Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 1 | /* |
Tom Rini | 75c57a3 | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 2 | * (C) Copyright 2004-2011 |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 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> |
Tom Rini | 75c57a3 | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 37 | #include <linux/mtd/nand.h> |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 38 | #include <asm/io.h> |
Steve Sakoman | 0cd3114 | 2010-09-19 21:19:48 -0700 | [diff] [blame] | 39 | #include <asm/arch/mmc_host_def.h> |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 40 | #include <asm/arch/mux.h> |
Tom Rini | 75c57a3 | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 41 | #include <asm/arch/mem.h> |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 42 | #include <asm/arch/sys_proto.h> |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 43 | #include <asm/gpio.h> |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 44 | #include <asm/mach-types.h> |
| 45 | #include "beagle.h" |
Jason Kridner | f835ea7 | 2010-07-21 07:41:25 -0500 | [diff] [blame] | 46 | #include <command.h> |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 47 | |
Govindraj.R | 43b6239 | 2012-02-06 03:55:34 +0000 | [diff] [blame^] | 48 | #ifdef CONFIG_USB_EHCI |
| 49 | #include <usb.h> |
| 50 | #include <asm/ehci-omap.h> |
| 51 | #endif |
| 52 | |
Alexander Holler | d90859a | 2011-04-19 09:30:35 -0400 | [diff] [blame] | 53 | #define pr_debug(fmt, args...) debug(fmt, ##args) |
| 54 | |
Koen Kooi | ca5f80a | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 55 | #define TWL4030_I2C_BUS 0 |
| 56 | #define EXPANSION_EEPROM_I2C_BUS 1 |
| 57 | #define EXPANSION_EEPROM_I2C_ADDRESS 0x50 |
| 58 | |
| 59 | #define TINCANTOOLS_ZIPPY 0x01000100 |
| 60 | #define TINCANTOOLS_ZIPPY2 0x02000100 |
| 61 | #define TINCANTOOLS_TRAINER 0x04000100 |
| 62 | #define TINCANTOOLS_SHOWDOG 0x03000100 |
| 63 | #define KBADC_BEAGLEFPGA 0x01000600 |
Koen Kooi | ee8485f | 2011-04-18 17:29:35 -0400 | [diff] [blame] | 64 | #define LW_BEAGLETOUCH 0x01000700 |
| 65 | #define BRAINMUX_LCDOG 0x01000800 |
| 66 | #define BRAINMUX_LCDOGTOUCH 0x02000800 |
| 67 | #define BBTOYS_WIFI 0x01000B00 |
| 68 | #define BBTOYS_VGA 0x02000B00 |
| 69 | #define BBTOYS_LCD 0x03000B00 |
Peter Meerwald | 6cce550 | 2012-01-03 04:14:35 +0000 | [diff] [blame] | 70 | #define BCT_BRETTL3 0x01000F00 |
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 | |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 118 | if (!gpio_request(171, "") && |
| 119 | !gpio_request(172, "") && |
| 120 | !gpio_request(173, "")) { |
Dirk Behme | f956fd0 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 121 | |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 122 | gpio_direction_input(171); |
| 123 | gpio_direction_input(172); |
| 124 | gpio_direction_input(173); |
Dirk Behme | f956fd0 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 125 | |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 126 | revision = gpio_get_value(173) << 2 | |
| 127 | gpio_get_value(172) << 1 | |
| 128 | gpio_get_value(171); |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 129 | } else { |
| 130 | printf("Error: unable to acquire board revision GPIOs\n"); |
| 131 | revision = -1; |
Tom Rix | 718763c | 2009-06-03 01:53:57 -0500 | [diff] [blame] | 132 | } |
Dirk Behme | f956fd0 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 133 | |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 134 | return revision; |
Dirk Behme | f956fd0 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 135 | } |
| 136 | |
Tom Rini | 75c57a3 | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 137 | #ifdef CONFIG_SPL_BUILD |
| 138 | /* |
| 139 | * Routine: get_board_mem_timings |
| 140 | * Description: If we use SPL then there is no x-loader nor config header |
| 141 | * so we have to setup the DDR timings ourself on both banks. |
| 142 | */ |
| 143 | void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl, |
| 144 | u32 *mr) |
| 145 | { |
| 146 | int pop_mfr, pop_id; |
| 147 | |
| 148 | /* |
| 149 | * We need to identify what PoP memory is on the board so that |
| 150 | * we know what timings to use. If we can't identify it then |
| 151 | * we know it's an xM. To map the ID values please see nand_ids.c |
| 152 | */ |
| 153 | identify_nand_chip(&pop_mfr, &pop_id); |
| 154 | |
| 155 | *mr = MICRON_V_MR_165; |
| 156 | switch (get_board_revision()) { |
| 157 | case REVISION_C4: |
| 158 | if (pop_mfr == NAND_MFR_STMICRO && pop_id == 0xba) { |
| 159 | /* 512MB DDR */ |
| 160 | *mcfg = NUMONYX_V_MCFG_165(512 << 20); |
| 161 | *ctrla = NUMONYX_V_ACTIMA_165; |
| 162 | *ctrlb = NUMONYX_V_ACTIMB_165; |
| 163 | *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; |
| 164 | break; |
robertcnelson@gmail.com | 223b8aa | 2012-01-27 07:09:42 +0000 | [diff] [blame] | 165 | } else if (pop_mfr == NAND_MFR_MICRON && pop_id == 0xba) { |
| 166 | /* Beagleboard Rev C4, 512MB Nand/256MB DDR*/ |
| 167 | *mcfg = MICRON_V_MCFG_165(128 << 20); |
| 168 | *ctrla = MICRON_V_ACTIMA_165; |
| 169 | *ctrlb = MICRON_V_ACTIMB_165; |
| 170 | *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; |
| 171 | break; |
Tom Rini | 75c57a3 | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 172 | } else if (pop_mfr == NAND_MFR_MICRON && pop_id == 0xbc) { |
| 173 | /* Beagleboard Rev C5, 256MB DDR */ |
| 174 | *mcfg = MICRON_V_MCFG_200(256 << 20); |
| 175 | *ctrla = MICRON_V_ACTIMA_200; |
| 176 | *ctrlb = MICRON_V_ACTIMB_200; |
| 177 | *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz; |
| 178 | break; |
| 179 | } |
| 180 | case REVISION_XM_A: |
| 181 | case REVISION_XM_B: |
| 182 | case REVISION_XM_C: |
| 183 | if (pop_mfr == 0) { |
| 184 | /* 256MB DDR */ |
| 185 | *mcfg = MICRON_V_MCFG_200(256 << 20); |
| 186 | *ctrla = MICRON_V_ACTIMA_200; |
| 187 | *ctrlb = MICRON_V_ACTIMB_200; |
| 188 | *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz; |
| 189 | } else { |
| 190 | /* 512MB DDR */ |
| 191 | *mcfg = NUMONYX_V_MCFG_165(512 << 20); |
| 192 | *ctrla = NUMONYX_V_ACTIMA_165; |
| 193 | *ctrlb = NUMONYX_V_ACTIMB_165; |
| 194 | *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; |
| 195 | } |
| 196 | break; |
| 197 | default: |
| 198 | /* Assume 128MB and Micron/165MHz timings to be safe */ |
| 199 | *mcfg = MICRON_V_MCFG_165(128 << 20); |
| 200 | *ctrla = MICRON_V_ACTIMA_165; |
| 201 | *ctrlb = MICRON_V_ACTIMB_165; |
| 202 | *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; |
| 203 | } |
| 204 | } |
| 205 | #endif |
| 206 | |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 207 | /* |
Koen Kooi | ca5f80a | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 208 | * Routine: get_expansion_id |
| 209 | * Description: This function checks for expansion board by checking I2C |
| 210 | * bus 1 for the availability of an AT24C01B serial EEPROM. |
| 211 | * returns the device_vendor field from the EEPROM |
| 212 | */ |
| 213 | unsigned int get_expansion_id(void) |
| 214 | { |
| 215 | i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS); |
| 216 | |
| 217 | /* return BEAGLE_NO_EEPROM if eeprom doesn't respond */ |
| 218 | if (i2c_probe(EXPANSION_EEPROM_I2C_ADDRESS) == 1) { |
| 219 | i2c_set_bus_num(TWL4030_I2C_BUS); |
| 220 | return BEAGLE_NO_EEPROM; |
| 221 | } |
| 222 | |
| 223 | /* read configuration data */ |
| 224 | i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config, |
| 225 | sizeof(expansion_config)); |
| 226 | |
| 227 | i2c_set_bus_num(TWL4030_I2C_BUS); |
| 228 | |
| 229 | return expansion_config.device_vendor; |
| 230 | } |
| 231 | |
| 232 | /* |
Jason Kridner | 3f16ab9 | 2011-04-19 14:01:13 -0500 | [diff] [blame] | 233 | * Configure DSS to display background color on DVID |
| 234 | * Configure VENC to display color bar on S-Video |
| 235 | */ |
| 236 | void beagle_display_init(void) |
| 237 | { |
| 238 | omap3_dss_venc_config(&venc_config_std_tv, VENC_HEIGHT, VENC_WIDTH); |
| 239 | switch (get_board_revision()) { |
| 240 | case REVISION_AXBX: |
| 241 | case REVISION_CX: |
| 242 | case REVISION_C4: |
| 243 | omap3_dss_panel_config(&dvid_cfg); |
| 244 | break; |
| 245 | case REVISION_XM_A: |
| 246 | case REVISION_XM_B: |
| 247 | case REVISION_XM_C: |
| 248 | default: |
| 249 | omap3_dss_panel_config(&dvid_cfg_xm); |
| 250 | break; |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | /* |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 255 | * Routine: misc_init_r |
| 256 | * Description: Configure board specific parts |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 257 | */ |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 258 | int misc_init_r(void) |
| 259 | { |
Dirk Behme | 97a099e | 2009-08-08 09:30:21 +0200 | [diff] [blame] | 260 | struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE; |
| 261 | struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE; |
Jason Kridner | f14a522 | 2011-04-20 13:52:26 +0000 | [diff] [blame] | 262 | 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] | 263 | |
| 264 | /* Enable i2c2 pullup resisters */ |
| 265 | writel(~(PRG_I2C2_PULLUPRESX), &prog_io_base->io1); |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 266 | |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 267 | switch (get_board_revision()) { |
| 268 | case REVISION_AXBX: |
| 269 | printf("Beagle Rev Ax/Bx\n"); |
| 270 | setenv("beaglerev", "AxBx"); |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 271 | break; |
| 272 | case REVISION_CX: |
| 273 | printf("Beagle Rev C1/C2/C3\n"); |
| 274 | setenv("beaglerev", "Cx"); |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 275 | MUX_BEAGLE_C(); |
| 276 | break; |
| 277 | case REVISION_C4: |
| 278 | printf("Beagle Rev C4\n"); |
Steve Sakoman | 08cbba2ab | 2010-08-19 20:56:11 -0700 | [diff] [blame] | 279 | setenv("beaglerev", "C4"); |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 280 | MUX_BEAGLE_C(); |
| 281 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 282 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 283 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 284 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 285 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
| 286 | break; |
Koen Kooi | f6e593b | 2011-04-18 17:28:32 -0400 | [diff] [blame] | 287 | case REVISION_XM_A: |
Steve Sakoman | 08cbba2ab | 2010-08-19 20:56:11 -0700 | [diff] [blame] | 288 | printf("Beagle xM Rev A\n"); |
| 289 | setenv("beaglerev", "xMA"); |
Koen Kooi | f6e593b | 2011-04-18 17:28:32 -0400 | [diff] [blame] | 290 | MUX_BEAGLE_XM(); |
| 291 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 292 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 293 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 294 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 295 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
| 296 | break; |
| 297 | case REVISION_XM_B: |
| 298 | printf("Beagle xM Rev B\n"); |
| 299 | setenv("beaglerev", "xMB"); |
Steve Sakoman | 08cbba2ab | 2010-08-19 20:56:11 -0700 | [diff] [blame] | 300 | MUX_BEAGLE_XM(); |
| 301 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 302 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 303 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 304 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 305 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
| 306 | break; |
Koen Kooi | 1ffcb34 | 2011-06-17 09:37:37 +0200 | [diff] [blame] | 307 | case REVISION_XM_C: |
| 308 | printf("Beagle xM Rev C\n"); |
| 309 | setenv("beaglerev", "xMC"); |
| 310 | MUX_BEAGLE_XM(); |
| 311 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 312 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 313 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 314 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 315 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
| 316 | break; |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 317 | default: |
| 318 | printf("Beagle unknown 0x%02x\n", get_board_revision()); |
Koen Kooi | f6e593b | 2011-04-18 17:28:32 -0400 | [diff] [blame] | 319 | MUX_BEAGLE_XM(); |
| 320 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 321 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 322 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 323 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 324 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
Steve Sakoman | 06b95bd | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 325 | } |
| 326 | |
Koen Kooi | ca5f80a | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 327 | switch (get_expansion_id()) { |
| 328 | case TINCANTOOLS_ZIPPY: |
| 329 | printf("Recognized Tincantools Zippy board (rev %d %s)\n", |
| 330 | expansion_config.revision, |
| 331 | expansion_config.fab_revision); |
| 332 | MUX_TINCANTOOLS_ZIPPY(); |
| 333 | setenv("buddy", "zippy"); |
| 334 | break; |
| 335 | case TINCANTOOLS_ZIPPY2: |
| 336 | printf("Recognized Tincantools Zippy2 board (rev %d %s)\n", |
| 337 | expansion_config.revision, |
| 338 | expansion_config.fab_revision); |
| 339 | MUX_TINCANTOOLS_ZIPPY(); |
| 340 | setenv("buddy", "zippy2"); |
| 341 | break; |
| 342 | case TINCANTOOLS_TRAINER: |
| 343 | printf("Recognized Tincantools Trainer board (rev %d %s)\n", |
| 344 | expansion_config.revision, |
| 345 | expansion_config.fab_revision); |
| 346 | MUX_TINCANTOOLS_ZIPPY(); |
| 347 | MUX_TINCANTOOLS_TRAINER(); |
| 348 | setenv("buddy", "trainer"); |
| 349 | break; |
| 350 | case TINCANTOOLS_SHOWDOG: |
| 351 | printf("Recognized Tincantools Showdow board (rev %d %s)\n", |
| 352 | expansion_config.revision, |
| 353 | expansion_config.fab_revision); |
| 354 | /* Place holder for DSS2 definition for showdog lcd */ |
| 355 | setenv("defaultdisplay", "showdoglcd"); |
| 356 | setenv("buddy", "showdog"); |
| 357 | break; |
| 358 | case KBADC_BEAGLEFPGA: |
| 359 | printf("Recognized KBADC Beagle FPGA board\n"); |
| 360 | MUX_KBADC_BEAGLEFPGA(); |
| 361 | setenv("buddy", "beaglefpga"); |
| 362 | break; |
Koen Kooi | ee8485f | 2011-04-18 17:29:35 -0400 | [diff] [blame] | 363 | case LW_BEAGLETOUCH: |
| 364 | printf("Recognized Liquidware BeagleTouch board\n"); |
| 365 | setenv("buddy", "beagletouch"); |
| 366 | break; |
| 367 | case BRAINMUX_LCDOG: |
| 368 | printf("Recognized Brainmux LCDog board\n"); |
| 369 | setenv("buddy", "lcdog"); |
| 370 | break; |
| 371 | case BRAINMUX_LCDOGTOUCH: |
| 372 | printf("Recognized Brainmux LCDog Touch board\n"); |
| 373 | setenv("buddy", "lcdogtouch"); |
| 374 | break; |
| 375 | case BBTOYS_WIFI: |
| 376 | printf("Recognized BeagleBoardToys WiFi board\n"); |
| 377 | MUX_BBTOYS_WIFI() |
| 378 | setenv("buddy", "bbtoys-wifi"); |
| 379 | break;; |
| 380 | case BBTOYS_VGA: |
| 381 | printf("Recognized BeagleBoardToys VGA board\n"); |
| 382 | break;; |
| 383 | case BBTOYS_LCD: |
| 384 | printf("Recognized BeagleBoardToys LCD board\n"); |
| 385 | break;; |
Peter Meerwald | 6cce550 | 2012-01-03 04:14:35 +0000 | [diff] [blame] | 386 | case BCT_BRETTL3: |
| 387 | printf("Recognized bct electronic GmbH brettl3 board\n"); |
| 388 | break; |
Koen Kooi | ca5f80a | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 389 | case BEAGLE_NO_EEPROM: |
| 390 | printf("No EEPROM on expansion board\n"); |
| 391 | setenv("buddy", "none"); |
| 392 | break; |
| 393 | default: |
| 394 | printf("Unrecognized expansion board: %x\n", |
| 395 | expansion_config.device_vendor); |
| 396 | setenv("buddy", "unknown"); |
| 397 | } |
| 398 | |
| 399 | if (expansion_config.content == 1) |
| 400 | setenv(expansion_config.env_var, expansion_config.env_setting); |
| 401 | |
Tom Rix | 2c15513 | 2009-06-28 12:52:30 -0500 | [diff] [blame] | 402 | twl4030_power_init(); |
Christian Spielberger | 38a77c3 | 2011-08-24 17:17:31 -0500 | [diff] [blame] | 403 | switch (get_board_revision()) { |
| 404 | case REVISION_XM_A: |
| 405 | case REVISION_XM_B: |
| 406 | twl4030_led_init(TWL4030_LED_LEDEN_LEDBON); |
| 407 | break; |
| 408 | default: |
| 409 | twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); |
| 410 | break; |
| 411 | } |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 412 | |
Bob Feretich | 52d82e4 | 2011-02-24 13:16:44 +0000 | [diff] [blame] | 413 | /* Set GPIO states before they are made outputs */ |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 414 | writel(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1, |
| 415 | &gpio6_base->setdataout); |
| 416 | writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 | |
| 417 | GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout); |
| 418 | |
Bob Feretich | 52d82e4 | 2011-02-24 13:16:44 +0000 | [diff] [blame] | 419 | /* Configure GPIOs to output */ |
| 420 | writel(~(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe); |
| 421 | writel(~(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 | |
| 422 | GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe); |
| 423 | |
Dirk Behme | e6a6a70 | 2009-03-12 19:30:50 +0100 | [diff] [blame] | 424 | dieid_num_r(); |
Jason Kridner | 3f16ab9 | 2011-04-19 14:01:13 -0500 | [diff] [blame] | 425 | beagle_display_init(); |
| 426 | omap3_dss_enable(); |
Dirk Behme | e6a6a70 | 2009-03-12 19:30:50 +0100 | [diff] [blame] | 427 | |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 428 | return 0; |
| 429 | } |
| 430 | |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 431 | /* |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 432 | * Routine: set_muxconf_regs |
| 433 | * Description: Setting up the configuration Mux registers specific to the |
| 434 | * hardware. Many pins need to be moved from protect to primary |
| 435 | * mode. |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 436 | */ |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 437 | void set_muxconf_regs(void) |
| 438 | { |
| 439 | MUX_BEAGLE(); |
Dirk Behme | f904cdb | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 440 | } |
Steve Sakoman | 0cd3114 | 2010-09-19 21:19:48 -0700 | [diff] [blame] | 441 | |
Tom Rini | 75c57a3 | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 442 | #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD) |
Steve Sakoman | 0cd3114 | 2010-09-19 21:19:48 -0700 | [diff] [blame] | 443 | int board_mmc_init(bd_t *bis) |
| 444 | { |
| 445 | omap_mmc_init(0); |
| 446 | return 0; |
| 447 | } |
| 448 | #endif |
Alexander Holler | d90859a | 2011-04-19 09:30:35 -0400 | [diff] [blame] | 449 | |
| 450 | #ifdef CONFIG_USB_EHCI |
Alexander Holler | d90859a | 2011-04-19 09:30:35 -0400 | [diff] [blame] | 451 | /* Call usb_stop() before starting the kernel */ |
| 452 | void show_boot_progress(int val) |
| 453 | { |
| 454 | if(val == 15) |
| 455 | usb_stop(); |
| 456 | } |
Govindraj.R | 43b6239 | 2012-02-06 03:55:34 +0000 | [diff] [blame^] | 457 | |
| 458 | static struct omap_usbhs_board_data usbhs_bdata = { |
| 459 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
| 460 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
| 461 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED |
| 462 | }; |
| 463 | |
| 464 | int ehci_hcd_init(void) |
| 465 | { |
| 466 | return omap_ehci_hcd_init(&usbhs_bdata); |
| 467 | } |
| 468 | |
| 469 | int ehci_hcd_stop(void) |
| 470 | { |
| 471 | return omap_ehci_hcd_stop(); |
| 472 | } |
| 473 | |
Alexander Holler | d90859a | 2011-04-19 09:30:35 -0400 | [diff] [blame] | 474 | #endif /* CONFIG_USB_EHCI */ |
Jason Kridner | f835ea7 | 2010-07-21 07:41:25 -0500 | [diff] [blame] | 475 | |
Tom Rini | 75c57a3 | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 476 | #ifndef CONFIG_SPL_BUILD |
Jason Kridner | f835ea7 | 2010-07-21 07:41:25 -0500 | [diff] [blame] | 477 | /* |
| 478 | * This command returns the status of the user button on beagle xM |
| 479 | * Input - none |
| 480 | * Returns - 1 if button is held down |
| 481 | * 0 if button is not held down |
| 482 | */ |
Dirk Behme | 513e6fd | 2011-09-22 01:53:22 +0000 | [diff] [blame] | 483 | int do_userbutton(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Jason Kridner | f835ea7 | 2010-07-21 07:41:25 -0500 | [diff] [blame] | 484 | { |
| 485 | int button = 0; |
| 486 | int gpio; |
| 487 | |
| 488 | /* |
| 489 | * pass address parameter as argv[0] (aka command name), |
| 490 | * and all remaining args |
| 491 | */ |
| 492 | switch (get_board_revision()) { |
| 493 | case REVISION_AXBX: |
| 494 | case REVISION_CX: |
| 495 | case REVISION_C4: |
| 496 | gpio = 7; |
| 497 | break; |
| 498 | case REVISION_XM_A: |
| 499 | case REVISION_XM_B: |
| 500 | case REVISION_XM_C: |
| 501 | default: |
| 502 | gpio = 4; |
| 503 | break; |
| 504 | } |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 505 | gpio_request(gpio, ""); |
| 506 | gpio_direction_input(gpio); |
Jason Kridner | f835ea7 | 2010-07-21 07:41:25 -0500 | [diff] [blame] | 507 | printf("The user button is currently "); |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 508 | if (gpio_get_value(gpio)) |
Jason Kridner | f835ea7 | 2010-07-21 07:41:25 -0500 | [diff] [blame] | 509 | { |
| 510 | button = 1; |
| 511 | printf("PRESSED.\n"); |
| 512 | } |
| 513 | else |
| 514 | { |
| 515 | button = 0; |
| 516 | printf("NOT pressed.\n"); |
| 517 | } |
| 518 | |
Jason Kridner | f835ea7 | 2010-07-21 07:41:25 -0500 | [diff] [blame] | 519 | return !button; |
| 520 | } |
| 521 | |
| 522 | /* -------------------------------------------------------------------- */ |
| 523 | |
| 524 | U_BOOT_CMD( |
| 525 | userbutton, CONFIG_SYS_MAXARGS, 1, do_userbutton, |
| 526 | "Return the status of the BeagleBoard USER button", |
| 527 | "" |
| 528 | ); |
Tom Rini | 75c57a3 | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 529 | #endif |