diff mbox series

[OpenWrt-Devel] ath79: Add GL.iNet AR-300M-Lite: Setup with eth0 as LAN

Message ID 123e5041-846e-bd3c-5c04-5e5b9631b2e1@wagsky.com
State Superseded, archived
Headers show
Series [OpenWrt-Devel] ath79: Add GL.iNet AR-300M-Lite: Setup with eth0 as LAN | expand

Commit Message

Jeff Kletsky Jan. 17, 2019, 5:48 a.m. UTC
From f6c780752d5812b24a923286700a58f174d792ae Mon Sep 17 00:00:00 2001
From: Jeff Kletsky <git-commits@allycomm.com>
Date: Wed, 16 Jan 2019 12:32:15 -0800
Subject: [PATCH] ath79: Add GL.iNet AR-300M-Lite: Setup with eth0 as LAN

AR300M-Lite is single-Ethernet variant of the AR300M series
Its eth0 would otherwise be assigned to the WAN interface
making it unreachable firstboot or failsafe.

Removes the assignment of GPIO 2 as an "LED" as the feature
to switch the power to the USB port is not present this version

Installation instructions from OEM (OpenWrt variant):
* Upload the sysupgrade image to the device
* Flash with "sysupgrade -n -F <path to uploaded image>"

Tested on GL.iNet AR300M-Lite

Signed-off-by: Jeff Kletsky <git-commits@allycomm.com>
---
  target/linux/ath79/base-files/etc/board.d/02_network     |  1 +
  target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts | 11 +++++++++++
  target/linux/ath79/image/generic.mk                      |  9 +++++++++
  3 files changed, 21 insertions(+)
  create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts

Comments

Petr Štetiar Jan. 17, 2019, 5:03 a.m. UTC | #1
Jeff Klesky <lede@allycomm.com> [2019-01-16 21:48:11]:

Hi,

subject could be just `ath79: Add support for GL.iNet AR-300M-Lite`, since
you've already added that information about eth0 in the commit message, and
that's the place where it belongs.

> --- a/target/linux/ath79/image/generic.mk
> +++ b/target/linux/ath79/image/generic.mk
> @@ -296,6 +296,15 @@ define Device/glinet_gl-ar150
>  endef
>  TARGET_DEVICES += glinet_gl-ar150

you're missing newline here.

> +define Device/glinet_gl-ar300m-lite
> +  ATH_SOC := qca9531
> +  DEVICE_TITLE := GL.iNet GL-AR300M-Lite
> +  DEVICE_PACKAGES := kmod-usb-core kmod-usb2
> +  IMAGE_SIZE := 16000k
> +  SUPPORTED_DEVICES += gl-ar300m-lite

The correct supported devices entry for your board is added by:

  SUPPORTED_DEVICES := $(subst _,$(comma),$(1))

in target/linux/ath79/image/Makefile.

The extension of the SUPPORTED_DEVICES is only required if the board used a
different userspace boardname in the past and you want to upgrade from an
image using the old name to this image (which is using the new name).

Since you add support for a new board, you don't need to take care of former
used userspace boardnames.

> +endef
> +TARGET_DEVICES += glinet_gl-ar300m-lite
> +
>  define Device/glinet_gl-ar300m-nor
>    ATH_SOC := qca9531
>    DEVICE_TITLE := GL.iNet GL-AR300M

In the spirit of DRY principle, this could be refactored into something like
this:

 define Device/glinet_gl-ar300
   ATH_SOC := qca9531
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2
   IMAGE_SIZE := 16000k
 endef

 define Device/glinet_gl-ar300m-nor
   $(Device/glinet_gl-ar300)
   DEVICE_TITLE := GL.iNet GL-AR300M
   SUPPORTED_DEVICES += gl-ar300m
 endef
 TARGET_DEVICES += glinet_gl-ar300m-nor

 define Device/glinet_gl-ar300m-lite
   $(Device/glinet_gl-ar300)
   DEVICE_TITLE := GL.iNet GL-AR300M-Lite
 endef
 TARGET_DEVICES += glinet_gl-ar300m-lite

-- ynezz
Jeff Kletsky Jan. 20, 2019, 11:21 p.m. UTC | #2
On 1/16/19 9:03 PM, Petr Štetiar wrote:

> Jeff Klesky <lede@allycomm.com> [2019-01-16 21:48:11]:
>
> Hi,
>
> subject could be just `ath79: Add support for GL.iNet AR-300M-Lite`, since
> you've already added that information about eth0 in the commit message, and
> that's the place where it belongs.

Thanks for all your suggestions. Updated patches attached have clear, simple headlines.

>
>> --- a/target/linux/ath79/image/generic.mk
>> +++ b/target/linux/ath79/image/generic.mk
>> @@ -296,6 +296,15 @@ define Device/glinet_gl-ar150
>>   endef
>>   TARGET_DEVICES += glinet_gl-ar150
> you're missing newline here.

