Re: [OpenWrt-Devel] [PATCH v2] gemini: Bring up DSA switches

2019-07-14 Thread Linus Walleij
On Sun, Jul 14, 2019 at 10:46 PM Linus Walleij  wrote:
> On Sun, Jul 14, 2019 at 5:15 PM Pawel Dembicki  
> wrote:
>
> > > +storlink,gemini324)
> > > + # These are all connected to eth1 thru VSC7385
> > > + ucidef_set_interface "eth" ifname "eth1" protocol "none"
> > > + ucidef_set_interfaces_lan_wan "eth1 lan1 lan2 lan3 lan4" "eth0"
> > > + ;;
>
> Ooops I say I shall fix it then I don't. eth1 is still there.
>
> OK I fix a v3. The switch is working fine on the VSC7385 like
> this.

Or no it doesn't. I'm not smart today...
Keeping eth1 as "none" isn't working. I had to assign
a static address (the same) to eth1 as well, then it works.

In /etc/config/network it looks like this:

config interface 'eth'
option ifname 'eth1'
option proto 'static'
option ipaddr '169.254.1.2'
option netmask '255.255.255.0'

config interface 'lan'
option type 'bridge'
option ifname 'lan1 lan2 lan3 lan4'
option proto 'static'
option ipaddr '169.254.1.2'
option netmask '255.255.255.0'
option ip6assign '60'

I don't know if there is any better way to fix it?

Yours,
Linus Walleij

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


Re: [OpenWrt-Devel] [PATCH v2] gemini: Bring up DSA switches

2019-07-14 Thread Linus Walleij
On Sun, Jul 14, 2019 at 5:15 PM Pawel Dembicki  wrote:

> > +storlink,gemini324)
> > + # These are all connected to eth1 thru VSC7385
> > + ucidef_set_interface "eth" ifname "eth1" protocol "none"
> > + ucidef_set_interfaces_lan_wan "eth1 lan1 lan2 lan3 lan4" "eth0"
> > + ;;

Ooops I say I shall fix it then I don't. eth1 is still there.

OK I fix a v3. The switch is working fine on the VSC7385 like
this.

> I can't reproduce working state on P2020RDB with this two methods.
> In my device work this sequence:
>
> ip link set eth0 up
> ip link set lan1 up
> ip link set lan2 up
> ip link set lan3 up
> ip link set lan4 up
> ip link add name br-lan type bridge
> ip link set dev lan1 master br-lan
> ip link set dev lan2 master br-lan
> ip link set dev lan3 master br-lan
> ip link set dev lan4 master br-lan
> ip addr add 192.168.1.1/24 dev br-lan
> ip link set dev br-lan up
> ip link set dev eth0 master br-lan
>
> I think, vsc73xx without vlan filtering is very tricky now.

I think you should have it like this:

ucidef_set_interface "eth" ifname "eth0" protocol "none"
ucidef_set_interfaces_lan "lan1 lan2 lan3 lan4"

If you don't have any WAN interface (uplink) on the device.

Yours,
Linus Walleij

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


Re: [OpenWrt-Devel] [PATCH RFC 2/3] ramips: mt76x8: pinctrl: add a hack for ESD_MODE bit in GPIO1_MODE

2019-07-14 Thread Petr Štetiar
Chuanhong Guo  [2019-07-15 00:34:27]:

Hi,

> To properly solve this problem and the other pinctrl hack in mtk-mmc
> driver we'll need to write a dedicated pinctrl driver for mt76x8,

I would prefer a proper fix instead of this hack series :-)


-- ynezz

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


[OpenWrt-Devel] [PATCH] libroxml: bump to the 3.0.2 version

2019-07-14 Thread Rafał Miłecki
From: Rafał Miłecki 

* Fix for memory leak regression
* Support for (un)escaping

Signed-off-by: Rafał Miłecki 
---
 package/libs/libroxml/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/libs/libroxml/Makefile b/package/libs/libroxml/Makefile
index 334ca86133..f60312b1ed 100644
--- a/package/libs/libroxml/Makefile
+++ b/package/libs/libroxml/Makefile
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libroxml
-PKG_VERSION:=3.0.1
+PKG_VERSION:=3.0.2
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://download.libroxml.net/pool/v3.x
-PKG_HASH:=b55fd616a2be4e9747173b8dfa4bbab64f5ddfafd7d7a529aa91ab7755bc0ce6
+PKG_HASH:=ed6d68d1bceabf98e5e76907411e2e4d93b2dbd48479ab41dede851f59dad6a3
 PKG_MAINTAINER:=Felix Fietkau 
 
 PKG_INSTALL:=1
@@ -27,7 +27,7 @@ define Package/libroxml
   CATEGORY:=Libraries
   TITLE:=Minimum, easy-to-use, C implementation for xml file parsing
   URL:=http://www.libroxml.net/
-  ABI_VERSION:=3.0.1
+  ABI_VERSION:=3.0.2
 endef
 
 CONFIGURE_ARGS += \
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH] orion: sysupgrade: change platform_check_image() args validation

2019-07-14 Thread Rafał Miłecki
From: Rafał Miłecki 

sysupgrade passes image to check as argument so use $# instead of $ARGC

Signed-off-by: Rafał Miłecki 
---
 target/linux/orion/generic/base-files/lib/upgrade/platform.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/orion/generic/base-files/lib/upgrade/platform.sh 
b/target/linux/orion/generic/base-files/lib/upgrade/platform.sh
index db2330684d..cf1fad83a8 100644
--- a/target/linux/orion/generic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/orion/generic/base-files/lib/upgrade/platform.sh
@@ -6,7 +6,7 @@
 # use default for platform_do_upgrade()
 
 platform_check_image() {
-   [ "${ARGC}" -gt 1 ] && { echo 'Too many arguments. Only flash file 
expected.'; return 1; }
+   [ "$#" -gt 1 ] && { echo 'Too many arguments. Only flash file 
expected.'; return 1; }
 
local hardware="$(board_name)"
local magic="$(get_magic_word "$1")"
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH] mvebu: sysupgrade: drop platform_copy_config_sdcard() argument

2019-07-14 Thread Rafał Miłecki
From: Rafał Miłecki 

That function doesn't take any arguments so don't pass anything when
calling it.

Signed-off-by: Rafał Miłecki 
---
 target/linux/mvebu/base-files/lib/upgrade/platform.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/mvebu/base-files/lib/upgrade/platform.sh 
b/target/linux/mvebu/base-files/lib/upgrade/platform.sh
index 3fc4ff6635..58e7d83e4e 100755
--- a/target/linux/mvebu/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mvebu/base-files/lib/upgrade/platform.sh
@@ -40,7 +40,7 @@ platform_copy_config() {
;;

cznic,turris-omnia|globalscale,espressobin|globalscale,espressobin-emmc|globalscale,espressobin-v7|globalscale,espressobin-v7-emmc|\

marvell,armada8040-mcbin|solidrun,clearfog-base-a1|solidrun,clearfog-pro-a1)
-   platform_copy_config_sdcard "$ARGV"
+   platform_copy_config_sdcard
;;
esac
 }
-- 
2.21.0


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


[OpenWrt-Devel] [sdwalker/sdwalker.github.io] 7b7b8e: This week's update

2019-07-14 Thread Stephen Walker
  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: 7b7b8e8a25ddb6444c3c91fbb23f41a5f4b80deb
  
https://github.com/sdwalker/sdwalker.github.io/commit/7b7b8e8a25ddb6444c3c91fbb23f41a5f4b80deb
  Author: Stephen Walker 
  Date:   2019-07-14 (Sun, 14 Jul 2019)

  Changed paths:
M uscan/index-18.06.html
M uscan/index.html

  Log Message:
  ---
  This week's update



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


[OpenWrt-Devel] [PATCH] treewide: sysupgrade: don't use $ARGV in platform_do_upgrade()

2019-07-14 Thread Rafał Miłecki
From: Rafał Miłecki 

stage2 passes image path to platform_do_upgrade() as an argument so it
can be simply accessed using $1

Signed-off-by: Rafał Miłecki 
---
 .../base-files/lib/upgrade/platform.sh |  4 ++--
 .../ar71xx/base-files/lib/upgrade/dir825.sh|  4 ++--
 .../ar71xx/base-files/lib/upgrade/platform.sh  | 18 +-
 .../ath79/base-files/lib/upgrade/platform.sh   |  6 +++---
 .../cns3xxx/base-files/lib/upgrade/platform.sh |  2 +-
 .../gemini/base-files/lib/upgrade/platform.sh  |  2 +-
 .../ipq40xx/base-files/lib/upgrade/platform.sh |  8 
 .../ipq806x/base-files/lib/upgrade/platform.sh | 12 ++--
 .../ixp4xx/base-files/lib/upgrade/platform.sh  |  4 ++--
 .../base-files/lib/upgrade/platform.sh |  4 ++--
 .../lantiq/base-files/lib/upgrade/platform.sh  |  2 +-
 .../base-files/lib/upgrade/platform.sh |  4 ++--
 .../base-files/lib/upgrade/platform.sh |  2 +-
 .../mpc85xx/base-files/lib/upgrade/platform.sh |  4 ++--
 .../mvebu/base-files/lib/upgrade/platform.sh   |  6 +++---
 .../ramips/base-files/lib/upgrade/platform.sh  |  8 
 16 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/target/linux/apm821xx/base-files/lib/upgrade/platform.sh 
b/target/linux/apm821xx/base-files/lib/upgrade/platform.sh
index 02c750130c..32e87513f3 100755
--- a/target/linux/apm821xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/apm821xx/base-files/lib/upgrade/platform.sh
@@ -22,7 +22,7 @@ platform_do_upgrade() {
 
case "$board" in
wd,mybooklive)
-   mbl_do_upgrade "$ARGV"
+   mbl_do_upgrade "$1"
;;
meraki,mr24|\
meraki,mx60|\
@@ -32,7 +32,7 @@ platform_do_upgrade() {
nand_do_upgrade "$1"
;;
*)
-   default_do_upgrade "$ARGV"
+   default_do_upgrade "$1"
;;
esac
 }
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/dir825.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/dir825.sh
index 7ad3dd8e1f..430df251a0 100644
--- a/target/linux/ar71xx/base-files/lib/upgrade/dir825.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/dir825.sh
@@ -148,7 +148,7 @@ platform_do_upgrade_dir825b() {
else
PART_NAME="firmware"
fi
-   default_do_upgrade "$ARGV"
+   default_do_upgrade "$1"
;;
"43493030")
if [ -z "$fw_mtd" ]; then
@@ -159,7 +159,7 @@ platform_do_upgrade_dir825b() {
exit 1
}
fi
-   dir825b_do_upgrade_combined "firmware" "$ARGV"
+   dir825b_do_upgrade_combined "firmware" "$1"
;;
esac
 }
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index c0f383b4e3..5de7af667f 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -806,7 +806,7 @@ platform_do_upgrade() {
 
case "$board" in
all0258n)
-   platform_do_upgrade_allnet "0x9f05" "$ARGV"
+   platform_do_upgrade_allnet "0x9f05" "$1"
;;
all0305|\
eap7660d|\
@@ -818,19 +818,19 @@ platform_do_upgrade() {
pb44|\
routerstation|\
routerstation-pro)
-   platform_do_upgrade_combined "$ARGV"
+   platform_do_upgrade_combined "$1"
;;
all0315n)
-   platform_do_upgrade_allnet "0x9f08" "$ARGV"
+   platform_do_upgrade_allnet "0x9f08" "$1"
;;
cap4200ag|\
eap300v2|\
ens202ext)
-   platform_do_upgrade_allnet "0xbf0a" "$ARGV"
+   platform_do_upgrade_allnet "0xbf0a" "$1"
;;
dir-825-b1|\
tew-673gru)
-   platform_do_upgrade_dir825b "$ARGV"
+   platform_do_upgrade_dir825b "$1"
;;
a40|\
a60|\
@@ -852,7 +852,7 @@ platform_do_upgrade() {
om5p-ac|\
om5p-acv2|\
om5p-an)
-   platform_do_upgrade_openmesh "$ARGV"
+   platform_do_upgrade_openmesh "$1"
;;
c-60|\
hiveap-121|\
@@ -903,14 +903,14 @@ platform_do_upgrade() {
uap-pro|\
unifi-outdoor-plus)
MTD_CONFIG_ARGS="-s 0x18"
-   default_do_upgrade "$ARGV"
+   default_do_upgrade "$1"
;;
wp543|\
wpe72)
-   platform_do_upgrade_compex "$ARGV"
+   platform_do_upgrade_compex "$1"
;;
*)
-   default_do_upgrade "$ARGV"
+   default_do_upgrade "$1"
;;
esac
 }
