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