Re: [OpenWrt-Devel] [PATCH] base-files: make wifi report unknown command

2018-08-06 Thread Karl Palsson

John Crispin  wrote:
> 
> 
> On 03/08/18 18:18, Thibaut VARÈNE wrote:
> > Avoid having /sbin/wifi silently ignore unknown keywords and execute
> > "enable"; instead display the help message and exit with an error.
> >
> > Signed-off-by: Thibaut VARÈNE 
> > ---
> >   package/base-files/files/sbin/wifi | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/package/base-files/files/sbin/wifi 
> > b/package/base-files/files/sbin/wifi
> > index 83befc0d6f..09e483ec55 100755
> > --- a/package/base-files/files/sbin/wifi
> > +++ b/package/base-files/files/sbin/wifi
> > @@ -241,5 +241,5 @@ case "$1" in
> > reload) wifi_reload "$2";;
> > reload_legacy) wifi_reload_legacy "$2";;
> > --help|help) usage;;
> > -   *) ubus call network reload; wifi_updown "enable" "$2";;
> > +   *) usage; exit 1;;
> >   esac
> 
> NAK, this changes expected behaviour. i regularly call "wifi"
> to resync my config with runstate.
>      John

respectfully, the behaviour of the "wifi" command is one of the most obtuse 
parts of openwrt's tooling.  It does "something" with no command output, and 
responds ~instantly.This is expected behaviour for very few people.  even 
"wifi asdfasdfa" returns ~instantly, with no warning that it is an unknown 
command.  Does the command perhaps not take arguments?  What would they be?  

Do we _reallly_ have to keep it's behaviour this way? 

What this patch _is_ missing, is a new command to replace the old
"anything but the other commands".

ie, the one that does "ubus call network reload; wifi_updown
"enable" "$2""

Sincerely,
Karl Palsson

signature.html
Description: OpenPGP Digital Signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Desire to add a documentation section

2018-08-06 Thread Alberto Bursi



On 06/08/2018 22:07, Dave Turvene - Work wrote:

Greetings -

I cleaned up the documentation in

https://openwrt.org/docs/guide-user/base-system/log.essentials

as a prelude to adding a section on iptable logging rules.  The wiki
source just has the following snippet:
"pagequery>@:docs:guide-user:firewall:netfilter-iptables *"

How do I go about adding a page under (git directory?)
netfilter-iptables so I can document my iptable logging chains/rules?

Thanks,

David Turvene


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
you can create the new page by writing the link to it in the browser and 
then editing the page you land in.


For example this is a link to a page called "asdadasd" 
https://openwrt.org/docs/guide-user/services/automation/asdasdasd
Which does not exist yet. Click on the pencil button on the right to 
edit/create it.


You can write the link however you like and it will land in the same 
"there is no page yet" page and you will be able to create a page there. 
https://openwrt.org/docs/guide-user/services/automation/domoticz_another_page


The page made with that link will then appear automatically in the 
"automation" category in other pages that show all pages from a specific 
category, like here 
https://openwrt.org/docs/guide-user/services/automation/start


We actually discussed wiki plugins to let people add new pages with a more 
intuitive way here
https://forum.openwrt.org/t/lede-openwrt-wiki-merge/10861/108 but I didn't yet 
find the time to do that.

-Alberto


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


[OpenWrt-Devel] Desire to add a documentation section

2018-08-06 Thread Dave Turvene - Work
Greetings -

I cleaned up the documentation in

https://openwrt.org/docs/guide-user/base-system/log.essentials

as a prelude to adding a section on iptable logging rules.  The wiki
source just has the following snippet: 
"pagequery>@:docs:guide-user:firewall:netfilter-iptables *"

How do I go about adding a page under (git directory?)
netfilter-iptables so I can document my iptable logging chains/rules?

Thanks,

David Turvene


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


[OpenWrt-Devel] [PATCH 0/1] ustream-ssl: update to latest git HEAD

2018-08-06 Thread Eneas U de Queiroz via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
There are only two packages needing changes before we can merge
https://github.com/openwrt/openwrt/pull/965 (openssl: Upgrade to 1.1.0h)
ustream-ssl here, and openssh in the packages feed.