diff --git a/target/linux/ath79/base-files/lib/upgrade/platform.sh 

[OpenWrt-Devel] [PATCH 2/2] base-files: don't set ARGV and ARGC

2019-07-14 Thread Rafał Miłecki
From: Rafał Miłecki 

Those are not used by any image check function anymore.

Signed-off-by: Rafał Miłecki 
---
 package/base-files/files/sbin/sysupgrade | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/package/base-files/files/sbin/sysupgrade 
b/package/base-files/files/sbin/sysupgrade
index 73291262e7..001e644476 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -316,9 +316,6 @@ case "$IMAGE" in
;;
 esac
 
-export ARGV="$IMAGE"
-export ARGC=1
-
 for check in $sysupgrade_image_check; do
( $check "$IMAGE" ) || {
if [ $FORCE -eq 1 ]; then
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH 1/2] mvebu: sysupgrade: don't use $ARGV in platform_check_image()

2019-07-14 Thread Rafał Miłecki
From: Rafał Miłecki 

sysupgrade passes image path to platform_check_image() as an argument so
it can be simply accessed using $1

Signed-off-by: Rafał Miłecki 
---
 target/linux/mvebu/base-files/lib/upgrade/platform.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/mvebu/base-files/lib/upgrade/platform.sh 
b/target/linux/mvebu/base-files/lib/upgrade/platform.sh
index b86fd1477e..6550dd59b7 100755
--- a/target/linux/mvebu/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mvebu/base-files/lib/upgrade/platform.sh
@@ -11,7 +11,7 @@ platform_check_image() {
case "$(board_name)" in

cznic,turris-omnia|globalscale,espressobin|globalscale,espressobin-emmc|globalscale,espressobin-v7|globalscale,espressobin-v7-emmc|\

marvell,armada8040-mcbin|solidrun,clearfog-base-a1|solidrun,clearfog-pro-a1)
-   platform_check_image_sdcard "$ARGV"
+   platform_check_image_sdcard "$1"
;;
*)
return 0
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH RFC 1/3] ramips: mtk-mmc: mt76x8: check ESD_MODE before applying AGPIO_CFG

