diff mbox series

[OpenWrt-Devel,v5,2/5] ath79: WNR612v2: improve device support

Message ID 20191016123951.0ed754a4@kosmio.komorska
State Accepted
Delegated to: John Crispin
Headers show
Series ath79: add support for some Netgear WNR routers | expand

Commit Message

Michal Cieslakiewicz Oct. 16, 2019, 10:39 a.m. UTC
This patch improves ath79 support for Netgear WNR612v2.
Router functionality becomes identical to ar71xx version.

Changes include:
* software control over LAN LEDs via sysfs
* correct MAC addresses for network interfaces
* correct image size in device definition
* dts: 'keys' renamed to 'ath9k-keys'
* dts: 'label-mac-device' set to eth1 (LAN)
* dts: formatting adjustments

Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
---
 .../ath79/dts/ar7240_netgear_wnr612-v2.dts    |  2 +-
 .../ath79/dts/ar7240_netgear_wnr612-v2.dtsi   | 23 +++++++++++++------
 target/linux/ath79/dts/ar7240_on_n150r.dts    |  2 +-
 target/linux/ath79/image/tiny-netgear.mk      |  2 +-
 4 files changed, 19 insertions(+), 10 deletions(-)

Comments

Adrian Schmutzler Oct. 16, 2019, 9:10 p.m. UTC | #1
Hi,

>  &pcie {
> @@ -116,6 +123,8 @@
>  	ath9k: wifi@0,0 {
>  		compatible = "pci168c,002b";
>  		reg = <0x0000 0 0 0 0>;
> +		mtd-mac-address = <&art 0x0>;
> +		mtd-mac-address-increment = <1>;

Sorry if I ask again, but I do not remember whether I asked this already: Is there a valid MAC address in the calibration data (0x1002 or 0x1006 ...)?
I just can't believe that eth0/eth1 are set from art but Wifi needs to be calculated.

Best

Adrian
Michal Cieslakiewicz Oct. 17, 2019, 6:56 a.m. UTC | #2
On Wed, 16 Oct 2019 23:10:45 +0200
<mail@adrianschmutzler.de> wrote:

> Hi,
> 
> >  &pcie {
> > @@ -116,6 +123,8 @@
> >  	ath9k: wifi@0,0 {
> >  		compatible = "pci168c,002b";
> >  		reg = <0x0000 0 0 0 0>;
> > +		mtd-mac-address = <&art 0x0>;
> > +		mtd-mac-address-increment = <1>;  
> 
> Sorry if I ask again, but I do not remember whether I asked this
> already: Is there a valid MAC address in the calibration data (0x1002
> or 0x1006 ...)? I just can't believe that eth0/eth1 are set from art
> but Wifi needs to be calculated.
> 
> Best
> 
> Adrian

Hello Adrian,

Yes, you've raised this topic, albeit without above offsets:
https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg47839.html
Anyway, verified again for 612v2, nothing resembling hw address at
0x1002, 0x1006 or 0x108c.

Best regards
Michal
diff mbox series

Patch

diff --git a/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dts b/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dts
index b568d90eff..41dbe709a0 100644
--- a/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dts
+++ b/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dts
@@ -4,6 +4,6 @@ 
 #include "ar7240_netgear_wnr612-v2.dtsi"
 
 / {
-	model = "Netgear WNR612 v2";
 	compatible = "netgear,wnr612-v2", "qca,ar7240";
+	model = "Netgear WNR612 v2";
 };
diff --git a/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dtsi b/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dtsi
index 8e934429a3..4bff7c8b78 100644
--- a/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dtsi
+++ b/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dtsi
@@ -12,9 +12,10 @@ 
 		led-failsafe = &power;
 		led-running = &power;
 		led-upgrade = &power;
+		label-mac-device = &eth1;
 	};
 
-	keys {
+	ath9k-keys {
 		compatible = "gpio-keys-polled";
 		poll-interval = <20>;
 
@@ -28,6 +29,10 @@ 
 
 	leds {
 		compatible = "gpio-leds";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&jtag_disable_pins &switch_led_disable_pins &clks_disable_pins>;
+
 		power: power {
 			label = "netgear:green:power";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
@@ -47,6 +52,10 @@ 
 			label = "netgear:green:wan";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
+	};
+
+	ath9k-leds {
+		compatible = "gpio-leds";
 
 		wlan: wlan {
 			label = "netgear:green:wlan";
@@ -70,7 +79,7 @@ 
 			#address-cells = <1>;
 			#size-cells = <1>;
 
-			uboot: partition@0 {
+			partition@0 {
 				reg = <0x0 0x40000>;
 				label = "u-boot";
 				read-only;
@@ -87,7 +96,7 @@ 
 				label = "firmware";
 			};
 
-			partition@3f0000 {
+			art: partition@3f0000 {
 				reg = <0x3f0000 0x10000>;
 				label = "art";
 				read-only;
@@ -99,15 +108,13 @@ 
 &eth0 {
 	status = "okay";
 
-	mtd-mac-address = <&uboot 0x1fc00>;
-	mtd-mac-address-increment = <(-1)>;
+	mtd-mac-address = <&art 0x0>;
 };
 
 &eth1 {
 	status = "okay";
 
-	mtd-mac-address = <&uboot 0x1fc00>;
-	mtd-mac-address-increment = <1>;
+	mtd-mac-address = <&art 0x6>;
 };
 
 &pcie {
@@ -116,6 +123,8 @@ 
 	ath9k: wifi@0,0 {
 		compatible = "pci168c,002b";
 		reg = <0x0000 0 0 0 0>;
+		mtd-mac-address = <&art 0x0>;
+		mtd-mac-address-increment = <1>;
 		qca,no-eeprom;
 		#gpio-cells = <2>;
 		gpio-controller;
diff --git a/target/linux/ath79/dts/ar7240_on_n150r.dts b/target/linux/ath79/dts/ar7240_on_n150r.dts
index 3aaa07f724..8322276213 100644
--- a/target/linux/ath79/dts/ar7240_on_n150r.dts
+++ b/target/linux/ath79/dts/ar7240_on_n150r.dts
@@ -4,6 +4,6 @@ 
 #include "ar7240_netgear_wnr612-v2.dtsi"
 
 / {
-	model = "ON Network N150R";
 	compatible = "on,n150r", "qca,ar7240";
+	model = "ON Network N150R";
 };
diff --git a/target/linux/ath79/image/tiny-netgear.mk b/target/linux/ath79/image/tiny-netgear.mk
index 67ef28c9cc..2f17d79757 100644
--- a/target/linux/ath79/image/tiny-netgear.mk
+++ b/target/linux/ath79/image/tiny-netgear.mk
@@ -4,7 +4,7 @@  define Device/netgear_ar7240
   ATH_SOC := ar7240
   NETGEAR_KERNEL_MAGIC := 0x32303631
   KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma
-  IMAGE_SIZE := 3904k
+  IMAGE_SIZE := 3712k
   IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | append-rootfs | pad-rootfs
   $(Device/netgear_ath79)
 endef