Eneas U de Queiroz (1):
  ustream-ssl: update to latest git HEAD

 package/libs/ustream-ssl/Makefile | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.16.4


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


[OpenWrt-Devel] [PATCH 1/1] ustream-ssl: update to latest git HEAD

2018-08-06 Thread Eneas U de Queiroz via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
23a3f28 openssl, wolfssl: match mbedTLS ciphersuite list
450ada0 ustream-ssl: Revised security on mbedtls
34b0b80 ustream-ssl: add openssl-1.1.0 compatibility

Signed-off-by: Eneas U de Queiroz 

diff --git a/package/libs/ustream-ssl/Makefile 
b/package/libs/ustream-ssl/Makefile
index 9bb093d734..2ea5bf0bd5 100644
--- a/package/libs/ustream-ssl/Makefile
+++ b/package/libs/ustream-ssl/Makefile
@@ -1,13 +1,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ustream-ssl
-PKG_RELEASE:=3
+PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/ustream-ssl.git
-PKG_SOURCE_DATE:=2018-05-24
-PKG_SOURCE_VERSION:=189cd38b4188bfcb4c8cf67d8ae71741ffc2b906
-PKG_MIRROR_HASH:=114d229828d95229e2b7134f668c0d2c3cee63ffa90e970d4c50a331f505b17d
+PKG_SOURCE_DATE:=2018-07-30
+PKG_SOURCE_VERSION:=23a3f2830341acd1db149175baf7315a33bd0edb
+PKG_MIRROR_HASH:=289bef5dac684015b6a40cfd72cf1c8c297bb77cf2efd54e562b628ba3afd83d
 CMAKE_INSTALL:=1
 
 PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)
-- 
2.16.4


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


[OpenWrt-Devel] [PATCH] mediatek: Fix amount of memory on U7623

2018-08-06 Thread Kristian Evensen
While finalizing support for the U7623 with 512MB RAM, I made an embarrassing
error and configured 1GB RAM for the board. I also forgot to move memory
from the dtsi and to the dts. This commit takes care of my errors.

While I am confessing my mistakes, I also note that I made a mistake in
the commit message of the initial U7623 commit. It is the .bin-file, and
not the .gz file that shall be sent to the device via tftp.

Signed-off-by: Kristian Evensen 
---
 .../0227-arm-dts-Add-Unielec-U7623-DTS.patch   | 37 +-
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git 
a/target/linux/mediatek/patches-4.14/0227-arm-dts-Add-Unielec-U7623-DTS.patch 
b/target/linux/mediatek/patches-4.14/0227-arm-dts-Add-Unielec-U7623-DTS.patch
index eb864e4657..8c0b7611b6 100644
--- 
a/target/linux/mediatek/patches-4.14/0227-arm-dts-Add-Unielec-U7623-DTS.patch
+++ 
b/target/linux/mediatek/patches-4.14/0227-arm-dts-Add-Unielec-U7623-DTS.patch
@@ -1,16 +1,18 @@
-From 13872b8abfadfe70598c065c19d1db759477c4e6 Mon Sep 17 00:00:00 2001
+From 1ebcba67d45f1365bcb1b5eb8b0cd8c847610ef2 Mon Sep 17 00:00:00 2001
 From: Kristian Evensen 
 Date: Sun, 17 Jun 2018 14:41:47 +0200
 Subject: [PATCH] arm: dts: Add Unielec U7623 DTS
 
 ---
  arch/arm/boot/dts/Makefile |   1 +
- .../dts/mt7623a-unielec-u7623-02-emmc-512M.dts |  17 +
- .../boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi| 375 +
- 3 files changed, 393 insertions(+)
+ .../dts/mt7623a-unielec-u7623-02-emmc-512M.dts |  22 ++
+ .../boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi| 366 +
+ 3 files changed, 389 insertions(+)
  create mode 100644 arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc-512M.dts
  create mode 100644 arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi
 
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+index 3fec84fa0..e685ce9a4 100644
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
 @@ -1062,6 +1062,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
@@ -21,9 +23,12 @@ Subject: [PATCH] arm: dts: Add Unielec U7623 DTS
mt7623n-rfb-nand.dtb \
mt7623n-bananapi-bpi-r2.dtb \
mt8127-moose.dtb \
+diff --git a/arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc-512M.dts 
b/arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc-512M.dts
+new file mode 100644
+index 0..6efa6e159
 --- /dev/null
 +++ b/arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc-512M.dts
-@@ -0,0 +1,17 @@
+@@ -0,0 +1,22 @@
 +/*
 + * Copyright 2018 Kristian Evensen 
 + *
@@ -40,10 +45,18 @@ Subject: [PATCH] arm: dts: Add Unielec U7623 DTS
 +  memory {
 +  reg = <0 0x8000 0 0x2000>;
 +  };
++
++  memory@8000 {
++  device_type = "memory";
++  reg = <0 0x8000 0 0x2000>;
++  };
 +};
+diff --git a/arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi 
b/arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi
+new file mode 100644
+index 0..adc91266e
 --- /dev/null
 +++ b/arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi
-@@ -0,0 +1,375 @@
+@@ -0,0 +1,366 @@
 +/*
 + * Copyright 2018 Kristian Evensen 
 + *
@@ -66,10 +79,6 @@ Subject: [PATCH] arm: dts: Add Unielec U7623 DTS
 +  stdout-path = "serial2:115200n8";
 +  };
 +
-+  memory {
-+  reg = <0 0x8000 0 0x2000>;
-+  };
-+
 +  cpus {
 +  cpu@0 {
 +  proc-supply = <_vproc_reg>;
@@ -145,11 +154,6 @@ Subject: [PATCH] arm: dts: Add Unielec U7623 DTS
 +  };
 +  };
 +
-+  memory@8000 {
-+  device_type = "memory";
-+  reg = <0 0x8000 0 0x4000>;
-+  };
-+
 +  mt7530: switch@0 {
 +  compatible = "mediatek,mt7530";
 +  #address-cells = <1>;
@@ -419,3 +423,6 @@ Subject: [PATCH] arm: dts: Add Unielec U7623 DTS
 +  status = "okay";
 +};
 +
+-- 
+2.14.1
+
-- 
2.14.1


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


Re: [OpenWrt-Devel] [PATCH] base-files: make wifi report unknown command

2018-08-06 Thread Alberto Bursi



On 06/08/2018 07:20, John Crispin wrote:



On 03/08/18 18:18, Thibaut VARÈNE wrote:

Avoid having /sbin/wifi silently ignore unknown keywords and execute
"enable"; instead display the help message and exit with an error.

Signed-off-by: Thibaut VARÈNE 
---
  package/base-files/files/sbin/wifi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/sbin/wifi 
b/package/base-files/files/sbin/wifi

index 83befc0d6f..09e483ec55 100755
--- a/package/base-files/files/sbin/wifi
+++ b/package/base-files/files/sbin/wifi
@@ -241,5 +241,5 @@ case "$1" in
  reload) wifi_reload "$2";;
  reload_legacy) wifi_reload_legacy "$2";;
  --help|help) usage;;
-    *) ubus call network reload; wifi_updown "enable" "$2";;
+    *) usage; exit 1;;
  esac


NAK, this changes expected behaviour. i regularly call "wifi" to 
resync my config with runstate.

    John



There are also scripts in packages (like wifitoggle) that expect to call 
"wifi" without arguments to do a status refresh.


Please make it print an error only if "wifi" is actually called with an 
unknown (=wrong) argument, calling "wifi" with no argument is ok.


-Alberto

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


[OpenWrt-Devel] [PATCH 4/4] ath79: add support for OCEDO Koala

2018-08-06 Thread David Bauer
This commit adds support for the OCEDO Koala

SOC:Qualcomm QCA9558 (Scorpion)
RAM:128MB
FLASH:  16MiB
WLAN1:  QCA9558 2.4 GHz 802.11bgn 3x3
WLAN2:  QCA9880 5 GHz 802.11nac 3x3
INPUT:  RESET button
LED:Power, LAN, WiFi 2.4, WiFi 5, SYS
Serial: Header Next to Black metal shield
Pinout is 3.3V - GND - TX - RX (Arrow Pad is 3.3V)
The Serial setting is 115200-8-N-1.

Tested and working:
 - Ethernet
 - 2.4 GHz WiFi
 - 5 GHz WiFi
 - TFTP boot from ramdisk image
 - Installation via ramdisk image
 - OpenWRT sysupgrade
 - Buttons
 - LEDs

Installation seems to be possible only through booting an OpenWRT
ramdisk image.

Hold down the reset button while powering on the device. It will load a
ramdisk image named 'koala-uImage-initramfs-lzma.bin' from 192.168.100.8.

Note: depending on the present software, the device might also try to
pull a file called 'koala-uimage-factory'. Only the name differs, it
is still used as a ramdisk image.

Wait for the ramdisk image to boot. OpenWRT can be written to the flash
via sysupgrade or mtd.

Due to the flip-flop bootloader which we not (yet) support, you need to
set the partition the bootloader is selecting. It is possible from the
initramfs image with

 > fw_setenv bootcmd run bootcmd_1

Afterwards you can reboot the device.

Signed-off-by: David Bauer 
---
 package/boot/uboot-envtools/files/ath79   |   1 +
 .../ath79/base-files/etc/board.d/02_network   |   1 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata  |   4 +
 .../linux/ath79/dts/qca9558_ocedo_koala.dts   | 173 ++
 target/linux/ath79/image/generic.mk   |  10 +
 5 files changed, 189 insertions(+)
 create mode 100644 target/linux/ath79/dts/qca9558_ocedo_koala.dts

diff --git a/package/boot/uboot-envtools/files/ath79 
b/package/boot/uboot-envtools/files/ath79
index 4d9d2e8fe0..aa0bf4514f 100644
--- a/package/boot/uboot-envtools/files/ath79
+++ b/package/boot/uboot-envtools/files/ath79
@@ -14,6 +14,7 @@ board=$(board_name)
 
 case "$board" in
 glinet,ar300m|\
+ocedo,koala|\
 ocedo,raccoon|\
 openmesh,om5p-ac-v2)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1" "0x1"
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 0bc187a245..e333231638 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()
ucidef_set_interface_lan "eth0" "dhcp"
;;
"avm,fritz300e"|\
+   "ocedo,koala"|\
"ocedo,raccoon"|\
"pcs,cap324"|\
"tplink,re450-v2"|\
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 240a1bf1dd..c6d6c0157d 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
@@ -87,6 +87,10 @@ board=$(board_name)
 case "$FIRMWARE" in
 "ath10k/cal-pci-:00:00.0.bin")
case $board in
+   "ocedo,koala")
+   ath10kcal_extract "art" 20480 2116
+   ath10kcal_patch_mac $(mtd_get_mac_binary art 12)
+   ;;
"openmesh,om5p-ac-v2")
ath10kcal_extract "ART" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat 
/sys/class/net/eth0/address) +16)
diff --git a/target/linux/ath79/dts/qca9558_ocedo_koala.dts 
b/target/linux/ath79/dts/qca9558_ocedo_koala.dts
new file mode 100644
index 00..e0d9680add
--- /dev/null
+++ b/target/linux/ath79/dts/qca9558_ocedo_koala.dts
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include 
+#include 
+
+#include "qca9557.dtsi"
+
+/ {
+   compatible = "ocedo,koala", "qca,qca9557";
+   model = "OCEDO Koala";
+
+   chosen {
+   bootargs = "console=ttyS0,115200n8";
+   };
+
+   aliases {
+   led-status = 
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   power {
+   label = "koala:green:power";
+   gpios = < 22 GPIO_ACTIVE_LOW>;
+   default-state = "on";
+   };
+
+   wifi2 {
+   label = "koala:yellow:wlan2";
+   gpios = < 23 GPIO_ACTIVE_LOW>;
+   linux,default-trigger = "phy1tpt";
+   default-state = "off";
+   };
+
+   wifi5 {
+   label = "koala:red:wlan58";
+   gpios = < 13 GPIO_ACTIVE_LOW>;
+   linux,default-trigger = "phy0tpt";
+   default-state = "off";
+   };
+
+   system: system {
+   label = "koala:blue:sys";
+   gpios = < 19 GPIO_ACTIVE_LOW>;
+ 

[OpenWrt-Devel] [PATCH 3/4] kernel: allow device-tree configuration of at803x

2018-08-06 Thread David Bauer
This commit adds the ability to configure specific functions of the
at803x series ethernet-PHYs, which were previously configured
exclusively with the help of platform-data, via device-tree.

This is needed to fully support existing boards of the ar71xx platform.

Signed-off-by: David Bauer 
---
 ...phy-at803x-allow-to-configure-via-dt.patch | 49 +++
 1 file changed, 49 insertions(+)
 create mode 100644 
target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch

diff --git 
a/target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch
 
b/target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch
new file mode 100644
index 00..daff25b633
--- /dev/null
+++ 
b/target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch
@@ -0,0 +1,49 @@
+Index: linux-4.14.60/drivers/net/phy/at803x.c
+===
+--- linux-4.14.60.orig/drivers/net/phy/at803x.c
 linux-4.14.60/drivers/net/phy/at803x.c
+@@ -354,6 +354,14 @@ static int at803x_config_init(struct phy
+   AT803X_DEBUG_TX_CLK_DLY_EN, 0);
+   }
+ 
++#ifdef CONFIG_OF_MDIO
++  if (phydev->mdio.dev.of_node &&
++  of_property_read_bool(phydev->mdio.dev.of_node,
++"at803x-disable-smarteee")) {
++  at803x_disable_smarteee(phydev);
++  }
++#endif
++
+   return 0;
+ }
+ 
+@@ -392,6 +400,7 @@ static void at803x_link_change_notify(st
+ {
+   struct at803x_priv *priv = phydev->priv;
+   struct at803x_platform_data *pdata;
++  u8 fixup_rgmii_tx_delay = 0;
+   pdata = dev_get_platdata(>mdio.dev);
+ 
+   /*
+@@ -421,8 +430,19 @@ static void at803x_link_change_notify(st
+   } else {
+   priv->phy_reset = false;
+   }
+-  if (pdata && pdata->fixup_rgmii_tx_delay &&
+-  phydev->speed != priv->prev_speed) {
++
++  if (pdata && pdata->fixup_rgmii_tx_delay)
++  fixup_rgmii_tx_delay = 1;
++
++#ifdef CONFIG_OF_MDIO
++  if (phydev->mdio.dev.of_node &&
++  of_property_read_bool(phydev->mdio.dev.of_node,
++"at803x-fixup-rgmii-tx-delay")) {
++  fixup_rgmii_tx_delay = 1;
++  }
++#endif
++
++  if (fixup_rgmii_tx_delay && phydev->speed != priv->prev_speed) {
+   switch (phydev->speed) {
+   case SPEED_10:
+   case SPEED_100:
-- 
2.18.0


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


[OpenWrt-Devel] [PATCH 2/4] ath79: fix QCA9557 eth PLL settings

2018-08-06 Thread David Bauer
The QCA9557 dtsi is currently missing pll-handle and pll-regs for both
eth0 and eth1, therefore PLL settings won't be applied. This commit
fixes this behavior.

Signed-off-by: David Bauer 
---
 target/linux/ath79/dts/qca9557.dtsi | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/target/linux/ath79/dts/qca9557.dtsi 
b/target/linux/ath79/dts/qca9557.dtsi
index 4f797a5543..e586f46433 100644
--- a/target/linux/ath79/dts/qca9557.dtsi
+++ b/target/linux/ath79/dts/qca9557.dtsi
@@ -109,7 +109,7 @@
 
pll: pll-controller@1805 {
compatible = "qca,ar9557-pll",
-   "qca,qca9550-pll";
+   "qca,qca9550-pll", "syscon";
reg = <0x1805 0x50>;
 
#clock-cells = <1>;
@@ -295,6 +295,9 @@
  {
compatible = "qca,qca9550-eth", "syscon", "simple-mfd";
 
+   pll-reg = <0 0x28 0>;
+   pll-handle = <>;
+
pll-data = <0x82000101 0x8101 0x80001313>;
phy-mode = "rgmii";
 
@@ -310,6 +313,9 @@
  {
compatible = "qca,qca9550-eth", "syscon", "simple-mfd";
 
+   pll-reg = <0 0x48 0>;
+   pll-handle = <>;
+
pll-data = <0x82000101 0x8101 0x80001313>;
phy-mode = "sgmii";
 
-- 
2.18.0


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


[OpenWrt-Devel] [PATCH 1/4] uboot-envtools: add ath79 target

2018-08-06 Thread David Bauer
This adds uci entries for all ath79 devices for which this already was
the case on ar71xx. Additionally we add the OCEDO Koala as there was no
support in OpenWRT yet.

Signed-off-by: David Bauer 
---
 package/boot/uboot-envtools/files/ath79 | 26 +
 1 file changed, 26 insertions(+)
 create mode 100644 package/boot/uboot-envtools/files/ath79

diff --git a/package/boot/uboot-envtools/files/ath79 
b/package/boot/uboot-envtools/files/ath79
new file mode 100644
index 00..4d9d2e8fe0
--- /dev/null
+++ b/package/boot/uboot-envtools/files/ath79
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Copyright (C) 2011-2014 OpenWrt.org
+#
+
+[ -e /etc/config/ubootenv ] && exit 0
+
+touch /etc/config/ubootenv
+
+. /lib/uboot-envtools.sh
+. /lib/functions.sh
+
+board=$(board_name)
+
+case "$board" in
+glinet,ar300m|\
+ocedo,raccoon|\
+openmesh,om5p-ac-v2)
+   ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1" "0x1"
+   ;;
+esac
+
+config_load ubootenv
+config_foreach ubootenv_add_app_config ubootenv
+
+exit 0
-- 
2.18.0


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


[OpenWrt-Devel] [PATCH 2/2] ar71xx: allow to override at803x sgmii aneg status

2018-08-06 Thread David Bauer
When checking the outcome of the PHY autonegotiation status, at803x
currently returns false in case the SGMII side is not established.

Due to a hardware-bug, ag71xx needs to fixup the SoCs SGMII side, which
it can't as it is not aware of the link-establishment.

This commit allows to ignore the SGMII side autonegotiation status to
allow ag71xx to do the fixup work.

Signed-off-by: David Bauer 
---
 .../files/arch/mips/ath79/mach-fritz450e.c|  1 +
 ...at803x-add-sgmii-aneg-override-pdata.patch | 42 +++
 2 files changed, 43 insertions(+)
 create mode 100644 
target/linux/ar71xx/patches-4.9/903-at803x-add-sgmii-aneg-override-pdata.patch

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz450e.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz450e.c
index e48ddd65e7..4e99834d27 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz450e.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz450e.c
@@ -122,6 +122,7 @@ static struct gpio_keys_button fritz450E_gpio_keys[] 
__initdata = {
 static struct at803x_platform_data fritz450E_at803x_data = {
.disable_smarteee = 1,
.has_reset_gpio = 1,
+   .override_sgmii_aneg = 1,
.reset_gpio = FRITZ450E_GPIO_PHY_RESET,
 };
 
diff --git 
a/target/linux/ar71xx/patches-4.9/903-at803x-add-sgmii-aneg-override-pdata.patch
 
b/target/linux/ar71xx/patches-4.9/903-at803x-add-sgmii-aneg-override-pdata.patch
new file mode 100644
index 00..9c922d155d
--- /dev/null
+++ 
b/target/linux/ar71xx/patches-4.9/903-at803x-add-sgmii-aneg-override-pdata.patch
@@ -0,0 +1,42 @@
+Index: linux-4.9.111/drivers/net/phy/at803x.c
+===
+--- linux-4.9.111.orig/drivers/net/phy/at803x.c
 linux-4.9.111/drivers/net/phy/at803x.c
+@@ -461,12 +461,15 @@ static void at803x_link_change_notify(st
+ 
+ static int at803x_aneg_done(struct phy_device *phydev)
+ {
++  struct at803x_platform_data *pdata;
+   int ccr;
+ 
+   int aneg_done = genphy_aneg_done(phydev);
+   if (aneg_done != BMSR_ANEGCOMPLETE)
+   return aneg_done;
+ 
++  pdata = dev_get_platdata(>mdio.dev);
++
+   /*
+* in SGMII mode, if copper side autoneg is successful,
+* also check SGMII side autoneg result
+@@ -481,7 +484,8 @@ static int at803x_aneg_done(struct phy_d
+   /* check if the SGMII link is OK. */
+   if (!(phy_read(phydev, AT803X_PSSR) & AT803X_PSSR_MR_AN_COMPLETE)) {
+   pr_warn("803x_aneg_done: SGMII link is not ok\n");
+-  aneg_done = 0;
++  if (!pdata || !pdata->override_sgmii_aneg)
++  aneg_done = 0;
+   }
+   /* switch back to copper page */
+   phy_write(phydev, AT803X_REG_CHIP_CONFIG, ccr | AT803X_BT_BX_REG_SEL);
+Index: linux-4.9.111/include/linux/platform_data/phy-at803x.h
+===
+--- linux-4.9.111.orig/include/linux/platform_data/phy-at803x.h
 linux-4.9.111/include/linux/platform_data/phy-at803x.h
+@@ -7,6 +7,7 @@ struct at803x_platform_data {
+   int enable_rgmii_rx_delay:1;
+   int fixup_rgmii_tx_delay:1;
+   int has_reset_gpio:1;
++  int override_sgmii_aneg:1;
+   int reset_gpio;
+ };
+ 
-- 
2.18.0


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


[OpenWrt-Devel] [PATCH 1/2] ar71xx: fix QCA955X SGMII link loss

2018-08-06 Thread David Bauer
The QCA955X is affected by a hardware bug which causes link-loss of the
SGMII link between SoC and PHY. This happens on change of link-state or
speed.

It is not really known what causes this bug. It definitely occurs when
using a AR8033 Gigabit Ethernet PHY.

Qualcomm solves this Bug in a similar fashion. We need to apply the fix
on a per-device base via platform-data as performing the fixup work will
break connectivity in case the SGMII interface is connected to a Switch.

This bug was first proposed to be fixed by Sven Eckelmann in 2016.
 https://patchwork.ozlabs.org/patch/604782/

Based-on-patch-by: Sven Eckelmann 
Signed-off-by: David Bauer 
---
 .../files/arch/mips/ath79/mach-fritz450e.c|  1 +
 .../include/asm/mach-ath79/ag71xx_platform.h  |  1 +
 .../net/ethernet/atheros/ag71xx/ag71xx.h  |  2 +
 .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 79 +++
 .../940-qca955x-add-more-registers.patch  | 44 +++
 5 files changed, 127 insertions(+)
 create mode 100644 
