pico-imx7d: Add USB Host support
authorFabio Estevam <festevam@gmail.com>
Fri, 28 Sep 2018 14:22:39 +0000 (11:22 -0300)
committerStefano Babic <sbabic@denx.de>
Tue, 9 Oct 2018 16:28:06 +0000 (18:28 +0200)
USB OTG2 port is connected to the USB host connector.

Add support for it.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
board/technexion/pico-imx7d/pico-imx7d.c

index 0767d0462fecac9be711ad45bdc3c2c0f49d4987..53e14693a5326d5e8a76f5cb2a2ced56f363a79e 100644 (file)
@@ -282,7 +282,34 @@ int checkboard(void)
        return 0;
 }
 
+static iomux_v3_cfg_t const usb_otg2_pads[] = {
+       MX7D_PAD_UART3_CTS_B__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+int board_ehci_hcd_init(int port)
+{
+       switch (port) {
+       case 0:
+               break;
+       case 1:
+               imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
+                                                ARRAY_SIZE(usb_otg2_pads));
+               break;
+       default:
+               return -EINVAL;
+       }
+       return 0;
+}
+
 int board_usb_phy_mode(int port)
 {
-       return USB_INIT_DEVICE;
+       switch (port) {
+       case 0:
+               return USB_INIT_DEVICE;
+       case 1:
+               return USB_INIT_HOST;
+       default:
+               return -EINVAL;
+       }
+       return 0;
 }