AnsweredAssumed Answered

[iMX27] USB with 4.1 kernel stops working after boot time (from kernel.org and fslc github)

Question asked by Miquèl Raynal on Dec 17, 2015
Latest reply on Feb 2, 2016 by Alexandre Schnegg

Hi,

Before describing the issue I am working on, please note that my knowledge of the USB stack is not very strong so do not hesitate to point me out good articles about it.

 

The goal: I am working on enabling USB on an iMX27 with the following hardware configuration. I tried with Kernel 4.1.5 from kernel.org and also with 4.1.13 from Freescale Github with same results.

  • Used ports: OTG and Host 2
  • Interface: ULPI
  • PHY: ISP1504 or USB3340

The kernel configuration and the device tree are below.

Please note that USB works well with an old 2.6.32.x kernel.

 

For the moment, I had to hack the ci_hdrc_imx.c file in order to use the "otg_ulpi_create" function from drivers/usb/phy/phy-ulpi.c and access the ULPI viewport. Then I added a call to "ulpi_set_vbus" function (with the DRVVBUSEXT flag) so both ports are now well powered.

 

The observations:

At boot, the root hubs are enumerated, as well as any USB device plugged in. The devices are binded to the matching driver ("hub" for the root hubs, "usbhid" for the mouse, "usb-storage" for the pen drive). This is seen from lsusb as well as /sys/kernel/debug/usb/devices virtual file. But then, there is nothing "coming from" the devices, nothing happens. I can even unplug the USB devices, the kernel is not aware of that and the list of plugged devices do not evolves. Nothing is detected if I plug a new device after boot neither.

 

The relevant lines of the dmesg are below too.

 

Any idea of what could happen/miss ? What kind of investigation should I try ?

 

Thank you for helping and do not hesitate to ask me to clarify if needed.

 

 

DEFCONFIG

--> Device Drivers

--> USB support

Support for Host-side USB

USB announce new devices

Enables USB persist by default

OTG support

USB 2.0 OTG FSM implementation

USB monitor

EHCI HCD support

Root Hub transaction translators

Improved transaction translators

Support for Freescale i.MX on-chip EHCI USB controller

***

USB mass storage support

USB Attached SCSI

***

ChipIdea Highspeed Dual Role Controller

ChipIdea host controller

ChipIdea driver debug

***

USB LD driver

USB Physical Layer drivers

NOP USB transceiver driver

Generic ULPI Transceiver driver

USB Gadget support

 

DEVICE TREE

/ {

[...]

        regulators {

                compatible = "simple-bus";

                #address-cells = <1>;

                #size-cells = <0>;

 

                reg_5v0: regulator@2 {

                        compatible = "regulator-fixed";

                        reg = <2>;

                        regulator-name = "5V0";

                        regulator-min-microvolt = <5000000>;

                        regulator-max-microvolt = <5000000>;

                        //regulator-always-on;

                        //regulator-enable-ramp-delay;

                };

        };

 

        usbphy {

                compatible = "simple-bus";

                #address-cells = <1>;

                #size-cells = <0>;

 

               usbphy0: usbphy@0 {

                        compatible = "usb-nop-xceiv";

                        reg = <0>;

                        vcc-supply = <&reg_5v0>;

                        clocks = <&clks IMX27_CLK_DUMMY>;

                        clock-names = "main_clk";

                        vbus-regulator = <&reg_5v0>;

                };

 

                usbphy1: usbphy@1 {

                        compatible = "usb-nop-xceiv";

                        reg = <1>;

                        vcc-supply = <&reg_5v0>;

                        clocks = <&clks IMX27_CLK_DUMMY>;

                        clock-names = "main_clk";

                        vbus-regulator = <&reg_5v0>;

                };

        };

};

 

&usbh2 {

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_usbh2>;

        dr_mode = "host";

        phy_type = "ulpi";

        disable-over-current;

        fsl,usbphy = <&usbphy0>;

        vbus-supply = <&reg_5v0>;

        status = "okay";

};

 

&usbotg {

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_usbotg>;

        dr_mode = "otg";

        phy_type = "ulpi";

        disable-over-current;

        fsl,usbphy = <&usbphy1>;

        vbus-supply = <&reg_5v0>;

        maximum-speed = "low-speed";

        status = "okay";

};

 

[...]

 

