[IMX6Q] bcmdhd wifi driver got kernel panic when insert the module driver

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

[IMX6Q] bcmdhd wifi driver got kernel panic when insert the module driver

10,093 Views
kai_wang
Contributor II

Hello,

 

We have our own board designed after the SabreSD-6Q and I am trying to bring WiFi module BCM43438 (similar to BCM43430) on imx6 quad platform.

 

Environment:

Platform: IMX6 quad

Codebase: Android 5.0.2 1.0.0-ga-rc4

Linux base: 3.10.53

 

The wifi module is connected to sd2/mmc2 controller.

The bcm reset (wlreg_on) line is connected to gpio_5(GPIO1_IO05) and interrupt(WL_WAKE_HOST) line is connected to gpio_16 (GPIO7_IO11)

The below changes are in dts file.

 

dts setting

wlreg_on: fixedregulator {

compatible = "regulator-fixed";

regulator-name = "wlreg_on";

gpio = <&gpio1 5 0>;

startup-delay-us = <600000>;

enable-active-high;

regulator-boot-on;

//regulator-always-on;

};

};

 

           bcmdhd_wlan{

                     compatible = "android,bcmdhd_wlan";

                     wlreg_on-supply = <&wlreg_on>;

                     gpios = <&gpio7 11 0>;//WL_WAKE_HOST

                     interrupt-names = "bcmdhd_wlan_irq";//interrupts name

                     interrupt-parent = <&gpio7>;

                     interrupts = <11 1>;

                     interrupt-controller;

           };

&iomuxc {

….

MX6QDL_PAD_GPIO_5__GPIO1_IO05   0x80000000 //wlreg_on

MX6QDL_PAD_GPIO_16__GPIO7_IO11 0x80000000 //WL_WAKE_HOST

 

 

&usdhc2 {

pinctrl-names = "default";

pinctrl-0 = <&pinctrl_usdhc2_2>;

no-1-8-v;

keep-power-in-suspend;

enable-sdio-wakeup;

status = "okay";

};

 

-----------------------------------------------------------------------------------

pinctrl_usdhc2_2: usdhc2grp-2 {

fsl,pins = <

MX6QDL_PAD_SD2_CMD__SD2_CMD    0x17059

MX6QDL_PAD_SD2_CLK__SD2_CLK    0x10059

MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059

MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059

MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059

MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17059

>;

};

 

When I try to insert the bcmdhd driver, the system got panic.

 

There are two failures while loading the wifi driver and collected the logs.

 

Case 1: The system stack at module driver bring up. As the log “case_1”, the stack point is the function “bcmsdh_oob_intr_register” (line 572).

It seems the panic happens when the function “request_irq” has been called.

 

Case 2: Add “interrupt-controller“ in the dts setting, the module is unstable when it has been brought up. It can pass the case 1 at sometimes, and it got another panic as “Workqueue: kmmcd mmc_rescan”(line 593).

 

Let me know Is there something wrong with the dts setting if it is wrong?

Please suggest if you have any additional pointers or any reasons for this issue.

 

 

 

 

 

 

Original Attachment has been moved to: case_1.log.zip

Original Attachment has been moved to: case_2.log.zip

Labels (2)
14 Replies

3,971 Views
karltsou
Contributor I

Hi,

 

I noticed that Dongle Host Driver, version is 1.141.88, this is new bcmdhd and cannot be there in kernel L3.10.53.

 

Can you add below debugs in file dhd_linux_platdev.c, function wifi_plat_dev_drv_probe I think wifi_plat_data is "null"

 

DHD_ERR(("%s wifi platform data %p\n", __FUNCTION__, adapter->wifi_plat_data));

0 Kudos

3,971 Views
fulinux
Contributor IV

hi,

are you still there? do you have bcmdhd firmware like this:

modprobe bcmdhd firmware_path=/lib/firmware/bcm/ZP_BCM4339/fw_bcmdhd.bin nvram_path=/lib/

firmware/bcm/ZP_BCM4339/bcmdhd.ZP.SDIO.cal

0 Kudos

3,971 Views
kai_wang
Contributor II

HI

In command line use, It should check your firmware and nvram file are exist in the path in your porting system. (not in your Compiled PC)

0 Kudos

3,971 Views
fulinux
Contributor IV

Hi,

firmware and nvram files are used by old kernel linux-3.0, my old kernel runs will with those files? Can't use them by new BSP kernel(linux-4.1.15, BSP: imx_4.1.15_1.0.0_ga)? can you give me your files, i will try that.

0 Kudos

3,971 Views
mengliangxia
Contributor I

do you have firmware and nvram file that imx6ul linux 4.1.15 can use ?My wifi is bcm43362.But i don't know where can i get the firmware file

0 Kudos

3,971 Views
kai_wang
Contributor II

Hi

In my knows, firmware and nvram are related to wifi chip not kernel system.

So that, you should

1. Check the  firmware and nvram are exist in /lib/firmware/bcm/ZP_BCM4339/fw_bcmdhd.bin and

/lib/firmware/bcm/ZP_BCM4339/bcmdhd.ZP.SDIO.cal

2.Check wifi module provider the  firmware and nvram can be used in linux 4.1.15

And I am using our own wifi module, the firmware and nvram can‘t be used in others.

0 Kudos

3,971 Views
fulinux
Contributor IV

hi kai,

look at this log:

dhd_module_init in

Power-up adapter 'DHD generic adapter'

wifi_platform_bus_enumerate device present 1

mmc2: queuing unknown CIS tuple 0x80 (2 bytes)

mmc2: queuing unknown CIS tuple 0x80 (3 bytes)

mmc2: queuing unknown CIS tuple 0x80 (3 bytes)

mmc2: queuing unknown CIS tuple 0x80 (7 bytes)

mmc2: new high speed SDIO card at address 0001

F1 signature OK, socitype:0x1 chip:0xa962 rev:0x1 pkg:0x9

DHD: dongle ram size is set to 245760(orig 245760) at 0x0

wifi_platform_get_mac_addr

CFG80211-ERROR) wl_setup_wiphy : Registering Vendor80211)

