Hi to All,
Sorry, for posting on this old thread but I am new here and do not know how to address other people's attention to help me.
I have just open a new thread about my problem to use USB OTG on A20-Olinuxino-Lime2-eMMC with mainline kernel 4.5.2.
Please, help me to solve my problem.
Chris
root@egpr:~# cat /boot/config-4.5.2-sunxi | grep CONFIG_USB_MUSB_HOST
# CONFIG_USB_MUSB_HOST is not set
        usb@01c13000 {
            compatible = "allwinner,sun4i-a10-musb";
            reg = <0x1c13000 0x400>;
            clocks = <0x3 0x0>;
            interrupts = <0x0 0x26 0x4>;
            interrupt-names = "mc";
            phys = <0x23 0x0>;
            phy-names = "usb";
            extcon = <0x23 0x0>;
            allwinner,sram = <0x24 0x1>;
            status = "okay";
            dr_mode = "host";
        };
        phy@01c13400 {
            #phy-cells = <0x1>;
            compatible = "allwinner,sun7i-a20-usb-phy";
            reg = <0x1c13400 0x10 0x1c14800 0x4 0x1c1c800 0x4>;
            reg-names = "phy_ctrl", "pmu1", "pmu2";
            clocks = <0x25 0x8>;
            clock-names = "usb_phy";
            resets = <0x25 0x0 0x25 0x1 0x25 0x2>;
            reset-names = "usb0_reset", "usb1_reset", "usb2_reset";
            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <0x26 0x27>;
            usb0_id_det-gpio = <0x1e 0x7 0x4 0x0>;
            usb0_vbus_det-gpio = <0x1e 0x7 0x5 0x0>;
            usb0_vbus-supply = <0x28>;
            usb1_vbus-supply = <0x29>;
            usb2_vbus-supply = <0x2a>;
            linux,phandle = <0x23>;
            phandle = <0x23>;
        };
        pinctrl@01c20800 {
...
            usb0_id_detect_pin@0 {
                allwinner,pins = "PH4";
                allwinner,function = "gpio_in";
                allwinner,drive = <0x0>;
                allwinner,pull = <0x1>;
                linux,phandle = <0x26>;
                phandle = <0x26>;
            };
            usb0_vbus_detect_pin@0 {
                allwinner,pins = "PH5";
                allwinner,function = "gpio_in";
                allwinner,drive = <0x0>;
                allwinner,pull = <0x2>;
                linux,phandle = <0x27>;
                phandle = <0x27>;
            };
        };
...
    usb0-vbus {
        compatible = "regulator-fixed";
        pinctrl-names = "default";
        pinctrl-0 = <0x3d>;
        regulator-name = "usb0-vbus";
        regulator-min-microvolt = <0x4c4b40>;
        regulator-max-microvolt = <0x4c4b40>;
        enable-active-high;
        gpio = <0x1e 0x2 0x11 0x0>;
        status = "okay";
        linux,phandle = <0x28>;
        phandle = <0x28>;
    };
usb0-vbus: disabling
" message is gone and usb0-vbus goes hi at boot.diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts
index d5c796c..d09cebe 100644
--- a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts
@@ -215,20 +215,6 @@
     allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
   };
Â
- Â Â usb0_id_detect_pin: usb0_id_detect_pin@0 {
- Â Â Â Â allwinner,pins = "PH4";
- Â Â Â Â allwinner,function = "gpio_in";
- Â Â Â Â allwinner,drive = <SUN4I_PINCTRL_10_MA>;
- Â Â Â Â allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
- Â Â };
-
- Â Â usb0_vbus_detect_pin: usb0_vbus_detect_pin@0 {
- Â Â Â Â allwinner,pins = "PH5";
- Â Â Â Â allwinner,function = "gpio_in";
- Â Â Â Â allwinner,drive = <SUN4I_PINCTRL_10_MA>;
- Â Â Â Â allwinner,pull = <SUN4I_PINCTRL_PULL_DOWN>;
- Â Â };
-
   usb0_vbus_pin_lime2: usb0_vbus_pin@0 {
     allwinner,pins = "PC17";
     allwinner,function = "gpio_out";
@@ -264,15 +250,11 @@
 };
Â
 &usb_otg {
- Â Â dr_mode = "otg";
+ Â Â dr_mode = "host";
   status = "okay";
 };
Â
 &usbphy {
- Â Â pinctrl-names = "default";
- Â Â pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
- Â Â usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
- Â Â usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
   usb0_vbus-supply = <®_usb0_vbus>;
   usb1_vbus-supply = <®_usb1_vbus>;
   usb2_vbus-supply = <®_usb2_vbus>;
[ Â Â 3.917976] usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ Â Â 3.918578] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ Â Â 3.918598] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 5
[ Â Â 3.918979] usb usb5: New USB device found, idVendor=1d6b, idProduct=0002
[ Â Â 3.918993] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ Â Â 3.919004] usb usb5: Product: MUSB HDRC host driver
[ Â Â 3.919013] usb usb5: Manufacturer: Linux 4.5.2-sunxi musb-hcd
[ Â Â 3.919022] usb usb5: SerialNumber: musb-hdrc.1.auto
[ 1356.542871] usb 5-1: new high-speed USB device number 2 using musb-hdrc
[ 1356.684880] usb 5-1: New USB device found, idVendor=090c, idProduct=1000
[ 1356.684917] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1356.684935] usb 5-1: Product: Flash Voyager
[ 1356.684952] usb 5-1: Manufacturer: Corsair
[ 1356.684968] usb 5-1: SerialNumber: AA00000000001460
[ 1356.686555] usb-storage 5-1:1.0: USB Mass Storage device detected
[ 1356.689189] scsi host1: usb-storage 5-1:1.0
[ 1356.755118] usbcore: registered new interface driver uas
[ 1356.684968] usb 5<span style="color: #660;" class="style
For some unclear reason sometimes we get VBus errors in host-only mode,
even though we do not have any vbus-detection then. Ignore these.
Signed-off-by: Hans de Goede <hdeg...@redhat.com>
---
 drivers/usb/musb/sunxi.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
index f9f6304..34ce5df 100644
--- a/drivers/usb/musb/sunxi.c
+++ b/drivers/usb/musb/sunxi.c
@@ -194,6 +194,10 @@ static irqreturn_t sunxi_musb_interrupt(int irq, void *__hci)
                 musb_writeb(musb->mregs, MUSB_FADDR, 0);
         }
Â
+Â Â Â Â Â Â Â Â /* Â Ignore Vbus errors when in host only mode */
+Â Â Â Â Â Â Â Â if (musb->port_mode == MUSB_PORT_MODE_HOST)
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â musb->int_usb &= ~MUSB_INTR_VBUSERROR;
+
         musb->int_tx = readw(musb->mregs + SUNXI_MUSB_INTRTX);
         if (musb->int_tx)
                 writew(musb->int_tx, musb->mregs + SUNXI_MUSB_INTRTX);
--
2.4.3