4 * Board functions for TI814x EVM
6 * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
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.
23 #include <asm/arch/cpu.h>
24 #include <asm/arch/hardware.h>
25 #include <asm/arch/omap.h>
26 #include <asm/arch/ddr_defs.h>
27 #include <asm/arch/clock.h>
28 #include <asm/arch/gpio.h>
29 #include <asm/arch/mmc_host_def.h>
30 #include <asm/arch/sys_proto.h>
36 DECLARE_GLOBAL_DATA_PTR;
38 #ifdef CONFIG_SPL_BUILD
39 static struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
42 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
45 #ifdef CONFIG_SPL_BUILD
46 static void uart_enable(void)
52 static void wdt_disable(void)
54 writel(0xAAAA, &wdtimer->wdtwspr);
55 while (readl(&wdtimer->wdtwwps) != 0x0)
57 writel(0x5555, &wdtimer->wdtwspr);
58 while (readl(&wdtimer->wdtwwps) != 0x0)
62 static const struct cmd_control evm_ddr2_cctrl_data = {
76 static const struct emif_regs evm_ddr2_emif0_regs = {
77 .sdram_config = 0x40801ab2,
78 .ref_ctrl = 0x10000c30,
79 .sdram_tim1 = 0x0aaaf552,
80 .sdram_tim2 = 0x043631d2,
81 .sdram_tim3 = 0x00000327,
82 .emif_ddr_phy_ctlr_1 = 0x00000007
85 static const struct emif_regs evm_ddr2_emif1_regs = {
86 .sdram_config = 0x40801ab2,
87 .ref_ctrl = 0x10000c30,
88 .sdram_tim1 = 0x0aaaf552,
89 .sdram_tim2 = 0x043631d2,
90 .sdram_tim3 = 0x00000327,
91 .emif_ddr_phy_ctlr_1 = 0x00000007
94 const struct dmm_lisa_map_regs evm_lisa_map_regs = {
95 .dmm_lisa_map_0 = 0x00000000,
96 .dmm_lisa_map_1 = 0x00000000,
97 .dmm_lisa_map_2 = 0x806c0300,
98 .dmm_lisa_map_3 = 0x806c0300,
101 static const struct ddr_data evm_ddr2_data = {
102 .datardsratio0 = ((0x35<<10) | (0x35<<0)),
103 .datawdsratio0 = ((0x20<<10) | (0x20<<0)),
104 .datawiratio0 = ((0<<10) | (0<<0)),
105 .datagiratio0 = ((0<<10) | (0<<0)),
106 .datafwsratio0 = ((0x90<<10) | (0x90<<0)),
107 .datawrsratio0 = ((0x50<<10) | (0x50<<0)),
108 .datauserank0delay = 1,
114 * early system init of muxing and clocks.
118 #ifdef CONFIG_SPL_BUILD
120 * Save the boot parameters passed from romcode.
121 * We cannot delay the saving further than this,
122 * to prevent overwrites.
124 #ifdef CONFIG_SPL_BUILD
125 save_omap_boot_params();
128 /* WDT1 is already running when the bootloader gets control
129 * Disable it to avoid "random" resets
136 /* Setup the PLLs and the clocks for the peripherals */
139 /* Enable RTC32K clock */
143 enable_uart0_pin_mux();
146 enable_mmc1_pin_mux();
148 /* Set Ethernet pins */
149 enable_enet_pin_mux();
156 preloader_console_init();
158 config_dmm(&evm_lisa_map_regs);
160 config_ddr(0, 0, &evm_ddr2_data, &evm_ddr2_cctrl_data,
161 &evm_ddr2_emif0_regs, 0);
162 config_ddr(0, 0, &evm_ddr2_data, &evm_ddr2_cctrl_data,
163 &evm_ddr2_emif1_regs, 1);
168 * Basic board specific setup. Pinmux has been handled already.
172 gd->bd->bi_boot_params = PHYS_DRAM_1 + 0x100;
176 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
177 int board_mmc_init(bd_t *bis)
179 omap_mmc_init(1, 0, 0, -1, -1);
185 #ifdef CONFIG_DRIVER_TI_CPSW
186 static void cpsw_control(int enabled)
188 /* VTP can be added here */
193 static struct cpsw_slave_data cpsw_slaves[] = {
195 .slave_reg_ofs = 0x50,
196 .sliver_reg_ofs = 0x700,
200 .slave_reg_ofs = 0x90,
201 .sliver_reg_ofs = 0x740,
206 static struct cpsw_platform_data cpsw_data = {
207 .mdio_base = CPSW_MDIO_BASE,
208 .cpsw_base = CPSW_BASE,
211 .cpdma_reg_ofs = 0x100,
213 .slave_data = cpsw_slaves,
214 .ale_reg_ofs = 0x600,
216 .host_port_reg_ofs = 0x28,
217 .hw_stats_reg_ofs = 0x400,
218 .mac_control = (1 << 5),
219 .control = cpsw_control,
221 .version = CPSW_CTRL_VERSION_1,
225 int board_eth_init(bd_t *bis)
228 uint32_t mac_hi, mac_lo;
230 if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
231 printf("<ethaddr> not set. Reading from E-fuse\n");
232 /* try reading mac address from efuse */
233 mac_lo = readl(&cdev->macid0l);
234 mac_hi = readl(&cdev->macid0h);
235 mac_addr[0] = mac_hi & 0xFF;
236 mac_addr[1] = (mac_hi & 0xFF00) >> 8;
237 mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
238 mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
239 mac_addr[4] = mac_lo & 0xFF;
240 mac_addr[5] = (mac_lo & 0xFF00) >> 8;
242 if (is_valid_ether_addr(mac_addr))
243 eth_setenv_enetaddr("ethaddr", mac_addr);
245 printf("Unable to read MAC address. Set <ethaddr>\n");
248 return cpsw_register(&cpsw_data);