diff options
author | Ye Li <ye.li@nxp.com> | 2018-05-11 01:36:19 -0700 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2018-05-11 08:12:29 -0700 |
commit | 62dab68436bb0a7cc53b506dad9168b9f10d0b3d (patch) | |
tree | ed06ead0cdda27e416fc49a59b7c5a55d0bf4cf3 /board | |
parent | c73d137e0a4a613a49f6f63ec63332508afb88c0 (diff) |
MLK-18290-5 imx8mm_evk: Add board codes for USB
Enable the USB host and device support, add relvent board level codes
and settings.
For device mode, the gadget is fixed on USB device 0. Can't support
gadget on USB device 1.
Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/freescale/imx8mm_evk/imx8mm_evk.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/board/freescale/imx8mm_evk/imx8mm_evk.c b/board/freescale/imx8mm_evk/imx8mm_evk.c index 88b8caa5de..63035160e4 100644 --- a/board/freescale/imx8mm_evk/imx8mm_evk.c +++ b/board/freescale/imx8mm_evk/imx8mm_evk.c @@ -24,6 +24,7 @@ #include <power/pmic.h> #include <power/bd71837.h> #include "../common/tcpc.h" +#include <usb.h> DECLARE_GLOBAL_DATA_PTR; @@ -293,6 +294,44 @@ static int setup_typec(void) return ret; } + +int board_usb_init(int index, enum usb_init_type init) +{ + int ret = 0; + + if (init == USB_INIT_HOST) { + imx8m_usb_power(index, true); + + if (index == 0) + ret = tcpc_setup_dfp_mode(&port1); + else + ret = tcpc_setup_dfp_mode(&port2); + } else { + if (index == 0) { + imx8m_usb_power(index, true); + ret = tcpc_setup_ufp_mode(&port1); + } else { + ret = -EPERM; /* UDC driver is hard coded to use device 0 */ + } + } + + return ret; +} + +int board_usb_cleanup(int index, enum usb_init_type init) +{ + int ret = 0; + + if (init == USB_INIT_HOST) { + if (index == 0) + ret = tcpc_disable_src_vbus(&port1); + else + ret = tcpc_disable_src_vbus(&port2); + } + + imx8m_usb_power(index, false); + return ret; +} #endif int board_init(void) |