Not sure where it was missing, but the spacing looks self-consistent
with the current patches that follow.

>
>> +define Device/glinet_gl-ar300m-lite
>> +  ATH_SOC := qca9531
>> +  DEVICE_TITLE := GL.iNet GL-AR300M-Lite
>> +  DEVICE_PACKAGES := kmod-usb-core kmod-usb2
>> +  IMAGE_SIZE := 16000k
>> +  SUPPORTED_DEVICES += gl-ar300m-lite
> The correct supported devices entry for your board is added by:
>
> [...]
>
> Since you add support for a new board, you don't need to take care of former
> used userspace boardnames.

Thanks for the insight -- it allowed me to use the proper SUPPORTED_DEVICES
to allow the OpenWrt build to be installed with the OEM-supplied LuCI

>> +endef
>> +TARGET_DEVICES += glinet_gl-ar300m-lite
>> +
>>   define Device/glinet_gl-ar300m-nor
>>     ATH_SOC := qca9531
>>     DEVICE_TITLE := GL.iNet GL-AR300M
> In the spirit of DRY principle, this could be refactored into something like
> this:
>
>   define Device/glinet_gl-ar300
>     ATH_SOC := qca9531
>     DEVICE_PACKAGES := kmod-usb-core kmod-usb2
>     IMAGE_SIZE := 16000k
>   endef
>
>   define Device/glinet_gl-ar300m-nor
>     $(Device/glinet_gl-ar300)
>     DEVICE_TITLE := GL.iNet GL-AR300M
>     SUPPORTED_DEVICES += gl-ar300m
>   endef
>   TARGET_DEVICES += glinet_gl-ar300m-nor
>
>   define Device/glinet_gl-ar300m-lite
>     $(Device/glinet_gl-ar300)
>     DEVICE_TITLE := GL.iNet GL-AR300M-Lite
>   endef
>   TARGET_DEVICES += glinet_gl-ar300m-lite
>
> -- ynezz

Great idea, done!

At some point I'd like to refactor out the duplication in the NOR flash layout,
but I haven't been successful yet with my DTS-fu in referencing
the compatible and label parameters within partition@2 of the NOR flash,
as they are subtly different in the NAND variant.

Another day, perhaps once I get going with moving the AR750S NAND to ath79.

Jeff




 From 2e3b968813e3862c5319c6c360781b0921d4b413 Mon Sep 17 00:00:00 2001
From: Jeff Kletsky <git-commits@allycomm.com>
Date: Sun, 20 Jan 2019 14:07:30 -0800
Subject: [PATCH 1/2] ath79: Add GL.iNet AR-300M-Lite

AR300M-Lite is single-Ethernet variant of the AR300M series
Its eth0 would otherwise be assigned to the WAN interface
making it unreachable firstboot or failsafe.

Installation instructions from OEM (OpenWrt variant):
* Install sysupgrade.bin using OEM's "Advanced" GUI (LuCI),
   * Do not preserve settings
* Access rebooted device via Ethernet at OpenWrt default address

Runtime-tested:  GL.iNet AR300M-Lite

Signed-off-by: Jeff Kletsky <git-commits@allycomm.com>
---
  target/linux/ath79/base-files/etc/board.d/02_network     |  1 +
  target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts |  8 ++++++++
  target/linux/ath79/image/generic.mk                      | 14 ++++++++++++--
  3 files changed, 21 insertions(+), 2 deletions(-)
  create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts

diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network
index 3eb0e413f3..fa947203f8 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -13,6 +13,7 @@ ath79_setup_interfaces()
  	devolo,dvl1200i|\
  	devolo,dvl1750c|\
  	devolo,dvl1750i|\
+	glinet,ar300m-lite|\
  	ocedo,koala|\
  	ocedo,raccoon|\
  	pcs,cap324|\
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts
new file mode 100644
index 0000000000..b14d1a47a9
--- /dev/null
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts
@@ -0,0 +1,8 @@
+/dts-v1/;
+
+#include "qca9531_glinet_gl-ar300m-nor.dts"
+
+/ {
+	compatible = "glinet,gl-ar300m-lite", "qca,qca9531";
+	model = "GL.iNet GL-AR300M-Lite";
+};
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 22ba5305b1..2021d83471 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -296,13 +296,23 @@ define Device/glinet_gl-ar150
  endef
  TARGET_DEVICES += glinet_gl-ar150
  
-define Device/glinet_gl-ar300m-nor
+define Device/glinet_gl-ar300m-common-nor
    ATH_SOC := qca9531
-  DEVICE_TITLE := GL.iNet GL-AR300M
    DEVICE_PACKAGES := kmod-usb-core kmod-usb2
    IMAGE_SIZE := 16000k
    SUPPORTED_DEVICES += gl-ar300m
  endef
