Atheros AR6003 SDIO WiFi Integration: Difference between revisions

From RidgeRun Developer Wiki
mNo edit summary
Line 16: Line 16:
* AR6K_PKG_FW.build_3.1_RC.329.tgz
* AR6K_PKG_FW.build_3.1_RC.329.tgz
* AR6K_SDK_ISC.build_3.1_RC.329.tgz
* AR6K_SDK_ISC.build_3.1_RC.329.tgz
== Adding drivers to development directory ==
This requires proper credentials as some of the code was provided under NDA.
<pre>
cd $DEVDIR/proprietary
svn co https://source.ridgerun.net/svn/bsp/proprietary/atheros/ar6003/trunk ar6003
svn co  https://source.ridgerun.net/svn/bsp/proprietary/atheros/nv-ar6003/trunk nv-ar6003
make -C $DEVDIR config # Proprietary software -> Atheros AR6003 SDIO Wireless support
cd $DEVDIR/proprietary/ar6003
make VERBOSE=1
cd $DEVDIR/proprietary/nv-ar6003
make VERBOSE=1
</pre>
Long term, only the ar6003 source code directory will be used.  The nv-ar6003 is just for reference.


== Add chip code files to target file system ==
== Add chip code files to target file system ==

Revision as of 16:11, 16 August 2011

Aug 15, 2011 -- This page is only half complete. It still contains SD8686 references.

Open Source project

The Wireless Linux project has an Atheros ath6k driver available.

Helpful links:

Atheros proprietary driver

Atheros provides two tarballs containing their proprietary Linux driver

  • AR6K_PKG_FW.build_3.1_RC.329.tgz
  • AR6K_SDK_ISC.build_3.1_RC.329.tgz

Adding drivers to development directory

This requires proper credentials as some of the code was provided under NDA.

cd $DEVDIR/proprietary
svn co https://source.ridgerun.net/svn/bsp/proprietary/atheros/ar6003/trunk ar6003
svn co  https://source.ridgerun.net/svn/bsp/proprietary/atheros/nv-ar6003/trunk nv-ar6003
make -C $DEVDIR config # Proprietary software -> Atheros AR6003 SDIO Wireless support
cd $DEVDIR/proprietary/ar6003
make VERBOSE=1
cd $DEVDIR/proprietary/nv-ar6003
make VERBOSE=1

Long term, only the ar6003 source code directory will be used. The nv-ar6003 is just for reference.

Add chip code files to target file system

Marvell should have supplied the 88W8686 chip code files with the hardware. These files need to be copied to target file system, with a minor file rename. The driver expects to find these files in /lib/firmware on the target file system.

mkdir -p $DEVDIR/fs/overlay/lib/firmware 
cp /tmp/helper_sd.bin $DEVDIR/fs/overlay/lib/firmware/sd8686_helper.bin
cp /tmp/sd8686.bin $DEVDIR/fs/overlay/lib/firmware

files="$DEVDIR/fs/overlay/lib $DEVDIR/fs/overlay/lib/firmware $DEVDIR/fs/overlay/lib/firmware/sd8686_helper.bin $DEVDIR/fs/overlay/lib/firmware/sd8686.bin"
svn add $files
svn ci -m "Added code images for 88W8686 chipset" $files

Enable kernel drivers

Configure the kernel so there variable are set as follows:

CONFIG_LIBERTAS=m
CONFIG_LIBERTAS_SDIO=m
CONFIG_MMC=y
CONFIG_MMC_DAVINCI=y

Enable helper applications

Configure the Wifi tools so they get built.

CONFIG_FS_APPS_WIRELESS_TOOLS=y
CONFIG_FS_APPS_WPASUPPLICANT=y

AR6003 as a WiFi client

Runtime driver module loading

Boot target hardware without wifi sdio card installed. Install card. You should see:

mmc0: new SDIO card at address 0001


Verifying AR6003 chip properly detected

On a DM365, the following entries should exist in sysfs.


cd /sys/devices/platform/davinci_mmc.0/mmc_host/mmc0/mmc0:0001/mmc0:0001:1
echo class: `cat class`, vendor: `cat vendor`, device: `cat device`

The output should be:

class: 0x00, vendor: 0x0271, device: 0x0301

Verifying SDIO hardware interface configuration

The debugfs file system contains entries that contain the current settings for the MMC/SD/SDIO interface of interest.

mount -t debugfs none /sys/kernel/debug
cat /sys/kernel/debug/mmc0/ios

You should see something like

