* [PATCH v3 net-next] net: phy: Add MAC-IF driver for Microsemi PHYs.
@ 2016-09-19 10:03 Raju Lakkaraju
2016-09-19 15:46 ` Andrew Lunn
2016-09-20 8:41 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Raju Lakkaraju @ 2016-09-19 10:03 UTC (permalink / raw)
To: netdev; +Cc: f.fainelli, Allan.Nielsen, andrew, Raju Lakkaraju
From: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
All the review comments updated and resending for review.
This is MAC interface feature.
Microsemi PHY can support RGMII, RMII or GMII/MII interface between MAC and PHY.
MAC-IF function program the right value based on Device tree configuration.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
---
drivers/net/phy/mscc.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
index c09cc4a..d350deb 100644
--- a/drivers/net/phy/mscc.c
+++ b/drivers/net/phy/mscc.c
@@ -23,6 +23,16 @@ enum rgmii_rx_clock_delay {
RGMII_RX_CLK_DELAY_3_4_NS = 7
};
+/* Microsemi VSC85xx PHY registers */
+/* IEEE 802. Std Registers */
+#define MSCC_PHY_EXT_PHY_CNTL_1 23
+#define MAC_IF_SELECTION_MASK 0x1800
+#define MAC_IF_SELECTION_GMII 0
+#define MAC_IF_SELECTION_RMII 1
+#define MAC_IF_SELECTION_RGMII 2
+#define MAC_IF_SELECTION_POS 11
+#define FAR_END_LOOPBACK_MODE_MASK 0x0008
+
#define MII_VSC85XX_INT_MASK 25
#define MII_VSC85XX_INT_MASK_MASK 0xa000
#define MII_VSC85XX_INT_STATUS 26
@@ -48,6 +58,42 @@ static int vsc85xx_phy_page_set(struct phy_device *phydev, u8 page)
return rc;
}
+static int vsc85xx_mac_if_set(struct phy_device *phydev,
+ phy_interface_t interface)
+{
+ int rc;
+ u16 reg_val;
+
+ mutex_lock(&phydev->lock);
+ reg_val = phy_read(phydev, MSCC_PHY_EXT_PHY_CNTL_1);
+ reg_val &= ~(MAC_IF_SELECTION_MASK);
+ switch (interface) {
+ case PHY_INTERFACE_MODE_RGMII:
+ reg_val |= (MAC_IF_SELECTION_RGMII << MAC_IF_SELECTION_POS);
+ break;
+ case PHY_INTERFACE_MODE_RMII:
+ reg_val |= (MAC_IF_SELECTION_RMII << MAC_IF_SELECTION_POS);
+ break;
+ case PHY_INTERFACE_MODE_MII:
+ case PHY_INTERFACE_MODE_GMII:
+ reg_val |= (MAC_IF_SELECTION_GMII << MAC_IF_SELECTION_POS);
+ break;
+ default:
+ rc = -EINVAL;
+ goto out_unlock;
+ }
+ rc = phy_write(phydev, MSCC_PHY_EXT_PHY_CNTL_1, reg_val);
+ if (rc != 0)
+ goto out_unlock;
+
+ rc = genphy_soft_reset(phydev);
+
+out_unlock:
+ mutex_unlock(&phydev->lock);
+
+ return rc;
+}
+
static int vsc85xx_default_config(struct phy_device *phydev)
{
int rc;
@@ -77,6 +123,11 @@ static int vsc85xx_config_init(struct phy_device *phydev)
rc = vsc85xx_default_config(phydev);
if (rc)
return rc;
+
+ rc = vsc85xx_mac_if_set(phydev, phydev->interface);
+ if (rc)
+ return rc;
+
rc = genphy_config_init(phydev);
return rc;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3 net-next] net: phy: Add MAC-IF driver for Microsemi PHYs.
2016-09-19 10:03 [PATCH v3 net-next] net: phy: Add MAC-IF driver for Microsemi PHYs Raju Lakkaraju
@ 2016-09-19 15:46 ` Andrew Lunn
2016-09-20 8:41 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2016-09-19 15:46 UTC (permalink / raw)
To: Raju Lakkaraju; +Cc: netdev, f.fainelli, Allan.Nielsen
On Mon, Sep 19, 2016 at 03:33:54PM +0530, Raju Lakkaraju wrote:
> From: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
>
> All the review comments updated and resending for review.
Hi Raju
Please put comments like the above below the --- line. They then don't
get placed into the commit log in git.
Also, please include a brief summary of what changed for each version
of a patch. That makes it easier for the reviewer. Again, this should
be below the ---.
>
> This is MAC interface feature.
> Microsemi PHY can support RGMII, RMII or GMII/MII interface between MAC and PHY.
> MAC-IF function program the right value based on Device tree configuration.
>
> Tested on Beaglebone Black with VSC 8531 PHY.
>
> Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3 net-next] net: phy: Add MAC-IF driver for Microsemi PHYs.
2016-09-19 10:03 [PATCH v3 net-next] net: phy: Add MAC-IF driver for Microsemi PHYs Raju Lakkaraju
2016-09-19 15:46 ` Andrew Lunn
@ 2016-09-20 8:41 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-09-20 8:41 UTC (permalink / raw)
To: Raju.Lakkaraju; +Cc: netdev, f.fainelli, Allan.Nielsen, andrew
From: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Date: Mon, 19 Sep 2016 15:33:54 +0530
> From: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
>
> All the review comments updated and resending for review.
>
> This is MAC interface feature.
> Microsemi PHY can support RGMII, RMII or GMII/MII interface between MAC and PHY.
> MAC-IF function program the right value based on Device tree configuration.
>
> Tested on Beaglebone Black with VSC 8531 PHY.
>
> Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-20 8:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-19 10:03 [PATCH v3 net-next] net: phy: Add MAC-IF driver for Microsemi PHYs Raju Lakkaraju
2016-09-19 15:46 ` Andrew Lunn
2016-09-20 8:41 ` David Miller
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).