* [PATCH v2 net-next 0/2] Check all RGMII phy mode variants
@ 2017-05-18 22:13 Iyappan Subramanian
2017-05-18 22:13 ` [PATCH v2 net-next 1/2] include: linux: Add helper function to check phy interface mode Iyappan Subramanian
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Iyappan Subramanian @ 2017-05-18 22:13 UTC (permalink / raw)
To: davem, netdev
Cc: f.fainelli, andrew, linux-arm-kernel, patches,
Iyappan Subramanian
This patch set,
- adds phy_interface_mode_is_rgmii() helper function
- addresses review comment from previous patch set, by calling
phy_interface_mode_is_rgmii() to address all RGMII variants
Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
v2: Address review comments from v1
- adds phy_interface_mode_is_rgmii() helper function
- addresses review comment from previous patch set, by calling
phy_interface_mode_is_rgmii() to address all RGMII variants
v1:
- Initial version
---
Iyappan Subramanian (2):
include: linux: Add helper function to check phy interface mode
drivers: net: xgene: Check all RGMII phy mode variants
drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c | 6 +++---
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 12 ++++++------
drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 15 +++++++++------
include/linux/phy.h | 14 ++++++++++++--
4 files changed, 30 insertions(+), 17 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2 net-next 1/2] include: linux: Add helper function to check phy interface mode 2017-05-18 22:13 [PATCH v2 net-next 0/2] Check all RGMII phy mode variants Iyappan Subramanian @ 2017-05-18 22:13 ` Iyappan Subramanian 2017-05-18 22:19 ` Florian Fainelli 2017-05-18 22:13 ` [PATCH v2 net-next 2/2] drivers: net: xgene: Check all RGMII phy mode variants Iyappan Subramanian 2017-05-19 23:42 ` [PATCH v2 net-next 0/2] " David Miller 2 siblings, 1 reply; 6+ messages in thread From: Iyappan Subramanian @ 2017-05-18 22:13 UTC (permalink / raw) To: davem, netdev Cc: f.fainelli, andrew, linux-arm-kernel, patches, Iyappan Subramanian Added helper function that checks phy_mode is RGMII (all variants) 'bool phy_interface_mode_is_rgmii(phy_interface_t mode)' Changed the following function, to use the above. 'bool phy_interface_is_rgmii(struct phy_device *phydev)' Signed-off-by: Iyappan Subramanian <isubramanian@apm.com> Suggested-by: Florian Fainelli <f.fainelli@gmail.com> Suggested-by: Andrew Lunn <andrew@lunn.ch> --- include/linux/phy.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/include/linux/phy.h b/include/linux/phy.h index 54ef458..5a808a2 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -716,14 +716,24 @@ static inline bool phy_is_internal(struct phy_device *phydev) } /** + * phy_interface_mode_is_rgmii - Convenience function for testing if a + * PHY interface mode is RGMII (all variants) + * @mode: the phy_interface_t enum + */ +static inline bool phy_interface_mode_is_rgmii(phy_interface_t mode) +{ + return mode >= PHY_INTERFACE_MODE_RGMII && + mode <= PHY_INTERFACE_MODE_RGMII_TXID; +}; + +/** * phy_interface_is_rgmii - Convenience function for testing if a PHY interface * is RGMII (all variants) * @phydev: the phy_device struct */ static inline bool phy_interface_is_rgmii(struct phy_device *phydev) { - return phydev->interface >= PHY_INTERFACE_MODE_RGMII && - phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID; + return phy_interface_mode_is_rgmii(phydev->interface); }; /* -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 net-next 1/2] include: linux: Add helper function to check phy interface mode 2017-05-18 22:13 ` [PATCH v2 net-next 1/2] include: linux: Add helper function to check phy interface mode Iyappan Subramanian @ 2017-05-18 22:19 ` Florian Fainelli 2017-05-19 4:34 ` Iyappan Subramanian 0 siblings, 1 reply; 6+ messages in thread From: Florian Fainelli @ 2017-05-18 22:19 UTC (permalink / raw) To: Iyappan Subramanian, davem, netdev; +Cc: andrew, patches, linux-arm-kernel On 05/18/2017 03:13 PM, Iyappan Subramanian wrote: > Added helper function that checks phy_mode is RGMII (all variants) > 'bool phy_interface_mode_is_rgmii(phy_interface_t mode)' > > Changed the following function, to use the above. > 'bool phy_interface_is_rgmii(struct phy_device *phydev)' > > Signed-off-by: Iyappan Subramanian <isubramanian@apm.com> > Suggested-by: Florian Fainelli <f.fainelli@gmail.com> > Suggested-by: Andrew Lunn <andrew@lunn.ch> Not sure why you have chosen include: linux as the subject since all changes done to that file typically had the "phy: " prefix, but the code changes are fine, thanks! Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> > --- > include/linux/phy.h | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/include/linux/phy.h b/include/linux/phy.h > index 54ef458..5a808a2 100644 > --- a/include/linux/phy.h > +++ b/include/linux/phy.h > @@ -716,14 +716,24 @@ static inline bool phy_is_internal(struct phy_device *phydev) > } > > /** > + * phy_interface_mode_is_rgmii - Convenience function for testing if a > + * PHY interface mode is RGMII (all variants) > + * @mode: the phy_interface_t enum > + */ > +static inline bool phy_interface_mode_is_rgmii(phy_interface_t mode) > +{ > + return mode >= PHY_INTERFACE_MODE_RGMII && > + mode <= PHY_INTERFACE_MODE_RGMII_TXID; > +}; > + > +/** > * phy_interface_is_rgmii - Convenience function for testing if a PHY interface > * is RGMII (all variants) > * @phydev: the phy_device struct > */ > static inline bool phy_interface_is_rgmii(struct phy_device *phydev) > { > - return phydev->interface >= PHY_INTERFACE_MODE_RGMII && > - phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID; > + return phy_interface_mode_is_rgmii(phydev->interface); > }; > > /* > -- Florian ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 net-next 1/2] include: linux: Add helper function to check phy interface mode 2017-05-18 22:19 ` Florian Fainelli @ 2017-05-19 4:34 ` Iyappan Subramanian 0 siblings, 0 replies; 6+ messages in thread From: Iyappan Subramanian @ 2017-05-19 4:34 UTC (permalink / raw) To: Florian Fainelli Cc: David Miller, netdev, Andrew Lunn, linux-arm-kernel@lists.infradead.org, patches On Thu, May 18, 2017 at 3:19 PM, Florian Fainelli <f.fainelli@gmail.com> wrote: > On 05/18/2017 03:13 PM, Iyappan Subramanian wrote: >> Added helper function that checks phy_mode is RGMII (all variants) >> 'bool phy_interface_mode_is_rgmii(phy_interface_t mode)' >> >> Changed the following function, to use the above. >> 'bool phy_interface_is_rgmii(struct phy_device *phydev)' >> >> Signed-off-by: Iyappan Subramanian <isubramanian@apm.com> >> Suggested-by: Florian Fainelli <f.fainelli@gmail.com> >> Suggested-by: Andrew Lunn <andrew@lunn.ch> > > Not sure why you have chosen include: linux as the subject since all > changes done to that file typically had the "phy: " prefix, but the code > changes are fine, thanks! Thanks Florian. I'll keep that in mind for future header file patches. :-) For now, if David Miller requests for the subject line change, I'll re-post the patch. > > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> > >> --- >> include/linux/phy.h | 14 ++++++++++++-- >> 1 file changed, 12 insertions(+), 2 deletions(-) >> >> diff --git a/include/linux/phy.h b/include/linux/phy.h >> index 54ef458..5a808a2 100644 >> --- a/include/linux/phy.h >> +++ b/include/linux/phy.h >> @@ -716,14 +716,24 @@ static inline bool phy_is_internal(struct phy_device *phydev) >> } >> >> /** >> + * phy_interface_mode_is_rgmii - Convenience function for testing if a >> + * PHY interface mode is RGMII (all variants) >> + * @mode: the phy_interface_t enum >> + */ >> +static inline bool phy_interface_mode_is_rgmii(phy_interface_t mode) >> +{ >> + return mode >= PHY_INTERFACE_MODE_RGMII && >> + mode <= PHY_INTERFACE_MODE_RGMII_TXID; >> +}; >> + >> +/** >> * phy_interface_is_rgmii - Convenience function for testing if a PHY interface >> * is RGMII (all variants) >> * @phydev: the phy_device struct >> */ >> static inline bool phy_interface_is_rgmii(struct phy_device *phydev) >> { >> - return phydev->interface >= PHY_INTERFACE_MODE_RGMII && >> - phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID; >> + return phy_interface_mode_is_rgmii(phydev->interface); >> }; >> >> /* >> > > > -- > Florian ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 net-next 2/2] drivers: net: xgene: Check all RGMII phy mode variants 2017-05-18 22:13 [PATCH v2 net-next 0/2] Check all RGMII phy mode variants Iyappan Subramanian 2017-05-18 22:13 ` [PATCH v2 net-next 1/2] include: linux: Add helper function to check phy interface mode Iyappan Subramanian @ 2017-05-18 22:13 ` Iyappan Subramanian 2017-05-19 23:42 ` [PATCH v2 net-next 0/2] " David Miller 2 siblings, 0 replies; 6+ messages in thread From: Iyappan Subramanian @ 2017-05-18 22:13 UTC (permalink / raw) To: davem, netdev Cc: f.fainelli, andrew, linux-arm-kernel, patches, Iyappan Subramanian, Quan Nguyen This patch addresses the review comment from the previous patch set, by using phy_interface_mode_is_rgmii() helper function to address all RGMII phy mode variants. Signed-off-by: Iyappan Subramanian <isubramanian@apm.com> Signed-off-by: Quan Nguyen <qnguyen@apm.com> --- Review comment reference: http://www.spinics.net/lists/netdev/msg434649.html --- drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c | 6 +++--- drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 12 ++++++------ drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 15 +++++++++------ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c index 0fdec78..559963b 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c @@ -127,7 +127,7 @@ static int xgene_get_link_ksettings(struct net_device *ndev, struct phy_device *phydev = ndev->phydev; u32 supported; - if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) { + if (phy_interface_mode_is_rgmii(pdata->phy_mode)) { if (phydev == NULL) return -ENODEV; @@ -177,7 +177,7 @@ static int xgene_set_link_ksettings(struct net_device *ndev, struct xgene_enet_pdata *pdata = netdev_priv(ndev); struct phy_device *phydev = ndev->phydev; - if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) { + if (phy_interface_mode_is_rgmii(pdata->phy_mode)) { if (!phydev) return -ENODEV; @@ -304,7 +304,7 @@ static int xgene_set_pauseparam(struct net_device *ndev, struct phy_device *phydev = ndev->phydev; u32 oldadv, newadv; - if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII || + if (phy_interface_mode_is_rgmii(pdata->phy_mode) || pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) { if (!phydev) return -EINVAL; diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c index 6ac27c7..e45b587 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c @@ -272,7 +272,7 @@ void xgene_enet_wr_mac(struct xgene_enet_pdata *pdata, u32 wr_addr, u32 wr_data) u32 done; if (pdata->mdio_driver && ndev->phydev && - pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) { + phy_interface_mode_is_rgmii(pdata->phy_mode)) { struct mii_bus *bus = ndev->phydev->mdio.bus; return xgene_mdio_wr_mac(bus->priv, wr_addr, wr_data); @@ -326,12 +326,13 @@ static void xgene_enet_rd_mcx_csr(struct xgene_enet_pdata *pdata, u32 xgene_enet_rd_mac(struct xgene_enet_pdata *pdata, u32 rd_addr) { void __iomem *addr, *rd, *cmd, *cmd_done; + struct net_device *ndev = pdata->ndev; u32 done, rd_data; u8 wait = 10; - if (pdata->mdio_driver && pdata->ndev->phydev && - pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) { - struct mii_bus *bus = pdata->ndev->phydev->mdio.bus; + if (pdata->mdio_driver && ndev->phydev && + phy_interface_mode_is_rgmii(pdata->phy_mode)) { + struct mii_bus *bus = ndev->phydev->mdio.bus; return xgene_mdio_rd_mac(bus->priv, rd_addr); } @@ -349,8 +350,7 @@ u32 xgene_enet_rd_mac(struct xgene_enet_pdata *pdata, u32 rd_addr) udelay(1); if (!done) - netdev_err(pdata->ndev, "mac read failed, addr: %04x\n", - rd_addr); + netdev_err(ndev, "mac read failed, addr: %04x\n", rd_addr); rd_data = ioread32(rd); iowrite32(0, cmd); diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 21cd4ef..d3906f6 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -1634,7 +1634,7 @@ static int xgene_enet_get_irqs(struct xgene_enet_pdata *pdata) struct device *dev = &pdev->dev; int i, ret, max_irqs; - if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) + if (phy_interface_mode_is_rgmii(pdata->phy_mode)) max_irqs = 1; else if (pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) max_irqs = 2; @@ -1760,7 +1760,7 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) dev_err(dev, "Unable to get phy-connection-type\n"); return pdata->phy_mode; } - if (pdata->phy_mode != PHY_INTERFACE_MODE_RGMII && + if (!phy_interface_mode_is_rgmii(pdata->phy_mode) && pdata->phy_mode != PHY_INTERFACE_MODE_SGMII && pdata->phy_mode != PHY_INTERFACE_MODE_XGMII) { dev_err(dev, "Incorrect phy-connection-type specified\n"); @@ -1805,7 +1805,7 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) pdata->cle.base = base_addr + BLOCK_ETH_CLE_CSR_OFFSET; pdata->eth_ring_if_addr = base_addr + BLOCK_ETH_RING_IF_OFFSET; pdata->eth_diag_csr_addr = base_addr + BLOCK_ETH_DIAG_CSR_OFFSET; - if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII || + if (phy_interface_mode_is_rgmii(pdata->phy_mode) || pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) { pdata->mcx_mac_addr = pdata->base_addr + BLOCK_ETH_MAC_OFFSET; pdata->mcx_stats_addr = @@ -1904,6 +1904,9 @@ static void xgene_enet_setup_ops(struct xgene_enet_pdata *pdata) { switch (pdata->phy_mode) { case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: pdata->mac_ops = &xgene_gmac_ops; pdata->port_ops = &xgene_gport_ops; pdata->rm = RM3; @@ -2100,7 +2103,7 @@ static int xgene_enet_probe(struct platform_device *pdev) if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) { INIT_DELAYED_WORK(&pdata->link_work, link_state); } else if (!pdata->mdio_driver) { - if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) + if (phy_interface_mode_is_rgmii(pdata->phy_mode)) ret = xgene_enet_mdio_config(pdata); else INIT_DELAYED_WORK(&pdata->link_work, link_state); @@ -2131,7 +2134,7 @@ static int xgene_enet_probe(struct platform_device *pdev) if (pdata->mdio_driver) xgene_enet_phy_disconnect(pdata); - else if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) + else if (phy_interface_mode_is_rgmii(pdata->phy_mode)) xgene_enet_mdio_remove(pdata); err1: xgene_enet_delete_desc_rings(pdata); @@ -2155,7 +2158,7 @@ static int xgene_enet_remove(struct platform_device *pdev) if (pdata->mdio_driver) xgene_enet_phy_disconnect(pdata); - else if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) + else if (phy_interface_mode_is_rgmii(pdata->phy_mode)) xgene_enet_mdio_remove(pdata); unregister_netdev(ndev); -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 net-next 0/2] Check all RGMII phy mode variants 2017-05-18 22:13 [PATCH v2 net-next 0/2] Check all RGMII phy mode variants Iyappan Subramanian 2017-05-18 22:13 ` [PATCH v2 net-next 1/2] include: linux: Add helper function to check phy interface mode Iyappan Subramanian 2017-05-18 22:13 ` [PATCH v2 net-next 2/2] drivers: net: xgene: Check all RGMII phy mode variants Iyappan Subramanian @ 2017-05-19 23:42 ` David Miller 2 siblings, 0 replies; 6+ messages in thread From: David Miller @ 2017-05-19 23:42 UTC (permalink / raw) To: isubramanian; +Cc: netdev, f.fainelli, andrew, linux-arm-kernel, patches From: Iyappan Subramanian <isubramanian@apm.com> Date: Thu, 18 May 2017 15:13:42 -0700 > This patch set, > - adds phy_interface_mode_is_rgmii() helper function > - addresses review comment from previous patch set, by calling > phy_interface_mode_is_rgmii() to address all RGMII variants > > Signed-off-by: Iyappan Subramanian <isubramanian@apm.com> Series applied, thanks. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-05-19 23:42 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-05-18 22:13 [PATCH v2 net-next 0/2] Check all RGMII phy mode variants Iyappan Subramanian 2017-05-18 22:13 ` [PATCH v2 net-next 1/2] include: linux: Add helper function to check phy interface mode Iyappan Subramanian 2017-05-18 22:19 ` Florian Fainelli 2017-05-19 4:34 ` Iyappan Subramanian 2017-05-18 22:13 ` [PATCH v2 net-next 2/2] drivers: net: xgene: Check all RGMII phy mode variants Iyappan Subramanian 2017-05-19 23:42 ` [PATCH v2 net-next 0/2] " David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox