blob: 5d228fcc1632b6fe21583b3ac3b39366a6ff02c0 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Ulf Samuelssoncb82a532009-03-27 23:26:43 +01002/*
Andreas Bießmann09c2b8f2016-05-01 03:46:16 +02003 * (C) Copyright 2010 Andreas Bießmann <andreas@biessmann.org>
Andreas Bießmann99fa97e2010-10-18 22:58:29 +02004 *
5 * derived from previous work
6 *
Ulf Samuelssoncb82a532009-03-27 23:26:43 +01007 * (C) Copyright 2002
8 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
9 * Marius Groeger <mgroeger@sysgo.de>
Ulf Samuelssoncb82a532009-03-27 23:26:43 +010010 */
11
12#include <common.h>
Jens Scharsigc041e9d2010-01-23 12:03:45 +010013#include <netdev.h>
Simon Glassc62db352017-05-31 19:47:48 -060014#include <asm/mach-types.h>
Andreas Bießmann99fa97e2010-10-18 22:58:29 +020015#include <asm/arch/hardware.h>
16#include <asm/arch/at91_pio.h>
Andreas Bießmann3432a932011-06-12 01:49:14 +000017#include <asm/arch/at91_common.h>
Jens Scharsigc041e9d2010-01-23 12:03:45 +010018#include <asm/io.h>
Ulf Samuelssoncb82a532009-03-27 23:26:43 +010019
20DECLARE_GLOBAL_DATA_PTR;
21
22/* ------------------------------------------------------------------------- */
Andreas Bießmann99fa97e2010-10-18 22:58:29 +020023int board_init(void)
Ulf Samuelssoncb82a532009-03-27 23:26:43 +010024{
Andreas Bießmann99fa97e2010-10-18 22:58:29 +020025 at91_pio_t *pio = (at91_pio_t *)AT91_PIO_BASE;
Ulf Samuelssoncb82a532009-03-27 23:26:43 +010026
27 /*
28 * Correct IRDA resistor problem
29 * Set PA23_TXD in Output
30 */
Jens Scharsig80733992011-02-19 06:17:02 +000031 writel(ATMEL_PMX_AA_TXD2, &pio->pioa.oer);
Ulf Samuelssoncb82a532009-03-27 23:26:43 +010032
33 /* arch number of AT91RM9200EK-Board */
34 gd->bd->bi_arch_number = MACH_TYPE_AT91RM9200EK;
35 /* adress of boot parameters */
Andreas Bießmann99fa97e2010-10-18 22:58:29 +020036 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
Ulf Samuelssoncb82a532009-03-27 23:26:43 +010037
38 return 0;
39}
40
Andreas Bießmann3432a932011-06-12 01:49:14 +000041int board_early_init_f(void)
42{
43 at91_seriald_hw_init();
44 return 0;
45}
46
Ulf Samuelssoncb82a532009-03-27 23:26:43 +010047int dram_init (void)
48{
Andreas Bießmann99fa97e2010-10-18 22:58:29 +020049 /* dram_init must store complete ramsize in gd->ram_size */
Albert ARIBAUDa55d23c2011-07-03 05:55:33 +000050 gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
Andreas Bießmann99fa97e2010-10-18 22:58:29 +020051 CONFIG_SYS_SDRAM_SIZE);
Ulf Samuelssoncb82a532009-03-27 23:26:43 +010052 return 0;
53}
54
Jens Scharsigc041e9d2010-01-23 12:03:45 +010055#ifdef CONFIG_DRIVER_AT91EMAC
56int board_eth_init(bd_t *bis)
57{
Jens Scharsig80733992011-02-19 06:17:02 +000058 return at91emac_register(bis, (u32) ATMEL_BASE_EMAC);
Jens Scharsigc041e9d2010-01-23 12:03:45 +010059}
60#endif