diff options
author | Luo Ji <ji.luo@nxp.com> | 2018-09-12 10:22:42 +0800 |
---|---|---|
committer | Luo Ji <ji.luo@nxp.com> | 2018-09-12 14:55:20 +0800 |
commit | 74a78490dccf359b38c721d0b92126a8b3e43e37 (patch) | |
tree | fbdb573223bb8652b8fd13dc3a2cd8685ccfc7dd /board | |
parent | 9020bf07d674d59a873d90f411e3d402f8c8d8ee (diff) |
MA-12669 imx8qm/qxp_mek: Guard TCPC codes with proper config
Separate tcpc related operations with config CONFIG_USB_TCPC
so we can enable/disable this feature separately.
Test: Boot ok on both imx8qm/8qxp_mek.
Change-Id: I46ef775e8deb4443944c0e969a4ced67c11ac48c
Signed-off-by: Luo Ji <ji.luo@nxp.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/freescale/imx8qm_mek/imx8qm_mek.c | 10 | ||||
-rw-r--r-- | board/freescale/imx8qxp_mek/imx8qxp_mek.c | 11 |
2 files changed, 18 insertions, 3 deletions
diff --git a/board/freescale/imx8qm_mek/imx8qm_mek.c b/board/freescale/imx8qm_mek/imx8qm_mek.c index e38ff4a298..ef03fa9ce6 100644 --- a/board/freescale/imx8qm_mek/imx8qm_mek.c +++ b/board/freescale/imx8qm_mek/imx8qm_mek.c @@ -279,6 +279,7 @@ void pci_init_board(void) #ifdef CONFIG_USB_XHCI_IMX8 +#ifdef CONFIG_USB_TCPC #define USB_TYPEC_SEL IMX_GPIO_NR(4, 6) #define USB_TYPEC_EN IMX_GPIO_NR(4, 19) @@ -312,6 +313,7 @@ static void setup_typec(void) tcpc_init(&port, port_config, &ss_mux_select); } +#endif static struct cdns3_device cdns3_device_data = { .none_core_base = 0x5B110000, @@ -335,7 +337,9 @@ int board_usb_init(int index, enum usb_init_type init) if (index == 1) { if (init == USB_INIT_HOST) { +#ifdef CONFIG_USB_TCPC ret = tcpc_setup_dfp_mode(&port); +#endif } else { struct power_domain pd; int ret; @@ -353,8 +357,10 @@ int board_usb_init(int index, enum usb_init_type init) printf("conn_usb2_phy Power up failed! (error = %d)\n", ret); } +#ifdef CONFIG_USB_TCPC ret = tcpc_setup_ufp_mode(&port); printf("%d setufp mode %d\n", index, ret); +#endif ret = cdns3_uboot_init(&cdns3_device_data); printf("%d cdns3_uboot_initmode %d\n", index, ret); @@ -369,7 +375,9 @@ int board_usb_cleanup(int index, enum usb_init_type init) if (index == 1) { if (init == USB_INIT_HOST) { +#ifdef CONFIG_USB_TCPC ret = tcpc_disable_src_vbus(&port); +#endif } else { struct power_domain pd; int ret; @@ -414,7 +422,7 @@ int board_init(void) #endif #endif -#ifdef CONFIG_USB_XHCI_IMX8 +#if defined(CONFIG_USB_XHCI_IMX8) && defined(CONFIG_USB_TCPC) setup_typec(); #endif diff --git a/board/freescale/imx8qxp_mek/imx8qxp_mek.c b/board/freescale/imx8qxp_mek/imx8qxp_mek.c index aee5601d68..ffe2fa3974 100644 --- a/board/freescale/imx8qxp_mek/imx8qxp_mek.c +++ b/board/freescale/imx8qxp_mek/imx8qxp_mek.c @@ -413,6 +413,7 @@ void pci_init_board(void) #ifdef CONFIG_USB +#ifdef CONFIG_USB_TCPC #define USB_TYPEC_SEL IMX_GPIO_NR(5, 9) static iomux_cfg_t ss_mux_gpio[] = { SC_P_ENET0_REFCLK_125M_25M | MUX_MODE_ALT(4) | MUX_PAD_CTRL(GPIO_PAD_CTRL), @@ -458,6 +459,7 @@ static void setup_typec(void) tcpc_init(&port, port_config, &ss_mux_select); } +#endif static struct cdns3_device cdns3_device_data = { .none_core_base = 0x5B110000, @@ -481,7 +483,9 @@ int board_usb_init(int index, enum usb_init_type init) if (index == 1) { if (init == USB_INIT_HOST) { +#ifdef CONFIG_USB_TCPC ret = tcpc_setup_dfp_mode(&port); +#endif } else { struct power_domain pd; int ret; @@ -498,9 +502,10 @@ int board_usb_init(int index, enum usb_init_type init) if (ret) printf("conn_usb2_phy Power up failed! (error = %d)\n", ret); } - +#ifdef CONFIG_USB_TCPC ret = tcpc_setup_ufp_mode(&port); printf("%d setufp mode %d\n", index, ret); +#endif ret = cdns3_uboot_init(&cdns3_device_data); printf("%d cdns3_uboot_initmode %d\n", index, ret); @@ -517,7 +522,9 @@ int board_usb_cleanup(int index, enum usb_init_type init) if (index == 1) { if (init == USB_INIT_HOST) { +#ifdef CONFIG_USB_TCPC ret = tcpc_disable_src_vbus(&port); +#endif } else { struct power_domain pd; int ret; @@ -553,7 +560,7 @@ int board_init(void) setup_fec(CONFIG_FEC_ENET_DEV); #endif -#ifdef CONFIG_USB +#if defined(CONFIG_USB) && defined(CONFIG_USB_TCPC) setup_typec(); #endif |