2 * (C) Copyright 2004-2008
3 * Texas Instruments, <www.ti.com>
6 * Manikandan Pillai <mani.pillai@ti.com>
8 * Derived from Beagle Board and 3430 SDP code by
9 * Richard Woodruff <r-woodruff2@ti.com>
10 * Syed Mohammed Khasim <khasim@ti.com>
12 * See file CREDITS for list of people who contributed to this
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
33 #include <asm/arch/mem.h>
34 #include <asm/arch/mux.h>
35 #include <asm/arch/sys_proto.h>
36 #include <asm/arch/mmc_host_def.h>
37 #include <asm/arch/gpio.h>
39 #include <asm/mach-types.h>
42 #define OMAP3EVM_GPIO_ETH_RST_GEN1 64
43 #define OMAP3EVM_GPIO_ETH_RST_GEN2 7
45 DECLARE_GLOBAL_DATA_PTR;
47 static u32 omap3_evm_version;
49 u32 get_omap3_evm_rev(void)
51 return omap3_evm_version;
54 static void omap3_evm_get_revision(void)
56 #if defined(CONFIG_CMD_NET)
58 * Board revision can be ascertained only by identifying
59 * the Ethernet chipset.
63 /* Ethernet PHY ID is stored at ID_REV register */
64 smsc_id = readl(CONFIG_SMC911X_BASE + 0x50) & 0xFFFF0000;
65 printf("Read back SMSC id 0x%x\n", smsc_id);
68 /* SMSC9115 chipset */
70 omap3_evm_version = OMAP3EVM_BOARD_GEN_1;
72 /* SMSC 9220 chipset */
75 omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
78 #if defined(CONFIG_STATIC_BOARD_REV)
80 * Look for static defintion of the board revision
82 omap3_evm_version = CONFIG_STATIC_BOARD_REV;
85 * Fallback to the default above.
87 omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
89 #endif /* CONFIG_CMD_NET */
92 #ifdef CONFIG_USB_OMAP3
94 * MUSB port on OMAP3EVM Rev >= E requires extvbus programming.
96 u8 omap3_evm_need_extvbus(void)
100 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
108 * Routine: board_init
109 * Description: Early hardware init.
113 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
114 /* board id for Linux */
115 gd->bd->bi_arch_number = MACH_TYPE_OMAP3EVM;
116 /* boot param addr */
117 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
123 * Routine: misc_init_r
124 * Description: Init ethernet (done here so udelay works)
126 int misc_init_r(void)
129 #ifdef CONFIG_DRIVER_OMAP34XX_I2C
130 i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
133 #if defined(CONFIG_CMD_NET)
136 omap3_evm_get_revision();
138 #if defined(CONFIG_CMD_NET)
147 * Routine: set_muxconf_regs
148 * Description: Setting up the configuration Mux registers specific to the
149 * hardware. Many pins need to be moved from protect to primary
152 void set_muxconf_regs(void)
157 #ifdef CONFIG_CMD_NET
159 * Routine: setup_net_chip
160 * Description: Setting up the configuration GPMC registers specific to the
163 static void setup_net_chip(void)
165 struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
167 /* Configure GPMC registers */
168 writel(NET_GPMC_CONFIG1, &gpmc_cfg->cs[5].config1);
169 writel(NET_GPMC_CONFIG2, &gpmc_cfg->cs[5].config2);
170 writel(NET_GPMC_CONFIG3, &gpmc_cfg->cs[5].config3);
171 writel(NET_GPMC_CONFIG4, &gpmc_cfg->cs[5].config4);
172 writel(NET_GPMC_CONFIG5, &gpmc_cfg->cs[5].config5);
173 writel(NET_GPMC_CONFIG6, &gpmc_cfg->cs[5].config6);
174 writel(NET_GPMC_CONFIG7, &gpmc_cfg->cs[5].config7);
176 /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
177 writew(readw(&ctrl_base ->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
178 /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
179 writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
180 /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
181 writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
182 &ctrl_base->gpmc_nadv_ale);
186 * Reset the ethernet chip.
188 static void reset_net_chip(void)
193 if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1) {
194 rst_gpio = OMAP3EVM_GPIO_ETH_RST_GEN1;
196 rst_gpio = OMAP3EVM_GPIO_ETH_RST_GEN2;
199 ret = omap_request_gpio(rst_gpio);
201 printf("Unable to get GPIO %d\n", rst_gpio);
205 /* Configure as output */
206 omap_set_gpio_direction(rst_gpio, 0);
208 /* Send a pulse on the GPIO pin */
209 omap_set_gpio_dataout(rst_gpio, 1);
211 omap_set_gpio_dataout(rst_gpio, 0);
213 omap_set_gpio_dataout(rst_gpio, 1);
216 int board_eth_init(bd_t *bis)
219 #ifdef CONFIG_SMC911X
220 rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
224 #endif /* CONFIG_CMD_NET */
226 #ifdef CONFIG_GENERIC_MMC
227 int board_mmc_init(bd_t *bis)