Cubietruck/AP6210
AMPAK AP6210 Wifi and Bluetooth driver for Linux-Sunxi
Linux-Sunxi's latest 3.4 kernel does not include a build-in driver for the Wifi and Bluetooth module found on the CubieTruck. The way the module is implemented in the CubieTruck make it incompatible with the BCMDHD driver included with the kernel. To make things worst, the day CubieTech implemented their own version of the BCMDHD driver made it incompatible with the latest kernel.
This driver solve theses problems, all the modifications to the linux kernel and BCMDHD driver have been merge into a single module which can be loaded at runtime or linked with the kernel.
Integrate the driver into sunxi-3.4
The driver is avalable in the form of two patches - the first one (ap6210_module.patch) is the actual driver, the second patch (ap6210_defconfig.patch) disables the BCMDHD driver and configures the AP6210 driver instead; you can re-enable it if you also use a USB Wifi module that needs the BCMDHD driver. Here's how to get the official sunxi-3.4 source and integrate the patch:
git clone https://github.com/linux-sunxi/linux-sunxi.git cd linux-sunxi wget https://raw.githubusercontent.com/armStrapTools/ap6210/master/ap6210_module.patch wget https://raw.githubusercontent.com/armStrapTools/ap6210/master/ap6210_defconfig.patch patch -p1 < ap6210_module.patch patch -p1 < ap6210_defconfig.patch
A pre-patched version of the linux-sunxi code is also avalable on my git repository, but since it is where I develop the driver and other things, it may not always be useable:
https://github.com/armStrapTools/linux-sunxi-ap6210.git
Compile the kernel
Once the kernel has been patch, you can follow the regular kernel building instructions to compile your new kernel, see the Linux Kernel howto[1] for a complete guide on how to build a kernel.
Enabling the module
To enable the module add the ap6210 module to /etc/modules. You can also enable ap mode by adding op_mode=2 to the module line.
Bugs and caveats
Presently, the module cannot be reloaded once it has been unloaded (rmmod), since the rfkill interface was not developped to be a module, but integrated into the architecture specific part of the kernel. This is not a problem for normal usage since the module can be turn on/off with iwconfig like any other wifi module.
GPIO 2 is hardcoded as the host wake irq, the board configuration should initialize this, to do so, the following must be present in your compiled Fex file.
[gpio_para] gpio_used = 1 gpio_num = 2 gpio_pin_1 = port:PH20<1><default><default><1> gpio_pin_2 = port:PH10<0><default><default><0>
External links
- Official linux-sunxi git repository[2]
- Unofficial linux-sunxi git repository with the driver already integrated[3]
- AP6210 driver git repository[4]