2019-07-14 Thread Chuanhong Guo
Since mt76x8an ver1 eco2, SDXC pins can be switched to the
following pinmap:
sd_d1  -> PAD_I2S_SDI
sd_d0  -> PAD_I2S_WS
sd_cmd -> PAD_I2S_CLK
sd_d3  -> PAD_I2C_SCLK
sd_d2  -> PAD_I2C_SD
sd_clk -> PAD_GPIO0
sd_wp  -> PAD_TXD1
sd_cd  -> PAD_RXD1

To use this pinmap, one would need to set ESD_MODE bit (bit 15)
to 1 in GPIO1_MODE and switch other used pads into GPIO mode.
In this mode, we don't need to switch ethernet pins to digital
pad.

Check ESD_MODE bit before applying AGPIO_CFG and use rt_sysc_m32
to set it.

Signed-off-by: Chuanhong Guo 
---
 .../ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c  | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c 
b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c
index 4ced4b6605..cb0aa4231a 100644
--- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c
+++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c
@@ -2205,16 +2205,12 @@ static int msdc_drv_probe(struct platform_device *pdev)
struct msdc_host *host;
struct msdc_hw *hw;
int ret;
-   u32 reg;
 
//FIXME: this should be done by pinconf and not by the sd driver
-   if (ralink_soc == MT762X_SOC_MT7688 ||
-   ralink_soc == MT762X_SOC_MT7628AN) {
-   /* set EPHY pads to digital mode */
-   reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE + 0x3c));
-   reg |= 0x1e << 16;
-   sdr_write32((void __iomem *)(RALINK_SYSCTL_BASE + 0x3c), reg);
-   }
+   if ((ralink_soc == MT762X_SOC_MT7688 ||
+ralink_soc == MT762X_SOC_MT7628AN) &&
+   (!(rt_sysc_r32(0x60) & BIT(15
+   rt_sysc_m32(0xf << 17, 0xf << 17, 0x3c);
 
hw = _hw;
 
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH RFC 3/3] ramips: enable sdxc driver for hc5661a

2019-07-14 Thread Chuanhong Guo
Since we've fixed AGPIO_MODE setup in sdxc driver, we can enable
SDXC interface for HC5661A now.

Signed-off-by: Chuanhong Guo 
---

pinctrl disallows "double enable" for a function (meaning can't set a
group to gpio twice), so the gpio group needs to be specified for every
dts and can't be put into mt7628.dtsi

 .../ramips/dts/mt7628an_hiwifi_hc5661a.dts  | 17 +
 target/linux/ramips/image/mt76x8.mk |  1 +
 2 files changed, 18 insertions(+)

diff --git a/target/linux/ramips/dts/mt7628an_hiwifi_hc5661a.dts 
b/target/linux/ramips/dts/mt7628an_hiwifi_hc5661a.dts
index df239e1fb8..3ba3774f1c 100644
--- a/target/linux/ramips/dts/mt7628an_hiwifi_hc5661a.dts
+++ b/target/linux/ramips/dts/mt7628an_hiwifi_hc5661a.dts
@@ -50,6 +50,18 @@
 };
 
  {
+   sdxc_router_pins: sdxc_router_mode {
+   gpio {
+   ralink,group = "i2s", "sdmode", "uart1", "gpio";
+   ralink,function = "gpio";
+   };
+
+   esdmode {
+   ralink,group = "esdmode";
+   ralink,function = "sdxc";
+   };
+   };
+
state_default: pinctrl0 {
gpio {
ralink,group = "i2c", "refclk", "wled_an";
@@ -58,6 +70,11 @@
};
 };
 
+ {
+   status = "okay";
+   pinctrl-0 = <_router_pins>;
+};
+
  {
status = "okay";
 
diff --git a/target/linux/ramips/image/mt76x8.mk 
b/target/linux/ramips/image/mt76x8.mk
index fae9fb03cf..033cc7527d 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -97,6 +97,7 @@ define Device/hiwifi_hc5661a
   DEVICE_VENDOR := HiWiFi
   DEVICE_MODEL := HC5661A
   SUPPORTED_DEVICES += hc5661a
+  DEVICE_PACKAGES := kmod-sdhci-mt7620
 endef
 TARGET_DEVICES += hiwifi_hc5661a
 
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH RFC 2/3] ramips: mt76x8: pinctrl: add a hack for ESD_MODE bit in GPIO1_MODE

2019-07-14 Thread Chuanhong Guo
This bit is used to specify sdxc pinmap for mt76x8. Details available
in patch description.

To properly solve this problem and the other pinctrl hack in mtk-mmc
driver we'll need to write a dedicated pinctrl driver for mt76x8,
with the support for configuring AGPIO_MODE and RGCTL registers as
well as specially handling GPIO reservation/pinctrl setup for ESDMODE.

Signed-off-by: Chuanhong Guo 
---
 .../500-hack-mt76x8-pinctrl-esdmode.patch | 55 +++
 1 file changed, 55 insertions(+)
 create mode 100644 
target/linux/ramips/patches-4.14/500-hack-mt76x8-pinctrl-esdmode.patch

diff --git 
a/target/linux/ramips/patches-4.14/500-hack-mt76x8-pinctrl-esdmode.patch 
b/target/linux/ramips/patches-4.14/500-hack-mt76x8-pinctrl-esdmode.patch
new file mode 100644
index 00..af8ce1257a
--- /dev/null
+++ b/target/linux/ramips/patches-4.14/500-hack-mt76x8-pinctrl-esdmode.patch
@@ -0,0 +1,55 @@
+From: Chuanhong Guo 
+Date: Sat, 13 Jul 2019 17:59:03 +0800
+Subject: [PATCH] ramips: hack: add esdmode pinctrl group
+
+Since mt76x8an ver1 eco2, SDXC pins can be switched to the
+following pinmap:
+sd_d1  -> PAD_I2S_SDI
+sd_d0  -> PAD_I2S_WS
+sd_cmd -> PAD_I2S_CLK
+sd_d3  -> PAD_I2C_SCLK
+sd_d2  -> PAD_I2C_SD
+sd_clk -> PAD_GPIO0
+sd_wp  -> PAD_TXD1
+sd_cd  -> PAD_RXD1
+
+To use this pinmap, one would need to set ESD_MODE bit (bit 15)
+to 1 in GPIO1_MODE and switch other used pads into GPIO mode.
+
+MTK called this pinmap "router mode" and the pinmap described
+in their datasheed is called "iot mode".
+
+This patch is hacky because:
+1. pinmux-rt2880 doesn't support reserving noncontiguous GPIO
+   pins so those GPIOs can't be properly reserved.
+2. it misused "gpio" function for "iot mode", due to the fact
+   that this mode doesn't reserve any GPIOs.
+
+Signed-off-by: Chuanhong Guo 
+---
+--- a/arch/mips/ralink/mt7620.c
 b/arch/mips/ralink/mt7620.c
+@@ -149,6 +149,7 @@ static struct rt2880_pmx_func refclk_grp
+ static struct rt2880_pmx_func perst_grp_mt7628[] = { FUNC("perst", 0, 36, 1) 
};
+ static struct rt2880_pmx_func wdt_grp_mt7628[] = { FUNC("wdt", 0, 38, 1) };
+ static struct rt2880_pmx_func spi_grp_mt7628[] = { FUNC("spi", 0, 7, 4) };
++static struct rt2880_pmx_func esd_mode_grp_mt7628[] = { FUNC("sdxc", 1, 0, 0) 
};
+ 
+ static struct rt2880_pmx_func sd_mode_grp_mt7628[] = {
+   FUNC("jtag", 3, 22, 8),
+@@ -297,6 +298,7 @@ static struct rt2880_pmx_func wled_an_gr
+ #define MT7628_GPIO_MODE_I2C  20
+ #define MT7628_GPIO_MODE_REFCLK   18
+ #define MT7628_GPIO_MODE_PERST16
++#define MT7628_GPIO_MODE_ESDMODE  15
+ #define MT7628_GPIO_MODE_WDT  14
+ #define MT7628_GPIO_MODE_SPI  12
+ #define MT7628_GPIO_MODE_SDMODE   10
+@@ -319,6 +321,7 @@ static struct rt2880_pmx_group mt7628an_
+   1, MT7628_GPIO_MODE_I2C),
+   GRP("refclk", refclk_grp_mt7628, 1, MT7628_GPIO_MODE_REFCLK),
+   GRP("perst", perst_grp_mt7628, 1, MT7628_GPIO_MODE_PERST),
++  GRP_G("esdmode", esd_mode_grp_mt7628, 1, 0, MT7628_GPIO_MODE_ESDMODE),
+   GRP("wdt", wdt_grp_mt7628, 1, MT7628_GPIO_MODE_WDT),
+   GRP("spi", spi_grp_mt7628, 1, MT7628_GPIO_MODE_SPI),
+   GRP_G("sdmode", sd_mode_grp_mt7628, MT7628_GPIO_MODE_MASK,
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH RFC 0/3] ramips: fix SDXC for HiWiFi HC5661A

2019-07-14 Thread Chuanhong Guo
Since mt76x8 ver1 eco2, SDXC pins can be switched to the
following pinmap:
sd_d1  -> PAD_I2S_SDI
sd_d0  -> PAD_I2S_WS
sd_cmd -> PAD_I2S_CLK
sd_d3  -> PAD_I2C_SCLK
sd_d2  -> PAD_I2C_SD
sd_clk -> PAD_GPIO0
sd_wp  -> PAD_TXD1
sd_cd  -> PAD_RXD1

To use this pinmap, one would need to set ESD_MODE bit (bit 15)
to 1 in GPIO1_MODE and switch other used pads into GPIO mode.

HC5661A is a router which used this pinmap so that all 5 ethernet
ports and SDXC interface can be used simutaneously.

I think this patchset is kind of hacky so I decided to send it here
for review/suggestions.

Chuanhong Guo (3):
  ramips: mtk-mmc: mt76x8: check ESD_MODE before applying AGPIO_CFG
  ramips: mt76x8: pinctrl: add a hack for ESD_MODE bit in GPIO1_MODE
  ramips: enable sdxc driver for hc5661a

 .../ramips/dts/mt7628an_hiwifi_hc5661a.dts| 17 ++
 .../files-4.14/drivers/mmc/host/mtk-mmc/sd.c  | 12 ++--
 target/linux/ramips/image/mt76x8.mk   |  1 +
 .../500-hack-mt76x8-pinctrl-esdmode.patch | 55 +++
 4 files changed, 77 insertions(+), 8 deletions(-)
 create mode 100644 
target/linux/ramips/patches-4.14/500-hack-mt76x8-pinctrl-esdmode.patch

-- 
2.21.0


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


Re: [OpenWrt-Devel] [PATCH v2] gemini: Bring up DSA switches

2019-07-14 Thread Pawel Dembicki

On 14.07.2019 15:50, Linus Walleij wrote:


+storlink,gemini324)
+   # These are all connected to eth1 thru VSC7385
+   ucidef_set_interface "eth" ifname "eth1" protocol "none"
+   ucidef_set_interfaces_lan_wan "eth1 lan1 lan2 lan3 lan4" "eth0"
+   ;;


and:


+itian,sq201)
+   # These are all connected to eth1 thru VSC7395
+   ucidef_set_interface "eth" ifname "eth1" protocol "none"
+   ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth0"
+   ;;


Hi Linus,

I can't reproduce working state on P2020RDB with this two methods.
In my device work this sequence:

ip link set eth0 up
ip link set lan1 up
ip link set lan2 up
ip link set lan3 up
ip link set lan4 up
ip link add name br-lan type bridge
ip link set dev lan1 master br-lan
ip link set dev lan2 master br-lan
ip link set dev lan3 master br-lan
ip link set dev lan4 master br-lan
ip addr add 192.168.1.1/24 dev br-lan
ip link set dev br-lan up
ip link set dev eth0 master br-lan

I think, vsc73xx without vlan filtering is very tricky now.

Best Regards,
Pawel Dembicki

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


Re: [OpenWrt-Devel] [PATCH] gemini: Bring up DSA switches

2019-07-14 Thread Pawel Dembicki

Hi Linus,

I work with P2020RDB and I stucked at the same problem.

On 14.07.2019 12:04, Linus Walleij wrote:

On Sat, Jul 13, 2019 at 10:38 PM Florian Fainelli  wrote:

I really tried to figure out a way to get both the Vitesse and Realtek
switches to do internal tagging but they just don't.



I'm afraid, that You have right.


The Vitesse switches can do VLAN but I just haven't implemented
it yet, but now that Adrian is using it on a Freescale board as well
I might get to it as we have some more users.



I plan to make support for VLAN filtering for this switch. Maybe we can 
work together?



There are some patches to the kernel do do port separation using
only VLAN (by Vladimir Oltean) but of course I have to implement
VLAN first if I want to try to use that.



I see three possible solutions for port separation after VLAN support:

1. Use this only:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/dsa/configuration.rst#n211
2. Use 8021q tag based solution.
3. Use tag_8021q tag based solution and try to use VLAN_KEEP_TAG_ENA for 
dual vlan tagging.



Best Regards,
Pawel Dembicki

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


[OpenWrt-Devel] [PATCH v2] gemini: Bring up DSA switches

2019-07-14 Thread Linus Walleij
First group the interfaces on the DSA switch into the
right LAN/WAN groups. Tested successfully on the Itian
Square One SQ201 and the SL93512 reference design
with the Vitesse DSA switches.

As discussed on the mailing list, these switches are
untagged (DSA_TAG_PROTO_NONE) so the DSA slave devices
are only slave devices with not datapath control.
This means each of the CPU-facing interfaces need to
be brought up with the "none" protocol before any
slave devices are brought up. (The sequence matters
here.)

Tested on each of the three affected devices.

Cc: Pawel Dembicki 
Signed-off-by: Linus Walleij 
---
ChangeLog v1->v2:
- Remove the eth1 from the LAN bridge in both the
  Vitesse switch devices, instead bring up each ethernet
  master interface independently with "none" protocol.
---
 .../gemini/base-files/etc/board.d/02_network  | 27 +++
 1 file changed, 27 insertions(+)
 create mode 100755 target/linux/gemini/base-files/etc/board.d/02_network

diff --git a/target/linux/gemini/base-files/etc/board.d/02_network 
b/target/linux/gemini/base-files/etc/board.d/02_network
new file mode 100755
index ..b5c48c82
--- /dev/null
+++ b/target/linux/gemini/base-files/etc/board.d/02_network
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+case "$(board_name)" in
+storlink,gemini324)
+   # These are all connected to eth1 thru VSC7385
+   ucidef_set_interface "eth" ifname "eth1" protocol "none"
+   ucidef_set_interfaces_lan_wan "eth1 lan1 lan2 lan3 lan4" "eth0"
+   ;;
+itian,sq201)
+   # These are all connected to eth1 thru VSC7395
+   ucidef_set_interface "eth" ifname "eth1" protocol "none"
+   ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth0"
+   ;;
+dlink,dir-685)
+   # These are all connected to eth0 thru RTL8366RB
+   ucidef_set_interface "eth" ifname "eth0" protocol "none"
+   ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "wan"
+   ;;
+esac
+
+board_config_flush
+
+exit 0
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH] nftables: Update nftables & clean up dependencies

