Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 1 | /* |
Tom Rini | 06c32fb | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 2 | * (C) Copyright 2004-2011 |
Dirk Behme | 2781f80 | 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 | c3ef8bc | 2011-04-18 17:23:35 -0400 | [diff] [blame] | 33 | #ifdef CONFIG_STATUS_LED |
| 34 | #include <status_led.h> |
| 35 | #endif |
Tom Rix | 0f2a804 | 2009-06-28 12:52:30 -0500 | [diff] [blame] | 36 | #include <twl4030.h> |
Tom Rini | 06c32fb | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 37 | #include <linux/mtd/nand.h> |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 38 | #include <asm/io.h> |
Steve Sakoman | 57c6241 | 2010-09-19 21:19:48 -0700 | [diff] [blame] | 39 | #include <asm/arch/mmc_host_def.h> |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 40 | #include <asm/arch/mux.h> |
Tom Rini | 06c32fb | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 41 | #include <asm/arch/mem.h> |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 42 | #include <asm/arch/sys_proto.h> |
Sanjeev Premi | 7b3dc82 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 43 | #include <asm/gpio.h> |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 44 | #include <asm/mach-types.h> |
| 45 | #include "beagle.h" |
Jason Kridner | 85a08fb | 2010-07-21 07:41:25 -0500 | [diff] [blame] | 46 | #include <command.h> |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 47 | |
Govindraj.R | edc16a0 | 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 | |
Koen Kooi | b6241c2 | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 53 | #define TWL4030_I2C_BUS 0 |
| 54 | #define EXPANSION_EEPROM_I2C_BUS 1 |
| 55 | #define EXPANSION_EEPROM_I2C_ADDRESS 0x50 |
| 56 | |
| 57 | #define TINCANTOOLS_ZIPPY 0x01000100 |
| 58 | #define TINCANTOOLS_ZIPPY2 0x02000100 |
| 59 | #define TINCANTOOLS_TRAINER 0x04000100 |
| 60 | #define TINCANTOOLS_SHOWDOG 0x03000100 |
| 61 | #define KBADC_BEAGLEFPGA 0x01000600 |
Koen Kooi | 3d5dac6 | 2011-04-18 17:29:35 -0400 | [diff] [blame] | 62 | #define LW_BEAGLETOUCH 0x01000700 |
| 63 | #define BRAINMUX_LCDOG 0x01000800 |
| 64 | #define BRAINMUX_LCDOGTOUCH 0x02000800 |
| 65 | #define BBTOYS_WIFI 0x01000B00 |
| 66 | #define BBTOYS_VGA 0x02000B00 |
| 67 | #define BBTOYS_LCD 0x03000B00 |
Peter Meerwald | 1aca738 | 2012-01-03 04:14:35 +0000 | [diff] [blame] | 68 | #define BCT_BRETTL3 0x01000F00 |
Peter Meerwald | ad5691f | 2012-06-28 05:38:35 +0000 | [diff] [blame] | 69 | #define BCT_BRETTL4 0x02000F00 |
Koen Kooi | b6241c2 | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 70 | #define BEAGLE_NO_EEPROM 0xffffffff |
| 71 | |
John Rigby | 0d21ed0 | 2010-12-20 18:27:51 -0700 | [diff] [blame] | 72 | DECLARE_GLOBAL_DATA_PTR; |
| 73 | |
Koen Kooi | b6241c2 | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 74 | static struct { |
| 75 | unsigned int device_vendor; |
| 76 | unsigned char revision; |
| 77 | unsigned char content; |
| 78 | char fab_revision[8]; |
| 79 | char env_var[16]; |
| 80 | char env_setting[64]; |
| 81 | } expansion_config; |
| 82 | |
Tom Rix | 558bb83 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 83 | /* |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 84 | * Routine: board_init |
| 85 | * Description: Early hardware init. |
Tom Rix | 558bb83 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 86 | */ |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 87 | int board_init(void) |
| 88 | { |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 89 | gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ |
| 90 | /* board id for Linux */ |
| 91 | gd->bd->bi_arch_number = MACH_TYPE_OMAP3_BEAGLE; |
| 92 | /* boot param addr */ |
| 93 | gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); |
| 94 | |
Jason Kridner | c3ef8bc | 2011-04-18 17:23:35 -0400 | [diff] [blame] | 95 | #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT) |
| 96 | status_led_set (STATUS_LED_BOOT, STATUS_LED_ON); |
| 97 | #endif |
| 98 | |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 99 | return 0; |
| 100 | } |
| 101 | |
Tom Rix | 558bb83 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 102 | /* |
Steve Sakoman | 3ca3376 | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 103 | * Routine: get_board_revision |
| 104 | * Description: Detect if we are running on a Beagle revision Ax/Bx, |
Steve Sakoman | ac92995 | 2010-08-19 20:56:11 -0700 | [diff] [blame] | 105 | * C1/2/3, C4 or xM. This can be done by reading |
Steve Sakoman | 3ca3376 | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 106 | * the level of GPIO173, GPIO172 and GPIO171. This should |
| 107 | * result in |
| 108 | * GPIO173, GPIO172, GPIO171: 1 1 1 => Ax/Bx |
| 109 | * GPIO173, GPIO172, GPIO171: 1 1 0 => C1/2/3 |
| 110 | * GPIO173, GPIO172, GPIO171: 1 0 1 => C4 |
Steve Sakoman | ac92995 | 2010-08-19 20:56:11 -0700 | [diff] [blame] | 111 | * GPIO173, GPIO172, GPIO171: 0 0 0 => xM |
Tom Rix | 558bb83 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 112 | */ |
Peter Meerwald | a93ee5f | 2012-07-02 03:19:03 +0000 | [diff] [blame] | 113 | static int get_board_revision(void) |
Dirk Behme | 7871611 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 114 | { |
Steve Sakoman | 3ca3376 | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 115 | int revision; |
Dirk Behme | 7871611 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 116 | |
Sanjeev Premi | 7b3dc82 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 117 | if (!gpio_request(171, "") && |
| 118 | !gpio_request(172, "") && |
| 119 | !gpio_request(173, "")) { |
Dirk Behme | 7871611 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 120 | |
Sanjeev Premi | 7b3dc82 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 121 | gpio_direction_input(171); |
| 122 | gpio_direction_input(172); |
| 123 | gpio_direction_input(173); |
Dirk Behme | 7871611 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 124 | |
Sanjeev Premi | 7b3dc82 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 125 | revision = gpio_get_value(173) << 2 | |
| 126 | gpio_get_value(172) << 1 | |
| 127 | gpio_get_value(171); |
Steve Sakoman | 3ca3376 | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 128 | } else { |
| 129 | printf("Error: unable to acquire board revision GPIOs\n"); |
| 130 | revision = -1; |
Tom Rix | 70d0541 | 2009-06-03 01:53:57 -0500 | [diff] [blame] | 131 | } |
Dirk Behme | 7871611 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 132 | |
Steve Sakoman | 3ca3376 | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 133 | return revision; |
Dirk Behme | 7871611 | 2009-02-12 18:55:41 +0100 | [diff] [blame] | 134 | } |
| 135 | |
Tom Rini | 06c32fb | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 136 | #ifdef CONFIG_SPL_BUILD |
| 137 | /* |
| 138 | * Routine: get_board_mem_timings |
| 139 | * Description: If we use SPL then there is no x-loader nor config header |
| 140 | * so we have to setup the DDR timings ourself on both banks. |
| 141 | */ |
Peter Barada | edb5c2f | 2012-11-13 07:40:28 +0000 | [diff] [blame^] | 142 | void get_board_mem_timings(struct board_sdrc_timings *timings) |
Tom Rini | 06c32fb | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 143 | { |
| 144 | int pop_mfr, pop_id; |
| 145 | |
| 146 | /* |
| 147 | * We need to identify what PoP memory is on the board so that |
| 148 | * we know what timings to use. If we can't identify it then |
| 149 | * we know it's an xM. To map the ID values please see nand_ids.c |
| 150 | */ |
| 151 | identify_nand_chip(&pop_mfr, &pop_id); |
| 152 | |
Peter Barada | edb5c2f | 2012-11-13 07:40:28 +0000 | [diff] [blame^] | 153 | timings->mr = MICRON_V_MR_165; |
Tom Rini | 06c32fb | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 154 | switch (get_board_revision()) { |
| 155 | case REVISION_C4: |
| 156 | if (pop_mfr == NAND_MFR_STMICRO && pop_id == 0xba) { |
| 157 | /* 512MB DDR */ |
Peter Barada | edb5c2f | 2012-11-13 07:40:28 +0000 | [diff] [blame^] | 158 | timings->mcfg = NUMONYX_V_MCFG_165(512 << 20); |
| 159 | timings->ctrla = NUMONYX_V_ACTIMA_165; |
| 160 | timings->ctrlb = NUMONYX_V_ACTIMB_165; |
| 161 | timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; |
Tom Rini | 06c32fb | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 162 | break; |
robertcnelson@gmail.com | 4b949bb | 2012-01-27 07:09:42 +0000 | [diff] [blame] | 163 | } else if (pop_mfr == NAND_MFR_MICRON && pop_id == 0xba) { |
| 164 | /* Beagleboard Rev C4, 512MB Nand/256MB DDR*/ |
Peter Barada | edb5c2f | 2012-11-13 07:40:28 +0000 | [diff] [blame^] | 165 | timings->mcfg = MICRON_V_MCFG_165(128 << 20); |
| 166 | timings->ctrla = MICRON_V_ACTIMA_165; |
| 167 | timings->ctrlb = MICRON_V_ACTIMB_165; |
| 168 | timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; |
robertcnelson@gmail.com | 4b949bb | 2012-01-27 07:09:42 +0000 | [diff] [blame] | 169 | break; |
Tom Rini | 06c32fb | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 170 | } else if (pop_mfr == NAND_MFR_MICRON && pop_id == 0xbc) { |
| 171 | /* Beagleboard Rev C5, 256MB DDR */ |
Peter Barada | edb5c2f | 2012-11-13 07:40:28 +0000 | [diff] [blame^] | 172 | timings->mcfg = MICRON_V_MCFG_200(256 << 20); |
| 173 | timings->ctrla = MICRON_V_ACTIMA_200; |
| 174 | timings->ctrlb = MICRON_V_ACTIMB_200; |
| 175 | timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz; |
Tom Rini | 06c32fb | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 176 | break; |
| 177 | } |
| 178 | case REVISION_XM_A: |
| 179 | case REVISION_XM_B: |
| 180 | case REVISION_XM_C: |
| 181 | if (pop_mfr == 0) { |
| 182 | /* 256MB DDR */ |
Peter Barada | edb5c2f | 2012-11-13 07:40:28 +0000 | [diff] [blame^] | 183 | timings->mcfg = MICRON_V_MCFG_200(256 << 20); |
| 184 | timings->ctrla = MICRON_V_ACTIMA_200; |
| 185 | timings->ctrlb = MICRON_V_ACTIMB_200; |
| 186 | timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz; |
Tom Rini | 06c32fb | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 187 | } else { |
| 188 | /* 512MB DDR */ |
Peter Barada | edb5c2f | 2012-11-13 07:40:28 +0000 | [diff] [blame^] | 189 | timings->mcfg = NUMONYX_V_MCFG_165(512 << 20); |
| 190 | timings->ctrla = NUMONYX_V_ACTIMA_165; |
| 191 | timings->ctrlb = NUMONYX_V_ACTIMB_165; |
| 192 | timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; |
Tom Rini | 06c32fb | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 193 | } |
| 194 | break; |
| 195 | default: |
| 196 | /* Assume 128MB and Micron/165MHz timings to be safe */ |
Peter Barada | edb5c2f | 2012-11-13 07:40:28 +0000 | [diff] [blame^] | 197 | timings->mcfg = MICRON_V_MCFG_165(128 << 20); |
| 198 | timings->ctrla = MICRON_V_ACTIMA_165; |
| 199 | timings->ctrlb = MICRON_V_ACTIMB_165; |
| 200 | timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; |
Tom Rini | 06c32fb | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 201 | } |
| 202 | } |
| 203 | #endif |
| 204 | |
Tom Rix | 558bb83 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 205 | /* |
Koen Kooi | b6241c2 | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 206 | * Routine: get_expansion_id |
| 207 | * Description: This function checks for expansion board by checking I2C |
| 208 | * bus 1 for the availability of an AT24C01B serial EEPROM. |
| 209 | * returns the device_vendor field from the EEPROM |
| 210 | */ |
Peter Meerwald | a93ee5f | 2012-07-02 03:19:03 +0000 | [diff] [blame] | 211 | static unsigned int get_expansion_id(void) |
Koen Kooi | b6241c2 | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 212 | { |
| 213 | i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS); |
| 214 | |
| 215 | /* return BEAGLE_NO_EEPROM if eeprom doesn't respond */ |
| 216 | if (i2c_probe(EXPANSION_EEPROM_I2C_ADDRESS) == 1) { |
| 217 | i2c_set_bus_num(TWL4030_I2C_BUS); |
| 218 | return BEAGLE_NO_EEPROM; |
| 219 | } |
| 220 | |
| 221 | /* read configuration data */ |
| 222 | i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config, |
| 223 | sizeof(expansion_config)); |
| 224 | |
| 225 | i2c_set_bus_num(TWL4030_I2C_BUS); |
| 226 | |
| 227 | return expansion_config.device_vendor; |
| 228 | } |
| 229 | |
Peter Meerwald | a2f5456 | 2012-07-10 06:07:34 +0000 | [diff] [blame] | 230 | #ifdef CONFIG_VIDEO_OMAP3 |
Koen Kooi | b6241c2 | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 231 | /* |
Jason Kridner | b8f6ac5 | 2011-04-19 14:01:13 -0500 | [diff] [blame] | 232 | * Configure DSS to display background color on DVID |
| 233 | * Configure VENC to display color bar on S-Video |
| 234 | */ |
Peter Meerwald | a93ee5f | 2012-07-02 03:19:03 +0000 | [diff] [blame] | 235 | static void beagle_display_init(void) |
Jason Kridner | b8f6ac5 | 2011-04-19 14:01:13 -0500 | [diff] [blame] | 236 | { |
| 237 | omap3_dss_venc_config(&venc_config_std_tv, VENC_HEIGHT, VENC_WIDTH); |
| 238 | switch (get_board_revision()) { |
| 239 | case REVISION_AXBX: |
| 240 | case REVISION_CX: |
| 241 | case REVISION_C4: |
| 242 | omap3_dss_panel_config(&dvid_cfg); |
| 243 | break; |
| 244 | case REVISION_XM_A: |
| 245 | case REVISION_XM_B: |
| 246 | case REVISION_XM_C: |
| 247 | default: |
| 248 | omap3_dss_panel_config(&dvid_cfg_xm); |
| 249 | break; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | /* |
Peter Meerwald | 03ed046 | 2012-02-08 05:24:26 +0000 | [diff] [blame] | 254 | * Enable DVI power |
| 255 | */ |
Anatolij Gustschin | 359260b | 2012-03-27 23:05:07 +0000 | [diff] [blame] | 256 | static void beagle_dvi_pup(void) |
| 257 | { |
Peter Meerwald | 03ed046 | 2012-02-08 05:24:26 +0000 | [diff] [blame] | 258 | uchar val; |
| 259 | |
| 260 | switch (get_board_revision()) { |
| 261 | case REVISION_AXBX: |
| 262 | case REVISION_CX: |
| 263 | case REVISION_C4: |
| 264 | case REVISION_XM_A: |
| 265 | gpio_request(170, ""); |
| 266 | gpio_direction_output(170, 0); |
| 267 | gpio_set_value(170, 1); |
| 268 | break; |
| 269 | case REVISION_XM_B: |
| 270 | case REVISION_XM_C: |
| 271 | default: |
| 272 | #define GPIODATADIR1 (TWL4030_BASEADD_GPIO+3) |
| 273 | #define GPIODATAOUT1 (TWL4030_BASEADD_GPIO+6) |
| 274 | |
| 275 | i2c_read(TWL4030_CHIP_GPIO, GPIODATADIR1, 1, &val, 1); |
| 276 | val |= 4; |
| 277 | i2c_write(TWL4030_CHIP_GPIO, GPIODATADIR1, 1, &val, 1); |
| 278 | |
| 279 | i2c_read(TWL4030_CHIP_GPIO, GPIODATAOUT1, 1, &val, 1); |
| 280 | val |= 4; |
| 281 | i2c_write(TWL4030_CHIP_GPIO, GPIODATAOUT1, 1, &val, 1); |
| 282 | break; |
| 283 | } |
| 284 | } |
Peter Meerwald | a2f5456 | 2012-07-10 06:07:34 +0000 | [diff] [blame] | 285 | #endif |
Peter Meerwald | 03ed046 | 2012-02-08 05:24:26 +0000 | [diff] [blame] | 286 | |
| 287 | /* |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 288 | * Routine: misc_init_r |
| 289 | * Description: Configure board specific parts |
Tom Rix | 558bb83 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 290 | */ |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 291 | int misc_init_r(void) |
| 292 | { |
Dirk Behme | dc7af20 | 2009-08-08 09:30:21 +0200 | [diff] [blame] | 293 | struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE; |
| 294 | struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE; |
Jason Kridner | 40aebca | 2011-04-20 13:52:26 +0000 | [diff] [blame] | 295 | struct control_prog_io *prog_io_base = (struct control_prog_io *)OMAP34XX_CTRL_BASE; |
Steve Kipisz | bf7438a | 2011-04-18 17:27:00 -0400 | [diff] [blame] | 296 | |
| 297 | /* Enable i2c2 pullup resisters */ |
| 298 | writel(~(PRG_I2C2_PULLUPRESX), &prog_io_base->io1); |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 299 | |
Steve Sakoman | 3ca3376 | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 300 | switch (get_board_revision()) { |
| 301 | case REVISION_AXBX: |
| 302 | printf("Beagle Rev Ax/Bx\n"); |
| 303 | setenv("beaglerev", "AxBx"); |
Steve Sakoman | 3ca3376 | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 304 | break; |
| 305 | case REVISION_CX: |
| 306 | printf("Beagle Rev C1/C2/C3\n"); |
| 307 | setenv("beaglerev", "Cx"); |
Steve Sakoman | 3ca3376 | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 308 | MUX_BEAGLE_C(); |
| 309 | break; |
| 310 | case REVISION_C4: |
| 311 | printf("Beagle Rev C4\n"); |
Steve Sakoman | ac92995 | 2010-08-19 20:56:11 -0700 | [diff] [blame] | 312 | setenv("beaglerev", "C4"); |
Steve Sakoman | 3ca3376 | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 313 | MUX_BEAGLE_C(); |
| 314 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 315 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 316 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 317 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 318 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
| 319 | break; |
Koen Kooi | 5b8018c | 2011-04-18 17:28:32 -0400 | [diff] [blame] | 320 | case REVISION_XM_A: |
Steve Sakoman | ac92995 | 2010-08-19 20:56:11 -0700 | [diff] [blame] | 321 | printf("Beagle xM Rev A\n"); |
| 322 | setenv("beaglerev", "xMA"); |
Steve Sakoman | ac92995 | 2010-08-19 20:56:11 -0700 | [diff] [blame] | 323 | MUX_BEAGLE_XM(); |
| 324 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 325 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 326 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 327 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 328 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
| 329 | break; |
Koen Kooi | 5b8018c | 2011-04-18 17:28:32 -0400 | [diff] [blame] | 330 | case REVISION_XM_B: |
| 331 | printf("Beagle xM Rev B\n"); |
| 332 | setenv("beaglerev", "xMB"); |
| 333 | MUX_BEAGLE_XM(); |
| 334 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 335 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 336 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 337 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 338 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
| 339 | break; |
Koen Kooi | 6330844 | 2011-06-17 09:37:37 +0200 | [diff] [blame] | 340 | case REVISION_XM_C: |
| 341 | printf("Beagle xM Rev C\n"); |
| 342 | setenv("beaglerev", "xMC"); |
| 343 | MUX_BEAGLE_XM(); |
| 344 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 345 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 346 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 347 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 348 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
| 349 | break; |
Steve Sakoman | 3ca3376 | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 350 | default: |
| 351 | printf("Beagle unknown 0x%02x\n", get_board_revision()); |
Koen Kooi | 5b8018c | 2011-04-18 17:28:32 -0400 | [diff] [blame] | 352 | MUX_BEAGLE_XM(); |
| 353 | /* Set VAUX2 to 1.8V for EHCI PHY */ |
| 354 | twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, |
| 355 | TWL4030_PM_RECEIVER_VAUX2_VSEL_18, |
| 356 | TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, |
| 357 | TWL4030_PM_RECEIVER_DEV_GRP_P1); |
Steve Sakoman | 3ca3376 | 2010-08-12 15:17:37 -0700 | [diff] [blame] | 358 | } |
| 359 | |
Koen Kooi | b6241c2 | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 360 | switch (get_expansion_id()) { |
| 361 | case TINCANTOOLS_ZIPPY: |
| 362 | printf("Recognized Tincantools Zippy board (rev %d %s)\n", |
| 363 | expansion_config.revision, |
| 364 | expansion_config.fab_revision); |
| 365 | MUX_TINCANTOOLS_ZIPPY(); |
| 366 | setenv("buddy", "zippy"); |
| 367 | break; |
| 368 | case TINCANTOOLS_ZIPPY2: |
| 369 | printf("Recognized Tincantools Zippy2 board (rev %d %s)\n", |
| 370 | expansion_config.revision, |
| 371 | expansion_config.fab_revision); |
| 372 | MUX_TINCANTOOLS_ZIPPY(); |
| 373 | setenv("buddy", "zippy2"); |
| 374 | break; |
| 375 | case TINCANTOOLS_TRAINER: |
| 376 | printf("Recognized Tincantools Trainer board (rev %d %s)\n", |
| 377 | expansion_config.revision, |
| 378 | expansion_config.fab_revision); |
| 379 | MUX_TINCANTOOLS_ZIPPY(); |
| 380 | MUX_TINCANTOOLS_TRAINER(); |
| 381 | setenv("buddy", "trainer"); |
| 382 | break; |
| 383 | case TINCANTOOLS_SHOWDOG: |
| 384 | printf("Recognized Tincantools Showdow board (rev %d %s)\n", |
| 385 | expansion_config.revision, |
| 386 | expansion_config.fab_revision); |
| 387 | /* Place holder for DSS2 definition for showdog lcd */ |
| 388 | setenv("defaultdisplay", "showdoglcd"); |
| 389 | setenv("buddy", "showdog"); |
| 390 | break; |
| 391 | case KBADC_BEAGLEFPGA: |
| 392 | printf("Recognized KBADC Beagle FPGA board\n"); |
| 393 | MUX_KBADC_BEAGLEFPGA(); |
| 394 | setenv("buddy", "beaglefpga"); |
| 395 | break; |
Koen Kooi | 3d5dac6 | 2011-04-18 17:29:35 -0400 | [diff] [blame] | 396 | case LW_BEAGLETOUCH: |
| 397 | printf("Recognized Liquidware BeagleTouch board\n"); |
| 398 | setenv("buddy", "beagletouch"); |
| 399 | break; |
| 400 | case BRAINMUX_LCDOG: |
| 401 | printf("Recognized Brainmux LCDog board\n"); |
| 402 | setenv("buddy", "lcdog"); |
| 403 | break; |
| 404 | case BRAINMUX_LCDOGTOUCH: |
| 405 | printf("Recognized Brainmux LCDog Touch board\n"); |
| 406 | setenv("buddy", "lcdogtouch"); |
| 407 | break; |
| 408 | case BBTOYS_WIFI: |
| 409 | printf("Recognized BeagleBoardToys WiFi board\n"); |
| 410 | MUX_BBTOYS_WIFI() |
| 411 | setenv("buddy", "bbtoys-wifi"); |
| 412 | break;; |
| 413 | case BBTOYS_VGA: |
| 414 | printf("Recognized BeagleBoardToys VGA board\n"); |
| 415 | break;; |
| 416 | case BBTOYS_LCD: |
| 417 | printf("Recognized BeagleBoardToys LCD board\n"); |
| 418 | break;; |
Peter Meerwald | 1aca738 | 2012-01-03 04:14:35 +0000 | [diff] [blame] | 419 | case BCT_BRETTL3: |
Peter Meerwald | ad5691f | 2012-06-28 05:38:35 +0000 | [diff] [blame] | 420 | printf("Recognized bct electronic GmbH brettl3 board\n"); |
| 421 | break; |
| 422 | case BCT_BRETTL4: |
| 423 | printf("Recognized bct electronic GmbH brettl4 board\n"); |
| 424 | break; |
Koen Kooi | b6241c2 | 2010-09-20 10:21:33 -0700 | [diff] [blame] | 425 | case BEAGLE_NO_EEPROM: |
| 426 | printf("No EEPROM on expansion board\n"); |
| 427 | setenv("buddy", "none"); |
| 428 | break; |
| 429 | default: |
| 430 | printf("Unrecognized expansion board: %x\n", |
| 431 | expansion_config.device_vendor); |
| 432 | setenv("buddy", "unknown"); |
| 433 | } |
| 434 | |
| 435 | if (expansion_config.content == 1) |
| 436 | setenv(expansion_config.env_var, expansion_config.env_setting); |
| 437 | |
Tom Rix | 0f2a804 | 2009-06-28 12:52:30 -0500 | [diff] [blame] | 438 | twl4030_power_init(); |
Christian Spielberger | 3be83dc | 2011-08-24 17:17:31 -0500 | [diff] [blame] | 439 | switch (get_board_revision()) { |
| 440 | case REVISION_XM_A: |
| 441 | case REVISION_XM_B: |
| 442 | twl4030_led_init(TWL4030_LED_LEDEN_LEDBON); |
| 443 | break; |
| 444 | default: |
| 445 | twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); |
| 446 | break; |
| 447 | } |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 448 | |
Bob Feretich | 0ad8951 | 2011-02-24 13:16:44 +0000 | [diff] [blame] | 449 | /* Set GPIO states before they are made outputs */ |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 450 | writel(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1, |
| 451 | &gpio6_base->setdataout); |
| 452 | writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 | |
| 453 | GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout); |
| 454 | |
Bob Feretich | 0ad8951 | 2011-02-24 13:16:44 +0000 | [diff] [blame] | 455 | /* Configure GPIOs to output */ |
| 456 | writel(~(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe); |
| 457 | writel(~(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 | |
| 458 | GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe); |
| 459 | |
Dirk Behme | 12dbcf6 | 2009-03-12 19:30:50 +0100 | [diff] [blame] | 460 | dieid_num_r(); |
Peter Meerwald | 03ed046 | 2012-02-08 05:24:26 +0000 | [diff] [blame] | 461 | |
Peter Meerwald | a2f5456 | 2012-07-10 06:07:34 +0000 | [diff] [blame] | 462 | #ifdef CONFIG_VIDEO_OMAP3 |
Peter Meerwald | 03ed046 | 2012-02-08 05:24:26 +0000 | [diff] [blame] | 463 | beagle_dvi_pup(); |
Jason Kridner | b8f6ac5 | 2011-04-19 14:01:13 -0500 | [diff] [blame] | 464 | beagle_display_init(); |
| 465 | omap3_dss_enable(); |
Peter Meerwald | a2f5456 | 2012-07-10 06:07:34 +0000 | [diff] [blame] | 466 | #endif |
Dirk Behme | 12dbcf6 | 2009-03-12 19:30:50 +0100 | [diff] [blame] | 467 | |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 468 | return 0; |
| 469 | } |
| 470 | |
Tom Rix | 558bb83 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 471 | /* |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 472 | * Routine: set_muxconf_regs |
| 473 | * Description: Setting up the configuration Mux registers specific to the |
| 474 | * hardware. Many pins need to be moved from protect to primary |
| 475 | * mode. |
Tom Rix | 558bb83 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 476 | */ |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 477 | void set_muxconf_regs(void) |
| 478 | { |
| 479 | MUX_BEAGLE(); |
Dirk Behme | 2781f80 | 2009-01-27 18:19:12 +0100 | [diff] [blame] | 480 | } |
Steve Sakoman | 57c6241 | 2010-09-19 21:19:48 -0700 | [diff] [blame] | 481 | |
Tom Rini | 06c32fb | 2011-11-18 12:48:08 +0000 | [diff] [blame] | 482 | #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD) |
Steve Sakoman | 57c6241 | 2010-09-19 21:19:48 -0700 | [diff] [blame] | 483 | int board_mmc_init(bd_t *bis) |
| 484 | { |
Jonathan Solnit | a9b0556 | 2012-02-24 11:30:18 +0000 | [diff] [blame] | 485 | omap_mmc_init(0, 0, 0); |
Steve Sakoman | 57c6241 | 2010-09-19 21:19:48 -0700 | [diff] [blame] | 486 | return 0; |
| 487 | } |
| 488 | #endif |
Alexander Holler | 8f6f15c | 2011-04-19 09:30:35 -0400 | [diff] [blame] | 489 | |
Ilya Yanok | f7a2c55 | 2012-09-18 00:22:50 +0000 | [diff] [blame] | 490 | #if defined(CONFIG_USB_EHCI) && !defined(CONFIG_SPL_BUILD) |
Alexander Holler | 8f6f15c | 2011-04-19 09:30:35 -0400 | [diff] [blame] | 491 | /* Call usb_stop() before starting the kernel */ |
| 492 | void show_boot_progress(int val) |
| 493 | { |
Simon Glass | 2939564 | 2011-12-10 11:07:54 +0000 | [diff] [blame] | 494 | if (val == BOOTSTAGE_ID_RUN_OS) |
Alexander Holler | 8f6f15c | 2011-04-19 09:30:35 -0400 | [diff] [blame] | 495 | usb_stop(); |
| 496 | } |
Govindraj.R | edc16a0 | 2012-02-06 03:55:34 +0000 | [diff] [blame] | 497 | |
| 498 | static struct omap_usbhs_board_data usbhs_bdata = { |
| 499 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
| 500 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
| 501 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED |
| 502 | }; |
| 503 | |
Lucas Stach | 3494a4c | 2012-09-26 00:14:35 +0200 | [diff] [blame] | 504 | int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) |
Govindraj.R | edc16a0 | 2012-02-06 03:55:34 +0000 | [diff] [blame] | 505 | { |
Lucas Stach | 3494a4c | 2012-09-26 00:14:35 +0200 | [diff] [blame] | 506 | return omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor); |
Govindraj.R | edc16a0 | 2012-02-06 03:55:34 +0000 | [diff] [blame] | 507 | } |
| 508 | |
Lucas Stach | 3494a4c | 2012-09-26 00:14:35 +0200 | [diff] [blame] | 509 | int ehci_hcd_stop(int index) |
Govindraj.R | edc16a0 | 2012-02-06 03:55:34 +0000 | [diff] [blame] | 510 | { |
| 511 | return omap_ehci_hcd_stop(); |
| 512 | } |
| 513 | |
Alexander Holler | 8f6f15c | 2011-04-19 09:30:35 -0400 | [diff] [blame] | 514 | #endif /* CONFIG_USB_EHCI */ |