blob: c09c833980179d502c5182bce17b8f99d80c5bfe [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>
45#include "beagle.h"
Jason Kridner85a08fb2010-07-21 07:41:25 -050046#include <command.h>
Dirk Behme2781f802009-01-27 18:19:12 +010047
Govindraj.Redc16a02012-02-06 03:55:34 +000048#ifdef CONFIG_USB_EHCI
49#include <usb.h>
50#include <asm/ehci-omap.h>
51#endif
52
Alexander Holler8f6f15c2011-04-19 09:30:35 -040053#define pr_debug(fmt, args...) debug(fmt, ##args)
54
Koen Kooib6241c22010-09-20 10:21:33 -070055#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 Kooi3d5dac62011-04-18 17:29:35 -040064#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 Meerwald1aca7382012-01-03 04:14:35 +000070#define BCT_BRETTL3 0x01000F00
Koen Kooib6241c22010-09-20 10:21:33 -070071#define BEAGLE_NO_EEPROM 0xffffffff
72
John Rigby0d21ed02010-12-20 18:27:51 -070073DECLARE_GLOBAL_DATA_PTR;
74
Koen Kooib6241c22010-09-20 10:21:33 -070075static 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 Rix558bb832009-04-01 22:02:20 -050084/*
Dirk Behme2781f802009-01-27 18:19:12 +010085 * Routine: board_init
86 * Description: Early hardware init.
Tom Rix558bb832009-04-01 22:02:20 -050087 */
Dirk Behme2781f802009-01-27 18:19:12 +010088int board_init(void)
89{
Dirk Behme2781f802009-01-27 18:19:12 +010090 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 Kridnerc3ef8bc2011-04-18 17:23:35 -040096#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
97 status_led_set (STATUS_LED_BOOT, STATUS_LED_ON);
98#endif
99
Dirk Behme2781f802009-01-27 18:19:12 +0100100 return 0;
101}
102
Tom Rix558bb832009-04-01 22:02:20 -0500103/*
Steve Sakoman3ca33762010-08-12 15:17:37 -0700104 * Routine: get_board_revision
105 * Description: Detect if we are running on a Beagle revision Ax/Bx,
Steve Sakomanac929952010-08-19 20:56:11 -0700106 * C1/2/3, C4 or xM. This can be done by reading
Steve Sakoman3ca33762010-08-12 15:17:37 -0700107 * 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 Sakomanac929952010-08-19 20:56:11 -0700112 * GPIO173, GPIO172, GPIO171: 0 0 0 => xM
Tom Rix558bb832009-04-01 22:02:20 -0500113 */
Steve Sakoman3ca33762010-08-12 15:17:37 -0700114int get_board_revision(void)
Dirk Behme78716112009-02-12 18:55:41 +0100115{
Steve Sakoman3ca33762010-08-12 15:17:37 -0700116 int revision;
Dirk Behme78716112009-02-12 18:55:41 +0100117
Sanjeev Premi7b3dc822011-09-08 10:51:01 -0400118 if (!gpio_request(171, "") &&
119 !gpio_request(172, "") &&
120 !gpio_request(173, "")) {
Dirk Behme78716112009-02-12 18:55:41 +0100121
Sanjeev Premi7b3dc822011-09-08 10:51:01 -0400122 gpio_direction_input(171);
123 gpio_direction_input(172);
124 gpio_direction_input(173);
Dirk Behme78716112009-02-12 18:55:41 +0100125
Sanjeev Premi7b3dc822011-09-08 10:51:01 -0400126 revision = gpio_get_value(173) << 2 |
127 gpio_get_value(172) << 1 |
128 gpio_get_value(171);
Steve Sakoman3ca33762010-08-12 15:17:37 -0700129 } else {
130 printf("Error: unable to acquire board revision GPIOs\n");
131 revision = -1;
Tom Rix70d05412009-06-03 01:53:57 -0500132 }
Dirk Behme78716112009-02-12 18:55:41 +0100133
Steve Sakoman3ca33762010-08-12 15:17:37 -0700134 return revision;
Dirk Behme78716112009-02-12 18:55:41 +0100135}
136
Tom Rini06c32fb2011-11-18 12:48:08 +0000137#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 */
143void 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.com4b949bb2012-01-27 07:09:42 +0000165 } 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 Rini06c32fb2011-11-18 12:48:08 +0000172 } 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 Rix558bb832009-04-01 22:02:20 -0500207/*
Koen Kooib6241c22010-09-20 10:21:33 -0700208 * 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 */
213unsigned 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 Kridnerb8f6ac52011-04-19 14:01:13 -0500233 * Configure DSS to display background color on DVID
234 * Configure VENC to display color bar on S-Video
235 */
236void 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/*
Peter Meerwald03ed0462012-02-08 05:24:26 +0000255 * Enable DVI power
256 */
257static void beagle_dvi_pup() {
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}
285
286/*
Dirk Behme2781f802009-01-27 18:19:12 +0100287 * Routine: misc_init_r
288 * Description: Configure board specific parts
Tom Rix558bb832009-04-01 22:02:20 -0500289 */
Dirk Behme2781f802009-01-27 18:19:12 +0100290int misc_init_r(void)
291{
Dirk Behmedc7af202009-08-08 09:30:21 +0200292 struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
293 struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
Jason Kridner40aebca2011-04-20 13:52:26 +0000294 struct control_prog_io *prog_io_base = (struct control_prog_io *)OMAP34XX_CTRL_BASE;
Steve Kipiszbf7438a2011-04-18 17:27:00 -0400295
296 /* Enable i2c2 pullup resisters */
297 writel(~(PRG_I2C2_PULLUPRESX), &prog_io_base->io1);
Dirk Behme2781f802009-01-27 18:19:12 +0100298
Steve Sakoman3ca33762010-08-12 15:17:37 -0700299 switch (get_board_revision()) {
300 case REVISION_AXBX:
301 printf("Beagle Rev Ax/Bx\n");
302 setenv("beaglerev", "AxBx");
Steve Sakoman3ca33762010-08-12 15:17:37 -0700303 break;
304 case REVISION_CX:
305 printf("Beagle Rev C1/C2/C3\n");
306 setenv("beaglerev", "Cx");
Steve Sakoman3ca33762010-08-12 15:17:37 -0700307 MUX_BEAGLE_C();
308 break;
309 case REVISION_C4:
310 printf("Beagle Rev C4\n");
Steve Sakomanac929952010-08-19 20:56:11 -0700311 setenv("beaglerev", "C4");
Steve Sakoman3ca33762010-08-12 15:17:37 -0700312 MUX_BEAGLE_C();
313 /* Set VAUX2 to 1.8V for EHCI PHY */
314 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
315 TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
316 TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
317 TWL4030_PM_RECEIVER_DEV_GRP_P1);
318 break;
Koen Kooi5b8018c2011-04-18 17:28:32 -0400319 case REVISION_XM_A:
Steve Sakomanac929952010-08-19 20:56:11 -0700320 printf("Beagle xM Rev A\n");
321 setenv("beaglerev", "xMA");
Steve Sakomanac929952010-08-19 20:56:11 -0700322 MUX_BEAGLE_XM();
323 /* Set VAUX2 to 1.8V for EHCI PHY */
324 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
325 TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
326 TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
327 TWL4030_PM_RECEIVER_DEV_GRP_P1);
328 break;
Koen Kooi5b8018c2011-04-18 17:28:32 -0400329 case REVISION_XM_B:
330 printf("Beagle xM Rev B\n");
331 setenv("beaglerev", "xMB");
332 MUX_BEAGLE_XM();
333 /* Set VAUX2 to 1.8V for EHCI PHY */
334 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
335 TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
336 TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
337 TWL4030_PM_RECEIVER_DEV_GRP_P1);
338 break;
Koen Kooi63308442011-06-17 09:37:37 +0200339 case REVISION_XM_C:
340 printf("Beagle xM Rev C\n");
341 setenv("beaglerev", "xMC");
342 MUX_BEAGLE_XM();
343 /* Set VAUX2 to 1.8V for EHCI PHY */
344 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
345 TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
346 TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
347 TWL4030_PM_RECEIVER_DEV_GRP_P1);
348 break;
Steve Sakoman3ca33762010-08-12 15:17:37 -0700349 default:
350 printf("Beagle unknown 0x%02x\n", get_board_revision());
Koen Kooi5b8018c2011-04-18 17:28:32 -0400351 MUX_BEAGLE_XM();
352 /* Set VAUX2 to 1.8V for EHCI PHY */
353 twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
354 TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
355 TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
356 TWL4030_PM_RECEIVER_DEV_GRP_P1);
Steve Sakoman3ca33762010-08-12 15:17:37 -0700357 }
358
Koen Kooib6241c22010-09-20 10:21:33 -0700359 switch (get_expansion_id()) {
360 case TINCANTOOLS_ZIPPY:
361 printf("Recognized Tincantools Zippy board (rev %d %s)\n",
362 expansion_config.revision,
363 expansion_config.fab_revision);
364 MUX_TINCANTOOLS_ZIPPY();
365 setenv("buddy", "zippy");
366 break;
367 case TINCANTOOLS_ZIPPY2:
368 printf("Recognized Tincantools Zippy2 board (rev %d %s)\n",
369 expansion_config.revision,
370 expansion_config.fab_revision);
371 MUX_TINCANTOOLS_ZIPPY();
372 setenv("buddy", "zippy2");
373 break;
374 case TINCANTOOLS_TRAINER:
375 printf("Recognized Tincantools Trainer board (rev %d %s)\n",
376 expansion_config.revision,
377 expansion_config.fab_revision);
378 MUX_TINCANTOOLS_ZIPPY();
379 MUX_TINCANTOOLS_TRAINER();
380 setenv("buddy", "trainer");
381 break;
382 case TINCANTOOLS_SHOWDOG:
383 printf("Recognized Tincantools Showdow board (rev %d %s)\n",
384 expansion_config.revision,
385 expansion_config.fab_revision);
386 /* Place holder for DSS2 definition for showdog lcd */
387 setenv("defaultdisplay", "showdoglcd");
388 setenv("buddy", "showdog");
389 break;
390 case KBADC_BEAGLEFPGA:
391 printf("Recognized KBADC Beagle FPGA board\n");
392 MUX_KBADC_BEAGLEFPGA();
393 setenv("buddy", "beaglefpga");
394 break;
Koen Kooi3d5dac62011-04-18 17:29:35 -0400395 case LW_BEAGLETOUCH:
396 printf("Recognized Liquidware BeagleTouch board\n");
397 setenv("buddy", "beagletouch");
398 break;
399 case BRAINMUX_LCDOG:
400 printf("Recognized Brainmux LCDog board\n");
401 setenv("buddy", "lcdog");
402 break;
403 case BRAINMUX_LCDOGTOUCH:
404 printf("Recognized Brainmux LCDog Touch board\n");
405 setenv("buddy", "lcdogtouch");
406 break;
407 case BBTOYS_WIFI:
408 printf("Recognized BeagleBoardToys WiFi board\n");
409 MUX_BBTOYS_WIFI()
410 setenv("buddy", "bbtoys-wifi");
411 break;;
412 case BBTOYS_VGA:
413 printf("Recognized BeagleBoardToys VGA board\n");
414 break;;
415 case BBTOYS_LCD:
416 printf("Recognized BeagleBoardToys LCD board\n");
417 break;;
Peter Meerwald1aca7382012-01-03 04:14:35 +0000418 case BCT_BRETTL3:
419 printf("Recognized bct electronic GmbH brettl3 board\n");
420 break;
Koen Kooib6241c22010-09-20 10:21:33 -0700421 case BEAGLE_NO_EEPROM:
422 printf("No EEPROM on expansion board\n");
423 setenv("buddy", "none");
424 break;
425 default:
426 printf("Unrecognized expansion board: %x\n",
427 expansion_config.device_vendor);
428 setenv("buddy", "unknown");
429 }
430
431 if (expansion_config.content == 1)
432 setenv(expansion_config.env_var, expansion_config.env_setting);
433
Tom Rix0f2a8042009-06-28 12:52:30 -0500434 twl4030_power_init();
Christian Spielberger3be83dc2011-08-24 17:17:31 -0500435 switch (get_board_revision()) {
436 case REVISION_XM_A:
437 case REVISION_XM_B:
438 twl4030_led_init(TWL4030_LED_LEDEN_LEDBON);
439 break;
440 default:
441 twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
442 break;
443 }
Dirk Behme2781f802009-01-27 18:19:12 +0100444
Bob Feretich0ad89512011-02-24 13:16:44 +0000445 /* Set GPIO states before they are made outputs */
Dirk Behme2781f802009-01-27 18:19:12 +0100446 writel(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1,
447 &gpio6_base->setdataout);
448 writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
449 GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);
450
Bob Feretich0ad89512011-02-24 13:16:44 +0000451 /* Configure GPIOs to output */
452 writel(~(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe);
453 writel(~(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
454 GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe);
455
Dirk Behme12dbcf62009-03-12 19:30:50 +0100456 dieid_num_r();
Peter Meerwald03ed0462012-02-08 05:24:26 +0000457
458 beagle_dvi_pup();
Jason Kridnerb8f6ac52011-04-19 14:01:13 -0500459 beagle_display_init();
460 omap3_dss_enable();
Dirk Behme12dbcf62009-03-12 19:30:50 +0100461
Dirk Behme2781f802009-01-27 18:19:12 +0100462 return 0;
463}
464
Tom Rix558bb832009-04-01 22:02:20 -0500465/*
Dirk Behme2781f802009-01-27 18:19:12 +0100466 * Routine: set_muxconf_regs
467 * Description: Setting up the configuration Mux registers specific to the
468 * hardware. Many pins need to be moved from protect to primary
469 * mode.
Tom Rix558bb832009-04-01 22:02:20 -0500470 */
Dirk Behme2781f802009-01-27 18:19:12 +0100471void set_muxconf_regs(void)
472{
473 MUX_BEAGLE();
Dirk Behme2781f802009-01-27 18:19:12 +0100474}
Steve Sakoman57c62412010-09-19 21:19:48 -0700475
Tom Rini06c32fb2011-11-18 12:48:08 +0000476#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
Steve Sakoman57c62412010-09-19 21:19:48 -0700477int board_mmc_init(bd_t *bis)
478{
479 omap_mmc_init(0);
480 return 0;
481}
482#endif
Alexander Holler8f6f15c2011-04-19 09:30:35 -0400483
484#ifdef CONFIG_USB_EHCI
Alexander Holler8f6f15c2011-04-19 09:30:35 -0400485/* Call usb_stop() before starting the kernel */
486void show_boot_progress(int val)
487{
488 if(val == 15)
489 usb_stop();
490}
Govindraj.Redc16a02012-02-06 03:55:34 +0000491
492static struct omap_usbhs_board_data usbhs_bdata = {
493 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
494 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
495 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
496};
497
498int ehci_hcd_init(void)
499{
500 return omap_ehci_hcd_init(&usbhs_bdata);
501}
502
503int ehci_hcd_stop(void)
504{
505 return omap_ehci_hcd_stop();
506}
507
Alexander Holler8f6f15c2011-04-19 09:30:35 -0400508#endif /* CONFIG_USB_EHCI */
Jason Kridner85a08fb2010-07-21 07:41:25 -0500509
Tom Rini06c32fb2011-11-18 12:48:08 +0000510#ifndef CONFIG_SPL_BUILD
Jason Kridner85a08fb2010-07-21 07:41:25 -0500511/*
512 * This command returns the status of the user button on beagle xM
513 * Input - none
514 * Returns - 1 if button is held down
515 * 0 if button is not held down
516 */
Dirk Behme5421b582011-09-22 01:53:22 +0000517int do_userbutton(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Jason Kridner85a08fb2010-07-21 07:41:25 -0500518{
519 int button = 0;
520 int gpio;
521
522 /*
523 * pass address parameter as argv[0] (aka command name),
524 * and all remaining args
525 */
526 switch (get_board_revision()) {
527 case REVISION_AXBX:
528 case REVISION_CX:
529 case REVISION_C4:
530 gpio = 7;
531 break;
532 case REVISION_XM_A:
533 case REVISION_XM_B:
534 case REVISION_XM_C:
535 default:
536 gpio = 4;
537 break;
538 }
Sanjeev Premi7b3dc822011-09-08 10:51:01 -0400539 gpio_request(gpio, "");
540 gpio_direction_input(gpio);
Jason Kridner85a08fb2010-07-21 07:41:25 -0500541 printf("The user button is currently ");
Sanjeev Premi7b3dc822011-09-08 10:51:01 -0400542 if (gpio_get_value(gpio))
Jason Kridner85a08fb2010-07-21 07:41:25 -0500543 {
544 button = 1;
545 printf("PRESSED.\n");
546 }
547 else
548 {
549 button = 0;
550 printf("NOT pressed.\n");
551 }
552
Jason Kridner85a08fb2010-07-21 07:41:25 -0500553 return !button;
554}
555
556/* -------------------------------------------------------------------- */
557
558U_BOOT_CMD(
559 userbutton, CONFIG_SYS_MAXARGS, 1, do_userbutton,
560 "Return the status of the BeagleBoard USER button",
561 ""
562);
Tom Rini06c32fb2011-11-18 12:48:08 +0000563#endif