&iomuxc {

[...]

                pinctrl_usbh2: usbh2grp {

                        fsl,pins = <

                                MX27_PAD_USBH2_CLK__USBH2_CLK           0x0

                                MX27_PAD_USBH2_DIR__USBH2_DIR           0x0

                                MX27_PAD_USBH2_NXT__USBH2_NXT           0x0

                                MX27_PAD_USBH2_STP__USBH2_STP           0x0

                                MX27_PAD_CSPI2_SCLK__USBH2_DATA0        0x0

                                MX27_PAD_CSPI2_MOSI__USBH2_DATA1        0x0

                                MX27_PAD_CSPI2_MISO__USBH2_DATA2        0x0

                                MX27_PAD_CSPI2_SS1__USBH2_DATA3         0x0

                                MX27_PAD_CSPI2_SS2__USBH2_DATA4         0x0

                                MX27_PAD_CSPI1_SS2__USBH2_DATA5         0x0

                                MX27_PAD_CSPI2_SS0__USBH2_DATA6         0x0

                                MX27_PAD_USBH2_DATA7__USBH2_DATA7       0x0

                        >;

                };

 

                pinctrl_usbotg: usbotggrp {

                        fsl,pins = <

                                MX27_PAD_USBOTG_CLK__USBOTG_CLK         0x0

                                MX27_PAD_USBOTG_DIR__USBOTG_DIR         0x0

                                MX27_PAD_USBOTG_NXT__USBOTG_NXT         0x0

                                MX27_PAD_USBOTG_STP__USBOTG_STP         0x0

                                MX27_PAD_USBOTG_DATA0__USBOTG_DATA0     0x0

                                MX27_PAD_USBOTG_DATA1__USBOTG_DATA1     0x0

                                MX27_PAD_USBOTG_DATA2__USBOTG_DATA2     0x0

                                MX27_PAD_USBOTG_DATA3__USBOTG_DATA3     0x0

                                MX27_PAD_USBOTG_DATA4__USBOTG_DATA4     0x0

                                MX27_PAD_USBOTG_DATA5__USBOTG_DATA5     0x0

                                MX27_PAD_USBOTG_DATA6__USBOTG_DATA6     0x0

                                MX27_PAD_USBOTG_DATA7__USBOTG_DATA7     0x0

                        >;

                };

[...]

};

 

DMESG (with a mouse plugged)

[    5.559445] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver

[    5.566680] ehci-pci: EHCI PCI platform driver

[    5.575045] ehci-mxc: Freescale On-Chip EHCI Host driver

[    5.586372] usbcore: registered new interface driver uas

[    5.593066] usbcore: registered new interface driver usb-storage

[    5.600061] usbcore: registered new interface driver ldusb

[    5.606670] usbcore: registered new interface driver usbtest

[    5.613307] usbcore: registered new interface driver lvs

[    5.628205] ci_hdrc ci_hdrc.0: ChipIdea HDRC found, revision: 10, lpm: 0; cap: f4424100 op: f4424140

[    5.638034] ci_hdrc ci_hdrc.0: It is OTG capable controller

[    5.647222] ci_hdrc ci_hdrc.0: doesn't support gadget

[    5.657084] ci_hdrc ci_hdrc.0: EHCI Host Controller

[    5.663035] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1

[    5.695765] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00

[    5.701766] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002

[    5.708807] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1

[    5.716242] usb usb1: Product: EHCI Host Controller

[    5.721174] usb usb1: Manufacturer: Linux 4.1.5-nvp-00017-ge121ba5-dirty ehci_hcd

[    5.728788] usb usb1: SerialNumber: ci_hdrc.0

[    5.739998] hub 1-0:1.0: USB hub found

[    5.744161] hub 1-0:1.0: 1 port detected

[    5.776375] ULPI transceiver vendor/product ID 0x0424/0x0009

[    5.782074] Found SMSC USB334x ULPI transceiver.

[    5.786897] ULPI integrity check: passed.

[    5.790976] ULPI ulpi_set_vbus

[    5.818923] ci_hdrc ci_hdrc.1: ChipIdea HDRC found, revision: 10, lpm: 0; cap: f4424500 op: f4424540

[    5.836690] ci_hdrc ci_hdrc.1: EHCI Host Controller

[    5.842644] ci_hdrc ci_hdrc.1: new USB bus registered, assigned bus number 2

[    5.875769] ci_hdrc ci_hdrc.1: USB 2.0 started, EHCI 1.00

[    5.881800] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002

[    5.888838] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1

[    5.896274] usb usb2: Product: EHCI Host Controller

