Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for GL.iNet GL-X1200

2019-04-11 Thread Guilin.Wang
I agree with Jeff that we need to test in detail before switching to ath79.
 
 
-- Original --
From:  "Jeff";
Date:  Thu, Apr 11, 2019 10:31 PM
To:  "Petr Štetiar"; "wellnw"; 
Cc:  "openwrt-devel"; "Kevin 'ldir' 
Darbyshire-Bryant"; 
Subject:  Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for GL.iNet GL-X1200

 


On 4/11/19 5:56 AM, Petr Štetiar wrote:
> Guilin.Wang  [2019-04-11 17:18:12]:
>
> Hi,
>
>> I want to submit it to ar71xx first, and I will submit it to ath79 later.
> tl;dr version:
>
> please don't waste your (and our time) with ar71xx anymore. BTW it was ath79
> first and ar71xx possibly later, but this period is already over. At least for
> me ar71xx is currently in 'fixes only' mode.
>
> Longer version:
>
> Even if you've provided ath79 support first I would simply hesitate to include
> ar71xx support for this device as it has simply non trivial amount of changes
> (the non-written rule it was agreed upon). Your changeset has following 
> numstats:
>
>   12 files changed, 218 insertions(+)
>
> Please take a look at the recent commits to ar71xx, it's pretty much 'fixes 
> only' mode already:
>
>   93d23aced ar71xx: Correct MAC address for WAN interface of Archer C7 v5
>1 file changed, 4 insertions(+)
[...]

Wow, I would have thought a simple

"Thank you for your submission. We appreciate your commercial concerns. 
We look forward to your future submissions on the ath79 platform."

would have been more than enough.

GL.iNet is one of the few OEMs that commercially benefit from OpenWrt 
development that take the time to try to return patches and enhancements 
directly to the project. "Don't waste our time" comes through loud and 
clear. If I were an OEM, why should I bother submitting patches? There 
is real opportunity cost associated with doing so, and not very much 
tangible benefit compared to maintaining their own "private" branch.

That the ath79 target on Linux 4.14 doesn't support NAND makes it 
challenging for a manufacturer to simply switch over their entire code 
development. Yes, patches for ath79 on Linux 4.19 dropped a week or two 
ago. However, a reputable manufacturer isn't going to ship product on an 
untested code line. So far I have seen that batman-adv won't even 
compile under ath79/4.19. Also, while the framework is supposedly 
present for NAND in Linux 4.19, as far as I know no devices have been 
demonstrated to be able to use it under OpenWrt. Not that I expect those 
things to magically happen, but they do make it challenging for a 
responsible OEM to switch over as easily as a hobbyist.


Jeff



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


[OpenWrt-Devel] [PATCH procd 1/4] instance: add support for customizable syslog facilities

2019-04-11 Thread Michael Heimpold
Signed-off-by: Michael Heimpold 
---
 service/instance.c | 32 +++-
 service/instance.h |  1 +
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/service/instance.c b/service/instance.c
index 3512f66..d37d872 100644
--- a/service/instance.c
+++ b/service/instance.c
@@ -26,6 +26,8 @@
 #include 
 #include 
 #include 
+#define SYSLOG_NAMES
+#include 
 
 #include 
 
@@ -57,6 +59,7 @@ enum {
INSTANCE_ATTR_PIDFILE,
INSTANCE_ATTR_RELOADSIG,
INSTANCE_ATTR_TERMTIMEOUT,
+   INSTANCE_ATTR_FACILITY,
__INSTANCE_ATTR_MAX
 };
 
@@ -82,6 +85,7 @@ static const struct blobmsg_policy 
instance_attr[__INSTANCE_ATTR_MAX] = {
[INSTANCE_ATTR_PIDFILE] = { "pidfile", BLOBMSG_TYPE_STRING },
[INSTANCE_ATTR_RELOADSIG] = { "reload_signal", BLOBMSG_TYPE_INT32 },
[INSTANCE_ATTR_TERMTIMEOUT] = { "term_timeout", BLOBMSG_TYPE_INT32 },
+   [INSTANCE_ATTR_FACILITY] = { "facility", BLOBMSG_TYPE_STRING },
 };
 
 enum {
@@ -148,6 +152,18 @@ static void closefd(int fd)
close(fd);
 }
 