+
+define Device/glinet_gl-ar300m-lite
+  $(Device/glinet_gl-ar300m-common-nor)
+  DEVICE_TITLE := GL.iNet GL-AR300M-Lite
+endef
+TARGET_DEVICES += glinet_gl-ar300m-lite
+
+define Device/glinet_gl-ar300m-nor
+  $(Device/glinet_gl-ar300m-common-nor)
+  DEVICE_TITLE := GL.iNet GL-AR300M
+endef
  TARGET_DEVICES += glinet_gl-ar300m-nor
  
  define Device/glinet_gl-ar750s
Mathias Kresin Jan. 26, 2019, 2:24 p.m. UTC | #3
21/01/2019 00:21, Jeff Klesky:
> On 1/16/19 9:03 PM, Petr Štetiar wrote:
> 
>> Jeff Klesky <lede@allycomm.com> [2019-01-16 21:48:11]:
>>
>> Hi,
>>
>> subject could be just `ath79: Add support for GL.iNet AR-300M-Lite`, 
>> since
>> you've already added that information about eth0 in the commit 
>> message, and
>> that's the place where it belongs.
> 
> Thanks for all your suggestions. Updated patches attached have clear, 
> simple headlines.
> 
>>
>>> --- a/target/linux/ath79/image/generic.mk
>>> +++ b/target/linux/ath79/image/generic.mk
>>> @@ -296,6 +296,15 @@ define Device/glinet_gl-ar150
>>>   endef
>>>   TARGET_DEVICES += glinet_gl-ar150
>> you're missing newline here.
> 
> Not sure where it was missing, but the spacing looks self-consistent
> with the current patches that follow.
> 
>>
>>> +define Device/glinet_gl-ar300m-lite
>>> +  ATH_SOC := qca9531
>>> +  DEVICE_TITLE := GL.iNet GL-AR300M-Lite
>>> +  DEVICE_PACKAGES := kmod-usb-core kmod-usb2
>>> +  IMAGE_SIZE := 16000k
>>> +  SUPPORTED_DEVICES += gl-ar300m-lite
>> The correct supported devices entry for your board is added by:
>>
>> [...]
>>
>> Since you add support for a new board, you don't need to take care of 
>> former
>> used userspace boardnames.
> 
> Thanks for the insight -- it allowed me to use the proper SUPPORTED_DEVICES
> to allow the OpenWrt build to be installed with the OEM-supplied LuCI
> 
>>> +endef
>>> +TARGET_DEVICES += glinet_gl-ar300m-lite
>>> +
>>>   define Device/glinet_gl-ar300m-nor
>>>     ATH_SOC := qca9531
>>>     DEVICE_TITLE := GL.iNet GL-AR300M
>> In the spirit of DRY principle, this could be refactored into 
>> something like
>> this:
>>
>>   define Device/glinet_gl-ar300
>>     ATH_SOC := qca9531
>>     DEVICE_PACKAGES := kmod-usb-core kmod-usb2
>>     IMAGE_SIZE := 16000k
>>   endef
>>
>>   define Device/glinet_gl-ar300m-nor
>>     $(Device/glinet_gl-ar300)
>>     DEVICE_TITLE := GL.iNet GL-AR300M
>>     SUPPORTED_DEVICES += gl-ar300m
>>   endef
>>   TARGET_DEVICES += glinet_gl-ar300m-nor
>>
>>   define Device/glinet_gl-ar300m-lite
>>     $(Device/glinet_gl-ar300)
>>     DEVICE_TITLE := GL.iNet GL-AR300M-Lite
>>   endef
>>   TARGET_DEVICES += glinet_gl-ar300m-lite
>>
>> -- ynezz
> 
> Great idea, done!
> 
> At some point I'd like to refactor out the duplication in the NOR flash 
> layout,
> but I haven't been successful yet with my DTS-fu in referencing
> the compatible and label parameters within partition@2 of the NOR flash,
> as they are subtly different in the NAND variant.
> 
> Another day, perhaps once I get going with moving the AR750S NAND to ath79.
> 
> Jeff
> 
> 
> 
> 
>  From 2e3b968813e3862c5319c6c360781b0921d4b413 Mon Sep 17 00:00:00 2001
> From: Jeff Kletsky <git-commits@allycomm.com>
> Date: Sun, 20 Jan 2019 14:07:30 -0800
> Subject: [PATCH 1/2] ath79: Add GL.iNet AR-300M-Lite
> 
> AR300M-Lite is single-Ethernet variant of the AR300M series
> Its eth0 would otherwise be assigned to the WAN interface
> making it unreachable firstboot or failsafe.
> 
> Installation instructions from OEM (OpenWrt variant):
> * Install sysupgrade.bin using OEM's "Advanced" GUI (LuCI),
>    * Do not preserve settings
> * Access rebooted device via Ethernet at OpenWrt default address
> 
> Runtime-tested:  GL.iNet AR300M-Lite
> 
> Signed-off-by: Jeff Kletsky <git-commits@allycomm.com>
> ---
>   target/linux/ath79/base-files/etc/board.d/02_network     |  1 +
>   target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts |  8 ++++++++
>   target/linux/ath79/image/generic.mk                      | 14 
> ++++++++++++--
>   3 files changed, 21 insertions(+), 2 deletions(-)
>   create mode 100644 
> target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts
> 
> diff --git a/target/linux/ath79/base-files/etc/board.d/02_network 
> b/target/linux/ath79/base-files/etc/board.d/02_network
> index 3eb0e413f3..fa947203f8 100755
> --- a/target/linux/ath79/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/base-files/etc/board.d/02_network
> @@ -13,6 +13,7 @@ ath79_setup_interfaces()
>       devolo,dvl1200i|\
>       devolo,dvl1750c|\
>       devolo,dvl1750i|\
> +    glinet,ar300m-lite|\
>       ocedo,koala|\
>       ocedo,raccoon|\
>       pcs,cap324|\
> diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts 
> b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts
> new file mode 100644
> index 0000000000..b14d1a47a9
> --- /dev/null
> +++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts
> @@ -0,0 +1,8 @@
> +/dts-v1/;
> +
> +#include "qca9531_glinet_gl-ar300m-nor.dts"
> +
> +/ {
> +    compatible = "glinet,gl-ar300m-lite", "qca,qca9531";
> +    model = "GL.iNet GL-AR300M-Lite";
> +};
> diff --git a/target/linux/ath79/image/generic.mk 
> b/target/linux/ath79/image/generic.mk
> index 22ba5305b1..2021d83471 100644
> --- a/target/linux/ath79/image/generic.mk
> +++ b/target/linux/ath79/image/generic.mk
> @@ -296,13 +296,23 @@ define Device/glinet_gl-ar150
>   endef
>   TARGET_DEVICES += glinet_gl-ar150
> 
> -define Device/glinet_gl-ar300m-nor
> +define Device/glinet_gl-ar300m-common-nor
>     ATH_SOC := qca9531
> -  DEVICE_TITLE := GL.iNet GL-AR300M
>     DEVICE_PACKAGES := kmod-usb-core kmod-usb2
>     IMAGE_SIZE := 16000k
>     SUPPORTED_DEVICES += gl-ar300m
>   endef
> +
> +define Device/glinet_gl-ar300m-lite
> +  $(Device/glinet_gl-ar300m-common-nor)
> +  DEVICE_TITLE := GL.iNet GL-AR300M-Lite
> +endef
> +TARGET_DEVICES += glinet_gl-ar300m-lite
> +
> +define Device/glinet_gl-ar300m-nor
> +  $(Device/glinet_gl-ar300m-common-nor)
> +  DEVICE_TITLE := GL.iNet GL-AR300M
> +endef
>   TARGET_DEVICES += glinet_gl-ar300m-nor
> 
>   define Device/glinet_gl-ar750s

