[PATCH] ath79: add support for onion omega

2021-08-11 Thread Jan-Niklas Burfeind
The Onion Omega is a hardware development platform with built-in WiFi.

https://onioniot.github.io/wiki/

Specifications:
 - QCA9331 @ 400 MHz (MIPS 24Kc Big-Endian Processor)
 - 64MB of DDR2 RAM running at 400 MHz
 - 16MB of on-board flash storage
 - Support for USB 2.0
 - Support for Ethernet at 100 Mbps
 - 802.11b/g/n WiFi at 150 Mbps
 - 18 digital GPIOs
 - A single Serial UART
 - Support for SPI
 - Support for I2S

Flash instructions:
The device is running OpenWrt upon release using the ar71xx target.
Both a sysupgrade
and uploading the factory image using u-boots web-UI do work fine.

Depending on the ssh client, it might be necessary to enable outdated
KeyExchange methods e.g. in the clients ssh-config:

Host 192.168.1.1
KexAlgorithms +diffie-hellman-group1-sha1

The stock credentials are: root onioneer

For u-boots web-UI manually configure `192.168.1.2/24` on your computer,
connect to `192.168.1.1`.

MAC addresses as verified by OEM firmware:
2G   phy0  label
LAN  eth0  label - 1

LAN is only available in combination with an optional expansion dock.

Based on vendor acked commit:
commit 5cd49bb067ca ("ar71xx: add support for Onion Omega")

Partly reverts:
commit fc553c7e4c8e ("ath79: drop unused/incomplete dts")

Signed-off-by: Jan-Niklas Burfeind 
---
 target/linux/ath79/dts/ar9331_onion_omega.dts | 138 ++
 .../generic/base-files/etc/board.d/02_network |   1 +
 target/linux/ath79/image/generic.mk   |  14 ++
 3 files changed, 153 insertions(+)
 create mode 100644 target/linux/ath79/dts/ar9331_onion_omega.dts

