[OpenWrt-Devel] Firmware loading in user space via hotplug (procd) is racy, radios don’t come up at first boot

2019-01-20 Thread Mark Mentovai
User-space firmware loading is handled by hotplug in procd. It’s directed
by /etc/hotplug.json. Paraphrasing:

[
[ "case", "ACTION", {
"add": [
[ "if",
[ "has", "FIRMWARE" ],
[
[ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ],
[ "load-firmware", "/lib/firmware" ],
[ "return" ]
]
]
],
} ],
]

hotplug-call is responsible for locating the correct firmware and placing
it in /lib/firmware. load-firmware instructs hotplug to feed the firmware
from /lib/firmware to the kernel via the appropriate protocol.

There’s no synchronization between the hotplug-call exec and load-firmware
actions, so they’re effectively done in parallel. A long-running
hotplug-call is sure to be missed by load-firmware.

I discovered this in an ath79 build for Netgear WNDR3x00 (3700, 3700v2,
3800) devices. At first boot following a sysupgrade, the radios don’t come
up, although they’re functional on subsequent boots. Calibration data for
the radios is requested by owl-loader via the firmware mechanism.
/etc/hotplug.d/firmware/10-ath9k-eeprom is able to pull it out of the art
MTD partition, but this is fairly time-consuming on first boot, taking
around 15 seconds of wall clock time. 10-ath9k-eeprom does eventually place
a file in /lib/firmware where it’s usable on subsequent boots, but this
isn’t finished until well after the load-firmware action runs (and doesn’t
find any firmware).

As a local workaround, for now, I’ve gotten rid of the load-firmware action
and replaced hotplug-call with another script that runs hotplug-call and
then, in sequence, follows the firmware protocol itself. This works well
(although it’s still somewhat troubling that it takes 15 seconds per radio
to read less than 4kB each from art) but it strikes me that it just papers
over a procd bug.

Is there any reason that procd doesn’t waitpid() for hotplug-call before
advancing to load-firmware? It seems like a problem that load-firmware
doesn’t wait for an exec that precedes it. As it stands now, it’s likely
that when load-firmware runs, firmware either won’t be present or will only
have been partially written to /lib/firmware.

ath79 relies much more heavily on the firmware loading mechanism for
calibration data, where ar71xx handled it very differently. I expect that
this affects a number of other ath79 devices, as well as devices on other
platforms that rely on hotplug-call to locate firmware.

Mark
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: adjust Netgear R6120 model name

2019-01-20 Thread David Bauer
Adjust the model string and device title to match other Netgear routers
in the ramips target.

Signed-off-by: David Bauer 
---
 target/linux/ramips/dts/R6120.dts   | 2 +-
 target/linux/ramips/image/mt76x8.mk | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/ramips/dts/R6120.dts 
b/target/linux/ramips/dts/R6120.dts
index 052933b766..375e400299 100644
--- a/target/linux/ramips/dts/R6120.dts
+++ b/target/linux/ramips/dts/R6120.dts
@@ -7,7 +7,7 @@
 
 / {
compatible = "netgear,r6120", "mediatek,mt7628an-soc";
-   model = "Netgear AC1200 R6120";
+   model = "Netgear R6120";
 
aliases {
led-boot = _power;
diff --git a/target/linux/ramips/image/mt76x8.mk 
b/target/linux/ramips/image/mt76x8.mk
index be3aeb1093..8b0fe3b38e 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -119,7 +119,7 @@ define Device/netgear_r6120
   DTS := R6120
   BLOCKSIZE := 64k
   IMAGE_SIZE := $(ralink_default_fw_size_16M)
-  DEVICE_TITLE := Netgear AC1200 R6120
+  DEVICE_TITLE := Netgear R6120
   DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci
   SERCOMM_HWID := CGQ
   SERCOMM_HWVER := A001
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Subject: [PATCH 2/2] ath79: GL.iNet AR300M family: Correct DTS LED definitions

2019-01-20 Thread Jeff Klesky

Follow-on patch to [PATCH 1/2] ath79: Add GL.iNet AR-300M-Lite present in
"Re: [OpenWrt-Devel] [PATCH] ath79: Add GL.iNet AR-300M-Lite: Setup with eth0 as 
LAN"

The familiar boot-sequence LED behavior is now present.

Jeff


From f485678e7f37b3f2995fefc1e7c41794091bd73e Mon Sep 17 00:00:00 2001
From: Jeff Kletsky 
Date: Sun, 20 Jan 2019 14:48:09 -0800
Subject: [PATCH 2/2] ath79: GL.iNet AR300M family: Correct DTS LED 
definitions


Change the "status" LED to proper GPIO 12 and "red" naming.

Remove GPIO 2 from definition as a USB LED.

GPIO 2 is used to control power to the USB socket, not an LED.
As such, PWM on the line or typical LED triggers are inappropriate.
Users who wish to control the USB power for custom applications
can manipulate the GPIO through code, or for example, export it
through /sys/class/gpio/export.

Runtime-tested:  GL.iNet AR300M-Lite

Signed-off-by: Jeff Kletsky 
---
 target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi | 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi 
b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi

index 2a0c4385cd..9baa6235b2 100644
--- a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi
@@ -41,13 +41,6 @@
 leds {
     compatible = "gpio-leds";

-        usb {
-            label = "gl-ar300m:green:usb";
-            gpios = < 2 GPIO_ACTIVE_LOW>;
-            trigger-sources = <_port>;
-            linux,default-trigger = "usbport";
-        };
-
     wlan {
         label = "gl-ar300m:green:wlan";
         gpios = < 14 GPIO_ACTIVE_LOW>;
@@ -60,8 +53,8 @@
     };

     led_status: status {
-            label = "gl-ar300m:green:status";
-            gpios = < 3 GPIO_ACTIVE_LOW>;
+            label = "gl-ar300m:red:status";
+            gpios = < 12 GPIO_ACTIVE_LOW>;
     };
 };
 };
--
2.11.0



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2019-01-20 Thread Jeff Klesky

On 1/16/19 9:03 PM, Petr Štetiar wrote:


Jeff Klesky  [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 
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 
---
 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 00..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 

Re: [OpenWrt-Devel] [PATCH] bcm53xx: add support for Phicomm K3

2019-01-20 Thread Rafał Miłecki

On 2019-01-19 18:39, Hao Dong wrote:

Hardware specifications:

- CPU: Broadcom BCM4709C0 @1.4GHz (Dual-Core ARM)
- RAM: 512 MB (DDR3)
- Flash: 128 MB (NAND)
- LAN ports: 3, LAN speed: 10/100/1000
- WAN ports: 1, WAN speed: 10/100/1000
- 2.4G: BCM4366 4x4 MIMO 1000Mbps -- Skyworks SE2623L 2.4GHz Power
Amplifier (x4)
- 5G: BCM4366 4x4 MIMO 2167Mbps -- RFMD RFPA5542 5GHz Power Amplifier
Module (x4)
- USB: 1x USB 3.0 port
- 1x LED, 1x reset button, 1x power switch
- 1x system status touch screen

Flash:

- Enter CFE
- Upload the trx file
- Reboot

Signed-off-by: Hao Dong 


Pushed, thanks!

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] lantiq: Netgear DM200 kernel too large

2019-01-20 Thread Thomas Nixon
Hi,

With a recent snapshot my Netgear DM200 failed to boot because the bootloader
only loads the first 2MiB of the kernel into memory before booting, while the
kernel image has grown to 2.017MiB.

This is obviously Not Good, but I'm not sure what to do about it. What do you
think is the best way to deal with this?

This probably isn't an issue on other boards; the only other xrx200 board with
a KERNEL_SIZE set is the fritz3370 at 4096k, so messing with the kernel config
for all xrx200 boards seems a bit silly.

I could add a new subtarget like xrx200 but with small_flash enabled, but this
seems a bit excessive for a single board. The DM200 has generally been a pain
to support, and there are better options out there, so I wonder if it makes
more sense to just drop it.

For anyone else with this problem ("Verifying Checksum ... Bad Data CRC") who
just needs it to work, I modified the uboot `bootcmd` variable:

old:

sleep 1;nmrp;sf probe 0:3;sf read $loadaddr 0x3 0x20;bootm $loadaddr

new:

sleep 1;nmrp;sf probe 0:3;sf read $loadaddr 0x3 0x40;bootm $loadaddr

Thanks,

Tom

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v1] ath79: Add support for Devolo WiFi Pro 1750e

2019-01-20 Thread D J Armstrong
Hardware

CPU:   Qualcomm Atheros QCA9558
RAM:   128M DDR2
FLASH: 16MiB
ETH:   1x Atheros AR8035 (PoE in)
   1x Atheros AR8033
WiFi2: QCA9558 3T3R (SiGE SE2565T 2.4 GHz power amp x3)
WiFi5: QCA9880 3T3R (Skyworks 5003L1 5 GHz power amp x3)
BTN:   1x Reset
   1x WPS
   1x USB eject
LED:   1x LED blue
   1x LED red
BEEP:  1x GPIO attached piezo beeper
UART:  3.3V GND TX RX (115200-N-8) (3.3V is pin closest to rear ports)
   Dupont 4 pin header
   Rear RJ45 serial port non-functional
USB:   1x v2.0

Installation

Make sure you set a password for the root user as prompted on first
setup!

1. Upload OpenWRT sysupgrade image via SSH to the device.
Use /tmp as the destination folder on the device.
User is root, password previously set in the web interface.

2. Install OpenWRT with

> sysupgrade -n -F /tmp/

Signed-off-by: Django Armstrong 
---
 .../linux/ath79/base-files/etc/board.d/02_network  |  3 +-
 .../etc/hotplug.d/firmware/11-ath10k-caldata   |  1 +
 target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts | 83 ++
 target/linux/ath79/image/generic.mk|  8 +++
 4 files changed, 94 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ath79/dts/qca9558_devolo_dvl1750e.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..6c732d854e 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -62,7 +62,8 @@ ath79_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth0" "1:lan:1" "3:lan:4" "4:lan:3" "5:lan:2" "2:wan"
;;
-   devolo,dvl1200e)
+   devolo,dvl1200e|\
+   devolo,dvl1750e)
ucidef_set_interface_lan "eth0 eth1"
;;
dlink,dir-825-b1)
diff --git 
a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 76efa24b52..84e43ceee5 100644
--- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -90,6 +90,7 @@ case "$FIRMWARE" in
devolo,dvl1200e|\
devolo,dvl1200i|\
devolo,dvl1750c|\
+   devolo,dvl1750e|\
devolo,dvl1750i)
ath10kcal_extract "art" 20480 2116
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 
0) -1)
diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts 
b/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts
new file mode 100644
index 00..2570eb7cea
--- /dev/null
+++ b/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts
@@ -0,0 +1,83 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include 
+#include 
+
+#include "qca9558_devolo_dvl1xxx.dtsi"
+
+/ {
+   compatible = "devolo,dvl1750e", "qca,qca9557";
+   model = "devolo WiFi pro 1750e";
+
+   aliases {
+   led-boot = _blue;
+   led-failsafe = _red;
+   led-running = _blue;
+   led-upgrade = _red;
+   };
+
+   keys {
+   wps {
+   label = "WPS Button";
+   linux,code = ;
+   gpios = < 16 GPIO_ACTIVE_LOW>;
+   debounce-interval = <60>;
+   };
+
+   usb_eject {
+   label = "USB Eject Button";
+   linux,code = ;
+   linux,input-type = ;
+   gpios = < 19 GPIO_ACTIVE_LOW>;
+   debounce-interval = <60>;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   status_blue: status_blue {
+   label = "dvl1750e:blue:status";
+   gpios = < 14 GPIO_ACTIVE_LOW>;
+   default-state = "on";
+   };
+
+   status_red: status_red {
+   label = "dvl1750e:red:status";
+   gpios = < 15 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   beeper {
+   compatible = "gpio-beeper";
+   gpios = < 4 GPIO_ACTIVE_HIGH>;
+   };
+
+
+   gpio_export {
+   compatible = "gpio-export";
+
+   gpio_usb_power {
+   gpio-export,name = "devolo:power:usb";
+   gpio-export,output = <1>;
+   gpios = < 11 GPIO_ACTIVE_HIGH>;
+   };
+   };
+};
+
+_phy0 {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
diff --git a/target/linux/ath79/image/generic.mk 
b/target/linux/ath79/image/generic.mk
index 22ba5305b1..9d0412fe97 100644
--- a/target/linux/ath79/image/generic.mk
+++