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> |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 16 | #include <netdev.h> |
Tom Rix | 2c15513 | 2009-06-28 12:52:30 -0500 | [diff] [blame] | 17 | #include <twl4030.h> |
Andreas Müller | 137703b | 2012-01-04 15:26:25 +0000 | [diff] [blame] | 18 | #include <linux/mtd/nand.h> |
Dirk Behme | 9d0fc81 | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 19 | #include <asm/io.h> |
Steve Sakoman | cd7c572 | 2010-09-19 21:21:07 -0700 | [diff] [blame] | 20 | #include <asm/arch/mmc_host_def.h> |
Dirk Behme | 9d0fc81 | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 21 | #include <asm/arch/mux.h> |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 22 | #include <asm/arch/mem.h> |
Dirk Behme | 9d0fc81 | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 23 | #include <asm/arch/sys_proto.h> |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 24 | #include <asm/gpio.h> |
Dirk Behme | 9d0fc81 | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 25 | #include <asm/mach-types.h> |
| 26 | #include "overo.h" |
| 27 | |
John Rigby | 2956532 | 2010-12-20 18:27:51 -0700 | [diff] [blame] | 28 | DECLARE_GLOBAL_DATA_PTR; |
| 29 | |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 30 | #define TWL4030_I2C_BUS 0 |
| 31 | #define EXPANSION_EEPROM_I2C_BUS 2 |
| 32 | #define EXPANSION_EEPROM_I2C_ADDRESS 0x51 |
| 33 | |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 34 | #define GUMSTIX_EMPTY_EEPROM 0x0 |
| 35 | |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 36 | #define GUMSTIX_SUMMIT 0x01000200 |
| 37 | #define GUMSTIX_TOBI 0x02000200 |
| 38 | #define GUMSTIX_TOBI_DUO 0x03000200 |
| 39 | #define GUMSTIX_PALO35 0x04000200 |
| 40 | #define GUMSTIX_PALO43 0x05000200 |
| 41 | #define GUMSTIX_CHESTNUT43 0x06000200 |
| 42 | #define GUMSTIX_PINTO 0x07000200 |
| 43 | #define GUMSTIX_GALLOP43 0x08000200 |
Ash Charles | ea5940e | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 44 | #define GUMSTIX_ALTO35 0x09000200 |
| 45 | #define GUMSTIX_STAGECOACH 0x0A000200 |
| 46 | #define GUMSTIX_THUMBO 0x0B000200 |
| 47 | #define GUMSTIX_TURTLECORE 0x0C000200 |
| 48 | #define GUMSTIX_ARBOR43C 0x0D000200 |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 49 | |
| 50 | #define ETTUS_USRP_E 0x01000300 |
| 51 | |
| 52 | #define GUMSTIX_NO_EEPROM 0xffffffff |
| 53 | |
| 54 | static struct { |
| 55 | unsigned int device_vendor; |
| 56 | unsigned char revision; |
| 57 | unsigned char content; |
| 58 | char fab_revision[8]; |
| 59 | char env_var[16]; |
| 60 | char env_setting[64]; |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 61 | } expansion_config = {0x0}; |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 62 | |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 63 | /* |
Dirk Behme | 9d0fc81 | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 64 | * Routine: board_init |
| 65 | * Description: Early hardware init. |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 66 | */ |
Dirk Behme | 9d0fc81 | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 67 | int board_init(void) |
| 68 | { |
Dirk Behme | 9d0fc81 | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 69 | gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ |
| 70 | /* board id for Linux */ |
| 71 | gd->bd->bi_arch_number = MACH_TYPE_OVERO; |
| 72 | /* boot param addr */ |
| 73 | gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); |
| 74 | |
| 75 | return 0; |
| 76 | } |
| 77 | |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 78 | /* |
Steve Sakoman | c2d5b34 | 2010-08-12 15:13:02 -0700 | [diff] [blame] | 79 | * Routine: get_board_revision |
| 80 | * Description: Returns the board revision |
| 81 | */ |
| 82 | int get_board_revision(void) |
| 83 | { |
| 84 | int revision; |
| 85 | |
Heiko Schocher | 6789e84 | 2013-10-22 11:03:18 +0200 | [diff] [blame] | 86 | #ifdef CONFIG_SYS_I2C_OMAP34XX |
Andreas Müller | 137703b | 2012-01-04 15:26:25 +0000 | [diff] [blame] | 87 | unsigned char data; |
| 88 | |
| 89 | /* board revisions <= R2410 connect 4030 irq_1 to gpio112 */ |
| 90 | /* these boards should return a revision number of 0 */ |
| 91 | /* the code below forces a 4030 RTC irq to ensure that gpio112 is low */ |
| 92 | i2c_set_bus_num(TWL4030_I2C_BUS); |
| 93 | data = 0x01; |
| 94 | i2c_write(0x4B, 0x29, 1, &data, 1); |
| 95 | data = 0x0c; |
| 96 | i2c_write(0x4B, 0x2b, 1, &data, 1); |
| 97 | i2c_read(0x4B, 0x2a, 1, &data, 1); |
| 98 | #endif |
| 99 | |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 100 | if (!gpio_request(112, "") && |
| 101 | !gpio_request(113, "") && |
| 102 | !gpio_request(115, "")) { |
Steve Sakoman | c2d5b34 | 2010-08-12 15:13:02 -0700 | [diff] [blame] | 103 | |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 104 | gpio_direction_input(112); |
| 105 | gpio_direction_input(113); |
| 106 | gpio_direction_input(115); |
Steve Sakoman | c2d5b34 | 2010-08-12 15:13:02 -0700 | [diff] [blame] | 107 | |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 108 | revision = gpio_get_value(115) << 2 | |
| 109 | gpio_get_value(113) << 1 | |
| 110 | gpio_get_value(112); |
Steve Sakoman | c2d5b34 | 2010-08-12 15:13:02 -0700 | [diff] [blame] | 111 | } else { |
Andreas Müller | bae485d | 2012-01-04 15:26:20 +0000 | [diff] [blame] | 112 | puts("Error: unable to acquire board revision GPIOs\n"); |
Steve Sakoman | c2d5b34 | 2010-08-12 15:13:02 -0700 | [diff] [blame] | 113 | revision = -1; |
| 114 | } |
| 115 | |
| 116 | return revision; |
| 117 | } |
| 118 | |
Andreas Müller | 137703b | 2012-01-04 15:26:25 +0000 | [diff] [blame] | 119 | #ifdef CONFIG_SPL_BUILD |
| 120 | /* |
| 121 | * Routine: get_board_mem_timings |
| 122 | * Description: If we use SPL then there is no x-loader nor config header |
| 123 | * so we have to setup the DDR timings ourself on both banks. |
| 124 | */ |
Peter Barada | 8c4445d | 2012-11-13 07:40:28 +0000 | [diff] [blame] | 125 | void get_board_mem_timings(struct board_sdrc_timings *timings) |
Andreas Müller | 137703b | 2012-01-04 15:26:25 +0000 | [diff] [blame] | 126 | { |
Peter Barada | 8c4445d | 2012-11-13 07:40:28 +0000 | [diff] [blame] | 127 | timings->mr = MICRON_V_MR_165; |
Andreas Müller | 137703b | 2012-01-04 15:26:25 +0000 | [diff] [blame] | 128 | switch (get_board_revision()) { |
| 129 | case REVISION_0: /* Micron 1286MB/256MB, 1/2 banks of 128MB */ |
Peter Barada | 8c4445d | 2012-11-13 07:40:28 +0000 | [diff] [blame] | 130 | timings->mcfg = MICRON_V_MCFG_165(128 << 20); |
| 131 | timings->ctrla = MICRON_V_ACTIMA_165; |
| 132 | timings->ctrlb = MICRON_V_ACTIMB_165; |
| 133 | timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; |
Andreas Müller | 137703b | 2012-01-04 15:26:25 +0000 | [diff] [blame] | 134 | break; |
| 135 | case REVISION_1: /* Micron 256MB/512MB, 1/2 banks of 256MB */ |
Ash Charles | be4cc45 | 2014-05-21 14:04:52 -0700 | [diff] [blame] | 136 | case REVISION_4: |
Ash Charles | 802b3c7 | 2013-07-24 12:22:35 -0700 | [diff] [blame] | 137 | timings->mcfg = MICRON_V_MCFG_200(256 << 20); |
| 138 | timings->ctrla = MICRON_V_ACTIMA_200; |
| 139 | timings->ctrlb = MICRON_V_ACTIMB_200; |
| 140 | timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz; |
Andreas Müller | 137703b | 2012-01-04 15:26:25 +0000 | [diff] [blame] | 141 | break; |
| 142 | case REVISION_2: /* Hynix 256MB/512MB, 1/2 banks of 256MB */ |
Ash Charles | 802b3c7 | 2013-07-24 12:22:35 -0700 | [diff] [blame] | 143 | timings->mcfg = HYNIX_V_MCFG_200(256 << 20); |
| 144 | timings->ctrla = HYNIX_V_ACTIMA_200; |
| 145 | timings->ctrlb = HYNIX_V_ACTIMB_200; |
| 146 | timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz; |
Andreas Müller | 137703b | 2012-01-04 15:26:25 +0000 | [diff] [blame] | 147 | break; |
Steve Sakoman | 49720a4 | 2013-07-24 12:22:34 -0700 | [diff] [blame] | 148 | case REVISION_3: /* Micron 512MB/1024MB, 1/2 banks of 512MB */ |
| 149 | timings->mcfg = MCFG(512 << 20, 15); |
| 150 | timings->ctrla = MICRON_V_ACTIMA_200; |
| 151 | timings->ctrlb = MICRON_V_ACTIMB_200; |
| 152 | timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz; |
| 153 | break; |
Andreas Müller | 137703b | 2012-01-04 15:26:25 +0000 | [diff] [blame] | 154 | default: |
Peter Barada | 8c4445d | 2012-11-13 07:40:28 +0000 | [diff] [blame] | 155 | timings->mcfg = MICRON_V_MCFG_165(128 << 20); |
| 156 | timings->ctrla = MICRON_V_ACTIMA_165; |
| 157 | timings->ctrlb = MICRON_V_ACTIMB_165; |
| 158 | timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; |
Andreas Müller | 137703b | 2012-01-04 15:26:25 +0000 | [diff] [blame] | 159 | } |
| 160 | } |
| 161 | #endif |
| 162 | |
Steve Sakoman | c2d5b34 | 2010-08-12 15:13:02 -0700 | [diff] [blame] | 163 | /* |
Steve Sakoman | a06e162 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 164 | * Routine: get_sdio2_config |
| 165 | * Description: Return information about the wifi module connection |
| 166 | * Returns 0 if the module connects though a level translator |
| 167 | * Returns 1 if the module connects directly |
| 168 | */ |
| 169 | int get_sdio2_config(void) |
| 170 | { |
| 171 | int sdio_direct; |
| 172 | |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 173 | if (!gpio_request(130, "") && !gpio_request(139, "")) { |
Steve Sakoman | a06e162 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 174 | |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 175 | gpio_direction_output(130, 0); |
| 176 | gpio_direction_input(139); |
Steve Sakoman | a06e162 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 177 | |
| 178 | sdio_direct = 1; |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 179 | gpio_set_value(130, 0); |
| 180 | if (gpio_get_value(139) == 0) { |
| 181 | gpio_set_value(130, 1); |
| 182 | if (gpio_get_value(139) == 1) |
Steve Sakoman | a06e162 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 183 | sdio_direct = 0; |
| 184 | } |
| 185 | |
Joe Hershberger | b5db0a0 | 2011-10-12 10:31:44 +0000 | [diff] [blame] | 186 | gpio_direction_input(130); |
Steve Sakoman | a06e162 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 187 | } else { |
Andreas Müller | bae485d | 2012-01-04 15:26:20 +0000 | [diff] [blame] | 188 | puts("Error: unable to acquire sdio2 clk GPIOs\n"); |
Steve Sakoman | a06e162 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 189 | sdio_direct = -1; |
| 190 | } |
| 191 | |
| 192 | return sdio_direct; |
| 193 | } |
| 194 | |
| 195 | /* |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 196 | * Routine: get_expansion_id |
| 197 | * Description: This function checks for expansion board by checking I2C |
| 198 | * bus 2 for the availability of an AT24C01B serial EEPROM. |
| 199 | * returns the device_vendor field from the EEPROM |
| 200 | */ |
| 201 | unsigned int get_expansion_id(void) |
| 202 | { |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 203 | if (expansion_config.device_vendor != 0x0) |
| 204 | return expansion_config.device_vendor; |
| 205 | |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 206 | i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS); |
| 207 | |
| 208 | /* return GUMSTIX_NO_EEPROM if eeprom doesn't respond */ |
| 209 | if (i2c_probe(EXPANSION_EEPROM_I2C_ADDRESS) == 1) { |
| 210 | i2c_set_bus_num(TWL4030_I2C_BUS); |
| 211 | return GUMSTIX_NO_EEPROM; |
| 212 | } |
| 213 | |
| 214 | /* read configuration data */ |
| 215 | i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config, |
| 216 | sizeof(expansion_config)); |
| 217 | |
| 218 | i2c_set_bus_num(TWL4030_I2C_BUS); |
| 219 | |
| 220 | return expansion_config.device_vendor; |
| 221 | } |
| 222 | |
| 223 | /* |
Dirk Behme | 9d0fc81 | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 224 | * Routine: misc_init_r |
| 225 | * Description: Configure board specific parts |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 226 | */ |
Dirk Behme | 9d0fc81 | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 227 | int misc_init_r(void) |
| 228 | { |
Ash Charles | ea5940e | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 229 | unsigned int expansion_id; |
| 230 | |
Tom Rix | 2c15513 | 2009-06-28 12:52:30 -0500 | [diff] [blame] | 231 | twl4030_power_init(); |
Grazvydas Ignotas | ead39d7 | 2009-12-10 17:10:21 +0200 | [diff] [blame] | 232 | twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); |
Dirk Behme | 9d0fc81 | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 233 | |
Steve Sakoman | c2d5b34 | 2010-08-12 15:13:02 -0700 | [diff] [blame] | 234 | printf("Board revision: %d\n", get_board_revision()); |
Steve Sakoman | a06e162 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 235 | |
| 236 | switch (get_sdio2_config()) { |
| 237 | case 0: |
Andreas Müller | bae485d | 2012-01-04 15:26:20 +0000 | [diff] [blame] | 238 | puts("Tranceiver detected on mmc2\n"); |
Steve Sakoman | a06e162 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 239 | MUX_OVERO_SDIO2_TRANSCEIVER(); |
| 240 | break; |
| 241 | case 1: |
Andreas Müller | bae485d | 2012-01-04 15:26:20 +0000 | [diff] [blame] | 242 | puts("Direct connection on mmc2\n"); |
Steve Sakoman | a06e162 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 243 | MUX_OVERO_SDIO2_DIRECT(); |
| 244 | break; |
| 245 | default: |
Andreas Müller | bae485d | 2012-01-04 15:26:20 +0000 | [diff] [blame] | 246 | puts("Unable to detect mmc2 connection type\n"); |
Steve Sakoman | a06e162 | 2010-08-24 10:37:29 -0700 | [diff] [blame] | 247 | } |
| 248 | |
Ash Charles | ea5940e | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 249 | expansion_id = get_expansion_id(); |
| 250 | switch (expansion_id) { |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 251 | case GUMSTIX_SUMMIT: |
| 252 | printf("Recognized Summit expansion board (rev %d %s)\n", |
| 253 | expansion_config.revision, |
| 254 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 255 | MUX_GUMSTIX(); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 256 | setenv("defaultdisplay", "dvi"); |
Ash Charles | 12cc543 | 2014-06-10 12:02:36 -0700 | [diff] [blame] | 257 | setenv("expansionname", "summit"); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 258 | break; |
| 259 | case GUMSTIX_TOBI: |
| 260 | printf("Recognized Tobi expansion board (rev %d %s)\n", |
| 261 | expansion_config.revision, |
| 262 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 263 | MUX_GUMSTIX(); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 264 | setenv("defaultdisplay", "dvi"); |
Ash Charles | 12cc543 | 2014-06-10 12:02:36 -0700 | [diff] [blame] | 265 | setenv("expansionname", "tobi"); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 266 | break; |
| 267 | case GUMSTIX_TOBI_DUO: |
| 268 | printf("Recognized Tobi Duo expansion board (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 | break; |
| 273 | case GUMSTIX_PALO35: |
| 274 | printf("Recognized Palo35 expansion board (rev %d %s)\n", |
| 275 | expansion_config.revision, |
| 276 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 277 | MUX_GUMSTIX(); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 278 | setenv("defaultdisplay", "lcd35"); |
| 279 | break; |
| 280 | case GUMSTIX_PALO43: |
| 281 | printf("Recognized Palo43 expansion board (rev %d %s)\n", |
| 282 | expansion_config.revision, |
| 283 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 284 | MUX_GUMSTIX(); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 285 | setenv("defaultdisplay", "lcd43"); |
Ash Charles | 12cc543 | 2014-06-10 12:02:36 -0700 | [diff] [blame] | 286 | setenv("expansionname", "palo43"); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 287 | break; |
| 288 | case GUMSTIX_CHESTNUT43: |
| 289 | printf("Recognized Chestnut43 expansion board (rev %d %s)\n", |
| 290 | expansion_config.revision, |
| 291 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 292 | MUX_GUMSTIX(); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 293 | setenv("defaultdisplay", "lcd43"); |
Ash Charles | 12cc543 | 2014-06-10 12:02:36 -0700 | [diff] [blame] | 294 | setenv("expansionname", "chestnut43"); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 295 | break; |
| 296 | case GUMSTIX_PINTO: |
| 297 | printf("Recognized Pinto expansion board (rev %d %s)\n", |
| 298 | expansion_config.revision, |
| 299 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 300 | MUX_GUMSTIX(); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 301 | break; |
| 302 | case GUMSTIX_GALLOP43: |
| 303 | printf("Recognized Gallop43 expansion board (rev %d %s)\n", |
| 304 | expansion_config.revision, |
| 305 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 306 | MUX_GUMSTIX(); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 307 | setenv("defaultdisplay", "lcd43"); |
Ash Charles | 12cc543 | 2014-06-10 12:02:36 -0700 | [diff] [blame] | 308 | setenv("expansionname", "gallop43"); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 309 | break; |
Ash Charles | ea5940e | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 310 | case GUMSTIX_ALTO35: |
| 311 | printf("Recognized Alto35 expansion board (rev %d %s)\n", |
| 312 | expansion_config.revision, |
| 313 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 314 | MUX_GUMSTIX(); |
Ash Charles | ea5940e | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 315 | MUX_ALTO35(); |
| 316 | setenv("defaultdisplay", "lcd35"); |
Ash Charles | 12cc543 | 2014-06-10 12:02:36 -0700 | [diff] [blame] | 317 | setenv("expansionname", "alto35"); |
Ash Charles | ea5940e | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 318 | break; |
| 319 | case GUMSTIX_STAGECOACH: |
| 320 | printf("Recognized Stagecoach expansion board (rev %d %s)\n", |
| 321 | expansion_config.revision, |
| 322 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 323 | MUX_GUMSTIX(); |
Ash Charles | ea5940e | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 324 | break; |
| 325 | case GUMSTIX_THUMBO: |
| 326 | printf("Recognized Thumbo expansion board (rev %d %s)\n", |
| 327 | expansion_config.revision, |
| 328 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 329 | MUX_GUMSTIX(); |
Ash Charles | ea5940e | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 330 | break; |
| 331 | case GUMSTIX_TURTLECORE: |
| 332 | printf("Recognized Turtlecore expansion board (rev %d %s)\n", |
| 333 | expansion_config.revision, |
| 334 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 335 | MUX_GUMSTIX(); |
Ash Charles | ea5940e | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 336 | break; |
| 337 | case GUMSTIX_ARBOR43C: |
| 338 | printf("Recognized Arbor43C expansion board (rev %d %s)\n", |
| 339 | expansion_config.revision, |
| 340 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 341 | MUX_GUMSTIX(); |
Ash Charles | ea5940e | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 342 | MUX_ARBOR43C(); |
| 343 | setenv("defaultdisplay", "lcd43"); |
| 344 | break; |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 345 | case ETTUS_USRP_E: |
| 346 | printf("Recognized Ettus Research USRP-E (rev %d %s)\n", |
| 347 | expansion_config.revision, |
| 348 | expansion_config.fab_revision); |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 349 | MUX_GUMSTIX(); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 350 | MUX_USRP_E(); |
| 351 | setenv("defaultdisplay", "dvi"); |
| 352 | break; |
| 353 | case GUMSTIX_NO_EEPROM: |
Stefan Herbrechtsmeier | 4ed914a | 2014-09-16 17:51:08 +0200 | [diff] [blame^] | 354 | case GUMSTIX_EMPTY_EEPROM: |
| 355 | puts("No or empty EEPROM on expansion board\n"); |
| 356 | MUX_GUMSTIX(); |
Ash Charles | 12cc543 | 2014-06-10 12:02:36 -0700 | [diff] [blame] | 357 | setenv("expansionname", "tobi"); |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 358 | break; |
| 359 | default: |
Ash Charles | ea5940e | 2014-05-21 14:04:53 -0700 | [diff] [blame] | 360 | printf("Unrecognized expansion board 0x%08x\n", expansion_id); |
| 361 | break; |
Steve Sakoman | d64b5b8 | 2010-09-20 08:05:14 -0700 | [diff] [blame] | 362 | } |
| 363 | |
| 364 | if (expansion_config.content == 1) |
| 365 | setenv(expansion_config.env_var, expansion_config.env_setting); |
| 366 | |
Dirk Behme | e6a6a70 | 2009-03-12 19:30:50 +0100 | [diff] [blame] | 367 | dieid_num_r(); |
| 368 | |
Ash Charles | 12cc543 | 2014-06-10 12:02:36 -0700 | [diff] [blame] | 369 | if (get_cpu_family() == CPU_OMAP34XX) |
| 370 | setenv("boardname", "overo"); |
| 371 | else |
| 372 | setenv("boardname", "overo-storm"); |
| 373 | |
Dirk Behme | 9d0fc81 | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 374 | return 0; |
| 375 | } |
| 376 | |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 377 | /* |
Dirk Behme | 9d0fc81 | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 378 | * Routine: set_muxconf_regs |
| 379 | * Description: Setting up the configuration Mux registers specific to the |
| 380 | * hardware. Many pins need to be moved from protect to primary |
| 381 | * mode. |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 382 | */ |
Dirk Behme | 9d0fc81 | 2009-01-28 21:39:57 +0100 | [diff] [blame] | 383 | void set_muxconf_regs(void) |
| 384 | { |
| 385 | MUX_OVERO(); |
| 386 | } |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 387 | |
Stefan Herbrechtsmeier | 113429a | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 388 | #if defined(CONFIG_CMD_NET) && !defined(CONFIG_SPL_BUILD) |
| 389 | /* GPMC definitions for LAN9221 chips on Tobi expansion boards */ |
| 390 | static const u32 gpmc_lan_config[] = { |
| 391 | NET_LAN9221_GPMC_CONFIG1, |
| 392 | NET_LAN9221_GPMC_CONFIG2, |
| 393 | NET_LAN9221_GPMC_CONFIG3, |
| 394 | NET_LAN9221_GPMC_CONFIG4, |
| 395 | NET_LAN9221_GPMC_CONFIG5, |
| 396 | NET_LAN9221_GPMC_CONFIG6, |
| 397 | /*CONFIG7- computed as params */ |
| 398 | }; |
| 399 | |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 400 | /* |
| 401 | * Routine: setup_net_chip |
| 402 | * Description: Setting up the configuration GPMC registers specific to the |
| 403 | * Ethernet hardware. |
| 404 | */ |
| 405 | static void setup_net_chip(void) |
| 406 | { |
| 407 | struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE; |
| 408 | |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 409 | /* Enable off mode for NWE in PADCONF_GPMC_NWE register */ |
| 410 | writew(readw(&ctrl_base ->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe); |
| 411 | /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */ |
| 412 | writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe); |
| 413 | /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */ |
| 414 | writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00, |
| 415 | &ctrl_base->gpmc_nadv_ale); |
Stefan Herbrechtsmeier | 113429a | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 416 | } |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 417 | |
Stefan Herbrechtsmeier | 113429a | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 418 | /* |
| 419 | * Routine: reset_net_chip |
| 420 | * Description: Reset the Ethernet hardware. |
| 421 | */ |
| 422 | static void reset_net_chip(void) |
| 423 | { |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 424 | /* 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] | 425 | if (!gpio_request(64, "")) { |
| 426 | gpio_direction_output(64, 0); |
| 427 | gpio_set_value(64, 1); |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 428 | udelay(1); |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 429 | gpio_set_value(64, 0); |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 430 | udelay(1); |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 431 | gpio_set_value(64, 1); |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 432 | } |
| 433 | } |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 434 | |
| 435 | int board_eth_init(bd_t *bis) |
| 436 | { |
Stefan Herbrechtsmeier | 113429a | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 437 | unsigned int expansion_id; |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 438 | int rc = 0; |
Stefan Herbrechtsmeier | 113429a | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 439 | |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 440 | #ifdef CONFIG_SMC911X |
Stefan Herbrechtsmeier | 113429a | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 441 | expansion_id = get_expansion_id(); |
| 442 | switch (expansion_id) { |
| 443 | case GUMSTIX_TOBI_DUO: |
| 444 | /* second lan chip */ |
| 445 | enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[4], |
| 446 | 0x2B000000, GPMC_SIZE_16M); |
| 447 | /* no break */ |
| 448 | case GUMSTIX_TOBI: |
| 449 | case GUMSTIX_CHESTNUT43: |
| 450 | case GUMSTIX_STAGECOACH: |
| 451 | case GUMSTIX_NO_EEPROM: |
| 452 | case GUMSTIX_EMPTY_EEPROM: |
| 453 | /* first lan chip */ |
| 454 | enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5], |
| 455 | 0x2C000000, GPMC_SIZE_16M); |
| 456 | |
| 457 | setup_net_chip(); |
| 458 | reset_net_chip(); |
| 459 | |
| 460 | rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); |
| 461 | break; |
| 462 | default: |
| 463 | break; |
| 464 | } |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 465 | #endif |
Stefan Herbrechtsmeier | 113429a | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 466 | |
Olof Johansson | df38262 | 2009-09-29 10:22:45 -0400 | [diff] [blame] | 467 | return rc; |
| 468 | } |
Stefan Herbrechtsmeier | 113429a | 2014-09-16 17:51:07 +0200 | [diff] [blame] | 469 | #endif |
Steve Sakoman | cd7c572 | 2010-09-19 21:21:07 -0700 | [diff] [blame] | 470 | |
Andreas Müller | 137703b | 2012-01-04 15:26:25 +0000 | [diff] [blame] | 471 | #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD) |
Steve Sakoman | cd7c572 | 2010-09-19 21:21:07 -0700 | [diff] [blame] | 472 | int board_mmc_init(bd_t *bis) |
| 473 | { |
Nikita Kiryanov | e3913f5 | 2012-12-03 02:19:47 +0000 | [diff] [blame] | 474 | return omap_mmc_init(0, 0, 0, -1, -1); |
Steve Sakoman | cd7c572 | 2010-09-19 21:21:07 -0700 | [diff] [blame] | 475 | } |
| 476 | #endif |