blob: ec0ce0b205c4c31bbd2ab2463f1c589346dbe2a5 [file] [log] [blame]
Tom Rix3db7af72009-09-27 07:47:24 -05001/*
Eric Bénard62d2b622010-08-09 11:50:45 +02002 * (C) Copyright 2006-2010 Eukrea Electromatique <www.eukrea.com>
Tom Rix3db7af72009-09-27 07:47:24 -05003 * 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 Denkd79de1d2013-07-08 09:37:19 +02009 * SPDX-License-Identifier: GPL-2.0+
Tom Rix3db7af72009-09-27 07:47:24 -050010 */
11
12#include <common.h>
Jens Scharsigdab7cb82010-01-23 12:03:45 +010013#include <netdev.h>
Jens Scharsigdab7cb82010-01-23 12:03:45 +010014
Eric Bénard62d2b622010-08-09 11:50:45 +020015#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ßmanna631d2b2011-06-12 01:49:16 +000019#include <asm/arch/at91_common.h>
Tom Rix3db7af72009-09-27 07:47:24 -050020
21DECLARE_GLOBAL_DATA_PTR;
22
23/* ------------------------------------------------------------------------- */
24/*
25 * Miscelaneous platform dependent initialisations
26 */
27
28int board_init(void)
29{
Tom Rix3db7af72009-09-27 07:47:24 -050030 /* arch number of CPUAT91-Board */
31 gd->bd->bi_arch_number = MACH_TYPE_CPUAT91;
32 /* adress of boot parameters */
Eric Benardc2e1f232011-04-03 06:35:55 +000033 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
Tom Rix3db7af72009-09-27 07:47:24 -050034
35 return 0;
36}
37
Andreas Bießmanna631d2b2011-06-12 01:49:16 +000038int board_early_init_f(void)
39{
40 at91_seriald_hw_init();
41 return 0;
42}
43
44
Tom Rix3db7af72009-09-27 07:47:24 -050045int dram_init(void)
46{
Eric Benardc2e1f232011-04-03 06:35:55 +000047 /* dram_init must store complete ramsize in gd->ram_size */
Albert ARIBAUDa9606732011-07-03 05:55:33 +000048 gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
Eric Benardc2e1f232011-04-03 06:35:55 +000049 CONFIG_SYS_SDRAM_SIZE);
Tom Rix3db7af72009-09-27 07:47:24 -050050 return 0;
51}
52
Jens Scharsigdab7cb82010-01-23 12:03:45 +010053#ifdef CONFIG_DRIVER_AT91EMAC
Jens Scharsigdab7cb82010-01-23 12:03:45 +010054int board_eth_init(bd_t *bis)
55{
Eric Benard01598912011-06-06 22:48:29 +000056 return at91emac_register(bis, (u32) ATMEL_BASE_EMAC);
Jens Scharsigdab7cb82010-01-23 12:03:45 +010057}
58#endif
Eric Bénard62d2b622010-08-09 11:50:45 +020059
Heiko Schocher479a4cf2013-01-29 08:53:15 +010060#ifdef CONFIG_SYS_I2C_SOFT
Eric Bénard62d2b622010-08-09 11:50:45 +020061void i2c_init_board(void)
62{
63 u32 pin;
Eric Benard01598912011-06-06 22:48:29 +000064 at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
65 at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIO;
Eric Bénard62d2b622010-08-09 11:50:45 +020066
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