ipq806x: provide WiFI mac-addresses from dts
authorAnsuel Smith <ansuelsmth@gmail.com>
Thu, 22 Jul 2021 11:35:42 +0000 (13:35 +0200)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Sat, 30 Oct 2021 20:11:13 +0000 (22:11 +0200)
Use nvmem framework for supported mac-address stored
in nvmem cells and drop mac patch function for hotplug
script for supported devices.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
[rebase, move to correct node for d7800, include xr500]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062-wg2600hp3.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200-c2600.dtsi
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wxr-2533dhp.dts

index a1cbe0a8f6bbf7edc659c20b055fb19777354919..2746ef1e2a70052df8bf32dd1fe77daf08ba5303 100644 (file)
@@ -22,7 +22,6 @@ case "$FIRMWARE" in
                ;;
        buffalo,wxr-2533dhp)
                caldata_extract "ART" 0x1000 0x2f20
-               ath10k_patch_mac $(mtd_get_mac_binary ART 0x1e)
                ;;
        edgecore,ecw5410)
                if [ -b "$(find_mtd_part 0:art)" ]; then
@@ -40,26 +39,21 @@ case "$FIRMWARE" in
        nec,wg2600hp |\
        nec,wg2600hp3)
                caldata_extract "ART" 0x1000 0x2f20
-               ath10k_patch_mac $(mtd_get_mac_binary PRODUCTDATA 0x12)
                ;;
        netgear,d7800 |\
        netgear,r7500v2 |\
        netgear,r7800)
                caldata_extract "art" 0x1000 0x2f20
-               ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x6) 1)
                ;;
        netgear,xr500)
                caldata_extract "art" 0x1000 0x2f20
-               ath10k_patch_mac $(mtd_get_mac_binary art 0xc)
                ;;
        tplink,ad7200 |\
        tplink,c2600)
                caldata_extract "radio" 0x1000 0x2f20
-               ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary default-mac 0x8) -1)
                ;;
        tplink,vr2600v)
                caldata_extract "ART" 0x1000 0x2f20
-               ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary default-mac 0x0) -1)
                ;;
        zyxel,nbg6817)
                if [ -b "$(find_mtd_part 0:art)" ]; then
@@ -88,7 +82,6 @@ case "$FIRMWARE" in
                ;;
        buffalo,wxr-2533dhp)
                caldata_extract "ART" 0x5000 0x2f20
-               ath10k_patch_mac $(mtd_get_mac_binary ART 0x18)
                ;;
        linksys,ea7500-v1 |\
        linksys,ea8500)
@@ -98,26 +91,21 @@ case "$FIRMWARE" in
        nec,wg2600hp |\
        nec,wg2600hp3)
                caldata_extract "ART" 0x5000 0x2f20
-               ath10k_patch_mac $(mtd_get_mac_binary PRODUCTDATA 0xc)
                ;;
        netgear,d7800 |\
        netgear,r7500v2 |\
        netgear,r7800)
                caldata_extract "art" 0x5000 0x2f20
-               ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x6) 2)
                ;;
        netgear,xr500)
                caldata_extract "art" 0x5000 0x2f20
-               ath10k_patch_mac $(mtd_get_mac_binary art 0x0)
                ;;
        tplink,ad7200 |\
        tplink,c2600)
                caldata_extract "radio" 0x5000 0x2f20
-               ath10k_patch_mac $(mtd_get_mac_binary default-mac 0x8)
                ;;
        tplink,vr2600v)
                caldata_extract "ART" 0x5000 0x2f20
-               ath10k_patch_mac $(mtd_get_mac_binary default-mac 0x0)
                ;;
        zyxel,nbg6817)
                if [ -b "$(find_mtd_part 0:art)" ]; then
index c6feb71a8ef6861f067a54330a1f94b986f89400..8f1bb74540f2a9450bd521735aa8b5792e747e06 100644 (file)
                        reg = <0x00010000 0 0 0 0>;
 
                        qcom,ath10k-calibration-variant = "NEC-Platforms-WG2600HP3";
+
+                       nvmem-cells = <&macaddr_PRODUCTDATA_12>;
+                       nvmem-cell-names = "mac-address";
                };
        };
 };
 
                        ieee80211-freq-limit = <2400000 2483000>;
                        qcom,ath10k-calibration-variant = "NEC-Platforms-WG2600HP3";
