Add SD8787 to Linux Mainline Apalis T30

I am trying to add Wifi Support to our Apalis T30 Mainline-Linux image, based on poky-tiny. The Wifi module is uBlox ELLA-131 (Marvel SD8787). I think I’ve successfully built the kernel. I added Marvel EX driver for SD8787. Additionally, I downloaded the firmware, and compiled it directly into the kernel. Does my boot log look successful?

[    5.736504] tegra-ehci 7d008000.usb: new USB bus registered, assigned bus number 2
[    5.744688] tegra-ehci 7d008000.usb: irq 96, io mem 0x7d008000
[    5.775362] tegra-ehci 7d008000.usb: USB 2.0 started, EHCI 1.00
[    5.782334] hub 2-0:1.0: USB hub found
[    5.786156] hub 2-0:1.0: 1 port detected
[    5.790954] iommu: Adding device ci_hdrc.0 to group 73
[    5.800323] sdhci-tegra 78000000.sdhci: Got CD GPIO
[    5.813507] mmc2: Invalid maximum block size, assuming 512 bytes
[    5.875811] mmc2: SDHCI controller on 78000000.sdhci [78000000.sdhci] using ADMA
[    5.883785] sdhci-tegra 78000400.sdhci: Got CD GPIO
[    5.895949] mmc1: Invalid maximum block size, assuming 512 bytes
[    5.955804] mmc1: SDHCI controller on 78000400.sdhci [78000400.sdhci] using ADMA
[    5.970976] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    5.977654] [drm] No driver support for vblank timestamp query.
[    6.008826] mmc1: new high speed SDIO card at address 0001
[    6.104171] Console: switching to colour frame buffer device 128x48
[    6.127151] drm drm: fb0:  frame buffer device
[    6.131712] [drm] Initialized tegra 0.0.0 20120330 for drm on minor 0
[    6.139571] input: gpio-keys as /devices/soc0/gpio-keys/input/input1
[    6.148185] hctosys: unable to open rtc device (rtc0)
[    6.206459] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    6.712285] mwifiex_sdio mmc1:0001:1: info: FW download over, size 463240 bytes
[    6.835430] mwifiex_sdio mmc1:0001:1: WLAN FW is active
[    7.075999] mwifiex_sdio mmc1:0001:1: CMD_RESP: cmd 0x242 error, result=0x2
[    7.083075] mwifiex_sdio mmc1:0001:1: mwifiex_process_cmdresp: cmd 0x242 failed during       initialization
[    8.065844] igb 0000:01:00.0 eth0: igb: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX
[    8.104403] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    8.125685] Sending DHCP and RARP requests .
[    8.125780] NOHZ: local_softirq_pending 08
[    8.137311] NOHZ: local_softirq_pending 28a
[    8.144488] NOHZ: local_softirq_pending 2ca
[    8.151660] NOHZ: local_softirq_pending 2ca
[    8.158771] NOHZ: local_softirq_pending 2ca
[    8.165844] NOHZ: local_softirq_pending 2ca
[    8.172828] NOHZ: local_softirq_pending 2ca
[    8.179748] NOHZ: local_softirq_pending 2ca
[    8.186650] NOHZ: local_softirq_pending 2ca
[    8.201662] mwifiex_sdio mmc1:0001:1: info: MWIFIEX VERSION: mwifiex 1.0 (14.66.35.p52)
[    8.212594] mwifiex_sdio mmc1:0001:1: driver_version = mwifiex 1.0 (14.66.35.p52)

I then added CORE_IMAGE_EXTRA_INSTALL += “packagegroup-base-wifi” to my local.conf. Is there a way to add this to meta_my_poky layer instead of local.conf?

If I do ifconfig, I don’t get any WLAN device in the list. wpa_cli gives a message "could not connect to wpa_supplicant: (nil) - retrying. It’s possible I am missing some configuration. I feel like I got the hard part right, loading the kernel driver and firmware, but am missing something obvious.

Does my boot log look successful?

No, I don’t think so.

  1. [ 7.075999] mwifiex_sdio mmc1:0001:1: CMD_RESP: cmd 0x242 error, result=0x2
    25. [ 7.083075] mwifiex_sdio mmc1:0001:1: mwifiex_process_cmdresp: cmd 0x242 failed during initialization
    I guess above is the issue which may be worked around according to the information I found googling here.

