ath79: calibrate nand netgear wndrxxxx with nvmem
Driver for both soc (2.4GHz Wifi) and pci (5 GHz) now pull the calibration data from the nvmem subsystem. This allows us to move the userspace caldata extraction for the pci-e ath9k supported wifi into the device-tree definition of the device. wmac's nodes are also changed over to use nvmem-cells over OpenWrt's custom mtd-cal-data property. The wifi mac address remains correct after these changes, because When both "mac-address" and "calibration" are defined, the effective mac address comes from the cell corresponding to "mac-address" and mac-address-increment. Test passed on my wndr3700v4 and wndr4500v3. Signed-off-by: Edward Chow <equu@openmail.cc>
This commit is contained in:
		 Edward Chow
					Edward Chow
				
			
				
					committed by
					
						 Hauke Mehrtens
						Hauke Mehrtens
					
				
			
			
				
	
			
			
			 Hauke Mehrtens
						Hauke Mehrtens
					
				
			
						parent
						
							bca663f20f
						
					
				
				
					commit
					3d343ca713
				
			| @@ -243,9 +243,8 @@ | |||||||
| &wmac { | &wmac { | ||||||
| 	status = "okay"; | 	status = "okay"; | ||||||
|  |  | ||||||
| 	nvmem-cells = <&macaddr_caldata_0>; | 	nvmem-cells = <&macaddr_caldata_0>, <&cal_art_1000>; | ||||||
| 	nvmem-cell-names = "mac-address"; | 	nvmem-cell-names = "mac-address", "calibration"; | ||||||
| 	qca,no-eeprom; |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| &pcie { | &pcie { | ||||||
| @@ -254,9 +253,8 @@ | |||||||
| 	ath9k: wifi@0,0 { | 	ath9k: wifi@0,0 { | ||||||
| 		compatible = "pci168c,0033"; | 		compatible = "pci168c,0033"; | ||||||
| 		reg = <0x0000 0 0 0 0>; | 		reg = <0x0000 0 0 0 0>; | ||||||
| 		nvmem-cells = <&macaddr_caldata_c>; | 		nvmem-cells = <&macaddr_caldata_c>, <&cal_art_5000>; | ||||||
| 		nvmem-cell-names = "mac-address"; | 		nvmem-cell-names = "mac-address", "calibration"; | ||||||
| 		qca,no-eeprom; |  | ||||||
| 		#gpio-cells = <2>; | 		#gpio-cells = <2>; | ||||||
| 		gpio-controller; | 		gpio-controller; | ||||||
| 	}; | 	}; | ||||||
| @@ -274,4 +272,12 @@ | |||||||
| 	macaddr_caldata_c: macaddr@c { | 	macaddr_caldata_c: macaddr@c { | ||||||
| 		reg = <0xc 0x6>; | 		reg = <0xc 0x6>; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
|  | 	cal_art_1000: cal@1000 { | ||||||
|  | 		reg = <0x1000 0x440>; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	cal_art_5000: cal@5000 { | ||||||
|  | 		reg = <0x5000 0x440>; | ||||||
|  | 	}; | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -209,9 +209,8 @@ | |||||||
| &wmac { | &wmac { | ||||||
| 	status = "okay"; | 	status = "okay"; | ||||||
|  |  | ||||||
| 	nvmem-cells = <&macaddr_caldata_0>; | 	nvmem-cells = <&macaddr_caldata_0>, <&cal_art_1000>; | ||||||
| 	nvmem-cell-names = "mac-address"; | 	nvmem-cell-names = "mac-address", "calibration"; | ||||||
| 	qca,no-eeprom; |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| &pcie { | &pcie { | ||||||
| @@ -221,9 +220,8 @@ | |||||||
| 		/* chip is AR9580, override bogus PCI ID 168c:abcd */ | 		/* chip is AR9580, override bogus PCI ID 168c:abcd */ | ||||||
| 		compatible = "pci168c,0033"; | 		compatible = "pci168c,0033"; | ||||||
| 		reg = <0x0000 0 0 0 0>; | 		reg = <0x0000 0 0 0 0>; | ||||||
| 		nvmem-cells = <&macaddr_caldata_c>; | 		nvmem-cells = <&macaddr_caldata_c>, <&cal_art_5000>; | ||||||
| 		nvmem-cell-names = "mac-address"; | 		nvmem-cell-names = "mac-address", "calibration"; | ||||||
| 		qca,no-eeprom; |  | ||||||
| 		qca,gpio-mask=<0xf6ff>;	/* unmask pin 9 for RFKILL button */ | 		qca,gpio-mask=<0xf6ff>;	/* unmask pin 9 for RFKILL button */ | ||||||
| 		#gpio-cells = <2>; | 		#gpio-cells = <2>; | ||||||
| 		gpio-controller; | 		gpio-controller; | ||||||
| @@ -250,4 +248,12 @@ | |||||||
| 	macaddr_caldata_c: macaddr@c { | 	macaddr_caldata_c: macaddr@c { | ||||||
| 		reg = <0xc 0x6>; | 		reg = <0xc 0x6>; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
|  | 	cal_art_1000: cal@1000 { | ||||||
|  | 		reg = <0x1000 0x440>; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	cal_art_5000: cal@5000 { | ||||||
|  | 		reg = <0x5000 0x440>; | ||||||
|  | 	}; | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -12,29 +12,6 @@ case "$FIRMWARE" in | |||||||
| 	8dev,rambutan) | 	8dev,rambutan) | ||||||
| 		caldata_extract "caldata" 0x1000 0x800 | 		caldata_extract "caldata" 0x1000 0x800 | ||||||
| 		;; | 		;; | ||||||
| 	netgear,wndr3700-v4|\ |  | ||||||
| 	netgear,wndr4300|\ |  | ||||||
| 	netgear,wndr4300sw|\ |  | ||||||
| 	netgear,wndr4300tn|\ |  | ||||||
| 	netgear,wndr4300-v2|\ |  | ||||||
| 	netgear,wndr4500-v3) |  | ||||||
| 		caldata_extract "caldata" 0x1000 0x440 |  | ||||||
| 		;; |  | ||||||
| 	*) |  | ||||||
| 		caldata_die "board $board is not supported yet" |  | ||||||
| 		;; |  | ||||||
| 	esac |  | ||||||
| 	;; |  | ||||||
| "ath9k-eeprom-pci-0000:00:00.0.bin") |  | ||||||
| 	case $board in |  | ||||||
| 	netgear,wndr3700-v4|\ |  | ||||||
| 	netgear,wndr4300|\ |  | ||||||
| 	netgear,wndr4300sw|\ |  | ||||||
| 	netgear,wndr4300tn|\ |  | ||||||
| 	netgear,wndr4300-v2|\ |  | ||||||
| 	netgear,wndr4500-v3) |  | ||||||
| 		caldata_extract "caldata" 0x5000 0x440 |  | ||||||
| 		;; |  | ||||||
| 	*) | 	*) | ||||||
| 		caldata_die "board $board is not supported yet" | 		caldata_die "board $board is not supported yet" | ||||||
| 		;; | 		;; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user