In this page, we tested a SDIO extend card with Marvell 8686 WIFI module, via BF548-EZKIT SD Host controller. We use 2009R1 uclinux-dist.
Kernel Configure
-
wireless network stack:
Networking ---> [*] Networking support Wireless ---> <*> Improved wireless configuration API [*] nl80211 new netlink interface support [*] Old wireless static regulatory definitions -*- Wireless extensions [*] Wireless extensions sysfs files <*> Generic IEEE 802.11 Networking Stack (mac80211)
-
Blackfin SD Host driver:
Device Drivers ---> <*> MMC/SD card support ---> *** MMC/SD Host Controller Drivers *** <*> Blackfin Secure Digital Host support [*] Blackfin EZkit Missing SDH_CMD Pull Up Resistor Workaround [*] Enable sdio irq for sdio device
-
libertas driver: For details about libertas, see linux wireless
Device Drivers ---> [*] Network device support ---> Wireless LAN ---> [*] Wireless LAN (IEEE 802.11) <M> Marvell 8xxx Libertas WLAN driver support <M> Marvell Libertas 8385 and 8686 SDIO 802.11b/g cards [*] Support transferring block with size of power-of-2 only [*] Enable full debugging output in the Libertas module.
-
Disable Nand flash controller support, because the Nand flash controller use the same DMA channel as SDH
Device Drivers ---> <*> Memory Technology Device (MTD) support ---> <*> NAND Device Support ---> < > Blackfin on-chip NAND Flash Controller driver
Setup Wifi
-
Build wireless network tools:
Network Applications ---> --- Wireless-tools [*] wireless_tools support [*] iwconfig [*] iwgetid [*] iwlist [*] iwpriv [*] iwspy
-
Add libertas firmware to rootfs: For details of the non-free firmware, see linux wireless - libertas driver
$ cd uclinux-dist $ mkdir romfs/lib/firmware $ cp …/sd8686.bin …/sd8686_helper.bin romfs/lib/firmware
Kernel Testing
Build the kernel image. Download to BF548-EZkit and boot.
- If the SDH driver found the card, there would be a message like:
mmc0: new SDIO card at address 0001
-
Load libertas driver:
root:/> modprobe libertas root:/> modprobe libertas_sdio helper_name=sd8686_helper.bin fw_name=sd8686.bin libertas_sdio: Libertas SDIO driver libertas_sdio: Copyright Pierre Ossman firmware: requesting sd8686_helper.bin firmware: requesting sd8686.bin libertas: 00:13:e0:a1:69:92, fw 9.70.3p24, cap 0x00000303 libertas: unidentified region code; using the default (USA) libertas: PREP_CMD: command 0x00a3 failed: 2 libertas: PREP_CMD: command 0x00a3 failed: 2 libertas: eth1: Marvell WLAN 802.11 adapter
Connect to an Access Point (Managed Mode)
-
Check eth1
root:/> iwconfig eth1 eth1 IEEE 802.11b/g ESSID:"" Mode:Managed Frequency:2.412 GHz Access Point: Not-Associated Bit Rate:0 kb/s Tx-Power=18 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
-
scan for available APs :
root:/> ifconfig eth1 up root:/> iwlist eth1 scan eth1 Scan completed : Cell 01 - Address: 00:1C:F9:C0:73:00 ESSID:"ADIWLAN" Mode:Managed Frequency:2.412 GHz (Channel 1) Quality=99/100 Signal level=-47 dBm Noise level=-96 dBm Encryption key:on Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s 11 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s 48 Mb/s; 54 Mb/s IE: WPA Version 1 Group Cipher : TKIP Pairwise Ciphers (1) : TKIP Authentication Suites (1) : 802.1x Cell 02 - Address: 00:1C:F9:C0:73:01 ESSID:"ADICHINA" Mode:Managed Frequency:2.412 GHz (Channel 1) Quality=99/100 Signal level=-48 dBm Noise level=-96 dBm Encryption key:on Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s 11 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s 48 Mb/s; 54 Mb/s IE: WPA Version 1 Group Cipher : TKIP Pairwise Ciphers (1) : TKIP Authentication Suites (1) : 802.1x [snip]
-
Connect to AP:
root:/> iwconfig eth1 essid linksys root:/> ifconfig eth1 192.168.1.101 up root:/> iwconfig eth1 eth1 IEEE 802.11b/g ESSID:"linksys" Mode:Managed Frequency:2.437 GHz Access Point: 00:1A:70:D4:94:C7 Bit Rate:0 kb/s Tx-Power=13 dBm Retry short limit:8 RTS thr=2347 B Fragment thr=2346 B Encryption key:off Power Management:off Link Quality=95/100 Signal level=-39 dBm Noise level=-93 dBm Rx invalid nwid:0 Rx invalid crypt:2499 Rx invalid frag:0 Tx excessive retries:24 Invalid misc:6120 Missed beacon:0 root:/> route add default gw 192.168.1.1 root:/> ping 192.168.1.1 PING 192.168.1.1 (192.168.1.1): 56 data bytes 64 bytes from 192.168.1.1: seq=0 ttl=64 time=24.000 ms 64 bytes from 192.168.1.1: seq=1 ttl=64 time=12.000 ms 64 bytes from 192.168.1.1: seq=2 ttl=64 time=12.000 ms 64 bytes from 192.168.1.1: seq=3 ttl=64 time=16.000 ms 64 bytes from 192.168.1.1: seq=4 ttl=64 time=12.000 ms 64 bytes from 192.168.1.1: seq=5 ttl=64 time=12.000 ms
Adhoc Mode
On both nodes. (One is 192.168.0.10, the other is 192.168.0.11), do bellow setup:
root:/> iwconfig eth1 mode ad-hoc root:/> iwconfig eth1 essid my_network root:/> iwconfig eth1 channel 1 root:/> ifconfig eth1 up root:/> ifconfig eth1 192.168.1.11 root:/> iwconfig eth1 IEEE 802.11b/g ESSID:"my_network" Mode:Ad-Hoc Frequency:2.437 GHz Cell: 02:24:D4:0D:78:9D Bit Rate:54 Mb/s Tx-Power=13 dBm Retry short limit:8 RTS thr=2347 B Fragment thr=2346 B Encryption key:off Power Management:off Link Quality=95/100 Signal level=-30 dBm Noise level=-92 dBm Rx invalid nwid:0 Rx invalid crypt:2664 Rx invalid frag:0 Tx excessive retries:23 Invalid misc:5865 Missed beacon:0 root:/> ping 192.168.1.10 PING 192.168.1.10 (192.168.1.10): 56 data bytes 64 bytes from 192.168.1.10: seq=0 ttl=64 time=40.000 ms 64 bytes from 192.168.1.10: seq=1 ttl=64 time=12.000 ms 64 bytes from 192.168.1.10: seq=2 ttl=64 time=12.000 ms 64 bytes from 192.168.1.10: seq=3 ttl=64 time=16.000 ms 64 bytes from 192.168.1.10: seq=4 ttl=64 time=16.000 ms ^C --- 192.168.1.10 ping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss round-trip min/avg/max = 12.000/19.200/40.000 ms
Performance
BF548-Ezkit
-
System Setting
Board Version | CCLK | SCLK | Kernel Version | Toolchain Version |
---|---|---|---|---|
BF548-EZKIT-1.4 - Rev 0.2 | 525MHz | 131MHz | 2.6.28.9-ADI-2009R1-pre-svn6259 | gcc 4.1.2 (svn-3305) |
iperf
Managed Mode
-
AP: Linksys WRH54G
-
Server side (a Linux PC with Intel WiFi link 5100)
linux-pc:/$ iwconfig wlan0 IEEE 802.11abgn ESSID:"linksys" Mode:Managed Frequency:2.437 GHz Access Point: 00:1A:70:D4:94:C7 Bit Rate=1 Mb/s Tx-Power=15 dBm Retry min limit:7 RTS thr:off Fragment thr=2352 B Power Management:off Link Quality=100/100 Signal level:-22 dBm Noise level=-83 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0 linux-pc:/$ ./iperf -s ------------------------------------------------------------ Server listening on TCP port 5001 TCP window size: 85.3 KByte (default) ------------------------------------------------------------
-
Client side
root:/> iwconfig eth1 eth1 IEEE 802.11b/g ESSID:"linksys" Mode:Managed Frequency:2.437 GHz Access Point: 00:1A:70:D4:94:C7 Bit Rate:1 Mb/s Tx-Power=13 dBm Retry short limit:8 RTS thr=2347 B Fragment thr=2346 B Encryption key:off Power Management:off Link Quality=100/100 Signal level=-23 dBm Noise level=-91 dBm Rx invalid nwid:0 Rx invalid crypt:2495 Rx invalid frag:0 Tx excessive retries:11276 Invalid misc:2789127 Missed beacon:0 root:/> iperf -v iperf version 2.0.4 (7 Apr 2008) pthreads root:/> iperf -c 192.168.1.100 -i 1 ------------------------------------------------------------ Client connecting to 192.168.1.100, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 5] local 192.168.1.101 port 35970 connected with 192.168.1.100 port 5001 [ ID] Interval Transfer Bandwidth [ 5] 0.0- 1.0 sec 264 KBytes 2.16 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 1.0- 2.0 sec 216 KBytes 1.77 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 2.0- 3.0 sec 240 KBytes 1.97 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 3.0- 4.0 sec 224 KBytes 1.84 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 4.0- 5.0 sec 224 KBytes 1.84 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 5.0- 6.0 sec 232 KBytes 1.90 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 6.0- 7.0 sec 224 KBytes 1.84 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 7.0- 8.0 sec 224 KBytes 1.84 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 8.0- 9.0 sec 248 KBytes 2.03 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 9.0-10.0 sec 232 KBytes 1.90 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 0.0-10.0 sec 2.27 MBytes 1.91 Mbits/sec
Adhoc Mode
-
Server side (a Linux PC with Intel WiFi link 5100)
linux-pc:/$ ./iperf -s ------------------------------------------------------------ Server listening on TCP port 5001 TCP window size: 85.3 KByte (default) ------------------------------------------------------------
-
Client side
root:/> iwconfig eth1 IEEE 802.11b/g ESSID:"my_network" Mode:Ad-Hoc Frequency:2.437 GHz Cell: 02:24:D4:0D:78:9D Bit Rate:54 Mb/s Tx-Power=13 dBm Retry short limit:8 RTS thr=2347 B Fragment thr=2346 B Encryption key:off Power Management:off Link Quality=95/100 Signal level=-30 dBm Noise level=-92 dBm Rx invalid nwid:0 Rx invalid crypt:2664 Rx invalid frag:0 Tx excessive retries:23 Invalid misc:5865 Missed beacon:0 root:/> iperf -c 192.168.1.10 -i 1 ------------------------------------------------------------ Client connecting to 192.168.1.10, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 5] local 192.168.1.11 port 38997 connected with 192.168.1.10 port 5001 [ ID] Interval Transfer Bandwidth [ 5] 0.0- 1.0 sec 248 KBytes 2.03 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 1.0- 2.0 sec 232 KBytes 1.90 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 2.0- 3.0 sec 224 KBytes 1.84 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 3.0- 4.0 sec 224 KBytes 1.84 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 4.0- 5.0 sec 232 KBytes 1.90 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 5.0- 6.0 sec 224 KBytes 1.84 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 6.0- 7.0 sec 224 KBytes 1.84 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 7.0- 8.0 sec 232 KBytes 1.90 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 8.0- 9.0 sec 240 KBytes 1.97 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 9.0-10.0 sec 232 KBytes 1.90 Mbits/sec [ ID] Interval Transfer Bandwidth [ 5] 0.0-10.0 sec 2.26 MBytes 1.90 Mbits/sec
BF518F-Ezkit
-
System Setting
Board Version | CCLK | SCLK | Kernel Version | Toolchain Version |
---|---|---|---|---|
BF518F-ezkit-0.1 - Rev 0.0 | 400MHz | 100MHz | 2.6.28.9-ADI-2009R1-pre-svn6277 | gcc 4.1.2 (09r1-rc5) |
iperf
-
Client side
root:/> iperf -c 192.168.1.2 -i 1 ------------------------------------------------------------ Client connecting to 192.168.1.2, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 5] local 192.168.1.101 port 33900 connected with 192.168.1.2 port 5001 [ 5] 0.0- 1.0 sec 256 KBytes 2.10 Mbits/sec [ 5] 1.0- 2.0 sec 224 KBytes 1.84 Mbits/sec [ 5] 2.0- 3.0 sec 232 KBytes 1.90 Mbits/sec [ 5] 3.0- 4.0 sec 224 KBytes 1.84 Mbits/sec [ 5] 4.0- 5.0 sec 232 KBytes 1.90 Mbits/sec [ 5] 5.0- 6.0 sec 224 KBytes 1.84 Mbits/sec [ 5] 6.0- 7.0 sec 232 KBytes 1.90 Mbits/sec [ 5] 7.0- 8.0 sec 200 KBytes 1.64 Mbits/sec [ 5] 8.0- 9.0 sec 232 KBytes 1.90 Mbits/sec [ 5] 9.0-10.0 sec 232 KBytes 1.90 Mbits/sec [ 5] 0.0-10.1 sec 2.24 MBytes 1.86 Mbits/sec
WIFI over GSPI
I have been able to get the 88W8686 Marvell module working in GSPI mode on a BF537-STAMP and BF561-EZKIT board. Both board have near the same configuration. The only difference is on the board setup code that need modification.
To test the GSPI I have use the SVN (live source) to have the latest wireless update.
Let see the configuration.
Kernel Config
[*] Networking support ---> -*- Wireless ---> <M> cfg80211 - wireless configuration API [*] enable powersave by default [*] cfg80211 wireless extensions compatibility [*] Wireless extensions sysfs files {*} Common routines for IEEE802.11 drivers <M> Generic IEEE 802.11 Networking Stack (mac80211) [*] Minstrel
Device Drivers ---> [*] Network device support ---> [*] Wireless LAN ---> <M> Marvell 8xxx Libertas WLAN driver support <M> Marvell Libertas 8686 SPI 802.11b/g cards [*] Enable full debugging output in the Libertas module. [*] Enable mesh support
Device Drivers ---> [*] SPI support ---> <*> SPI controller driver for ADI Blackfin5xx
thant it for the kernel config. Normally, with this config you should be able to get your libertas_spi module. Now we need some tools to configure the Wireless under uclinux.
Uclinux Distribution Configuration
Network Applications ---> --- Wireless-tools [*] wireless_tools support [*] iwconfig [*] iwgetid [*] iwlist [*] iwpriv [*] iwspy [*] iwevent [*] ifrename
Now that everything is configured, We need to change the setup board file in the linux tree. Here the modification for both board
BF537-STAMP
In order to ba able to use the SPI driver in the kernel we need to put some info on the source file. here what you need.
edit
/linux-2.6.x/arch/blackfin/mach-bf537/boards/stamp.c
add this line
#include <linux/spi/libertas_spi.h>
and this lines
/* * Driver needs to know address, irq and flag pin. */ #if defined(CONFIG_LIBERTAS_SPI_MODULE) static int spi0_libertas_setup(struct spi_device *spi) { return 0; } static struct libertas_spi_platform_data libertas_spi_platform_data_info = { .use_dummy_writes = 0, .setup = spi0_libertas_setup }; #endif
We need to declare a new chip, so add those line
#if defined(CONFIG_LIBERTAS_SPI_MODULE) static struct bfin5xx_spi_chip spi_mw8686_chip_info = { .enable_dma = 0, .bits_per_word = 16, }; #endif
Now we need to add the SPI info to the bfin_spi_board_info struct like this
#if defined(CONFIG_LIBERTAS_SPI_MODULE) { .modalias = "libertas_spi", .max_speed_hz = 33000000, .bus_num = 0, .irq = IRQ_PF6, .chip_select = GPIO_PF10 + MAX_CTRL_CS, .platform_data = &libertas_spi_platform_data_info, .controller_data = &spi_mw8686_chip_info, .mode = SPI_MODE_0, }, #endif
On the BF561, you need to pu this lines
#if defined(CONFIG_LIBERTAS_SPI_MODULE) { .modalias = "libertas_spi", .max_speed_hz = 33000000, .bus_num = 0, .irq = IRQ_PF0, .chip_select = GPIO_PF1 + MAX_CTRL_CS, .platform_data = &libertas_spi_platform_data_info, .controller_data = &spi_mw8686_chip_info, .mode = SPI_MODE_0, }, #endif
and change the num_chipselect in the bfin_spi0_info struct from
.num_chipselect = 8,
to
.num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
if you don't do that, you won't be able to use the CS in GPIO mode. On the BF561, you hook your CS to PF1 and you IRQ to PF0. don't forget to put both switch to on from the SW13.
So now that everything is setup, you need to compile everything with make.
Get the Libertas firmware
To be able to have the libertas_spi working, you need the libertas_spi firmware. I have try the one from the wireless tree without success. To be able to get this worked, I have used the one from cozybit. http://cozybit.com/projects/gspi8686/. You need to download and extract to the romfs/lib/firmware/libertas. Also be sure to have the file renamed to gspi8686.bin and gspi8686_hlp.bin. After that juste rebuild the image with
make romfs && make image
download the uImage to your board and hookup the SPI board to the SPI connector with the FP10 line as CS and PF6 as IRQ. do the probing with
modprobe libertas_spi
if everything goes well, you should now have a wlan0 interface.
Some ideas about GSPI Mode WIFI cards
Many users prefer SPI mode WIFI card, but we don't have such cards in hand currently, some general ideas to make it work can be 1)Select SPI driver for ADI blackfin.2)Selet Marvell Libertas 8686 SPI 802.11b/g cards.3)Selet the right firmwares for GSPI mode.4)configure SPI part of the board file to provide right working parameters for SPI mode WIFI card.
轉載[http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:wifi_over_sdio]