diff options
author | Igor Opaniuk <igor.opaniuk@toradex.com> | 2019-07-19 12:16:25 +0300 |
---|---|---|
committer | Igor Opaniuk <igor.opaniuk@toradex.com> | 2019-07-19 12:16:25 +0300 |
commit | 0ece8702d4b097cd837cfcabba980c358874aef4 (patch) | |
tree | c2d1f9e785ade4f29c8770a3fc7aeff718f1f5ff /board/toradex | |
parent | a26e924efbf998711f56911ddd8419f95eca09b9 (diff) |
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 <igor.opaniuk@toradex.com>
Diffstat (limited to 'board/toradex')
-rw-r--r-- | board/toradex/colibri_imx6/colibri_imx6.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c index f3181a0fa1f..21be62b577c 100644 --- a/board/toradex/colibri_imx6/colibri_imx6.c +++ b/board/toradex/colibri_imx6/colibri_imx6.c @@ -37,6 +37,8 @@ #include <netdev.h> #include <libfdt.h> #include <cpu.h> +#include <usb.h> +#include <usb/ehci-ci.h> #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 |