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 * SPDX-License-Identifier: GPL-2.0+
20 #include <linux/mtd/nand.h>
22 #include <asm/arch/mmc_host_def.h>
23 #include <asm/arch/mux.h>
24 #include <asm/arch/mem.h>
25 #include <asm/arch/sys_proto.h>
27 #include <asm/mach-types.h>
30 #ifdef CONFIG_USB_EHCI
32 #include <asm/ehci-omap.h>
35 DECLARE_GLOBAL_DATA_PTR;
37 #define TWL4030_I2C_BUS 0
38 #define EXPANSION_EEPROM_I2C_BUS 2
39 #define EXPANSION_EEPROM_I2C_ADDRESS 0x51
41 #define GUMSTIX_EMPTY_EEPROM 0x0
43 #define GUMSTIX_SUMMIT 0x01000200
44 #define GUMSTIX_TOBI 0x02000200
45 #define GUMSTIX_TOBI_DUO 0x03000200
46 #define GUMSTIX_PALO35 0x04000200
47 #define GUMSTIX_PALO43 0x05000200
48 #define GUMSTIX_CHESTNUT43 0x06000200
49 #define GUMSTIX_PINTO 0x07000200
50 #define GUMSTIX_GALLOP43 0x08000200
51 #define GUMSTIX_ALTO35 0x09000200
52 #define GUMSTIX_STAGECOACH 0x0A000200
53 #define GUMSTIX_THUMBO 0x0B000200
54 #define GUMSTIX_TURTLECORE 0x0C000200
55 #define GUMSTIX_ARBOR43C 0x0D000200
57 #define ETTUS_USRP_E 0x01000300
59 #define GUMSTIX_NO_EEPROM 0xffffffff
62 unsigned int device_vendor;
63 unsigned char revision;
64 unsigned char content;
68 } expansion_config = {0x0};
70 static const struct ns16550_platdata overo_serial = {
76 U_BOOT_DEVICE(overo_uart) = {
82 * Routine: get_sdio2_config
83 * Description: Return information about the wifi module connection
84 * Returns 0 if the module connects though a level translator
85 * Returns 1 if the module connects directly
87 int get_sdio2_config(void)
91 if (!gpio_request(130, "") && !gpio_request(139, "")) {
93 gpio_direction_output(130, 0);
94 gpio_direction_input(139);
97 gpio_set_value(130, 0);
98 if (gpio_get_value(139) == 0) {
99 gpio_set_value(130, 1);
100 if (gpio_get_value(139) == 1)
104 gpio_direction_input(130);
106 puts("Error: unable to acquire sdio2 clk GPIOs\n");
114 * Routine: get_expansion_id
115 * Description: This function checks for expansion board by checking I2C
116 * bus 2 for the availability of an AT24C01B serial EEPROM.
117 * returns the device_vendor field from the EEPROM
119 unsigned int get_expansion_id(void)
121 if (expansion_config.device_vendor != 0x0)
122 return expansion_config.device_vendor;
124 i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS);
126 /* return GUMSTIX_NO_EEPROM if eeprom doesn't respond */
127 if (i2c_probe(EXPANSION_EEPROM_I2C_ADDRESS) == 1) {
128 i2c_set_bus_num(TWL4030_I2C_BUS);
129 return GUMSTIX_NO_EEPROM;
132 /* read configuration data */
133 i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config,
134 sizeof(expansion_config));
136 i2c_set_bus_num(TWL4030_I2C_BUS);
138 return expansion_config.device_vendor;
142 * Routine: misc_init_r
143 * Description: Configure board specific parts
145 int misc_init_r(void)
147 unsigned int expansion_id;
149 twl4030_power_init();
150 twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
152 printf("Board revision: %d\n", get_board_revision());
154 switch (get_sdio2_config()) {
156 puts("Tranceiver detected on mmc2\n");
157 MUX_OVERO_SDIO2_TRANSCEIVER();
160 puts("Direct connection on mmc2\n");
161 MUX_OVERO_SDIO2_DIRECT();
164 puts("Unable to detect mmc2 connection type\n");
167 expansion_id = get_expansion_id();
168 switch (expansion_id) {
170 printf("Recognized Summit expansion board (rev %d %s)\n",
171 expansion_config.revision,
172 expansion_config.fab_revision);
174 setenv("defaultdisplay", "dvi");
175 setenv("expansionname", "summit");
178 printf("Recognized Tobi expansion board (rev %d %s)\n",
179 expansion_config.revision,
180 expansion_config.fab_revision);
182 setenv("defaultdisplay", "dvi");
183 setenv("expansionname", "tobi");
185 case GUMSTIX_TOBI_DUO:
186 printf("Recognized Tobi Duo expansion board (rev %d %s)\n",
187 expansion_config.revision,
188 expansion_config.fab_revision);
190 setenv("expansionname", "tobiduo");
193 printf("Recognized Palo35 expansion board (rev %d %s)\n",
194 expansion_config.revision,
195 expansion_config.fab_revision);
197 setenv("defaultdisplay", "lcd35");
198 setenv("expansionname", "palo35");
201 printf("Recognized Palo43 expansion board (rev %d %s)\n",
202 expansion_config.revision,
203 expansion_config.fab_revision);
205 setenv("defaultdisplay", "lcd43");
206 setenv("expansionname", "palo43");
208 case GUMSTIX_CHESTNUT43:
209 printf("Recognized Chestnut43 expansion board (rev %d %s)\n",
210 expansion_config.revision,
211 expansion_config.fab_revision);
213 setenv("defaultdisplay", "lcd43");
214 setenv("expansionname", "chestnut43");
217 printf("Recognized Pinto expansion board (rev %d %s)\n",
218 expansion_config.revision,
219 expansion_config.fab_revision);
222 case GUMSTIX_GALLOP43:
223 printf("Recognized Gallop43 expansion board (rev %d %s)\n",
224 expansion_config.revision,
225 expansion_config.fab_revision);
227 setenv("defaultdisplay", "lcd43");
228 setenv("expansionname", "gallop43");
231 printf("Recognized Alto35 expansion board (rev %d %s)\n",
232 expansion_config.revision,
233 expansion_config.fab_revision);
236 setenv("defaultdisplay", "lcd35");
237 setenv("expansionname", "alto35");
239 case GUMSTIX_STAGECOACH:
240 printf("Recognized Stagecoach expansion board (rev %d %s)\n",
241 expansion_config.revision,
242 expansion_config.fab_revision);
246 printf("Recognized Thumbo expansion board (rev %d %s)\n",
247 expansion_config.revision,
248 expansion_config.fab_revision);
251 case GUMSTIX_TURTLECORE:
252 printf("Recognized Turtlecore expansion board (rev %d %s)\n",
253 expansion_config.revision,
254 expansion_config.fab_revision);
257 case GUMSTIX_ARBOR43C:
258 printf("Recognized Arbor43C expansion board (rev %d %s)\n",
259 expansion_config.revision,
260 expansion_config.fab_revision);
263 setenv("defaultdisplay", "lcd43");
264 setenv("expansionname", "arbor43c");
267 printf("Recognized Ettus Research USRP-E (rev %d %s)\n",
268 expansion_config.revision,
269 expansion_config.fab_revision);
272 setenv("defaultdisplay", "dvi");
274 case GUMSTIX_NO_EEPROM:
275 case GUMSTIX_EMPTY_EEPROM:
276 puts("No or empty EEPROM on expansion board\n");
278 setenv("expansionname", "tobi");
281 printf("Unrecognized expansion board 0x%08x\n", expansion_id);
285 if (expansion_config.content == 1)
286 setenv(expansion_config.env_var, expansion_config.env_setting);
290 if (get_cpu_family() == CPU_OMAP34XX)
291 setenv("boardname", "overo");
293 setenv("boardname", "overo-storm");
298 #if defined(CONFIG_CMD_NET)
299 /* GPMC definitions for LAN9221 chips on Tobi expansion boards */
300 static const u32 gpmc_lan_config[] = {
301 NET_LAN9221_GPMC_CONFIG1,
302 NET_LAN9221_GPMC_CONFIG2,
303 NET_LAN9221_GPMC_CONFIG3,
304 NET_LAN9221_GPMC_CONFIG4,
305 NET_LAN9221_GPMC_CONFIG5,
306 NET_LAN9221_GPMC_CONFIG6,
307 /*CONFIG7- computed as params */
311 * Routine: setup_net_chip
312 * Description: Setting up the configuration GPMC registers specific to the
315 static void setup_net_chip(void)
317 struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
319 /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
320 writew(readw(&ctrl_base ->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
321 /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
322 writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
323 /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
324 writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
325 &ctrl_base->gpmc_nadv_ale);
329 * Routine: reset_net_chip
330 * Description: Reset the Ethernet hardware.
332 static void reset_net_chip(void)
334 /* Make GPIO 64 as output pin and send a magic pulse through it */
335 if (!gpio_request(64, "")) {
336 gpio_direction_output(64, 0);
337 gpio_set_value(64, 1);
339 gpio_set_value(64, 0);
341 gpio_set_value(64, 1);
345 int board_eth_init(bd_t *bis)
347 unsigned int expansion_id;
350 #ifdef CONFIG_SMC911X
351 expansion_id = get_expansion_id();
352 switch (expansion_id) {
353 case GUMSTIX_TOBI_DUO:
354 /* second lan chip */
355 enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[4],
356 0x2B000000, GPMC_SIZE_16M);
359 case GUMSTIX_CHESTNUT43:
360 case GUMSTIX_STAGECOACH:
361 case GUMSTIX_NO_EEPROM:
362 case GUMSTIX_EMPTY_EEPROM:
364 enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5],
365 0x2C000000, GPMC_SIZE_16M);
370 rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
381 #if defined(CONFIG_GENERIC_MMC)
382 int board_mmc_init(bd_t *bis)
384 return omap_mmc_init(0, 0, 0, -1, -1);
388 #if defined(CONFIG_GENERIC_MMC)
389 void board_mmc_power_init(void)
391 twl4030_power_mmc_init(0);
395 #if defined(CONFIG_USB_EHCI)
396 static struct omap_usbhs_board_data usbhs_bdata = {
397 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
398 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
399 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
402 #define GUMSTIX_GPIO_USBH_CPEN 168
403 int ehci_hcd_init(int index, enum usb_init_type init,
404 struct ehci_hccr **hccr, struct ehci_hcor **hcor)
406 /* Enable USB power */
407 if (!gpio_request(GUMSTIX_GPIO_USBH_CPEN, "usbh_cpen"))
408 gpio_direction_output(GUMSTIX_GPIO_USBH_CPEN, 1);
410 return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
413 int ehci_hcd_stop(void)
415 /* Disable USB power */
416 gpio_set_value(GUMSTIX_GPIO_USBH_CPEN, 0);
417 gpio_free(GUMSTIX_GPIO_USBH_CPEN);
419 return omap_ehci_hcd_stop();
422 #endif /* CONFIG_USB_EHCI */