Skip to content

Commit

Permalink
ath79: Meraki MR18: convert calibration data to nvmem-on-UBI
Browse files Browse the repository at this point in the history
Since UBI volumes can be used as nvmem devices now, port Meraki Insect
family to use that for applying calibration data. Definition for the
backup (raw) volume was set too, but it currently can't be used if UBI
volume is unavailable, due to lack of fallback mechanism.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
  • Loading branch information
Leo-PL committed Mar 1, 2024
1 parent dbc14e4 commit 3f59da2
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 52 deletions.
84 changes: 79 additions & 5 deletions target/linux/ath79/dts/qca9557_meraki_mr18.dts
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,22 @@
};

partition@1080000 {
label = "ubi";
compatible = "linux,ubi";
reg = <0x1080000 0x6f00000>;
label = "ubi";

volumes {
ubi_board_config: board-config {
label = "board-config";
};

ubi_caldata: caldata {
label = "caldata";
};
};
};

partition@7fe0000 {
odm_caldata: partition@7fe0000 {
/*
* This is not always present. And if
* it is, then Meraki (or contractor)
Expand Down Expand Up @@ -157,7 +168,8 @@
wifi@0,0 {
compatible = "pci168c,0033";
reg = <0x0000 0 0 0 0>;
qca,no-eeprom;
nvmem-cells = <&macaddr_board_config 66 2>, <&cal_caldata_5000>;
nvmem-cell-names = "mac-address", "calibration";
};
};

Expand All @@ -167,7 +179,8 @@
wifi@0,0 {
compatible = "pci168c,0033";
reg = <0x0000 0 0 0 0>;
qca,no-eeprom;
nvmem-cells = <&macaddr_board_config 66 3>, <&cal_caldata_9000>;
nvmem-cell-names = "mac-address", "calibration";
};
};

Expand All @@ -187,6 +200,8 @@
status = "okay";
pll-data = <0xa6000000 0xa0000101 0x80001313>;
phy-handle = <&phy>;
nvmem-cells = <&macaddr_board_config 66 0>;
nvmem-cell-names = "mac-address";

gmac-config {
device = <&gmac>;
Expand All @@ -198,5 +213,64 @@

&wmac {
status = "okay";
qca,no-eeprom;
nvmem-cells = <&macaddr_board_config 66 1>, <&cal_caldata_1000>;
nvmem-cell-names = "mac-address", "calibration";
};

&ubi_board_config {
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;

macaddr_board_config_66: macaddr@102 {
compatible = "mac-base";
reg = <0x66 0x6>;
#nvmem-cell-cells = <1>;
};
};
};

&odm_caldata {
/* Currently unused - please see the note in main node.
* Can be used as a backup (again) if a fallback mechanism
* can be implemented into nvmem subsystem for getting calibration data
*/
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;

cal_caldata_1000_backup: calibration@1000 {
reg = <0x1000 0x440>;
};

cal_caldata_5000_backup: calibration@5000 {
reg = <0x5000 0x440>;
};

cal_caldata_9000_backup: calibration@9000 {
reg = <0x9000 0x440>;
};
};
};

&ubi_caldata {
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;

cal_caldata_1000: calibration@1000 {
reg = <0x1000 0x440>;
};

cal_caldata_5000: calibration@5000 {
reg = <0x5000 0x440>;
};

cal_caldata_9000: calibration@9000 {
reg = <0x9000 0x440>;
};
};
};
3 changes: 0 additions & 3 deletions target/linux/ath79/nand/base-files/etc/board.d/02_network
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ ath79_setup_macs()
wan_mac=$(mtd_get_mac_binary art 0x0)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
meraki,mr18)
lan_mac=$(mtd_get_mac_binary_ubi board-config 102)
;;
netgear,wndr3700-v4|\
netgear,wndr4300|\
netgear,wndr4300sw|\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,6 @@ case "$FIRMWARE" in
8dev,rambutan)
caldata_extract "caldata" 0x1000 0x800
;;
meraki,mr18)
. /lib/upgrade/nand.sh

if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
caldata_extract_ubi "caldata" 0x1000 0x440
else
caldata_extract "odm-caldata" 0x1000 0x440
fi
ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 1)
;;
*)
caldata_die "board $board is not supported yet"
;;
esac
;;
"ath9k-eeprom-pci-0000:00:00.0.bin")
case $board in
meraki,mr18)
. /lib/upgrade/nand.sh

if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
caldata_extract_ubi "caldata" 0x5000 0x440
else
caldata_extract "odm-caldata" 0x5000 0x440
fi
ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 2)
;;
*)
caldata_die "board $board is not supported yet"
;;
esac
;;
"ath9k-eeprom-pci-0000:01:00.0.bin")
case $board in
meraki,mr18)
. /lib/upgrade/nand.sh

if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
caldata_extract_ubi "caldata" 0x9000 0x440
else
caldata_extract "odm-caldata" 0x9000 0x440
fi
ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 3)
;;
*)
caldata_die "board $board is not supported yet"
;;
Expand Down

0 comments on commit 3f59da2

Please sign in to comment.