2 * Maintainer : Steve Sakoman <steve@sakoman.com>
4 * Derived from Beagle Board, 3430 SDP, and OMAP3EVM code by
5 * Richard Woodruff <r-woodruff2@ti.com>
6 * Syed Mohammed Khasim <khasim@ti.com>
7 * Sunil Kumar <sunilsaini05@gmail.com>
8 * Shashi Ranjan <shashiranjanmca05@gmail.com>
10 * (C) Copyright 2004-2008
11 * Texas Instruments, <www.ti.com>
13 * See file CREDITS for list of people who contributed to this
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
35 #include <asm/arch/mmc_host_def.h>
36 #include <asm/arch/mux.h>
37 #include <asm/arch/mem.h>
38 #include <asm/arch/sys_proto.h>
39 #include <asm/arch/omap_gpmc.h>
41 #include <asm/mach-types.h>
44 DECLARE_GLOBAL_DATA_PTR;
46 #define TWL4030_I2C_BUS 0
47 #define EXPANSION_EEPROM_I2C_BUS 2
48 #define EXPANSION_EEPROM_I2C_ADDRESS 0x51
50 #define GUMSTIX_SUMMIT 0x01000200
51 #define GUMSTIX_TOBI 0x02000200
52 #define GUMSTIX_TOBI_DUO 0x03000200
53 #define GUMSTIX_PALO35 0x04000200
54 #define GUMSTIX_PALO43 0x05000200
55 #define GUMSTIX_CHESTNUT43 0x06000200
56 #define GUMSTIX_PINTO 0x07000200
57 #define GUMSTIX_GALLOP43 0x08000200
59 #define ETTUS_USRP_E 0x01000300
61 #define GUMSTIX_NO_EEPROM 0xffffffff
64 unsigned int device_vendor;
65 unsigned char revision;
66 unsigned char content;
72 #if defined(CONFIG_CMD_NET)
73 static void setup_net_chip(void);
76 /* GPMC definitions for LAN9221 chips on Tobi expansion boards */
77 static const u32 gpmc_lan_config[] = {
78 NET_LAN9221_GPMC_CONFIG1,
79 NET_LAN9221_GPMC_CONFIG2,
80 NET_LAN9221_GPMC_CONFIG3,
81 NET_LAN9221_GPMC_CONFIG4,
82 NET_LAN9221_GPMC_CONFIG5,
83 NET_LAN9221_GPMC_CONFIG6,
84 /*CONFIG7- computed as params */
89 * Description: Early hardware init.
93 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
94 /* board id for Linux */
95 gd->bd->bi_arch_number = MACH_TYPE_OVERO;
97 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
103 * Routine: get_board_revision
104 * Description: Returns the board revision
106 int get_board_revision(void)
110 if (!gpio_request(112, "") &&
111 !gpio_request(113, "") &&
112 !gpio_request(115, "")) {
114 gpio_direction_input(112);
115 gpio_direction_input(113);
116 gpio_direction_input(115);
118 revision = gpio_get_value(115) << 2 |
119 gpio_get_value(113) << 1 |
126 printf("Error: unable to acquire board revision GPIOs\n");
134 * Routine: get_sdio2_config
135 * Description: Return information about the wifi module connection
136 * Returns 0 if the module connects though a level translator
137 * Returns 1 if the module connects directly
139 int get_sdio2_config(void)
143 if (!gpio_request(130, "") && !gpio_request(139, "")) {
145 gpio_direction_output(130, 0);
146 gpio_direction_input(139);
149 gpio_set_value(130, 0);
150 if (gpio_get_value(139) == 0) {
151 gpio_set_value(130, 1);
152 if (gpio_get_value(139) == 1)
159 printf("Error: unable to acquire sdio2 clk GPIOs\n");
167 * Routine: get_expansion_id
168 * Description: This function checks for expansion board by checking I2C
169 * bus 2 for the availability of an AT24C01B serial EEPROM.
170 * returns the device_vendor field from the EEPROM
172 unsigned int get_expansion_id(void)
174 i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS);
176 /* return GUMSTIX_NO_EEPROM if eeprom doesn't respond */
177 if (i2c_probe(EXPANSION_EEPROM_I2C_ADDRESS) == 1) {
178 i2c_set_bus_num(TWL4030_I2C_BUS);
179 return GUMSTIX_NO_EEPROM;
182 /* read configuration data */
183 i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config,
184 sizeof(expansion_config));
186 i2c_set_bus_num(TWL4030_I2C_BUS);
188 return expansion_config.device_vendor;
192 * Routine: misc_init_r
193 * Description: Configure board specific parts
195 int misc_init_r(void)
197 twl4030_power_init();
198 twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
200 #if defined(CONFIG_CMD_NET)
204 printf("Board revision: %d\n", get_board_revision());
206 switch (get_sdio2_config()) {
208 printf("Tranceiver detected on mmc2\n");
209 MUX_OVERO_SDIO2_TRANSCEIVER();
212 printf("Direct connection on mmc2\n");
213 MUX_OVERO_SDIO2_DIRECT();
216 printf("Unable to detect mmc2 connection type\n");
219 switch (get_expansion_id()) {
221 printf("Recognized Summit expansion board (rev %d %s)\n",
222 expansion_config.revision,
223 expansion_config.fab_revision);
224 setenv("defaultdisplay", "dvi");
227 printf("Recognized Tobi expansion board (rev %d %s)\n",
228 expansion_config.revision,
229 expansion_config.fab_revision);
230 setenv("defaultdisplay", "dvi");
232 case GUMSTIX_TOBI_DUO:
233 printf("Recognized Tobi Duo expansion board (rev %d %s)\n",
234 expansion_config.revision,
235 expansion_config.fab_revision);
238 printf("Recognized Palo35 expansion board (rev %d %s)\n",
239 expansion_config.revision,
240 expansion_config.fab_revision);
241 setenv("defaultdisplay", "lcd35");
244 printf("Recognized Palo43 expansion board (rev %d %s)\n",
245 expansion_config.revision,
246 expansion_config.fab_revision);
247 setenv("defaultdisplay", "lcd43");
249 case GUMSTIX_CHESTNUT43:
250 printf("Recognized Chestnut43 expansion board (rev %d %s)\n",
251 expansion_config.revision,
252 expansion_config.fab_revision);
253 setenv("defaultdisplay", "lcd43");
256 printf("Recognized Pinto expansion board (rev %d %s)\n",
257 expansion_config.revision,
258 expansion_config.fab_revision);
260 case GUMSTIX_GALLOP43:
261 printf("Recognized Gallop43 expansion board (rev %d %s)\n",
262 expansion_config.revision,
263 expansion_config.fab_revision);
264 setenv("defaultdisplay", "lcd43");
267 printf("Recognized Ettus Research USRP-E (rev %d %s)\n",
268 expansion_config.revision,
269 expansion_config.fab_revision);
271 setenv("defaultdisplay", "dvi");
273 case GUMSTIX_NO_EEPROM:
274 printf("No EEPROM on expansion board\n");
277 printf("Unrecognized expansion board\n");
280 if (expansion_config.content == 1)
281 setenv(expansion_config.env_var, expansion_config.env_setting);
289 * Routine: set_muxconf_regs
290 * Description: Setting up the configuration Mux registers specific to the
291 * hardware. Many pins need to be moved from protect to primary
294 void set_muxconf_regs(void)
299 #if defined(CONFIG_CMD_NET)
301 * Routine: setup_net_chip
302 * Description: Setting up the configuration GPMC registers specific to the
305 static void setup_net_chip(void)
307 struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
310 enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5], 0x2C000000,
313 /* second lan chip */
314 enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[4], 0x2B000000,
317 /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
318 writew(readw(&ctrl_base ->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
319 /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
320 writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
321 /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
322 writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
323 &ctrl_base->gpmc_nadv_ale);
325 /* Make GPIO 64 as output pin and send a magic pulse through it */
326 if (!gpio_request(64, "")) {
327 gpio_direction_output(64, 0);
328 gpio_set_value(64, 1);
330 gpio_set_value(64, 0);
332 gpio_set_value(64, 1);
337 int board_eth_init(bd_t *bis)
340 #ifdef CONFIG_SMC911X
341 rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
346 #ifdef CONFIG_GENERIC_MMC
347 int board_mmc_init(bd_t *bis)