[    5.901209] usb usb2: Manufacturer: Linux 4.1.5-nvp-00017-ge121ba5-dirty ehci_hcd

[    5.908821] usb usb2: SerialNumber: ci_hdrc.1

[    5.920076] hub 2-0:1.0: USB hub found

[    5.924244] hub 2-0:1.0: 1 port detected

[    5.951158] ULPI transceiver vendor/product ID 0x0424/0x0009

[    5.957023] Found SMSC USB334x ULPI transceiver.

[    5.961699] ULPI integrity check: passed.

[    5.965935] ULPI ulpi_set_vbus on/off

[    6.097409] usbcore: registered new interface driver usbhid

[    6.103029] usbhid: USB HID core driver

[    7.225701] usb 1-1: new low-speed USB device number 2 using ci_hdrc

[    7.421435] usb 1-1: New USB device found, idVendor=1c4f, idProduct=0003

[    7.428700] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0

[    7.441492] usb 1-1: Product: Usb Mouse

[    7.445380] usb 1-1: Manufacturer: SIGMACHIP

[    7.504425] input: SIGMACHIP Usb Mouse as /devices/platform/soc/10020000.aipi/10024000.usb/ci_hdrc.0/usb1/1-1/1-1:1.0/0003:1C4F:0000

[    7.523995] hid-generic 0003:1C4F:0003.0001: input: USB HID v1.10 Mouse [SIGMACHIP Usb Mouse] on usb-ci_hdrc.0-1/input0

 

 

Edit: Backtrace when accessing an USB key

 

When my Intenso USB key is plugged at boot time, it is recognized (see following logs) bug when I want to mount it I get an error:

 

[...DMESG...]

[    6.226754] usb 2-1: new high-speed USB device number 2 using ci_hdrc

[    6.417956] usb 2-1: New USB device found, idVendor=1f75, idProduct=0817

[    6.424721] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3

[    6.437610] usb 2-1: Product: Intenso Rainbow Line

[    6.442931] usb 2-1: Manufacturer: is817

[    6.447529] usb 2-1: SerialNumber: 201404301057

[    6.478698] usb-storage 2-1:1.0: USB Mass Storage device detected

[    6.494697] scsi host0: usb-storage 2-1:1.0

[    7.524911] scsi 0:0:0:0: Direct-Access     Intenso  Rainbow Line     1.00 PQ: 0 ANSI: 6

[    7.572095] sd 0:0:0:0: [sda] 7905280 512-byte logical blocks: (4.04 GB/3.76 GiB)

[    7.594994] sd 0:0:0:0: Attached scsi generic sg0 type 0

[    7.611986] sd 0:0:0:0: [sda] Write Protect is off

[    7.630293] sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00

[    7.651152] sd 0:0:0:0: [sda] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA

[    7.740637]  sda: sda1

[    7.799752] sd 0:0:0:0: [sda] Attached SCSI removable disk

[...INIT...]

mkdir: can't create directory '/run/media/sda1': No such file or directory

mount: mounting /dev/sda1 on /run/media/sda1 failed: No such file or directory

 

root@th7:~# lsusb

Bus 002 Device 002: ID 1f75:0817

Bus 001 Device 001: ID 1d6b:0002

Bus 002 Device 001: ID 1d6b:0002

root@th7:~# ls -l  /dev/sda*

brw-r-----    1 root     disk        8,   0 Dec 21 17:16 /dev/sda

brw-rw----    1 root     root        8,   1 Dec 21 17:16 /dev/sda1

root@th7:~# mount -t vfat /dev/sda1 /mnt/key/

[  135.572985] Unhandled fault: external abort on non-linefetch (0x008) at 0xf4424544

[  135.580611] pgd = c0004000

[  135.583345] [f4424544] *pgd=10000452(bad)

