2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2009-01-27 17:19:12 +00:00
|
|
|
/*
|
2011-11-18 12:48:08 +00:00
|
|
|
* (C) Copyright 2004-2011
|
2009-01-27 17:19:12 +00:00
|
|
|
* Texas Instruments, <www.ti.com>
|
|
|
|
*
|
|
|
|
* Author :
|
|
|
|
* Sunil Kumar <sunilsaini05@gmail.com>
|
|
|
|
* Shashi Ranjan <shashiranjanmca05@gmail.com>
|
|
|
|
*
|
|
|
|
* Derived from Beagle Board and 3430 SDP code by
|
|
|
|
* Richard Woodruff <r-woodruff2@ti.com>
|
|
|
|
* Syed Mohammed Khasim <khasim@ti.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include <common.h>
|
2014-10-23 03:37:15 +00:00
|
|
|
#include <dm.h>
|
|
|
|
#include <ns16550.h>
|
2017-01-19 08:51:45 +00:00
|
|
|
#ifdef CONFIG_LED_STATUS
|
2011-04-18 21:23:35 +00:00
|
|
|
#include <status_led.h>
|
|
|
|
#endif
|
2009-06-28 17:52:30 +00:00
|
|
|
#include <twl4030.h>
|
2017-11-30 04:45:24 +00:00
|
|
|
#include <linux/mtd/rawnand.h>
|
2009-01-27 17:19:12 +00:00
|
|
|
#include <asm/io.h>
|
2010-09-20 04:19:48 +00:00
|
|
|
#include <asm/arch/mmc_host_def.h>
|
2009-01-27 17:19:12 +00:00
|
|
|
#include <asm/arch/mux.h>
|
2011-11-18 12:48:08 +00:00
|
|
|
#include <asm/arch/mem.h>
|
2009-01-27 17:19:12 +00:00
|
|
|
#include <asm/arch/sys_proto.h>
|
2011-09-08 14:51:01 +00:00
|
|
|
#include <asm/gpio.h>
|
2009-01-27 17:19:12 +00:00
|
|
|
#include <asm/mach-types.h>
|
2012-11-06 13:48:30 +00:00
|
|
|
#include <asm/omap_musb.h>
|
2016-09-21 02:28:55 +00:00
|
|
|
#include <linux/errno.h>
|
2012-11-06 13:48:30 +00:00
|
|
|
#include <linux/usb/ch9.h>
|
|
|
|
#include <linux/usb/gadget.h>
|
|
|
|
#include <linux/usb/musb.h>
|
2009-01-27 17:19:12 +00:00
|
|
|
#include "beagle.h"
|
2010-07-21 12:41:25 +00:00
|
|
|
#include <command.h>
|
2009-01-27 17:19:12 +00:00
|
|
|
|
2017-05-13 02:33:27 +00:00
|
|
|
#ifdef CONFIG_USB_EHCI_HCD
|
2012-02-06 03:55:34 +00:00
|
|
|
#include <usb.h>
|
|
|
|
#include <asm/ehci-omap.h>
|
|
|
|
#endif
|
|
|
|
|
2010-09-20 17:21:33 +00:00
|
|
|
#define TWL4030_I2C_BUS 0
|
|
|
|
#define EXPANSION_EEPROM_I2C_BUS 1
|
|
|
|
#define EXPANSION_EEPROM_I2C_ADDRESS 0x50
|
|
|
|
|
|
|
|
#define TINCANTOOLS_ZIPPY 0x01000100
|
|
|
|
#define TINCANTOOLS_ZIPPY2 0x02000100
|
|
|
|
#define TINCANTOOLS_TRAINER 0x04000100
|
|
|
|
#define TINCANTOOLS_SHOWDOG 0x03000100
|
|
|
|
#define KBADC_BEAGLEFPGA 0x01000600
|
2011-04-18 21:29:35 +00:00
|
|
|
#define LW_BEAGLETOUCH 0x01000700
|
|
|
|
#define BRAINMUX_LCDOG 0x01000800
|
|
|
|
#define BRAINMUX_LCDOGTOUCH 0x02000800
|
|
|
|
#define BBTOYS_WIFI 0x01000B00
|
|
|
|
#define BBTOYS_VGA 0x02000B00
|
|
|
|
#define BBTOYS_LCD 0x03000B00
|
2012-01-03 04:14:35 +00:00
|
|
|
#define BCT_BRETTL3 0x01000F00
|
2012-06-28 05:38:35 +00:00
|
|
|
#define BCT_BRETTL4 0x02000F00
|
2013-02-04 06:03:30 +00:00
|
|
|
#define LSR_COM6L_ADPT 0x01001300
|
2010-09-20 17:21:33 +00:00
|
|
|
#define BEAGLE_NO_EEPROM 0xffffffff
|
|
|
|
|
2010-12-21 01:27:51 +00:00
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2010-09-20 17:21:33 +00:00
|
|
|
static struct {
|
|
|
|
unsigned int device_vendor;
|
|
|
|
unsigned char revision;
|
|
|
|
unsigned char content;
|
|
|
|
char fab_revision[8];
|
|
|
|
char env_var[16];
|
|
|
|
char env_setting[64];
|
|
|
|
} expansion_config;
|
|
|
|
|
2009-04-02 03:02:20 +00:00
|
|
|
/*
|
2009-01-27 17:19:12 +00:00
|
|
|
* Routine: board_init
|
|
|
|
* Description: Early hardware init.
|
2009-04-02 03:02:20 +00:00
|
|
|
*/
|
2009-01-27 17:19:12 +00:00
|
|
|
int board_init(void)
|
|
|
|
{
|
|
|
|
gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
|
|
|
|
/* board id for Linux */
|
|
|
|
gd->bd->bi_arch_number = MACH_TYPE_OMAP3_BEAGLE;
|
|
|
|
/* boot param addr */
|
|
|
|
gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
|
|
|
|
|
2017-01-19 08:51:45 +00:00
|
|
|
#if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE)
|
|
|
|
status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_ON);
|
2011-04-18 21:23:35 +00:00
|
|
|
#endif
|
|
|
|
|
2009-01-27 17:19:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-12-29 16:37:32 +00:00
|
|
|
#if defined(CONFIG_SPL_OS_BOOT)
|
|
|
|
int spl_start_uboot(void)
|
|
|
|
{
|
|
|
|
/* break into full u-boot on 'c' */
|
|
|
|
if (serial_tstc() && serial_getc() == 'c')
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_SPL_OS_BOOT */
|
|
|
|
|
2009-04-02 03:02:20 +00:00
|
|
|
/*
|
2010-08-12 22:17:37 +00:00
|
|
|
* Routine: get_board_revision
|
|
|
|
* Description: Detect if we are running on a Beagle revision Ax/Bx,
|
2013-04-16 20:31:20 +00:00
|
|
|
* C1/2/3, C4, xM Ax/Bx or xM Cx. This can be done by reading
|
2010-08-12 22:17:37 +00:00
|
|
|
* the level of GPIO173, GPIO172 and GPIO171. This should
|
|
|
|
* result in
|
|
|
|
* GPIO173, GPIO172, GPIO171: 1 1 1 => Ax/Bx
|
|
|
|
* GPIO173, GPIO172, GPIO171: 1 1 0 => C1/2/3
|
|
|
|
* GPIO173, GPIO172, GPIO171: 1 0 1 => C4
|
2013-04-16 20:31:20 +00:00
|
|
|
* GPIO173, GPIO172, GPIO171: 0 1 0 => xM Cx
|
|
|
|
* GPIO173, GPIO172, GPIO171: 0 0 0 => xM Ax/Bx
|
2009-04-02 03:02:20 +00:00
|
|
|
*/
|
2012-07-02 03:19:03 +00:00
|
|
|
static int get_board_revision(void)
|
2009-02-12 17:55:41 +00:00
|
|
|
{
|
2014-10-23 03:37:15 +00:00
|
|
|
static int revision = -1;
|
2009-02-12 17:55:41 +00:00
|
|
|
|
2014-10-23 03:37:15 +00:00
|
|
|
if (revision == -1) {
|
|
|
|
if (!gpio_request(171, "rev0") &&
|
|
|
|
!gpio_request(172, "rev1") &&
|
|
|
|
!gpio_request(173, "rev2")) {
|
|
|
|
gpio_direction_input(171);
|
|
|
|
gpio_direction_input(172);
|
|
|
|
gpio_direction_input(173);
|
2009-06-03 06:53:57 +00:00
|
|
|
|
2014-10-23 03:37:15 +00:00
|
|
|
revision = gpio_get_value(173) << 2 |
|
|
|
|
gpio_get_value(172) << 1 |
|
|
|
|
gpio_get_value(171);
|
|
|
|
} else {
|
|
|
|
printf("Error: unable to acquire board revision GPIOs\n");
|
|
|
|
}
|
2009-06-03 06:53:57 +00:00
|
|
|
}
|
2009-02-12 17:55:41 +00:00
|
|
|
|
2010-08-12 22:17:37 +00:00
|
|
|
return revision;
|
2009-02-12 17:55:41 +00:00
|
|
|
}
|
|
|
|
|
2011-11-18 12:48:08 +00:00
|
|
|
#ifdef CONFIG_SPL_BUILD
|
|
|
|
/*
|
|
|
|
* Routine: get_board_mem_timings
|
|
|
|
* Description: If we use SPL then there is no x-loader nor config header
|
|
|
|
* so we have to setup the DDR timings ourself on both banks.
|
|
|
|
*/
|
2012-11-13 07:40:28 +00:00
|
|
|
void get_board_mem_timings(struct board_sdrc_timings *timings)
|
2011-11-18 12:48:08 +00:00
|
|
|
{
|
|
|
|
int pop_mfr, pop_id;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We need to identify what PoP memory is on the board so that
|
|
|
|
* we know what timings to use. If we can't identify it then
|
|
|
|
* we know it's an xM. To map the ID values please see nand_ids.c
|
|
|
|
*/
|
|
|
|
identify_nand_chip(&pop_mfr, &pop_id);
|
|
|
|
|
2012-11-13 07:40:28 +00:00
|
|
|
timings->mr = MICRON_V_MR_165;
|
2011-11-18 12:48:08 +00:00
|
|
|
switch (get_board_revision()) {
|
|
|
|
case REVISION_C4:
|
|
|
|
if (pop_mfr == NAND_MFR_STMICRO && pop_id == 0xba) {
|
|
|
|
/* 512MB DDR */
|
2012-11-13 07:40:28 +00:00
|
|
|
timings->mcfg = NUMONYX_V_MCFG_165(512 << 20);
|
|
|
|
timings->ctrla = NUMONYX_V_ACTIMA_165;
|
|
|
|
timings->ctrlb = NUMONYX_V_ACTIMB_165;
|
|
|
|
timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
|
2011-11-18 12:48:08 +00:00
|
|
|
break;
|
2012-01-27 07:09:42 +00:00
|
|
|
} else if (pop_mfr == NAND_MFR_MICRON && pop_id == 0xba) {
|
|
|
|
/* Beagleboard Rev C4, 512MB Nand/256MB DDR*/
|
2012-11-13 07:40:28 +00:00
|
|
|
timings->mcfg = MICRON_V_MCFG_165(128 << 20);
|
|
|
|
timings->ctrla = MICRON_V_ACTIMA_165;
|
|
|
|
timings->ctrlb = MICRON_V_ACTIMB_165;
|
|
|
|
timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
|
2012-01-27 07:09:42 +00:00
|
|
|
break;
|
2011-11-18 12:48:08 +00:00
|
|
|
} else if (pop_mfr == NAND_MFR_MICRON && pop_id == 0xbc) {
|
|
|
|
/* Beagleboard Rev C5, 256MB DDR */
|
2012-11-13 07:40:28 +00:00
|
|
|
timings->mcfg = MICRON_V_MCFG_200(256 << 20);
|
|
|
|
timings->ctrla = MICRON_V_ACTIMA_200;
|
|
|
|
timings->ctrlb = MICRON_V_ACTIMB_200;
|
|
|
|
timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
|
2011-11-18 12:48:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-07-15 12:11:30 +00:00
|
|
|
case REVISION_XM_AB:
|
2011-11-18 12:48:08 +00:00
|
|
|
case REVISION_XM_C:
|
|
|
|
if (pop_mfr == 0) {
|
|
|
|
/* 256MB DDR */
|
2012-11-13 07:40:28 +00:00
|
|
|
timings->mcfg = MICRON_V_MCFG_200(256 << 20);
|
|
|
|
timings->ctrla = MICRON_V_ACTIMA_200;
|
|
|
|
timings->ctrlb = MICRON_V_ACTIMB_200;
|
|
|
|
timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
|
2011-11-18 12:48:08 +00:00
|
|
|
} else {
|
|
|
|
/* 512MB DDR */
|
2012-11-13 07:40:28 +00:00
|
|
|
timings->mcfg = NUMONYX_V_MCFG_165(512 << 20);
|
|
|
|
timings->ctrla = NUMONYX_V_ACTIMA_165;
|
|
|
|
timings->ctrlb = NUMONYX_V_ACTIMB_165;
|
|
|
|
timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
|
2011-11-18 12:48:08 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Assume 128MB and Micron/165MHz timings to be safe */
|
2012-11-13 07:40:28 +00:00
|
|
|
timings->mcfg = MICRON_V_MCFG_165(128 << 20);
|
|
|
|
timings->ctrla = MICRON_V_ACTIMA_165;
|
|
|
|
timings->ctrlb = MICRON_V_ACTIMB_165;
|
|
|
|
timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
|
2011-11-18 12:48:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-09-20 17:21:33 +00:00
|
|
|
/*
|
|
|
|
* Routine: get_expansion_id
|
|
|
|
* Description: This function checks for expansion board by checking I2C
|
|
|
|
* bus 1 for the availability of an AT24C01B serial EEPROM.
|
|
|
|
* returns the device_vendor field from the EEPROM
|
|
|
|
*/
|
2012-07-02 03:19:03 +00:00
|
|
|
static unsigned int get_expansion_id(void)
|
2010-09-20 17:21:33 +00:00
|
|
|
{
|
|
|
|
i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS);
|
|
|
|
|
|
|
|
/* return BEAGLE_NO_EEPROM if eeprom doesn't respond */
|
|
|
|
if (i2c_probe(EXPANSION_EEPROM_I2C_ADDRESS) == 1) {
|
|
|
|
i2c_set_bus_num(TWL4030_I2C_BUS);
|
|
|
|
return BEAGLE_NO_EEPROM;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read configuration data */
|
|
|
|
i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config,
|
|
|
|
sizeof(expansion_config));
|
|
|
|
|
2013-02-04 06:03:10 +00:00
|
|
|
/* retry reading configuration data with 16bit addressing */
|
|
|
|
if ((expansion_config.device_vendor == 0xFFFFFF00) ||
|
|
|
|
(expansion_config.device_vendor == 0xFFFFFFFF)) {
|
|
|
|
printf("EEPROM is blank or 8bit addressing failed: retrying with 16bit:\n");
|
|
|
|
i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 2, (u8 *)&expansion_config,
|
|
|
|
sizeof(expansion_config));
|
|
|
|
}
|
|
|
|
|
2010-09-20 17:21:33 +00:00
|
|
|
i2c_set_bus_num(TWL4030_I2C_BUS);
|
|
|
|
|
|
|
|
return expansion_config.device_vendor;
|
|
|
|
}
|
|
|
|
|
2012-07-10 06:07:34 +00:00
|
|
|
#ifdef CONFIG_VIDEO_OMAP3
|
2011-04-19 19:01:13 +00:00
|
|
|
/*
|
|
|
|
* Configure DSS to display background color on DVID
|
|
|
|
* Configure VENC to display color bar on S-Video
|
|
|
|
*/
|
2012-07-02 03:19:03 +00:00
|
|
|
static void beagle_display_init(void)
|
2011-04-19 19:01:13 +00:00
|
|
|
{
|
|
|
|
omap3_dss_venc_config(&venc_config_std_tv, VENC_HEIGHT, VENC_WIDTH);
|
|
|
|
switch (get_board_revision()) {
|
|
|
|
case REVISION_AXBX:
|
|
|
|
case REVISION_CX:
|
|
|
|
case REVISION_C4:
|
|
|
|
omap3_dss_panel_config(&dvid_cfg);
|
|
|
|
break;
|
2013-07-15 12:11:30 +00:00
|
|
|
case REVISION_XM_AB:
|
2011-04-19 19:01:13 +00:00
|
|
|
case REVISION_XM_C:
|
|
|
|
default:
|
|
|
|
omap3_dss_panel_config(&dvid_cfg_xm);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-08 05:24:26 +00:00
|
|
|
/*
|
|
|
|
* Enable DVI power
|
|
|
|
*/
|
2012-03-27 23:05:07 +00:00
|
|
|
static void beagle_dvi_pup(void)
|
|
|
|
{
|
2012-02-08 05:24:26 +00:00
|
|
|
uchar val;
|
|
|
|
|
|
|
|
switch (get_board_revision()) {
|
|
|
|
case REVISION_AXBX:
|
|
|
|
case REVISION_CX:
|
|
|
|
case REVISION_C4:
|
2014-10-23 03:37:15 +00:00
|
|
|
gpio_request(170, "dvi");
|
2012-02-08 05:24:26 +00:00
|
|
|
gpio_direction_output(170, 0);
|
|
|
|
gpio_set_value(170, 1);
|
|
|
|
break;
|
2013-07-15 12:11:30 +00:00
|
|
|
case REVISION_XM_AB:
|
2012-02-08 05:24:26 +00:00
|
|
|
case REVISION_XM_C:
|
|
|
|
default:
|
|
|
|
#define GPIODATADIR1 (TWL4030_BASEADD_GPIO+3)
|
|
|
|
#define GPIODATAOUT1 (TWL4030_BASEADD_GPIO+6)
|
|
|
|
|
|
|
|
i2c_read(TWL4030_CHIP_GPIO, GPIODATADIR1, 1, &val, 1);
|
|
|
|
val |= 4;
|
|
|
|
i2c_write(TWL4030_CHIP_GPIO, GPIODATADIR1, 1, &val, 1);
|
|
|
|
|
|
|
|
i2c_read(TWL4030_CHIP_GPIO, GPIODATAOUT1, 1, &val, 1);
|
|
|
|
val |= 4;
|
|
|
|
i2c_write(TWL4030_CHIP_GPIO, GPIODATAOUT1, 1, &val, 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-07-10 06:07:34 +00:00
|
|
|
#endif
|
2012-02-08 05:24:26 +00:00
|
|
|
|
2012-11-06 13:48:30 +00:00
|
|
|
#ifdef CONFIG_USB_MUSB_OMAP2PLUS
|
|
|
|
static struct musb_hdrc_config musb_config = {
|
|
|
|
.multipoint = 1,
|
|
|
|
.dyn_fifo = 1,
|
|
|
|
.num_eps = 16,
|
|
|
|
.ram_bits = 12,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct omap_musb_board_data musb_board_data = {
|
|
|
|
.interface_type = MUSB_INTERFACE_ULPI,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct musb_hdrc_platform_data musb_plat = {
|
2015-08-04 15:04:06 +00:00
|
|
|
#if defined(CONFIG_USB_MUSB_HOST)
|
2012-11-06 13:48:30 +00:00
|
|
|
.mode = MUSB_HOST,
|
2015-08-04 15:04:06 +00:00
|
|
|
#elif defined(CONFIG_USB_MUSB_GADGET)
|
2012-11-06 13:48:30 +00:00
|
|
|
.mode = MUSB_PERIPHERAL,
|
|
|
|
#else
|
2015-08-04 15:04:06 +00:00
|
|
|
#error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
|
2012-11-06 13:48:30 +00:00
|
|
|
#endif
|
|
|
|
.config = &musb_config,
|
|
|
|
.power = 100,
|
|
|
|
.platform_ops = &omap2430_ops,
|
|
|
|
.board_data = &musb_board_data,
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2009-04-02 03:02:20 +00:00
|
|
|
/*
|
2009-01-27 17:19:12 +00:00
|
|
|
* Routine: misc_init_r
|
|
|
|
* Description: Configure board specific parts
|
2009-04-02 03:02:20 +00:00
|
|
|
*/
|
2009-01-27 17:19:12 +00:00
|
|
|
int misc_init_r(void)
|
|
|
|
{
|
2009-08-08 07:30:21 +00:00
|
|
|
struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
|
|
|
|
struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
|
2011-04-20 13:52:26 +00:00
|
|
|
struct control_prog_io *prog_io_base = (struct control_prog_io *)OMAP34XX_CTRL_BASE;
|
2014-03-28 16:00:06 +00:00
|
|
|
bool generate_fake_mac = false;
|
2014-09-29 17:46:48 +00:00
|
|
|
u32 value;
|
2011-04-18 21:27:00 +00:00
|
|
|
|
|
|
|
/* Enable i2c2 pullup resisters */
|
2014-09-29 17:46:48 +00:00
|
|
|
value = readl(&prog_io_base->io1);
|
|
|
|
value &= ~(PRG_I2C2_PULLUPRESX);
|
|
|
|
writel(value, &prog_io_base->io1);
|
2009-01-27 17:19:12 +00:00
|
|
|
|
2010-08-12 22:17:37 +00:00
|
|
|
switch (get_board_revision()) {
|
|
|
|
case REVISION_AXBX:
|
|
|
|
printf("Beagle Rev Ax/Bx\n");
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("beaglerev", "AxBx");
|
2010-08-12 22:17:37 +00:00
|
|
|
break;
|
|
|
|
case REVISION_CX:
|
|
|
|
printf("Beagle Rev C1/C2/C3\n");
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("beaglerev", "Cx");
|
2010-08-12 22:17:37 +00:00
|
|
|
MUX_BEAGLE_C();
|
|
|
|
break;
|
|
|
|
case REVISION_C4:
|
|
|
|
printf("Beagle Rev C4\n");
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("beaglerev", "C4");
|
2010-08-12 22:17:37 +00:00
|
|
|
MUX_BEAGLE_C();
|
|
|
|
/* Set VAUX2 to 1.8V for EHCI PHY */
|
2010-08-20 03:56:11 +00:00
|
|
|
twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
|
|
|
|
TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
|
|
|
|
TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
|
|
|
|
TWL4030_PM_RECEIVER_DEV_GRP_P1);
|
|
|
|
break;
|
2013-07-15 12:11:30 +00:00
|
|
|
case REVISION_XM_AB:
|
|
|
|
printf("Beagle xM Rev A/B\n");
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("beaglerev", "xMAB");
|
2010-08-20 03:56:11 +00:00
|
|
|
MUX_BEAGLE_XM();
|
|
|
|
/* Set VAUX2 to 1.8V for EHCI PHY */
|
2011-06-17 07:37:37 +00:00
|
|
|
twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
|
|
|
|
TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
|
|
|
|
TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
|
|
|
|
TWL4030_PM_RECEIVER_DEV_GRP_P1);
|
2014-03-28 16:00:06 +00:00
|
|
|
generate_fake_mac = true;
|
2011-06-17 07:37:37 +00:00
|
|
|
break;
|
|
|
|
case REVISION_XM_C:
|
|
|
|
printf("Beagle xM Rev C\n");
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("beaglerev", "xMC");
|
2011-06-17 07:37:37 +00:00
|
|
|
MUX_BEAGLE_XM();
|
|
|
|
/* Set VAUX2 to 1.8V for EHCI PHY */
|
2010-08-12 22:17:37 +00:00
|
|
|
twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
|
|
|
|
TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
|
|
|
|
TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
|
|
|
|
TWL4030_PM_RECEIVER_DEV_GRP_P1);
|
2014-03-28 16:00:06 +00:00
|
|
|
generate_fake_mac = true;
|
2010-08-12 22:17:37 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printf("Beagle unknown 0x%02x\n", get_board_revision());
|
2011-04-18 21:28:32 +00:00
|
|
|
MUX_BEAGLE_XM();
|
|
|
|
/* Set VAUX2 to 1.8V for EHCI PHY */
|
|
|
|
twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
|
|
|
|
TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
|
|
|
|
TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
|
|
|
|
TWL4030_PM_RECEIVER_DEV_GRP_P1);
|
2014-03-28 16:00:06 +00:00
|
|
|
generate_fake_mac = true;
|
2010-08-12 22:17:37 +00:00
|
|
|
}
|
|
|
|
|
2010-09-20 17:21:33 +00:00
|
|
|
switch (get_expansion_id()) {
|
|
|
|
case TINCANTOOLS_ZIPPY:
|
|
|
|
printf("Recognized Tincantools Zippy board (rev %d %s)\n",
|
|
|
|
expansion_config.revision,
|
|
|
|
expansion_config.fab_revision);
|
|
|
|
MUX_TINCANTOOLS_ZIPPY();
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("buddy", "zippy");
|
2010-09-20 17:21:33 +00:00
|
|
|
break;
|
|
|
|
case TINCANTOOLS_ZIPPY2:
|
|
|
|
printf("Recognized Tincantools Zippy2 board (rev %d %s)\n",
|
|
|
|
expansion_config.revision,
|
|
|
|
expansion_config.fab_revision);
|
|
|
|
MUX_TINCANTOOLS_ZIPPY();
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("buddy", "zippy2");
|
2010-09-20 17:21:33 +00:00
|
|
|
break;
|
|
|
|
case TINCANTOOLS_TRAINER:
|
|
|
|
printf("Recognized Tincantools Trainer board (rev %d %s)\n",
|
|
|
|
expansion_config.revision,
|
|
|
|
expansion_config.fab_revision);
|
|
|
|
MUX_TINCANTOOLS_ZIPPY();
|
|
|
|
MUX_TINCANTOOLS_TRAINER();
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("buddy", "trainer");
|
2010-09-20 17:21:33 +00:00
|
|
|
break;
|
|
|
|
case TINCANTOOLS_SHOWDOG:
|
|
|
|
printf("Recognized Tincantools Showdow board (rev %d %s)\n",
|
|
|
|
expansion_config.revision,
|
|
|
|
expansion_config.fab_revision);
|
|
|
|
/* Place holder for DSS2 definition for showdog lcd */
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("defaultdisplay", "showdoglcd");
|
|
|
|
env_set("buddy", "showdog");
|
2010-09-20 17:21:33 +00:00
|
|
|
break;
|
|
|
|
case KBADC_BEAGLEFPGA:
|
|
|
|
printf("Recognized KBADC Beagle FPGA board\n");
|
|
|
|
MUX_KBADC_BEAGLEFPGA();
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("buddy", "beaglefpga");
|
2010-09-20 17:21:33 +00:00
|
|
|
break;
|
2011-04-18 21:29:35 +00:00
|
|
|
case LW_BEAGLETOUCH:
|
|
|
|
printf("Recognized Liquidware BeagleTouch board\n");
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("buddy", "beagletouch");
|
2011-04-18 21:29:35 +00:00
|
|
|
break;
|
|
|
|
case BRAINMUX_LCDOG:
|
|
|
|
printf("Recognized Brainmux LCDog board\n");
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("buddy", "lcdog");
|
2011-04-18 21:29:35 +00:00
|
|
|
break;
|
|
|
|
case BRAINMUX_LCDOGTOUCH:
|
|
|
|
printf("Recognized Brainmux LCDog Touch board\n");
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("buddy", "lcdogtouch");
|
2011-04-18 21:29:35 +00:00
|
|
|
break;
|
|
|
|
case BBTOYS_WIFI:
|
|
|
|
printf("Recognized BeagleBoardToys WiFi board\n");
|
|
|
|
MUX_BBTOYS_WIFI()
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("buddy", "bbtoys-wifi");
|
2017-06-13 06:17:28 +00:00
|
|
|
break;
|
2011-04-18 21:29:35 +00:00
|
|
|
case BBTOYS_VGA:
|
|
|
|
printf("Recognized BeagleBoardToys VGA board\n");
|
2017-06-13 06:17:28 +00:00
|
|
|
break;
|
2011-04-18 21:29:35 +00:00
|
|
|
case BBTOYS_LCD:
|
|
|
|
printf("Recognized BeagleBoardToys LCD board\n");
|
2017-06-13 06:17:28 +00:00
|
|
|
break;
|
2012-01-03 04:14:35 +00:00
|
|
|
case BCT_BRETTL3:
|
2012-06-28 05:38:35 +00:00
|
|
|
printf("Recognized bct electronic GmbH brettl3 board\n");
|
|
|
|
break;
|
|
|
|
case BCT_BRETTL4:
|
|
|
|
printf("Recognized bct electronic GmbH brettl4 board\n");
|
|
|
|
break;
|
2013-02-04 06:03:30 +00:00
|
|
|
case LSR_COM6L_ADPT:
|
|
|
|
printf("Recognized LSR COM6L Adapter Board\n");
|
|
|
|
MUX_BBTOYS_WIFI()
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("buddy", "lsr-com6l-adpt");
|
2013-02-04 06:03:30 +00:00
|
|
|
break;
|
2010-09-20 17:21:33 +00:00
|
|
|
case BEAGLE_NO_EEPROM:
|
|
|
|
printf("No EEPROM on expansion board\n");
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("buddy", "none");
|
2010-09-20 17:21:33 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printf("Unrecognized expansion board: %x\n",
|
|
|
|
expansion_config.device_vendor);
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("buddy", "unknown");
|
2010-09-20 17:21:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (expansion_config.content == 1)
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set(expansion_config.env_var, expansion_config.env_setting);
|
2010-09-20 17:21:33 +00:00
|
|
|
|
2009-06-28 17:52:30 +00:00
|
|
|
twl4030_power_init();
|
2011-08-24 22:17:31 +00:00
|
|
|
switch (get_board_revision()) {
|
2013-07-15 12:11:30 +00:00
|
|
|
case REVISION_XM_AB:
|
2011-08-24 22:17:31 +00:00
|
|
|
twl4030_led_init(TWL4030_LED_LEDEN_LEDBON);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
|
|
|
|
break;
|
|
|
|
}
|
2009-01-27 17:19:12 +00:00
|
|
|
|
2011-02-24 13:16:44 +00:00
|
|
|
/* Set GPIO states before they are made outputs */
|
2009-01-27 17:19:12 +00:00
|
|
|
writel(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1,
|
|
|
|
&gpio6_base->setdataout);
|
|
|
|
writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
|
|
|
|
GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);
|
|
|
|
|
2011-02-24 13:16:44 +00:00
|
|
|
/* Configure GPIOs to output */
|
|
|
|
writel(~(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe);
|
|
|
|
writel(~(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
|
|
|
|
GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe);
|
|
|
|
|
2015-08-27 17:37:13 +00:00
|
|
|
omap_die_id_display();
|
2012-02-08 05:24:26 +00:00
|
|
|
|
2012-07-10 06:07:34 +00:00
|
|
|
#ifdef CONFIG_VIDEO_OMAP3
|
2012-02-08 05:24:26 +00:00
|
|
|
beagle_dvi_pup();
|
2011-04-19 19:01:13 +00:00
|
|
|
beagle_display_init();
|
|
|
|
omap3_dss_enable();
|
2012-07-10 06:07:34 +00:00
|
|
|
#endif
|
2009-03-12 18:30:50 +00:00
|
|
|
|
2012-11-06 13:48:30 +00:00
|
|
|
#ifdef CONFIG_USB_MUSB_OMAP2PLUS
|
|
|
|
musb_register(&musb_plat, &musb_board_data, (void *)MUSB_BASE);
|
|
|
|
#endif
|
|
|
|
|
2015-08-27 17:37:12 +00:00
|
|
|
if (generate_fake_mac)
|
|
|
|
omap_die_id_usbethaddr();
|
2014-03-28 16:00:06 +00:00
|
|
|
|
2018-02-26 23:52:57 +00:00
|
|
|
#if defined(CONFIG_MTDIDS_DEFAULT) && defined(CONFIG_MTDPARTS_DEFAULT)
|
|
|
|
if (strlen(CONFIG_MTDIDS_DEFAULT))
|
|
|
|
env_set("mtdids", CONFIG_MTDIDS_DEFAULT);
|
|
|
|
|
|
|
|
if (strlen(CONFIG_MTDPARTS_DEFAULT))
|
|
|
|
env_set("mtdparts", CONFIG_MTDPARTS_DEFAULT);
|
|
|
|
#endif
|
|
|
|
|
2009-01-27 17:19:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-04-02 03:02:20 +00:00
|
|
|
/*
|
2009-01-27 17:19:12 +00:00
|
|
|
* Routine: set_muxconf_regs
|
|
|
|
* Description: Setting up the configuration Mux registers specific to the
|
|
|
|
* hardware. Many pins need to be moved from protect to primary
|
|
|
|
* mode.
|
2009-04-02 03:02:20 +00:00
|
|
|
*/
|
2009-01-27 17:19:12 +00:00
|
|
|
void set_muxconf_regs(void)
|
|
|
|
{
|
|
|
|
MUX_BEAGLE();
|
|
|
|
}
|
2010-09-20 04:19:48 +00:00
|
|
|
|
2017-05-09 11:31:39 +00:00
|
|
|
#if defined(CONFIG_MMC)
|
2010-09-20 04:19:48 +00:00
|
|
|
int board_mmc_init(bd_t *bis)
|
|
|
|
{
|
2012-12-03 02:19:47 +00:00
|
|
|
return omap_mmc_init(0, 0, 0, -1, -1);
|
2010-09-20 04:19:48 +00:00
|
|
|
}
|
|
|
|
#endif
|
2011-04-19 13:30:35 +00:00
|
|
|
|
2017-05-09 11:31:39 +00:00
|
|
|
#if defined(CONFIG_MMC)
|
2014-11-08 19:55:47 +00:00
|
|
|
void board_mmc_power_init(void)
|
|
|
|
{
|
|
|
|
twl4030_power_mmc_init(0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-05-13 02:33:27 +00:00
|
|
|
#if defined(CONFIG_USB_EHCI_HCD) && !defined(CONFIG_SPL_BUILD)
|
2011-04-19 13:30:35 +00:00
|
|
|
/* Call usb_stop() before starting the kernel */
|
|
|
|
void show_boot_progress(int val)
|
|
|
|
{
|
2011-12-10 11:07:54 +00:00
|
|
|
if (val == BOOTSTAGE_ID_RUN_OS)
|
2011-04-19 13:30:35 +00:00
|
|
|
usb_stop();
|
|
|
|
}
|
2012-02-06 03:55:34 +00:00
|
|
|
|
|
|
|
static struct omap_usbhs_board_data usbhs_bdata = {
|
|
|
|
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
|
|
|
|
.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
|
|
|
|
.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
|
|
|
|
};
|
|
|
|
|
2013-10-10 22:27:57 +00:00
|
|
|
int ehci_hcd_init(int index, enum usb_init_type init,
|
|
|
|
struct ehci_hccr **hccr, struct ehci_hcor **hcor)
|
2012-02-06 03:55:34 +00:00
|
|
|
{
|
2013-10-04 17:22:26 +00:00
|
|
|
return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
|
2012-02-06 03:55:34 +00:00
|
|
|
}
|
|
|
|
|
2012-09-25 22:14:35 +00:00
|
|
|
int ehci_hcd_stop(int index)
|
2012-02-06 03:55:34 +00:00
|
|
|
{
|
|
|
|
return omap_ehci_hcd_stop();
|
|
|
|
}
|
|
|
|
|
2017-05-13 02:33:27 +00:00
|
|
|
#endif /* CONFIG_USB_EHCI_HCD */
|
2012-11-06 13:48:30 +00:00
|
|
|
|
2015-08-04 15:04:06 +00:00
|
|
|
#if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
|
2012-11-06 13:48:30 +00:00
|
|
|
int board_eth_init(bd_t *bis)
|
|
|
|
{
|
|
|
|
return usb_eth_initialize(bis);
|
|
|
|
}
|
|
|
|
#endif
|