2019-07-14 Thread Kristian Evensen
This patch does three things:

* Bumps nftables from 0.9.0 to 0.9.1 and remove a patch that was
accepted upstream.
* Cleans up the nftables-dependencies in netfilter.mk. All targets are
not at 4.14+, so there is no need to specify for example "ge 4.9.0" or
keep "lt 4.9.0" around.
* Fix building support for nftables sets. In 4.18 the configuration
symbol changed from CONFIG_NFT_SET_RBTREE and CONFIG_NFT_SET_HAS, to
CONFIG_NF_TABLES_SET.

Signed-off-by: Kristian Evensen 
---
 include/netfilter.mk  | 17 ++-
 package/network/utils/nftables/Makefile   |  4 +--
 .../nftables/patches/010-uclibc-ng.patch  | 28 ---
 3 files changed, 10 insertions(+), 39 deletions(-)
 delete mode 100644 package/network/utils/nftables/patches/010-uclibc-ng.patch

diff --git a/include/netfilter.mk b/include/netfilter.mk
index 179d4ed7b9..0ba9c10dca 100644
--- a/include/netfilter.mk
+++ b/include/netfilter.mk
@@ -337,12 +337,11 @@ $(eval $(if $(NF_KMOD),$(call 
nf_add,NFT_CORE,CONFIG_NF_TABLES, $(P_XT)nf_tables
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_INET, 
$(P_XT)nf_tables_inet, lt 4.17),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_EXTHDR, 
$(P_XT)nft_exthdr),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_META, 
$(P_XT)nft_meta),))
-$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_NUMGEN, 
$(P_XT)nft_numgen, ge 4.9.0),))
+$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_NUMGEN, 
$(P_XT)nft_numgen),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CT, $(P_XT)nft_ct),))
-$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_RBTREE, 
$(P_XT)nft_set_rbtree, ge 4.9.0),))
-$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_RBTREE, 
$(P_XT)nft_rbtree, lt 4.9.0),))
-$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_HASH, 
$(P_XT)nft_set_hash, ge 4.9.0),))
-$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_HASH, 
$(P_XT)nft_hash, lt 4.9.0),))
+$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_RBTREE, 
$(P_XT)nft_set_rbtree, le 4.17.0),))
+$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_HASH, 
$(P_XT)nft_set_hash, le 4.17.0),))
+$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_SET, 
$(P_XT)nf_tables_set, gt 4.17),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_COUNTER, 
$(P_XT)nft_counter),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LOG, 
$(P_XT)nft_log),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LIMIT, 
$(P_XT)nft_limit),))
@@ -352,8 +351,8 @@ $(eval $(if $(NF_KMOD),$(call 
nf_add,NFT_CORE,CONFIG_NF_TABLES_IPV4, $(P_V4)nf_t
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV4, 
$(P_V4)nft_chain_route_ipv4),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_IPV6, 
$(P_V6)nf_tables_ipv6, lt 4.17),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV6, 
$(P_V6)nft_chain_route_ipv6),))
-$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REDIR, 
$(P_XT)nft_redir, ge 3.19.0),))
-$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_QUOTA, 
$(P_XT)nft_quota, ge 4.9.0),))
+$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REDIR, 
$(P_XT)nft_redir),))
+$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_QUOTA, 
$(P_XT)nft_quota),))
 
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_ARP,CONFIG_NF_TABLES_ARP, 
$(P_V4)nf_tables_arp, lt 4.17),))
 
