TWR-LS1021A and TWR-SER2: Kernel crash when loading fsl_usb2_udc.ko

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TWR-LS1021A and TWR-SER2: Kernel crash when loading fsl_usb2_udc.ko

2,049 Views
cpark
Contributor II

Hi,

I'm using LS1021A-SDK-V1.3-20141024-yocto with the following change.

diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi

index 638ac50..0b8cd28 100644

--- a/arch/arm/boot/dts/ls1021a.dtsi

+++ b/arch/arm/boot/dts/ls1021a.dtsi

@@ -764,7 +764,7 @@

                        #address-cells = <1>;

                        #size-cells = <0>;

                        interrupts = <GIC_SPI 171 IRQ_TYPE_LEVEL_HIGH>;

-                       dr_mode = "host";

+                       dr_mode = "peripheral";

                        phy_type = "ulpi";

                };

When loading the UDC Gadget driver, there is a kernel crash so I can't load g_zero.ko.

Can you confirm if USB2 in ULPI is tested for device mode?

root@ls1021atwr:~# cd /lib/modules/3.12.0+/kernel/drivers/usb/host/

root@ls1021atwr:/lib/modules/3.12.0+/kernel/drivers/usb/host#

root@ls1021atwr:/lib/modules/3.12.0+/kernel/drivers/usb/host#

root@ls1021atwr:/lib/modules/3.12.0+/kernel/drivers/usb/host# insmod fsl-mph-dr-of.ko

Unable to handle kernel NULL pointer dereference at virtual address 00000024

pgd = bf745600

[00000024] *pgd=bd84e003, *pmd=bf6c3003, *pte=00000000

