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