@@ -363,11 +362,11 @@ $(eval $(if $(NF_KMOD),$(call 
nf_add,NFT_BRIDGE,CONFIG_NFT_BRIDGE_REJECT, $(P_EB
 
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_nat),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_CHAIN_NAT_IPV4, 
$(P_V4)nft_chain_nat_ipv4),))
-$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_REDIR_IPV4, 
$(P_V4)nft_redir_ipv4, ge 3.19.0),))
+$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_REDIR_IPV4, 
$(P_V4)nft_redir_ipv4),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_MASQ, 
$(P_XT)nft_masq),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_MASQ_IPV4, 
$(P_V4)nft_masq_ipv4),))
 
-$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_REDIR_IPV6, 
$(P_V6)nft_redir_ipv6, ge 3.19.0),))
+$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_REDIR_IPV6, 
$(P_V6)nft_redir_ipv6),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_CHAIN_NAT_IPV6, 
$(P_V6)nft_chain_nat_ipv6),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_MASQ_IPV6, 
$(P_V6)nft_masq_ipv6),))
 
diff --git a/package/network/utils/nftables/Makefile 
b/package/network/utils/nftables/Makefile
index d4f91a2c89..0ffb2adc01 100644
--- a/package/network/utils/nftables/Makefile
+++ b/package/network/utils/nftables/Makefile
@@ -7,12 +7,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nftables
-PKG_VERSION:=0.9.0
+PKG_VERSION:=0.9.1
 PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 