+
+                       nvmem-cells = <&macaddr_PRODUCTDATA_c>;
+                       nvmem-cell-names = "mac-address";
                };
        };
 };
        macaddr_factory_6: macaddr@6 {
                reg = <0x6 0x6>;
        };
+
+       macaddr_PRODUCTDATA_c: macaddr@c {
+               reg = <0xc 0x6>;
+       };
+
+       macaddr_PRODUCTDATA_12: macaddr@12 {
+               reg = <0x12 0x6>;
+       };
 };
index cd6c0ea77d4ab6fb50d71ed8ef9caa85ca11f00a..5842c34c16bc1c46b40a17f7bf8b12ffde188179 100644 (file)
 
 &pcie0 {
        status = "okay";
+
+       bridge@0,0 {
+               reg = <0x00000000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+               ranges;
+
+               wifi@1,0 {
+                       compatible = "pci168c,0040";
+                       reg = <0x00010000 0 0 0 0>;
+
+                       nvmem-cells = <&macaddr_defaultmac_8>;
+                       nvmem-cell-names = "mac-address";
+                       mac-address-increment = <(-1)>;
+               };
+       };
 };
 
 &pcie1 {
        status = "okay";
        max-link-speed = <1>;
+
+       bridge@0,0 {
+               reg = <0x00000000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+               ranges;
+
+               wifi@1,0 {
+                       compatible = "pci168c,0040";
+                       reg = <0x00010000 0 0 0 0>;
+
+                       nvmem-cells = <&macaddr_defaultmac_8>;
+                       nvmem-cell-names = "mac-address";
+               };
+       };
 };
 
 &mdio0 {
index 6e022cece066a0b03b8f702be02b4e6058cfdbb9..940e01439d08ff38ce788553ff4ad8d416378e00 100644 (file)
        reset-gpio = <&qcom_pinmux 3 GPIO_ACTIVE_HIGH>;
        pinctrl-0 = <&pcie0_pins>;
        pinctrl-names = "default";
+
+       bridge@0,0 {
+               reg = <0x00000000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+               ranges;
+
+               wifi@1,0 {
+                       compatible = "pci168c,0040";
+                       reg = <0x00010000 0 0 0 0>;
+
+                       nvmem-cells = <&macaddr_art_6>;
+                       nvmem-cell-names = "mac-address";
+                       mac-address-increment = <(1)>;
+               };
+       };
 };
 
 &pcie1 {
        pinctrl-0 = <&pcie1_pins>;
        pinctrl-names = "default";
        max-link-speed = <1>;
+
+       bridge@0,0 {
+               reg = <0x00000000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+               ranges;
+
+               wifi@1,0 {
+                       compatible = "pci168c,0040";
+                       reg = <0x00010000 0 0 0 0>;
+
+                       nvmem-cells = <&macaddr_art_6>;
+                       nvmem-cell-names = "mac-address";
+                       mac-address-increment = <(2)>;
+               };
+       };
 };
 
 &nand_controller {
index 0f224804344b11670cbc0916bba4bc9d754a8f60..f2bd1705b5252d9657e88a269482307fe1aeb63b 100644 (file)
        reset-gpio = <&qcom_pinmux 3 GPIO_ACTIVE_LOW>;
        pinctrl-0 = <&pcie0_pins>;
        pinctrl-names = "default";
+
+       bridge@0,0 {
+               reg = <0x00000000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+               ranges;
+
+               wifi@1,0 {
+                       compatible = "pci168c,0040";
+                       reg = <0x00010000 0 0 0 0>;
+
+                       nvmem-cells = <&macaddr_art_6>;
+                       nvmem-cell-names = "mac-address";
+                       mac-address-increment = <(1)>;
+               };
+       };
 };
 
 &pcie1 {
        pinctrl-0 = <&pcie1_pins>;
        pinctrl-names = "default";
        max-link-speed = <1>;
+
+       bridge@0,0 {
+               reg = <0x00000000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+               ranges;
+
+               wifi@1,0 {
+                       compatible = "pci168c,0040";
+                       reg = <0x00010000 0 0 0 0>;
+
+                       nvmem-cells = <&macaddr_art_6>;
+                       nvmem-cell-names = "mac-address";
+                       mac-address-increment = <(2)>;
+               };
+       };
 };
 
 &nand_controller {
index 54ae07590af8041ff713284fb4eb83a5270ddaca..863c5d7b1c32555c842b1f7d34a57dc6509875c3 100644 (file)
 
 &pcie0 {
        status = "okay";
+
+       bridge@0,0 {
+               reg = <0x00000000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+               ranges;
+
+               wifi@1,0 {
+                       compatible = "pci168c,0040";
+                       reg = <0x00010000 0 0 0 0>;
+
+                       nvmem-cells = <&macaddr_defaultmac_0>;
+                       nvmem-cell-names = "mac-address";
+                       mtd-mac-address-increment = <(-1)>;
+               };
+       };
 };
 
 &pcie1 {
        status = "okay";
        max-link-speed = <1>;
+
+       bridge@0,0 {
+               reg = <0x00000000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+               ranges;
+
+               wifi@1,0 {
+                       compatible = "pci168c,0040";
+                       reg = <0x00010000 0 0 0 0>;
+
+                       nvmem-cells = <&macaddr_defaultmac_0>;
+                       nvmem-cell-names = "mac-address";
+               };
+       };
 };
 
 &mdio0 {
index 7148fdf14317562e06a48744267b00a256283bc9..45da4a2b1193584ebc1ecb3f4f014aa1fecf2cad 100644 (file)
 
 &pcie0 {
        status = "okay";
+
+       bridge@0,0 {
+               reg = <0x00000000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+               ranges;
+
+               wifi@1,0 {
+                       compatible = "pci168c,0040";
+                       reg = <0x00010000 0 0 0 0>;
+
+                       nvmem-cells = <&macaddr_PRODUCTDATA_12>;
+                       nvmem-cell-names = "mac-address";
+               };
+       };
 };
 
 &pcie1 {
        status = "okay";
        max-link-speed = <1>;
+
+       bridge@0,0 {
+               reg = <0x00000000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+               ranges;
+
+               wifi@1,0 {
+                       compatible = "pci168c,0040";
+                       reg = <0x00010000 0 0 0 0>;
+
+                       nvmem-cells = <&macaddr_PRODUCTDATA_c>;
+                       nvmem-cell-names = "mac-address";
+               };
+       };
 };
 
 &qcom_pinmux {
        macaddr_PRODUCTDATA_6: macaddr@6 {
                reg = <0x6 0x6>;
        };
+
+       macaddr_PRODUCTDATA_c: macaddr@c {
+               reg = <0xc 0x6>;
+       };
+
+       macaddr_PRODUCTDATA_12: macaddr@12 {
+               reg = <0x12 0x6>;
+       };
 };
index 1cf5e3452f98eaa55f713ac5ad4aa8f047948b89..4b4e8736d42b60297ad1118543c79d75177cc96b 100644 (file)
 
 &pcie0 {
        status = "okay";
+
+       bridge@0,0 {
+               reg = <0x00000000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+               ranges;
+
+               wifi@1,0 {
+                       compatible = "pci168c,0040";
+                       reg = <0x00010000 0 0 0 0>;
+
+                       nvmem-cells = <&macaddr_ART_1e>;
+                       nvmem-cell-names = "mac-address";
+               };
+       };
 };
 
 &pcie1 {
        status = "okay";
        max-link-speed = <1>;
+
+       bridge@0,0 {
+               reg = <0x00000000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+               ranges;
+
+               wifi@1,0 {
+                       compatible = "pci168c,0040";
+                       reg = <0x00010000 0 0 0 0>;
+
+                       nvmem-cells = <&macaddr_ART_18>;
+                       nvmem-cell-names = "mac-address";
+               };
+       };
 };
 
 &qcom_pinmux {
        macaddr_ART_6: macaddr@6 {
                reg = <0x6 0x6>;
        };
+
+       macaddr_ART_18: macaddr@18 {
+               reg = <0x18 0x6>;
+       };
+
+       macaddr_ART_1e: macaddr@1e {
+               reg = <0x1e 0x6>;
+       };
 };