blob: 36f147b44de0f5b46de364877e18f7171e1e4b8f [file] [log] [blame]
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +01001/*
Andreas Bießmann07dafdb2016-05-01 03:46:16 +02002 * (C) Copyright 2010 Andreas Bießmann <andreas@biessmann.org>
Andreas Bießmann65c65672010-10-18 22:58:29 +02003 *
4 * derived from previous work
5 *
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +01006 * (C) Copyright 2002
7 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
8 * Marius Groeger <mgroeger@sysgo.de>
9 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +020010 * SPDX-License-Identifier: GPL-2.0+
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010011 */
12
13#include <common.h>
Jens Scharsigdab7cb82010-01-23 12:03:45 +010014#include <netdev.h>
Simon Glass0ffb9d62017-05-31 19:47:48 -060015#include <asm/mach-types.h>
Andreas Bießmann65c65672010-10-18 22:58:29 +020016#include <asm/arch/hardware.h>
17#include <asm/arch/at91_pio.h>
Andreas Bießmannf9d3f912011-06-12 01:49:14 +000018#include <asm/arch/at91_common.h>
Jens Scharsigdab7cb82010-01-23 12:03:45 +010019#include <asm/io.h>
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010020
21DECLARE_GLOBAL_DATA_PTR;
22
23/* ------------------------------------------------------------------------- */
Andreas Bießmann65c65672010-10-18 22:58:29 +020024int board_init(void)
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010025{
Andreas Bießmann65c65672010-10-18 22:58:29 +020026 at91_pio_t *pio = (at91_pio_t *)AT91_PIO_BASE;
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010027
28 /*
29 * Correct IRDA resistor problem
30 * Set PA23_TXD in Output
31 */
Jens Scharsig58aa5632011-02-19 06:17:02 +000032 writel(ATMEL_PMX_AA_TXD2, &pio->pioa.oer);
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010033
34 /* arch number of AT91RM9200EK-Board */
35 gd->bd->bi_arch_number = MACH_TYPE_AT91RM9200EK;
36 /* adress of boot parameters */
Andreas Bießmann65c65672010-10-18 22:58:29 +020037 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010038
39 return 0;
40}
41
Andreas Bießmannf9d3f912011-06-12 01:49:14 +000042int board_early_init_f(void)
43{
44 at91_seriald_hw_init();
45 return 0;
46}
47
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010048int dram_init (void)
49{
Andreas Bießmann65c65672010-10-18 22:58:29 +020050 /* dram_init must store complete ramsize in gd->ram_size */
Albert ARIBAUDa9606732011-07-03 05:55:33 +000051 gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
Andreas Bießmann65c65672010-10-18 22:58:29 +020052 CONFIG_SYS_SDRAM_SIZE);
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010053 return 0;
54}
Jens Scharsigdab7cb82010-01-23 12:03:45 +010055
56#ifdef CONFIG_DRIVER_AT91EMAC
57int board_eth_init(bd_t *bis)
58{
Jens Scharsig58aa5632011-02-19 06:17:02 +000059 return at91emac_register(bis, (u32) ATMEL_BASE_EMAC);
Jens Scharsigdab7cb82010-01-23 12:03:45 +010060}
61#endif