wl_create_event_handler(): thread:wl_event_handler:332 started

CFG80211-ERROR) wl_event_handler : tsk Enter, tsk = 0xd708143c

dhd_attach(): thread:dhd_watchdog_thread:333 started

dhd_attach(): thread:dhd_dpc:334 started

dhd_deferred_work_init: work queue initialized

Dongle Host Driver, version 1.141.88 (r)

Compiled from

Register interface [wlan0]  MAC: 00:90:4c:11:22:33

CFG80211-ERROR) wl_event_handler : was terminated

wl_destroy_event_handler(): thread:wl_event_handler:332 terminated OK

dhd_prot_ioctl : bus is down. we have nothing to do

root@imx6qsabresd:~/firmware#

Dongle Host Driver, version 1.141.88 (r)

Compiled from

wl_android_wifi_on in

mmc2: queuing unknown CIS tuple 0x80 (2 bytes)

mmc2: queuing unknown CIS tuple 0x80 (3 bytes)

mmc2: queuing unknown CIS tuple 0x80 (3 bytes)

mmc2: queuing unknown CIS tuple 0x80 (7 bytes)

F1 signature OK, socitype:0x1 chip:0xa962 rev:0x1 pkg:0x9

DHD: dongle ram size is set to 245760(orig 245760) at 0x0

dhdsdio_write_vars: Download, Upload and compare of NVRAM succeeded.

random: nonblocking pool is initialized

dhd_bus_init: enable 0x06, ready 0x06 (waited 0us)

wifi_platform_get_mac_addr

Firmware up: op_mode=0x0005, MAC=94:a1:a2:5d:d1:6e

dhd_preinit_ioctls buf_key_b4_m4 set failed -23

Firmware version = wl0: Jul  5 2013 17:55:22 version 5.90.195.89.10 FWID 01-f4d31c13

dhd_preinit_ioctls wl ampdu_hostreorder failed -23

dhd_wlfc_init(): successfully enabled bdcv2 tlv signaling, 79

dhd_wlfc_init(): wlfc_mode=0x0, ret=-23

CFG80211-ERROR) wl_update_wiphybands : error reading vhtmode (-23)

wl_create_event_handler(): thread:wl_event_handler:344 started

CFG80211-ERROR) wl_event_handler : tsk Enter, tsk = 0xd708143c

skbuff: skb_under_panic: text:7f054774 len:12 put:12 head:d66b151c data:d66b1510 tail:0xd66b1514 end:0xd66b1514 dev:<NULL>

------------[ cut here ]------------

Kernel BUG at 805f08ac [verbose debug info unavailable]

Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM

Modules linked in: bcmdhd

CPU: 0 PID: 820 Comm: dhd_dpc Not tainted 4.1.15+gd5d7c02 #15

Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)

