From: Marcel Reichmuth <Marcel.Reichmuth@netmodule.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "andrew@lunn.ch" <andrew@lunn.ch>,
"vivien.didelot@gmail.com" <vivien.didelot@gmail.com>,
"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
"davem@davemloft.net" <davem@davemloft.net>,
Marcel Reichmuth <Marcel.Reichmuth@netmodule.com>
Subject: [PATCH] net: dsa: add missing phy address offset
Date: Wed, 20 Feb 2019 18:15:04 +0000 [thread overview]
Message-ID: <20190220181426.2970-1-marcel.reichmuth@netmodule.com> (raw)
When phys do not start at address 0 like on the mv88e6341 the wrong
phy address is used and therefore the slave ports can not be
initialized. This patch adds the proper offset to the phy address.
Signed-off-by: Marcel Reichmuth <marcel.reichmuth@netmodule.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 3 +++
include/net/dsa.h | 1 +
net/dsa/slave.c | 3 ++-
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 12fd7ce3f1ff..0ca649f784d2 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -2198,12 +2198,15 @@ static int mv88e6xxx_setup_upstream_port(struct mv88e6xxx_chip *chip, int port)
static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
{
struct dsa_switch *ds = chip->ds;
+ struct dsa_port *dp = &ds->ports[port];
int err;
u16 reg;
chip->ports[port].chip = chip;
chip->ports[port].port = port;
+ dp->phy_base_addr = chip->info->phy_base_addr;
+
/* MAC Forcing register: don't force link, speed, duplex or flow control
* state to any particular values on physical ports, but force the CPU
* port and all DSA ports to their maximum bandwidth and full duplex.
diff --git a/include/net/dsa.h b/include/net/dsa.h
index b3eefe8e18fd..f9c9dc1f6d21 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -196,6 +196,7 @@ struct dsa_port {
struct dsa_switch *ds;
unsigned int index;
+ unsigned int phy_base_addr;
const char *name;
const struct dsa_port *cpu_dp;
struct device_node *dn;
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index a1c9fe155057..4f67dff34a3b 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1221,7 +1221,8 @@ static int dsa_slave_phy_setup(struct net_device *slave_dev)
/* We could not connect to a designated PHY or SFP, so use the
* switch internal MDIO bus instead
*/
- ret = dsa_slave_phy_connect(slave_dev, dp->index);
+ ret = dsa_slave_phy_connect(slave_dev, dp->phy_base_addr +
+ dp->index);
if (ret) {
netdev_err(slave_dev,
"failed to connect to port %d: %d\n",
--
2.11.0
next reply other threads:[~2019-02-20 18:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 18:15 Marcel Reichmuth [this message]
2019-02-20 19:27 ` Florian Fainelli
2019-02-20 19:31 ` Andrew Lunn
2019-02-21 7:53 ` Marcel Reichmuth
2019-02-21 13:10 ` Andrew Lunn
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=20190220181426.2970-1-marcel.reichmuth@netmodule.com \
--to=marcel.reichmuth@netmodule.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.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
Powered by JetHome