blob: f20ebed4524298c4d5bb777dd732f7ae509d1b1c [file] [log] [blame]
Dirk Behme2781f802009-01-27 18:19:12 +01001/*
Tom Rini06c32fb2011-11-18 12:48:08 +00002 * (C) Copyright 2004-2011
Dirk Behme2781f802009-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 *
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 Kridnerc3ef8bc2011-04-18 17:23:35 -040033#ifdef CONFIG_STATUS_LED
34#include <status_led.h>
35#endif
Tom Rix0f2a8042009-06-28 12:52:30 -050036#include <twl4030.h>
Tom Rini06c32fb2011-11-18 12:48:08 +000037#include <linux/mtd/nand.h>
Dirk Behme2781f802009-01-27 18:19:12 +010038#include <asm/io.h>
Steve Sakoman57c62412010-09-19 21:19:48 -070039#include <asm/arch/mmc_host_def.h>
Dirk Behme2781f802009-01-27 18:19:12 +010040#include <asm/arch/mux.h>
Tom Rini06c32fb2011-11-18 12:48:08 +000041#include <asm/arch/mem.h>
Dirk Behme2781f802009-01-27 18:19:12 +010042#include <asm/arch/sys_proto.h>
Sanjeev Premi7b3dc822011-09-08 10:51:01 -040043#include <asm/gpio.h>
Dirk Behme2781f802009-01-27 18:19:12 +010044#include <asm/mach-types.h>
Ilya Yanokcb7b2b82012-11-06 13:48:30 +000045#include <asm/omap_musb.h>
46#include <asm/errno.h>
47#include <linux/usb/ch9.h>
48#include <linux/usb/gadget.h>
49#include <linux/usb/musb.h>
Dirk Behme2781f802009-01-27 18:19:12 +010050#include "beagle.h"
Jason Kridner85a08fb2010-07-21 07:41:25 -050051#include <command.h>
Dirk Behme2781f802009-01-27 18:19:12 +010052
Govindraj.Redc16a02012-02-06 03:55:34 +000053#ifdef CONFIG_USB_EHCI
54#include <usb.h>
55#include <asm/ehci-omap.h>
56#endif
57
Koen Kooib6241c22010-09-20 10:21:33 -070058#define TWL4030_I2C_BUS 0
59#define EXPANSION_EEPROM_I2C_BUS 1
60#define EXPANSION_EEPROM_I2C_ADDRESS 0x50
61
62#define TINCANTOOLS_ZIPPY 0x01000100
63#define TINCANTOOLS_ZIPPY2 0x02000100
64#define TINCANTOOLS_TRAINER 0x04000100
65#define TINCANTOOLS_SHOWDOG 0x03000100
66#define KBADC_BEAGLEFPGA 0x01000600
Koen Kooi3d5dac62011-04-18 17:29:35 -040067#define LW_BEAGLETOUCH 0x01000700
68#define BRAINMUX_LCDOG 0x01000800
69#define BRAINMUX_LCDOGTOUCH 0x02000800
70#define BBTOYS_WIFI 0x01000B00
71#define BBTOYS_VGA 0x02000B00
72#define BBTOYS_LCD 0x03000B00
Peter Meerwald1aca7382012-01-03 04:14:35 +000073#define BCT_BRETTL3 0x01000F00
Peter Meerwaldad5691f2012-06-28 05:38:35 +000074#define BCT_BRETTL4 0x02000F00
Koen Kooib6241c22010-09-20 10:21:33 -070075#define BEAGLE_NO_EEPROM 0xffffffff
76
John Rigby0d21ed02010-12-20 18:27:51 -070077DECLARE_GLOBAL_DATA_PTR;
78
Koen Kooib6241c22010-09-20 10:21:33 -070079static struct {
80 unsigned int device_vendor;
81 unsigned char revision;
82 unsigned char content;
83 char fab_revision[8];
84 char env_var[16];
85 char env_setting[64];
86} expansion_config;
87
Tom Rix558bb832009-04-01 22:02:20 -050088/*
Dirk Behme2781f802009-01-27 18:19:12 +010089 * Routine: board_init
90 * Description: Early hardware init.
Tom Rix558bb832009-04-01 22:02:20 -050091 */
Dirk Behme2781f802009-01-27 18:19:12 +010092int board_init(void)
93{
Dirk Behme2781f802009-01-27 18:19:12 +010094 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
95 /* board id for Linux */
96 gd->bd->bi_arch_number = MACH_TYPE_OMAP3_BEAGLE;
97 /* boot param addr */
98 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
99
Jason Kridnerc3ef8bc2011-04-18 17:23:35 -0400100#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
101 status_led_set (STATUS_LED_BOOT, STATUS_LED_ON);
102#endif
103
Dirk Behme2781f802009-01-27 18:19:12 +0100104 return 0;
105}
106
Tom Rix558bb832009-04-01 22:02:20 -0500107/*
Steve Sakoman3ca33762010-08-12 15:17:37 -0700108 * Routine: get_board_revision
109 * Description: Detect if we are running on a Beagle revision Ax/Bx,
Steve Sakomanac929952010-08-19 20:56:11 -0700110 * C1/2/3, C4 or xM. This can be done by reading
Steve Sakoman3ca33762010-08-12 15:17:37 -0700111 * the level of GPIO173, GPIO172 and GPIO171. This should
112 * result in
113 * GPIO173, GPIO172, GPIO171: 1 1 1 => Ax/Bx
114 * GPIO173, GPIO172, GPIO171: 1 1 0 => C1/2/3
115 * GPIO173, GPIO172, GPIO171: 1 0 1 => C4
Steve Sakomanac929952010-08-19 20:56:11 -0700116 * GPIO173, GPIO172, GPIO171: 0 0 0 => xM
Tom Rix558bb832009-04-01 22:02:20 -0500117 */
Peter Meerwalda93ee5f2012-07-02 03:19:03 +0000118static int get_board_revision(void)
Dirk Behme78716112009-02-12 18:55:41 +0100119{
Steve Sakoman3ca33762010-08-12 15:17:37 -0700120 int revision;
Dirk Behme78716112009-02-12 18:55:41 +0100121
Sanjeev Premi7b3dc822011-09-08 10:51:01 -0400122 if (!gpio_request(171, "") &&
123 !gpio_request(172, "") &&
124 !gpio_request(173, "")) {
Dirk Behme78716112009-02-12 18:55:41 +0100125
Sanjeev Premi7b3dc822011-09-08 10:51:01 -0400126 gpio_direction_input(171);
127 gpio_direction_input(172);
128 gpio_direction_input(173);
Dirk Behme78716112009-02-12 18:55:41 +0100129
Sanjeev Premi7b3dc822011-09-08 10:51:01 -0400130 revision = gpio_get_value(173) << 2 |
131 gpio_get_value(172) << 1 |
132 gpio_get_value(171);
Steve Sakoman3ca33762010-08-12 15:17:37 -0700133 } else {
134 printf("Error: unable to acquire board revision GPIOs\n");
135 revision = -1;
Tom Rix70d05412009-06-03 01:53:57 -0500136 }
Dirk Behme78716112009-02-12 18:55:41 +0100137
Steve Sakoman3ca33762010-08-12 15:17:37 -0700138 return revision;
Dirk Behme78716112009-02-12 18:55:41 +0100139}
140
Tom Rini06c32fb2011-11-18 12:48:08 +0000141#ifdef CONFIG_SPL_BUILD
142/*
143 * Routine: get_board_mem_timings
144 * Description: If we use SPL then there is no x-loader nor config header
145 * so we have to setup the DDR timings ourself on both banks.
146 */
147void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
148 u32 *mr)
149{
150 int pop_mfr, pop_id;
151
152 /*
153 * We need to identify what PoP memory is on the board so that
154 * we know what timings to use. If we can't identify it then
155 * we know it's an xM. To map the ID values please see nand_ids.c
156 */
157 identify_nand_chip(&pop_mfr, &pop_id);
158
159 *mr = MICRON_V_MR_165;
160 switch (get_board_revision()) {
161 case REVISION_C4:
162 if (pop_mfr == NAND_MFR_STMICRO && pop_id == 0xba) {
163 /* 512MB DDR */
164 *mcfg = NUMONYX_V_MCFG_165(512 << 20);
165 *ctrla = NUMONYX_V_ACTIMA_165;
166 *ctrlb = NUMONYX_V_ACTIMB_165;
167 *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
168 break;
robertcnelson@gmail.com4b949bb2012-01-27 07:09:42 +0000169 } else if (pop_mfr == NAND_MFR_MICRON && pop_id == 0xba) {
170 /* Beagleboard Rev C4, 512MB Nand/256MB DDR*/
171 *mcfg = MICRON_V_MCFG_165(128 << 20);
172 *ctrla = MICRON_V_ACTIMA_165;
173 *ctrlb = MICRON_V_ACTIMB_165;
174 *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
175 break;
Tom Rini06c32fb2011-11-18 12:48:08 +0000176 } else if (pop_mfr == NAND_MFR_MICRON && pop_id == 0xbc) {
177 /* Beagleboard Rev C5, 256MB DDR */
178 *mcfg = MICRON_V_MCFG_200(256 << 20);
179 *ctrla = MICRON_V_ACTIMA_200;
180 *ctrlb = MICRON_V_ACTIMB_200;
181 *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
182 break;
183 }
184 case REVISION_XM_A:
185 case REVISION_XM_B:
186 case REVISION_XM_C:
187 if (pop_mfr == 0) {
188 /* 256MB DDR */
189 *mcfg = MICRON_V_MCFG_200(256 << 20);
190 *ctrla = MICRON_V_ACTIMA_200;
191 *ctrlb = MICRON_V_ACTIMB_200;
192 *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
193 } else {
194 /* 512MB DDR */
195 *mcfg = NUMONYX_V_MCFG_165(512 << 20);
196 *ctrla = NUMONYX_V_ACTIMA_165;
197 *ctrlb = NUMONYX_V_ACTIMB_165;
198 *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
199 }
200 break;
201 default:
202 /* Assume 128MB and Micron/165MHz timings to be safe */
203 *mcfg = MICRON_V_MCFG_165(128 << 20);
204 *ctrla = MICRON_V_ACTIMA_165;
205 *ctrlb = MICRON_V_ACTIMB_165;
206 *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
207 }
208}
209#endif
210
Tom Rix558bb832009-04-01 22:02:20 -0500211/*
Koen Kooib6241c22010-09-20 10:21:33 -0700212 * Routine: get_expansion_id
213 * Description: This function checks for expansion board by checking I2C
214 * bus 1 for the availability of an AT24C01B serial EEPROM.
215 * returns the device_vendor field from the EEPROM
216 */
Peter Meerwalda93ee5f2012-07-02 03:19:03 +0000217static unsigned int get_expansion_id(void)
Koen Kooib6241c22010-09-20 10:21:33 -0700218{
219 i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS);
220
221 /* return BEAGLE_NO_EEPROM if eeprom doesn't respond */
222 if (i2c_probe(EXPANSION_EEPROM_I2C_ADDRESS) == 1) {
223 i2c_set_bus_num(TWL4030_I2C_BUS);
224 return BEAGLE_NO_EEPROM;
225 }
226
227 /* read configuration data */
228 i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config,
229 sizeof(expansion_config));
230
231 i2c_set_bus_num(TWL4030_I2C_BUS);
232
233 return expansion_config.device_vendor;
234}
235
Peter Meerwalda2f54562012-07-10 06:07:34 +0000236#ifdef CONFIG_VIDEO_OMAP3
Koen Kooib6241c22010-09-20 10:21:33 -0700237/*
Jason Kridnerb8f6ac52011-04-19 14:01:13 -0500238 * Configure DSS to display background color on DVID
239 * Configure VENC to display color bar on S-Video
240 */
Peter Meerwalda93ee5f2012-07-02 03:19:03 +0000241static void beagle_display_init(void)
Jason Kridnerb8f6ac52011-04-19 14:01:13 -0500242{
243 omap3_dss_venc_config(&venc_config_std_tv, VENC_HEIGHT, VENC_WIDTH);
244 switch (get_board_revision()) {
245 case REVISION_AXBX:
246 case REVISION_CX:
247 case REVISION_C4:
248 omap3_dss_panel_config(&dvid_cfg);
249 break;
250 case REVISION_XM_A:
251 case REVISION_XM_B:
252 case REVISION_XM_C:
253 default:
254 omap3_dss_panel_config(&dvid_cfg_xm);
255 break;
256 }
257}
258
259/*
Peter Meerwald03ed0462012-02-08 05:24:26 +0000260 * Enable DVI power
261 */
Anatolij Gustschin359260b2012-03-27 23:05:07 +0000262static void beagle_dvi_pup(void)
263{
Peter Meerwald03ed0462012-02-08 05:24:26 +0000264 uchar val;
265
266 switch (get_board_revision()) {
267 case REVISION_AXBX:
268 case REVISION_CX:
269 case REVISION_C4:
270 case REVISION_XM_A:
271 gpio_request(170, "");
272 gpio_direction_output(170, 0);
273 gpio_set_value(170, 1);
274 break;
275 case REVISION_XM_B:
276 case REVISION_XM_C:
277 default:
278 #define GPIODATADIR1 (TWL4030_BASEADD_GPIO+3)
279 #define GPIODATAOUT1 (TWL4030_BASEADD_GPIO+6)
280
281 i2c_read(TWL4030_CHIP_GPIO, GPIODATADIR1, 1, &val, 1);
282 val |= 4;
283 i2c_write(TWL4030_CHIP_GPIO, GPIODATADIR1, 1, &val, 1);
284
285 i2c_read(TWL4030_CHIP_GPIO, GPIODATAOUT1, 1, &val, 1);
286 val |= 4;
287 i2c_write(TWL4030_CHIP_GPIO, GPIODATAOUT1, 1, &val, 1);
288 break;
289 }
290}
Peter Meerwalda2f54562012-07-10 06:07:34 +0000291#endif
Peter Meerwald03ed0462012-02-08 05:24:26 +0000292
Ilya Yanokcb7b2b82012-11-06 13:48:30 +0000293#ifdef CONFIG_USB_MUSB_OMAP2PLUS
294static struct musb_hdrc_config musb_config = {
295 .multipoint = 1,
296 .dyn_fifo = 1,
297 .num_eps = 16,
298 .ram_bits = 12,
299};
300
301static struct omap_musb_board_data musb_board_data = {
302 .interface_type = MUSB_INTERFACE_ULPI,
303};
304
305static struct musb_hdrc_platform_data musb_plat = {
306#if defined(CONFIG_MUSB_HOST)
307 .mode = MUSB_HOST,
308#elif defined(CONFIG_MUSB_GADGET)
309 .mode = MUSB_PERIPHERAL,
310#else
311#error "Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET"
312#endif
313 .config = &musb_config,
314 .power = 100,
315 .platform_ops = &omap2430_ops,
316 .board_data = &musb_board_data,
317};
318#endif
319
Peter Meerwald03ed0462012-02-08 05:24:26 +0000320/*
Dirk Behme2781f802009-01-27 18:19:12 +0100321 * Routine: misc_init_r
322 * Description: Configure board specific parts
Tom Rix558bb832009-04-01 22:02:20 -0500323 */
Dirk Behme2781f802009-01-27 18:19:12 +0100324int misc_init_r(void)
325{
Dirk Behmedc7af202009-08-08 09:30:21 +0200326 struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
327 struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
Jason Kridner40aebca2011-04-20 13:52:26 +0000328 struct control_prog_io *prog_io_base = (struct control_prog_io *)OMAP34XX_CTRL_BASE;
Steve Kipiszbf7438a2011-04-18 17:27:00 -0400329
330 /* Enable i2c2 pullup resisters */
331 writel(~(PRG_I2C2_PULLUPRESX), &prog_io_base->io1);
Dirk Behme2781f802009-01-27 18:19:12 +0100332
Steve Sakoman3ca33762010-08-12 15:17:37 -0700333 switch (get_board_revision()) {
334 case REVISION_AXBX:
335 printf("Beagle Rev Ax/Bx\n");
336 setenv("beaglerev", "AxBx");
Steve Sakoman3ca33762010-08-12 15:17:37 -0700337 break;
338 case REVISION_CX:
339 printf("Beagle Rev C1/C2/C3\n");
340 setenv("beaglerev", "Cx");
Steve Sakoman3ca33762010-08-12 15:17:37 -0700341 MUX_BEAGLE_C();
342 break;
343 case REVISION_C4:
344 printf("Beagle Rev C4\n");
Steve Sakomanac929952010-08-19 20:56:11 -0700345 setenv("beaglerev", "C4");
Steve Sakoman3ca33762010-08-12 15:17:37 -0700346 MUX_BEAGLE_C();
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 Kooi5b8018c2011-04-18 17:28:32 -0400353 case REVISION_XM_A:
Steve Sakomanac929952010-08-19 20:56:11 -0700354 printf("Beagle xM Rev A\n");
355 setenv("beaglerev", "xMA");
Steve Sakomanac929952010-08-19 20:56:11 -0700356 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;
Koen Kooi5b8018c2011-04-18 17:28:32 -0400363 case REVISION_XM_B:
364 printf("Beagle xM Rev B\n");
365 setenv("beaglerev", "xMB");
366 MUX_BEAGLE_XM();
367 /* Set VAUX2 to 1.8V for EHCI PHY */
368 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
369 TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
370 TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
371 TWL4030_PM_RECEIVER_DEV_GRP_P1);
372 break;
Koen Kooi63308442011-06-17 09:37:37 +0200373 case REVISION_XM_C:
374 printf("Beagle xM Rev C\n");
375 setenv("beaglerev", "xMC");
376 MUX_BEAGLE_XM();
377 /* Set VAUX2 to 1.8V for EHCI PHY */
378 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
379 TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
380 TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
381 TWL4030_PM_RECEIVER_DEV_GRP_P1);
382 break;
Steve Sakoman3ca33762010-08-12 15:17:37 -0700383 default:
384 printf("Beagle unknown 0x%02x\n", get_board_revision());
Koen Kooi5b8018c2011-04-18 17:28:32 -0400385 MUX_BEAGLE_XM();
386 /* Set VAUX2 to 1.8V for EHCI PHY */
387 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
388 TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
389 TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
390 TWL4030_PM_RECEIVER_DEV_GRP_P1);
Steve Sakoman3ca33762010-08-12 15:17:37 -0700391 }
392
Koen Kooib6241c22010-09-20 10:21:33 -0700393 switch (get_expansion_id()) {
394 case TINCANTOOLS_ZIPPY:
395 printf("Recognized Tincantools Zippy board (rev %d %s)\n",
396 expansion_config.revision,
397 expansion_config.fab_revision);
398 MUX_TINCANTOOLS_ZIPPY();
399 setenv("buddy", "zippy");
400 break;
401 case TINCANTOOLS_ZIPPY2:
402 printf("Recognized Tincantools Zippy2 board (rev %d %s)\n",
403 expansion_config.revision,
404 expansion_config.fab_revision);
405 MUX_TINCANTOOLS_ZIPPY();
406 setenv("buddy", "zippy2");
407 break;
408 case TINCANTOOLS_TRAINER:
409 printf("Recognized Tincantools Trainer board (rev %d %s)\n",
410 expansion_config.revision,
411 expansion_config.fab_revision);
412 MUX_TINCANTOOLS_ZIPPY();
413 MUX_TINCANTOOLS_TRAINER();
414 setenv("buddy", "trainer");
415 break;
416 case TINCANTOOLS_SHOWDOG:
417 printf("Recognized Tincantools Showdow board (rev %d %s)\n",
418 expansion_config.revision,
419 expansion_config.fab_revision);
420 /* Place holder for DSS2 definition for showdog lcd */
421 setenv("defaultdisplay", "showdoglcd");
422 setenv("buddy", "showdog");
423 break;
424 case KBADC_BEAGLEFPGA:
425 printf("Recognized KBADC Beagle FPGA board\n");
426 MUX_KBADC_BEAGLEFPGA();
427 setenv("buddy", "beaglefpga");
428 break;
Koen Kooi3d5dac62011-04-18 17:29:35 -0400429 case LW_BEAGLETOUCH:
430 printf("Recognized Liquidware BeagleTouch board\n");
431 setenv("buddy", "beagletouch");
432 break;
433 case BRAINMUX_LCDOG:
434 printf("Recognized Brainmux LCDog board\n");
435 setenv("buddy", "lcdog");
436 break;
437 case BRAINMUX_LCDOGTOUCH:
438 printf("Recognized Brainmux LCDog Touch board\n");
439 setenv("buddy", "lcdogtouch");
440 break;
441 case BBTOYS_WIFI:
442 printf("Recognized BeagleBoardToys WiFi board\n");
443 MUX_BBTOYS_WIFI()
444 setenv("buddy", "bbtoys-wifi");
445 break;;
446 case BBTOYS_VGA:
447 printf("Recognized BeagleBoardToys VGA board\n");
448 break;;
449 case BBTOYS_LCD:
450 printf("Recognized BeagleBoardToys LCD board\n");
451 break;;
Peter Meerwald1aca7382012-01-03 04:14:35 +0000452 case BCT_BRETTL3:
Peter Meerwaldad5691f2012-06-28 05:38:35 +0000453 printf("Recognized bct electronic GmbH brettl3 board\n");
454 break;
455 case BCT_BRETTL4:
456 printf("Recognized bct electronic GmbH brettl4 board\n");
457 break;
Koen Kooib6241c22010-09-20 10:21:33 -0700458 case BEAGLE_NO_EEPROM:
459 printf("No EEPROM on expansion board\n");
460 setenv("buddy", "none");
461 break;
462 default:
463 printf("Unrecognized expansion board: %x\n",
464 expansion_config.device_vendor);
465 setenv("buddy", "unknown");
466 }
467
468 if (expansion_config.content == 1)
469 setenv(expansion_config.env_var, expansion_config.env_setting);
470
Tom Rix0f2a8042009-06-28 12:52:30 -0500471 twl4030_power_init();
Christian Spielberger3be83dc2011-08-24 17:17:31 -0500472 switch (get_board_revision()) {
473 case REVISION_XM_A:
474 case REVISION_XM_B:
475 twl4030_led_init(TWL4030_LED_LEDEN_LEDBON);
476 break;
477 default:
478 twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
479 break;
480 }
Dirk Behme2781f802009-01-27 18:19:12 +0100481
Bob Feretich0ad89512011-02-24 13:16:44 +0000482 /* Set GPIO states before they are made outputs */
Dirk Behme2781f802009-01-27 18:19:12 +0100483 writel(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1,
484 &gpio6_base->setdataout);
485 writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
486 GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);
487
Bob Feretich0ad89512011-02-24 13:16:44 +0000488 /* Configure GPIOs to output */
489 writel(~(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe);
490 writel(~(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
491 GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe);
492
Dirk Behme12dbcf62009-03-12 19:30:50 +0100493 dieid_num_r();
Peter Meerwald03ed0462012-02-08 05:24:26 +0000494
Peter Meerwalda2f54562012-07-10 06:07:34 +0000495#ifdef CONFIG_VIDEO_OMAP3
Peter Meerwald03ed0462012-02-08 05:24:26 +0000496 beagle_dvi_pup();
Jason Kridnerb8f6ac52011-04-19 14:01:13 -0500497 beagle_display_init();
498 omap3_dss_enable();
Peter Meerwalda2f54562012-07-10 06:07:34 +0000499#endif
Dirk Behme12dbcf62009-03-12 19:30:50 +0100500
Ilya Yanokcb7b2b82012-11-06 13:48:30 +0000501#ifdef CONFIG_USB_MUSB_OMAP2PLUS
502 musb_register(&musb_plat, &musb_board_data, (void *)MUSB_BASE);
503#endif
504
Dirk Behme2781f802009-01-27 18:19:12 +0100505 return 0;
506}
507
Tom Rix558bb832009-04-01 22:02:20 -0500508/*
Dirk Behme2781f802009-01-27 18:19:12 +0100509 * Routine: set_muxconf_regs
510 * Description: Setting up the configuration Mux registers specific to the
511 * hardware. Many pins need to be moved from protect to primary
512 * mode.
Tom Rix558bb832009-04-01 22:02:20 -0500513 */
Dirk Behme2781f802009-01-27 18:19:12 +0100514void set_muxconf_regs(void)
515{
516 MUX_BEAGLE();
Dirk Behme2781f802009-01-27 18:19:12 +0100517}
Steve Sakoman57c62412010-09-19 21:19:48 -0700518
Tom Rini06c32fb2011-11-18 12:48:08 +0000519#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
Steve Sakoman57c62412010-09-19 21:19:48 -0700520int board_mmc_init(bd_t *bis)
521{
Jonathan Solnita9b05562012-02-24 11:30:18 +0000522 omap_mmc_init(0, 0, 0);
Steve Sakoman57c62412010-09-19 21:19:48 -0700523 return 0;
524}
525#endif
Alexander Holler8f6f15c2011-04-19 09:30:35 -0400526
Ilya Yanokf7a2c552012-09-18 00:22:50 +0000527#if defined(CONFIG_USB_EHCI) && !defined(CONFIG_SPL_BUILD)
Alexander Holler8f6f15c2011-04-19 09:30:35 -0400528/* Call usb_stop() before starting the kernel */
529void show_boot_progress(int val)
530{
Simon Glass29395642011-12-10 11:07:54 +0000531 if (val == BOOTSTAGE_ID_RUN_OS)
Alexander Holler8f6f15c2011-04-19 09:30:35 -0400532 usb_stop();
533}
Govindraj.Redc16a02012-02-06 03:55:34 +0000534
535static struct omap_usbhs_board_data usbhs_bdata = {
536 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
537 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
538 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
539};
540
Lucas Stach3494a4c2012-09-26 00:14:35 +0200541int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
Govindraj.Redc16a02012-02-06 03:55:34 +0000542{
Lucas Stach3494a4c2012-09-26 00:14:35 +0200543 return omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor);
Govindraj.Redc16a02012-02-06 03:55:34 +0000544}
545
Lucas Stach3494a4c2012-09-26 00:14:35 +0200546int ehci_hcd_stop(int index)
Govindraj.Redc16a02012-02-06 03:55:34 +0000547{
548 return omap_ehci_hcd_stop();
549}
550
Alexander Holler8f6f15c2011-04-19 09:30:35 -0400551#endif /* CONFIG_USB_EHCI */
Ilya Yanokcb7b2b82012-11-06 13:48:30 +0000552
553#if defined(CONFIG_USB_ETHER) && defined(CONFIG_MUSB_GADGET)
554int board_eth_init(bd_t *bis)
555{
556 return usb_eth_initialize(bis);
557}
558#endif