Tom Rix | 3db7af7 | 2009-09-27 07:47:24 -0500 | [diff] [blame] | 1 | /* |
Eric Bénard | 62d2b62 | 2010-08-09 11:50:45 +0200 | [diff] [blame] | 2 | * (C) Copyright 2006-2010 Eukrea Electromatique <www.eukrea.com> |
Tom Rix | 3db7af7 | 2009-09-27 07:47:24 -0500 | [diff] [blame] | 3 | * Eric Benard <eric@eukrea.com> |
| 4 | * based on at91rm9200dk.c which is : |
| 5 | * (C) Copyright 2002 |
| 6 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 7 | * Marius Groeger <mgroeger@sysgo.de> |
| 8 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 9 | * SPDX-License-Identifier: GPL-2.0+ |
Tom Rix | 3db7af7 | 2009-09-27 07:47:24 -0500 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <common.h> |
Jens Scharsig | dab7cb8 | 2010-01-23 12:03:45 +0100 | [diff] [blame] | 13 | #include <netdev.h> |
Jens Scharsig | dab7cb8 | 2010-01-23 12:03:45 +0100 | [diff] [blame] | 14 | |
Eric Bénard | 62d2b62 | 2010-08-09 11:50:45 +0200 | [diff] [blame] | 15 | #include <asm/io.h> |
| 16 | #include <asm/arch/hardware.h> |
| 17 | #include <asm/arch/at91_pio.h> |
| 18 | #include <asm/arch/at91_pmc.h> |
Andreas Bießmann | a631d2b | 2011-06-12 01:49:16 +0000 | [diff] [blame] | 19 | #include <asm/arch/at91_common.h> |
Tom Rix | 3db7af7 | 2009-09-27 07:47:24 -0500 | [diff] [blame] | 20 | |
| 21 | DECLARE_GLOBAL_DATA_PTR; |
| 22 | |
| 23 | /* ------------------------------------------------------------------------- */ |
| 24 | /* |
| 25 | * Miscelaneous platform dependent initialisations |
| 26 | */ |
| 27 | |
| 28 | int board_init(void) |
| 29 | { |
Tom Rix | 3db7af7 | 2009-09-27 07:47:24 -0500 | [diff] [blame] | 30 | /* arch number of CPUAT91-Board */ |
| 31 | gd->bd->bi_arch_number = MACH_TYPE_CPUAT91; |
| 32 | /* adress of boot parameters */ |
Eric Benard | c2e1f23 | 2011-04-03 06:35:55 +0000 | [diff] [blame] | 33 | gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; |
Tom Rix | 3db7af7 | 2009-09-27 07:47:24 -0500 | [diff] [blame] | 34 | |
| 35 | return 0; |
| 36 | } |
| 37 | |
Andreas Bießmann | a631d2b | 2011-06-12 01:49:16 +0000 | [diff] [blame] | 38 | int board_early_init_f(void) |
| 39 | { |
| 40 | at91_seriald_hw_init(); |
| 41 | return 0; |
| 42 | } |
| 43 | |
| 44 | |
Tom Rix | 3db7af7 | 2009-09-27 07:47:24 -0500 | [diff] [blame] | 45 | int dram_init(void) |
| 46 | { |
Eric Benard | c2e1f23 | 2011-04-03 06:35:55 +0000 | [diff] [blame] | 47 | /* dram_init must store complete ramsize in gd->ram_size */ |
Albert ARIBAUD | a960673 | 2011-07-03 05:55:33 +0000 | [diff] [blame] | 48 | gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, |
Eric Benard | c2e1f23 | 2011-04-03 06:35:55 +0000 | [diff] [blame] | 49 | CONFIG_SYS_SDRAM_SIZE); |
Tom Rix | 3db7af7 | 2009-09-27 07:47:24 -0500 | [diff] [blame] | 50 | return 0; |
| 51 | } |
| 52 | |
Jens Scharsig | dab7cb8 | 2010-01-23 12:03:45 +0100 | [diff] [blame] | 53 | #ifdef CONFIG_DRIVER_AT91EMAC |
Jens Scharsig | dab7cb8 | 2010-01-23 12:03:45 +0100 | [diff] [blame] | 54 | int board_eth_init(bd_t *bis) |
| 55 | { |
Eric Benard | 0159891 | 2011-06-06 22:48:29 +0000 | [diff] [blame] | 56 | return at91emac_register(bis, (u32) ATMEL_BASE_EMAC); |
Jens Scharsig | dab7cb8 | 2010-01-23 12:03:45 +0100 | [diff] [blame] | 57 | } |
| 58 | #endif |
Eric Bénard | 62d2b62 | 2010-08-09 11:50:45 +0200 | [diff] [blame] | 59 | |
Heiko Schocher | 479a4cf | 2013-01-29 08:53:15 +0100 | [diff] [blame] | 60 | #ifdef CONFIG_SYS_I2C_SOFT |
Eric Bénard | 62d2b62 | 2010-08-09 11:50:45 +0200 | [diff] [blame] | 61 | void i2c_init_board(void) |
| 62 | { |
| 63 | u32 pin; |
Eric Benard | 0159891 | 2011-06-06 22:48:29 +0000 | [diff] [blame] | 64 | at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; |
| 65 | at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIO; |
Eric Bénard | 62d2b62 | 2010-08-09 11:50:45 +0200 | [diff] [blame] | 66 | |
| 67 | writel(1 << AT91_ID_PIOA, &pmc->pcer); |
| 68 | pin = AT91_PMX_AA_TWD | AT91_PMX_AA_TWCK; |
| 69 | writel(pin, &pio->pioa.idr); |
| 70 | writel(pin, &pio->pioa.pudr); |
| 71 | writel(pin, &pio->pioa.per); |
| 72 | writel(pin, &pio->pioa.oer); |
| 73 | writel(pin, &pio->pioa.sodr); |
| 74 | } |
| 75 | #endif |