Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Dirk Behme | 220faba | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Maintainer : Steve Sakoman <steve@sakoman.com> |
| 4 | * |
| 5 | * Derived from Beagle Board, 3430 SDP, and OMAP3EVM code by |
| 6 | * Richard Woodruff <r-woodruff2@ti.com> |
| 7 | * Syed Mohammed Khasim <khasim@ti.com> |
| 8 | * Sunil Kumar <sunilsaini05@gmail.com> |
| 9 | * Shashi Ranjan <shashiranjanmca05@gmail.com> |
| 10 | * |
| 11 | * (C) Copyright 2004-2008 |
| 12 | * Texas Instruments, <www.ti.com> |
Dirk Behme | 220faba | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 13 | */ |
| 14 | #include <common.h> |
Simon Glass | bc0f4ea | 2014-10-22 21:37:15 -0600 | [diff] [blame] | 15 | #include <dm.h> |
| 16 | #include <ns16550.h> |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 17 | #include <netdev.h> |
Tom Rix | 0f2a804 | 2009-06-28 12:52:30 -0500 | [diff] [blame] | 18 | #include <twl4030.h> |
Masahiro Yamada | 2b7a873 | 2017-11-30 13:45:24 +0900 | [diff] [blame] | 19 | #include <linux/mtd/rawnand.h> |
Dirk Behme | 220faba | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 20 | #include <asm/io.h> |
Steve Sakoman | b7d8052 | 2010-09-19 21:21:07 -0700 | [diff] [blame] | 21 | #include <asm/arch/mmc_host_def.h> |
Dirk Behme | 220faba | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 22 | #include <asm/arch/mux.h> |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 23 | #include <asm/arch/mem.h> |
Dirk Behme | 220faba | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 24 | #include <asm/arch/sys_proto.h> |
Sanjeev Premi | 7b3dc82 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 25 | #include <asm/gpio.h> |
Dirk Behme | 220faba | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 26 | #include <asm/mach-types.h> |
| 27 | #include "overo.h" |
| 28 | |
Tom Rini | ceed5d2 | 2017-05-12 22:33:27 -0400 | [diff] [blame] | 29 | #ifdef CONFIG_USB_EHCI_HCD |
Stefan Herbrechtsmeier | 0c87e68 | 2014-09-16 17:51:09 +0200 | [diff] [blame] | 30 | #include <usb.h> |
| 31 | #include <asm/ehci-omap.h> |
| 32 | #endif |
| 33 | |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 34 | #define TWL4030_I2C_BUS 0 |
| 35 | #define EXPANSION_EEPROM_I2C_BUS 2 |
| 36 | #define EXPANSION_EEPROM_I2C_ADDRESS 0x51 |
| 37 | |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 38 | #define GUMSTIX_EMPTY_EEPROM 0x0 |
| 39 | |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 40 | #define GUMSTIX_SUMMIT 0x01000200 |
| 41 | #define GUMSTIX_TOBI 0x02000200 |
| 42 | #define GUMSTIX_TOBI_DUO 0x03000200 |
| 43 | #define GUMSTIX_PALO35 0x04000200 |
| 44 | #define GUMSTIX_PALO43 0x05000200 |
| 45 | #define GUMSTIX_CHESTNUT43 0x06000200 |
| 46 | #define GUMSTIX_PINTO 0x07000200 |
| 47 | #define GUMSTIX_GALLOP43 0x08000200 |
Ash Charles | 7baad0f | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 48 | #define GUMSTIX_ALTO35 0x09000200 |
| 49 | #define GUMSTIX_STAGECOACH 0x0A000200 |
| 50 | #define GUMSTIX_THUMBO 0x0B000200 |
| 51 | #define GUMSTIX_TURTLECORE 0x0C000200 |
| 52 | #define GUMSTIX_ARBOR43C 0x0D000200 |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 53 | |
| 54 | #define ETTUS_USRP_E 0x01000300 |
| 55 | |
| 56 | #define GUMSTIX_NO_EEPROM 0xffffffff |
| 57 | |
| 58 | static struct { |
| 59 | unsigned int device_vendor; |
| 60 | unsigned char revision; |
| 61 | unsigned char content; |
| 62 | char fab_revision[8]; |
| 63 | char env_var[16]; |
| 64 | char env_setting[64]; |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 65 | } expansion_config = {0x0}; |
Steve Sakoman | 0d1d008 | 2010-08-12 21:07:02 -0700 | [diff] [blame] | 66 | |
Simon Glass | bc0f4ea | 2014-10-22 21:37:15 -0600 | [diff] [blame] | 67 | static const struct ns16550_platdata overo_serial = { |
Adam Ford | d1e22fa | 2016-03-07 21:08:49 -0600 | [diff] [blame] | 68 | .base = OMAP34XX_UART3, |
| 69 | .reg_shift = 2, |
Heiko Schocher | 06f108e | 2017-01-18 08:05:49 +0100 | [diff] [blame] | 70 | .clock = V_NS16550_CLK, |
| 71 | .fcr = UART_FCR_DEFVAL, |
Simon Glass | bc0f4ea | 2014-10-22 21:37:15 -0600 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | U_BOOT_DEVICE(overo_uart) = { |
Thomas Chou | 52ac443 | 2015-11-19 21:48:12 +0800 | [diff] [blame] | 75 | "ns16550_serial", |
Simon Glass | bc0f4ea | 2014-10-22 21:37:15 -0600 | [diff] [blame] | 76 | &overo_serial |
| 77 | }; |
| 78 | |
Tom Rix | 558bb83 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 79 | /* |
Steve Sakoman | 541ce99 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 80 | * Routine: get_sdio2_config |
| 81 | * Description: Return information about the wifi module connection |
| 82 | * Returns 0 if the module connects though a level translator |
| 83 | * Returns 1 if the module connects directly |
| 84 | */ |
| 85 | int get_sdio2_config(void) |
| 86 | { |
| 87 | int sdio_direct; |
| 88 | |
Sanjeev Premi | 7b3dc82 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 89 | if (!gpio_request(130, "") && !gpio_request(139, "")) { |
Steve Sakoman | 541ce99 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 90 | |
Sanjeev Premi | 7b3dc82 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 91 | gpio_direction_output(130, 0); |
| 92 | gpio_direction_input(139); |
Steve Sakoman | 541ce99 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 93 | |
| 94 | sdio_direct = 1; |
Sanjeev Premi | 7b3dc82 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 95 | gpio_set_value(130, 0); |
| 96 | if (gpio_get_value(139) == 0) { |
| 97 | gpio_set_value(130, 1); |
| 98 | if (gpio_get_value(139) == 1) |
Steve Sakoman | 541ce99 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 99 | sdio_direct = 0; |
| 100 | } |
| 101 | |
Joe Hershberger | 9b124d3 | 2011-10-12 10:31:44 +0000 | [diff] [blame] | 102 | gpio_direction_input(130); |
Steve Sakoman | 541ce99 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 103 | } else { |
Andreas Müller | b958a5d | 2012-01-04 15:26:20 +0000 | [diff] [blame] | 104 | puts("Error: unable to acquire sdio2 clk GPIOs\n"); |
Steve Sakoman | 541ce99 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 105 | sdio_direct = -1; |
| 106 | } |
| 107 | |
| 108 | return sdio_direct; |
| 109 | } |
| 110 | |
| 111 | /* |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 112 | * Routine: get_expansion_id |
| 113 | * Description: This function checks for expansion board by checking I2C |
| 114 | * bus 2 for the availability of an AT24C01B serial EEPROM. |
| 115 | * returns the device_vendor field from the EEPROM |
| 116 | */ |
| 117 | unsigned int get_expansion_id(void) |
| 118 | { |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 119 | if (expansion_config.device_vendor != 0x0) |
| 120 | return expansion_config.device_vendor; |
| 121 | |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 122 | i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS); |
| 123 | |
| 124 | /* return GUMSTIX_NO_EEPROM if eeprom doesn't respond */ |
| 125 | if (i2c_probe(EXPANSION_EEPROM_I2C_ADDRESS) == 1) { |
| 126 | i2c_set_bus_num(TWL4030_I2C_BUS); |
| 127 | return GUMSTIX_NO_EEPROM; |
| 128 | } |
| 129 | |
| 130 | /* read configuration data */ |
| 131 | i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config, |
| 132 | sizeof(expansion_config)); |
| 133 | |
| 134 | i2c_set_bus_num(TWL4030_I2C_BUS); |
| 135 | |
| 136 | return expansion_config.device_vendor; |
| 137 | } |
| 138 | |
| 139 | /* |
Dirk Behme | 220faba | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 140 | * Routine: misc_init_r |
| 141 | * Description: Configure board specific parts |
Tom Rix | 558bb83 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 142 | */ |
Dirk Behme | 220faba | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 143 | int misc_init_r(void) |
| 144 | { |
Ash Charles | 7baad0f | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 145 | unsigned int expansion_id; |
| 146 | |
Tom Rix | 0f2a804 | 2009-06-28 12:52:30 -0500 | [diff] [blame] | 147 | twl4030_power_init(); |
Grazvydas Ignotas | 17887bf | 2009-12-10 17:10:21 +0200 | [diff] [blame] | 148 | twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); |
Dirk Behme | 220faba | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 149 | |
Steve Sakoman | 5ddc70b | 2010-08-12 15:13:02 -0700 | [diff] [blame] | 150 | printf("Board revision: %d\n", get_board_revision()); |
Steve Sakoman | 541ce99 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 151 | |
| 152 | switch (get_sdio2_config()) { |
| 153 | case 0: |
Andreas Müller | b958a5d | 2012-01-04 15:26:20 +0000 | [diff] [blame] | 154 | puts("Tranceiver detected on mmc2\n"); |
Steve Sakoman | 541ce99 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 155 | MUX_OVERO_SDIO2_TRANSCEIVER(); |
| 156 | break; |
| 157 | case 1: |
Andreas Müller | b958a5d | 2012-01-04 15:26:20 +0000 | [diff] [blame] | 158 | puts("Direct connection on mmc2\n"); |
Steve Sakoman | 541ce99 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 159 | MUX_OVERO_SDIO2_DIRECT(); |
| 160 | break; |
| 161 | default: |
Andreas Müller | b958a5d | 2012-01-04 15:26:20 +0000 | [diff] [blame] | 162 | puts("Unable to detect mmc2 connection type\n"); |
Steve Sakoman | 541ce99 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 163 | } |
| 164 | |
Ash Charles | 7baad0f | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 165 | expansion_id = get_expansion_id(); |
| 166 | switch (expansion_id) { |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 167 | case GUMSTIX_SUMMIT: |
| 168 | printf("Recognized Summit expansion board (rev %d %s)\n", |
| 169 | expansion_config.revision, |
| 170 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 171 | MUX_GUMSTIX(); |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 172 | env_set("defaultdisplay", "dvi"); |
| 173 | env_set("expansionname", "summit"); |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 174 | break; |
| 175 | case GUMSTIX_TOBI: |
| 176 | printf("Recognized Tobi expansion board (rev %d %s)\n", |
| 177 | expansion_config.revision, |
| 178 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 179 | MUX_GUMSTIX(); |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 180 | env_set("defaultdisplay", "dvi"); |
| 181 | env_set("expansionname", "tobi"); |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 182 | break; |
| 183 | case GUMSTIX_TOBI_DUO: |
| 184 | printf("Recognized Tobi Duo expansion board (rev %d %s)\n", |
| 185 | expansion_config.revision, |
| 186 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 187 | MUX_GUMSTIX(); |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 188 | env_set("expansionname", "tobiduo"); |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 189 | break; |
| 190 | case GUMSTIX_PALO35: |
| 191 | printf("Recognized Palo35 expansion board (rev %d %s)\n", |
| 192 | expansion_config.revision, |
| 193 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 194 | MUX_GUMSTIX(); |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 195 | env_set("defaultdisplay", "lcd35"); |
| 196 | env_set("expansionname", "palo35"); |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 197 | break; |
| 198 | case GUMSTIX_PALO43: |
| 199 | printf("Recognized Palo43 expansion board (rev %d %s)\n", |
| 200 | expansion_config.revision, |
| 201 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 202 | MUX_GUMSTIX(); |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 203 | env_set("defaultdisplay", "lcd43"); |
| 204 | env_set("expansionname", "palo43"); |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 205 | break; |
| 206 | case GUMSTIX_CHESTNUT43: |
| 207 | printf("Recognized Chestnut43 expansion board (rev %d %s)\n", |
| 208 | expansion_config.revision, |
| 209 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 210 | MUX_GUMSTIX(); |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 211 | env_set("defaultdisplay", "lcd43"); |
| 212 | env_set("expansionname", "chestnut43"); |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 213 | break; |
| 214 | case GUMSTIX_PINTO: |
| 215 | printf("Recognized Pinto expansion board (rev %d %s)\n", |
| 216 | expansion_config.revision, |
| 217 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 218 | MUX_GUMSTIX(); |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 219 | break; |
| 220 | case GUMSTIX_GALLOP43: |
| 221 | printf("Recognized Gallop43 expansion board (rev %d %s)\n", |
| 222 | expansion_config.revision, |
| 223 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 224 | MUX_GUMSTIX(); |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 225 | env_set("defaultdisplay", "lcd43"); |
| 226 | env_set("expansionname", "gallop43"); |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 227 | break; |
Ash Charles | 7baad0f | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 228 | case GUMSTIX_ALTO35: |
| 229 | printf("Recognized Alto35 expansion board (rev %d %s)\n", |
| 230 | expansion_config.revision, |
| 231 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 232 | MUX_GUMSTIX(); |
Ash Charles | 7baad0f | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 233 | MUX_ALTO35(); |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 234 | env_set("defaultdisplay", "lcd35"); |
| 235 | env_set("expansionname", "alto35"); |
Ash Charles | 7baad0f | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 236 | break; |
| 237 | case GUMSTIX_STAGECOACH: |
| 238 | printf("Recognized Stagecoach expansion board (rev %d %s)\n", |
| 239 | expansion_config.revision, |
| 240 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 241 | MUX_GUMSTIX(); |
Ash Charles | 7baad0f | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 242 | break; |
| 243 | case GUMSTIX_THUMBO: |
| 244 | printf("Recognized Thumbo expansion board (rev %d %s)\n", |
| 245 | expansion_config.revision, |
| 246 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 247 | MUX_GUMSTIX(); |
Ash Charles | 7baad0f | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 248 | break; |
| 249 | case GUMSTIX_TURTLECORE: |
| 250 | printf("Recognized Turtlecore expansion board (rev %d %s)\n", |
| 251 | expansion_config.revision, |
| 252 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 253 | MUX_GUMSTIX(); |
Ash Charles | 7baad0f | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 254 | break; |
| 255 | case GUMSTIX_ARBOR43C: |
| 256 | printf("Recognized Arbor43C expansion board (rev %d %s)\n", |
| 257 | expansion_config.revision, |
| 258 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 259 | MUX_GUMSTIX(); |
Ash Charles | 7baad0f | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 260 | MUX_ARBOR43C(); |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 261 | env_set("defaultdisplay", "lcd43"); |
| 262 | env_set("expansionname", "arbor43c"); |
Ash Charles | 7baad0f | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 263 | break; |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 264 | case ETTUS_USRP_E: |
| 265 | printf("Recognized Ettus Research USRP-E (rev %d %s)\n", |
| 266 | expansion_config.revision, |
| 267 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 268 | MUX_GUMSTIX(); |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 269 | MUX_USRP_E(); |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 270 | env_set("defaultdisplay", "dvi"); |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 271 | break; |
| 272 | case GUMSTIX_NO_EEPROM: |
Stefan Herbrechtsmeier | e2f29a1 | 2014-09-16 17:51:08 +0200 | [diff] [blame] | 273 | case GUMSTIX_EMPTY_EEPROM: |
| 274 | puts("No or empty EEPROM on expansion board\n"); |
| 275 | MUX_GUMSTIX(); |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 276 | env_set("expansionname", "tobi"); |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 277 | break; |
| 278 | default: |
Ash Charles | 7baad0f | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 279 | printf("Unrecognized expansion board 0x%08x\n", expansion_id); |
| 280 | break; |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | if (expansion_config.content == 1) |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 284 | env_set(expansion_config.env_var, expansion_config.env_setting); |
Steve Sakoman | 0b88063 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 285 | |
Paul Kocialkowski | 6bc318e | 2015-08-27 19:37:13 +0200 | [diff] [blame] | 286 | omap_die_id_display(); |
Dirk Behme | 12dbcf6 | 2009-03-12 19:30:50 +0100 | [diff] [blame] | 287 | |
Ash Charles | 1bfdde6 | 2014-06-10 12:02:36 -0700 | [diff] [blame] | 288 | if (get_cpu_family() == CPU_OMAP34XX) |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 289 | env_set("boardname", "overo"); |
Ash Charles | 1bfdde6 | 2014-06-10 12:02:36 -0700 | [diff] [blame] | 290 | else |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 291 | env_set("boardname", "overo-storm"); |
Ash Charles | 1bfdde6 | 2014-06-10 12:02:36 -0700 | [diff] [blame] | 292 | |
Dirk Behme | 220faba | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 293 | return 0; |
| 294 | } |
| 295 | |
Arun Bharadwaj | 9a0475c | 2015-04-28 16:55:29 -0700 | [diff] [blame] | 296 | #if defined(CONFIG_CMD_NET) |
Stefan Herbrechtsmeier | 59f72d2 | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 297 | /* GPMC definitions for LAN9221 chips on Tobi expansion boards */ |
| 298 | static const u32 gpmc_lan_config[] = { |
| 299 | NET_LAN9221_GPMC_CONFIG1, |
| 300 | NET_LAN9221_GPMC_CONFIG2, |
| 301 | NET_LAN9221_GPMC_CONFIG3, |
| 302 | NET_LAN9221_GPMC_CONFIG4, |
| 303 | NET_LAN9221_GPMC_CONFIG5, |
| 304 | NET_LAN9221_GPMC_CONFIG6, |
| 305 | /*CONFIG7- computed as params */ |
| 306 | }; |
| 307 | |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 308 | /* |
| 309 | * Routine: setup_net_chip |
| 310 | * Description: Setting up the configuration GPMC registers specific to the |
| 311 | * Ethernet hardware. |
| 312 | */ |
| 313 | static void setup_net_chip(void) |
| 314 | { |
| 315 | struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE; |
| 316 | |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 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); |
Stefan Herbrechtsmeier | 59f72d2 | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 324 | } |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 325 | |
Stefan Herbrechtsmeier | 59f72d2 | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 326 | /* |
| 327 | * Routine: reset_net_chip |
| 328 | * Description: Reset the Ethernet hardware. |
| 329 | */ |
| 330 | static void reset_net_chip(void) |
| 331 | { |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 332 | /* Make GPIO 64 as output pin and send a magic pulse through it */ |
Sanjeev Premi | 7b3dc82 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 333 | if (!gpio_request(64, "")) { |
| 334 | gpio_direction_output(64, 0); |
| 335 | gpio_set_value(64, 1); |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 336 | udelay(1); |
Sanjeev Premi | 7b3dc82 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 337 | gpio_set_value(64, 0); |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 338 | udelay(1); |
Sanjeev Premi | 7b3dc82 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 339 | gpio_set_value(64, 1); |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 340 | } |
| 341 | } |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 342 | |
| 343 | int board_eth_init(bd_t *bis) |
| 344 | { |
Stefan Herbrechtsmeier | 59f72d2 | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 345 | unsigned int expansion_id; |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 346 | int rc = 0; |
Stefan Herbrechtsmeier | 59f72d2 | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 347 | |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 348 | #ifdef CONFIG_SMC911X |
Stefan Herbrechtsmeier | 59f72d2 | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 349 | expansion_id = get_expansion_id(); |
| 350 | switch (expansion_id) { |
| 351 | case GUMSTIX_TOBI_DUO: |
| 352 | /* second lan chip */ |
| 353 | enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[4], |
| 354 | 0x2B000000, GPMC_SIZE_16M); |
| 355 | /* no break */ |
| 356 | case GUMSTIX_TOBI: |
| 357 | case GUMSTIX_CHESTNUT43: |
| 358 | case GUMSTIX_STAGECOACH: |
| 359 | case GUMSTIX_NO_EEPROM: |
| 360 | case GUMSTIX_EMPTY_EEPROM: |
| 361 | /* first lan chip */ |
| 362 | enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5], |
| 363 | 0x2C000000, GPMC_SIZE_16M); |
| 364 | |
| 365 | setup_net_chip(); |
| 366 | reset_net_chip(); |
| 367 | |
| 368 | rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); |
| 369 | break; |
| 370 | default: |
| 371 | break; |
| 372 | } |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 373 | #endif |
Stefan Herbrechtsmeier | 59f72d2 | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 374 | |
Olof Johansson | 4963f92 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 375 | return rc; |
| 376 | } |
Stefan Herbrechtsmeier | 59f72d2 | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 377 | #endif |
Steve Sakoman | b7d8052 | 2010-09-19 21:21:07 -0700 | [diff] [blame] | 378 | |
Masahiro Yamada | 0a78017 | 2017-05-09 20:31:39 +0900 | [diff] [blame] | 379 | #if defined(CONFIG_MMC) |
Steve Sakoman | b7d8052 | 2010-09-19 21:21:07 -0700 | [diff] [blame] | 380 | int board_mmc_init(bd_t *bis) |
| 381 | { |
Nikita Kiryanov | 4be9dbc | 2012-12-03 02:19:47 +0000 | [diff] [blame] | 382 | return omap_mmc_init(0, 0, 0, -1, -1); |
Steve Sakoman | b7d8052 | 2010-09-19 21:21:07 -0700 | [diff] [blame] | 383 | } |
| 384 | #endif |
Stefan Herbrechtsmeier | 0c87e68 | 2014-09-16 17:51:09 +0200 | [diff] [blame] | 385 | |
Masahiro Yamada | 0a78017 | 2017-05-09 20:31:39 +0900 | [diff] [blame] | 386 | #if defined(CONFIG_MMC) |
Paul Kocialkowski | 6955989 | 2014-11-08 20:55:47 +0100 | [diff] [blame] | 387 | void board_mmc_power_init(void) |
| 388 | { |
| 389 | twl4030_power_mmc_init(0); |
| 390 | } |
| 391 | #endif |
| 392 | |
Tom Rini | ceed5d2 | 2017-05-12 22:33:27 -0400 | [diff] [blame] | 393 | #if defined(CONFIG_USB_EHCI_HCD) |
Stefan Herbrechtsmeier | 0c87e68 | 2014-09-16 17:51:09 +0200 | [diff] [blame] | 394 | static struct omap_usbhs_board_data usbhs_bdata = { |
| 395 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, |
| 396 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
| 397 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED |
| 398 | }; |
| 399 | |
| 400 | #define GUMSTIX_GPIO_USBH_CPEN 168 |
| 401 | int ehci_hcd_init(int index, enum usb_init_type init, |
| 402 | struct ehci_hccr **hccr, struct ehci_hcor **hcor) |
| 403 | { |
| 404 | /* Enable USB power */ |
| 405 | if (!gpio_request(GUMSTIX_GPIO_USBH_CPEN, "usbh_cpen")) |
| 406 | gpio_direction_output(GUMSTIX_GPIO_USBH_CPEN, 1); |
| 407 | |
| 408 | return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor); |
| 409 | } |
| 410 | |
| 411 | int ehci_hcd_stop(void) |
| 412 | { |
| 413 | /* Disable USB power */ |
| 414 | gpio_set_value(GUMSTIX_GPIO_USBH_CPEN, 0); |
| 415 | gpio_free(GUMSTIX_GPIO_USBH_CPEN); |
| 416 | |
| 417 | return omap_ehci_hcd_stop(); |
| 418 | } |
| 419 | |
Tom Rini | ceed5d2 | 2017-05-12 22:33:27 -0400 | [diff] [blame] | 420 | #endif /* CONFIG_USB_EHCI_HCD */ |