diff --git a/target/linux/ath79/dts/ar9331_onion_omega.dts 
b/target/linux/ath79/dts/ar9331_onion_omega.dts
new file mode 100644
index 00..3b72a293b4
--- /dev/null
+++ b/target/linux/ath79/dts/ar9331_onion_omega.dts
@@ -0,0 +1,138 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include 
+#include 
+
+#include "ar9331.dtsi"
+
+/ {
+   model = "Onion Omega";
+   compatible = "onion,omega", "qca,ar9331";
+
+   aliases {
+   serial0 = 
+   led-boot = _system;
+   led-failsafe = _system;
+   led-running = _system;
+   led-upgrade = _system;
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led_system: system {
+   label = "onion:amber:system";
+   gpios = < 27 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   keys {
+   compatible = "gpio-keys-polled";
+   poll-interval = <100>;
+
+   button0 {
+   label = "reset";
+   linux,code = ;
+   gpios = < 11 GPIO_ACTIVE_HIGH>;
+   };
+   };
+};
+
+ {
+   clock-frequency = <2500>;
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   dr_mode = "host";
+};
+
+_phy {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   compatible = "syscon", "simple-mfd";
+};
+
+ {
+   status = "okay";
+
+   nvmem-cells = <_uboot_1fc00>;
+   nvmem-cell-names = "mac-address";
+   mac-address-increment = <(-1)>;
+
+   gmac-config {
+   device = <>;
+   switch-phy-addr-swap = <4>;
+   switch-phy-swap = <4>;
+   };
+};
+
+
+ {
+   status = "okay";
+
+   num-chipselects = <1>;
+
+   /* Winbond 25Q128FVSG SPI flash */
+   flash@0 {
+   compatible = "winbond,w25q128", "jedec,spi-nor";
+   spi-max-frequency = <2500>;
+   reg = <0>;
+
+   partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   uboot: partition@0 {
+   label = "u-boot";
+   reg = <0x00 0x02>;
+   read-only;
+   };
+
+   partition@2 {
+   compatible = "tplink,firmware";
+   label = "firmware";
+   reg = <0x02 0xfd>;
+   };
+
+   art: partition@ff {
+   label = "art";
+   reg = <0xff 0x01>;
+   read-only;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
+
+   mtd-cal-data = < 0x1000>;
+   nvmem-cells = <_uboot_1fc00>;
+   nvmem-cell-names = "mac-address";
+};
+
+ {
+   compatible = "nvmem-cells";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   macaddr_uboot_1fc00: macaddr@1fc00 {
+   reg = <0x1fc00 0x6>;
+   };
+};
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network 

Re: [RFC PATCH] gpio-button-hotplug: gpio descriptor API update

2021-08-11 Thread Linus Walleij
On Thu, Aug 5, 2021 at 3:54 PM Christian Lamparter  wrote:

> This driver still uses the Legacy GPIO Subsystem gpio_ API.
> While it does work fine, it won't supports the new GPIO
> LOOKUP tables that have been popping up upstream since v5.0.
>
> For APU2 users > linux 5.4:
> Please test if this fixes your reset button.
>
> (DT devices needs to be re-tested as well)
>
> Reported-by: Chris Blake 
> Signed-off-by: Christian Lamparter 

This looks very nice to me, thanks for doing this Christian:
Reviewed-by: Linus Walleij 

Yours,
Linus Walleij

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


cgi-io: extend backup file name

2021-08-11 Thread F. D. Ansel


it is now backup_HOST_rREV-HASH_-MM-DD_HHMM.tgz
HOST is without domain now, if fqdn was set
the extension changed form tar.gz to tgz
REV+HASH added for easier get of version
TIME added to allow more than 1 backup per day
added list of installed packages

From 37e9917a3f784b8f0338546129d4a319deaba013 Mon Sep 17 00:00:00 2001
From: Fritz D. Ansel 
Date: Mon, 2 Aug 2021 21:16:16 +0200
Subject: [PATCH] extend backup file name

it is now backup_HOST_rREV-HASH_-MM-DD_HHMM.tgz
HOST is without domain now, if fqdn was set
the extension changed form tar.gz to tgz
REV+HASH added for easier get of version
TIME added to allow more than 1 backup per day
added list of installed packages

Signed-off-by: Fritz D. Ansel 
---
 main.c | 24 
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/main.c b/main.c
index 95a62b8..c0aa15b 100644
--- a/main.c
+++ b/main.c
@@ -650,7 +650,7 @@ main_backup(int argc, char **argv)
return failure(500, errno, "Failed chdir('/')");
 
execl("/sbin/sysupgrade", "/sbin/sysupgrade",
- "--create-backup", "-", NULL);
+ "-k", "--create-backup", "-", NULL);
 
return -1;
 
@@ -658,15 +658,31 @@ main_backup(int argc, char **argv)
close(fds[1]);
 
now = time(NULL);
-   strftime(datestr, sizeof(datestr) - 1, "%Y-%m-%d", 
localtime());
+   strftime(datestr, sizeof(datestr) - 1, "%Y-%m-%d_%H%M", 
localtime());
 
if (gethostname(hostname, sizeof(hostname) - 1))
sprintf(hostname, "OpenWrt");
+   else {
+   for (int i=0; i<(int)strlen(hostname); i++)
+   if (hostname[i] == '.') {
+   hostname[i] = '\0';
+   break;
+   }
+   }
+
+   char version[32] = "UNKNOWN";
+   FILE *fp;
+   if ((fp = fopen("/etc/openwrt_version", "r")) != NULL) {
+   if (fgets(version, sizeof(version), fp) == version)
+   if (version[strlen(version)-1] == '\n' )
+   version[strlen(version)-1] = '\0';
+   fclose(fp);
+   }
 
printf("Status: 200 OK\r\n");
printf("Content-Type: application/x-targz\r\n");
printf("Content-Disposition: attachment; "
-  "filename=\"backup-%s-%s.tar.gz\"\r\n\r\n", hostname, 
datestr);
+  "filename=\"backup_%s_%s_%s.tgz\"\r\n\r\n", hostname, 
version, datestr);
 
fflush(stdout);
 
-- 
2.31.1

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


[PATCH] target/x86: add grub2-bios-setup to DEFAULT_PACKAGES

2021-08-11 Thread Florian Eckert
With the commit 5876d6a62fc0ae5799e7d9c896356f75c99a6f0a the command under
`/usr/sbin/grub-bios-setup` has been moved to its own package named
`grub-bios-setup`.

The script `81_upgrade_bootloader` under `/lib/preinit` is used by all
x86 targets to update the bootloader. The script is using the command
`grub-bios-setup` for this.

I get the following output at the first boot after the upgrade.
`/etc/preinit: line 9: /usr/sbin/grub-bios-setup: not found`.

To fix this, the DEFAULT_PACKAGES dependency is extended by the entry
`grub2-bios-setup` so that the missing command is installed again.

Signed-off-by: Florian Eckert 
---
 target/linux/x86/Makefile | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/target/linux/x86/Makefile b/target/linux/x86/Makefile
index 0ab322d8bc..b1891de0ce 100644
--- a/target/linux/x86/Makefile
+++ b/target/linux/x86/Makefile
@@ -17,7 +17,10 @@ KERNELNAME:=bzImage
 
 include $(INCLUDE_DIR)/target.mk
 
-DEFAULT_PACKAGES += partx-utils mkf2fs e2fsprogs kmod-button-hotplug
+DEFAULT_PACKAGES += \
+   partx-utils mkf2fs \
+   e2fsprogs kmod-button-hotplug \
+   grub2-bios-setup
 
 $(eval $(call BuildTarget))
 
-- 
2.20.1


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


Re: [PATCH] RFC: ARM: dts: Proposed Goramo MultiLink device tree

2021-08-11 Thread Linus Walleij
On Thu, Jul 29, 2021 at 2:16 PM Geert Uytterhoeven  wrote:

> Hi Linus,
(...)
> Can't the existing drivers/gpio/gpio-74x164.c be used?
> See also Documentation/devicetree/bindings/gpio/fairchild,74hc595.yaml

Sadly no. The way this device is used for GPIO is very
different. The former used a version of SPI and this has
to hammer GPIO lines directly, and has to use a special
strobe signal to propagate values out to pins.

Yours,
Linus Walleij

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