Internal error: Oops: 207 [#1] SMP ARM

Modules linked in: fsl_mph_dr_of(+)

CPU: 0 PID: 1058 Comm: insmod Not tainted 3.12.0+ #3

task: bdb3db00 ti: bf55a000 task.ti: bf55a000

PC is at __device_attach+0x18/0x4c

LR is at bus_for_each_drv+0x80/0x94

pc : [<8025b544>]    lr : [<80259a34>]    psr: 60070013

sp : bf55bbc0  ip : bf55bbd8  fp : bf55bbd4

r10: 00000000  r9 : bf12a210  r8 : 00000002

r7 : 00000000  r6 : 8025b52c  r5 : bf68b410  r4 : 805ef8a0

r3 : 00000000  r2 : 00000000  r1 : bf68b410  r0 : 805ef8a0

Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user

Control: 30c53c7d  Table: bf745600  DAC: fffffffd

Process insmod (pid: 1058, stack limit = 0xbf55a240)

Stack: (0xbf55bbc0 to 0xbf55c000)

bbc0: 00000000 bf68b410 bf55bbfc bf55bbd8 80259a34 8025b538 bf004894 bf20ea44

bbe0: 80469344 bf68b410 bf68b444 bf68b410 bf55bc1c bf55bc00 8025b314 802599c0

bc00: 00000001 bf68b410 80616220 bf68b410 bf55bc3c bf55bc20 8025a8c0 8025b2b0

bc20: 00000001 bf68b410 00000000 bf68b418 bf55bc84 bf55bc40 80258d28 8025a89c

bc40: 8046b37c 801f22c8 bf55bc74 bf55bc58 80022200 8046b378 00000200 bf68b400

bc60: 00000002 00000000 7f00094c 00000002 bf68b400 bf10e100 bf55bca4 bf55bc88

bc80: 8025c818 80258844 bf12a200 bf12a210 00000000 7f00094c bf55bd34 bf55bca8

bca0: 7f0003e0 8025c6f4 bf55bcd4 7f000924 800f5948 00000004 00000002 00000001

bcc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000010

bce0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

bd00: 00000000 00000000 bf55bd24 bf12a210 bf12a244 8065928c 7f000974 00000000

bd20: bf55a020 00000000 bf55bd44 bf55bd38 8025c484 7f000050 bf55bd64 bf55bd48

bd40: 8025b3f8 8025c474 bf12a210 bf12a244 7f000974 00000000 bf55bd84 bf55bd68

bd60: 8025b5e8 8025b360 8025b578 00000000 7f000974 8025b578 bf55bdac bf55bd88

bd80: 8025997c 8025b584 bf004874 bf10e1c0 8046b18c 7f000974 80616220 bdbcf800

bda0: bf55bdbc bf55bdb0 8025af64 8025990c bf55bde4 bf55bdc0 8025ab08 8025af50

bdc0: 7f0008b9 bf55bdd0 7f000974 bf55bf48 7f002000 bf55a018 bf55bdfc bf55bde8

bde0: 8025ba38 8025aa30 7f000a08 bf55bf48 bf55be0c bf55be00 8025c99c 8025b9a0

be00: bf55be1c bf55be10 7f002018 8025c958 bf55be94 bf55be20 8000879c 7f00200c

be20: ffffffff 806059e8 00000001 ffffffff bf55be4c bf55be40 8003aac4 801e6890

be40: bf55be7c bf55be50 8003bc54 8003aac0 00000000 bf55be60 800954bc 7f000a08

be60: bf55bf48 00000000 bf55a018 00000018 7f000a08 bf55bf48 00000000 bf55a018

be80: 00000018 bf55beec bf55bf44 bf55be98 800669e4 80008710 ffff8000 00007fff

bea0: 80063db8 00000000 00000000 76f2f8fc bf55bed4 c09de060 00000044 00000000

bec0: 00000000 7f000a14 00160219 00000000 0000000c 801f81a4 00000001 00000000

bee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

bf00: 00000000 00000000 00000000 00000000 00000000 00000000 bf55bf34 00000000

bf20: 76f2f8fc 00000003 0000017b 8000de44 bf55a000 00000000 bf55bfa4 bf55bf48

bf40: 80066d34 80065df4 c09dd000 00001a9c c09ddd40 c09ddc77 c09de4f0 00000b54

bf60: 00000cc4 00000000 00000000 00000000 00000014 00000015 0000000d 00000000

bf80: 00000009 00000000 00000000 76f1fb98 00000000 00021008 00000000 bf55bfa8

bfa0: 8000dcc0 80066cdc 76f1fb98 00000000 00000003 76f2f8fc 00000000 76f1cb40

bfc0: 76f1fb98 00000000 00021008 0000017b 76f2f8fc 00021d00 76f61000 00000000

bfe0: 7ed66c00 7ed66bf0 76f27aa4 76eb3b90 60070010 00000003 00000000 00000000

Backtrace:

[<8025b52c>] (__device_attach+0x0/0x4c) from [<80259a34>] (bus_for_each_drv+0x80/0x94)

r5:bf68b410 r4:00000000

[<802599b4>] (bus_for_each_drv+0x0/0x94) from [<8025b314>] (device_attach+0x70/0x88)

r6:bf68b410 r5:bf68b444 r4:bf68b410

[<8025b2a4>] (device_attach+0x0/0x88) from [<8025a8c0>] (bus_probe_device+0x30/0xa0)

r6:bf68b410 r5:80616220 r4:bf68b410 r3:00000001

[<8025a890>] (bus_probe_device+0x0/0xa0) from [<80258d28>] (device_add+0x4f0/0x5c8)

r6:bf68b418 r5:00000000 r4:bf68b410 r3:00000001

[<80258838>] (device_add+0x0/0x5c8) from [<8025c818>] (platform_device_add+0x130/0x1c4)

[<8025c6e8>] (platform_device_add+0x0/0x1c4) from [<7f0003e0>] (fsl_usb2_mph_dr_of_probe+0x39c/0x490 [fsl_mph_dr_of])

r7:7f00094c r6:00000000 r5:bf12a210 r4:bf12a200

[<7f000044>] (fsl_usb2_mph_dr_of_probe+0x0/0x490 [fsl_mph_dr_of]) from [<8025c484>] (platform_drv_probe+0x1c/0x20)

[<8025c468>] (platform_drv_probe+0x0/0x20) from [<8025b3f8>] (driver_probe_device+0xa4/0x1d8)

[<8025b354>] (driver_probe_device+0x0/0x1d8) from [<8025b5e8>] (__driver_attach+0x70/0x94)

r7:00000000 r6:7f000974 r5:bf12a244 r4:bf12a210

[<8025b578>] (__driver_attach+0x0/0x94) from [<8025997c>] (bus_for_each_dev+0x7c/0x90)

r6:8025b578 r5:7f000974 r4:00000000 r3:8025b578

[<80259900>] (bus_for_each_dev+0x0/0x90) from [<8025af64>] (driver_attach+0x20/0x28)

r6:bdbcf800 r5:80616220 r4:7f000974

[<8025af44>] (driver_attach+0x0/0x28) from [<8025ab08>] (bus_add_driver+0xe4/0x248)

[<8025aa24>] (bus_add_driver+0x0/0x248) from [<8025ba38>] (driver_register+0xa4/0xe8)

r7:bf55a018 r6:7f002000 r5:bf55bf48 r4:7f000974

[<8025b994>] (driver_register+0x0/0xe8) from [<8025c99c>] (__platform_driver_register+0x50/0x64)

r5:bf55bf48 r4:7f000a08

[<8025c94c>] (__platform_driver_register+0x0/0x64) from [<7f002018>] (fsl_usb2_mph_dr_driver_init+0x18/0x24 [fsl_mph_dr_of])

[<7f002000>] (fsl_usb2_mph_dr_driver_init+0x0/0x24 [fsl_mph_dr_of]) from [<8000879c>] (do_one_initcall+0x98/0x134)

[<80008704>] (do_one_initcall+0x0/0x134) from [<800669e4>] (load_module+0xbfc/0xe08)

r9:bf55beec r8:00000018 r7:bf55a018 r6:00000000 r5:bf55bf48

r4:7f000a08

[<80065de8>] (load_module+0x0/0xe08) from [<80066d34>] (SyS_finit_module+0x64/0x74)

[<80066cd0>] (SyS_finit_module+0x0/0x74) from [<8000dcc0>] (ret_fast_syscall+0x0/0x30)

r6:00021008 r5:00000000 r4:76f1fb98

Code: e24cb004 e5903004 e1a04000 e1a05001 (e5933024)

---[ end trace f07d429fba7171e1 ]---

Segmentation fault

Labels (1)
0 Kudos
6 Replies

1,255 Views
cpark
Contributor II

The full log file is attached.

0 Kudos

1,255 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Chan Park,


There is only USB3.0 port integrated on LS1021ATWR board, and USB 3.0 is backward compatible with USB 2.0.

Please follow "USB 3.0 Host/Peripheral Linux Driver User Manual" to configure and rebuild Linux Kernel.

Please configure Kernel as the following

Device Drivers--->

USB support --->

[*] Support for Host-side USB

Device Drivers--->

USB support --->

<*> xHCI HCD (USB 3.0) support

Device Drivers--->

USB support --->

<*> USB Mass Storage support

[ ] USB Mass Storage verbose debug

Device Drivers--->

USB support --->

<*> USB Gadget Support --->

<M> USB Gadget Drivers

< > USB functions configurable

through configfs

< > Gadget Zero (DEVELOPMENT)

<M> Ethernet Gadget (with CDC

Ethernet support)

[*] RNDIS support

[ ] Ethernet Emulation Model (EEM)

support

< > Network Control Model (NCM)

support

< > Gadget Filesystem

< > Function Filesystem

<M> Mass Storage Gadget

< > Serial Gadget (with CDC ACM and

CDC OBEX support)

Device Drivers--->

<*> DesignWare USB3 DRD Core Support

In addition, please make sure Kernel image and Kernel modules come from the same build, please refer to the following steps to perform build in SDK Yocto environment.

$ bitbake virtual/kernel -c cleansstate

$ bitbake virtual/kernel -c patch

$ bitbake virtual/kernel -c configure

Go to build_ls1021atwr_release/tmp/work/ls1021atwr-fsl-linux-gnueabi/linux-layerscape-sdk/3.12-r0/git

$ make ARCH=arm menuconfig

$ bitbake fsl-image-core


Have a great day,
Yiping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,255 Views
TMain
Contributor III

Yiping,

The TWR-LS1021A bd has the USB2.0 port pinned out to the elevator module for connection to the TWR-SER2... This is the port Chan is trying to configure.

pastedImage_0.png

0 Kudos

1,255 Views
cpark
Contributor II

Thanks Todd for the clarification.  That's right.  The USB2_ULPI port is the one that I'm testing.

I also gave it a try with SDK 1.7 (QorIQ-SDK-V1.7-20141218-yocto), but it is still not working.

At least, I no longer see the kernel crash, but it shows me the following error message.

fsl_udc_core.c:

          ERR("udc reset timeout!\n");

          return -ETIMEDOUT;

Here is a link to a patch that solves an endianess problem in the FSL UDC driver for LS102X devices.

http://git.freescale.com/git/cgit.cgi/ppc/sdk/linux.git/commit/drivers/usb/gadget/fsl_udc_core.c?h=s...

It says the code change was reviewed and tested. 

Can you double check and confirm if it is tested on TWR-LS1021A + TWR-SER2?

Thanks,

Chan

0 Kudos

1,255 Views
cpark
Contributor II

I have verified the USB2 UDC in ULPI on TWR-SER2 is working with the following configuration.

1. SDK 1.7

2. RCW EC2=USB2

3. DTS dr_mode = "peripheral"

4. 1K pull-down on CAN3_USB2_SEL

1,255 Views
ufedor
NXP Employee
NXP Employee

Hello,

You wrote:

> 4. 1K pull-down on CAN3_USB2_SEL

This is not a correct solution.

Correct is to use the TWR-LS1021A CPLD registers as follows:

1) Set Bit[3] (0x08) in the Register 0x4 to enable CAN3/USB2 Interface Selection

2) Set Bit[0] (0x01) in the Register 0xB to select CAN3

0 Kudos