
Hi Marcel,
Just found out that to be able to use usbotg1 also in host mode this change should be introduced: --- a/arch/arm/dts/imx6ull-colibri.dts +++ b/arch/arm/dts/imx6ull-colibri.dts @@ -220,7 +220,7 @@
/* Colibri USBC */ &usbotg1 { - dr_mode = "otg"; + dr_mode = "host"; srp-disable; hnp-disable; adp-disable;
Without (tested with USB pendrive): Colibri iMX6ULL # usb start starting USB... USB0: USB1: USB EHCI 1.00 scanning bus 0 for devices... 1 USB Device(s) found scanning bus 1 for devices... 2 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found
With (tested with USB pendrive): Colibri iMX6ULL # usb start starting USB... USB0: USB EHCI 1.00 USB1: USB EHCI 1.00 scanning bus 0 for devices... 2 USB Device(s) found scanning bus 1 for devices... 2 USB Device(s) found scanning usb for storage devices... 1 Storage Device(s) found
On Tue, Apr 9, 2019 at 5:31 PM Marcel Ziswiler marcel@ziswiler.com wrote:
From: Marcel Ziswiler marcel.ziswiler@toradex.com
Migrate USB to using driver model. Add USBH_PEN GPIO regulator. While at it also add alias e.g. as required for UMS.
Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com
Changes in v2:
- Added Igor's reviewed-by.
arch/arm/dts/imx6ull-colibri.dts | 24 ++++++++++ .../toradex/colibri-imx6ull/colibri-imx6ull.c | 48 ------------------- configs/colibri-imx6ull_defconfig | 1 + 3 files changed, 25 insertions(+), 48 deletions(-)
diff --git a/arch/arm/dts/imx6ull-colibri.dts b/arch/arm/dts/imx6ull-colibri.dts index 0d416ebd10..91e48aab61 100644 --- a/arch/arm/dts/imx6ull-colibri.dts +++ b/arch/arm/dts/imx6ull-colibri.dts @@ -13,6 +13,7 @@
aliases { mmc0 = &usdhc1;
usb0 = &usbotg1; /* required for ums */ }; chosen {
@@ -35,6 +36,13 @@ regulator-max-microvolt = <3300000>; };
reg_5v0: regulator-5v0 {
compatible = "regulator-fixed";
regulator-name = "5V";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
};
reg_sd1_vmmc: regulator-sd1-vmmc { compatible = "regulator-gpio"; gpio = <&gpio5 9 GPIO_ACTIVE_HIGH>;
@@ -47,6 +55,17 @@ states = <1800000 0x1 3300000 0x0>; vin-supply = <®_module_3v3>; };
reg_usbh_vbus: regulator-usbh-vbus {
compatible = "regulator-fixed";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usbh_reg>;
regulator-name = "VCC_USB[1-4]";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&gpio1 2 GPIO_ACTIVE_LOW>; /* USBH_PEN */
vin-supply = <®_5v0>;
};
};
&adc1 { @@ -183,15 +202,20 @@ fsl,dte-mode; };
+/* Colibri USBC */ &usbotg1 { dr_mode = "otg"; srp-disable; hnp-disable; adp-disable;
status = "okay";
};
+/* Colibri USBH */ &usbotg2 { dr_mode = "host";
vbus-supply = <®_usbh_vbus>;
status = "okay";
};
/* Colibri MMC */ diff --git a/board/toradex/colibri-imx6ull/colibri-imx6ull.c b/board/toradex/colibri-imx6ull/colibri-imx6ull.c index c9af44e30e..21addaf6ed 100644 --- a/board/toradex/colibri-imx6ull/colibri-imx6ull.c +++ b/board/toradex/colibri-imx6ull/colibri-imx6ull.c @@ -24,8 +24,6 @@ #include <miiphy.h> #include <mtd_node.h> #include <netdev.h> -#include <usb.h> -#include <usb/ehci-ci.h>
#include "../common/tdx-common.h" #include "../common/tdx-cfg-block.h" @@ -41,8 +39,6 @@ DECLARE_GLOBAL_DATA_PTR;
#define NAND_PAD_READY0_CTRL (PAD_CTL_DSE_48ohm | PAD_CTL_PUS_22K_UP)
-#define USB_CDET_GPIO IMX_GPIO_NR(7, 14)
int dram_init(void) { gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE); @@ -50,10 +46,6 @@ int dram_init(void) return 0; }
-static iomux_v3_cfg_t const usb_cdet_pads[] = {
MX6_PAD_SNVS_TAMPER2__GPIO5_IO02 | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
#ifdef CONFIG_NAND_MXS static void setup_gpmi_nand(void) { @@ -163,11 +155,6 @@ int board_init(void) setup_lcd(); #endif
-#ifdef CONFIG_USB_EHCI_MX6
imx_iomux_v3_setup_multiple_pads(usb_cdet_pads, ARRAY_SIZE(usb_cdet_pads));
gpio_request(USB_CDET_GPIO, "usb-cdet-gpio");
-#endif
return 0;
}
@@ -241,41 +228,6 @@ int ft_board_setup(void *blob, bd_t *bd) } #endif
-#ifdef CONFIG_USB_EHCI_MX6 -static iomux_v3_cfg_t const usb_otg2_pads[] = {
MX6_PAD_GPIO1_IO02__GPIO1_IO02 | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-int board_ehci_hcd_init(int port) -{
switch (port) {
case 0:
break;
case 1:
imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
ARRAY_SIZE(usb_otg2_pads));
break;
default:
return -EINVAL;
}
return 0;
-}
-int board_usb_phy_mode(int port) -{
switch (port) {
case 0:
if (gpio_get_value(USB_CDET_GPIO))
return USB_INIT_DEVICE;
else
return USB_INIT_HOST;
case 1:
default:
return USB_INIT_HOST;
}
-} -#endif
static struct mxc_serial_platdata mxc_serial_plat = { .reg = (struct mxc_uart *)UART1_BASE, .use_dte = 1, diff --git a/configs/colibri-imx6ull_defconfig b/configs/colibri-imx6ull_defconfig index 69305323f2..0440b4ed94 100644 --- a/configs/colibri-imx6ull_defconfig +++ b/configs/colibri-imx6ull_defconfig @@ -71,6 +71,7 @@ CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_SERIAL=y CONFIG_MXC_UART=y CONFIG_USB=y +CONFIG_DM_USB=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="Toradex" CONFIG_USB_GADGET_VENDOR_NUM=0x1b67 -- 2.20.1
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot