USB OTG on A20 Lime2 board does not work with mainline kernel

627 views
Skip to first unread message

Christo Radev

unread,
May 4, 2016, 5:44:25 AM5/4/16
to linux-sunxi

Hi to All,


I am trying to use USB OTG on A20-Olinuxino-Lime2-eMMC with own build of Armbian 5.11, U-Boot 2016.05--rec1, mainline kernel 4.5.2 and Debian Jessie without success. I have tested:

  • both 'host' and 'otg' types for dr_mode in device tree;
  • connect USB OTG to other board's USB Host;
  • attach USB mass storage and other devices;
  • attach other self powered devices;
  • try to load modules like extcon_gpio, extcon_usb_gpio, u_serial, u_ether;
  • rebuild kernel with CONFIG_USB_GPIO_VBUS=y and many others without any success.

I have verified the HW is working fine as 'host' and 'device' with latest Olimex image with Debian Jessie and kermel 3.4.103.

Some time ago I have also tested it to work with Armbian 5.07 and kernel 3.4.111 (with modified fex file).

I have also verify that device tree seams to be o.k. according to posts in this forum.


In the boot messages USB OTG is recognized by sunxi musb driver but usb0-vbus is finally disabled.

There are few confusing messages as well:


[    3.254996] reg-fixed-voltage usb0-vbus: could not find pctldev for node /soc@01c00000/pinctrl@01c20800 usb0_vbus_pin@0, deferring probe
[    3.255033] reg-fixed-voltage usb1-vbus: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/usb1_vbus_pin@0, deferring probe
[    3.255067] reg-fixed-voltage usb2-vbus: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/usb2_vbus_pin@0, deferring probe
[    3.257948] usbcore: registered new interface driver usbfs
[    3.258023] usbcore: registered new interface driver hub
[    3.258127] usbcore: registered new device driver usb
[    3.369469] sun4i-usb-phy 1c13400.phy: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/usb0_id_detect_pin@0, deferring probe


...


[    3.846532] usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    3.847087] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    3.847109] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 5
[    3.847554] usb usb5: New USB device found, idVendor=1d6b, idProduct=0002
[    3.847569] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    3.847579] usb usb5: Product: MUSB HDRC host driver
[    3.847588] usb usb5: Manufacturer: Linux 4.5.2-sunxi musb-hcd
[    3.847598] usb usb5: SerialNumber: musb-hdrc.1.auto
[    3.848439] hub 5-0:1.0: USB hub found
[    3.848513] hub 5-0:1.0: 1 port detected
[    3.877070] usb0-vbus: disabling


I have also verified usb0_id_det and usb0_vbus_det wotk fine as inputs (cat /sys/kernel/debug/gpio)

GPIOs 0-287, platform/1c20800.pinctrl, 1c20800.pinctrl:
 gpio
-50  (                    |sysfs               ) in  hi
 gpio
-67  (                    |ahci-5v             ) out hi
 gpio
-81  (                    |usb0-vbus           ) out lo
 gpio
-87  (                    |sysfs               ) out lo
 gpio
-88  (                    |sysfs               ) out hi
 gpio
-225 (                    |cd                  ) in  hi IRQ
 gpio
-226 (                    |?                   ) out hi
 gpio
-227 (                    |usb2-vbus           ) out hi
 gpio
-228 (                    |usb0_id_det         ) in  hi IRQ
 gpio
-229 (                    |usb0_vbus_det       ) in  lo IRQ
 gpio
-230 (                    |usb1-vbus           ) out hi
but usb0-vbus is always low and the USB OTG behaves like a dead.

The only reaction was when USB OTG with dr_mode = 'host' was connected (by error) to other board USB Host.

In this situation USB OTG enumeration try was registered at both sides but finished with error (probably because of support lack).


Please, help me to find a solution.


Best regards

Chris


Code Kipper

unread,
May 4, 2016, 6:48:40 AM5/4/16
to christ...@gmail.com, linux-sunxi
On 4 May 2016 at 11:44, Christo Radev <christ...@gmail.com> wrote:
> Hi to All,
>
>
> I am trying to use USB OTG on A20-Olinuxino-Lime2-eMMC with own build of
> Armbian 5.11, U-Boot 2016.05--rec1, mainline kernel 4.5.2 and Debian Jessie
> without success. I have tested:

I don't think Wens changes for OTG is in 4.5.2.
The following should be in arch/arm/configs/sunxi_defconfig

CONFIG_USB_MUSB_HDRC=y
CONFIG_USB_MUSB_SUNXI=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_GADGET=y

They're in linux-next,

CK
> --
> You received this message because you are subscribed to the Google Groups
> "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to linux-sunxi...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Christo Radev

unread,
May 4, 2016, 7:20:26 AM5/4/16
to linux-sunxi, christ...@gmail.com
Thanks CodeKipper,

Yes, all the are ok:
root@egpr:~# cat /boot/config-4.5.2-sunxi | grep CONFIG_USB_MUSB_HDRC
CONFIG_USB_MUSB_HDRC
=y
root@egpr
:~# cat /boot/config-4.5.2-sunxi | grep CONFIG_USB_MUSB_SUNXI
CONFIG_USB_MUSB_SUNXI
=y
root@egpr
:~# CONFIG_NOP_USB_XCEIV^C
root@egpr
:~# cat /boot/config-4.5.2-sunxi | grep CONFIG_NOP_USB_XCEIV
CONFIG_NOP_USB_XCEIV
=y
root@egpr
:~# cat /boot/config-4.5.2-sunxi | grep CONFIG_USB_GADGET
CONFIG_USB_GADGET
=y
# CONFIG_USB_GADGET_DEBUG is not set
# CONFIG_USB_GADGET_DEBUG_FILES is not set
# CONFIG_USB_GADGET_DEBUG_FS is not set
CONFIG_USB_GADGET_VBUS_DRAW
=200
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS
=2
# CONFIG_USB_GADGET_XILINX is not set
CONFIG_USB_GADGETFS
=m
# CONFIG_USB_GADGET_TARGET is not set
In Armbian build scripts is used linux-sunxi-next.config as kernel config and the only change done by me in testing process is to add.
CONFIG_USB_GPIO_VBUS=y
which was not set by default but did not help.

Best regards
Chris

Christo Radev

unread,
May 4, 2016, 10:24:32 AM5/4/16
to linux-sunxi, christ...@gmail.com
Hi to All,

Following Michal Suchanek's post and applying Maxime Ripard's advice USB OTG started working in host only mode.

Unfortunately, it solves the problem in a half so any ideas are welcome.


Best regards
Chris

On Wednesday, May 4, 2016 at 1:48:40 PM UTC+3, CodeKipper wrote:

ddis...@gmail.com

unread,
May 4, 2016, 12:07:05 PM5/4/16
to linux-sunxi, christ...@gmail.com
On Wednesday, May 4, 2016 at 4:24:32 PM UTC+2, Christo Radev wrote:
> Hi to All,
>
> Following Michal Suchanek's post and applying Maxime Ripard's advice USB OTG started working in host only mode.
>
> Unfortunately, it solves the problem in a half so any ideas are welcome.

A different A20 board (cubietruck), but might still be useful...
USB OTG device mode worked fine with a vanilla 4.4.0-rc4 kernel
for a recent project:
(http://blog.elastocloud.org/2015/12/ceph-usb-storage-gateway.html).

The kernel config that I used can be found at:
https://raw.githubusercontent.com/ddiss/ceph_usb_gateway/master/.config

Cheers, David

Christo Radev

unread,
May 4, 2016, 12:20:34 PM5/4/16
to linux-sunxi, christ...@gmail.com, ddis...@gmail.com
Thanks David,

I take a brief look on your .config file and do not see any important differences around USB OTG.

In my opinion the problem most probably comes from device tree configuration or some recent changes in the driver (I use kernel 4.5.2).

Could you send me yor dtb file used at boot time together with the kernel?
You can find it as /boot/dtb/sun7i-a20-cubietruck.dtb on the board's rootfs.

Best regards
Chris

David Disseldorp

unread,
May 6, 2016, 5:15:21 AM5/6/16
to Christo Radev, linux-sunxi
On Wed, May 4, 2016 at 6:20 PM, Christo Radev <christ...@gmail.com> wrote:
...
> In my opinion the problem most probably comes from device tree configuration
> or some recent changes in the driver (I use kernel 4.5.2).
>
> Could you send me yor dtb file used at boot time together with the kernel?
> You can find it as /boot/dtb/sun7i-a20-cubietruck.dtb on the board's rootfs.

I used a vanilla sun7i-a20-cubietruck.dts:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
I don't have the dtb any more.

Cheers, David

Christo Radev

unread,
Jul 12, 2016, 3:49:55 AM7/12/16
to linux-sunxi, christ...@gmail.com
Hi to All,

Some time after making USB OTG to work in 'host' mode I have observed that from time to time the port stops working.
I use it to connect STM-H405 board powered from USB OTG with ChibiOS based FW and USB CDC.
Everything works fine but very rarely without identified reason USB OTG get disconnected.

After such disconnection only Linux reboot makes it to start working again.

This behavior is observer at all Linux kernel versions till last used 4.6.3.

Can somebody help me to idevtify and / or solve the problem?

Best regards
Chris
Reply all
Reply to author
Forward
0 new messages