From: Grygorii Strashko <grygorii.strashko@ti.com>
To: "David S. Miller" <davem@davemloft.net>,
Kishon Vijay Abraham I <kishon@ti.com>,
Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: <netdev@vger.kernel.org>, Sekhar Nori <nsekhar@ti.com>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
Tony Lindgren <tony@atomide.com>,
<linux-amlogic@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Antoine Tenart <antoine.tenart@free-electrons.com>,
Quentin Schulz <quentin.schulz@bootlin.com>,
Vivek Gautam <vivek.gautam@codeaurora.org>,
Maxime Ripard <maxime.ripard@bootlin.com>,
Chen-Yu Tsai <wens@csie.org>, Carlo Caione <carlo@caione.org>,
Chunfeng Yun <chunfeng.yun@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Manu Gautam <mgautam@codeaurora.org>,
Grygorii Strashko <grygorii.strashko@ti.com>
Subject: [PATCH v2 3/5] phy: ocelot-serdes: convert to use eth phy mode and submode
Date: Fri, 9 Nov 2018 17:47:53 -0600 [thread overview]
Message-ID: <20181109234755.21687-4-grygorii.strashko@ti.com> (raw)
In-Reply-To: <20181109234755.21687-1-grygorii.strashko@ti.com>
Convert ocelot-serdes PHY driver to use recently introduced
PHY_MODE_ETHERNET and phy_set_mode_ext().
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
drivers/net/ethernet/mscc/ocelot.c | 9 ++-------
drivers/phy/mscc/phy-ocelot-serdes.c | 14 ++++++++++----
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index 3238b9e..3edb608 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -472,7 +472,6 @@ static int ocelot_port_open(struct net_device *dev)
{
struct ocelot_port *port = netdev_priv(dev);
struct ocelot *ocelot = port->ocelot;
- enum phy_mode phy_mode;
int err;
/* Enable receiving frames on the port, and activate auto-learning of
@@ -484,12 +483,8 @@ static int ocelot_port_open(struct net_device *dev)
ANA_PORT_PORT_CFG, port->chip_port);
if (port->serdes) {
- if (port->phy_mode == PHY_INTERFACE_MODE_SGMII)
- phy_mode = PHY_MODE_SGMII;
- else
- phy_mode = PHY_MODE_QSGMII;
-
- err = phy_set_mode(port->serdes, phy_mode);
+ err = phy_set_mode_ext(port->serdes, PHY_MODE_ETHERNET,
+ port->phy_mode);
if (err) {
netdev_err(dev, "Could not set mode of SerDes\n");
return err;
diff --git a/drivers/phy/mscc/phy-ocelot-serdes.c b/drivers/phy/mscc/phy-ocelot-serdes.c
index c61a9890..f525a21 100644
--- a/drivers/phy/mscc/phy-ocelot-serdes.c
+++ b/drivers/phy/mscc/phy-ocelot-serdes.c
@@ -11,6 +11,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
+#include <linux/phy.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
@@ -116,8 +117,10 @@ struct serdes_mux {
.mux = _mux, \
}
-#define SERDES_MUX_SGMII(i, p, m, c) SERDES_MUX(i, p, PHY_MODE_SGMII, m, c)
-#define SERDES_MUX_QSGMII(i, p, m, c) SERDES_MUX(i, p, PHY_MODE_QSGMII, m, c)
+#define SERDES_MUX_SGMII(i, p, m, c) \
+ SERDES_MUX(i, p, PHY_INTERFACE_MODE_SGMII, m, c)
+#define SERDES_MUX_QSGMII(i, p, m, c) \
+ SERDES_MUX(i, p, PHY_INTERFACE_MODE_QSGMII, m, c)
static const struct serdes_mux ocelot_serdes_muxes[] = {
SERDES_MUX_SGMII(SERDES1G(0), 0, 0, 0),
@@ -164,12 +167,15 @@ static int serdes_set_mode(struct phy *phy, enum phy_mode mode, int submode)
unsigned int i;
int ret;
+ if (mode != PHY_MODE_ETHERNET)
+ return -EINVAL;
+
for (i = 0; i < ARRAY_SIZE(ocelot_serdes_muxes); i++) {
if (macro->idx != ocelot_serdes_muxes[i].idx ||
- mode != ocelot_serdes_muxes[i].mode)
+ submode != ocelot_serdes_muxes[i].mode)
continue;
- if (mode != PHY_MODE_QSGMII &&
+ if (submode != PHY_INTERFACE_MODE_QSGMII &&
macro->port != ocelot_serdes_muxes[i].port)
continue;
--
2.10.5
next prev parent reply other threads:[~2018-11-09 23:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-09 23:47 [PATCH v2 0/5] phy: core: rework phy_set_mode to accept phy mode and submode Grygorii Strashko
2018-11-09 23:47 ` [PATCH v2 1/5] " Grygorii Strashko
2018-11-09 23:47 ` [PATCH v2 2/5] phy: core: add PHY_MODE_ETHERNET Grygorii Strashko
2018-11-09 23:47 ` Grygorii Strashko [this message]
2018-11-12 10:42 ` [PATCH v2 3/5] phy: ocelot-serdes: convert to use eth phy mode and submode Kishon Vijay Abraham I
2018-11-16 11:15 ` Quentin Schulz
2018-11-16 21:00 ` Grygorii Strashko
2018-11-09 23:47 ` [PATCH v2 4/5] phy: mvebu-cp110-comphy: " Grygorii Strashko
2018-11-12 10:48 ` Kishon Vijay Abraham I
2018-11-19 8:26 ` Maxime Chevallier
2018-11-19 16:48 ` Antoine Tenart
2018-11-19 17:07 ` Russell King - ARM Linux
2018-11-19 22:42 ` Grygorii Strashko
2018-11-09 23:47 ` [PATCH v2 5/5] phy: core: clean up unused ethernet specific phy modes Grygorii Strashko
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=20181109234755.21687-4-grygorii.strashko@ti.com \
--to=grygorii.strashko@ti.com \
--cc=alexandre.belloni@bootlin.com \
--cc=antoine.tenart@free-electrons.com \
--cc=carlo@caione.org \
--cc=chunfeng.yun@mediatek.com \
--cc=davem@davemloft.net \
--cc=kishon@ti.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=matthias.bgg@gmail.com \
--cc=maxime.ripard@bootlin.com \
--cc=mgautam@codeaurora.org \
--cc=netdev@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=quentin.schulz@bootlin.com \
--cc=tony@atomide.com \
--cc=vivek.gautam@codeaurora.org \
--cc=wens@csie.org \
/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).