3 * Corscience GmbH & Co.KG, Andreas Bießmann <biessmann@corscience.de>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #include <asm/sdram.h>
27 #include <asm/arch/clk.h>
28 #include <asm/arch/hmatrix.h>
29 #include <asm/arch/mmu.h>
30 #include <asm/arch/portmux.h>
33 DECLARE_GLOBAL_DATA_PTR;
35 struct mmu_vm_range mmu_vmr_table[CONFIG_SYS_NR_VM_REGIONS] = {
37 .virt_pgno = CONFIG_SYS_FLASH_BASE >> PAGE_SHIFT,
38 .nr_pages = CONFIG_SYS_FLASH_SIZE >> PAGE_SHIFT,
39 .phys = (CONFIG_SYS_FLASH_BASE >> PAGE_SHIFT)
42 .virt_pgno = CONFIG_SYS_SDRAM_BASE >> PAGE_SHIFT,
43 .nr_pages = EBI_SDRAM_SIZE >> PAGE_SHIFT,
44 .phys = (CONFIG_SYS_SDRAM_BASE >> PAGE_SHIFT)
45 | MMU_VMR_CACHE_WRBACK,
49 static const struct sdram_config sdram_config = {
50 /* Dual MT48LC16M16A2-7E (or equal) */
51 .data_bits = SDRAM_DATA_32BIT,
63 .refresh_period = (781 * (SDRAMC_BUS_HZ / 1000)) / 100000,
66 int board_early_init_f(void)
68 /* Enable SDRAM in the EBI mux */
69 hmatrix_slave_write(EBI, SFR, HMATRIX_BIT(EBI_SDRAM_ENABLE));
71 portmux_enable_ebi(SDRAM_DATA_32BIT, 23, 0, PORTMUX_DRIVE_HIGH);
72 portmux_enable_usart0(PORTMUX_DRIVE_MIN);
73 portmux_enable_usart1(PORTMUX_DRIVE_MIN);
74 #if defined(CONFIG_MACB)
75 /* set PHY reset and pwrdown to low */
76 portmux_select_gpio(PORTMUX_PORT_B, (1 << 29) | (1 << 30),
77 PORTMUX_DIR_OUTPUT | PORTMUX_INIT_LOW);
79 /* release PHYs reset */
80 gpio_set_value(GPIO_PIN_PB(29), 1);
82 portmux_enable_macb0(PORTMUX_MACB_MII, PORTMUX_DRIVE_LOW);
88 phys_size_t initdram(int board_type)
90 unsigned long expected_size;
91 unsigned long actual_size;
94 sdram_base = uncached(EBI_SDRAM_BASE);
96 expected_size = sdram_init(sdram_base, &sdram_config);
97 actual_size = get_ram_size(sdram_base, expected_size);
99 if (expected_size != actual_size)
100 printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
101 actual_size >> 20, expected_size >> 20);
106 int board_early_init_r(void)
108 gd->bd->bi_phy_id[0] = 0x00;
112 #ifdef CONFIG_CMD_NET
113 int board_eth_init(bd_t *bi)
115 macb_eth_initialize(0, (void *)ATMEL_BASE_MACB0, bi->bi_phy_id[0]);
119 /* vim: set noet ts=8: */