Cypress Wifi Linux FMAC Driver Package - README
===============================================

Package Version
---------------
v4.12-2018_0205


Release Date
------------
2018-02-05


Description
-----------
This is Cypress's Linux brcmfmac driver and firmware support package.
Brcmfmac is an open-source driver project.

Files in this release:
* Backports package (cypress-backports-v4.12_2017_1030-module-src.tar.gz)
* Firmware/clm_blob files (cypress-firmware-v4.12-2017_1122.tar.gz)
* Cypress fmac patch files (cypress-patch-v4.12_2017_1030.tar.gz)
* Device tree files (cypress-devicetree-v4.11_2017_0818.tar.gz)
* README

For more information about the Linux brcmfmac project, see:

[brcm80211 Wireless Wiki](https://wireless.wiki.kernel.org/en/users/drivers/brcm80211)

For more information about Linux backports project, see:

[Linux Backports Project](https://backports.wiki.kernel.org/index.php/Main_Page)


Supported Feature
-----------------
* Concurrnet APSTA
* P2P
* Out-of-band (OOB) interrupt
* CLM Download (4373/43455)
* Wake on Wireless LAN
* PMF


Test Environment
----------------
* ARM (MCIMX6SX-SDB)
   * Linux v4.1.15 (NXP imx-4.1.15_2.0.0_ga)
   * backports
* x86
   * Linux v4.12


Firmware Versions
-----------------
| Chip      | FW Version   |
|-----------|--------------|
| 43455     | 7.45.132     |
| 4343W     | 7.45.98.38   |
| 4373      | 13.10.246.79 |
| 4356-pcie | 7.35.180.176 |
| 4354      | 7.35.349.28  |
| 4339      | 6.37.39.80   |
| 43340     | 6.10.190.70  |
| 43362     | 5.90.240     |
| 43012     | 13.10.271.57 |


Instructions
------------
The patch files in this package are based on Linux v4.12, so older kernels
need use backports package. Below are examples of how to use this package
with an older kernel or linux-stable v4.12.

### Using backports with an older kernel (v3.0+)

Linux kernel image and cypress driver modules need to be built separately.
Below is the example of using with iMX Linux v4.1.15:

#### Build the kernel image
```bash
#1. Have the BSP kernel source available
   wget http://git.freescale.com/git/cgit.cgi/imx/linux-imx.git/snapshot/linux-imx-rel_imx_4.1.15_2.0.0_ga.tar.gz
   tar zxvf linux-imx-rel_imx_4.1.15_2.0.0_ga.tar.gz
#2. Set up build environment and kernel configuration
   cd linux-imx-rel_imx_4.1.15_2.0.0_ga
   source /opt/poky/1.8/environment-setup-cortexa7hf-vfp-neon-poky-linux-gnueabi
   make imx_v7_defconfig
#3. Edit .config and build cfg80211 as module
#     CONFIG_CFG80211=m
#     CONFIG_BCMDHD=n
#4. Build the Linux kernel image
   make oldconfig
   make zImage -j 8
#5. The kernel image is available here
   arch/arm/boot/zImage 
```

#### Build the cypress driver/backports modules
```bash
#1. Untar the Cypress backports package
    tar zxvf cypress-backports-*.tar.gz
    cd v4.12-backports
#2. (Native) compile local tools and generate .config (in a new terminal
#   without sourcing Yoctol toolchain settings)
    bash
    MY_KERNEL=<the 4.1.15 kernel path>
    make KLIB=$MY_KERNEL KLIB_BUILD=$MY_KERNEL defconfig-brcmfmac
#3. (Cross) compile kernel modules
    source /opt/poky/1.8/environment-setup-cortexa7hf-vfp-neon-poky-linux-gnueabi
    make KLIB=$MY_KERNEL KLIB_BUILD=$MY_KERNEL modules
#4. The kernel modules are available here
#      compat/compat.ko
#      net/wireless/cfg80211.ko
#      drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko
#      drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
```

#### Device tree
```bash
#1. Untar the cypress devicetree package
    tar zxvf cypress-devicetree-*.tar.gz
#2. Find your board's dtb file, for example
#      cypress-devicetree/iMX6SX/4.1.15/imx6sx-sdb-btwifi-fmac.dtb
```
Note: If your board's dtb is not available in the cypress devicetree
      package, please refer to the available dts/dtsi files and create
      them for your board, then compile them for the dtb file. iMX dts
      files are located in linux-imx/arch/arm/boot/dts/ folder of the
      Linux kernel tree. Below command compiles a dtb file
```bash
    make ARCH=arm <devicetree name>.dtb
```

#### Load the cypress wifi driver
```bash
#1. Copy your boards's zImage and dtb files to the target board
    bash
    TARGET_IP=<target board IP>
    scp <dtb file> root@$TARGET_IP:/run/media/mmcblk1p1/cy.dtb
    scp <zImage file> root@$TARGET_IP:/run/media/mmcblk1p1/zImage_cy
#2. Copy firmware files to the target board
    tar zxvf cypress-firmware*.tar.gz
    scp firmware/* root@$TARGET_IP:/lib/firmware/brcm
#3. Copy your nvram file (from board vendor) to the target board and rename it
    scp <nvram file> root@$TARGET_IP:/lib/firmware/brcm/<fw name>.txt
#      (fw name is your chip's *.bin file name in the cypress firmware package)
#4. Copy cypress kernel modeules to the target board
    scp <module files> root@$TARGET_IP:/lib/modules/4.1.15
#5. (iMX console) Press ctrl-c after target boot to enter u-boot and configure it 
#   for the new zImage/dtb files
   env print image fdt_file 
   setenv image zImage_cy
   setenv fdt_file cy.dtb
   saveenv
   env print image fdt_file 
   reset
#6. (iMX console) Boot up the target board with the above zImage and insmod cypress modules
    insmod /lib/modules/4.1.15/compat.ko
    insmod /lib/modules/4.1.15/cfg80211.ko
    insmod /lib/modules/4.1.15/brcmutil.ko
    insmod /lib/modules/4.1.15/brcmfmac.ko
```
Note: More on fmac driver [firmware/nvram install](https://wireless.wiki.kernel.org/en/users/drivers/brcm80211#firmware_installation1)

### Using Linux Stable v4.12
```bash
#1. Download Linux stable kernel source
    wget https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/snapshot/linux-stable-4.12.tar.gz
    tar zxvf linux-stable-4.12.tar.gz
#2. In Linux root folder, untar/apply cypress patches with below bash commands
    cd linux-stable-4.12
    tar zxvf cypress-patch*.tar.gz
    for i in cypress-patch/*.patch; do patch -p1 < $i; done
#3. Set kernel .config and enable below options, then compile kernel image
#      CONFIG_BRCMUTIL=y
#      CONFIG_BRCMFMAC=y
#      CONFIG_BRCMFMAC_SDIO=y
#      CONFIG_BRCMFMAC_PROTO_BCDC=y
#      CONFIG_BRCMFMAC_PCIE=y
#      CONFIG_BRCMFMAC_PROTO_MSGBUF=y
#4. (optional) Backup original firmware files
    cp /lib/firmware/brcm /lib/firmware/brcm-bak -r
#5. Update firmware files in /lib/firmware/brcm
    tar zxvf cypress-firmware*.tar.gz
    cp firmware/* /lib/firmware/brcm
#6. Boot the system with the new kernel image
```



Cypress Wifi Linux FMAC Driver Package - Release Notes
======================================================

FMAC Driver Changes
-------------------
* 4373 support (0001, 0004)
* 43455/4373 CLM download support (0002)
   - An additional brcmfmac43xx-sdio.clm_blob required together with the .bin file
   - !! The firmwares .bin comes with *.clm_blob in this package requre these
     patches to work !!
* APSTA bug fix (0003, 0015)
* Roaming fix (0005)
* AP mode WEP secuirty fix (0006)
* Multi-channel operation fix (0007)
* SG parameter support (0008)
* WL tool hang fix (0009)
* VE support (0010, 0011, 0012, 0013, 0016)
* 43012 support (0014, 0017)

FMAC Driver Patch List
----------------------
* 0001-brcmfmac-Add-support-for-CYW4373-SDIO-USB-chipset.patch [v4.14-rc1]
* 0002-brcmfmac-add-CLM-download-support.patch [v4.15-rc1]
* 0003-brcmfmac-remove-setting-IBSS-mode-when-stopping-AP.patch [v4.13]
* 0004-brcmfmac-Set-F2-blksz-and-Watermark-to-256-for-4373.patch
* 0005-brcmfmac-add-setting-carrier-state-on-for-successful.patch [v4.14-rc1]
* 0006-brcmfmac-set-wpa_auth-to-WPA_AUTH_DISABLED-in-AP-ope.patch [v4.14-rc1]
* 0007-brcmfmac-fix-wrong-num_different_channels-when-mchan.patch [v4.14-rc1]
* 0008-brcmfmac-Add-sg-parameters-dts-parsing.patch
* 0009-brcmfmac-return-EPERM-when-getting-error-in-vendor-c.patch
* 0010-cfg80211-support-4-way-handshake-offloading-for-WPA-.patch [v4.13]
* 0011-cfg80211-support-4-way-handshake-offloading-for-802..patch [v4.13]
* 0012-brcmfmac-support-4-way-handshake-offloading-for-WPA-.patch [v4.13]
* 0013-brcmfmac-support-4-way-handshake-offloading-for-802..patch [v4.13]
* 0014-brcmfmac-Add-support-for-CYW43012-SDIO-chipset.patch
* 0015-brcmfmac-set-apsta-to-1-when-AP-start-on-primary-int.patch
* 0016-brcmfmac-add-IEEE-802.11r-Fast-BSS-Transition-suppor.patch
* 0017-brcmfmac-Saverestore-support-changes-for-43012.patch

Note: [*] is the upstream tag containing the patch


Firmware Changes
----------------
* 43455
   * --- 7.45.132 --- 
   * KRACK security fixes
   * CVE-2017-11120: Fix RRM variable length IE calculation bug
   * Enable GTK offload
   * CVE-2017-11121: validate FBT IE in authentication response frame
   * Add 802.11k TSM support
   * DFS bug fixes
   * Disable MCS32 in 40Mhz
   * CLM download feature updates and bug fixes
   * Reset max_seq when AMPDU seq is out of window to avoid deadlock.
   * --- 7.45.122 --- 

* 4343W
   * --- 7.45.98.38 ---
   * KRACK security fixes
   * Sleep mode transition packet drop fix
   * Throughput fluctuation fix
   * Coex: BT choppy audio fix
   * --- 7.45.98.30 ---

* 4373
   * --- 13.10.246.79 ---
   * KRACK security fixes
   * --- 13.10.246.63 ---

* 4356-pcie
   * --- 7.35.180.176 ---
   * KRACK security fixes
   * DFS master support
   * Coex: fix low throughput when running BT slave/eSCO tests
   * CLM download support
   * Add "CY" in version string
   * --- 7.35.180.162 ---

* 4354
   * --- 7.35.349.28 ---
   * KRACK security fixes
   * 1Mbps PER fix
   * Hidden node data loss fix
   * --- 7.35.349.17 ---

* 4339
   * --- 6.37.39.80 ---
   * Doen't include HT/VHT ie when WEP or TKIP only
   * Coex: prioirty WiFi over BT when association in progress
   * --- 6.37.39.73 ---

* 43340
   * --- 6.10.190.70 ---
   * KRACK security fixes
   * --- 6.10.190.68 ---

* 43362
   * --- 5.90.240 ---
   * KRACK security fixes
   * --- 5.90.238 ---

* 43012
   * --- 13.10.271.57 ---


Known Issues
------------
* 43455 TKIP connection failure

