From: Greg Kroah-Hartman Date: Mon, 30 Jul 2018 12:28:03 +0000 (+0200) Subject: 4.17-stable patches X-Git-Tag: v4.17.12~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca31b507dbb2f88c0e602bbbe521df75e52b833f;p=thirdparty%2Fkernel%2Fstable-queue.git 4.17-stable patches added patches: net-dsa-qca8k-add-qca8334-binding-documentation.patch net-dsa-qca8k-allow-overwriting-cpu-port-setting.patch net-dsa-qca8k-enable-rxmac-when-bringing-up-a-port.patch net-dsa-qca8k-force-cpu-port-to-its-highest-bandwidth.patch --- diff --git a/queue-4.17/net-dsa-qca8k-add-qca8334-binding-documentation.patch b/queue-4.17/net-dsa-qca8k-add-qca8334-binding-documentation.patch new file mode 100644 index 00000000000..dacb6edb75c --- /dev/null +++ b/queue-4.17/net-dsa-qca8k-add-qca8334-binding-documentation.patch @@ -0,0 +1,74 @@ +From 218bbea11a777c156eb7bcbdc72867b32ae10985 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michal=20Vok=C3=A1=C4=8D?= +Date: Wed, 23 May 2018 08:20:18 +0200 +Subject: net: dsa: qca8k: Add QCA8334 binding documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Michal Vokáč + +commit 218bbea11a777c156eb7bcbdc72867b32ae10985 upstream. + +Add support for the four-port variant of the Qualcomm QCA833x switch. + +The CPU port default link settings can be reconfigured using +a fixed-link sub-node. + +Signed-off-by: Michal Vokáč +Reviewed-by: Rob Herring +Reviewed-by: Andrew Lunn +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/devicetree/bindings/net/dsa/qca8k.txt | 23 +++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) + +--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt ++++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt +@@ -2,7 +2,10 @@ + + Required properties: + +-- compatible: should be "qca,qca8337" ++- compatible: should be one of: ++ "qca,qca8334" ++ "qca,qca8337" ++ + - #size-cells: must be 0 + - #address-cells: must be 1 + +@@ -14,6 +17,20 @@ port and PHY id, each subnode describing + referencing the internal PHY connected to it. The CPU port of this switch is + always port 0. + ++A CPU port node has the following optional node: ++ ++- fixed-link : Fixed-link subnode describing a link to a non-MDIO ++ managed entity. See ++ Documentation/devicetree/bindings/net/fixed-link.txt ++ for details. ++ ++For QCA8K the 'fixed-link' sub-node supports only the following properties: ++ ++- 'speed' (integer, mandatory), to indicate the link speed. Accepted ++ values are 10, 100 and 1000 ++- 'full-duplex' (boolean, optional), to indicate that full duplex is ++ used. When absent, half duplex is assumed. ++ + Example: + + +@@ -53,6 +70,10 @@ Example: + label = "cpu"; + ethernet = <&gmac1>; + phy-mode = "rgmii"; ++ fixed-link { ++ speed = 1000; ++ full-duplex; ++ }; + }; + + port@1 { diff --git a/queue-4.17/net-dsa-qca8k-allow-overwriting-cpu-port-setting.patch b/queue-4.17/net-dsa-qca8k-allow-overwriting-cpu-port-setting.patch new file mode 100644 index 00000000000..594cc1386b4 --- /dev/null +++ b/queue-4.17/net-dsa-qca8k-allow-overwriting-cpu-port-setting.patch @@ -0,0 +1,102 @@ +From 9bb2289f90e671bdb78e306974187424ac19ff8e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michal=20Vok=C3=A1=C4=8D?= +Date: Wed, 23 May 2018 08:20:22 +0200 +Subject: net: dsa: qca8k: Allow overwriting CPU port setting +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Michal Vokáč + +commit 9bb2289f90e671bdb78e306974187424ac19ff8e upstream. + +Implement adjust_link function that allows to overwrite default CPU port +setting using fixed-link device tree subnode. + +Signed-off-by: Michal Vokáč +Reviewed-by: Andrew Lunn +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/dsa/qca8k.c | 43 +++++++++++++++++++++++++++++++++++++++++++ + drivers/net/dsa/qca8k.h | 1 + + 2 files changed, 44 insertions(+) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -587,6 +587,47 @@ qca8k_setup(struct dsa_switch *ds) + return 0; + } + ++static void ++qca8k_adjust_link(struct dsa_switch *ds, int port, struct phy_device *phy) ++{ ++ struct qca8k_priv *priv = ds->priv; ++ u32 reg; ++ ++ /* Force fixed-link setting for CPU port, skip others. */ ++ if (!phy_is_pseudo_fixed_link(phy)) ++ return; ++ ++ /* Set port speed */ ++ switch (phy->speed) { ++ case 10: ++ reg = QCA8K_PORT_STATUS_SPEED_10; ++ break; ++ case 100: ++ reg = QCA8K_PORT_STATUS_SPEED_100; ++ break; ++ case 1000: ++ reg = QCA8K_PORT_STATUS_SPEED_1000; ++ break; ++ default: ++ dev_dbg(priv->dev, "port%d link speed %dMbps not supported.\n", ++ port, phy->speed); ++ return; ++ } ++ ++ /* Set duplex mode */ ++ if (phy->duplex == DUPLEX_FULL) ++ reg |= QCA8K_PORT_STATUS_DUPLEX; ++ ++ /* Force flow control */ ++ if (dsa_is_cpu_port(ds, port)) ++ reg |= QCA8K_PORT_STATUS_RXFLOW | QCA8K_PORT_STATUS_TXFLOW; ++ ++ /* Force link down before changing MAC options */ ++ qca8k_port_set_status(priv, port, 0); ++ qca8k_write(priv, QCA8K_REG_PORT_STATUS(port), reg); ++ qca8k_port_set_status(priv, port, 1); ++} ++ + static int + qca8k_phy_read(struct dsa_switch *ds, int phy, int regnum) + { +@@ -835,6 +876,7 @@ qca8k_get_tag_protocol(struct dsa_switch + static const struct dsa_switch_ops qca8k_switch_ops = { + .get_tag_protocol = qca8k_get_tag_protocol, + .setup = qca8k_setup, ++ .adjust_link = qca8k_adjust_link, + .get_strings = qca8k_get_strings, + .phy_read = qca8k_phy_read, + .phy_write = qca8k_phy_write, +@@ -866,6 +908,7 @@ qca8k_sw_probe(struct mdio_device *mdiod + return -ENOMEM; + + priv->bus = mdiodev->bus; ++ priv->dev = &mdiodev->dev; + + /* read the switches ID register */ + id = qca8k_read(priv, QCA8K_REG_MASK_CTRL); +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -167,6 +167,7 @@ struct qca8k_priv { + struct ar8xxx_port_status port_sts[QCA8K_NUM_PORTS]; + struct dsa_switch *ds; + struct mutex reg_mutex; ++ struct device *dev; + }; + + struct qca8k_mib_desc { diff --git a/queue-4.17/net-dsa-qca8k-enable-rxmac-when-bringing-up-a-port.patch b/queue-4.17/net-dsa-qca8k-enable-rxmac-when-bringing-up-a-port.patch new file mode 100644 index 00000000000..b17998afa7c --- /dev/null +++ b/queue-4.17/net-dsa-qca8k-enable-rxmac-when-bringing-up-a-port.patch @@ -0,0 +1,37 @@ +From eee1fe64765c562d8bcaf95e5631a8ea2f760f34 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michal=20Vok=C3=A1=C4=8D?= +Date: Wed, 23 May 2018 08:20:20 +0200 +Subject: net: dsa: qca8k: Enable RXMAC when bringing up a port +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Michal Vokáč + +commit eee1fe64765c562d8bcaf95e5631a8ea2f760f34 upstream. + +When a port is brought up/down do not enable/disable only the TXMAC +but the RXMAC as well. This is essential for the CPU port to work. + +Fixes: 6b93fb46480a ("net-next: dsa: add new driver for qca8xxx family") +Signed-off-by: Michal Vokáč +Reviewed-by: Andrew Lunn +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/dsa/qca8k.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -473,7 +473,7 @@ qca8k_set_pad_ctrl(struct qca8k_priv *pr + static void + qca8k_port_set_status(struct qca8k_priv *priv, int port, int enable) + { +- u32 mask = QCA8K_PORT_STATUS_TXMAC; ++ u32 mask = QCA8K_PORT_STATUS_TXMAC | QCA8K_PORT_STATUS_RXMAC; + + /* Port 0 and 6 have no internal PHY */ + if ((port > 0) && (port < 6)) diff --git a/queue-4.17/net-dsa-qca8k-force-cpu-port-to-its-highest-bandwidth.patch b/queue-4.17/net-dsa-qca8k-force-cpu-port-to-its-highest-bandwidth.patch new file mode 100644 index 00000000000..d2f0b1ff763 --- /dev/null +++ b/queue-4.17/net-dsa-qca8k-force-cpu-port-to-its-highest-bandwidth.patch @@ -0,0 +1,70 @@ +From 79a4ed4f0f93fc65e48a0fc5247ffa5645f7b0cc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michal=20Vok=C3=A1=C4=8D?= +Date: Wed, 23 May 2018 08:20:21 +0200 +Subject: net: dsa: qca8k: Force CPU port to its highest bandwidth +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Michal Vokáč + +commit 79a4ed4f0f93fc65e48a0fc5247ffa5645f7b0cc upstream. + +By default autonegotiation is enabled to configure MAC on all ports. +For the CPU port autonegotiation can not be used so we need to set +some sensible defaults manually. + +This patch forces the default setting of the CPU port to 1000Mbps/full +duplex which is the chip maximum capability. + +Also correct size of the bit field used to configure link speed. + +Fixes: 6b93fb46480a ("net-next: dsa: add new driver for qca8xxx family") +Signed-off-by: Michal Vokáč +Reviewed-by: Andrew Lunn +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/dsa/qca8k.c | 6 +++++- + drivers/net/dsa/qca8k.h | 6 ++++-- + 2 files changed, 9 insertions(+), 3 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -490,6 +490,7 @@ qca8k_setup(struct dsa_switch *ds) + { + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; + int ret, i, phy_mode = -1; ++ u32 mask; + + /* Make sure that port 0 is the cpu port */ + if (!dsa_is_cpu_port(ds, 0)) { +@@ -515,7 +516,10 @@ qca8k_setup(struct dsa_switch *ds) + if (ret < 0) + return ret; + +- /* Enable CPU Port */ ++ /* Enable CPU Port, force it to maximum bandwidth and full-duplex */ ++ mask = QCA8K_PORT_STATUS_SPEED_1000 | QCA8K_PORT_STATUS_TXFLOW | ++ QCA8K_PORT_STATUS_RXFLOW | QCA8K_PORT_STATUS_DUPLEX; ++ qca8k_write(priv, QCA8K_REG_PORT_STATUS(QCA8K_CPU_PORT), mask); + qca8k_reg_set(priv, QCA8K_REG_GLOBAL_FW_CTRL0, + QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN); + qca8k_port_set_status(priv, QCA8K_CPU_PORT, 1); +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -51,8 +51,10 @@ + #define QCA8K_GOL_MAC_ADDR0 0x60 + #define QCA8K_GOL_MAC_ADDR1 0x64 + #define QCA8K_REG_PORT_STATUS(_i) (0x07c + (_i) * 4) +-#define QCA8K_PORT_STATUS_SPEED GENMASK(2, 0) +-#define QCA8K_PORT_STATUS_SPEED_S 0 ++#define QCA8K_PORT_STATUS_SPEED GENMASK(1, 0) ++#define QCA8K_PORT_STATUS_SPEED_10 0 ++#define QCA8K_PORT_STATUS_SPEED_100 0x1 ++#define QCA8K_PORT_STATUS_SPEED_1000 0x2 + #define QCA8K_PORT_STATUS_TXMAC BIT(2) + #define QCA8K_PORT_STATUS_RXMAC BIT(3) + #define QCA8K_PORT_STATUS_TXFLOW BIT(4) diff --git a/queue-4.17/series b/queue-4.17/series index e463000d0d4..7d2c73685a4 100644 --- a/queue-4.17/series +++ b/queue-4.17/series @@ -307,3 +307,7 @@ ext4-fix-check-to-prevent-initializing-reserved-inodes.patch gpio-of-handle-fixed-regulator-flags-properly.patch gpio-uniphier-set-legitimate-irq-trigger-type-in-.to_irq-hook.patch rdma-uverbs-protect-from-attempts-to-create-flows-on-unsupported-qp.patch +net-dsa-qca8k-force-cpu-port-to-its-highest-bandwidth.patch +net-dsa-qca8k-enable-rxmac-when-bringing-up-a-port.patch +net-dsa-qca8k-add-qca8334-binding-documentation.patch +net-dsa-qca8k-allow-overwriting-cpu-port-setting.patch