Re: [OpenWrt-Devel] [PATCH] ar71xx: enable QCA955x SGMII fixup on Mikrotik wAP AC

2019-07-14 Thread David Bauer
Hi Etienne,

one small remark:

On 14.07.19 04:43, Etienne Champetier wrote:
>   ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 0);
>   ath79_eth1_data.mii_bus_dev = _phy_device.dev;
>   ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
>   ath79_eth1_data.phy_mask = BIT(RBWAPGSC_MDIO_PHYADDR);
> + ath79_eth1_data.enable_sgmii_fixup = 1;

This should be dropped as it's not necessary anymore.

Best wishes
David

>   ath79_eth1_pll_data.pll_1000 = 0x03000101;
>   ath79_eth1_pll_data.pll_100 = 0x8101;
>   ath79_eth1_pll_data.pll_10 = 0x80001313;
> 

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


Re: [OpenWrt-Devel] [PATCH] gemini: Bring up DSA switches

2019-07-14 Thread Linus Walleij
On Sat, Jul 13, 2019 at 10:38 PM Florian Fainelli  wrote:

> drivers/net/dsa/vitesse-vsc73xx.c returns DSA_TAG_PROTO_NONE for the
> tagging protocol, which means that the DSA slave devices are only
> control devices they are not used by the data-path (which requires an
> appropriate tagging protocol to allow differentiating the Ethernet
> frames on a per-port basis). If you supported a different tagging
> protocol, then you would not be able to enslave the DSA master device
> (eth1) into the bridge, because that would conflict with the bridge's
> rx_handler, see 8db0a2ee2c6302a1dcbcdb93cb731dfc6c0cdb5e ("net: bridge:
> reject DSA-enabled master netdevices as bridge members")

Ah it's because of this! I try to figure it out. Thanks Florian!

I really tried to figure out a way to get both the Vitesse and Realtek
switches to do internal tagging but they just don't.

The Vitesse switches can do VLAN but I just haven't implemented
it yet, but now that Adrian is using it on a Freescale board as well
I might get to it as we have some more users.

There are some patches to the kernel do do port separation using
only VLAN (by Vladimir Oltean) but of course I have to implement
VLAN first if I want to try to use that.

> Your second sequence is more in line with what you should do, see the
> recent documentation examples from Benedikt:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/dsa/configuration.rst

Oh that is really good documentation. I linked it in the Ethernet switch
page in the OpenWrt wiki.

Yours,
Linus Walleij

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