I then added CORE_IMAGE_EXTRA_INSTALL += “packagegroup-base-wifi” to my local.conf. Is there a way to add this to meta_my_poky layer instead of local.conf?

Yes, you would just bbappend resp. image recipe or even create your own as e.g. outlined here.

If I do ifconfig, I don’t get any WLAN device in the list. wpa_cli gives a message "could not connect to wpa_supplicant: (nil) - retrying. It’s possible I am missing some configuration. I feel like I got the hard part right, loading the kernel driver and firmware, but am missing something obvious.

Really looks like a driver issue. On your particular device, certain commands seem unsupported.

The command that isn’t supported is set country code. It is normal for that to fail. I applied the patch you mentioned, and it just skipped that config step and did the same thing.

Is this the correct firmware version for u-Blox ELLA-W131 (WiBear) - mwifiex 1.0 (14.66.35.p52)?

How do I enable more debugging to get more info at the driver level? Are there any known issues with MMC1 on Apalis T30 with mainline, other than the toradex 4.14.y mainline patches?

I figured out how to mount debugfs as per the driver README.
mkdir /debugfs. mkdir /debugfs; mount -t debugfs debugfs /debugfs

cat /debugfs/mwifiex/mlan0/info

[ 1161.479189] mwifiex_sdio mmc1:0001:1: info: MWIFIEX VERSION: mwifiex 1.0 (14.66.35.p52)
driver_name = "mwifiex"
driver_[ 1161.498176] mwifiex_sdio mmc1:0001:1: info: MWIFIEX VERSION: mwifiex 1.0 (14.66.35.p52)
version = mwifiex 1.0 (14.66.35.p52)
verext = w8787-Ax, RF878X, FP66, 14.66.35[ 1161.512632] mwifiex_sdio mmc1:0001:1: info: MWIFIEX VERSION: mwifiex 1.0 (14.66.35.p52)
.p52, BT_SDIO
interface_name="mlan0"
bss_mode="STATION"
media_state="Disconnected"
mac_address="cc:f9:57:0b:30:65"
multicast_count="1"
essid=""
bssid="00:00:00:00:00:00"
channel="0"
country_code = ""
region_code="0x10"
multicast_address[0]="33:33:00:00:00:01"
num_tx_bytes = 0
num_rx_bytes = 0
num_tx_pkts = 0
num_rx_pkts = 0
num_tx_pkts_dropped = 0
num_rx_pkts_dropped = 0
num_tx_pkts_err = 0
num_rx_pkts_err = 0
carrier on
tx queue 0:started 1:started 2:started 3:started

There is nothing wrong with you wifi. You can veryfi it by running

rfkill unblock all

iw dev mlan0 scan

What are you trying to do with WiFi?

I managed to get uBlox ELLA-W131 (Marvell SD8787) working with toradex-mainline 4.14.y. For the kernel, I changed networking->wireless->mcf80211 to y. Driver->Network Device->Wireless LAN->Marvel Wifi-EX Drive and SD8787 to yes. I added Driver->Generic Driver Options->Include in-kernel firmware blob as mrvl/sd8787_uapsta.bin. Add to build/local.conf: CORE_IMAGE_EXTRA_INSTALL += “packagegroup-base-wifi”

Add the .bbappend for the driver firmware.

    SRC_URI_append_apalis-t30-mainline = " \
        file://sd8787_uapsta.bin \
    "
    do_configure_prepend_apalis-t30-mainline () {
        mkdir -p ${S}/firmware/mrvl
        cp ${WORKDIR}/sd8787_uapsta.bin ${S}/firmware/mrvl/
    }

-ifconfig mlan0 up. It failed the first time, but always succeeds on second attempt.

edit /etc/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1

network={
        key_mgmt=WPA-PSK
        ssid="myssid"
        psk="mypsk"
}

wpa_supplicant -imlan0 -c/etc/wpa_supplicant.conf -B (-B run in background once working)
udhcp -i mlan0

At this point, I had an IP address for mlan0 and registered to the AP. So i unplugged the wired ethernet and issue ifconfig eth0 down and ping over the wireless, and it works. Hopefully some of this is useful to someone else, but I am happy to have it working.

Congratulations and thanks for sharing!