+/* convert a string into numeric syslog facility or return -1 if no match 
found */
+static int
+syslog_facility_str_to_int(const char *facility)
+{
+   CODE *p = facilitynames;
+
+   while (p->c_name && strcasecmp(p->c_name, facility))
+   p++;
+
+   return p->c_val;
+}
+
 static void
 instance_limits(const char *limit, const char *value)
 {
@@ -466,7 +482,7 @@ instance_stdio(struct ustream *s, int prio, struct 
service_instance *in)
 
arg0 = basename(blobmsg_data(blobmsg_data(in->command)));
snprintf(ident, sizeof(ident), "%s[%d]", arg0, in->proc.pid);
-   ulog_open(ULOG_SYSLOG, LOG_DAEMON, ident);
+   ulog_open(ULOG_SYSLOG, in->syslog_facility, ident);
 
do {
str = ustream_get_read_buf(s, );
@@ -628,6 +644,9 @@ instance_config_changed(struct service_instance *in, struct 
service_instance *in
if (in->nice != in_new->nice)
return true;
 
+   if (in->syslog_facility != in_new->syslog_facility)
+   return true;
+
if (string_changed(in->user, in_new->user))
return true;
 
@@ -938,6 +957,15 @@ instance_config_parse(struct service_instance *in)
if (!instance_fill_array(>errors, tb[INSTANCE_ATTR_ERROR], NULL, 
true))
return false;
 
+   if (tb[INSTANCE_ATTR_FACILITY]) {
+   int facility = 
syslog_facility_str_to_int(blobmsg_get_string(tb[INSTANCE_ATTR_FACILITY]));
+   if (facility != -1) {
+   in->syslog_facility = facility;
+   DEBUG(3, "setting facility '%s'\n", 
blobmsg_get_string(tb[INSTANCE_ATTR_FACILITY]));
+   } else
+   DEBUG(3, "unknown syslog facility '%s' given, using 
default (LOG_DAEMON)\n", blobmsg_get_string(tb[INSTANCE_ATTR_FACILITY]));
+   }
+
return true;
 }
 
@@ -974,6 +1002,7 @@ instance_config_move(struct service_instance *in, struct 
service_instance *in_sr
in->trace = in_src->trace;
in->seccomp = in_src->seccomp;
in->node.avl.key = in_src->node.avl.key;
+   in->syslog_facility = in_src->syslog_facility;
 
free(in->config);
in->config = in_src->config;
@@ -1022,6 +1051,7 @@ instance_init(struct service_instance *in, struct service 
*s, struct blob_attr *
in->timeout.cb = instance_timeout;
in->proc.cb = instance_exit;
in->term_timeout = 5;
+   in->syslog_facility = LOG_DAEMON;
 
in->_stdout.fd.fd = -2;
in->_stdout.stream.string_data = true;
diff --git a/service/instance.h b/service/instance.h
index 771406c..9300d32 100644
--- a/service/instance.h
+++ b/service/instance.h
@@ -59,6 +59,7 @@ struct service_instance {
struct jail jail;
char *seccomp;
char *pidfile;
+   int syslog_facility;
 
uint32_t term_timeout;
uint32_t respawn_timeout;
-- 
2.17.1


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


[OpenWrt-Devel] [PATCH (resend as series) procd/openwrt 0/4] procd enhancements

2019-04-11 Thread Michael Heimpold
This series bundles two little enhancements for procd and also
adds the required passing-through to the procd shell script helper.

(1) Allow to specify the syslog facility for stdour/stderr syslog redirection

At the moment, the instance stdout/stderr output is always logged with
daemon facility which makes it hard to e.g. filter for messages.
This patch allows to select an other syslog facility, e.g. local0.

(2) Allow setting dedicated groupid for services

Sometimes is desirable to run a process with a specific group id
instead of the default one which is derived from passwd entry.

Please note, that the first two patch needs to applied to procd repository
while patch three and four targets OpenWrt repository (i.e. procd
package).

-- 

2.17.1


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


[OpenWrt-Devel] [PATCH openwrt 3/4] procd: allow passing optional syslog facility as instance parameter

2019-04-11 Thread Michael Heimpold
While at, also add stdout/stderr documentation.

Signed-off-by: Michael Heimpold 
---
 package/system/procd/files/procd.sh | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/package/system/procd/files/procd.sh 
b/package/system/procd/files/procd.sh
index 72f25fe0c0..6115f0702f 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -20,6 +20,9 @@
 # limits: resource limits (passed to the process)
 # user info: array with 1 values $username
 # pidfile: file name to write pid into
+# stdout: boolean whether to redirect commands stdout to syslog (default: 
0)
+# stderr: boolean whether to redirect commands stderr to syslog (default: 
0)
+# facility: syslog facility used when logging to syslog (default: daemon)
 #
 #   No space separation is done for arrays/tables - use one function argument 
per command line argument
 #
@@ -249,7 +252,7 @@ _procd_set_param() {
reload_signal)
json_add_int "$type" $(kill -l "$1")
;;
-   pidfile|user|seccomp|capabilities)
+   pidfile|user|seccomp|capabilities|facility)
json_add_string "$type" "$1"
;;
stdout|stderr|no_new_privs)
-- 
2.17.1


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


[OpenWrt-Devel] [PATCH procd 2/4] service: allow setting a dedicated group id

2019-04-11 Thread Michael Heimpold
Sometimes is desirable to run a process with a specific group id
instead of the default one which is derived from passwd entry.

However, we still want to initialize supplementary group ids
(including the default one), thus we have to store the specific
one in a dedicated structure element.

Signed-off-by: Michael Heimpold 
---
 service/instance.c | 25 -
 service/instance.h |  4 +++-
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/service/instance.c b/service/instance.c
index d37d872..d8bd52e 100644
--- a/service/instance.c
+++ b/service/instance.c
@@ -50,6 +50,7 @@ enum {
INSTANCE_ATTR_WATCH,
INSTANCE_ATTR_ERROR,
INSTANCE_ATTR_USER,
+   INSTANCE_ATTR_GROUP,
INSTANCE_ATTR_STDOUT,
INSTANCE_ATTR_STDERR,
INSTANCE_ATTR_NO_NEW_PRIVS,
@@ -76,6 +77,7 @@ static const struct blobmsg_policy 
instance_attr[__INSTANCE_ATTR_MAX] = {
[INSTANCE_ATTR_WATCH] = { "watch", BLOBMSG_TYPE_ARRAY },
[INSTANCE_ATTR_ERROR] = { "error", BLOBMSG_TYPE_ARRAY },
[INSTANCE_ATTR_USER] = { "user", BLOBMSG_TYPE_STRING },
+   [INSTANCE_ATTR_GROUP] = { "group", BLOBMSG_TYPE_STRING },
[INSTANCE_ATTR_STDOUT] = { "stdout", BLOBMSG_TYPE_BOOL },
[INSTANCE_ATTR_STDERR] = { "stderr", BLOBMSG_TYPE_BOOL },
[INSTANCE_ATTR_NO_NEW_PRIVS] = { "no_new_privs", BLOBMSG_TYPE_BOOL },
@@ -364,12 +366,12 @@ instance_run(struct service_instance *in, int _stdout, 
int _stderr)
closefd(_stderr);
}
 
-   if (in->user && in->gid && initgroups(in->user, in->gid)) {
+   if (in->user && in->pw_gid && initgroups(in->user, in->pw_gid)) {
ERROR("failed to initgroups() for user %s: %m\n", in->user);
exit(127);
}
-   if (in->gid && setgid(in->gid)) {
-   ERROR("failed to set group id %d: %m\n", in->gid);
+   if (in->gr_gid && setgid(in->gr_gid)) {
+   ERROR("failed to set group id %d: %m\n", in->gr_gid);
exit(127);
}
if (in->uid && setuid(in->uid)) {
@@ -650,10 +652,13 @@ instance_config_changed(struct service_instance *in, 
struct service_instance *in
if (string_changed(in->user, in_new->user))
return true;
 
+   if (string_changed(in->group, in_new->group))
+   return true;
+
if (in->uid != in_new->uid)
return true;
 
-   if (in->gid != in_new->gid)
+   if (in->pw_gid != in_new->pw_gid)
return true;
 
if (string_changed(in->pidfile, in_new->pidfile))
@@ -909,7 +914,16 @@ instance_config_parse(struct service_instance *in)
if (p) {
in->user = strdup(user);
in->uid = p->pw_uid;
-   in->gid = p->pw_gid;
+   in->gr_gid = in->pw_gid = p->pw_gid;
+   }
+   }
+
+   if (tb[INSTANCE_ATTR_GROUP]) {
+   const char *group = blobmsg_get_string(tb[INSTANCE_ATTR_GROUP]);
+   struct group *p = getgrnam(group);
+   if (p) {
+   in->group = strdup(group);
+   in->gr_gid = p->gr_gid;
}
}
 
@@ -1038,6 +1052,7 @@ instance_free(struct service_instance *in)
instance_config_cleanup(in);
free(in->config);
free(in->user);
+   free(in->group);
free(in);
 }
 
diff --git a/service/instance.h b/service/instance.h
index 9300d32..42cc4be 100644
--- a/service/instance.h
+++ b/service/instance.h
@@ -44,7 +44,9 @@ struct service_instance {
 
char *user;
uid_t uid;
-   gid_t gid;
+   gid_t pw_gid;
+   char *group;
+   gid_t gr_gid;
 
bool halt;
bool restart;
-- 
2.17.1


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


[OpenWrt-Devel] [PATCH openwrt 4/4] procd: allow passing optional group instance parameter

2019-04-11 Thread Michael Heimpold
Signed-off-by: Michael Heimpold 
---
 package/system/procd/files/procd.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/package/system/procd/files/procd.sh 
b/package/system/procd/files/procd.sh
index 6115f0702f..b49b2b9d01 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -18,7 +18,8 @@
 # file: configuration files (array)
 # netdev: bound network device (detects ifindex changes)
 # limits: resource limits (passed to the process)
-# user info: array with 1 values $username
+# user: $username to run service as
+# group: $groupname to run service as
 # pidfile: file name to write pid into
 # stdout: boolean whether to redirect commands stdout to syslog (default: 
0)
 # stderr: boolean whether to redirect commands stderr to syslog (default: 
0)
@@ -252,7 +253,7 @@ _procd_set_param() {
reload_signal)
json_add_int "$type" $(kill -l "$1")
;;
-   pidfile|user|seccomp|capabilities|facility)
+   pidfile|user|group|seccomp|capabilities|facility)
json_add_string "$type" "$1"
;;
stdout|stderr|no_new_privs)
-- 
2.17.1


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


Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for GL.iNet GL-X1200

