From: "Michal Vokáč" <vokac.m@gmail.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
f.fainelli@gmail.com, vivien.didelot@savoirfairelinux.com,
andrew@lunn.ch, mark.rutland@arm.com, robh+dt@kernel.org,
davem@davemloft.net, michal.vokac@ysoft.com
Subject: [PATCH net-next v3 4/7] net: dsa: qca8k: Force CPU port to its highest bandwidth
Date: Wed, 23 May 2018 08:20:21 +0200 [thread overview]
Message-ID: <1527056424-14528-5-git-send-email-michal.vokac@ysoft.com> (raw)
In-Reply-To: <1527056424-14528-1-git-send-email-michal.vokac@ysoft.com>
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áč <michal.vokac@ysoft.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v3:
- none
Changes in v2:
- Add "Fixes" tag as pointed out by Florian.
- Add "Reviewed-by" tags from Andrew and Florian.
drivers/net/dsa/qca8k.c | 6 +++++-
drivers/net/dsa/qca8k.h | 6 ++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 0d224f3..14a108b38 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -537,6 +537,7 @@ qca8k_setup(struct dsa_switch *ds)
{
struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
int ret, i, phy_mode = -1;
+ u32 mask;
pr_debug("qca: setup\n");
@@ -564,7 +565,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);
diff --git a/drivers/net/dsa/qca8k.h b/drivers/net/dsa/qca8k.h
index 1cf8a92..5bda165 100644
--- 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)
--
2.7.4
next prev parent reply other threads:[~2018-05-23 6:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 6:20 [PATCH net-next v3 0/7] Add support for QCA8334 switch Michal Vokáč
2018-05-23 6:20 ` [PATCH net-next v3 1/7] net: dsa: qca8k: Add QCA8334 binding documentation Michal Vokáč
2018-05-23 15:37 ` Florian Fainelli
2018-05-23 6:20 ` [PATCH net-next v3 2/7] net: dsa: qca8k: Add support for QCA8334 switch Michal Vokáč
2018-05-23 15:38 ` Florian Fainelli
2018-05-23 6:20 ` [PATCH net-next v3 3/7] net: dsa: qca8k: Enable RXMAC when bringing up a port Michal Vokáč
2018-05-23 6:20 ` Michal Vokáč [this message]
2018-05-23 6:20 ` [PATCH net-next v3 5/7] net: dsa: qca8k: Allow overwriting CPU port setting Michal Vokáč
2018-05-23 6:20 ` [PATCH net-next v3 6/7] net: dsa: qca8k: Replace GPL boilerplate by SPDX Michal Vokáč
2018-05-23 6:20 ` [PATCH net-next v3 7/7] net: dsa: qca8k: Remove redundant parentheses Michal Vokáč
2018-05-23 15:39 ` [PATCH net-next v3 0/7] Add support for QCA8334 switch Florian Fainelli
2018-05-24 9:34 ` Michal Vokáč
2018-05-24 13:17 ` Andrew Lunn
2018-05-23 19:47 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1527056424-14528-5-git-send-email-michal.vokac@ysoft.com \
--to=vokac.m@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=michal.vokac@ysoft.com \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=vivien.didelot@savoirfairelinux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).