blob: a314ced5e4a5498a8d6f41cbe28e1ab8273a631b [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +01002/*
Andreas Bießmann07dafdb2016-05-01 03:46:16 +02003 * (C) Copyright 2010 Andreas Bießmann <andreas@biessmann.org>
Andreas Bießmann65c65672010-10-18 22:58:29 +02004 *
5 * derived from previous work
6 *
Ulf Samuelsson07f9b4e2009-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 Samuelsson07f9b4e2009-03-27 23:26:43 +010010 */
11
12#include <common.h>
Simon Glass8e16b1e2019-12-28 10:45:05 -070013#include <init.h>
Simon Glass274e0b02020-05-10 11:39:56 -060014#include <net.h>
Jens Scharsigdab7cb82010-01-23 12:03:45 +010015#include <netdev.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060016#include <asm/global_data.h>
Simon Glass0ffb9d62017-05-31 19:47:48 -060017#include <asm/mach-types.h>
Andreas Bießmann65c65672010-10-18 22:58:29 +020018#include <asm/arch/hardware.h>
19#include <asm/arch/at91_pio.h>
Andreas Bießmannf9d3f912011-06-12 01:49:14 +000020#include <asm/arch/at91_common.h>
Jens Scharsigdab7cb82010-01-23 12:03:45 +010021#include <asm/io.h>
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010022
23DECLARE_GLOBAL_DATA_PTR;
24
25/* ------------------------------------------------------------------------- */
Andreas Bießmann65c65672010-10-18 22:58:29 +020026int board_init(void)
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010027{
Andreas Bießmann65c65672010-10-18 22:58:29 +020028 at91_pio_t *pio = (at91_pio_t *)AT91_PIO_BASE;
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010029
30 /*
31 * Correct IRDA resistor problem
32 * Set PA23_TXD in Output
33 */
Jens Scharsig58aa5632011-02-19 06:17:02 +000034 writel(ATMEL_PMX_AA_TXD2, &pio->pioa.oer);
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010035
36 /* arch number of AT91RM9200EK-Board */
37 gd->bd->bi_arch_number = MACH_TYPE_AT91RM9200EK;
38 /* adress of boot parameters */
Andreas Bießmann65c65672010-10-18 22:58:29 +020039 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010040
41 return 0;
42}
43
Andreas Bießmannf9d3f912011-06-12 01:49:14 +000044int board_early_init_f(void)
45{
46 at91_seriald_hw_init();
47 return 0;
48}
49
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010050int dram_init (void)
51{
Andreas Bießmann65c65672010-10-18 22:58:29 +020052 /* dram_init must store complete ramsize in gd->ram_size */
Albert ARIBAUDa9606732011-07-03 05:55:33 +000053 gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
Andreas Bießmann65c65672010-10-18 22:58:29 +020054 CONFIG_SYS_SDRAM_SIZE);
Ulf Samuelsson07f9b4e2009-03-27 23:26:43 +010055 return 0;
56}
Jens Scharsigdab7cb82010-01-23 12:03:45 +010057
58#ifdef CONFIG_DRIVER_AT91EMAC
Masahiro Yamadaf7ed78b2020-06-26 15:13:33 +090059int board_eth_init(struct bd_info *bis)
Jens Scharsigdab7cb82010-01-23 12:03:45 +010060{
Jens Scharsig58aa5632011-02-19 06:17:02 +000061 return at91emac_register(bis, (u32) ATMEL_BASE_EMAC);
Jens Scharsigdab7cb82010-01-23 12:03:45 +010062}
63#endif