8/22/2012

NCLP R5-SP1 WLAN Dirver for modules of Jorjin the inside TI WL12xx chip


#################################################################
#   README
#
#   Introduction Wlan Driver For Jorjin SiP Modules
#
#   NLCP Version        : R5_SP1
#   Operation system    : Linux / Android
#   Date                : July,24 2012
#   Mantainer           : Dicky Chiang <dickychiang@jorjin.com.tw>
#
#   Jorjin Technologies Inc - http://www.jorjin.com.tw/
#
#################################################################

NLCP(Native Linux Communication Package) is open source,which to integrated for TI.

The wlan driver will to support WG72xx/WG73xx/WG75xx of the Jorjin SiP modules.

Wirelees solutions of the between TI and Jorjin:
* WG72xx - Inside WL125x chip
* WG73xx - Inside WL127x chip
* WG75xx - Inside WL128x chip

Download site:

# git clone git://github.com/dickychiang/compat-wireless-r5-sp1.git

====================================================================================================
1. Build Instructions

Setting your environment:

# export YOUR_PATH=`pwd`
# export DRIVER_PATH=${YOUR_PATH}/
# export ARCH=arm
# export CROSS_COMPILE=
# export PATH=$PATH:
# export DESTDIR=
# export KLIB=
# export KLIB_BUILD=$KLIB

Building:

# make modules     # Only modules
# make install     # Build modules & install to your filesystem

====================================================================================================
2. Firmware

Choose for your module type then to copy into the filesystem.

For Android:
# cp ${DRIVER_PATH}/jorjin/firmware/WG73xx_fw/*.bin \
     /etc/firmware/ti-connectivity/
For Linux:
# cp ${DRIVER_PATH}/jorjin/firmware/WG73xx_fw/*.bin \
     /lib/firmware/ti-connectivity/

====================================================================================================

3. Copy driver module

# cp ${DRIVER_PATH}/compat/compat.ko                           $(DESTDIR)/system/lib/modules
# cp ${DRIVER_PATH}/drivers/net/wireless/wl12xx/wl12xx.ko      $(DESTDIR)/system/lib/modules
# cp ${DRIVER_PATH}/net/mac80211/mac80211.ko                   $(DESTDIR)/system/lib/modules
# cp ${DRIVER_PATH}/net/wireless/cfg80211.ko                   $(DESTDIR)/system/lib/modules
# cp ${DRIVER_PATH}/drivers/net/wireless/wl12xx/wl12xx_sdio.ko $(DESTDIR)/system/lib/modules
# cp ${DRIVER_PATH}/drivers/net/wireless/wl12xx/wl12xx_spi.ko  $(DESTDIR)/system/lib/modules

====================================================================================================
4. Insert module

Go to you filesystem then according to as below for insert module.

# insmod compat.ko
# insmod cfg80211.ko
# insmod mac80211.ko

Choose for your module type.
# insmod wl1251.ko
# insmod wl1251_sdio.ko

====================================================================================================
************************************
* Related WLAN tools & application *
************************************

1. Install SoftAP & wpa_supplicant_8 with R5-SP1 WLAN driver
# git clone git://github.com/dickychiang/hostap.git
# cd hostap
# git checkout R5_SP1_Maintenance_Release
# cd ../ ; cp -rf hostap/* $MYDROID/external/wpa_supplicant_8

2. Install ti-utils (calibration tools)
# git clone git://github.com/dickychiang/ti-utils.git
# cd ti-utils
# git checkout R5_SP1_Maintenance_Release
# cd ../ ; cp -rf ti-utils $MYDROID/external/ti-utils

3. Install IW (for Android version)
# git clone git://github.com/dickychiang/iw.git
# cd iw
# git checkout ol_R5.00.21
# cd ../ ; cp -rf iw $MYDROID/external/iw

4. Install crda(Central Regulatory Domain Agent)
# git clone git://github.com/dickychiang/crda.git
# cp -rf crda $MYDROID/external/crda

====================================================================================================
************************************
* How to Calibration *
************************************
The calibrator and other useful utilities for TI wireless solution,
based on wl12xx driver.

Calibration is a process in which specific radio configuration parameters are
generated and saved into the NVS file, later to be used by the wl12xx driver
upon initialization.
These configuration parameters are specific to the chip on the specific design
and therefore are sent back to the driver to store in non-volatile memory for
later use. Upon initialization, the wl12xx driver will load an NVS file where
it expects to read those parameters and send them to the chip.