task: d6f22f80 ti: d6820000 task.ti: d6820000

PC is at skb_panic+0x60/0x64

LR is at skb_panic+0x60/0x64

pc : [<805f08ac>]    lr : [<805f08ac>]    psr: 600b0013

sp : d6821c98  ip : 00000000  fp : 00000001

r10: d6790000  r9 : 0000000c  r8 : d6d67460

r7 : 80832c84  r6 : d66b1510  r5 : d66b1514  r4 : 809f5cdc

r3 : 00000000  r2 : 00000000  r1 : 809b84a0  r0 : 0000007a

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

Control: 10c53c7d  Table: 6691404a  DAC: 00000015

Process dhd_dpc (pid: 820, stack limit = 0xd6820210)

Stack: (0xd6821c98 to 0xd6822000)

1c80:                                                       0000000c d66b151c

1ca0: d66b1510 d66b1514 d66b1514 809f5cdc 00000000 805f292c 00000000 d6d67400

1cc0: d66b1480 7f054774 00000000 00000002 00000000 d6821df8 0000004e 0000000c

1ce0: 00000000 00000000 00000000 d65e4080 7f075dd0 00000000 00000001 00000000

1d00: 00000200 d65e4080 d6821df4 80aeb5ea d6821df8 d65e4100 00000000 80ae52f8

1d20: 80ae8800 00000000 00000001 d603cc50 d6821d68 80ae8800 00000000 8005d014

1d40: 00008800 00000000 80aec6c0 d603cc40 00000000 00000400 00000000 00000001

1d60: 00000000 80aec100 00000000 00000000 00000000 00000000 00000400 00000000

1d80: 00000000 00000001 00000001 00000000 00000000 d603cb40 d603cc40 00000002

1da0: d8f9fc00 d6790000 00000201 00000000 00000001 80037c00 d6790000 00000000

1dc0: 00000001 d6d67400 d6821df8 d6d67460 00000000 d6790000 00000001 7f055260

1de0: 000000ff 00000014 18002000 7f075dd0 00000007 80aec594 d66b1480 ef6fe840

1e00: d60db488 d60db440 80aec6c0 d6f23228 80aec594 00000000 ef6fe800 8005e760

1e20: ef6fe8a8 ef6fe800 d6f23038 d6790000 00000201 00000000 00000000 80037c00

1e40: d6790000 00000000 00000000 7f0096f0 d6790000 7f04c5e4 d67939a0 a00b0093

1e60: 00000014 80796be8 00000014 80796f68 d6790000 a00b0013 d6793000 000007d0

1e80: d65e4100 7f00f378 7f075dd0 00000003 00000014 80796f68 7f075dd0 d6d67400

1ea0: 7f075dd0 7f07a684 00000000 d65e4100 00000000 00000000 00000014 7f0574cc

1ec0: 00000000 60010013 d67938bc 00000032 ffff9a9d d6793000 80b9c140 80ae8800

1ee0: 01000000 6ec16000 80b9c140 80052b38 d6793858 ffff9a9d 00000000 80796f68

1f00: d6793858 8007a8dc 00000000 a00b0093 d6790000 a00b0013 d6793000 d6790000

1f20: d67938a8 d67938e0 00000000 600b0013 d67938bc 00000000 00000000 7f00f528

1f40: d67938a8 00000001 00000000 00000000 d65e44c0 d67938a8 7f00f440 00000000

1f60: 00000000 8004ce08 00000000 00000000 d62fc678 d67938a8 00000000 00000000

1f80: d6821f80 d6821f80 00000000 00000000 d6821f90 d6821f90 d6821fac d65e44c0

1fa0: 8004cd2c 00000000 00000000 8000f528 00000000 00000000 00000000 00000000

1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 7f759811 7f759c11

[<805f08ac>] (skb_panic) from [<805f292c>] (skb_push+0x40/0x44)

[<805f292c>] (skb_push) from [<7f054774>] (dhdsdio_txpkt.constprop.8+0xdc/0xa60 [bcmdhd])

[<7f054774>] (dhdsdio_txpkt.constprop.8 [bcmdhd]) from [<7f055260>] (dhdsdio_sendfromq+0x168/0x3e4 [bcmdhd])

[<7f055260>] (dhdsdio_sendfromq [bcmdhd]) from [<7f0574cc>] (dhdsdio_dpc+0x2d4/0x1024 [bcmdhd])