target/linux/ar71xx/patches-4.9/940-qca955x-add-more-registers.patch

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz450e.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz450e.c
index ee0a185304..e48ddd65e7 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz450e.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz450e.c
@@ -155,6 +155,7 @@ static void __init fritz450E_setup(void) {
ath79_eth0_data.mii_bus_dev = _mdio1_device.dev;
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
ath79_eth0_data.phy_mask = BIT(FRITZ450E_PHY_ADDRESS);
+   ath79_eth0_data.enable_sgmii_fixup = 1;
ath79_eth0_pll_data.pll_1000 = 0x0300;
ath79_eth0_pll_data.pll_100 = 0x0101;
ath79_eth0_pll_data.pll_10 = 0x1313;
diff --git 
a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h 
b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h
index c4c3a6d44c..e476d57e45 100644
--- 
a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h
+++ 
b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h
@@ -37,6 +37,7 @@ struct ag71xx_platform_data {
u8  is_ar724x:1;
u8  has_ar8216:1;
u8  use_flow_control:1;
+   u8  enable_sgmii_fixup:1;
u8  disable_inline_checksum_engine:1;
 
struct ag71xx_switch_platform_data *switch_data;
diff --git 
a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h 
b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
index 77ee5b36ec..2d9a865043 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
@@ -66,6 +66,8 @@
 #define AG71XX_TX_RING_SIZE_MAX128
 #define AG71XX_RX_RING_SIZE_MAX256
 
+#define QCA955X_SGMII_LINK_WAR_MAX_TRY 10
+
 #ifdef CONFIG_AG71XX_DEBUG
 #define DBG(fmt, args...)  pr_debug(fmt, ## args)
 #else
diff --git 
a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c 
b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index 54ec8e67b3..d89579298f 100644
--- 
a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ 
b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -31,6 +31,7 @@ MODULE_PARM_DESC(msg_level, "Message level 
(-1=defaults,0=none,...,16=all)");
 #define ETH_SWITCH_HEADER_LEN  2
 
 static int ag71xx_tx_packets(struct ag71xx *ag, bool flush);
+static void ag71xx_qca955x_sgmii_init(void);
 
 static inline unsigned int ag71xx_max_frame_len(unsigned int mtu)
 {
@@ -610,6 +611,9 @@ __ag71xx_link_adjust(struct ag71xx *ag, bool update)
if (update && pdata->set_speed)
pdata->set_speed(ag->speed);
 
+   if (update && pdata->enable_sgmii_fixup)
+   ag71xx_qca955x_sgmii_init();
+
ag71xx_wr(ag, AG71XX_REG_MAC_CFG2, cfg2);
ag71xx_wr(ag, AG71XX_REG_FIFO_CFG5, fifo5);
ag71xx_wr(ag, AG71XX_REG_MAC_IFCTL, ifctl);
@@ -913,6 +917,81 @@ static void ag71xx_tx_timeout(struct net_device *dev)
schedule_delayed_work(>restart_work, 1);
 }
 
+static void ag71xx_bit_set(void __iomem *reg, u32 bit)
+{
+   u32 val = __raw_readl(reg) | bit;
+   __raw_writel(val, reg);
+   __raw_readl(reg);
+}
+
+static void ag71xx_bit_clear(void __iomem *reg, u32 bit)
+{
+   u32 val = __raw_readl(reg) & ~bit;
+   __raw_writel(val, reg);
+   __raw_readl(reg);
+}
+
+static void ag71xx_qca955x_sgmii_init()
+{
+   void __iomem *gmac_base;
+   u32 mr_an_status, sgmii_status;
+   u8 tries = 0;
+
+   gmac_base = ioremap_nocache(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE);
+
+   if (!gmac_base)
+   goto sgmii_out;
+
+   mr_an_status = 

[OpenWrt-Devel] [PATCH] base-files: make wifi report unknown command

2018-08-06 Thread Thibaut VARÈNE
Avoid having /sbin/wifi silently ignore unknown keywords and execute
"enable"; instead display the help message and exit with an error.

Also preserve the implicit assumption that runing /sbin/wifi without
argument performs network reload and "enable".

Signed-off-by: Thibaut VARÈNE 
---
 package/base-files/files/sbin/wifi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/base-files/files/sbin/wifi 
b/package/base-files/files/sbin/wifi
index 83befc0d6f..13c91c2919 100755
--- a/package/base-files/files/sbin/wifi
+++ b/package/base-files/files/sbin/wifi
@@ -241,5 +241,6 @@ case "$1" in
reload) wifi_reload "$2";;
reload_legacy) wifi_reload_legacy "$2";;
--help|help) usage;;
-   *) ubus call network reload; wifi_updown "enable" "$2";;
+   '') ubus call network reload; wifi_updown "enable";;
+   *) usage; exit 1;;
 esac
-- 
2.13.6 (Apple Git-96)


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