[U-Boot] [PATCH v2 3/5] net: phy: Marvell 88E151x: Add support for RGMII
Phil Edworthy
phil.edworthy at renesas.com
Fri Dec 9 14:38:23 CET 2016
This has been tested with a Marvell 88E1512 PHY.
Signed-off-by: Phil Edworthy <phil.edworthy at renesas.com>
Reviewed-by: Stefan Roese <sr at denx.de>
---
v2:
Rebased on top of Joe's code to use macros
---
drivers/net/phy/marvell.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 5adfe7d..646b00d 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -94,6 +94,7 @@
#define MIIM_88E151x_INT_EN_OFFS 7
/* Page 18 registers */
#define MIIM_88E151x_GENERAL_CTRL 20
+#define MIIM_88E151x_MODE_RGMII 0
#define MIIM_88E151x_MODE_SGMII 1
#define MIIM_88E151x_RESET_OFFS 15
@@ -315,14 +316,22 @@ static int m88e1518_config(struct phy_device *phydev)
phy_write(phydev, MDIO_DEVAD_NONE, 16, 0x2159);
phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 0x0000);
- /* SGMII-to-Copper mode initialization */
- if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
+ /* SGMII/RGMII-to-Copper mode initialization */
+ if ((phydev->interface == PHY_INTERFACE_MODE_SGMII) ||
+ phy_interface_is_rgmii(phydev)) {
+ u16 mode;
+
+ if (phydev->interface == PHY_INTERFACE_MODE_SGMII)
+ mode = MIIM_88E151x_MODE_SGMII;
+ else
+ mode = MIIM_88E151x_MODE_RGMII;
+
/* Select page 18 */
phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 18);
- /* In reg 20, write MODE[2:0] = 0x1 (SGMII to Copper) */
+ /* In reg 20, write MODE[2:0], SGMII or RGMII to Copper */
m88e1518_phy_writebits(phydev, MIIM_88E151x_GENERAL_CTRL,
- 0, 3, MIIM_88E151x_MODE_SGMII);
+ 0, 3, mode);
/* PHY reset is necessary after changing MODE[2:0] */
m88e1518_phy_writebits(phydev, MIIM_88E151x_GENERAL_CTRL,
--
2.7.4
More information about the U-Boot
mailing list