[<7f0574cc>] (dhdsdio_dpc [bcmdhd]) from [<7f00f528>] (dhd_dpc_thread+0xe8/0x130 [bcmdhd])

[<7f00f528>] (dhd_dpc_thread [bcmdhd]) from [<8004ce08>] (kthread+0xdc/0xf4)

[<8004ce08>] (kthread) from [<8000f528>] (ret_from_fork+0x14/0x2c)

Code: e58de014 e58d500c e58dc010 eb06798d (e7f001f2)

---[ end trace f5a16a9b3eefbf7a ]---

root@imx6qsabresd:~/firmware# lsmod

Module                  Size  Used by

bcmdhd                638540  0

root@imx6qsabresd:~/firmware# ifconfig

eth0      Link encap:Ethernet  HWaddr CC:85:6C:04:E3:32 

          inet addr:192.168.0.106  Bcast:192.168.0.255  Mask:255.255.255.0

          inet6 addr: fe80::ce85:6cff:fe04:e332/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:315 errors:0 dropped:0 overruns:0 frame:0

          TX packets:31 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:35870 (35.0 KiB)  TX bytes:5743 (5.6 KiB)

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:65536  Metric:1

          RX packets:10 errors:0 dropped:0 overruns:0 frame:0

          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:700 (700.0 B)  TX bytes:700 (700.0 B)

wlan0     Link encap:Ethernet  HWaddr 94:A1:A2:5D:D1:6E 

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:879 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 B)  TX bytes:299862 (292.8 KiB)

i don't know what's happend, can you give me some advice? where are you come from?

should i add host_oob_irq or host_wake_irq in dts file, because in my old kernel linux-3.0's board file has this:

//wifi

int bcm_wlan_get_oob_irq(void)

{

    int host_oob_irq = 0;

    gpio_request(WIFI_HOST_WAKE, "wifi_host_wake");

    gpio_direction_input(WIFI_HOST_WAKE);

    host_oob_irq = gpio_to_irq(WIFI_HOST_WAKE);

    printk("host_oob_irq: %d \r\n", host_oob_irq);

    return host_oob_irq;

}

EXPORT_SYMBOL(bcm_wlan_get_oob_irq);

void bcm_wlan_power_on(int flag)

{

    if (flag == 1) {

        force_remove_sdio3();

        printk("======== PULL WL_REG_ON LOW! ========\n");

        gpio_set_value(WIFI_REG_ON, 0);

        mdelay(100);

        printk("======== PULL WL_REG_ON HIGH! ========\n");

        gpio_set_value(WIFI_REG_ON, 1);

        /* Lets customer power to get stable */

        mdelay(100);

        force_detect_sdio3();

        printk("======== Card detection to detect SDIO card! ========\n"); 

    } else {

        printk("======== PULL WL_REG_ON HIGH! (flag = %d) ========\n", flag);

        gpio_set_value(WIFI_REG_ON, 1);

    }

}

EXPORT_SYMBOL(bcm_wlan_power_on);

0 Kudos

3,971 Views
kai_wang
Contributor II

HI

1. Please check your sdio bus or wifi module, wifi module is missing in the 2nd log

2. I had removed oob irq in the dts file and mask obb irq register in the DHD driver.

It is because I followed freescale release do and you could find some thread said mmc issue about CPU.

0 Kudos

3,971 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Kai,

     From your logs, it seemed that you compiled wifi driver into kernel !

     you can try to compile it as a single module, then insert it to system by insmod application after booting. Don't forget to add firmware when using insmod 'bcmdhd.ko' .

Regards,

Weidong

3,971 Views
kai_wang
Contributor II

Hi Weidong

    

     The logs seemed module build-in that I forgot to turn Wifi off in the Setting app.

    

     The problem is that when I insert module driver, I will get stuck and panic at the  "request_irq" function.

     Attach the new log is used insmod function as you mention.

     I have found an article in the community, it said that you cannot use the GPIO in the first bank as an interrupt source.

    

     1. Is that GPIO_16 in the first bank?

     2. Is there something wrong with the dts setting if it is wrong?

0 Kudos

3,970 Views
fulinux
Contributor IV

hi wang,

     have you solve this problem, can you give me you qq or email? would you touch me with my qq:861239127?

0 Kudos

3,971 Views
kai_wang
Contributor II

Hi 福林

I don't have QQ. Sorry.

