【全志H3】XR819 WIFI驱动适配

1.准备驱动

https://github.com/fifteenhex/xradio/?tab=readme-ov-file

https://github.com/armbian/firmware/tree/master/xr819

下载文件

2.设备树配置

我这里用的orangepi的SDK,编辑/home/jun/orangepi-build/kernel/orange-pi-5.4/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts

/*
 * Copyright (C) 2016 Hans de Goede <hdegoede@redhat.com>
 *
 * This file is dual-licensed: you can use it either under the terms
 * of the GPL or the X11 license, at your option. Note that this dual
 * licensing only applies to this file, and not this project as a
 * whole.
 *
 *  a) This file is free software; you can redistribute it and/or
 *     modify it under the terms of the GNU General Public License as
 *     published by the Free Software Foundation; either version 2 of the
 *     License, or (at your option) any later version.
 *
 *     This file is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 * Or, alternatively,
 *
 *  b) Permission is hereby granted, free of charge, to any person
 *     obtaining a copy of this software and associated documentation
 *     files (the "Software"), to deal in the Software without
 *     restriction, including without limitation the rights to use,
 *     copy, modify, merge, publish, distribute, sublicense, and/or
 *     sell copies of the Software, and to permit persons to whom the
 *     Software is furnished to do so, subject to the following
 *     conditions:
 *
 *     The above copyright notice and this permission notice shall be
 *     included in all copies or substantial portions of the Software.
 *
 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 *     OTHER DEALINGS IN THE SOFTWARE.
 */

/* The Orange Pi PC Plus is an extended version of the regular PC */
#include "sun8i-h3-orangepi-pc.dts"

/ {
    model = "Xunlong Orange Pi PC Plus";
    compatible = "xunlong,orangepi-pc-plus", "allwinner,sun8i-h3";

    aliases {
        /* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
        ethernet1 = &xr819;
    };

    vdd_wifi: vdd_wifi {
        compatible = "regulator-fixed";
        regulator-name = "wifi";
        regulator-min-microvolt = <1800000>;
        regulator-max-microvolt = <1800000>;
        gpio = <&pio 0 20 GPIO_ACTIVE_HIGH>;
        startup-delay-us = <70000>;
        enable-active-high;
    };

    pwrseq_wifi: pwrseq_wifi@0 {
        compatible = "mmc-pwrseq-simple";
        pinctrl-names = "default";
        pinctrl-0 = <&wifi_rst>;
        reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>;
        post-power-on-delay-ms = <50>;
    };
};

&emac {
    /* LEDs changed to active high on the plus */
    /delete-property/ allwinner,leds-active-high;
};

&mmc1 {
    pinctrl-names = "default";
    pinctrl-0 = <&mmc1_pins>;
    vmmc-supply = <&reg_vcc3v3>;
    vqmmc-supply = <&vdd_wifi>;
    mmc-pwrseq = <&pwrseq_wifi>;
    bus-width = <4>;
    max-frequency = <16000000>;
    non-removable;
    status = "okay";

    /*
     * Explicitly define the sdio device, so that we can add an ethernet
     * alias for it (which e.g. makes u-boot set a mac-address).
     */
    xr819: sdio_wifi@1 {
        reg = <2>;
        compatible = "xradio,xr819";
        pinctrl-names = "default";
        pinctrl-0 = <&wifi_wake>;
        interrupt-parent = <&pio>;
        interrupts = <6 10 IRQ_TYPE_EDGE_RISING>;
        interrupt-names = "host-wake";
        local-mac-address = [dc 44 6d c0 ff ee];
    };
};

&pio {
    gmac_power_pin_nanopi: gmac_power_pin@0 {
        pins = "PD6";
        function = "gpio_out";
    };
};

&pio {
    wifi_wake: wifi_wake {
        pins = "PG10";
        function = "gpio_in";
    };
};

&r_pio {
    wifi_rst: wifi_rst {
        pins = "PL7";
        function = "gpio_out";
    };
};

&mmc1_pins {
    bias-pull-up;
};

&mmc2 {
    pinctrl-names = "default";
    pinctrl-0 = <&mmc2_8bit_pins>;
    vmmc-supply = <&reg_vcc3v3>;
    bus-width = <8>;
    non-removable;
    cap-mmc-hw-reset;
    status = "okay";
};

&mmc2_8bit_pins {
    /* Increase drive strength for DDR modes */
    drive-strength = <40>;
    /* eMMC is missing pull-ups */
    bias-pull-up;
};

3.拷贝固件

root@orangepipcplus:~# ls /usr/lib/firmware/xr819/
boot_xr819.bin  device-xradio.mk  fw_xr819.bin  sdd_xr819.bin

启动硬件

[   15.258757] xradio: hardware vers. 7.9
[   15.258780] xradio: firmware vers. 8 (WSM), build 5258, api 1060, cap 0x0003
[   15.258786] xradio: Config USE_EXTENSIONS

4.配置网络

查看网络设备列表

nmcli dev

注意,如果列出的设备状态是 unmanaged 的,说明网络设备不受NetworkManager管理,你需要清空 /etc/network/interfaces下的网络设置,然后重启.

开启WiFi

nmcli r wifi on

连接到指定的 WiFi 热点

nmcli dev wifi connect "SSID" password "PASSWORD" ifname wlan0

观察日志

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.102  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::acb9:c843:b03f:b501  prefixlen 64  scopeid 0x20<link>
        ether 12:81:36:60:5c:c3  txqueuelen 1000  (Ethernet)
        RX packets 15  bytes 2276 (2.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12  bytes 1856 (1.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@orangepipcplus:~# ping www.baidu.com -I wlan0
PING www.a.shifen.com (183.2.172.42) from 192.168.0.102 wlan0: 56(84) bytes of data.
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=1 ttl=52 time=27.7 ms
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=2 ttl=52 time=21.4 ms

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值