colibri_vf: Enable board specific USB initialisation for USB pen gpio
authorSanchayan Maity <maitysanchayan@gmail.com>
Mon, 1 Jun 2015 13:07:25 +0000 (18:37 +0530)
committerStefano Babic <sbabic@denx.de>
Mon, 8 Jun 2015 06:41:56 +0000 (08:41 +0200)
Add IOMUX for the pad used as USB pen. This needs to be driven low for
the Iris and Viola boards where it is pulled up high by default. This is
required for the USB host functionality to work on these boards. Use the
board specific weak initialisation function, to drive the pin low which
would be called on "usb start".

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
arch/arm/include/asm/arch-vf610/iomux-vf610.h
board/toradex/colibri_vf/colibri_vf.c

index b8b22b13089c55613293ea8c6881446ca66499ea..019307b2f9edad63b62c305dcf8e6e62c369b5dd 100644 (file)
@@ -131,6 +131,7 @@ enum {
        VF610_PAD_PTD1__QSPI0_A_CS0             = IOMUX_PAD(0x0140, 0x0140, 1, __NA_, 0, VF610_QSPI_PAD_CTRL),
        VF610_PAD_PTD2__QSPI0_A_DATA3           = IOMUX_PAD(0x0144, 0x0144, 1, __NA_, 0, VF610_QSPI_PAD_CTRL),
        VF610_PAD_PTD3__QSPI0_A_DATA2           = IOMUX_PAD(0x0148, 0x0148, 1, __NA_, 0, VF610_QSPI_PAD_CTRL),
+       VF610_PAD_PTD4__GPIO_83         = IOMUX_PAD(0x014C, 0x014C, 0, __NA_, 0, VF610_GPIO_PAD_CTRL),
        VF610_PAD_PTD4__QSPI0_A_DATA1           = IOMUX_PAD(0x014c, 0x014c, 1, __NA_, 0, VF610_QSPI_PAD_CTRL),
        VF610_PAD_PTD5__QSPI0_A_DATA0           = IOMUX_PAD(0x0150, 0x0150, 1, __NA_, 0, VF610_QSPI_PAD_CTRL),
        VF610_PAD_PTD7__QSPI0_B_QSCK            = IOMUX_PAD(0x0158, 0x0158, 1, __NA_, 0, VF610_QSPI_PAD_CTRL),
index 717302239515eb5f8de64b64e689b40f16a32b62..8618fd068cc447adf1b9990e86d392f17c742da5 100644 (file)
@@ -20,6 +20,7 @@
 #include <netdev.h>
 #include <i2c.h>
 #include <g_dnl.h>
+#include <asm/gpio.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -32,6 +33,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #define ENET_PAD_CTRL  (PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_HIGH | \
                        PAD_CTL_DSE_50ohm | PAD_CTL_OBE_IBE_ENABLE)
 
+#define USB_PEN_GPIO           83
+
+static const iomux_v3_cfg_t usb_pads[] = {
+       VF610_PAD_PTD4__GPIO_83,
+};
+
 int dram_init(void)
 {
        static const struct ddr3_jedec_timings timings = {
@@ -464,3 +471,21 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 
        return 0;
 }
+
+#ifdef CONFIG_USB_EHCI_VF
+int board_ehci_hcd_init(int port)
+{
+       imx_iomux_v3_setup_multiple_pads(usb_pads, ARRAY_SIZE(usb_pads));
+
+       switch (port) {
+       case 0:
+               /* USBC does not have PEN, also configured as USB client only */
+               break;
+       case 1:
+               gpio_request(USB_PEN_GPIO, "usb-pen-gpio");
+               gpio_direction_output(USB_PEN_GPIO, 0);
+               break;
+       }
+       return 0;
+}
+#endif