Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2004-2008 |
| 3 | * Texas Instruments, <www.ti.com> |
| 4 | * |
| 5 | * Author : |
| 6 | * Sunil Kumar <sunilsaini05@gmail.com> |
| 7 | * Shashi Ranjan <shashiranjanmca05@gmail.com> |
| 8 | * |
| 9 | * Derived from Beagle Board and 3430 SDP code by |
| 10 | * Richard Woodruff <r-woodruff2@ti.com> |
| 11 | * Syed Mohammed Khasim <khasim@ti.com> |
| 12 | * |
| 13 | * |
| 14 | * See file CREDITS for list of people who contributed to this |
| 15 | * project. |
| 16 | * |
| 17 | * This program is free software; you can redistribute it and/or |
| 18 | * modify it under the terms of the GNU General Public License as |
| 19 | * published by the Free Software Foundation; either version 2 of |
| 20 | * the License, or (at your option) any later version. |
| 21 | * |
| 22 | * This program is distributed in the hope that it will be useful, |
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 25 | * GNU General Public License for more details. |
| 26 | * |
| 27 | * You should have received a copy of the GNU General Public License |
| 28 | * along with this program; if not, write to the Free Software |
| 29 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 30 | * MA 02111-1307 USA |
| 31 | */ |
| 32 | #include <common.h> |
Jason Kridner | 70d8c94 | 2011-04-18 17:23:35 -0400 | [diff] [blame] | 33 | #ifdef CONFIG_STATUS_LED |
| 34 | #include <status_led.h> |
| 35 | #endif |
Tom Rix | 2c15513 | 2009-06-28 12:52:30 -0500 | [diff] [blame] | 36 | #include <twl4030.h> |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 37 | #include <asm/io.h> |
Steve Sakoman | 0cd3114 | 2010-09-19 21:19:48 -0700 | [diff] [blame] | 38 | #include <asm/arch/mmc_host_def.h> |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 39 | #include <asm/arch/mux.h> |
| 40 | #include <asm/arch/sys_proto.h> |
Tom Rix | 718763c | 2009-06-03 01:53:57 -0500 | [diff] [blame] | 41 | #include <asm/arch/gpio.h> |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 42 | #include <asm/mach-types.h> |
Alexander Holler | d90859a | 2011-04-19 09:30:35 -0400 | [diff] [blame] | 43 | #ifdef CONFIG_USB_EHCI |
| 44 | #include <usb.h> |
| 45 | #include <asm/arch/clocks.h> |
| 46 | #include <asm/arch/clocks_omap3.h> |
| 47 | #include <asm/arch/ehci_omap3.h> |
| 48 | /* from drivers/usb/host/ehci-core.h */ |
| 49 | extern struct ehci_hccr *hccr; |
| 50 | extern volatile struct ehci_hcor *hcor; |
| 51 | #endif |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 52 | #include "beagle.h" |
| 53 | |
Alexander Holler | d90859a | 2011-04-19 09:30:35 -0400 | [diff] [blame] | 54 | #define pr_debug(fmt, args...) debug(fmt, ##args) |
| 55 | |
Koen Kooi | ca5f80a | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 56 | #define TWL4030_I2C_BUS 0 |
| 57 | #define EXPANSION_EEPROM_I2C_BUS 1 |
| 58 | #define EXPANSION_EEPROM_I2C_ADDRESS 0x50 |
| 59 | |
| 60 | #define TINCANTOOLS_ZIPPY 0x01000100 |
| 61 | #define TINCANTOOLS_ZIPPY2 0x02000100 |
| 62 | #define TINCANTOOLS_TRAINER 0x04000100 |
| 63 | #define TINCANTOOLS_SHOWDOG 0x03000100 |
| 64 | #define KBADC_BEAGLEFPGA 0x01000600 |
Koen Kooi | ee8485f | 2011-04-18 17:29:35 -0400 | [diff] [blame] | 65 | #define LW_BEAGLETOUCH 0x01000700 |
| 66 | #define BRAINMUX_LCDOG 0x01000800 |
| 67 | #define BRAINMUX_LCDOGTOUCH 0x02000800 |
| 68 | #define BBTOYS_WIFI 0x01000B00 |
| 69 | #define BBTOYS_VGA 0x02000B00 |
| 70 | #define BBTOYS_LCD 0x03000B00 |
Koen Kooi | ca5f80a | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 71 | #define BEAGLE_NO_EEPROM 0xffffffff |
| 72 | |
John Rigby | 2956532 | 2010-12-20 18:27:51 -0700 | [diff] [blame] | 73 | DECLARE_GLOBAL_DATA_PTR; |
| 74 | |
Koen Kooi | ca5f80a | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 75 | static struct { |
| 76 | unsigned int device_vendor; |
| 77 | unsigned char revision; |
| 78 | unsigned char content; |
| 79 | char fab_revision[8]; |
| 80 | char env_var[16]; |
| 81 | char env_setting[64]; |
| 82 | } expansion_config; |
| 83 | |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 84 | /* |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 85 | * Routine: board_init |
| 86 | * Description: Early hardware init. |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 87 | */ |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 88 | int board_init(void) |
| 89 | { |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 90 | gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ |
| 91 | /* board id for Linux */ |
| 92 | gd->bd->bi_arch_number = MACH_TYPE_OMAP3_BEAGLE; |
| 93 | /* boot param addr */ |
| 94 | gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); |
| 95 | |
Jason Kridner | 70d8c94 | 2011-04-18 17:23:35 -0400 | [diff] [blame] | 96 | #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT) |
| 97 | status_led_set (STATUS_LED_BOOT, STATUS_LED_ON); |
| 98 | #endif |
| 99 | |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 100 | return 0; |
| 101 | } |
| 102 | |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 103 | /* |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 104 | * Routine: get_board_revision |
| 105 | * Description: Detect if we are running on a Beagle revision Ax/Bx, |
Steve Sakoman | 08cbba2ab | 2010-08-19 20:56:11 -0700 | [diff] [blame] | 106 | * C1/2/3, C4 or xM. This can be done by reading |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 107 | * the level of GPIO173, GPIO172 and GPIO171. This should |
| 108 | * result in |
| 109 | * GPIO173, GPIO172, GPIO171: 1 1 1 => Ax/Bx |
| 110 | * GPIO173, GPIO172, GPIO171: 1 1 0 => C1/2/3 |
| 111 | * GPIO173, GPIO172, GPIO171: 1 0 1 => C4 |
Steve Sakoman | 08cbba2ab | 2010-08-19 20:56:11 -0700 | [diff] [blame] | 112 | * GPIO173, GPIO172, GPIO171: 0 0 0 => xM |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 113 | */ |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 114 | int get_board_revision(void) |
Dirk Behme | f956fd0 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 115 | { |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 116 | int revision; |
Dirk Behme | f956fd0 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 117 | |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 118 | if (!omap_request_gpio(171) && |
| 119 | !omap_request_gpio(172) && |
| 120 | !omap_request_gpio(173)) { |
Dirk Behme | f956fd0 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 121 | |
Tom Rix | 718763c | 2009-06-03 01:53:57 -0500 | [diff] [blame] | 122 | omap_set_gpio_direction(171, 1); |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 123 | omap_set_gpio_direction(172, 1); |
| 124 | omap_set_gpio_direction(173, 1); |
Dirk Behme | f956fd0 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 125 | |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 126 | revision = omap_get_gpio_datain(173) << 2 | |
| 127 | omap_get_gpio_datain(172) << 1 | |
| 128 | omap_get_gpio_datain(171); |
| 129 | |
| 130 | omap_free_gpio(171); |
| 131 | omap_free_gpio(172); |
| 132 | omap_free_gpio(173); |
| 133 | } else { |
| 134 | printf("Error: unable to acquire board revision GPIOs\n"); |
| 135 | revision = -1; |
Tom Rix | 718763c | 2009-06-03 01:53:57 -0500 | [diff] [blame] | 136 | } |
Dirk Behme | f956fd0 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 137 | |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 138 | return revision; |
Dirk Behme | f956fd0 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 139 | } |
| 140 | |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 141 | /* |
Koen Kooi | ca5f80a | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 142 | * Routine: get_expansion_id |
| 143 | * Description: This function checks for expansion board by checking I2C |
| 144 | * bus 1 for the availability of an AT24C01B serial EEPROM. |
| 145 | * returns the device_vendor field from the EEPROM |
| 146 | */ |
| 147 | unsigned int get_expansion_id(void) |
| 148 | { |
| 149 | i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS); |
| 150 | |
| 151 | /* return BEAGLE_NO_EEPROM if eeprom doesn't respond */ |
| 152 | if (i2c_probe(EXPANSION_EEPROM_I2C_ADDRESS) == 1) { |
| 153 | i2c_set_bus_num(TWL4030_I2C_BUS); |
| 154 | return BEAGLE_NO_EEPROM; |
| 155 | } |
| 156 | |
| 157 | /* read configuration data */ |
| 158 | i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config, |
| 159 | sizeof(expansion_config)); |
| 160 | |
| 161 | i2c_set_bus_num(TWL4030_I2C_BUS); |
| 162 | |
| 163 | return expansion_config.device_vendor; |
| 164 | } |
| 165 | |
| 166 | /* |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 167 | * Routine: misc_init_r |
| 168 | * Description: Configure board specific parts |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 169 | */ |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 170 | int misc_init_r(void) |
| 171 | { |
Dirk Behme | 97a099e | 2009-08-08 09:30:21 +0200 | [diff] [blame] | 172 | struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE; |
| 173 | struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE; |
Jason Kridner | f14a522 | 2011-04-20 13:52:26 +0000 | [diff] [blame] | 174 | struct control_prog_io *prog_io_base = (struct control_prog_io *)OMAP34XX_CTRL_BASE; |
Steve Kipisz | d4e53f0 | 2011-04-18 17:27:00 -0400 | [diff] [blame] | 175 | |
| 176 | /* Enable i2c2 pullup resisters */ |
| 177 | writel(~(PRG_I2C2_PULLUPRESX), &prog_io_base->io1); |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 178 | |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 179 | switch (get_board_revision()) { |
| 180 | case REVISION_AXBX: |
| 181 | printf("Beagle Rev Ax/Bx\n"); |
| 182 | setenv("beaglerev", "AxBx"); |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 183 | break; |
| 184 | case REVISION_CX: |
| 185 | printf("Beagle Rev C1/C2/C3\n"); |
| 186 | setenv("beaglerev", "Cx"); |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 187 | MUX_BEAGLE_C(); |
| 188 | break; |
| 189 | case REVISION_C4: |
| 190 | printf("Beagle Rev C4\n"); |
Steve Sakoman | 08cbba2ab | 2010-08-19 20:56:11 -0700 | [diff] [blame] | 191 | setenv("beaglerev", "C4"); |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 192 | MUX_BEAGLE_C(); |
| 193 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 194 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 195 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 196 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 197 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
| 198 | break; |
Koen Kooi | f6e593b | 2011-04-18 17:28:32 -0400 | [diff] [blame] | 199 | case REVISION_XM_A: |
Steve Sakoman | 08cbba2ab | 2010-08-19 20:56:11 -0700 | [diff] [blame] | 200 | printf("Beagle xM Rev A\n"); |
| 201 | setenv("beaglerev", "xMA"); |
Koen Kooi | f6e593b | 2011-04-18 17:28:32 -0400 | [diff] [blame] | 202 | MUX_BEAGLE_XM(); |
| 203 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 204 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 205 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 206 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 207 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
| 208 | break; |
| 209 | case REVISION_XM_B: |
| 210 | printf("Beagle xM Rev B\n"); |
| 211 | setenv("beaglerev", "xMB"); |
Steve Sakoman | 08cbba2ab | 2010-08-19 20:56:11 -0700 | [diff] [blame] | 212 | MUX_BEAGLE_XM(); |
| 213 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 214 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 215 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 216 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 217 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
| 218 | break; |
Koen Kooi | 1ffcb34 | 2011-06-17 09:37:37 +0200 | [diff] [blame] | 219 | case REVISION_XM_C: |
| 220 | printf("Beagle xM Rev C\n"); |
| 221 | setenv("beaglerev", "xMC"); |
| 222 | MUX_BEAGLE_XM(); |
| 223 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 224 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 225 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 226 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 227 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
| 228 | break; |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 229 | default: |
| 230 | printf("Beagle unknown 0x%02x\n", get_board_revision()); |
Koen Kooi | f6e593b | 2011-04-18 17:28:32 -0400 | [diff] [blame] | 231 | MUX_BEAGLE_XM(); |
| 232 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 233 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 234 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 235 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 236 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 237 | } |
| 238 | |
Koen Kooi | ca5f80a | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 239 | switch (get_expansion_id()) { |
| 240 | case TINCANTOOLS_ZIPPY: |
| 241 | printf("Recognized Tincantools Zippy board (rev %d %s)\n", |
| 242 | expansion_config.revision, |
| 243 | expansion_config.fab_revision); |
| 244 | MUX_TINCANTOOLS_ZIPPY(); |
| 245 | setenv("buddy", "zippy"); |
| 246 | break; |
| 247 | case TINCANTOOLS_ZIPPY2: |
| 248 | printf("Recognized Tincantools Zippy2 board (rev %d %s)\n", |
| 249 | expansion_config.revision, |
| 250 | expansion_config.fab_revision); |
| 251 | MUX_TINCANTOOLS_ZIPPY(); |
| 252 | setenv("buddy", "zippy2"); |
| 253 | break; |
| 254 | case TINCANTOOLS_TRAINER: |
| 255 | printf("Recognized Tincantools Trainer board (rev %d %s)\n", |
| 256 | expansion_config.revision, |
| 257 | expansion_config.fab_revision); |
| 258 | MUX_TINCANTOOLS_ZIPPY(); |
| 259 | MUX_TINCANTOOLS_TRAINER(); |
| 260 | setenv("buddy", "trainer"); |
| 261 | break; |
| 262 | case TINCANTOOLS_SHOWDOG: |
| 263 | printf("Recognized Tincantools Showdow board (rev %d %s)\n", |
| 264 | expansion_config.revision, |
| 265 | expansion_config.fab_revision); |
| 266 | /* Place holder for DSS2 definition for showdog lcd */ |
| 267 | setenv("defaultdisplay", "showdoglcd"); |
| 268 | setenv("buddy", "showdog"); |
| 269 | break; |
| 270 | case KBADC_BEAGLEFPGA: |
| 271 | printf("Recognized KBADC Beagle FPGA board\n"); |
| 272 | MUX_KBADC_BEAGLEFPGA(); |
| 273 | setenv("buddy", "beaglefpga"); |
| 274 | break; |
Koen Kooi | ee8485f | 2011-04-18 17:29:35 -0400 | [diff] [blame] | 275 | case LW_BEAGLETOUCH: |
| 276 | printf("Recognized Liquidware BeagleTouch board\n"); |
| 277 | setenv("buddy", "beagletouch"); |
| 278 | break; |
| 279 | case BRAINMUX_LCDOG: |
| 280 | printf("Recognized Brainmux LCDog board\n"); |
| 281 | setenv("buddy", "lcdog"); |
| 282 | break; |
| 283 | case BRAINMUX_LCDOGTOUCH: |
| 284 | printf("Recognized Brainmux LCDog Touch board\n"); |
| 285 | setenv("buddy", "lcdogtouch"); |
| 286 | break; |
| 287 | case BBTOYS_WIFI: |
| 288 | printf("Recognized BeagleBoardToys WiFi board\n"); |
| 289 | MUX_BBTOYS_WIFI() |
| 290 | setenv("buddy", "bbtoys-wifi"); |
| 291 | break;; |
| 292 | case BBTOYS_VGA: |
| 293 | printf("Recognized BeagleBoardToys VGA board\n"); |
| 294 | break;; |
| 295 | case BBTOYS_LCD: |
| 296 | printf("Recognized BeagleBoardToys LCD board\n"); |
| 297 | break;; |
Koen Kooi | ca5f80a | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 298 | case BEAGLE_NO_EEPROM: |
| 299 | printf("No EEPROM on expansion board\n"); |
| 300 | setenv("buddy", "none"); |
| 301 | break; |
| 302 | default: |
| 303 | printf("Unrecognized expansion board: %x\n", |
| 304 | expansion_config.device_vendor); |
| 305 | setenv("buddy", "unknown"); |
| 306 | } |
| 307 | |
| 308 | if (expansion_config.content == 1) |
| 309 | setenv(expansion_config.env_var, expansion_config.env_setting); |
| 310 | |
Tom Rix | 2c15513 | 2009-06-28 12:52:30 -0500 | [diff] [blame] | 311 | twl4030_power_init(); |
Grazvydas Ignotas | ead39d7 | 2009-12-10 17:10:21 +0200 | [diff] [blame] | 312 | twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 313 | |
Bob Feretich | 52d82e4 | 2011-02-24 13:16:44 +0000 | [diff] [blame] | 314 | /* Set GPIO states before they are made outputs */ |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 315 | writel(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1, |
| 316 | &gpio6_base->setdataout); |
| 317 | writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 | |
| 318 | GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout); |
| 319 | |
Bob Feretich | 52d82e4 | 2011-02-24 13:16:44 +0000 | [diff] [blame] | 320 | /* Configure GPIOs to output */ |
| 321 | writel(~(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe); |
| 322 | writel(~(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 | |
| 323 | GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe); |
| 324 | |
Dirk Behme | e6a6a70 | 2009-03-12 19:30:50 +0100 | [diff] [blame] | 325 | dieid_num_r(); |
| 326 | |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 327 | return 0; |
| 328 | } |
| 329 | |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 330 | /* |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 331 | * Routine: set_muxconf_regs |
| 332 | * Description: Setting up the configuration Mux registers specific to the |
| 333 | * hardware. Many pins need to be moved from protect to primary |
| 334 | * mode. |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 335 | */ |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 336 | void set_muxconf_regs(void) |
| 337 | { |
| 338 | MUX_BEAGLE(); |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 339 | } |
Steve Sakoman | 0cd3114 | 2010-09-19 21:19:48 -0700 | [diff] [blame] | 340 | |
| 341 | #ifdef CONFIG_GENERIC_MMC |
| 342 | int board_mmc_init(bd_t *bis) |
| 343 | { |
| 344 | omap_mmc_init(0); |
| 345 | return 0; |
| 346 | } |
| 347 | #endif |
Alexander Holler | d90859a | 2011-04-19 09:30:35 -0400 | [diff] [blame] | 348 | |
| 349 | #ifdef CONFIG_USB_EHCI |
| 350 | |
| 351 | #define GPIO_PHY_RESET 147 |
| 352 | |
| 353 | /* Reset is needed otherwise the kernel-driver will throw an error. */ |
| 354 | int ehci_hcd_stop(void) |
| 355 | { |
| 356 | pr_debug("Resetting OMAP3 EHCI\n"); |
| 357 | omap_set_gpio_dataout(GPIO_PHY_RESET, 0); |
| 358 | writel(OMAP_UHH_SYSCONFIG_SOFTRESET, OMAP3_UHH_BASE + OMAP_UHH_SYSCONFIG); |
Koen Kooi | f44047d | 2011-06-17 09:26:17 +0200 | [diff] [blame^] | 359 | /* disable USB clocks */ |
| 360 | struct prcm *prcm_base = (struct prcm *)PRCM_BASE; |
| 361 | sr32(&prcm_base->iclken_usbhost, 0, 1, 0); |
| 362 | sr32(&prcm_base->fclken_usbhost, 0, 2, 0); |
| 363 | sr32(&prcm_base->iclken3_core, 2, 1, 0); |
| 364 | sr32(&prcm_base->fclken3_core, 2, 1, 0); |
Alexander Holler | d90859a | 2011-04-19 09:30:35 -0400 | [diff] [blame] | 365 | return 0; |
| 366 | } |
| 367 | |
| 368 | /* Call usb_stop() before starting the kernel */ |
| 369 | void show_boot_progress(int val) |
| 370 | { |
| 371 | if(val == 15) |
| 372 | usb_stop(); |
| 373 | } |
| 374 | |
| 375 | /* |
| 376 | * Initialize the OMAP3 EHCI controller and PHY on the BeagleBoard. |
| 377 | * Based on "drivers/usb/host/ehci-omap.c" from Linux 2.6.37. |
| 378 | * See there for additional Copyrights. |
| 379 | */ |
| 380 | int ehci_hcd_init(void) |
| 381 | { |
| 382 | pr_debug("Initializing OMAP3 ECHI\n"); |
| 383 | |
| 384 | /* Put the PHY in RESET */ |
| 385 | omap_request_gpio(GPIO_PHY_RESET); |
| 386 | omap_set_gpio_direction(GPIO_PHY_RESET, 0); |
| 387 | omap_set_gpio_dataout(GPIO_PHY_RESET, 0); |
| 388 | |
| 389 | /* Hold the PHY in RESET for enough time till DIR is high */ |
| 390 | /* Refer: ISSUE1 */ |
| 391 | udelay(10); |
| 392 | |
| 393 | struct prcm *prcm_base = (struct prcm *)PRCM_BASE; |
| 394 | /* Enable USBHOST_L3_ICLK (USBHOST_MICLK) */ |
| 395 | sr32(&prcm_base->iclken_usbhost, 0, 1, 1); |
| 396 | /* |
| 397 | * Enable USBHOST_48M_FCLK (USBHOST_FCLK1) |
| 398 | * and USBHOST_120M_FCLK (USBHOST_FCLK2) |
| 399 | */ |
| 400 | sr32(&prcm_base->fclken_usbhost, 0, 2, 3); |
| 401 | /* Enable USBTTL_ICLK */ |
| 402 | sr32(&prcm_base->iclken3_core, 2, 1, 1); |
| 403 | /* Enable USBTTL_FCLK */ |
| 404 | sr32(&prcm_base->fclken3_core, 2, 1, 1); |
| 405 | pr_debug("USB clocks enabled\n"); |
| 406 | |
| 407 | /* perform TLL soft reset, and wait until reset is complete */ |
| 408 | writel(OMAP_USBTLL_SYSCONFIG_SOFTRESET, |
| 409 | OMAP3_USBTLL_BASE + OMAP_USBTLL_SYSCONFIG); |
| 410 | /* Wait for TLL reset to complete */ |
| 411 | while (!(readl(OMAP3_USBTLL_BASE + OMAP_USBTLL_SYSSTATUS) |
| 412 | & OMAP_USBTLL_SYSSTATUS_RESETDONE)); |
| 413 | pr_debug("TLL reset done\n"); |
| 414 | |
| 415 | writel(OMAP_USBTLL_SYSCONFIG_ENAWAKEUP | |
| 416 | OMAP_USBTLL_SYSCONFIG_SIDLEMODE | |
| 417 | OMAP_USBTLL_SYSCONFIG_CACTIVITY, |
| 418 | OMAP3_USBTLL_BASE + OMAP_USBTLL_SYSCONFIG); |
| 419 | |
| 420 | /* Put UHH in NoIdle/NoStandby mode */ |
| 421 | writel(OMAP_UHH_SYSCONFIG_ENAWAKEUP |
| 422 | | OMAP_UHH_SYSCONFIG_SIDLEMODE |
| 423 | | OMAP_UHH_SYSCONFIG_CACTIVITY |
| 424 | | OMAP_UHH_SYSCONFIG_MIDLEMODE, |
| 425 | OMAP3_UHH_BASE + OMAP_UHH_SYSCONFIG); |
| 426 | |
| 427 | /* setup burst configurations */ |
| 428 | writel(OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN |
| 429 | | OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN |
| 430 | | OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN, |
| 431 | OMAP3_UHH_BASE + OMAP_UHH_HOSTCONFIG); |
| 432 | |
| 433 | /* |
| 434 | * Refer ISSUE1: |
| 435 | * Hold the PHY in RESET for enough time till |
| 436 | * PHY is settled and ready |
| 437 | */ |
| 438 | udelay(10); |
| 439 | omap_set_gpio_dataout(GPIO_PHY_RESET, 1); |
| 440 | |
| 441 | hccr = (struct ehci_hccr *)(OMAP3_EHCI_BASE); |
| 442 | hcor = (struct ehci_hcor *)(OMAP3_EHCI_BASE + 0x10); |
| 443 | |
| 444 | pr_debug("OMAP3 EHCI init done\n"); |
| 445 | return 0; |
| 446 | } |
| 447 | |
| 448 | #endif /* CONFIG_USB_EHCI */ |