2019-04-11 Thread Sami Olmari 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 ---
On Thu, Apr 11, 2019 at 5:31 PM Jeff  wrote:

> Wow, I would have thought a simple
>
> "Thank you for your submission. We appreciate your commercial concerns.
> We look forward to your future submissions on the ath79 platform."
>
> would have been more than enough.
>
> GL.iNet is one of the few OEMs that commercially benefit from OpenWrt
> development that take the time to try to return patches and enhancements
> directly to the project. "Don't waste our time" comes through loud and
> clear. If I were an OEM, why should I bother submitting patches? There
> is real opportunity cost associated with doing so, and not very much
> tangible benefit compared to maintaining their own "private" branch.
>
> That the ath79 target on Linux 4.14 doesn't support NAND makes it
> challenging for a manufacturer to simply switch over their entire code
> development. Yes, patches for ath79 on Linux 4.19 dropped a week or two
> ago. However, a reputable manufacturer isn't going to ship product on an
> untested code line. So far I have seen that batman-adv won't even
> compile under ath79/4.19. Also, while the framework is supposedly
> present for NAND in Linux 4.19, as far as I know no devices have been
> demonstrated to be able to use it under OpenWrt. Not that I expect those
> things to magically happen, but they do make it challenging for a
> responsible OEM to switch over as easily as a hobbyist.
>
>
> Jeff
>

For what it's worth to say from "back here from the side", I don't think
the "waste our time" was meant as bad as it did indeed sounded... The thing
still is that AR71xx target is planned to be obsoleted after very next
OpenWrt stable version, so it doesn't make that much sense figuring out
anything major for that target.

Unfortunately, like Jeff pointed out too, ATH79 isn't 100% working in all
areas, but that can only change with developing...

There is also "clash" of new codebase and MFG releasing mature enough
stuff. That is something that allways will exist. All I can say to that is
that an device MFG builds and does whatever they deem to be best practice
(to them), if it is sticking to codebase that is on phase of being
obsolete, they can do so. It will work for current devices and even new
devices appearing in near-future, but it will not be long-term solution...

Also one should think that having new codebase that is deemed to be
overally better, everyone should focus on developing that instead of burden
of figuring out similar stuff for 2 codebases...

These kind of transitions are never painless...

Best regards,
-- 
 Sami Olmari
--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/4] ath79: allow to override AR8033 SGMII aneg status

2019-04-11 Thread David Bauer
In order to make the QCA955x SGMII workaround work, the unsuccessful
SGMII autonegotiation on the AR8033 should not block the PHY
state-machine.

Otherwise, the ag71xx driver never becomes aware of the copper-side
link-establishment and the workaround is never executed.

Signed-off-by: David Bauer 
---
 .../425-at803x-allow-sgmii-aneg-override.patch   | 16 
 .../425-at803x-allow-sgmii-aneg-override.patch   | 16 
 2 files changed, 32 insertions(+)
 create mode 100644 
target/linux/ath79/patches-4.14/425-at803x-allow-sgmii-aneg-override.patch
 create mode 100644 
target/linux/ath79/patches-4.19/425-at803x-allow-sgmii-aneg-override.patch

diff --git 
a/target/linux/ath79/patches-4.14/425-at803x-allow-sgmii-aneg-override.patch 
b/target/linux/ath79/patches-4.14/425-at803x-allow-sgmii-aneg-override.patch
new file mode 100644
index 00..0ac6af38f3
--- /dev/null
+++ b/target/linux/ath79/patches-4.14/425-at803x-allow-sgmii-aneg-override.patch
@@ -0,0 +1,16 @@
+--- a/drivers/net/phy/at803x.c
 b/drivers/net/phy/at803x.c
+@@ -484,6 +484,13 @@ static int at803x_aneg_done(struct phy_d
+   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;
++#ifdef CONFIG_OF_MDIO
++  if (phydev->mdio.dev.of_node && 
++  of_property_read_bool(phydev->mdio.dev.of_node,
++  "at803x-override-sgmii-link-check")) {
++  aneg_done = 1;
++  }
++#endif
+   }
+   /* switch back to copper page */
+   phy_write(phydev, AT803X_REG_CHIP_CONFIG, ccr | AT803X_BT_BX_REG_SEL);
diff --git 
a/target/linux/ath79/patches-4.19/425-at803x-allow-sgmii-aneg-override.patch 
b/target/linux/ath79/patches-4.19/425-at803x-allow-sgmii-aneg-override.patch
new file mode 100644
index 00..0ac6af38f3
--- /dev/null
+++ b/target/linux/ath79/patches-4.19/425-at803x-allow-sgmii-aneg-override.patch
@@ -0,0 +1,16 @@
+--- a/drivers/net/phy/at803x.c
 b/drivers/net/phy/at803x.c
+@@ -484,6 +484,13 @@ static int at803x_aneg_done(struct phy_d
+   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;
++#ifdef CONFIG_OF_MDIO
++  if (phydev->mdio.dev.of_node && 
++  of_property_read_bool(phydev->mdio.dev.of_node,
++  "at803x-override-sgmii-link-check")) {
++  aneg_done = 1;
++  }
++#endif
+   }
+   /* switch back to copper page */
+   phy_write(phydev, AT803X_REG_CHIP_CONFIG, ccr | AT803X_BT_BX_REG_SEL);
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH 2/4] ath79: add QCA955x SGMII link loss workaround