The NVS file contains 2 main parts - one stores the calibration parameters and
the other one stores initialization information required for the wl12xx driver.


1. Install ti-utils (calibration tools)
# git clone git://github.com/dickychiang/ti-utils.git
# cd ti-utils
# git checkout R5_SP1_Maintenance_Release
# make
Don't forget to set your environment before make.

# cp ./calibrator /bin/

2. Copy ini files into the filesystem
For Andriod:
# cp ${DRIVER_PATH}/jorjin/ini_files/ \
${TAGET_OUT}/etc/firmware/ti-connectivity/TQS_S_2.6.ini 
For Native Linux:
# cp ${DRIVER_PATH}/jorjin/ini_files/ \
${ROOT_FS}/lib/firmware/ti-connectivity/TQS_S_2.6.ini 

3. Execute calibrator on your board
# rmmod wl12xx_sdio.ko
# calibrator plt autocalibrate     
         Device name. Probably wlan0
  Full path to wl12xx_sdio.ko kernel module                                                                             
         Full path to Radio param ini file
         Full path of nvs file. Must be the real path as wl12xx will load it
For example: 
# calibrator plt autocalibrate wlan0 \
/system/lib/modules/wl12xx_sdio.ko \
/etc/firmware/ti-connectivity/TQS_S_2.6.ini \
/etc/firmware/ti-connectivity/wl1271-nvs.bin 00:01:02:03:04:05

Appendix:

How to change MAC address in calibrated NVS

# calibrator set nvs_mac  []

If the MAC address missing, the random valid value will be added

====================================================================================================
**********************
* Building for Linux *
**********************

1. Install libnl-2.0

First to download it:

# git clone git://github.com/dickychiang/libnl-2.0.git

And export environment or can reference to script 'm.sh'

# export ROOTFS_PATH=
# export PATH=:$PATH
# export CROSS_COMPILE=
# ./configure --prefix=${ROOTFS}  CC=${CROSS_COMPILE}gcc --host=arm-linux LD=${CROSS_COMPILE}ld
# make
# make install

====================================================================================================
2. Install IW tool for wireless configuration

Download source code :

# git clone git://github.com/dickychiang/iw-linux.git

Export environment or reference script 'm.sh' for compile.

# export PKG_CONFIG_PATH=${ROOTFS_PATH}/lib/pkgconfig:$PKG_CONFIG_PATH
# export PKG_CONFIG_LIBDIR=${ROOTFS_PATH}/lib/:$PKG_CONFIG_LIBDIR
# export NFSROOT=${ROOTFS_PATH}
# make PREFIX=${NFSROOT} CC=${CROSS_COMPILE}gcc
# make PREFIX=${NFSROOT} CC=${CROSS_COMPILE}gcc install
====================================================================================================
3. How to use iw tool

Usually is commonly commands the following.

# iw wlan0 scan                     // Scan for Wifi network
# iw wlan0 connect            // Connect to specifc Access point (by its SSID)
# iw wlan0 disconnect               // Disconnect from the Access point that the Station is connected too   
# iw wlan0 link                     // Verify Link Status

For example as below:

# iw wlan0 scan
BSS 00:13:46:dd:e2:e9 (on wlan0)
TSF: 362449530606 usec (4d, 04:40:49)
freq: 2452
beacon interval: 100
capability: ESS Privacy ShortPreamble (0x0031)
    signal: -50.00 dBm
    last seen: 270 ms ago
    SSID: jjap
    Supported rates: 1.0* 2.0* 5.5* 11.0* 22.0 
    DS Parameter set: channel 9
    ERP: 
    Extended supported rates: 6.0 9.0 12.0 18.0 24.0 36.0 48.0 54.

# iw wlan0 connect jjap keys 0:0397430202

# iw wlan0 link
Connected to 00:13:46:dd:e2:e9 (on wlan10)
SSID: jjap
freq: 2452
RX: 9400 bytes (96 packets)
TX: 0 bytes (0 packets)
    signal: -48 dBm
    tx bitrate: 1.0 MBit/s

    bss flags:      short-preamble
    dtim period:    3
    beacon int:     100