]> git.ipfire.org Git - people/ms/u-boot.git/blob - board/eukrea/cpuat91/cpuat91.c
Merge branch 'master' of git://git.denx.de/u-boot-i2c
[people/ms/u-boot.git] / board / eukrea / cpuat91 / cpuat91.c
1 /*
2 * (C) Copyright 2006-2010 Eukrea Electromatique <www.eukrea.com>
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 *
9 * SPDX-License-Identifier: GPL-2.0+
10 */
11
12 #include <common.h>
13 #include <netdev.h>
14
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>
19 #include <asm/arch/at91_common.h>
20
21 DECLARE_GLOBAL_DATA_PTR;
22
23 /* ------------------------------------------------------------------------- */
24 /*
25 * Miscelaneous platform dependent initialisations
26 */
27
28 int board_init(void)
29 {
30 /* arch number of CPUAT91-Board */
31 gd->bd->bi_arch_number = MACH_TYPE_CPUAT91;
32 /* adress of boot parameters */
33 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
34
35 return 0;
36 }
37
38 int board_early_init_f(void)
39 {
40 at91_seriald_hw_init();
41 return 0;
42 }
43
44
45 int dram_init(void)
46 {
47 /* dram_init must store complete ramsize in gd->ram_size */
48 gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
49 CONFIG_SYS_SDRAM_SIZE);
50 return 0;
51 }
52
53 #ifdef CONFIG_DRIVER_AT91EMAC
54 int board_eth_init(bd_t *bis)
55 {
56 return at91emac_register(bis, (u32) ATMEL_BASE_EMAC);
57 }
58 #endif
59
60 #ifdef CONFIG_SYS_I2C_SOFT
61 void i2c_init_board(void)
62 {
63 u32 pin;
64 at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
65 at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIO;
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