2019-04-11 Thread David Bauer
This commit adds a workaround for the loss of the SGMII link observed on
the QCA955x generation of SoCs. The workaround originates part from the
U-Boot source code, part from the implementation from AVM found in the
GPL tarball for the AVM FRITZ!WLAN Repeater 450E.

The bug results in a stuck SGMII link between the PHY device and the SoC
side. This has only been observed with the Atheros AR8033 PHY and most
likely all devices using such combination are affected.

It is worked around by reading a hidden SGMII status register and
issuing a SGMII PHY reset until the link becomes useable again.

Signed-off-by: David Bauer 
---
 .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 108 ++
 ...9-add-missing-QCA955x-GMAC-registers.patch |  91 +++
 ...9-add-missing-QCA955x-GMAC-registers.patch |  91 +++
 3 files changed, 290 insertions(+)
 create mode 100644 
target/linux/ath79/patches-4.14/0038-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch
 create mode 100644 
target/linux/ath79/patches-4.19/0038-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch

diff --git 
a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c 
b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index 8cff56a11a..a7565e6ffb 100644
--- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -559,6 +559,112 @@ static void ath79_set_pll(struct ag71xx *ag)
udelay(100);
 }
 
+static void ag71xx_bit_set(void __iomem *reg, u32 bit)
+{
+   u32 val;
+
+   val = __raw_readl(reg) | bit;
+   __raw_writel(val, reg);
+   __raw_readl(reg);
+}
+
+static void ag71xx_bit_clear(void __iomem *reg, u32 bit)
+{
+   u32 val;
+
+   val = __raw_readl(reg) & ~bit;
+   __raw_writel(val, reg);
+   __raw_readl(reg);
+}
+
+static void ag71xx_sgmii_init_qca955x(struct device_node *np)
+{
+   struct device_node *np_dev;
+   void __iomem *gmac_base;
+   u32 mr_an_status;
+   u32 sgmii_status;
+   u8 tries = 0;
+   int err = 0;
+
+   np = of_get_child_by_name(np, "gmac-config");
+   if (!np)
+   return;
+
+   np_dev = of_parse_phandle(np, "device", 0);
+   if (!np_dev)
+   goto out;
+
+   gmac_base = of_iomap(np_dev, 0);
+   if (!gmac_base) {
+   pr_err("%pOF: can't map GMAC registers\n", np_dev);
+   err = -ENOMEM;
+   goto err_iomap;
+   }
+
+   mr_an_status = __raw_readl(gmac_base + QCA955X_GMAC_REG_MR_AN_STATUS);
+   if (!(mr_an_status & QCA955X_MR_AN_STATUS_AN_ABILITY))
+   goto sgmii_out;
+
+   /* SGMII reset sequence */
+   __raw_writel(QCA955X_SGMII_RESET_RX_CLK_N_RESET,
+gmac_base + QCA955X_GMAC_REG_SGMII_RESET);
+   __raw_readl(gmac_base + QCA955X_GMAC_REG_SGMII_RESET);
+   udelay(10);
+
+   ag71xx_bit_set(gmac_base + QCA955X_GMAC_REG_SGMII_RESET,
+  QCA955X_SGMII_RESET_HW_RX_125M_N);
+   udelay(10);
+
+   ag71xx_bit_set(gmac_base + QCA955X_GMAC_REG_SGMII_RESET,
+  QCA955X_SGMII_RESET_RX_125M_N);
+   udelay(10);
+
+   ag71xx_bit_set(gmac_base + QCA955X_GMAC_REG_SGMII_RESET,
+  QCA955X_SGMII_RESET_TX_125M_N);
+   udelay(10);
+
+   ag71xx_bit_set(gmac_base + QCA955X_GMAC_REG_SGMII_RESET,
+  QCA955X_SGMII_RESET_RX_CLK_N);
+   udelay(10);
+
+   ag71xx_bit_set(gmac_base + QCA955X_GMAC_REG_SGMII_RESET,
+  QCA955X_SGMII_RESET_TX_CLK_N);
+   udelay(10);
+
+   /*
+* The following is what QCA has to say about what happens here:
+*
+* Across resets SGMII link status goes to weird state.
+* If SGMII_DEBUG register reads other than 0x1f or 0x10,
+* we are for sure in a bad  state.
+*
+* Issue a PHY reset in MR_AN_CONTROL to keep going.
+*/
+   do {
+   ag71xx_bit_set(gmac_base + QCA955X_GMAC_REG_MR_AN_CONTROL,
+  QCA955X_MR_AN_CONTROL_PHY_RESET |
+  QCA955X_MR_AN_CONTROL_AN_ENABLE);
+   udelay(200);
+   ag71xx_bit_clear(gmac_base + QCA955X_GMAC_REG_MR_AN_CONTROL,
+QCA955X_MR_AN_CONTROL_PHY_RESET);
+   mdelay(300);
+   sgmii_status = __raw_readl(gmac_base + 
QCA955X_GMAC_REG_SGMII_DEBUG) &
+  QCA955X_SGMII_DEBUG_TX_STATE_MASK;
+
+   if (tries++ >= 20) {
+   pr_err("ag71xx: max retries for SGMII fixup 
exceeded\n");
+   break;
+   }
+   } while (!(sgmii_status == 0xf || sgmii_status == 0x10));
+
+sgmii_out:
+   iounmap(gmac_base);
+err_iomap:
+   of_node_put(np_dev);
+out:
+   of_node_put(np);
+}
+
 static void 

[OpenWrt-Devel] [PATCH 4/4] ath79: enable QCA955x SGMII workaround

2019-04-11 Thread David Bauer
Enable the QCA955x SGMII workaround for all devices which sport the
AR8033 + QCA955x combination which is known to show the link-stuck
symptoms.

Signed-off-by: David Bauer 
---
 target/linux/ath79/dts/qca9558_devolo_dvl1xxx.dtsi | 6 ++
 target/linux/ath79/dts/qca9558_ocedo_ursus.dts | 6 ++
 target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts | 6 ++
 3 files changed, 18 insertions(+)

diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1xxx.dtsi 
b/target/linux/ath79/dts/qca9558_devolo_dvl1xxx.dtsi
index 9937186b1e..e2d1b7cc94 100644
--- a/target/linux/ath79/dts/qca9558_devolo_dvl1xxx.dtsi
+++ b/target/linux/ath79/dts/qca9558_devolo_dvl1xxx.dtsi
@@ -131,6 +131,7 @@
  {
phy1: ethernet-phy@1 {
reg = <1>;
+   at803x-override-sgmii-link-check;
};
 };
 
@@ -139,6 +140,11 @@
mtd-mac-address-increment = <1>;
phy-handle = <>;
pll-data = <0x03000101 0x0101 0x1313>;
+   qca955x-sgmii-fixup;
+
+   gmac-config {
+   device = <>;
+   };
 };
 
  {
diff --git a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts 
b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts
index 1a92da3946..53bfa51fd2 100644
--- a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts
+++ b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts
@@ -119,6 +119,7 @@
 
phy2: ethernet-phy@2 {
reg = <2>;
+   at803x-override-sgmii-link-check;
};
 };
 
