K230 SDK IoT WiFi AiW4211LV10驱动开发指南
1. 功能介绍
AiW4211LV10是一款低功耗IoT WiFi芯片,我司采用该芯片平台设计了一款AiW4211LV10开发板,该开发板可插入K230 EVB板的TF卡插槽实现接入。K230 EVB加载AiW4211LV10驱动之 后,可以生成wlan0无线网卡,实现网络数据通信。
2. 模块依赖
硬件上依赖AiW4211LV10开发板,依赖K230 EVB开发板,K230 EVB为WiFi提供电源及中断检测连线。
软件上依赖于K230 SDIO主控驱动,依赖GPIO驱动的完备,需要emmc引导启动实现。
2.1 操作系统
当前驱动支持linux 4.9、linux 4.17和linux 5.10.4
2.2 硬件环境
K230 EVB开发板设置emmc启动,空出TF卡插槽用于AiW4211LV10开发板接入。
K230 EVB开发板飞线到AiW4211LV10开发板排针。连接关系如下:
表 2-1 飞线关系
Link1 | Link2 | Link3 | Link4 | Link5 | |
---|---|---|---|---|---|
K230排针 | J5 PIN16 (5V) | J8 PIN9 (GPIO34) | |||
WiFi排针 | J6 PIN1 (5V) | J2 PIN3 (SDIO_INT_OUT) | J2 PIN4 (TX) | J2 PIN5 (RX) | J2 PIN6 (GND) |
TTL-USB | RX | TX | GND |
备注:TTL-USB与WiFi的连线主要是为了观察WiFi的固件输出,可以不连接
3. 模块配置
3.1 设备树修改
3.1.1 配置引脚function
修改uboot设备树arch/riscv/dts/k230_evb.dts,配置K230 EVB IO52引脚功能为GPIO,方向为input:
&iomux {
pinctrl-names = "default";
pinctrl-0 = <&pins>;
pins: iomux_pins {
pinctrl-single,pins = <
......
(IO52) ( 0 <<SEL | 0<<SL | BANK_VOLTAGE_IO50_IO61<<MSC | 1<<IE | 0<<OE | 0<<PU | 1<<PD | 7<<DS | 0<<ST )
}
}
3.1.2 配置GPIO控制器
修改linux设备树arch/riscv/boot/dts/kendryte/gpio_provider.dtsi,配置K230 EVB GPIO52控制器:
/ {
......
gpio52: gpio52@9140c000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "canaan,k230-apb-gpio";
reg = <0x0 0x9140c000 0x0 0x1000>;
interrupt-controller;
interrupt-parent = <&intc>;
#interrupt-cells = <2>;
interrupts = <84 IRQ_TYPE_EDGE_RISING>;
port52: gpio-controller@0 {
gpio-controller;
#gpio-cells = <2>;
nr-gpios = <1>;
reg-bank = <0>;
id = <52>;
};
};
};
3.1.3 配置SDHCI1参数
修改linux设备树arch/riscv/boot/dts/kendryte/k230_evb.dtsi,配置对应sdio主控参数:
sdcard: sdhci1@91581000 {
compatible = "snps,dwcmshc-sdhci";
reg = <0x0 0x91581000 0x0 0x1000>;
interrupt-parent = <&intc>;
interrupts = <144>;
interrupt-names = "sdhci1irq";
clocks = <&dummy_sd>,<&dummy_sd>;
clock-names = "core", "bus";
max-frequency = <50000000>;
bus-width = <4>;
//cd-gpios = <>;
no-1-8-v;
cap-sd-highspeed;
sdhci,auto-cmd12;
status = "okay";
};