Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Ulf Samuelsson | 07f9b4e | 2009-03-27 23:26:43 +0100 | [diff] [blame] | 2 | /* |
Andreas Bießmann | 07dafdb | 2016-05-01 03:46:16 +0200 | [diff] [blame] | 3 | * (C) Copyright 2010 Andreas Bießmann <andreas@biessmann.org> |
Andreas Bießmann | 65c6567 | 2010-10-18 22:58:29 +0200 | [diff] [blame] | 4 | * |
| 5 | * derived from previous work |
| 6 | * |
Ulf Samuelsson | 07f9b4e | 2009-03-27 23:26:43 +0100 | [diff] [blame] | 7 | * (C) Copyright 2002 |
| 8 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 9 | * Marius Groeger <mgroeger@sysgo.de> |
Ulf Samuelsson | 07f9b4e | 2009-03-27 23:26:43 +0100 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <common.h> |
Simon Glass | 8e16b1e | 2019-12-28 10:45:05 -0700 | [diff] [blame] | 13 | #include <init.h> |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 14 | #include <net.h> |
Jens Scharsig | dab7cb8 | 2010-01-23 12:03:45 +0100 | [diff] [blame] | 15 | #include <netdev.h> |
Simon Glass | 0ffb9d6 | 2017-05-31 19:47:48 -0600 | [diff] [blame] | 16 | #include <asm/mach-types.h> |
Andreas Bießmann | 65c6567 | 2010-10-18 22:58:29 +0200 | [diff] [blame] | 17 | #include <asm/arch/hardware.h> |
| 18 | #include <asm/arch/at91_pio.h> |
Andreas Bießmann | f9d3f91 | 2011-06-12 01:49:14 +0000 | [diff] [blame] | 19 | #include <asm/arch/at91_common.h> |
Jens Scharsig | dab7cb8 | 2010-01-23 12:03:45 +0100 | [diff] [blame] | 20 | #include <asm/io.h> |
Ulf Samuelsson | 07f9b4e | 2009-03-27 23:26:43 +0100 | [diff] [blame] | 21 | |
| 22 | DECLARE_GLOBAL_DATA_PTR; |
| 23 | |
| 24 | /* ------------------------------------------------------------------------- */ |
Andreas Bießmann | 65c6567 | 2010-10-18 22:58:29 +0200 | [diff] [blame] | 25 | int board_init(void) |
Ulf Samuelsson | 07f9b4e | 2009-03-27 23:26:43 +0100 | [diff] [blame] | 26 | { |
Andreas Bießmann | 65c6567 | 2010-10-18 22:58:29 +0200 | [diff] [blame] | 27 | at91_pio_t *pio = (at91_pio_t *)AT91_PIO_BASE; |
Ulf Samuelsson | 07f9b4e | 2009-03-27 23:26:43 +0100 | [diff] [blame] | 28 | |
| 29 | /* |
| 30 | * Correct IRDA resistor problem |
| 31 | * Set PA23_TXD in Output |
| 32 | */ |
Jens Scharsig | 58aa563 | 2011-02-19 06:17:02 +0000 | [diff] [blame] | 33 | writel(ATMEL_PMX_AA_TXD2, &pio->pioa.oer); |
Ulf Samuelsson | 07f9b4e | 2009-03-27 23:26:43 +0100 | [diff] [blame] | 34 | |
| 35 | /* arch number of AT91RM9200EK-Board */ |
| 36 | gd->bd->bi_arch_number = MACH_TYPE_AT91RM9200EK; |
| 37 | /* adress of boot parameters */ |
Andreas Bießmann | 65c6567 | 2010-10-18 22:58:29 +0200 | [diff] [blame] | 38 | gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; |
Ulf Samuelsson | 07f9b4e | 2009-03-27 23:26:43 +0100 | [diff] [blame] | 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | |
Andreas Bießmann | f9d3f91 | 2011-06-12 01:49:14 +0000 | [diff] [blame] | 43 | int board_early_init_f(void) |
| 44 | { |
| 45 | at91_seriald_hw_init(); |
| 46 | return 0; |
| 47 | } |
| 48 | |
Ulf Samuelsson | 07f9b4e | 2009-03-27 23:26:43 +0100 | [diff] [blame] | 49 | int dram_init (void) |
| 50 | { |
Andreas Bießmann | 65c6567 | 2010-10-18 22:58:29 +0200 | [diff] [blame] | 51 | /* dram_init must store complete ramsize in gd->ram_size */ |
Albert ARIBAUD | a960673 | 2011-07-03 05:55:33 +0000 | [diff] [blame] | 52 | gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, |
Andreas Bießmann | 65c6567 | 2010-10-18 22:58:29 +0200 | [diff] [blame] | 53 | CONFIG_SYS_SDRAM_SIZE); |
Ulf Samuelsson | 07f9b4e | 2009-03-27 23:26:43 +0100 | [diff] [blame] | 54 | return 0; |
| 55 | } |
Jens Scharsig | dab7cb8 | 2010-01-23 12:03:45 +0100 | [diff] [blame] | 56 | |
| 57 | #ifdef CONFIG_DRIVER_AT91EMAC |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 58 | int board_eth_init(struct bd_info *bis) |
Jens Scharsig | dab7cb8 | 2010-01-23 12:03:45 +0100 | [diff] [blame] | 59 | { |
Jens Scharsig | 58aa563 | 2011-02-19 06:17:02 +0000 | [diff] [blame] | 60 | return at91emac_register(bis, (u32) ATMEL_BASE_EMAC); |
Jens Scharsig | dab7cb8 | 2010-01-23 12:03:45 +0100 | [diff] [blame] | 61 | } |
| 62 | #endif |