@@ -144,4 +145,9 @@
mtd-mac-address = < 0x12>;
phy-handle = <>;
pll-data = <0x3000101 0x101 0x1313>;
+   qca955x-sgmii-fixup;
+
+   gmac-config {
+   device = <>;
+   };
 };
diff --git a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts 
b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts
index 1e3cf40f71..d05e844d63 100644
--- a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts
+++ b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts
@@ -146,6 +146,7 @@
phy1: ethernet-phy@1 {
reg = <1>;
phy-mode = "sgmii";
+   at803x-override-sgmii-link-check;
};
 };
 
@@ -165,4 +166,9 @@
 
phy-handle = <>;
phy-mode = "sgmii";
+   qca955x-sgmii-fixup;
+
+   gmac-config {
+   device = <>;
+   };
 };
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH 1/4] ath79: fix QCA955x GMAC register size

2019-04-11 Thread David Bauer
The register size of the QCA955x currently matches the size stated in
the datasheet. However, there are more hidden GMAC registers which are
needed for the SGMII workaround to work.

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

diff --git a/target/linux/ath79/dts/qca9557.dtsi 
b/target/linux/ath79/dts/qca9557.dtsi
index fefb91c39a..b726a382ee 100644
--- a/target/linux/ath79/dts/qca9557.dtsi
+++ b/target/linux/ath79/dts/qca9557.dtsi
@@ -223,7 +223,7 @@
 
gmac: gmac@1807 {
compatible = "qca,qca9550-gmac";
-   reg = <0x1807 0x14>;
+   reg = <0x1807 0x58>;
};
 
