mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@free-electrons.com>
To: Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@savoirfairelinux.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Jason Cooper <jason@lakedaemon.net>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Gregory CLEMENT <gregory.clement@free-electrons.com>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	linux-arm-kernel@lists.infradead.org,
	Nadav Haklai <nadavh@marvell.com>,
	Wilson Ding <dingwei@marvell.com>,
	Kostya Porotchkin <kostap@marvell.com>,
	Joe Zhou <shjzhou@marvell.com>,
	Jon Pannell <jpannell@marvell.com>
Subject: [PATCH v5 1/2] net: dsa: mv88e6xxx: Don't forbid MDIO I/Os for PHY addr >= num_of_ports
Date: Thu, 19 Jan 2017 22:49:33 +0100	[thread overview]
Message-ID: <20170119214934.27442-2-gregory.clement@free-electrons.com> (raw)
In-Reply-To: <20170119214934.27442-1-gregory.clement@free-electrons.com>

From: Romain Perier <romain.perier@free-electrons.com>

Some Marvell ethernet switches have internal ethernet transceivers with
hardcoded phy addresses. These addresses can be greater than the number
of ports or its value might be different than the associated port number.
This is for example the case for MV88E6341 that has 6 ports and internal
Port 1 to Port4 PHYs mapped at SMI addresses from 0x11 to 0x14.

This commits fixes the issue by removing the condition in MDIO callbacks.

Signed-off-by: Romain Perier <romain.perier@free-electrons.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 987b2dbbd35a..d1960ae0a618 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -2882,9 +2882,6 @@ static int mv88e6xxx_mdio_read(struct mii_bus *bus, int phy, int reg)
 	u16 val;
 	int err;
 
-	if (phy >= mv88e6xxx_num_ports(chip))
-		return 0xffff;
-
 	mutex_lock(&chip->reg_lock);
 	err = mv88e6xxx_phy_read(chip, phy, reg, &val);
 	mutex_unlock(&chip->reg_lock);
@@ -2897,9 +2894,6 @@ static int mv88e6xxx_mdio_write(struct mii_bus *bus, int phy, int reg, u16 val)
 	struct mv88e6xxx_chip *chip = bus->priv;
 	int err;
 
-	if (phy >= mv88e6xxx_num_ports(chip))
-		return 0xffff;
-
 	mutex_lock(&chip->reg_lock);
 	err = mv88e6xxx_phy_write(chip, phy, reg, val);
 	mutex_unlock(&chip->reg_lock);
-- 
2.11.0

  reply	other threads:[~2017-01-19 21:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-19 21:49 [PATCH v5 0/2] Add support for the ethernet switch on the ESPRESSObin Gregory CLEMENT
2017-01-19 21:49 ` Gregory CLEMENT [this message]
2017-01-19 22:13   ` [PATCH v5 1/2] net: dsa: mv88e6xxx: Don't forbid MDIO I/Os for PHY addr >= num_of_ports Vivien Didelot
2017-01-20  0:06     ` Andrew Lunn
2017-01-20  1:54       ` Vivien Didelot
2017-01-19 21:49 ` [PATCH v5 2/2] net: dsa: mv88e6xxx: Add support for ethernet switch 88E6341 Gregory CLEMENT
2017-01-19 22:26   ` Vivien Didelot
2017-01-20  0:12     ` Andrew Lunn
2017-01-20  1:55       ` Vivien Didelot
2017-01-20 17:21       ` Gregory CLEMENT
2017-01-20 17:30         ` Vivien Didelot
2017-01-20 23:15           ` Andrew Lunn
2017-01-19 22:06 ` [PATCH v5 0/2] Add support for the ethernet switch on the ESPRESSObin Andrew Lunn
2017-01-19 23:41   ` [EXT] " Jon Pannell
2017-01-20 17:08   ` Gregory CLEMENT
2017-01-20 17:43     ` Andrew Lunn
2017-01-20 22:38     ` Andrew Lunn
2017-01-19 22:07 ` Vivien Didelot
2017-01-19 22:33   ` Vivien Didelot
2017-01-20 19:17 ` David Miller
2017-01-24 16:47   ` Gregory CLEMENT
2017-01-24 18:08     ` Vivien Didelot
2017-01-24 19:57     ` 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=20170119214934.27442-2-gregory.clement@free-electrons.com \
    --to=gregory.clement@free-electrons.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dingwei@marvell.com \
    --cc=f.fainelli@gmail.com \
    --cc=jason@lakedaemon.net \
    --cc=jpannell@marvell.com \
    --cc=kostap@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nadavh@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=shjzhou@marvell.com \
    --cc=thomas.petazzoni@free-electrons.com \
    --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

all inboxes | Powered by JetHome®