clock:		50000000 Hz
vdd:		20 (3.2 ~ 3.3 V)
bus mode:	2 (push-pull)
chip select:	0 (don't care)
power mode:	2 (on)
bus width:	2 (4 bits)
timing spec:	2 (sd high-speed)

Video ar6000.ko driver parameters

ls /sys/module/ar6000/parameters

with results similar to

allow_trace_signal      ifname                  setupbtdev
ar3khcibaud             irqprocmode             setuphci
bmienable               logWmiRawMsgs           setuphcipal
busspeedlow             loghci                  skipflash
bypasswmi               mac_addr_method         submode
csumOffload             mbox_yield_limit        targetconf
debuglevel              nohifscattersupport     testmode
devmode                 onebitmode              tspecCompliance
enablerssicompensation  panic_on_assert         tx_attempt
enabletimerwar          processDot11Hdr         tx_complete
enableuartprint         reduce_credit_dribble   tx_post
eppingtest              regcode                 war23838_disabled
firmware_bridge         regscanmode             wlanNodeCaching
hciuartscale            reset_sdio_on_unload    wlaninitmode
hciuartstep             resetok                 wmitimeout
hifBusRequestNumMax     rtc_reset_only_on_exit


Installing Libertas WiFi module

modprobe libertas

Output will only be generated if there is an error.

Installing Libertas SDIO module

modmodprobe ar6000

You should see:


If you don't see any output, you may need to increase the printk debug level:

echo 8 > /proc/sys/kernel/printk

or you can look in the kernel message buffer

dmesg | tail -n 6

Verifying wlan0 exists

Make sure Linux network interface and wireless LAN interface are both found

ifconfig wlan0
iwconfig wlan0

You should get output like:

wlan0     Link encap:Ethernet  HWaddr 00:19:88:3D:D3:77  
          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)

and for iwconfig, the output will be similar to:

wlan0     IEEE 802.11b/g  ESSID:""  
          Mode:Managed  Frequency:2.412 GHz  Access Point: Not-Associated   
          Bit Rate:0 kb/s   Tx-Power=15 dBm   
          Retry short limit:8   RTS thr=2347 B   Fragment thr=2346 B   
          Encryption key:off
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Power on WiFi sub-system

ifconfig wlan0 up

No output will be generated if successful.

Scan for access points

iwlist wlan0 scan

which lists access points that are in range, like:

wlan0     Scan completed :
          Cell 01 - Address: 00:12:25:57:61:B5
                    ESSID:"Hawley"
                    Mode:Managed
                    Frequency:2.462 GHz (Channel 11)
                    Quality=97/100  Signal level=-28 dBm  Noise level=-96 dBm
                    Encryption key:off
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
                              24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s
                              12 Mb/s; 48 Mb/s

Attaching WiFi to access point

Security disabled

iwconfig wlan0 essid "Hawley"

WEP security

iwconfig wlan0 essid "Hawley"
iwconfig wlan0 key 0001020304

WPA security

mkdir -p /etc/wpa_supplicant
cat <<EOF >/etc/wpa_supplicant/wpa_supplicant.conf
# Example wpa_supplicant 
network={
	ssid="Baily"
	psk="very secret passphrase"
	priority=5
}
EOF

wpa_supplicant -d -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -Dwext &

With debug output enabled, you will have lots of information on what is not working if you run into a problem.

Verifying access point association

You can check you are associated with an access point using

iwconfig wlan0

With example output being:

wlan0     IEEE 802.11b/g  ESSID:"Baily"  
          Mode:Managed  Frequency:2.437 GHz  Access Point: 00:13:10:EA:BD:66   
          Bit Rate:1 Mb/s   Tx-Power=13 dBm   
          Retry short limit:8   RTS thr=2347 B   Fragment thr=2346 B   
          Encryption key:<too big>   Security mode:open
          Power Management:off
          Link Quality=95/100  Signal level=-44 dBm  Noise level=-89 dBm
          Rx invalid nwid:0  Rx invalid crypt:121  Rx invalid frag:0
          Tx excessive retries:6  Invalid misc:13   Missed beacon:0

If you are having trouble associating with an access point, I find connecting to the AP with my laptop is a good way to verify the AP is configured as expected.

Configuring IP networking

ifconfig wlan0 10.111.0.157
route add -net 0.0.0.0 gw 10.111.0.1 netmask 0.0.0.0 dev wlan0
route -n

With example output:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.111.0.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 wlan0
0.0.0.0         10.111.0.1      0.0.0.0         UG    0      0        0 wlan0
0.0.0.0         10.111.0.1      0.0.0.0         UG    0      0        0 eth0

Note that the routing table is traversed from top to bottom, so packets for the Internet will go out wlan0 since that entry is closer to the top.

Functional test

The Google nameserver, which supports ping, is at IP address 8.8.8.8.

ping -c 5 8.8.8.8

Unconfiguring WiFi client mode of operation

ifconfig wlan0 down
rmmod libertas_sdio
rmmod libertas


Problems and how to fix them

configuration opcode 7 is only used for RTOS systems, not Linux systems

When you load the ar6000 kernel module, you may see

Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
AR6000: configuration opcode 7 is only used for RTOS systems, not Linux systems
 Timeout waiting for recv message 
Target debug interrupt
ar6000_target_failure: target asserted