summaryrefslogtreecommitdiff
path: root/board/freescale
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2017-03-16 17:02:56 +0800
committerYe Li <ye.li@nxp.com>2017-04-05 17:24:34 +0800
commitb4e01a67a0740c524e7522da7ace0488f86261db (patch)
treed50134f6832d17678a58daf48c5e0eeb692ca2ac /board/freescale
parent8382781a59fbae1d8ab797d64761136277e291d1 (diff)
downloadu-boot-imx-b4e01a67a0740c524e7522da7ace0488f86261db.zip
u-boot-imx-b4e01a67a0740c524e7522da7ace0488f86261db.tar.gz
u-boot-imx-b4e01a67a0740c524e7522da7ace0488f86261db.tar.bz2
MLK-14445-6 mx7ulp_evk: Add USB OTG0 support
Porting codes to support USB OTG0 on the EVK board. Convert to use DM USB driver. Signed-off-by: Ye Li <ye.li@nxp.com>
Diffstat (limited to 'board/freescale')
-rw-r--r--board/freescale/mx7ulp_evk/mx7ulp_evk.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/board/freescale/mx7ulp_evk/mx7ulp_evk.c b/board/freescale/mx7ulp_evk/mx7ulp_evk.c
index d6c27db..afad505 100644
--- a/board/freescale/mx7ulp_evk/mx7ulp_evk.c
+++ b/board/freescale/mx7ulp_evk/mx7ulp_evk.c
@@ -9,11 +9,15 @@
#include <asm/arch/sys_proto.h>
#include <asm/arch/mx7ulp-pins.h>
#include <asm/arch/iomux.h>
+#include <asm/gpio.h>
+#include <usb.h>
+#include <dm.h>
DECLARE_GLOBAL_DATA_PTR;
#define UART_PAD_CTRL (PAD_CTL_PUS_UP)
#define QSPI_PAD_CTRL1 (PAD_CTL_PUS_UP | PAD_CTL_DSE)
+#define OTG_ID_GPIO_PAD_CTRL (PAD_CTL_IBE_ENABLE)
int dram_init(void)
{
@@ -63,6 +67,37 @@ int board_qspi_init(void)
}
#endif
+#ifdef CONFIG_DM_USB
+static iomux_cfg_t const usb_otg1_pads[] = {
+ MX7ULP_PAD_PTC8__PTC8 | MUX_PAD_CTRL(OTG_ID_GPIO_PAD_CTRL), /* gpio for OTG ID*/
+};
+
+static void setup_usb(void)
+{
+ mx7ulp_iomux_setup_multiple_pads(usb_otg1_pads,
+ ARRAY_SIZE(usb_otg1_pads));
+
+ gpio_request(IMX_GPIO_NR(3, 8), "otg_id");
+ gpio_direction_input(IMX_GPIO_NR(3, 8));
+}
+
+int board_ehci_usb_phy_mode(struct udevice *dev)
+{
+ int ret = 0;
+
+ if (dev_get_addr(dev) == USBOTG0_RBASE) {
+ ret = gpio_get_value(IMX_GPIO_NR(3, 8));
+
+ if (ret)
+ return USB_INIT_DEVICE;
+ else
+ return USB_INIT_HOST;
+ }
+
+ return USB_INIT_HOST;
+}
+#endif
+
int board_early_init_f(void)
{
setup_iomux_uart();
@@ -79,5 +114,9 @@ int board_init(void)
board_qspi_init();
#endif
+#ifdef CONFIG_DM_USB
+ setup_usb();
+#endif
+
return 0;
}