wmac: wmac@1810 {
-- 
2.21.0


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


Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for GL.iNet GL-X1200

2019-04-11 Thread Jeff


On 4/11/19 5:56 AM, Petr Štetiar wrote:

Guilin.Wang  [2019-04-11 17:18:12]:

Hi,


I want to submit it to ar71xx first, and I will submit it to ath79 later.

tl;dr version:

please don't waste your (and our time) with ar71xx anymore. BTW it was ath79
first and ar71xx possibly later, but this period is already over. At least for
me ar71xx is currently in 'fixes only' mode.

Longer version:

Even if you've provided ath79 support first I would simply hesitate to include
ar71xx support for this device as it has simply non trivial amount of changes
(the non-written rule it was agreed upon). Your changeset has following 
numstats:

  12 files changed, 218 insertions(+)

Please take a look at the recent commits to ar71xx, it's pretty much 'fixes 
only' mode already:

  93d23aced ar71xx: Correct MAC address for WAN interface of Archer C7 v5
   1 file changed, 4 insertions(+)

[...]

Wow, I would have thought a simple

"Thank you for your submission. We appreciate your commercial concerns. 
We look forward to your future submissions on the ath79 platform."


would have been more than enough.

GL.iNet is one of the few OEMs that commercially benefit from OpenWrt 
development that take the time to try to return patches and enhancements 
directly to the project. "Don't waste our time" comes through loud and 
clear. If I were an OEM, why should I bother submitting patches? There 
is real opportunity cost associated with doing so, and not very much 
tangible benefit compared to maintaining their own "private" branch.


That the ath79 target on Linux 4.14 doesn't support NAND makes it 
challenging for a manufacturer to simply switch over their entire code 
development. Yes, patches for ath79 on Linux 4.19 dropped a week or two 
ago. However, a reputable manufacturer isn't going to ship product on an 
untested code line. So far I have seen that batman-adv won't even 
compile under ath79/4.19. Also, while the framework is supposedly 
present for NAND in Linux 4.19, as far as I know no devices have been 
demonstrated to be able to use it under OpenWrt. Not that I expect those 
things to magically happen, but they do make it challenging for a 
responsible OEM to switch over as easily as a hobbyist.



Jeff



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


Re: [OpenWrt-Devel] [PATCH/netifd] interface: fix "if-down" hotplug event handling

2019-04-11 Thread Hans Dedecker
Hi,

On Thu, Apr 11, 2019 at 3:02 PM Martin Schiller  wrote:
>
> commit a97297d83e42 ("interface: set interface in TEARDOWN state when 
> checking link state")
> broke the if-down hotplug event handling, as the iface->state is now 
> IFS_TEARDOWN when
> calling the mark_interface_down() function from the IFPEV_DOWN event.
>
> Fixes: a97297d83e42 ("interface: set interface in TEARDOWN state when 
> checking link state")
> Signed-off-by: Martin Schiller 
> ---
>  interface.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/interface.c b/interface.c
> index fd7a826..7c25839 100644
> --- a/interface.c
> +++ b/interface.c
> @@ -268,7 +268,7 @@ mark_interface_down(struct interface *iface)
> iface->link_up_event = false;
> iface->state = IFS_DOWN;
> switch (state) {
> -   case IFS_UP:
> +   case IFS_TEARDOWN:
I don't think it's safe to remove the IFS_UP state as
mark_interface_down can be called when the interface is either in the
IFS_UP or IFS_TEARDOWN state

Hans
> interface_event(iface, IFEV_DOWN);
> break;
> case IFS_SETUP:
> --
> 2.11.0
>

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


[OpenWrt-Devel] [PATCH/netifd] interface: fix "if-down" hotplug event handling

2019-04-11 Thread Martin Schiller
commit a97297d83e42 ("interface: set interface in TEARDOWN state when checking 
link state")
broke the if-down hotplug event handling, as the iface->state is now 
IFS_TEARDOWN when
calling the mark_interface_down() function from the IFPEV_DOWN event.

Fixes: a97297d83e42 ("interface: set interface in TEARDOWN state when checking 
link state")
Signed-off-by: Martin Schiller 
---
 interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/interface.c b/interface.c
index fd7a826..7c25839 100644
--- a/interface.c
+++ b/interface.c
@@ -268,7 +268,7 @@ mark_interface_down(struct interface *iface)
iface->link_up_event = false;
iface->state = IFS_DOWN;
switch (state) {
-   case IFS_UP:
+   case IFS_TEARDOWN:
interface_event(iface, IFEV_DOWN);
break;
case IFS_SETUP:
-- 
2.11.0


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


Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for GL.iNet GL-X1200

2019-04-11 Thread Petr Štetiar
Guilin.Wang  [2019-04-11 17:18:12]:

Hi,

> I want to submit it to ar71xx first, and I will submit it to ath79 later.

tl;dr version:

please don't waste your (and our time) with ar71xx anymore. BTW it was ath79
first and ar71xx possibly later, but this period is already over. At least for
me ar71xx is currently in 'fixes only' mode.

Longer version:

Even if you've provided ath79 support first I would simply hesitate to include
ar71xx support for this device as it has simply non trivial amount of changes
(the non-written rule it was agreed upon). Your changeset has following 
numstats:

 12 files changed, 218 insertions(+)

Please take a look at the recent commits to ar71xx, it's pretty much 'fixes 
only' mode already:

 93d23aced ar71xx: Correct MAC address for WAN interface of Archer C7 v5
  1 file changed, 4 insertions(+)

 9aa8f87d2 ar71xx: Add "info" partition for TP-Link Archer C7 v5
  1 file changed, 1 insertion(+), 1 deletion(-)

 31ea08a64 ar71xx: ag71xx: Fix broken networking on some devices (FS#2177)
  1 file changed, 3 insertions(+), 2 deletions(-)

 0f8cdc28a ar71xx: Add support for Ubiquity Bullet M (XW)
  8 files changed, 18 insertions(+)

 6009b3fd5 ar71xx: ubnt-m-xw: Fix factory image flashing using TFTP recovery
  1 file changed, 11 insertions(+), 2 deletions(-)

 99f6f2c0b ar71xx: Add support for TP-Link CPE210 v3
  7 files changed, 29 insertions(+), 2 deletions(-)

 a2a972b2c ar71xx: Use dynamic partitions for TP-Link CPE210 v2
  1 file changed, 3 insertions(+), 1 deletion(-)

 0a67e84ba ar71xx: ens202ext: Fix whitespace issues
  1 file changed, 4 insertions(+), 4 deletions(-)

 d260813d0 ar71xx: ens202ext: Fix VLAN switch
  1 file changed, 5 insertions(+), 1 deletion(-)

 e1444ab59 ar71xx: add support for MikroTik RouterBOARD 922UAGS-5HPacD
  6 files changed, 87 insertions(+), 29 deletions(-)

 0304e76cd kernel: bump 4.14 to 4.14.107
  2 files changed, 5 insertions(+), 5 deletions(-)

 5ac974f21 ar71xx: Add support for Mikrotik RB SXT 2nD r3
  6 files changed, 9 insertions(+), 1 deletion(-)

 34113999e ar71xx: Remove ath10k packages from archer-c7-v1 (fixes FS#1743)
  1 file changed, 1 insertion(+), 1 deletion(-)

 26f7cf8ac ar71xx: Speed up mtd extraction in ar71xx.sh
  1 file changed, 2 insertions(+), 2 deletions(-)

 51fb186cb ar71xx: Speed up caldata/eeprom handling
  2 files changed, 6 insertions(+), 6 deletions(-)

 fe591f2fe ar71xx: enable QCA955x SGMII fixup on Rambutan
  1 file changed, 2 insertions(+)

 d3506d1bc ar71xx: ag71xx: fix compile error when enabling debug
  1 file changed, 5 insertions(+), 6 deletions(-)

 e65f935de ar71xx: Change led trigger from usbdev to usbport
  1 file changed, 46 insertions(+), 46 deletions(-)

 53c46b504 ar71xx: GL.iNet AR300M family: correct LED definitions
  2 files changed, 2 insertions(+), 8 deletions(-)

 319c5d7c4 ar71xx: Fix 5 GHz MAC address for Archer C60 v2
  1 file changed, 6 insertions(+), 1 deletion(-)

 78277ec16 ar71xx: fix TL-MR3220-v2 switch port order
  1 file changed, 1 insertion(+), 1 deletion(-)

 341311f319b18b74d1d112709830979ceab11f67 ar71xx: fix TL-WR741ND-v4 switch port 
order
  1 file changed, 5 insertions(+), 1 deletion(-)

 8c9f255ce56a43ecd49c80688052a02029c4fa52 ar71xx: add rssileds for xw devices
1 file changed, 1 insertion(+)

and just following commits have introduced new devices, so I'm adding reason why
it was included as well:

 0f8cdc28a ar71xx: Add support for Ubiquity Bullet M (XW)
  8 files changed, 18 insertions(+)

  added by me, it's already in ath79, patch was simple enough and I need this
  for ar71xx/ath79 testing

 99f6f2c0b ar71xx: Add support for TP-Link CPE210 v3
  7 files changed, 29 insertions(+), 2 deletions(-)

  commited by me, because this PR was lingering on the GitHub since 13th August
  2018, they worked really hard to make this happen(ath79, dynamic partitions
  etc) and the changes to ar71xx tree were really small, easy to review, very
  well tested so I've decided to give it a go.

 e1444ab59 ar71xx: add support for MikroTik RouterBOARD 922UAGS-5HPacD
  6 files changed, 87 insertions(+), 29 deletions(-)

  added by xback, can't comment on this one

 5ac974f21 ar71xx: Add support for Mikrotik RB SXT 2nD r3
  6 files changed, 9 insertions(+), 1 deletion(-)

  commited by me, because this PR was lingering on the GitHub since 18th
  October 2018, was simple enough and the user worked hard to get it in

So please stop sending ar71xx patches which are adding support for new devices,
ar71xx is really in 'fixes only' mode and you're wasting your time.

-- ynezz

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


Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for GL.iNet GL-X1200

2019-04-11 Thread Guilin.Wang
Thanks for your suggestion.
Since the customer is waiting for urgent use, I want to submit it to ar71xx 
first, and I will submit it to ath79 later.
 
-- Original --
From:  "Kevin 'ldir' Darbyshire-Bryant";
Date:  Thu, Apr 11, 2019 05:05 PM
To:  "wellnw";
Cc:  "openwrt-devel@lists.openwrt.org";
Subject:  Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for GL.iNet GL-X1200
 


> On 11 Apr 2019, at 08:53, wellnw  wrote:
> 
> This patch adds supports for GL-X1200.
> 
> Specification:
> - SOC: QCA9563 (775MHz)
> - Flash: 16 MiB (W25Q128FVSG)
> - RAM: 128 MiB DDR2
> - Ethernet: 4x 1Gbps LAN + 1x 1Gbps WAN
> - Wireless: QCA9563(2.4GHz) and QCA9886(5GHz)
> - SIM: 2x SIM card slots
> - MicroSD: 1x microSD slot
> - Antenna: 2x external 5dBi antennas
> - USB: 1x USB 2.0 port
> - Button: 1x reset button
> - LED: 16x LEDs (3x GPIO controllable)
> - UART: 1x UART on PCB (JP1: 3.3V, RX, TX, GND)
> 
> Signed-off-by: wellnw 
> ---
> target/linux/ar71xx/base-files/etc/board.d/01_leds |   4 +
> .../linux/ar71xx/base-files/etc/board.d/02_network |   4 +
> .../etc/hotplug.d/firmware/11-ath10k-caldata   |   5 +
> target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
> .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
> target/linux/ar71xx/config-4.14|   1 +
> .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  11 ++
> target/linux/ar71xx/files/arch/mips/ath79/Makefile |   1 +
> .../ar71xx/files/arch/mips/ath79/mach-gl-x1200.c   | 173 +
> .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   1 +
> target/linux/ar71xx/generic/config-default |   1 +
> target/linux/ar71xx/image/generic.mk   |  13 ++
> 12 files changed, 218 insertions(+)
> create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-gl-x1200.c
> 
> diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds 
> b/target/linux/ar71xx/base-files/etc/board.d/01_leds
> index 41dd8c5..eb455ce 100755
> --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
> +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
> @@ -448,6 +448,10 @@ gl-inet)
> ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth1"
> ucidef_set_led_wlan "wlan" "WLAN" "$board:red:wlan" "phy0tpt"
> ;;
> +gl-x1200)
> + ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:green:wlan2g" "phy1tpt"
> + ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g" "phy0tpt"
> + ;;
> hiwifi-hc6361)
> ucidef_set_led_netdev "inet" "INET" "hiwifi:blue:internet" "eth1"
> ucidef_set_led_wlan "wlan" "WLAN" "hiwifi:blue:wlan-2p4" "phy0tpt"
> diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network 
> b/target/linux/ar71xx/base-files/etc/board.d/02_network
> index 68874e0..6fd4c25 100755
> --- a/target/linux/ar71xx/base-files/etc/board.d/02_network
> +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
> @@ -456,6 +456,10 @@ ar71xx_setup_interfaces()
> ucidef_add_switch "switch0" \
>  "0@eth0" "2:lan:2" "3:lan:1" "1:wan"
> ;;
> + gl-x1200)
> + ucidef_add_switch "switch0" \
> + "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
> + ;;
> jwap230)
> ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
> ucidef_add_switch "switch0" \
> diff --git 
> a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
> b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> index 2ded261..fd6f213 100644
> --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> @@ -187,6 +187,11 @@ case "$FIRMWARE" in
> cf-e385ac)
> ath10kcal_extract "art" 20480 12064
> ;;
> + gl-x1200)
> + ath10kcal_extract "art" 20480 12064
> + ln -sf /lib/firmware/ath10k/pre-cal-pci-\:00\:00.0.bin \
> + /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
> + ;;
> esac
> ;;
> *)
> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
> b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> index 990683a..42902d0 100755
> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> @@ -794,6 +794,9 @@ ar71xx_board_detect() {
> *"GL-USB150")
> name="gl-usb150"
> ;;
> + *"GL-X1200")
> + name="gl-x1200"
> + ;;
> *"HiveAP-121")
> name="hiveap-121"
> ;;
> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> index 8173501..55be0a3 100755
> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> @@ -273,6 +273,7 @@ platform_check_image() {
> gl-domino|\
> gl-mifi|\
> gl-usb150|\
> + gl-x1200|\
> hiwifi-hc6361|\
> hornet-ub-x2|\
> jwap230|\
> diff --git a/target/linux/ar71xx/config-4.14 b/target/linux/ar71xx/config-4.14
> index 9a524fa..8f8d8ce 100644
> --- a/target/linux/ar71xx/config-4.14
> +++ b/target/linux/ar71xx/config-4.14
> @@ -130,6 +130,7 @@ 

Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for GL.iNet GL-X1200

2019-04-11 Thread Kevin 'ldir' Darbyshire-Bryant



> On 11 Apr 2019, at 08:53, wellnw  wrote:
> 
> This patch adds supports for GL-X1200.
> 
> Specification:
>   - SOC: QCA9563 (775MHz)
>   - Flash: 16 MiB (W25Q128FVSG)
>   - RAM: 128 MiB DDR2
>   - Ethernet: 4x 1Gbps LAN + 1x 1Gbps WAN
>   - Wireless: QCA9563(2.4GHz) and QCA9886(5GHz)
>   - SIM: 2x SIM card slots
>   - MicroSD: 1x microSD slot
>   - Antenna: 2x external 5dBi antennas
>   - USB: 1x USB 2.0 port
>   - Button: 1x reset button
>   - LED: 16x LEDs (3x GPIO controllable)
>   - UART: 1x UART on PCB (JP1: 3.3V, RX, TX, GND)
> 
> Signed-off-by: wellnw 
> ---
> target/linux/ar71xx/base-files/etc/board.d/01_leds |   4 +
> .../linux/ar71xx/base-files/etc/board.d/02_network |   4 +
> .../etc/hotplug.d/firmware/11-ath10k-caldata   |   5 +
> target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
> .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
> target/linux/ar71xx/config-4.14|   1 +
> .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  11 ++
> target/linux/ar71xx/files/arch/mips/ath79/Makefile |   1 +
> .../ar71xx/files/arch/mips/ath79/mach-gl-x1200.c   | 173 +
> .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   1 +
> target/linux/ar71xx/generic/config-default |   1 +
> target/linux/ar71xx/image/generic.mk   |  13 ++
> 12 files changed, 218 insertions(+)
> create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-gl-x1200.c
> 
> diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds 
> b/target/linux/ar71xx/base-files/etc/board.d/01_leds
> index 41dd8c5..eb455ce 100755
> --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
> +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
> @@ -448,6 +448,10 @@ gl-inet)
>   ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth1"
>   ucidef_set_led_wlan "wlan" "WLAN" "$board:red:wlan" "phy0tpt"
>   ;;
> +gl-x1200)
> + ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:green:wlan2g" "phy1tpt"
> + ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g" "phy0tpt"
> + ;;
> hiwifi-hc6361)
>   ucidef_set_led_netdev "inet" "INET" "hiwifi:blue:internet" "eth1"
>   ucidef_set_led_wlan "wlan" "WLAN" "hiwifi:blue:wlan-2p4" "phy0tpt"
> diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network 
> b/target/linux/ar71xx/base-files/etc/board.d/02_network
> index 68874e0..6fd4c25 100755
> --- a/target/linux/ar71xx/base-files/etc/board.d/02_network
> +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
> @@ -456,6 +456,10 @@ ar71xx_setup_interfaces()
>   ucidef_add_switch "switch0" \
>   "0@eth0" "2:lan:2" "3:lan:1" "1:wan"
>   ;;
> + gl-x1200)
> + ucidef_add_switch "switch0" \
> + "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
> + ;;
>   jwap230)
>   ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
>   ucidef_add_switch "switch0" \
> diff --git 
> a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
> b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> index 2ded261..fd6f213 100644
> --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> @@ -187,6 +187,11 @@ case "$FIRMWARE" in
>   cf-e385ac)
>   ath10kcal_extract "art" 20480 12064
>   ;;
> + gl-x1200)
> + ath10kcal_extract "art" 20480 12064
> + ln -sf /lib/firmware/ath10k/pre-cal-pci-\:00\:00.0.bin \
> + /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
> + ;;
>   esac
>   ;;
> *)
> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
> b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> index 990683a..42902d0 100755
> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> @@ -794,6 +794,9 @@ ar71xx_board_detect() {
>   *"GL-USB150")
>   name="gl-usb150"
>   ;;
> + *"GL-X1200")
> + name="gl-x1200"
> + ;;
>   *"HiveAP-121")
>   name="hiveap-121"
>   ;;
> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> index 8173501..55be0a3 100755
> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> @@ -273,6 +273,7 @@ platform_check_image() {
>   gl-domino|\
>   gl-mifi|\
>   gl-usb150|\
> + gl-x1200|\
>   hiwifi-hc6361|\
>   hornet-ub-x2|\
>   jwap230|\
> diff --git a/target/linux/ar71xx/config-4.14 b/target/linux/ar71xx/config-4.14
> index 9a524fa..8f8d8ce 100644
> --- a/target/linux/ar71xx/config-4.14
> +++ b/target/linux/ar71xx/config-4.14
> @@ -130,6 

Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for GL.iNet GL-X1200

2019-04-11 Thread Alberto Bursi



On 11/04/19 09:53, wellnw wrote:

This patch adds supports for GL-X1200.

Specification:
- SOC: QCA9563 (775MHz)
- Flash: 16 MiB (W25Q128FVSG)
- RAM: 128 MiB DDR2
- Ethernet: 4x 1Gbps LAN + 1x 1Gbps WAN
- Wireless: QCA9563(2.4GHz) and QCA9886(5GHz)
- SIM: 2x SIM card slots
- MicroSD: 1x microSD slot
- Antenna: 2x external 5dBi antennas
- USB: 1x USB 2.0 port
- Button: 1x reset button
- LED: 16x LEDs (3x GPIO controllable)
- UART: 1x UART on PCB (JP1: 3.3V, RX, TX, GND)

Signed-off-by: wellnw 
---



You need to use your name and surname in the Signed Off By.


-Alberto


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


[OpenWrt-Devel] [PATCH] ar71xx: add support for GL.iNet GL-X1200

2019-04-11 Thread wellnw
This patch adds supports for GL-X1200.

Specification:
- SOC: QCA9563 (775MHz)
- Flash: 16 MiB (W25Q128FVSG)
- RAM: 128 MiB DDR2
- Ethernet: 4x 1Gbps LAN + 1x 1Gbps WAN
- Wireless: QCA9563(2.4GHz) and QCA9886(5GHz)
- SIM: 2x SIM card slots
- MicroSD: 1x microSD slot
- Antenna: 2x external 5dBi antennas
- USB: 1x USB 2.0 port
- Button: 1x reset button
- LED: 16x LEDs (3x GPIO controllable)
- UART: 1x UART on PCB (JP1: 3.3V, RX, TX, GND)

Signed-off-by: wellnw 
---
 target/linux/ar71xx/base-files/etc/board.d/01_leds |   4 +
 .../linux/ar71xx/base-files/etc/board.d/02_network |   4 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata   |   5 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ar71xx/config-4.14|   1 +
 .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  11 ++
 target/linux/ar71xx/files/arch/mips/ath79/Makefile |   1 +
 .../ar71xx/files/arch/mips/ath79/mach-gl-x1200.c   | 173 +
 .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   1 +
 target/linux/ar71xx/generic/config-default |   1 +
 target/linux/ar71xx/image/generic.mk   |  13 ++
 12 files changed, 218 insertions(+)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-gl-x1200.c

diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds 
b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 41dd8c5..eb455ce 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -448,6 +448,10 @@ gl-inet)
ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth1"
ucidef_set_led_wlan "wlan" "WLAN" "$board:red:wlan" "phy0tpt"
;;
+gl-x1200)
+   ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:green:wlan2g" "phy1tpt"
+   ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g" "phy0tpt"
+   ;;
 hiwifi-hc6361)