[  135.587419] Internal error: : 8 [#1] PREEMPT ARM

[  135.592060] Modules linked in:

[  135.595170] CPU: 0 PID: 493 Comm: usb-storage Not tainted 4.1.5-nvp-00017-ge121ba5-dirty #740

[  135.603717] Hardware name: NVP Th7 system based on Freescale i.MX27L

[  135.610793] task: c7987460 ti: c7bd6000 task.ti: c7bd6000

[  135.616243] PC is at ehci_poll_ASS+0x30/0xc8

[  135.620550] LR is at qh_link_async+0xac/0xd0

[  135.624851] pc : [<c02f5848>]    lr : [<c02f598c>]    psr: 60000093

[  135.624851] sp : c7bd7c48  ip : 00000000  fp : c7bd7c54

[  135.636356] r10: 00000002  r9 : a0000013  r8 : c7971be0

[  135.641604] r7 : 00000000  r6 : c798a540  r5 : a78b80c2  r4 : c7971be0

[  135.648155] r3 : c798a540  r2 : 00010005  r1 : f4424540  r0 : c798a540

[  135.654707] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel

[  135.662127] Control: 0005317f  Table: a71f0000  DAC: 00000017

[  135.667898] Process usb-storage (pid: 493, stack limit = 0xc7bd6190)

[  135.674275] Stack: (0xc7bd7c48 to 0xc7bd8000)

[  135.678672] 7c40:                   c7bd7c74 c7bd7c58 c02f598c c02f5828 00000003 c7abf900

[  135.686894] 7c60: c798a400 c7bd7ca0 c7bd7cdc c7bd7c78 c02f9d70 c02f58f0 c79bfef8 00000001

[  135.695114] 7c80: c7987490 c7bd7e3c c7bd7cbc c7bd7c98 c003c4b0 c003b8cc 00000010 c798a540

[  135.703332] 7ca0: c892d1b8 c892d1b8 00000002 c056e288 ffffffff c7abf900 c798a400 00000000

[  135.711553] 7cc0: 00000010 c79d1c00 00000003 c7bd6000 c7bd7d8c c7bd7ce0 c02daaf8 c02f9c8c

[  135.719771] 7ce0: c7bd7d14 c7bd7cf0 c03ee948 c0036d1c c7bd7d18 c7bd6000 00000001 00000001

[  135.727989] 7d00: 00000001 c7bd7ddc c7bd7d2c c7bd7d18 c03eec64 c03ee780 00000000 7fffffff

[  135.736208] 7d20: c7bd7d7c c7bd7d30 c03f1844 c03eec30 c7bd6000 00000002 00000000 00000000

[  135.744426] 7d40: c7bc5c50 00000000 c7bd7d9c c7bd7d58 00000201 c7abf580 c7bd6000 00000001

[  135.752645] 7d60: 00000001 c7abf900 00000010 00000002 00000004 c79d1c00 00000003 c7bd6000

[  135.760864] 7d80: c7bd7dd4 c7bd7d90 c02dc730 c02daa48 00002893 00000000 c7987490 00000000

[  135.769083] 7da0: c7bd7dcc 00000001 c054baf0 c7bc5bb0 00000000 c7bd7ddc 00000000 00000000

[  135.777303] 7dc0: 0000001f c7bd6000 c7bd7e04 c7bd7dd8 c02fe6a8 c02dc464 ffffffff 00000000

[  135.785523] 7de0: c7bd7de0 c7bd7de0 c7bc5bb0 0000001f c0010200 00000000 c7bd7e2c c7bd7e08

[  135.793742] 7e00: c02feb10 c02fe634 ffffffff c78233c0 c89b2000 c7bc5bb0 c7bcfe20 c89b200f

[  135.801961] 7e20: c7bd7e64 c7bd7e30 c02fed80 c02fead4 00000000 00000001 00000001 c7bc5c68

[  135.810180] 7e40: c7bc5bb0 c7bcfe20 c7bc5c68 c054c9d0 00000000 00000000 c7bd7efc c7bd7e68

[  135.818399] 7e60: c02ff5f4 c02fecc0 c7bd7e9c c7bd7e78 c0037ff8 c0036c88 c7bd7eac c7bd7e88

[  135.826617] 7e80: c003377c c78233c0 00000000 c7bc5c68 c7bd6000 00000001 00000001 00000001

[  135.834837] 7ea0: c7bc5c68 00000000 c7bd7efc c7bd7eb8 c03ef67c c03f16d0 c7bd7ed4 c7bd7ec8

[  135.843056] 7ec0: c001c498 00000001 c7987460 c0038150 00100100 c7bc5bb0 00000000 c7bc5c68

[  135.851276] 7ee0: c054c9d0 00000000 00000000 c7bd6000 c7bd7f0c c7bd7f00 c02fe3b0 c02ff5dc

[  135.859496] 7f00: c7bd7f64 c7bd7f10 c0300b4c c02fe3b0 00000000 00000000 c7bd7f4c c7bd7f28

[  135.867715] 7f20: c03ee854 c003b938 c7bd7f50 c7bd6000 00000000 c7bc5bb0 c0300970 c79be840

[  135.875933] 7f40: 00000000 c7bc5bb0 c0300970 00000000 00000000 00000000 c7bd7fac c7bd7f68

[  135.884153] 7f60: c0032834 c0300980 c7bd7f94 00000000 c0036e40 c7bc5bb0 00000000 c7bd7f7c

[  135.892373] 7f80: c7bd7f7c 00000000 c7bd7f88 c7bd7f88 c79be840 c003276c 00000000 00000000

[  135.900592] 7fa0: 00000000 c7bd7fb0 c000a480 c003277c 00000000 00000000 00000000 00000000

[  135.908808] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

[  135.917025] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000

[  135.925218] Backtrace:

[  135.927738] [<c02f5818>] (ehci_poll_ASS) from [<c02f598c>] (qh_link_async+0xac/0xd0)

[  135.935538] [<c02f58e0>] (qh_link_async) from [<c02f9d70>] (ehci_urb_enqueue+0xf4/0xfe0)

[  135.943651]  r6:c7bd7ca0 r5:c798a400 r4:c7abf900 r3:00000003

[  135.949428] [<c02f9c7c>] (ehci_urb_enqueue) from [<c02daaf8>] (usb_hcd_submit_urb+0xc0/0x958)

[  135.957974]  r10:c7bd6000 r9:00000003 r8:c79d1c00 r7:00000010 r6:00000000 r5:c798a400

[  135.965913]  r4:c7abf900

[  135.968499] [<c02daa38>] (usb_hcd_submit_urb) from [<c02dc730>] (usb_submit_urb+0x2dc/0x4e4)

[  135.976957]  r10:c7bd6000 r9:00000003 r8:c79d1c00 r7:00000004 r6:00000002 r5:00000010

[  135.984894]  r4:c7abf900

[  135.987477] [<c02dc454>] (usb_submit_urb) from [<c02fe6a8>] (usb_stor_msg_common+0x84/0x148)

[  135.995935]  r10:c7bd6000 r9:0000001f r8:00000000 r7:00000000 r6:c7bd7ddc r5:00000000

[  136.003873]  r4:c7bc5bb0

[  136.006456] [<c02fe624>] (usb_stor_msg_common) from [<c02feb10>] (usb_stor_bulk_transfer_buf+0x4c/0x88)

[  136.015869]  r7:00000000 r6:c0010200 r5:0000001f r4:c7bc5bb0

[  136.021637] [<c02feac4>] (usb_stor_bulk_transfer_buf) from [<c02fed80>] (usb_stor_Bulk_transport+0xd0/0x358)

[  136.031486]  r7:c89b200f r6:c7bcfe20 r5:c7bc5bb0 r4:c89b2000

[  136.037256] [<c02fecb0>] (usb_stor_Bulk_transport) from [<c02ff5f4>] (usb_stor_invoke_transport+0x28/0x578)

[  136.047017]  r9:00000000 r8:00000000 r7:c054c9d0 r6:c7bc5c68 r5:c7bcfe20 r4:c7bc5bb0

[  136.054895] [<c02ff5cc>] (usb_stor_invoke_transport) from [<c02fe3b0>] (usb_stor_transparent_scsi_command+0x10/0x14)

[  136.065439]  r10:c7bd6000 r9:00000000 r8:00000000 r7:c054c9d0 r6:c7bc5c68 r5:00000000

[  136.073382]  r4:c7bc5bb0

[  136.075969] [<c02fe3a0>] (usb_stor_transparent_scsi_command) from [<c0300b4c>] (usb_stor_control_thread+0x1dc/0x2e8)

[  136.086549] [<c0300970>] (usb_stor_control_thread) from [<c0032834>] (kthread+0xc8/0xe4)

[  136.094657]  r10:00000000 r9:00000000 r8:00000000 r7:c0300970 r6:c7bc5bb0 r5:00000000

[  136.102597]  r4:c79be840

[  136.105188] [<c003276c>] (kthread) from [<c000a480>] (ret_from_fork+0x14/0x34)

[  136.112431]  r7:00000000 r6:00000000 r5:c003276c r4:c79be840

[  136.118197] Code: e59010a0 e3120020 13a0c902 03a0c000 (e5912004)

[  136.124318] ---[ end trace 8bbfaff994fa3bba ]---

[  136.128964] note: usb-storage[493] exited with preempt_count 1

Outcomes