From 4a803df96dbdcbee38d2cdccf3da0654f5587327 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Wed, 20 Mar 2019 11:03:20 +0100 Subject: colibri-imx8qxp: fix usb device/host functionality Fix USB device aka UMS as well as USB host functionality. Signed-off-by: Marcel Ziswiler --- arch/arm/dts/fsl-imx8qxp-colibri.dts | 33 ++++++++++++++++++++----- board/toradex/colibri-imx8qxp/colibri-imx8qxp.c | 24 ++++++++++++++++++ 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/arch/arm/dts/fsl-imx8qxp-colibri.dts b/arch/arm/dts/fsl-imx8qxp-colibri.dts index fac93cce4d..0d331f7f1d 100644 --- a/arch/arm/dts/fsl-imx8qxp-colibri.dts +++ b/arch/arm/dts/fsl-imx8qxp-colibri.dts @@ -25,13 +25,14 @@ #address-cells = <1>; #size-cells = <0>; - reg_usb_otg1_vbus: regulator@0 { + reg_usbh_vbus: regulator-usbh-vbus { compatible = "regulator-fixed"; - reg = <0>; - regulator-name = "usb_otg1_vbus"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usbh1_reg>; + regulator-name = "usbh_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - enable-active-high; + gpio = <&gpio4 3 GPIO_ACTIVE_LOW>; }; }; @@ -146,6 +147,25 @@ >; }; + /*INT*/ + pinctrl_usb3503a: usb3503a-grp { + fsl,pins = < + SC_P_MIPI_CSI0_MCLK_OUT_LSIO_GPIO3_IO04 0x00000061 + >; + }; + + pinctrl_usbc_det: usbc-det { + fsl,pins = < + SC_P_ENET0_REFCLK_125M_25M_LSIO_GPIO5_IO09 0x06000040 + >; + }; + + pinctrl_usbh1_reg: usbh1-reg { + fsl,pins = < + SC_P_USB_SS3_TC0_LSIO_GPIO4_IO03 0x06000040 + >; + }; + pinctrl_usdhc1: usdhc1grp { fsl,pins = < SC_P_EMMC0_CLK_CONN_EMMC0_CLK 0x06000041 @@ -350,15 +370,16 @@ }; &usbotg1 { - vbus-supply = <®_usb_otg1_vbus>; srp-disable; hnp-disable; adp-disable; - power-polarity-active-high; disable-over-current; + dr_mode = "peripheral"; status = "okay"; }; &usb2 { + dr_mode = "host"; status = "okay"; + vbus-supply = <®_usbh_vbus>; }; diff --git a/board/toradex/colibri-imx8qxp/colibri-imx8qxp.c b/board/toradex/colibri-imx8qxp/colibri-imx8qxp.c index f3b8ced8a3..e476f408c9 100644 --- a/board/toradex/colibri-imx8qxp/colibri-imx8qxp.c +++ b/board/toradex/colibri-imx8qxp/colibri-imx8qxp.c @@ -360,6 +360,30 @@ int checkboard(void) return 0; } +/* Only Enable USB3 resources currently */ +int board_usb_init(int index, enum usb_init_type init) +{ +#ifndef CONFIG_DM_USB + struct power_domain pd; + int ret; + + /* Power on usb */ + if (!power_domain_lookup_name("conn_usb2", &pd)) { + ret = power_domain_on(&pd); + if (ret) + printf("conn_usb2 Power up failed! (error = %d)\n", ret); + } + + if (!power_domain_lookup_name("conn_usb2_phy", &pd)) { + ret = power_domain_on(&pd); + if (ret) + printf("conn_usb2_phy Power up failed! (error = %d)\n", ret); + } +#endif + + return 0; +} + int board_init(void) { #ifdef CONFIG_MXC_GPIO -- cgit v1.2.3