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