I followed the method in the android 5.1.1 (android 6.0.1) from freescale release to remove the interrupts gpio in our own bcmdhd driver.

It seems to work  fine in android 5.1.1 and 6.0 with our own driver.

So, you can find the android release in the NXP website.

(You can only download kernel source for android from repo sync if you think the whole android source code is too big)

B.R.

Kai

0 Kudos

3,972 Views
chengsi
Contributor I

Hi Wang:

You said you changed the bcmdhd driver, but i can not find the document about  how to change the driver in android, can you please give me some reference? thanks

0 Kudos

3,972 Views
fulinux
Contributor IV

Hi Wang,

this is my dts file attached as follows.

and then i use this command:

insmod /home/root/firmware/bcmdhd.ko firmware_path=/home/root/firmware/wlan/fw_bcm40181a2.bin nvram_path=/home/root/firmware/wlan/nvram_ap6210.txt

it log show some wrong:

dhd_module_init in

Power-up adapter 'DHD generic adapter'

wifi_platform_bus_enumerate device present 1

mmc2: queuing unknown CIS tuple 0x80 (2 bytes)

mmc2: queuing unknown CIS tuple 0x80 (3 bytes)

mmc2: queuing unknown CIS tuple 0x80 (3 bytes)

mmc2: queuing unknown CIS tuple 0x80 (7 bytes)

mmc2: new high speed SDIO card at address 0001

F1 signature OK, socitype:0x1 chip:0xa962 rev:0x1 pkg:0x9

DHD: dongle ram size is set to 245760(orig 245760) at 0x0

wifi_platform_get_mac_addr

CFG80211-ERROR) wl_setup_wiphy : Registering Vendor80211)

wl_create_event_handler(): thread:wl_event_handler:330 started

CFG80211-ERROR) wl_event_handler :

dhd_attach(): thread:dhd_watchdog_thread:331 started

tsk Enter, tsk = 0xd706143c

dhd_attach(): thread:dhd_dpc:332 started

dhd_deferred_work_init: work queue initialized

Dongle Host Driver, version 1.141.88 (r)

Compiled from

Register interface [wlan0]  MAC: 00:90:4c:11:22:33

CFG80211-ERROR) wl_event_handler : was terminated

wl_destroy_event_handler(): thread:wl_event_handler:330 terminated OK

dhd_prot_ioctl : bus is down. we have nothing to do

root@imx6qsabresd:~#

Dongle Host Driver, version 1.141.88 (r)

Compiled from

wl_android_wifi_on in

mmc2: queuing unknown CIS tuple 0x80 (2 bytes)

mmc2: queuing unknown CIS tuple 0x80 (3 bytes)

mmc2: queuing unknown CIS tuple 0x80 (3 bytes)

mmc2: queuing unknown CIS tuple 0x80 (7 bytes)

F1 signature OK, socitype:0x1 chip:0xa962 rev:0x1 pkg:0x9

DHD: dongle ram size is set to 245760(orig 245760) at 0x0

dhdsdio_download_nvram: error reading nvram file: 0

_dhdsdio_download_firmware: dongle nvram file download failed

dhd_net_bus_devreset: dhd_bus_devreset: -35

dhd_open : wl_android_wifi_on failed (-35)

wl_android_wifi_off in

dhd_prot_ioctl : bus is down. we have nothing to do

dhd_net_bus_devreset: dhd_bus_devreset: -35

Dongle Host Driver, version 1.141.88 (r)

Compiled from

wl_android_wifi_on in

mmc2: queuing unknown CIS tuple 0x80 (2 bytes)

mmc2: queuing unknown CIS tuple 0x80 (3 bytes)

F1 signature OK, socitype:0x1 chip:0xa962 rev:0x1 pkg:0x9

DHD: dongle ram size is set to 245760(orig 245760) at 0x0

random: nonblocking pool is initialized

dhdsdio_download_nvram: error reading nvram file: 0

_dhdsdio_download_firmware: dongle nvram file download failed

dhd_net_bus_devreset: dhd_bus_devreset: -35

dhd_open : wl_android_wifi_on failed (-35)

wl_android_wifi_off in

dhd_prot_ioctl : bus is down. we have nothing to do

dhd_net_bus_devreset: dhd_bus_devreset: -35

what is wrong?

should we define WIFI 32K CLK Ctrl pin refer to 《Porting BCM4330/BCM43362 WIFI  to Android4.2.2》 which attached.

than you,

fulinux.

0 Kudos