Please resend the patch! Patchwork failed to pickup the "patch as a 
reply" [0].

Mathias

[0] https://patchwork.ozlabs.org/patch/1026411/
diff mbox series

Patch

diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network
index 3eb0e413f3..fa947203f8 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -13,6 +13,7 @@  ath79_setup_interfaces()
  	devolo,dvl1200i|\
  	devolo,dvl1750c|\
  	devolo,dvl1750i|\
+	glinet,ar300m-lite|\
  	ocedo,koala|\
  	ocedo,raccoon|\
  	pcs,cap324|\
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts
new file mode 100644
index 0000000000..c38fcf735d
--- /dev/null
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts
@@ -0,0 +1,11 @@ 
+/dts-v1/;
+
+#include "qca9531_glinet_gl-ar300m-nor.dts"
+
+/ {
+	compatible = "glinet,gl-ar300m-lite", "qca,qca9531";
+	model = "GL.iNet GL-AR300M-Lite";
+};
+
+/delete-node/ &{/leds/usb};
+
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 22ba5305b1..38cdd5d109 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -296,6 +296,15 @@  define Device/glinet_gl-ar150
  endef
  TARGET_DEVICES += glinet_gl-ar150
  
+define Device/glinet_gl-ar300m-lite
+  ATH_SOC := qca9531
+  DEVICE_TITLE := GL.iNet GL-AR300M-Lite
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2
+  IMAGE_SIZE := 16000k
+  SUPPORTED_DEVICES += gl-ar300m-lite
+endef
+TARGET_DEVICES += glinet_gl-ar300m-lite
+
  define Device/glinet_gl-ar300m-nor
    ATH_SOC := qca9531
    DEVICE_TITLE := GL.iNet GL-AR300M