From 0ece8702d4b097cd837cfcabba980c358874aef4 Mon Sep 17 00:00:00 2001 From: Igor Opaniuk Date: Fri, 19 Jul 2019 12:16:25 +0300 Subject: colibri_imx6: provide usb phy mode func Add function which checks USBC_DET pin value for switching to proper usb phy mode. Now USB OTG works in both host/otg modes: U-Boot 2016.11-00011-ga26e924efb-dirty (Jul 19 2019 - 12:14:09 +0300) ... Colibri iMX6 # usb start starting USB... USB0: USB EHCI 1.00 scanning bus 0 for devices... 2 USB Device(s) found USB1: USB EHCI 1.00 scanning bus 1 for devices... 2 USB Device(s) found scanning usb for storage devices... 1 Storage Device(s) found scanning usb for ethernet devices... 0 Ethernet Device(s) found Signed-off-by: Igor Opaniuk --- board/toradex/colibri_imx6/colibri_imx6.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c index f3181a0fa1..21be62b577 100644 --- a/board/toradex/colibri_imx6/colibri_imx6.c +++ b/board/toradex/colibri_imx6/colibri_imx6.c @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include "../common/tdx-cfg-block.h" #ifdef CONFIG_TDX_CMD_IMX_MFGR @@ -312,6 +314,21 @@ int board_ehci_power(int port, int on) } return 0; } + +int board_usb_phy_mode(int port) +{ + switch (port) { + case 0: + if (gpio_get_value(IMX_GPIO_NR(7, 12))) + return USB_INIT_DEVICE; + else + return USB_INIT_HOST; + case 1: + default: + return USB_INIT_HOST; + } + return USB_INIT_HOST; +} #endif #ifdef CONFIG_FSL_ESDHC -- cgit v1.2.3