Commit 62dab684 authored by Ye Li's avatar Ye Li

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: 's avatarYe Li <ye.li@nxp.com>
Acked-by: 's avatarPeng Fan <peng.fan@nxp.com>
parent c73d137e
......@@ -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)
......
......@@ -40,3 +40,7 @@ CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_USB_TCPC=y
CONFIG_USB=y
CONFIG_DM_USB=y
CONFIG_USB_EHCI_HCD=y
\ No newline at end of file
......@@ -303,4 +303,30 @@
#define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */
#define CONFIG_SYS_I2C_SPEED 100000
/* USB configs */
#ifndef CONFIG_SPL_BUILD
#define CONFIG_CMD_USB
#define CONFIG_USB_STORAGE
#define CONFIG_CMD_EXT2
#define CONFIG_USBD_HS
#define CONFIG_USB_GADGET
#define CONFIG_CMD_USB_MASS_STORAGE
#define CONFIG_USB_GADGET_MASS_STORAGE
#define CONFIG_USB_GADGET_DOWNLOAD
#define CONFIG_USB_GADGET_VBUS_DRAW 2
#define CONFIG_USB_GADGET_DUALSPEED
#define CONFIG_USB_FUNCTION_MASS_STORAGE
#define CONFIG_G_DNL_VENDOR_NUM 0x0525
#define CONFIG_G_DNL_PRODUCT_NUM 0xa4a5
#define CONFIG_G_DNL_MANUFACTURER "FSL"
#define CONFIG_CI_UDC
#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
#endif
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment