Enabling SDIO WiFi on Zynq

Introduction

The purpose of this page is to describe how to enable wireless connectivity for ZC702 running Linux.

Test Setup

Board: ZC702
Kernel: Linux 3.5 (uses uImage and uramdisk)
Wireless card in SDIO slot: Atheros AR6103 (see http://wireless.kernel.org/en/users/Drivers/Atheros)
Connection: Wired connection from host (192.168.1.2) to wireless access point (linksys, 192.168.1.1). Once the steps documented on this page have been followed, there will be a wireless connection between ZC702 (192.168.1.10) and the access point.

Boot Linux with Wireless Capabilities

Download and build Linux

See http://wiki.xilinx.com/zynq-linux for details on downloading and building Linux.

Download the latest Xilinx kernel:

bash> git clone git://git.xilinx.com/linux-xlnx.git

Configure the kernel for Zynq:

bash> make ARCH=arm xilinx_zynq_defconfig

To compile the SDIO wireless driver as a loadable kernel module, configure the kernel:

bash> make ARCH=arm menuconfig

Use the following configurations:

-> Networking support (CONFIG_NET [=y])
 -> Wireless (CONFIG_WIRELESS [=y])
  -> cfg80211 (CONFIG_CFG80211 [=y])
-> Device Drivers
 -> Generic Driver Options
  -> Userspace firmware loading support (CONFIG_FW_LOADER [=y])
   -> Include in-kernel firmware blobs in kernel binary (CONFIG_FIRMWARE_IN_KERNEL [=n])
 -> Network device support (CONFIG_NETDEVICES [=y])
  -> Wireless LAN (CONFIG_WLAN [=y])
   -> Atheros Wireless Cards (CONFIG_ATH_COMMON [=y])
    -> Atheros mobile chipsets support (CONFIG_ATH6KL [=y])
     -> Atheros ath6kl SDIO support (CONFIG_ATH6KL_SDIO [=m])

Build the kernel and the driver:

bash> make ARCH=arm uImage
bash> make ARCH=arm modules

Build the device tree blob:

bash> make ARCH=arm zynq-zc702.dtb

Result:
<linux build dir>/drivers/net/wireless/ath/ath6kl/ath6kl_sdio.ko
<linux build dir>/arch/arm/boot/uImage
<linux build dir>/arch/arm/boot/zynq-zc702.dtb

Create a root filesystem

See http://wiki.xilinx.com/zynq-rootfs to produce root filesystem.
A framework such as Buildroot (http://buildroot.uclibc.org/) might be useful in creating a root filesystem.

Copy <linux build dir>/drivers/net/wireless/ath/ath6kl/ath6kl_sdio.ko onto the root filesystem.

Download the latest firmware:

bash> git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git

Cross-compile iwconfig (http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html) and copy it to the root filesystem (/usr/sbin).

Copy <linux-firmware>/ath6k to /lib/firmware/ath6k on the root filesystem.

Copy /lib/firmware/ath6k/AR6003/hw2.1.1/bdata.SD31.bin to /lib/firmware/ath6k/AR6003/hw2.1.1/bdata.bin on the root filesystem. The following result might occur otherwise (as of 2012/10/09):

ath6kl: Failed to get board file ath6k/AR6003/hw2.1.1/bdata.bin (-2), trying to find default board file.
ath6kl: WARNING! No proper board file was not found, instead using a default board file.
ath6kl: Most likely your hardware won't work as specified. Install correct board file!

Result:
uramdisk.image.gz

Boot Linux on Zynq

-> http://wiki.xilinx.com/zc702-boot-from-flash for an example of how to boot from flash.
-> http://wiki.xilinx.com/zc702-linux for an example of how to boot from an SD card.
*Note: Make sure to rename the device tree blob (*.dtb) to devicetree.dtb as this is what U-Boot expects for some of the boot modes (such as SD boot).

Enable wireless connectivity

Now that Linux is running on Zynq…

Setup

Load the wireless driver:

zynq> insmod ath6kl_sdio.ko
ath6kl: temporary war to avoid sdio crc error
ath6kl: ar6003 hw 2.1.1 sdio fw 3.2.0.144 api 3

Setup wireless connection between the board and the Host:

zynq> iwconfig wlan0 essid 'linksys'
zynq> ifconfig wlan0 192.168.1.10
zynq> iwconfig
lo        no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"linksys"
          Mode:Managed  GEM: ioctl 35585 not implemented.
Frequency:2.462 GHz  Access Point: 00:16:B6:2A:AD:05
          Bit Rate=54 Mb/s   Tx-Power=15 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on
          Link Quality=62/70  Signal level=-48 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

eth0      no wireless extensions.
zynq> ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0A:35:00:01:22
          inet addr:10.10.71.1  Bcast:10.10.71.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:542 errors:0 dropped:0 overruns:0 frame:0
          TX packets:124 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:753923 (736.2 KiB)  TX bytes:14397 (14.0 KiB)
          Interrupt:54 Base address:0xb000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1020 (1020.0 B)  TX bytes:1020 (1020.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:03:7F:BE:F0:A0
          inet addr:192.168.1.10  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:31 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4900 (4.7 KiB)  TX bytes:4455 (4.3 KiB)

Test

Now, there is a wireless connection between ZC702 and the host. We can SFTP:
host

host> sftp root@192.168.1.10
Connecting to 192.168.1.10...
root@192.168.1.10's password: root
sftp> ls /
/README          /ath6kl_sdio.ko  /bin             /dev             /etc             /home            /lib
/licenses        /linuxrc         /lost+found      /mnt             /opt             /proc            /root
/sbin            /sys             /tmp             /update_qspi.sh  /usr             /var
sftp>
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License