This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3352: MMC2 interface to WiFi module

Part Number: AM3352


Hi Sitara Team,

my customer is using AM3352BZCZ100 for some revisions of his board already. They now want to include a wifi module WILC3000 SDIO-connected to MMC2 of the Sitara. They are using kernel 3.15.1 and have problems connecting to the Wifi-Module and want to find out the correct DMA channel assignment for this setup.

Devicetree snippets below:

&mmc3{
vmmc-supply = <&vmmcsd_fixed>;
               compatible = "ti,omap4-hsmmc";
                        ti,hwmods = "mmc3";
                        ti,dual-volt;
                        ti,needs-special-reset;
                        ti,needs-special-hs-handling;
                        dmas = <&edma 32
                                &edma 33>;
       bus-width = <0x4>;

pinctrl-names = "default";
pinctrl-0 = <&mmc3_pins>;

                        dma-names = "tx", "rx";
                        interrupts = <8>;
                        interrupt-parent = <&intc>;
//			reg = <0x47810000 0x1000>;                        
			status = "okay";

};
mmc3_pins: pinmux_mmc3_pins { 
	    pinctrl-single,pins = < 
		0x8c ( PIN_INPUT_PULLUP | MUX_MODE3 ) /* (V12) gpmc_clk.mmc2_clk */
		0x88 ( PIN_INPUT_PULLUP | MUX_MODE3 ) /* (T13) gpmc_csn3.mmc2_cmd */
		0x30 ( PIN_INPUT_PULLUP | MUX_MODE3 ) /* (T12) gpmc_ad12.mmc2_dat0 */
		0x34 ( PIN_INPUT_PULLUP | MUX_MODE3 ) /* (R12) gpmc_ad13.mmc2_dat1 */
		0x38 ( PIN_INPUT_PULLUP | MUX_MODE3 ) /* (V13) gpmc_ad14.mmc2_dat2 */
		0x3c ( PIN_INPUT_PULLUP | MUX_MODE3 ) /* (U13) gpmc_ad15.mmc2_dat3 */
>; 
	};

Adding the recommended resistors on MMC_CLK line didn't changed the behaviour.

Please advise what my customer can additional test or how he can solve the problem.

Best regards

Cevin

  • Hi Cevin,

    Your customer is using a Linux version that has never been released or supported by TI. We have collaterals here: processors.wiki.ti.com/.../WiLink8_Linux_Getting_Started_Guide, but they are based on the Processor SDK and TI's WiLink solution.
  • Is this resolved? If it is, please mark as "Resolved" so we can close the thread.
  • Hi,

    First of all, thanks to Cevin for starting this thread.

    I have moved our development from our custom kernel & rootfs to:
    ti-processor-sdk-linux-am335x-evm-04.01.00.06

    I hope this helps us to benefit from future updates for the AM33XX platform.

    Our custom board is very closely related to the Beaglebone Black (BBB). Basically we just have to modify the kernel sources to allow our custom board to be treated like a BBB.

    To make things easier to port to our target platform i started from scratch to make sure that the base image the SDK spits out will boot on a BBB first.
    After that, there is the board identification to be taken care of and we are good to go.

    So for starters, I have the following 4 setups in place:

    Setup #1:
    Beaglebone Black with a WILC3000 shield connected in SDIO mode as follows:
    PIN BBB <-> PIN WILC (description)
    P9_3 <-> 3V3
    P9_1 <-> GND
    P8_9 <-> CHP_EN
    P8_10 <-> RST
    P8_15 <-> SD_DAT3
    P8_16 <-> SD_DAT2
    P8_11 <-> SD_DAT1
    P8_12 <-> SD_DAT0
    P8_18 <-> SD_CLK
    P9_15 <-> SD_CMD (This pin is shared across CPU Pins R13 and T13 on the BBB)


    &mmc3 { /*based on github.com/.../ti,wlcore.txt
    just added the wilc_sdio node as given in device trees for the current WILC3000 drivers as there is no official kernel doc in /Documentation/devicetree/bindings/ regarding required parameters
    thats why
    #define GPIO_NUM_CHIP_EN 39
    #define GPIO_NUM_RESET 38
    are also set in /drivers/staging/wilc1000/wilc_wlan.h as recommended by an Atmel engineer.
    WILC3000 drivers taken from: github.com/.../dev because of the sigle module availability and device tree adjustments
    */
    status = "okay";
    bus-width = <4>;
    cap-power-off-card;
    keep-power-in-suspend;
    #address-cells = <1>;
    #size-cells = <0>;
    pinctrl-0 = <&mymmc3_pins_default>;
    vmmc-supply = <&vmmcsd_fixed>;
    wilc_sdio@0{
    compatible = "atmel,wilc_sdio";
    gpio_reset = <&gpio2 4 0>;
    gpio_chip_en = <&gpio2 5 0>;
    gpio_irq = <&gpio2 3 0>;
    status = "okay";
    };
    };


    mymmc3_pins_default: mymmc3_pins_default {
    pinctrl-single,pins = <
    0x3C (PIN_INPUT_PULLUP | MUX_MODE3) /* mmc2_dat3 */
    0x38 (PIN_INPUT_PULLUP | MUX_MODE3) /* mmc2_dat2 */
    0x34 (PIN_INPUT_PULLUP | MUX_MODE3) /* mmc2_dat1 */
    0x30 (PIN_INPUT_PULLUP | MUX_MODE3) /* mmc2_dat0 */
    0x8c (PIN_INPUT_PULLUP | MUX_MODE3) /* mmc2_clk */
    0x88 (PIN_INPUT_PULLUP | MUX_MODE3) /* mmc2_cmd */
    >;
    };

    Setup #2:
    WILC3000 shield modifiedas follows:
    R310 shortened
    R311 removed
    istead of removing R218,R219,R220,R221 and connecting R214,R215,R216,R217 i just use the SPI pins on the Raspberry connector J207


    Beaglebone Black with a WILC3000 shield connected in SPI mode as follows:
    PIN BBB <-> PIN WILC (description)
    P9_3 <-> 3V3
    P9_1 <-> GND
    P8_9 <-> CHP_EN
    P8_10 <-> RST
    P9_17 <-> J207 Pin 24 (SPI CS0)
    P9_18 <-> J207 Pin 21 (SPI D1/MISO)
    P9_21 <-> J207 Pin 19 (SPI D0/MOSI)
    P9_22 <-> J207 Pin 23 (SPI SCLK)

    &spi0 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&spi0_pins>; /*the default setups*/

    #address-cells = <0x1>;
    #size-cells = <0x0>;
    pinctrl-names = "default";
    status = "okay";
    wilc_spi@0 {
    compatible = "atmel,wilc_spi";
    spi-max-frequency = <400000>;
    reg = <0x0>;
    status = "okay";
    };

    };

    Setup #3 & #4: is our target board, but lets focus on the basic questions first before we get to that.


    My progress so far is havin an Image built by the imagebuilder in the SDK and booting the kernel with the respective device tree variations without errors.
    As soon as I do insmd /lib/firmware/wilc-spi.ko on Setup2 the SPI Bus device files disappear. On Setup #1 i had no luck getting the sdio interface to show up properly(even when I trigegr the CHP_EN&RST Pins before loading the kernel in Uboot).

    Would you be so kind to check if my way of trying to configure the SPI and SDIO interfaces has any mistakes? I Will collect more Debug output and add it in anoter post.

    Regards

    Mateusz Gwara - casenio AG
  • I think the #define in the .h file is incorrect. The gpio banks start at gpio0. Then gpio2 starts at 64 so gpio2_4 would be 68 and gpio2_5 would be 69. I'm still verifying the pin muxing.

    Steve K.

  • And can you enable debug? It would be good to see any debug messages.

    Steve K.
  • Sorry for the late replay.

    In the meantime we decided to use SPI as this seems to be the better option with out WILC3000 chip from atmel.

    I tried to run the current dev branch driver from atmel on the ti CPU SDK(ti-processor-sdk-linux-am335x-evm-04.02.00.09) using kernel 4.9.59 my making the modifications in wilc_wlan.h as atmel recommended:

    #define MODALIAS               "WILC_SPI"

    #define GPIO_NUM       88

    #define GPIO_NUM_CHIP_EN 86

    #define GPIO_NUM_RESET 87

     

    Which corresponds to our cpu-wilc interconnects:

     

    The device tree looks as follows:

    &spi0 {

    pinctrl-names = "default";

    pinctrl-0 = <&spi0_pins>;

    status = "okay";

                   wilc_spi@0 {

                                   compatible = "atmel,wilc_spi";

                                   spi-max-frequency = <24000000>;

                                   reg = <0x0>;

                                   status = "okay";

                   };

     

    };

    With spi0_pins being defined as:

    spi0_pins: spi0_pins {

           pinctrl-single,pins = <

                   0x150 (PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_sclk.spi0_sclk */

                   0x154 (PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_d0.spi0_d0 */

                   0x158 (PIN_OUTPUT_PULLUP | MUX_MODE0) /* spi0_d1.spi0_d1 */

                   0x15c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* spi0_cs0.spi0_cs0 */

          >;

    };

     

    Which corresponds to our cpu-wilc interconnects:

     

     

    I’m not sure if what I see is correct as the output says:

    root@casa-dev-mg:~# cat /sys/bus/spi/devices/spi1.0/uevent

    DRIVER=WILC_SPI

    OF_NAME=wilc_spi

    OF_FULLNAME=/ocp/spi@48030000/wilc_spi@0

    OF_COMPATIBLE_0=atmel,wilc_spi

    OF_COMPATIBLE_N=1

    MODALIAS=spi:wilc_spi

     

    Shouldn’t it be spi0 ??

    There seems to be no spi bus device in /dev:

    root@casa-dev-mg:~# ls /dev/s*

    /dev/stderr /dev/stdin /dev/stdout

     

    /dev/shm:

     

    /dev/snd:

    Timer

     

     

    When I load the wilc-spi module via:

    insmod /lib/modules/4.9.59casenio-ga75d8e9305/kernel/drivers/staging/wilc1000/wilc-spi.ko

     

    This is the output:

    [   97.416822] wilc_spi: module is from the staging directory, the quality is unknown, you have been warned.

    [   97.433856] WILC_SPI spi1.0: spiModalias: wilc_spi, spiMax-Speed: 24000000

    [   97.441387] (unnamed net_device) (uninitialized): INFO [wilc_create_wiphy]Registering wifi device

    [   97.450693] (unnamed net_device) (uninitialized): INFO [WILC_WFI_CfgAlloc]Allocating wireless device

    [   97.462296] (unnamed net_device) (uninitialized): INFO [wilc_create_wiphy]Successful Registering

    [   97.474031] (unnamed net_device) (uninitialized): INFO [wilc_create_wiphy]Registering wifi device

    [   97.483389] (unnamed net_device) (uninitialized): INFO [WILC_WFI_CfgAlloc]Allocating wireless device

    [   97.493505] (unnamed net_device) (uninitialized): INFO [wilc_create_wiphy]Successful Registering

    [   97.504267] WILC_SPI spi1.0: WILC setting default Reset GPIO to 87. Got -2

    [   97.511689] WILC_SPI spi1.0: WILC setting default Chip Enable GPIO to 86. Got -2

    [   97.519659] WILC_SPI spi1.0: WILC setting default IRQ GPIO to 88. Got -2

    [   97.526859] wifi_pm : 0

    [   97.529668] wifi_pm : 1

    [   97.626390] WILC_SPI spi1.0 p2p0: INFO [wilc_mac_open]MAC OPEN[dd71f800] p2p0

    [   97.634244] WILC POWER UP

    [   97.637051] WILC_SPI spi1.0 p2p0: INFO [wilc_init_host_int]Host[dd71f800][dd04ac00]

    [   97.742382] WILC_SPI spi1.0 p2p0: INFO [wilc_mac_open]*** re-init ***

    [   97.749205] WILC_SPI spi1.0 p2p0: INFO [wlan_init_locks]Initializing Locks ...

    [   97.756799] WILC_SPI spi1.0 p2p0: INFO [wilc_wlan_init]Initializing WILC_Wlan ...

    [   97.817362] WILC_SPI spi1.0: Failed cmd response, cmd (c4), resp (ff)

    [   97.824151] WILC_SPI spi1.0: Failed internal read cmd...

    [   97.859583] WILC_SPI spi1.0: Failed cmd response, cmd (cf), resp (ff)

    [   97.866334] WILC_SPI spi1.0: Failed cmd reset

    [   97.871056] WILC_SPI spi1.0: Reset and retry 10 24

    [   97.887114] WILC_SPI spi1.0: WILC SPI probe success

    [   97.898324] WILC_SPI spi1.0: Failed cmd response, cmd (c4), resp (ff)

    [   97.905069] WILC_SPI spi1.0: Failed internal read cmd...

    [   97.936714] WILC_SPI spi1.0: Failed cmd response, cmd (cf), resp (ff)

    [   99.397990] WILC_SPI spi1.0: Reset and retry 1 24

    [   99.426554] WILC_SPI spi1.0: Failed internal read protocol...

    [   99.432583] WILC_SPI spi1.0 p2p0: ERR [wilc_wlan_initialize: 1165] Initializing WILC_Wlan FAILED

    [   99.441788] WILC_SPI spi1.0 p2p0: INFO [wlan_deinit_locks]De-Initializing Locks

    [   99.449449] WILC_SPI spi1.0 p2p0: ERR [wilc_wlan_initialize: 1245] WLAN initialization FAILED

    [   99.458371] WILC_SPI spi1.0 p2p0: ERR [wilc_mac_open: 1295] Failed to initialize wilc

    [   99.469629] WILC_SPI spi1.0 p2p0: ERR [wilc_send_config_pkt: 1887] [Sendconfigpkt]Set Timed out

    [   99.479376] WILC_SPI spi1.0 p2p0: ERR [handle_set_wfi_drv_handler: 444] Failed to set driver handler

    [   99.488965] WILC_SPI spi1.0 p2p0: Host cmd 24 failed

    [   99.496237] WILC_SPI spi1.0 p2p0: ERR [host_if_work: 2986] [Host Interface] undefined

    [   99.543518] WILC_SPI spi1.0 wlan0: INFO [wilc_mac_open]MAC OPEN[dd0f0000] wlan0

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

    [   99.556656] WARNING: CPU: 0 PID: 2902 at kernel/locking/mutex.c:529 mutex_lock_nested+0x2e8/0x314

    [   99.565923] DEBUG_LOCKS_WARN_ON(l->magic != l)[   99.570379] Modules linked in:

    wilc_spi(C)

    [   99.574857] CPU: 0 PID: 2902 Comm: NetworkManager Tainted: G         C     4.9.59casenio-ga75d8e9305 #14

    [   99.584831] Hardware name: Generic AM33XX (Flattened Device Tree)

    [   99.591222] [<c010de80>] (unwind_backtrace) from [<c010bb94>] (show_stack+0x10/0x14)

    [   99.599322] [<c010bb94>] (show_stack) from [<c0131970>] (__warn+0xd8/0x100)

    [   99.606590] [<c0131970>] (__warn) from [<c01319cc>] (warn_slowpath_fmt+0x34/0x44)

    [   99.614410] [<c01319cc>] (warn_slowpath_fmt) from [<c07bb90c>] (mutex_lock_nested+0x2e8/0x314)

    [   99.623549] [<c07bb90c>] (mutex_lock_nested) from [<bf0168dc>] (wilc_bt_power_up+0x24/0x31c [wilc_spi])

    [   99.633447] [<bf0168dc>] (wilc_bt_power_up [wilc_spi]) from [<bf0088ec>] (wilc_mac_open+0x214/0x340 [wilc_spi])

    [   99.644033] [<bf0088ec>] (wilc_mac_open [wilc_spi]) from [<c0637c48>] (__dev_open+0xb8/0x120)

    [   99.652932] [<c0637c48>] (__dev_open) from [<c0637ed0>] (__dev_change_flags+0x88/0x14c)

    [   99.661289] [<c0637ed0>] (__dev_change_flags) from [<c0637fac>] (dev_change_flags+0x18/0x48)

    [   99.670108] [<c0637fac>] (dev_change_flags) from [<c064a688>] (do_setlink+0x2bc/0x7f4)

    [   99.678383] [<c064a688>] (do_setlink) from [<c064c5d0>] (rtnl_newlink+0x468/0x6dc)

    [   99.686290] [<c064c5d0>] (rtnl_newlink) from [<c064c914>] (rtnetlink_rcv_msg+0xd0/0x1f4)

    [   99.694740] [<c064c914>] (rtnetlink_rcv_msg) from [<c065fc98>] (netlink_rcv_skb+0xbc/0xe0)

    [   99.703378] [<c065fc98>] (netlink_rcv_skb) from [<c0649dd8>] (rtnetlink_rcv+0x20/0x30)

    [   99.711650] [<c0649dd8>] (rtnetlink_rcv) from [<c065f5e8>] (netlink_unicast+0x160/0x1f0)

    [   99.720096] [<c065f5e8>] (netlink_unicast) from [<c065fa3c>] (netlink_sendmsg+0x2f8/0x370)

    [   99.728743] [<c065fa3c>] (netlink_sendmsg) from [<c061812c>] (sock_sendmsg+0x14/0x24)

    [   99.736923] [<c061812c>] (sock_sendmsg) from [<c0618c6c>] (___sys_sendmsg+0x1ec/0x200)

    [   99.745186] [<c0618c6c>] (___sys_sendmsg) from [<c0619a08>] (__sys_sendmsg+0x40/0x6c)

    [   99.753359] [<c0619a08>] (__sys_sendmsg) from [<c0107600>] (ret_fast_syscall+0x0/0x1c)

    [   99.761614] ---[ end trace ba572216b531688a ]---

    [   99.766561] power up request for already powered up source Wifi

    [   99.772735] Device already up. request source is Wifi

    [   99.778059] WILC_SPI spi1.0 wlan0: INFO [wilc_init_host_int]Host[dd0f0000][de79b000]

    [   99.795516] WILC_SPI spi1.0 wlan0: INFO [wilc_mac_open]*** re-init ***

    [   99.802469] WILC_SPI spi1.0 wlan0: INFO [wlan_init_locks]Initializing Locks ...

    [   99.810128] WILC_SPI spi1.0 wlan0: INFO [wilc_wlan_init]Initializing WILC_Wlan ...

    [ 108.333243] WILC_SPI spi1.0: Failed cmd reset

    [ 108.337943] WILC_SPI spi1.0: Reset and retry 1 24

    [ 108.366478] WILC_SPI spi1.0: Failed internal read protocol...

    [ 108.372493] WILC_SPI spi1.0 wlan0: ERR [wilc_wlan_initialize: 1165] Initializing WILC_Wlan FAILED

    [ 108.381785] WILC_SPI spi1.0 wlan0: INFO [wlan_deinit_locks]De-Initializing Locks

    [ 108.389523] WILC_SPI spi1.0 wlan0: ERR [wilc_wlan_initialize: 1245] WLAN initialization FAILED

    [ 108.398530] WILC_SPI spi1.0 wlan0: ERR [wilc_mac_open: 1295] Failed to initialize wilc

    [ 108.407068] WILC_SPI spi1.0 wlan0: ERR [wilc_send_config_pkt: 1887] [Sendconfigpkt]Set Timed out

    [ 108.416279] WILC_SPI spi1.0 wlan0: ERR [handle_set_wfi_drv_handler: 444] Failed to set driver handler

    [ 108.425941] WILC_SPI spi1.0 wlan0: Host cmd 24 failed

    [ 108.432663] WILC_SPI spi1.0 wlan0: ERR [host_if_work: 2986] [Host Interface] undefined

     

     

    root@casa-dev-mg:~# ifconfig -a

    lo       Link encap:Local Loopback

             inet addr:127.0.0.1 Mask:255.0.0.0

             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:1

             RX bytes:552 (552.0 B) TX bytes:552 (552.0 B)

     

    p2p0     Link encap:Ethernet HWaddr 00:00:00:00:00:00

             BROADCAST MULTICAST MTU:1500 Metric:1

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

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

             collisions:0 txqueuelen:1000

             RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

     

    wlan0     Link encap:Ethernet HWaddr 00:00:00:00:00:00

             BROADCAST MULTICAST MTU:1500 Metric:1

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

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

             collisions:0 txqueuelen:1000

             RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

     

     

    I’m not sure why the driver starts and fails with the gpio init, as those pins aren’t used…

    root@casa-dev-mg:~# ls /sys/class/gpio/

    export gpio111 gpio113 gpio115 gpio117 gpio50 gpio56 gpio96 gpio97 gpio98 gpiochip0 gpiochip32 gpiochip64 gpiochip96 unexport

     

    Please let me know if you need any additional information (full/which logs etc.)

  • I also tried to configure the spi interface as a 3 pin interface with the cs pin set manually per gpio.

    Still this is what I see in the debugfs:
    root@casa-dev-mg:~# ls /sys/bus/spi/devices/spi1.0/ -al
    total 0
    drwxr-xr-x 6 root root 0 Jan 1 01:37 .
    drwxr-xr-x 5 root root 0 Jan 1 01:03 ..
    lrwxrwxrwx 1 root root 0 Jan 1 01:03 driver -> ../../../../../../../bus/spi/drivers/WILC_SPI
    drwxr-xr-x 4 root root 0 Jan 1 01:03 ieee80211
    -r--r--r-- 1 root root 4096 Jan 1 01:36 modalias
    drwxr-xr-x 4 root root 0 Jan 1 01:03 net
    lrwxrwxrwx 1 root root 0 Jan 1 01:36 of_node -> ../../../../../../../firmware/devicetree/base/ocp/spi@48030000/wilc_spi@0
    drwxr-xr-x 2 root root 0 Jan 1 01:36 power
    drwxr-xr-x 2 root root 0 Jan 1 01:36 statistics
    lrwxrwxrwx 1 root root 0 Jan 1 01:03 subsystem -> ../../../../../../../bus/spi
    -rw-r--r-- 1 root root 4096 Jan 1 01:03 uevent


    The Atmel engineer confirmed that the gpios are used as declared in the header file and the errors only refer to those values not being present in the device tree and no SPI communication.

    I'm still missing the spi clock signal.
    As far as i understood, the 3pin mode assumes the AM3352 McSPI to be in master mode with just one slave node.
    Is there still something I have to do to get a clock signal out to the slave in order to be able to communicate?

    The am3352 hw ref guide www.ti.com/.../spruh73p.pdf on page 4892 states that:
    The SPIEN line may remain active between successive transfers. In 3-pin mode without using the SPIEN
    signal, the controller provides the same waveform but with SPIEN forced to low state.

    Does that mean that I can expect the clock to be constantly available or does it need to be enabled by a pullup/-down as stated on page 4885 in section "24.2.2 McSPI Clock and Reset Management", but this only applies to external clocs from an external SPI master(btw this section states that "Neither" mode is supported, but probably there should be a "Either" instead).
  • I wonder if the problem is with the Atmel driver. The first line out of the driver is
    [ 97.416822] wilc_spi: module is from the staging directory, the quality is unknown, you have been warned.

    Steve K.