ucidef_set_led_netdev "inet" "INET" "hiwifi:blue:internet" "eth1"
ucidef_set_led_wlan "wlan" "WLAN" "hiwifi:blue:wlan-2p4" "phy0tpt"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network 
b/target/linux/ar71xx/base-files/etc/board.d/02_network
index 68874e0..6fd4c25 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -456,6 +456,10 @@ ar71xx_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth0" "2:lan:2" "3:lan:1" "1:wan"
;;
+   gl-x1200)
+   ucidef_add_switch "switch0" \
+   "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
+   ;;
jwap230)
ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
ucidef_add_switch "switch0" \
diff --git 
a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 2ded261..fd6f213 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -187,6 +187,11 @@ case "$FIRMWARE" in
cf-e385ac)
ath10kcal_extract "art" 20480 12064
;;
+   gl-x1200)
+   ath10kcal_extract "art" 20480 12064
+   ln -sf /lib/firmware/ath10k/pre-cal-pci-\:00\:00.0.bin \
+   /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
+   ;;
esac
;;
 *)
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 990683a..42902d0 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -794,6 +794,9 @@ ar71xx_board_detect() {
*"GL-USB150")
name="gl-usb150"
;;
+   *"GL-X1200")
+   name="gl-x1200"
+   ;;
*"HiveAP-121")
name="hiveap-121"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 8173501..55be0a3 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -273,6 +273,7 @@ platform_check_image() {
gl-domino|\
gl-mifi|\
gl-usb150|\
+   gl-x1200|\
hiwifi-hc6361|\
hornet-ub-x2|\
jwap230|\
diff --git a/target/linux/ar71xx/config-4.14 b/target/linux/ar71xx/config-4.14
index 9a524fa..8f8d8ce 100644
--- a/target/linux/ar71xx/config-4.14
+++ b/target/linux/ar71xx/config-4.14
@@ -130,6 +130,7 @@ CONFIG_ATH79=y
 # CONFIG_ATH79_MACH_GL_INET is not set
 # CONFIG_ATH79_MACH_GL_MIFI is not set
 # CONFIG_ATH79_MACH_GL_USB150 is not set
+#