2010-02-05 14:13:58 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2009 Freescale Semiconductor, Inc.
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2010-02-05 14:13:58 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/io.h>
|
2011-08-21 21:29:52 +00:00
|
|
|
#include <asm/gpio.h>
|
2010-02-05 14:13:58 +00:00
|
|
|
#include <asm/arch/imx-regs.h>
|
2013-05-03 10:32:27 +00:00
|
|
|
#include <asm/arch/iomux-mx51.h>
|
2016-09-21 02:28:55 +00:00
|
|
|
#include <linux/errno.h>
|
2010-03-05 16:54:37 +00:00
|
|
|
#include <asm/arch/sys_proto.h>
|
2010-03-16 16:22:21 +00:00
|
|
|
#include <asm/arch/crm_regs.h>
|
2012-10-01 08:36:25 +00:00
|
|
|
#include <asm/arch/clock.h>
|
2017-06-29 08:16:06 +00:00
|
|
|
#include <asm/mach-imx/mx5_video.h>
|
2010-02-05 14:13:58 +00:00
|
|
|
#include <i2c.h>
|
|
|
|
#include <mmc.h>
|
|
|
|
#include <fsl_esdhc.h>
|
2012-11-13 03:21:55 +00:00
|
|
|
#include <power/pmic.h>
|
2010-03-16 16:22:21 +00:00
|
|
|
#include <fsl_pmic.h>
|
|
|
|
#include <mc13892.h>
|
2016-03-31 21:12:23 +00:00
|
|
|
#include <usb/ehci-ci.h>
|
2010-02-05 14:13:58 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
|
|
|
#ifdef CONFIG_FSL_ESDHC
|
|
|
|
struct fsl_esdhc_cfg esdhc_cfg[2] = {
|
2012-08-13 07:28:16 +00:00
|
|
|
{MMC_SDHC1_BASE_ADDR},
|
|
|
|
{MMC_SDHC2_BASE_ADDR},
|
2010-02-05 14:13:58 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int dram_init(void)
|
|
|
|
{
|
2010-10-28 02:13:15 +00:00
|
|
|
/* dram_init must store complete ramsize in gd->ram_size */
|
2011-07-03 05:55:33 +00:00
|
|
|
gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
|
2010-10-28 02:13:15 +00:00
|
|
|
PHYS_SDRAM_1_SIZE);
|
2010-02-05 14:13:58 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-09-18 04:48:42 +00:00
|
|
|
u32 get_board_rev(void)
|
|
|
|
{
|
|
|
|
u32 rev = get_cpu_rev();
|
|
|
|
if (!gpio_get_value(IMX_GPIO_NR(1, 22)))
|
|
|
|
rev |= BOARD_REV_2_0 << BOARD_VER_OFFSET;
|
|
|
|
return rev;
|
|
|
|
}
|
|
|
|
|
2013-05-03 10:32:27 +00:00
|
|
|
#define UART_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN | PAD_CTL_DSE_HIGH)
|
|
|
|
|
2010-02-05 14:13:58 +00:00
|
|
|
static void setup_iomux_uart(void)
|
|
|
|
{
|
2013-05-03 10:32:27 +00:00
|
|
|
static const iomux_v3_cfg_t uart_pads[] = {
|
|
|
|
MX51_PAD_UART1_RXD__UART1_RXD,
|
|
|
|
MX51_PAD_UART1_TXD__UART1_TXD,
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_UART1_RTS__UART1_RTS, UART_PAD_CTRL),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_UART1_CTS__UART1_CTS, UART_PAD_CTRL),
|
|
|
|
};
|
|
|
|
|
|
|
|
imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads));
|
2010-02-05 14:13:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void setup_iomux_fec(void)
|
|
|
|
{
|
2013-05-03 10:32:27 +00:00
|
|
|
static const iomux_v3_cfg_t fec_pads[] = {
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_EIM_EB2__FEC_MDIO, PAD_CTL_HYS |
|
|
|
|
PAD_CTL_PUS_22K_UP | PAD_CTL_ODE |
|
|
|
|
PAD_CTL_DSE_HIGH | PAD_CTL_SRE_FAST),
|
|
|
|
MX51_PAD_NANDF_CS3__FEC_MDC,
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_EIM_CS3__FEC_RDATA3, MX51_PAD_CTRL_2),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_EIM_CS2__FEC_RDATA2, MX51_PAD_CTRL_2),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_EIM_EB3__FEC_RDATA1, MX51_PAD_CTRL_2),
|
|
|
|
MX51_PAD_NANDF_D9__FEC_RDATA0,
|
|
|
|
MX51_PAD_NANDF_CS6__FEC_TDATA3,
|
|
|
|
MX51_PAD_NANDF_CS5__FEC_TDATA2,
|
|
|
|
MX51_PAD_NANDF_CS4__FEC_TDATA1,
|
|
|
|
MX51_PAD_NANDF_D8__FEC_TDATA0,
|
|
|
|
MX51_PAD_NANDF_CS7__FEC_TX_EN,
|
|
|
|
MX51_PAD_NANDF_CS2__FEC_TX_ER,
|
|
|
|
MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK,
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_NANDF_RB2__FEC_COL, MX51_PAD_CTRL_4),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_NANDF_RB3__FEC_RX_CLK, MX51_PAD_CTRL_4),
|
|
|
|
MX51_PAD_EIM_CS5__FEC_CRS,
|
|
|
|
MX51_PAD_EIM_CS4__FEC_RX_ER,
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_NANDF_D11__FEC_RX_DV, MX51_PAD_CTRL_4),
|
|
|
|
};
|
|
|
|
|
|
|
|
imx_iomux_v3_setup_multiple_pads(fec_pads, ARRAY_SIZE(fec_pads));
|
2010-02-05 14:13:58 +00:00
|
|
|
}
|
|
|
|
|
2010-03-16 16:22:21 +00:00
|
|
|
#ifdef CONFIG_MXC_SPI
|
|
|
|
static void setup_iomux_spi(void)
|
|
|
|
{
|
2013-05-03 10:32:27 +00:00
|
|
|
static const iomux_v3_cfg_t spi_pads[] = {
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI, PAD_CTL_HYS |
|
|
|
|
PAD_CTL_DSE_HIGH | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_CSPI1_MISO__ECSPI1_MISO, PAD_CTL_HYS |
|
|
|
|
PAD_CTL_DSE_HIGH | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_CSPI1_SS1__ECSPI1_SS1,
|
|
|
|
MX51_GPIO_PAD_CTRL),
|
|
|
|
MX51_PAD_CSPI1_SS0__ECSPI1_SS0,
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_CSPI1_RDY__ECSPI1_RDY, MX51_PAD_CTRL_2),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK, PAD_CTL_HYS |
|
|
|
|
PAD_CTL_DSE_HIGH | PAD_CTL_SRE_FAST),
|
|
|
|
};
|
|
|
|
|
|
|
|
imx_iomux_v3_setup_multiple_pads(spi_pads, ARRAY_SIZE(spi_pads));
|
2010-03-16 16:22:21 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-11-11 13:03:38 +00:00
|
|
|
#ifdef CONFIG_USB_EHCI_MX5
|
2013-05-03 10:32:27 +00:00
|
|
|
#define MX51EVK_USBH1_HUB_RST IMX_GPIO_NR(1, 7)
|
|
|
|
#define MX51EVK_USBH1_STP IMX_GPIO_NR(1, 27)
|
2014-12-12 14:33:32 +00:00
|
|
|
#define MX51EVK_USB_CLK_EN_B IMX_GPIO_NR(2, 1)
|
2013-05-03 10:32:27 +00:00
|
|
|
#define MX51EVK_USB_PHY_RESET IMX_GPIO_NR(2, 5)
|
2011-11-11 13:03:38 +00:00
|
|
|
|
|
|
|
static void setup_usb_h1(void)
|
|
|
|
{
|
2013-05-03 10:32:27 +00:00
|
|
|
static const iomux_v3_cfg_t usb_h1_pads[] = {
|
|
|
|
MX51_PAD_USBH1_CLK__USBH1_CLK,
|
|
|
|
MX51_PAD_USBH1_DIR__USBH1_DIR,
|
|
|
|
MX51_PAD_USBH1_STP__USBH1_STP,
|
|
|
|
MX51_PAD_USBH1_NXT__USBH1_NXT,
|
|
|
|
MX51_PAD_USBH1_DATA0__USBH1_DATA0,
|
|
|
|
MX51_PAD_USBH1_DATA1__USBH1_DATA1,
|
|
|
|
MX51_PAD_USBH1_DATA2__USBH1_DATA2,
|
|
|
|
MX51_PAD_USBH1_DATA3__USBH1_DATA3,
|
|
|
|
MX51_PAD_USBH1_DATA4__USBH1_DATA4,
|
|
|
|
MX51_PAD_USBH1_DATA5__USBH1_DATA5,
|
|
|
|
MX51_PAD_USBH1_DATA6__USBH1_DATA6,
|
|
|
|
MX51_PAD_USBH1_DATA7__USBH1_DATA7,
|
|
|
|
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_GPIO1_7__GPIO1_7, 0), /* H1 hub reset */
|
|
|
|
MX51_PAD_EIM_D17__GPIO2_1,
|
|
|
|
MX51_PAD_EIM_D21__GPIO2_5, /* PHY reset */
|
|
|
|
};
|
|
|
|
|
|
|
|
imx_iomux_v3_setup_multiple_pads(usb_h1_pads, ARRAY_SIZE(usb_h1_pads));
|
2011-11-11 13:03:38 +00:00
|
|
|
}
|
|
|
|
|
2011-12-12 01:25:46 +00:00
|
|
|
int board_ehci_hcd_init(int port)
|
2011-11-11 13:03:38 +00:00
|
|
|
{
|
|
|
|
/* Set USBH1_STP to GPIO and toggle it */
|
2013-05-03 10:32:27 +00:00
|
|
|
imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_USBH1_STP__GPIO1_27,
|
|
|
|
MX51_USBH_PAD_CTRL));
|
2011-11-11 13:03:38 +00:00
|
|
|
|
|
|
|
gpio_direction_output(MX51EVK_USBH1_STP, 0);
|
|
|
|
gpio_direction_output(MX51EVK_USB_PHY_RESET, 0);
|
|
|
|
mdelay(10);
|
|
|
|
gpio_set_value(MX51EVK_USBH1_STP, 1);
|
|
|
|
|
|
|
|
/* Set back USBH1_STP to be function */
|
2013-05-03 10:32:27 +00:00
|
|
|
imx_iomux_v3_setup_pad(MX51_PAD_USBH1_STP__USBH1_STP);
|
2011-11-11 13:03:38 +00:00
|
|
|
|
|
|
|
/* De-assert USB PHY RESETB */
|
|
|
|
gpio_set_value(MX51EVK_USB_PHY_RESET, 1);
|
|
|
|
|
|
|
|
/* Drive USB_CLK_EN_B line low */
|
|
|
|
gpio_direction_output(MX51EVK_USB_CLK_EN_B, 0);
|
|
|
|
|
|
|
|
/* Reset USB hub */
|
|
|
|
gpio_direction_output(MX51EVK_USBH1_HUB_RST, 0);
|
|
|
|
mdelay(2);
|
|
|
|
gpio_set_value(MX51EVK_USBH1_HUB_RST, 1);
|
2011-12-12 01:25:46 +00:00
|
|
|
return 0;
|
2011-11-11 13:03:38 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-03-16 16:22:21 +00:00
|
|
|
static void power_init(void)
|
|
|
|
{
|
|
|
|
unsigned int val;
|
|
|
|
struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
|
2011-10-08 08:59:20 +00:00
|
|
|
struct pmic *p;
|
2012-11-13 03:21:55 +00:00
|
|
|
int ret;
|
2011-10-08 08:59:20 +00:00
|
|
|
|
2013-11-20 22:26:03 +00:00
|
|
|
ret = pmic_init(CONFIG_FSL_PMIC_BUS);
|
2012-11-13 03:21:55 +00:00
|
|
|
if (ret)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = pmic_get("FSL_PMIC");
|
|
|
|
if (!p)
|
|
|
|
return;
|
2010-03-16 16:22:21 +00:00
|
|
|
|
|
|
|
/* Write needed to Power Gate 2 register */
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_read(p, REG_POWER_MISC, &val);
|
2010-03-16 16:22:21 +00:00
|
|
|
val &= ~PWGT2SPIEN;
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_write(p, REG_POWER_MISC, val);
|
2010-03-16 16:22:21 +00:00
|
|
|
|
2010-10-27 15:36:04 +00:00
|
|
|
/* Externally powered */
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_read(p, REG_CHARGE, &val);
|
2010-10-27 15:36:04 +00:00
|
|
|
val |= ICHRG0 | ICHRG1 | ICHRG2 | ICHRG3 | CHGAUTOB;
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_write(p, REG_CHARGE, val);
|
2010-03-16 16:22:21 +00:00
|
|
|
|
|
|
|
/* power up the system first */
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_write(p, REG_POWER_MISC, PWUP);
|
2010-03-16 16:22:21 +00:00
|
|
|
|
|
|
|
/* Set core voltage to 1.1V */
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_read(p, REG_SW_0, &val);
|
2011-01-19 04:40:36 +00:00
|
|
|
val = (val & ~SWx_VOLT_MASK) | SWx_1_100V;
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_write(p, REG_SW_0, val);
|
2010-03-16 16:22:21 +00:00
|
|
|
|
|
|
|
/* Setup VCC (SW2) to 1.25 */
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_read(p, REG_SW_1, &val);
|
2011-01-19 04:40:36 +00:00
|
|
|
val = (val & ~SWx_VOLT_MASK) | SWx_1_250V;
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_write(p, REG_SW_1, val);
|
2010-03-16 16:22:21 +00:00
|
|
|
|
|
|
|
/* Setup 1V2_DIG1 (SW3) to 1.25 */
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_read(p, REG_SW_2, &val);
|
2011-01-19 04:40:36 +00:00
|
|
|
val = (val & ~SWx_VOLT_MASK) | SWx_1_250V;
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_write(p, REG_SW_2, val);
|
2010-03-16 16:22:21 +00:00
|
|
|
udelay(50);
|
|
|
|
|
|
|
|
/* Raise the core frequency to 800MHz */
|
|
|
|
writel(0x0, &mxc_ccm->cacrr);
|
|
|
|
|
|
|
|
/* Set switchers in Auto in NORMAL mode & STANDBY mode */
|
|
|
|
/* Setup the switcher mode for SW1 & SW2*/
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_read(p, REG_SW_4, &val);
|
2010-03-16 16:22:21 +00:00
|
|
|
val = (val & ~((SWMODE_MASK << SWMODE1_SHIFT) |
|
|
|
|
(SWMODE_MASK << SWMODE2_SHIFT)));
|
|
|
|
val |= (SWMODE_AUTO_AUTO << SWMODE1_SHIFT) |
|
|
|
|
(SWMODE_AUTO_AUTO << SWMODE2_SHIFT);
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_write(p, REG_SW_4, val);
|
2010-03-16 16:22:21 +00:00
|
|
|
|
|
|
|
/* Setup the switcher mode for SW3 & SW4 */
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_read(p, REG_SW_5, &val);
|
2010-03-16 16:22:21 +00:00
|
|
|
val = (val & ~((SWMODE_MASK << SWMODE3_SHIFT) |
|
|
|
|
(SWMODE_MASK << SWMODE4_SHIFT)));
|
|
|
|
val |= (SWMODE_AUTO_AUTO << SWMODE3_SHIFT) |
|
|
|
|
(SWMODE_AUTO_AUTO << SWMODE4_SHIFT);
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_write(p, REG_SW_5, val);
|
2010-03-16 16:22:21 +00:00
|
|
|
|
|
|
|
/* Set VDIG to 1.65V, VGEN3 to 1.8V, VCAM to 2.6V */
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_read(p, REG_SETTING_0, &val);
|
2010-03-16 16:22:21 +00:00
|
|
|
val &= ~(VCAM_MASK | VGEN3_MASK | VDIG_MASK);
|
|
|
|
val |= VDIG_1_65 | VGEN3_1_8 | VCAM_2_6;
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_write(p, REG_SETTING_0, val);
|
2010-03-16 16:22:21 +00:00
|
|
|
|
|
|
|
/* Set VVIDEO to 2.775V, VAUDIO to 3V, VSD to 3.15V */
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_read(p, REG_SETTING_1, &val);
|
2010-03-16 16:22:21 +00:00
|
|
|
val &= ~(VVIDEO_MASK | VSD_MASK | VAUDIO_MASK);
|
|
|
|
val |= VSD_3_15 | VAUDIO_3_0 | VVIDEO_2_775;
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_write(p, REG_SETTING_1, val);
|
2010-03-16 16:22:21 +00:00
|
|
|
|
|
|
|
/* Configure VGEN3 and VCAM regulators to use external PNP */
|
|
|
|
val = VGEN3CONFIG | VCAMCONFIG;
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_write(p, REG_MODE_1, val);
|
2010-03-16 16:22:21 +00:00
|
|
|
udelay(200);
|
|
|
|
|
|
|
|
/* Enable VGEN3, VCAM, VAUDIO, VVIDEO, VSD regulators */
|
|
|
|
val = VGEN3EN | VGEN3CONFIG | VCAMEN | VCAMCONFIG |
|
|
|
|
VVIDEOEN | VAUDIOEN | VSDEN;
|
2011-10-08 08:59:20 +00:00
|
|
|
pmic_reg_write(p, REG_MODE_1, val);
|
2010-03-16 16:22:21 +00:00
|
|
|
|
2013-05-03 10:32:27 +00:00
|
|
|
imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_EIM_A20__GPIO2_14,
|
|
|
|
NO_PAD_CTRL));
|
2012-08-28 02:09:38 +00:00
|
|
|
gpio_direction_output(IMX_GPIO_NR(2, 14), 0);
|
2011-10-25 03:14:00 +00:00
|
|
|
|
2010-03-16 16:22:21 +00:00
|
|
|
udelay(500);
|
|
|
|
|
2012-08-28 02:09:38 +00:00
|
|
|
gpio_set_value(IMX_GPIO_NR(2, 14), 1);
|
2010-03-16 16:22:21 +00:00
|
|
|
}
|
|
|
|
|
2010-02-05 14:13:58 +00:00
|
|
|
#ifdef CONFIG_FSL_ESDHC
|
2012-01-02 01:15:36 +00:00
|
|
|
int board_mmc_getcd(struct mmc *mmc)
|
2010-02-05 14:13:58 +00:00
|
|
|
{
|
|
|
|
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
|
2012-01-02 01:15:36 +00:00
|
|
|
int ret;
|
2010-02-05 14:13:58 +00:00
|
|
|
|
2013-05-03 10:32:27 +00:00
|
|
|
imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_GPIO1_0__GPIO1_0,
|
|
|
|
NO_PAD_CTRL));
|
2012-08-28 02:09:38 +00:00
|
|
|
gpio_direction_input(IMX_GPIO_NR(1, 0));
|
2013-05-03 10:32:27 +00:00
|
|
|
imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_GPIO1_6__GPIO1_6,
|
|
|
|
NO_PAD_CTRL));
|
2012-08-28 02:09:38 +00:00
|
|
|
gpio_direction_input(IMX_GPIO_NR(1, 6));
|
2011-11-15 05:51:33 +00:00
|
|
|
|
2010-02-05 14:13:58 +00:00
|
|
|
if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
|
2012-08-28 02:09:38 +00:00
|
|
|
ret = !gpio_get_value(IMX_GPIO_NR(1, 0));
|
2010-02-05 14:13:58 +00:00
|
|
|
else
|
2012-08-28 02:09:38 +00:00
|
|
|
ret = !gpio_get_value(IMX_GPIO_NR(1, 6));
|
2010-02-05 14:13:58 +00:00
|
|
|
|
2012-01-02 01:15:36 +00:00
|
|
|
return ret;
|
2010-02-05 14:13:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int board_mmc_init(bd_t *bis)
|
|
|
|
{
|
2013-05-03 10:32:27 +00:00
|
|
|
static const iomux_v3_cfg_t sd1_pads[] = {
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_SD1_CMD__SD1_CMD, PAD_CTL_DSE_MAX |
|
|
|
|
PAD_CTL_HYS | PAD_CTL_PUS_47K_UP | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_SD1_CLK__SD1_CLK, PAD_CTL_DSE_MAX |
|
|
|
|
PAD_CTL_PUS_47K_UP | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_SD1_DATA0__SD1_DATA0, PAD_CTL_DSE_MAX |
|
|
|
|
PAD_CTL_HYS | PAD_CTL_PUS_47K_UP | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_SD1_DATA1__SD1_DATA1, PAD_CTL_DSE_MAX |
|
|
|
|
PAD_CTL_HYS | PAD_CTL_PUS_47K_UP | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_SD1_DATA2__SD1_DATA2, PAD_CTL_DSE_MAX |
|
|
|
|
PAD_CTL_HYS | PAD_CTL_PUS_47K_UP | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_SD1_DATA3__SD1_DATA3, PAD_CTL_DSE_MAX |
|
|
|
|
PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_GPIO1_0__SD1_CD, PAD_CTL_HYS),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_GPIO1_1__SD1_WP, PAD_CTL_HYS),
|
|
|
|
};
|
|
|
|
|
|
|
|
static const iomux_v3_cfg_t sd2_pads[] = {
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_SD2_CMD__SD2_CMD,
|
|
|
|
PAD_CTL_DSE_MAX | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_SD2_CLK__SD2_CLK,
|
|
|
|
PAD_CTL_DSE_MAX | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_SD2_DATA0__SD2_DATA0,
|
|
|
|
PAD_CTL_DSE_MAX | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_SD2_DATA1__SD2_DATA1,
|
|
|
|
PAD_CTL_DSE_MAX | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_SD2_DATA2__SD2_DATA2,
|
|
|
|
PAD_CTL_DSE_MAX | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_SD2_DATA3__SD2_DATA3,
|
|
|
|
PAD_CTL_DSE_MAX | PAD_CTL_SRE_FAST),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_GPIO1_6__GPIO1_6, PAD_CTL_HYS),
|
|
|
|
NEW_PAD_CTRL(MX51_PAD_GPIO1_5__GPIO1_5, PAD_CTL_HYS),
|
|
|
|
};
|
|
|
|
|
2010-02-05 14:13:58 +00:00
|
|
|
u32 index;
|
2014-11-20 18:35:16 +00:00
|
|
|
int ret;
|
2010-02-05 14:13:58 +00:00
|
|
|
|
2012-10-01 08:36:25 +00:00
|
|
|
esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
|
|
|
|
esdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
|
|
|
|
|
2010-02-05 14:13:58 +00:00
|
|
|
for (index = 0; index < CONFIG_SYS_FSL_ESDHC_NUM;
|
|
|
|
index++) {
|
|
|
|
switch (index) {
|
|
|
|
case 0:
|
2013-05-03 10:32:27 +00:00
|
|
|
imx_iomux_v3_setup_multiple_pads(sd1_pads,
|
|
|
|
ARRAY_SIZE(sd1_pads));
|
2010-02-05 14:13:58 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2013-05-03 10:32:27 +00:00
|
|
|
imx_iomux_v3_setup_multiple_pads(sd2_pads,
|
|
|
|
ARRAY_SIZE(sd2_pads));
|
2010-02-05 14:13:58 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printf("Warning: you configured more ESDHC controller"
|
|
|
|
"(%d) as supported by the board(2)\n",
|
|
|
|
CONFIG_SYS_FSL_ESDHC_NUM);
|
2014-11-20 18:35:16 +00:00
|
|
|
return -EINVAL;
|
2010-02-05 14:13:58 +00:00
|
|
|
}
|
2014-11-20 18:35:16 +00:00
|
|
|
ret = fsl_esdhc_initialize(bis, &esdhc_cfg[index]);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2010-02-05 14:13:58 +00:00
|
|
|
}
|
2014-11-20 18:35:16 +00:00
|
|
|
return 0;
|
2010-02-05 14:13:58 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-12-23 01:13:17 +00:00
|
|
|
int board_early_init_f(void)
|
|
|
|
{
|
|
|
|
setup_iomux_uart();
|
|
|
|
setup_iomux_fec();
|
2011-11-11 13:03:38 +00:00
|
|
|
#ifdef CONFIG_USB_EHCI_MX5
|
|
|
|
setup_usb_h1();
|
|
|
|
#endif
|
2012-11-10 02:28:52 +00:00
|
|
|
setup_iomux_lcd();
|
2010-12-23 01:13:17 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-02-05 14:13:58 +00:00
|
|
|
int board_init(void)
|
|
|
|
{
|
|
|
|
/* address of boot parameters */
|
|
|
|
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-10-20 04:19:47 +00:00
|
|
|
#ifdef CONFIG_BOARD_LATE_INIT
|
2010-03-16 16:22:21 +00:00
|
|
|
int board_late_init(void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_MXC_SPI
|
|
|
|
setup_iomux_spi();
|
|
|
|
power_init();
|
|
|
|
#endif
|
2012-05-09 06:39:41 +00:00
|
|
|
|
2010-03-16 16:22:21 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-08-05 07:31:33 +00:00
|
|
|
/*
|
|
|
|
* Do not overwrite the console
|
|
|
|
* Use always serial for U-Boot console
|
|
|
|
*/
|
|
|
|
int overwrite_console(void)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-02-05 14:13:58 +00:00
|
|
|
int checkboard(void)
|
|
|
|
{
|
2011-04-22 02:55:42 +00:00
|
|
|
puts("Board: MX51EVK\n");
|
2010-02-05 14:13:58 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|