blob: 41fed54fdb43b418c9bb493212e23fa064ffab4c [file] [log] [blame]
Dirk Behmef904cdb2009-01-27 18:19:12 +01001/*
Tom Rini75c57a32011-11-18 12:48:08 +00002 * (C) Copyright 2004-2011
Dirk Behmef904cdb2009-01-27 18:19:12 +01003 * 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 *
Wolfgang Denk1a459662013-07-08 09:37:19 +020014 * SPDX-License-Identifier: GPL-2.0+
Dirk Behmef904cdb2009-01-27 18:19:12 +010015 */
16#include <common.h>
Jason Kridner70d8c942011-04-18 17:23:35 -040017#ifdef CONFIG_STATUS_LED
18#include <status_led.h>
19#endif
Tom Rix2c155132009-06-28 12:52:30 -050020#include <twl4030.h>
Tom Rini75c57a32011-11-18 12:48:08 +000021#include <linux/mtd/nand.h>
Dirk Behmef904cdb2009-01-27 18:19:12 +010022#include <asm/io.h>
Steve Sakoman0cd31142010-09-19 21:19:48 -070023#include <asm/arch/mmc_host_def.h>
Dirk Behmef904cdb2009-01-27 18:19:12 +010024#include <asm/arch/mux.h>
Tom Rini75c57a32011-11-18 12:48:08 +000025#include <asm/arch/mem.h>
Dirk Behmef904cdb2009-01-27 18:19:12 +010026#include <asm/arch/sys_proto.h>
Sanjeev Premi84c3b632011-09-08 10:51:01 -040027#include <asm/gpio.h>
Dirk Behmef904cdb2009-01-27 18:19:12 +010028#include <asm/mach-types.h>
Ilya Yanokc642b152012-11-06 13:48:30 +000029#include <asm/omap_musb.h>
30#include <asm/errno.h>
31#include <linux/usb/ch9.h>
32#include <linux/usb/gadget.h>
33#include <linux/usb/musb.h>
Dirk Behmef904cdb2009-01-27 18:19:12 +010034#include "beagle.h"
Jason Kridnerf835ea72010-07-21 07:41:25 -050035#include <command.h>
Dirk Behmef904cdb2009-01-27 18:19:12 +010036
Govindraj.R43b62392012-02-06 03:55:34 +000037#ifdef CONFIG_USB_EHCI
38#include <usb.h>
39#include <asm/ehci-omap.h>
40#endif
41
Koen Kooica5f80a2010-09-20 10:21:33 -070042#define TWL4030_I2C_BUS 0
43#define EXPANSION_EEPROM_I2C_BUS 1
44#define EXPANSION_EEPROM_I2C_ADDRESS 0x50
45
46#define TINCANTOOLS_ZIPPY 0x01000100
47#define TINCANTOOLS_ZIPPY2 0x02000100
48#define TINCANTOOLS_TRAINER 0x04000100
49#define TINCANTOOLS_SHOWDOG 0x03000100
50#define KBADC_BEAGLEFPGA 0x01000600
Koen Kooiee8485f2011-04-18 17:29:35 -040051#define LW_BEAGLETOUCH 0x01000700
52#define BRAINMUX_LCDOG 0x01000800
53#define BRAINMUX_LCDOGTOUCH 0x02000800
54#define BBTOYS_WIFI 0x01000B00
55#define BBTOYS_VGA 0x02000B00
56#define BBTOYS_LCD 0x03000B00
Peter Meerwald6cce5502012-01-03 04:14:35 +000057#define BCT_BRETTL3 0x01000F00
Peter Meerwaldef88e602012-06-28 05:38:35 +000058#define BCT_BRETTL4 0x02000F00
robertcnelson@gmail.com8a1f2dc2013-02-04 06:03:30 +000059#define LSR_COM6L_ADPT 0x01001300
Koen Kooica5f80a2010-09-20 10:21:33 -070060#define BEAGLE_NO_EEPROM 0xffffffff
61
John Rigby29565322010-12-20 18:27:51 -070062DECLARE_GLOBAL_DATA_PTR;
63
Koen Kooica5f80a2010-09-20 10:21:33 -070064static struct {
65 unsigned int device_vendor;
66 unsigned char revision;
67 unsigned char content;
68 char fab_revision[8];
69 char env_var[16];
70 char env_setting[64];
71} expansion_config;
72
Tom Rix58911512009-04-01 22:02:20 -050073/*
Dirk Behmef904cdb2009-01-27 18:19:12 +010074 * Routine: board_init
75 * Description: Early hardware init.
Tom Rix58911512009-04-01 22:02:20 -050076 */
Dirk Behmef904cdb2009-01-27 18:19:12 +010077int board_init(void)
78{
Dirk Behmef904cdb2009-01-27 18:19:12 +010079 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
80 /* board id for Linux */
81 gd->bd->bi_arch_number = MACH_TYPE_OMAP3_BEAGLE;
82 /* boot param addr */
83 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
84
Jason Kridner70d8c942011-04-18 17:23:35 -040085#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
86 status_led_set (STATUS_LED_BOOT, STATUS_LED_ON);
87#endif
88
Dirk Behmef904cdb2009-01-27 18:19:12 +010089 return 0;
90}
91
Tom Rix58911512009-04-01 22:02:20 -050092/*
Steve Sakoman06b95bd2010-08-12 15:17:37 -070093 * Routine: get_board_revision
94 * Description: Detect if we are running on a Beagle revision Ax/Bx,
Tom Rini8ce4e5f2013-04-16 16:31:20 -040095 * C1/2/3, C4, xM Ax/Bx or xM Cx. This can be done by reading
Steve Sakoman06b95bd2010-08-12 15:17:37 -070096 * the level of GPIO173, GPIO172 and GPIO171. This should
97 * result in
98 * GPIO173, GPIO172, GPIO171: 1 1 1 => Ax/Bx
99 * GPIO173, GPIO172, GPIO171: 1 1 0 => C1/2/3
100 * GPIO173, GPIO172, GPIO171: 1 0 1 => C4
Tom Rini8ce4e5f2013-04-16 16:31:20 -0400101 * GPIO173, GPIO172, GPIO171: 0 1 0 => xM Cx
102 * GPIO173, GPIO172, GPIO171: 0 0 0 => xM Ax/Bx
Tom Rix58911512009-04-01 22:02:20 -0500103 */
Peter Meerwaldfff1a572012-07-02 03:19:03 +0000104static int get_board_revision(void)
Dirk Behmef956fd02009-02-12 18:55:41 +0100105{
Steve Sakoman06b95bd2010-08-12 15:17:37 -0700106 int revision;
Dirk Behmef956fd02009-02-12 18:55:41 +0100107
Sanjeev Premi84c3b632011-09-08 10:51:01 -0400108 if (!gpio_request(171, "") &&
109 !gpio_request(172, "") &&
110 !gpio_request(173, "")) {
Dirk Behmef956fd02009-02-12 18:55:41 +0100111
Sanjeev Premi84c3b632011-09-08 10:51:01 -0400112 gpio_direction_input(171);
113 gpio_direction_input(172);
114 gpio_direction_input(173);
Dirk Behmef956fd02009-02-12 18:55:41 +0100115
Sanjeev Premi84c3b632011-09-08 10:51:01 -0400116 revision = gpio_get_value(173) << 2 |
117 gpio_get_value(172) << 1 |
118 gpio_get_value(171);
Steve Sakoman06b95bd2010-08-12 15:17:37 -0700119 } else {
120 printf("Error: unable to acquire board revision GPIOs\n");
121 revision = -1;
Tom Rix718763c2009-06-03 01:53:57 -0500122 }
Dirk Behmef956fd02009-02-12 18:55:41 +0100123
Steve Sakoman06b95bd2010-08-12 15:17:37 -0700124 return revision;
Dirk Behmef956fd02009-02-12 18:55:41 +0100125}
126
Tom Rini75c57a32011-11-18 12:48:08 +0000127#ifdef CONFIG_SPL_BUILD
128/*
129 * Routine: get_board_mem_timings
130 * Description: If we use SPL then there is no x-loader nor config header
131 * so we have to setup the DDR timings ourself on both banks.
132 */
Peter Barada8c4445d2012-11-13 07:40:28 +0000133void get_board_mem_timings(struct board_sdrc_timings *timings)
Tom Rini75c57a32011-11-18 12:48:08 +0000134{
135 int pop_mfr, pop_id;
136
137 /*
138 * We need to identify what PoP memory is on the board so that
139 * we know what timings to use. If we can't identify it then
140 * we know it's an xM. To map the ID values please see nand_ids.c
141 */
142 identify_nand_chip(&pop_mfr, &pop_id);
143
Peter Barada8c4445d2012-11-13 07:40:28 +0000144 timings->mr = MICRON_V_MR_165;
Tom Rini75c57a32011-11-18 12:48:08 +0000145 switch (get_board_revision()) {
146 case REVISION_C4:
147 if (pop_mfr == NAND_MFR_STMICRO && pop_id == 0xba) {
148 /* 512MB DDR */
Peter Barada8c4445d2012-11-13 07:40:28 +0000149 timings->mcfg = NUMONYX_V_MCFG_165(512 << 20);
150 timings->ctrla = NUMONYX_V_ACTIMA_165;
151 timings->ctrlb = NUMONYX_V_ACTIMB_165;
152 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
Tom Rini75c57a32011-11-18 12:48:08 +0000153 break;
robertcnelson@gmail.com223b8aa2012-01-27 07:09:42 +0000154 } else if (pop_mfr == NAND_MFR_MICRON && pop_id == 0xba) {
155 /* Beagleboard Rev C4, 512MB Nand/256MB DDR*/
Peter Barada8c4445d2012-11-13 07:40:28 +0000156 timings->mcfg = MICRON_V_MCFG_165(128 << 20);
157 timings->ctrla = MICRON_V_ACTIMA_165;
158 timings->ctrlb = MICRON_V_ACTIMB_165;
159 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
robertcnelson@gmail.com223b8aa2012-01-27 07:09:42 +0000160 break;
Tom Rini75c57a32011-11-18 12:48:08 +0000161 } else if (pop_mfr == NAND_MFR_MICRON && pop_id == 0xbc) {
162 /* Beagleboard Rev C5, 256MB DDR */
Peter Barada8c4445d2012-11-13 07:40:28 +0000163 timings->mcfg = MICRON_V_MCFG_200(256 << 20);
164 timings->ctrla = MICRON_V_ACTIMA_200;
165 timings->ctrlb = MICRON_V_ACTIMB_200;
166 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
Tom Rini75c57a32011-11-18 12:48:08 +0000167 break;
168 }
Nishanth Menonaf4d8962013-07-15 07:11:30 -0500169 case REVISION_XM_AB:
Tom Rini75c57a32011-11-18 12:48:08 +0000170 case REVISION_XM_C:
171 if (pop_mfr == 0) {
172 /* 256MB DDR */
Peter Barada8c4445d2012-11-13 07:40:28 +0000173 timings->mcfg = MICRON_V_MCFG_200(256 << 20);
174 timings->ctrla = MICRON_V_ACTIMA_200;
175 timings->ctrlb = MICRON_V_ACTIMB_200;
176 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
Tom Rini75c57a32011-11-18 12:48:08 +0000177 } else {
178 /* 512MB DDR */
Peter Barada8c4445d2012-11-13 07:40:28 +0000179 timings->mcfg = NUMONYX_V_MCFG_165(512 << 20);
180 timings->ctrla = NUMONYX_V_ACTIMA_165;
181 timings->ctrlb = NUMONYX_V_ACTIMB_165;
182 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
Tom Rini75c57a32011-11-18 12:48:08 +0000183 }
184 break;
185 default:
186 /* Assume 128MB and Micron/165MHz timings to be safe */
Peter Barada8c4445d2012-11-13 07:40:28 +0000187 timings->mcfg = MICRON_V_MCFG_165(128 << 20);
188 timings->ctrla = MICRON_V_ACTIMA_165;
189 timings->ctrlb = MICRON_V_ACTIMB_165;
190 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
Tom Rini75c57a32011-11-18 12:48:08 +0000191 }
192}
193#endif
194
Tom Rix58911512009-04-01 22:02:20 -0500195/*
Koen Kooica5f80a2010-09-20 10:21:33 -0700196 * Routine: get_expansion_id
197 * Description: This function checks for expansion board by checking I2C
198 * bus 1 for the availability of an AT24C01B serial EEPROM.
199 * returns the device_vendor field from the EEPROM
200 */
Peter Meerwaldfff1a572012-07-02 03:19:03 +0000201static unsigned int get_expansion_id(void)
Koen Kooica5f80a2010-09-20 10:21:33 -0700202{
203 i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS);
204
205 /* return BEAGLE_NO_EEPROM if eeprom doesn't respond */
206 if (i2c_probe(EXPANSION_EEPROM_I2C_ADDRESS) == 1) {
207 i2c_set_bus_num(TWL4030_I2C_BUS);
208 return BEAGLE_NO_EEPROM;
209 }
210
211 /* read configuration data */
212 i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config,
213 sizeof(expansion_config));
214
robertcnelson@gmail.comff229ec2013-02-04 06:03:10 +0000215 /* retry reading configuration data with 16bit addressing */
216 if ((expansion_config.device_vendor == 0xFFFFFF00) ||
217 (expansion_config.device_vendor == 0xFFFFFFFF)) {
218 printf("EEPROM is blank or 8bit addressing failed: retrying with 16bit:\n");
219 i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 2, (u8 *)&expansion_config,
220 sizeof(expansion_config));
221 }
222
Koen Kooica5f80a2010-09-20 10:21:33 -0700223 i2c_set_bus_num(TWL4030_I2C_BUS);
224
225 return expansion_config.device_vendor;
226}
227
Peter Meerwald2c30c182012-07-10 06:07:34 +0000228#ifdef CONFIG_VIDEO_OMAP3
Koen Kooica5f80a2010-09-20 10:21:33 -0700229/*
Jason Kridner3f16ab92011-04-19 14:01:13 -0500230 * Configure DSS to display background color on DVID
231 * Configure VENC to display color bar on S-Video
232 */
Peter Meerwaldfff1a572012-07-02 03:19:03 +0000233static void beagle_display_init(void)
Jason Kridner3f16ab92011-04-19 14:01:13 -0500234{
235 omap3_dss_venc_config(&venc_config_std_tv, VENC_HEIGHT, VENC_WIDTH);
236 switch (get_board_revision()) {
237 case REVISION_AXBX:
238 case REVISION_CX:
239 case REVISION_C4:
240 omap3_dss_panel_config(&dvid_cfg);
241 break;
Nishanth Menonaf4d8962013-07-15 07:11:30 -0500242 case REVISION_XM_AB:
Jason Kridner3f16ab92011-04-19 14:01:13 -0500243 case REVISION_XM_C:
244 default:
245 omap3_dss_panel_config(&dvid_cfg_xm);
246 break;
247 }
248}
249
250/*
Peter Meerwald4258aa62012-02-08 05:24:26 +0000251 * Enable DVI power
252 */
Anatolij Gustschin3fbc6932012-03-27 23:05:07 +0000253static void beagle_dvi_pup(void)
254{
Peter Meerwald4258aa62012-02-08 05:24:26 +0000255 uchar val;
256
257 switch (get_board_revision()) {
258 case REVISION_AXBX:
259 case REVISION_CX:
260 case REVISION_C4:
Peter Meerwald4258aa62012-02-08 05:24:26 +0000261 gpio_request(170, "");
262 gpio_direction_output(170, 0);
263 gpio_set_value(170, 1);
264 break;
Nishanth Menonaf4d8962013-07-15 07:11:30 -0500265 case REVISION_XM_AB:
Peter Meerwald4258aa62012-02-08 05:24:26 +0000266 case REVISION_XM_C:
267 default:
268 #define GPIODATADIR1 (TWL4030_BASEADD_GPIO+3)
269 #define GPIODATAOUT1 (TWL4030_BASEADD_GPIO+6)
270
271 i2c_read(TWL4030_CHIP_GPIO, GPIODATADIR1, 1, &val, 1);
272 val |= 4;
273 i2c_write(TWL4030_CHIP_GPIO, GPIODATADIR1, 1, &val, 1);
274
275 i2c_read(TWL4030_CHIP_GPIO, GPIODATAOUT1, 1, &val, 1);
276 val |= 4;
277 i2c_write(TWL4030_CHIP_GPIO, GPIODATAOUT1, 1, &val, 1);
278 break;
279 }
280}
Peter Meerwald2c30c182012-07-10 06:07:34 +0000281#endif
Peter Meerwald4258aa62012-02-08 05:24:26 +0000282
Ilya Yanokc642b152012-11-06 13:48:30 +0000283#ifdef CONFIG_USB_MUSB_OMAP2PLUS
284static struct musb_hdrc_config musb_config = {
285 .multipoint = 1,
286 .dyn_fifo = 1,
287 .num_eps = 16,
288 .ram_bits = 12,
289};
290
291static struct omap_musb_board_data musb_board_data = {
292 .interface_type = MUSB_INTERFACE_ULPI,
293};
294
295static struct musb_hdrc_platform_data musb_plat = {
296#if defined(CONFIG_MUSB_HOST)
297 .mode = MUSB_HOST,
298#elif defined(CONFIG_MUSB_GADGET)
299 .mode = MUSB_PERIPHERAL,
300#else
301#error "Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET"
302#endif
303 .config = &musb_config,
304 .power = 100,
305 .platform_ops = &omap2430_ops,
306 .board_data = &musb_board_data,
307};
308#endif
309
Peter Meerwald4258aa62012-02-08 05:24:26 +0000310/*
Dirk Behmef904cdb2009-01-27 18:19:12 +0100311 * Routine: misc_init_r
312 * Description: Configure board specific parts
Tom Rix58911512009-04-01 22:02:20 -0500313 */
Dirk Behmef904cdb2009-01-27 18:19:12 +0100314int misc_init_r(void)
315{
Dirk Behme97a099e2009-08-08 09:30:21 +0200316 struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
317 struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
Jason Kridnerf14a5222011-04-20 13:52:26 +0000318 struct control_prog_io *prog_io_base = (struct control_prog_io *)OMAP34XX_CTRL_BASE;
Steve Kipiszd4e53f02011-04-18 17:27:00 -0400319
320 /* Enable i2c2 pullup resisters */
321 writel(~(PRG_I2C2_PULLUPRESX), &prog_io_base->io1);
Dirk Behmef904cdb2009-01-27 18:19:12 +0100322
Steve Sakoman06b95bd2010-08-12 15:17:37 -0700323 switch (get_board_revision()) {
324 case REVISION_AXBX:
325 printf("Beagle Rev Ax/Bx\n");
326 setenv("beaglerev", "AxBx");
Steve Sakoman06b95bd2010-08-12 15:17:37 -0700327 break;
328 case REVISION_CX:
329 printf("Beagle Rev C1/C2/C3\n");
330 setenv("beaglerev", "Cx");
Steve Sakoman06b95bd2010-08-12 15:17:37 -0700331 MUX_BEAGLE_C();
332 break;
333 case REVISION_C4:
334 printf("Beagle Rev C4\n");
Steve Sakoman08cbba2ab2010-08-19 20:56:11 -0700335 setenv("beaglerev", "C4");
Steve Sakoman06b95bd2010-08-12 15:17:37 -0700336 MUX_BEAGLE_C();
337 /* Set VAUX2 to 1.8V for EHCI PHY */
338 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
339 TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
340 TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
341 TWL4030_PM_RECEIVER_DEV_GRP_P1);
342 break;
Nishanth Menonaf4d8962013-07-15 07:11:30 -0500343 case REVISION_XM_AB:
344 printf("Beagle xM Rev A/B\n");
345 setenv("beaglerev", "xMAB");
Steve Sakoman08cbba2ab2010-08-19 20:56:11 -0700346 MUX_BEAGLE_XM();
347 /* Set VAUX2 to 1.8V for EHCI PHY */
348 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
349 TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
350 TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
351 TWL4030_PM_RECEIVER_DEV_GRP_P1);
352 break;
Koen Kooi1ffcb342011-06-17 09:37:37 +0200353 case REVISION_XM_C:
354 printf("Beagle xM Rev C\n");
355 setenv("beaglerev", "xMC");
356 MUX_BEAGLE_XM();
357 /* Set VAUX2 to 1.8V for EHCI PHY */
358 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
359 TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
360 TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
361 TWL4030_PM_RECEIVER_DEV_GRP_P1);
362 break;
Steve Sakoman06b95bd2010-08-12 15:17:37 -0700363 default:
364 printf("Beagle unknown 0x%02x\n", get_board_revision());
Koen Kooif6e593b2011-04-18 17:28:32 -0400365 MUX_BEAGLE_XM();
366 /* Set VAUX2 to 1.8V for EHCI PHY */
367 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
368 TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
369 TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
370 TWL4030_PM_RECEIVER_DEV_GRP_P1);
Steve Sakoman06b95bd2010-08-12 15:17:37 -0700371 }
372
Koen Kooica5f80a2010-09-20 10:21:33 -0700373 switch (get_expansion_id()) {
374 case TINCANTOOLS_ZIPPY:
375 printf("Recognized Tincantools Zippy board (rev %d %s)\n",
376 expansion_config.revision,
377 expansion_config.fab_revision);
378 MUX_TINCANTOOLS_ZIPPY();
379 setenv("buddy", "zippy");
380 break;
381 case TINCANTOOLS_ZIPPY2:
382 printf("Recognized Tincantools Zippy2 board (rev %d %s)\n",
383 expansion_config.revision,
384 expansion_config.fab_revision);
385 MUX_TINCANTOOLS_ZIPPY();
386 setenv("buddy", "zippy2");
387 break;
388 case TINCANTOOLS_TRAINER:
389 printf("Recognized Tincantools Trainer board (rev %d %s)\n",
390 expansion_config.revision,
391 expansion_config.fab_revision);
392 MUX_TINCANTOOLS_ZIPPY();
393 MUX_TINCANTOOLS_TRAINER();
394 setenv("buddy", "trainer");
395 break;
396 case TINCANTOOLS_SHOWDOG:
397 printf("Recognized Tincantools Showdow board (rev %d %s)\n",
398 expansion_config.revision,
399 expansion_config.fab_revision);
400 /* Place holder for DSS2 definition for showdog lcd */
401 setenv("defaultdisplay", "showdoglcd");
402 setenv("buddy", "showdog");
403 break;
404 case KBADC_BEAGLEFPGA:
405 printf("Recognized KBADC Beagle FPGA board\n");
406 MUX_KBADC_BEAGLEFPGA();
407 setenv("buddy", "beaglefpga");
408 break;
Koen Kooiee8485f2011-04-18 17:29:35 -0400409 case LW_BEAGLETOUCH:
410 printf("Recognized Liquidware BeagleTouch board\n");
411 setenv("buddy", "beagletouch");
412 break;
413 case BRAINMUX_LCDOG:
414 printf("Recognized Brainmux LCDog board\n");
415 setenv("buddy", "lcdog");
416 break;
417 case BRAINMUX_LCDOGTOUCH:
418 printf("Recognized Brainmux LCDog Touch board\n");
419 setenv("buddy", "lcdogtouch");
420 break;
421 case BBTOYS_WIFI:
422 printf("Recognized BeagleBoardToys WiFi board\n");
423 MUX_BBTOYS_WIFI()
424 setenv("buddy", "bbtoys-wifi");
425 break;;
426 case BBTOYS_VGA:
427 printf("Recognized BeagleBoardToys VGA board\n");
428 break;;
429 case BBTOYS_LCD:
430 printf("Recognized BeagleBoardToys LCD board\n");
431 break;;
Peter Meerwald6cce5502012-01-03 04:14:35 +0000432 case BCT_BRETTL3:
Peter Meerwaldef88e602012-06-28 05:38:35 +0000433 printf("Recognized bct electronic GmbH brettl3 board\n");
434 break;
435 case BCT_BRETTL4:
436 printf("Recognized bct electronic GmbH brettl4 board\n");
437 break;
robertcnelson@gmail.com8a1f2dc2013-02-04 06:03:30 +0000438 case LSR_COM6L_ADPT:
439 printf("Recognized LSR COM6L Adapter Board\n");
440 MUX_BBTOYS_WIFI()
441 setenv("buddy", "lsr-com6l-adpt");
442 break;
Koen Kooica5f80a2010-09-20 10:21:33 -0700443 case BEAGLE_NO_EEPROM:
444 printf("No EEPROM on expansion board\n");
445 setenv("buddy", "none");
446 break;
447 default:
448 printf("Unrecognized expansion board: %x\n",
449 expansion_config.device_vendor);
450 setenv("buddy", "unknown");
451 }
452
453 if (expansion_config.content == 1)
454 setenv(expansion_config.env_var, expansion_config.env_setting);
455
Tom Rix2c155132009-06-28 12:52:30 -0500456 twl4030_power_init();
Christian Spielberger38a77c32011-08-24 17:17:31 -0500457 switch (get_board_revision()) {
Nishanth Menonaf4d8962013-07-15 07:11:30 -0500458 case REVISION_XM_AB:
Christian Spielberger38a77c32011-08-24 17:17:31 -0500459 twl4030_led_init(TWL4030_LED_LEDEN_LEDBON);
460 break;
461 default:
462 twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
463 break;
464 }
Dirk Behmef904cdb2009-01-27 18:19:12 +0100465
Bob Feretich52d82e42011-02-24 13:16:44 +0000466 /* Set GPIO states before they are made outputs */
Dirk Behmef904cdb2009-01-27 18:19:12 +0100467 writel(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1,
468 &gpio6_base->setdataout);
469 writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
470 GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);
471
Bob Feretich52d82e42011-02-24 13:16:44 +0000472 /* Configure GPIOs to output */
473 writel(~(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe);
474 writel(~(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
475 GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe);
476
Dirk Behmee6a6a702009-03-12 19:30:50 +0100477 dieid_num_r();
Peter Meerwald4258aa62012-02-08 05:24:26 +0000478
Peter Meerwald2c30c182012-07-10 06:07:34 +0000479#ifdef CONFIG_VIDEO_OMAP3
Peter Meerwald4258aa62012-02-08 05:24:26 +0000480 beagle_dvi_pup();
Jason Kridner3f16ab92011-04-19 14:01:13 -0500481 beagle_display_init();
482 omap3_dss_enable();
Peter Meerwald2c30c182012-07-10 06:07:34 +0000483#endif
Dirk Behmee6a6a702009-03-12 19:30:50 +0100484
Ilya Yanokc642b152012-11-06 13:48:30 +0000485#ifdef CONFIG_USB_MUSB_OMAP2PLUS
486 musb_register(&musb_plat, &musb_board_data, (void *)MUSB_BASE);
487#endif
488
Dirk Behmef904cdb2009-01-27 18:19:12 +0100489 return 0;
490}
491
Tom Rix58911512009-04-01 22:02:20 -0500492/*
Dirk Behmef904cdb2009-01-27 18:19:12 +0100493 * Routine: set_muxconf_regs
494 * Description: Setting up the configuration Mux registers specific to the
495 * hardware. Many pins need to be moved from protect to primary
496 * mode.
Tom Rix58911512009-04-01 22:02:20 -0500497 */
Dirk Behmef904cdb2009-01-27 18:19:12 +0100498void set_muxconf_regs(void)
499{
500 MUX_BEAGLE();
Dirk Behmef904cdb2009-01-27 18:19:12 +0100501}
Steve Sakoman0cd31142010-09-19 21:19:48 -0700502
Tom Rini75c57a32011-11-18 12:48:08 +0000503#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
Steve Sakoman0cd31142010-09-19 21:19:48 -0700504int board_mmc_init(bd_t *bis)
505{
Nikita Kiryanove3913f52012-12-03 02:19:47 +0000506 return omap_mmc_init(0, 0, 0, -1, -1);
Steve Sakoman0cd31142010-09-19 21:19:48 -0700507}
508#endif
Alexander Hollerd90859a2011-04-19 09:30:35 -0400509
Ilya Yanok7ac2fe22012-09-18 00:22:50 +0000510#if defined(CONFIG_USB_EHCI) && !defined(CONFIG_SPL_BUILD)
Alexander Hollerd90859a2011-04-19 09:30:35 -0400511/* Call usb_stop() before starting the kernel */
512void show_boot_progress(int val)
513{
Simon Glass578ac1e2011-12-10 11:07:54 +0000514 if (val == BOOTSTAGE_ID_RUN_OS)
Alexander Hollerd90859a2011-04-19 09:30:35 -0400515 usb_stop();
516}
Govindraj.R43b62392012-02-06 03:55:34 +0000517
518static struct omap_usbhs_board_data usbhs_bdata = {
519 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
520 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
521 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
522};
523
Lucas Stach676ae062012-09-26 00:14:35 +0200524int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
Govindraj.R43b62392012-02-06 03:55:34 +0000525{
Mateusz Zalega16297cf2013-10-04 19:22:26 +0200526 return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
Govindraj.R43b62392012-02-06 03:55:34 +0000527}
528
Lucas Stach676ae062012-09-26 00:14:35 +0200529int ehci_hcd_stop(int index)
Govindraj.R43b62392012-02-06 03:55:34 +0000530{
531 return omap_ehci_hcd_stop();
532}
533
Alexander Hollerd90859a2011-04-19 09:30:35 -0400534#endif /* CONFIG_USB_EHCI */
Ilya Yanokc642b152012-11-06 13:48:30 +0000535
536#if defined(CONFIG_USB_ETHER) && defined(CONFIG_MUSB_GADGET)
537int board_eth_init(bd_t *bis)
538{
539 return usb_eth_initialize(bis);
540}
541#endif