PICO-PI-IMX7: Using later kernels since 5.6.x

Hey all,

I’ve been using the 5.6.x kernel on my IMX7 with much success; touchscreen, colour display, both CPU’s etc all working perfectly after following the wiki build instructions.

I’d used the 5.4.x build originally but changed to 5.6.x based on a message posted to this forum.

However, I still haven’t had any luck with the WiFi (AP6335 module with my board) and was wondering if it has been resolved in later kernel releases.

Is there a list somewhere showing what’s changed at each iteration until the current build of 5.11.x?

Also, has anyone any idea if I can use the camera module that ships with this board? It’s a CAM-OV5645 revision A1.

Hi @bampan, sorry personally haven’t had much luck with the AP6335 on this board… This is the firmware i’m borrowed from TechNexion, as they no longer host it on their download site…

I’m not sure if the Camera is supported on mainline yet…

Looking at NXP’s repo:

I see some patches we can test to see if we can get WiFi working on mainline…

Regards,

Brilliant, thanks.

I’ll try the AP6335_4.2 WiFi stuff today.

I hadn’t really thought about the Bluetooth hardware (I see the folder in your github), so I’ll add that to the list of things to do/check.

When I initially got the androidthings kit the camera and WiFi were functional, so it’s become a bit of a personal challenge for me to get them working under Debian too.

Hi Robert,

I’ve managed to get the WiFi working perfectly, thank you. I used the AP6335_4.2 firmware and it’s running brilliantly.

Thanks.

Did you manage to make camera working?
I remember it working correctly on Android, as Android things kit, but never again.

Hi, I’m afraid I didn’t. I also had mine working on the Android things kit, so I know it should work, but I’ve never got it to work with Linux.
If you make any progress please let me know

Hey this sounds amazing!
I downloaded the files from sdk-firmware/technexion/Broadcom/AP6335_4.2 at master · rcn-ee/sdk-firmware · GitHub but it’s unclear to me how to “install” it to a live Pico i.MX7D system running Ubuntu 22.04 from TechNexion’s image. I suspect I need to copy the files to /lib/firmware/brcm/ but I don’t know what to do afterwards. Can you shed some light on how to achieve this? Thanks!

I’d assume TechNexion’s image by default would have the firmware, as that’s where i got it from…

Nope, i assumed wrong:

voodoo@hestia:~/Downloads$ sha256sum ubuntu-22.04.xz 
d23c04fe49b2537e5240f4b448f4d43f720d80ebb057d0bb62238a13b1a5b3ef  ubuntu-22.04.xz

Copy them to /usr/lib/firmware/

and run:

sudo update-initramfs -uk uname -r

Regards,

Thanks a lot for the answer. It’s really appreciated. I took the time to research a bit more to reduce the need for back-and-forth, so this post is a bit long. I hope you don’t mind.

initramfs

I recreated the initramfs with the additional files listed above but there’s was no visible impact.

sudo apt install initramfs-tools
mkdir wifi
cd wifi
wget -c https://github.com/rcn-ee/sdk-firmware/raw/refs/heads/master/technexion/Broadcom/AP6335_4.2/Wi-Fi/nvram_ap6335.txt
wget -c https://github.com/rcn-ee/sdk-firmware/raw/refs/heads/master/technexion/Broadcom/AP6335_4.2/Wi-Fi/fw_bcm4339a0_ag.bin
wget -c https://github.com/rcn-ee/sdk-firmware/raw/refs/heads/master/technexion/Broadcom/AP6335_4.2/Wi-Fi/fw_bcm4339a0_ag_apsta.bin

sudo mkdir -p /usr/lib/firmware/brcm
sudo cp * /usr/lib/firmware/brcm
sudo update-initramfs -u -k $(uname -r)

# Reboot and check logs:
sudo shutdown -r now
dmesg | grep br

OS image

Here’s what I used to flash my device from a linux machine. I’m using the base image from: Index of /images/pico-imx7/pi-lcd800x480/

sudo apt-get install libusb-1.0.0-dev libzip-dev libbz2-dev

# Tool:
wget -c https://download.technexion.com/development_resources/development_tools/installer/imx-mfg-uuu-tool.zip
unzip imx-mfg-uuu-tool.zip

# Image:
wget -c https://download.technexion.com/images/pico-imx7/pi-lcd800x480/ubuntu-22.04.xz
xz --decompress ubuntu-22.04.xz

# Flash:
sudo ../imx-mfg-uuu-tool/uuu/linux64/uuu -b emmc_imx7_img imx-mfg-uuu-tool/imx7/pico-imx7/imx7-SPL imx-mfg-uuu-tool/imx7/pico-imx7/imx7-u-boot.img ubuntu-22.04

firmware

The spec says the board has a QCA9377. And indeed I found the files there once I knew where to look:

$ ls -l /usr/lib/firmware/qca9377
-rwxr-xr-x 1 root root   8124 Apr 26  2024 bdwlan30.bin
-rwxr-xr-x 1 root root  25057 Apr 26  2024 otp30.bin
-rwxr-xr-x 1 root root 619364 Apr 26  2024 qwlan30.bin
-rwxr-xr-x 1 root root 372688 Apr 26  2024 utf30.bin

There’s also a ton of files in /usr/lib/firmware/qca/.

modules

$ lsmod
Module                  Size  Used by
ov5640_camera_mipi_v2    24576  0
zram                   32768  2
caam_jr               163840  0
caamkeyblob_desc       16384  1 caam_jr
caamhash_desc          16384  1 caam_jr
caamalg_desc           65536  1 caam_jr
crypto_engine          16384  1 caam_jr
authenc                16384  1 caam_jr
libdes                 28672  1 caam_jr
mx6s_capture           24576  0
mxc_mipi_csi           20480  1
binfmt_misc            20480  1

$ uname -a
Linux technexion 5.15.71 #1 SMP PREEMPT Fri Apr 26 15:52:59 CST 2024 armv7l armv7l armv7l GNU/Linux

Interestingly, ov5640_camera_mipi_v2 is there! So maybe there’s a intent to make the camera module work?

This has no effect:

$ sudo modprobe -v ath10k_pci
insmod /lib/modules/5.15.71/kernel/drivers/net/wireless/ath/ath.ko
insmod /lib/modules/5.15.71/kernel/drivers/net/wireless/ath/ath10k/ath10k_core.ko
insmod /lib/modules/5.15.71/kernel/drivers/net/wireless/ath/ath10k/ath10k_pci.ko

$ lsmod
Module                  Size  Used by
ath10k_pci             40960  0
ath10k_core           380928  1 ath10k_pci
ath                    32768  1 ath10k_core
ov5640_camera_mipi_v2    24576  0
zram                   32768  2
caam_jr               163840  0
caamkeyblob_desc       16384  1 caam_jr
caamhash_desc          16384  1 caam_jr
caamalg_desc           65536  1 caam_jr
crypto_engine          16384  1 caam_jr
authenc                16384  1 caam_jr
libdes                 28672  1 caam_jr
mx6s_capture           24576  0
mxc_mipi_csi           20480  1
binfmt_misc            20480  1

$ sudo find /sys -name "ath*"
/sys/bus/pci/drivers/ath10k_pci
/sys/module/ath
/sys/module/ath/holders/ath10k_core
/sys/module/ath10k_pci
/sys/module/ath10k_core
/sys/module/ath10k_core/holders/ath10k_pci

I’m guessing the module is configured but the device is not?

sources scavenging

On my workstation, I validated that the right driver is ath10k:

$ git clone https://github.com/TechNexion/linux-tn-imx
$ cd linux-tn-imx
$ git checkout tn-kirkstone_5.15.71-2.2.2_20240220
$ git grep qca9377
Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml:      - qcom,qca9377-bt
arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts:              compatible = "qcom,qca9377-bt";
drivers/bluetooth/hci_qca.c:    { .compatible = "qcom,qca9377-bt" },
drivers/net/wireless/ath/ath10k/core.c:         .name = "qca9377 hw1.0",
drivers/net/wireless/ath/ath10k/core.c:         .name = "qca9377 hw1.1",
drivers/net/wireless/ath/ath10k/core.c:         .name = "qca9377 hw1.1 sdio",
drivers/net/wireless/ath/ath10k/hw.h:enum qca9377_chip_id_rev {
drivers/net/wireless/ath/ath10k/pci.c: * Support to access target space below 1M for qca6174 and qca9377.

I decided to look at TechNexion’s script and what they used to build ubuntu 22.04 versus their current master and I found this:

$ git clone https://github.com/TechNexion-customization/ubuntu-tn-imx
$ cd ubuntu-tn-imx
$ git diff v22.04-lts-02 -- gen_rootfs.sh
diff --git gen_rootfs.sh gen_rootfs.sh
index 17ebdc2..851625c 100755
--- gen_rootfs.sh
+++ gen_rootfs.sh
@@ -46,6 +46,30 @@ gen_pure_rootfs() {
   fi
   sync

+  # Install QCA9377 firmware
+  local qca_fw_url="https://oauth2:SbtQ_mC4fvJRA88_9jB7@gitlab.com/technexion-imx/qca_firmware.git"
+  local qca_fw_branch="caf-wlan/CNSS.LEA.NRT_3.0"
+  local fw_src="${TOP}/qca_firmware"
+  rm -rf ${fw_src}
+  git clone ${qca_fw_url} -b ${qca_fw_branch} ${fw_src}
+
+  local fw_dst="${TOP}/rootfs/usr/lib/firmware"
+  for p in qca9377 qca6174; do
+    install -d ${fw_dst}/${p}/
+    for f in bdwlan30 otp30 qwlan30 utf30; do
+      install -m 0755 ${fw_src}/${p}/${f}.bin ${fw_dst}/${p}/
+    done
+
+    install -d ${fw_dst}/wlan/${p}/
+    install -m 0755 ${fw_src}/wlan/${p}/qcom_cfg.ini ${fw_dst}/wlan/${p}/
+  done
+  install -m 0755 ${fw_src}/wlan/cfg.dat ${fw_dst}/wlan/
+
+  install -d ${fw_dst}/qca
+  install -m 0755 ${fw_src}/qca/nvm_tlv_3.2.bin ${fw_dst}/qca
+  install -m 0755 ${fw_src}/qca/rampatch_tlv_3.2.tlv ${fw_dst}/qca
+  unset qca_fw_url qca_fw_branch fw_src fw_dst
+
   if [[ $(echo $1 | grep "imx8") ]]; then

     # fs-overlay

Fascinating but red herring.

ubuntu-tn-imx/README-imx6.md at master · TechNexion-customization/ubuntu-tn-imx · GitHub mentions the firmware files and all the files mentioned there are in the base image. So that’s not the problem.

$ git clone https://github.com/TechNexion/u-boot-tn-imx
$ cd u-boot-tn-imx
$ git tag | grep 5.15
$ git checkout tn-kirkstone_5.15.71-2.2.2_20240220
$ git grep 9377
(didn't provide anything useful)

I feel there’s really just a silly simple thing missing. :frowning: I glanced at yocto configuration files, there’s more stuff there but I don’t know how to apply the knowledge in my situation.

I just learned about the lshw command.

$ sudo lshw -short
H/W path  Device            Class          Description
======================================================
                            system         TechNexion PICO-IMX7D with QCA WLAN module and PI baseboard
/0                          bus            Motherboard
/0/0                        processor      cpu
/0/1                        processor      cpu
/0/2                        memory         487MiB System memory
/1        usb1              bus            EHCI Host Controller
/1/1      input1            input          Dell KB216 Wired Keyboard Consumer Control
/2        mmc0              bus            MMC Host
/3        mmc1              bus            MMC Host
/3/1                        generic        SDIO Device
/3/1/1    mmc1:0001:1       generic        4335/4339
/3/1/2    mmc1:0001:2       generic        4335/4339
/3/1/3    mmc1:0001:3       communication  4335/4339
/4        mmc2              bus            MMC Host
/4/1                        generic        M62704
/4/1/1    /dev/mmcblk2rpmb  generic
/4/1/2    /dev/mmcblk2      generic
/4/1/2/1  /dev/mmcblk2p1    volume         15EiB Windows FAT volume
/4/1/2/2  /dev/mmcblk2p2    volume         3608MiB EXT4 volume
/5        card0             multimedia     audiosgtl5000
/6        /dev/fb0          display        mxs-lcdif
/7        /dev/fb1          display        FG
/8        input0            input          generic ft5x06 (82)
/9        eth0              network        Ethernet interface
$  sudo lshw -class generic
  *-device
       description: SDIO Device
       physical id: 1
       bus info: mmc@1:0001
       serial: 0
       capabilities: sdio
     *-interface:0
          product: 4335/4339
          vendor: Broadcom
          physical id: 1
          bus info: mmc@1:0001:1
          logical name: mmc1:0001:1
     *-interface:1
          product: 4335/4339
          vendor: Broadcom
          physical id: 2
          bus info: mmc@1:0001:2
          logical name: mmc1:0001:2
  *-device
       description: SD/MMC Device
       product: M62704
       vendor: Unknown (112)
       physical id: 1
       bus info: mmc@2:0001
       date: 04/2018
       serial: 46758551
       capabilities: mmc
     *-interface:0
          physical id: 1
          logical name: /dev/mmcblk2rpmb
     *-interface:1
          physical id: 2
          logical name: /dev/mmcblk2
          size: 3825205248
          capabilities: partitioned partitioned:dos
          configuration: logicalsectorsize=512 sectorsize=512 signature=710335fb

$ sudo lshw -class communication
  *-bt
       description: BlueTooth interface
       product: 4335/4339
       vendor: Broadcom
       physical id: 3
       bus info: mmc@1:0001:3
       logical name: mmc1:0001:3
       capabilities: wireless bluetooth
       configuration: wireless=BlueTooth

Cross-checking with dmesg:

$ dmesg | grep -e mmc[0-9]
[    2.055109] mmc2: SDHCI controller on 30b60000.mmc [30b60000.mmc] using ADMA
[    2.062281] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA
[    2.081559] mmc0: SDHCI controller on 30b40000.mmc [30b40000.mmc] using ADMA
[    2.132498] mmc2: new DDR MMC card at address 0001
[    2.145746] mmcblk2: mmc2:0001 M62704 3.56 GiB
[    2.156818] mmcblk2boot0: mmc2:0001 M62704 2.00 MiB
[    2.163696] mmcblk2boot1: mmc2:0001 M62704 2.00 MiB
[    2.170678] mmcblk2rpmb: mmc2:0001 M62704 512 KiB, chardev (244:0)
[    2.191231] mmc1: new high speed SDIO card at address 0001

Checking compatibility:

$ cat /sys/firmware/devicetree/base/soc/bus@30800000/mmc@30b50000/compatible
fsl,imx7d-usdhcfsl,imx6sl-usdhc

$ cat /sys/firmware/devicetree/base/compatible
fsl,pico-imx7dfsl,imx7d

$ cat /sys/firmware/devicetree/base/model
TechNexion PICO-IMX7D with QCA WLAN module and PI baseboard

That’s confusing.

Broadcom brcmsmac(PCIe) and brcmfmac(SDIO/USB) drivers — Linux Wireless documentation seems to be what I’m looking for. BCM4335/BCM4339 are explicitly supported by brcmfmac. It seems to me that the problem is that the driver is not compiled in the kernel. This is odd if this is indeed the problem.