* [PATCH net-next 0/2] net: phy: marvell: add RGMII-to-Copper mode configuration
@ 2026-11-09 12:44 Paul Louvel
2026-11-09 12:44 ` [PATCH net-next 1/2] net: phy: marvell: move mode configuration into standalone function Paul Louvel
2026-11-09 12:44 ` [PATCH net-next 2/2] net: phy: marvell: add RGMII-to-Copper mode configuration Paul Louvel
0 siblings, 2 replies; 4+ messages in thread
From: Paul Louvel @ 2026-11-09 12:44 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Chevallier
Cc: netdev, linux-kernel, Thomas Petazzoni, Miquel Raynal,
Herve Codina, Paul Louvel
Hi,
This series add the configuration of the RGMII-to-Copper MAC interface
for Marvell 88E1510/88E1518/88E1512/88E1514 PHYs.
Patch #1 is a preparation commit to factor out common code.
Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
---
Paul Louvel (2):
net: phy: marvell: move mode configuration into standalone function
net: phy: marvell: add RGMII-to-Copper mode configuration
drivers/net/phy/marvell.c | 69 ++++++++++++++++++++---------------------------
1 file changed, 29 insertions(+), 40 deletions(-)
---
base-commit: 7b6ab4dbc156e2f96419715130b3d5738a306c93
change-id: 20261109-marvell-phy-rgmii-60a8bf619582
Best regards,
--
Paul Louvel, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 1/2] net: phy: marvell: move mode configuration into standalone function
2026-11-09 12:44 [PATCH net-next 0/2] net: phy: marvell: add RGMII-to-Copper mode configuration Paul Louvel
@ 2026-11-09 12:44 ` Paul Louvel
2026-11-09 12:44 ` [PATCH net-next 2/2] net: phy: marvell: add RGMII-to-Copper mode configuration Paul Louvel
1 sibling, 0 replies; 4+ messages in thread
From: Paul Louvel @ 2026-11-09 12:44 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Chevallier
Cc: netdev, linux-kernel, Thomas Petazzoni, Miquel Raynal,
Herve Codina, Paul Louvel
Move the configuration of the m88e151x out of the
m88e1510_port_configure_serdes() function, so that other part of the
driver can use it.
Signed-off-by: Paul Louvel (Schneider Electric) <paul.louvel@bootlin.com>
---
drivers/net/phy/marvell.c | 38 ++++++++++++++++++++++----------------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 2c688d661297..aef5f8279133 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1332,6 +1332,27 @@ static int m88e1318_config_init(struct phy_device *phydev)
return marvell_config_init(phydev);
}
+static int m88e1510_config_mode(struct phy_device *phydev, u16 mode)
+{
+ int oldpage;
+ int ret = 0;
+
+ oldpage = phy_select_page(phydev, MII_MARVELL_MODE_PAGE);
+ if (oldpage < 0)
+ goto error;
+
+ ret = __phy_modify(phydev, MII_88E1510_GEN_CTRL_REG_1,
+ MII_88E1510_GEN_CTRL_REG_1_MODE_MASK, mode);
+ if (ret < 0)
+ goto error;
+
+ ret = __phy_set_bits(phydev, MII_88E1510_GEN_CTRL_REG_1,
+ MII_88E1510_GEN_CTRL_REG_1_RESET);
+
+error:
+ return phy_restore_page(phydev, oldpage, ret);
+}
+
static int m88e1510_config_init(struct phy_device *phydev)
{
static const struct {
@@ -3656,8 +3677,6 @@ static int m88e1510_port_configure_serdes(struct phy_port *port, bool enable,
{
struct phy_device *phydev = port_phydev(port);
struct device *dev;
- int oldpage;
- int ret = 0;
u16 mode;
dev = &phydev->mdio.dev;
@@ -3685,20 +3704,7 @@ static int m88e1510_port_configure_serdes(struct phy_port *port, bool enable,
mode = MII_88E1510_GEN_CTRL_REG_1_MODE_RGMII;
}
- oldpage = phy_select_page(phydev, MII_MARVELL_MODE_PAGE);
- if (oldpage < 0)
- goto error;
-
- ret = __phy_modify(phydev, MII_88E1510_GEN_CTRL_REG_1,
- MII_88E1510_GEN_CTRL_REG_1_MODE_MASK, mode);
- if (ret < 0)
- goto error;
-
- ret = __phy_set_bits(phydev, MII_88E1510_GEN_CTRL_REG_1,
- MII_88E1510_GEN_CTRL_REG_1_RESET);
-
-error:
- return phy_restore_page(phydev, oldpage, ret);
+ return m88e1510_config_mode(phydev, mode);
}
static const struct phy_port_ops m88e1510_serdes_port_ops = {
--
2.56.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] net: phy: marvell: add RGMII-to-Copper mode configuration
2026-11-09 12:44 [PATCH net-next 0/2] net: phy: marvell: add RGMII-to-Copper mode configuration Paul Louvel
2026-11-09 12:44 ` [PATCH net-next 1/2] net: phy: marvell: move mode configuration into standalone function Paul Louvel
@ 2026-11-09 12:44 ` Paul Louvel
2026-11-09 14:43 ` Marek Behún
1 sibling, 1 reply; 4+ messages in thread
From: Paul Louvel @ 2026-11-09 12:44 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Chevallier
Cc: netdev, linux-kernel, Thomas Petazzoni, Miquel Raynal,
Herve Codina, Paul Louvel
The driver currently programs it only for SGMII-to-Copper, based on the
PHY interface mode.
Some MAC connect to the PHY via RGMII. Add code to configure the device
in m88e1510_config_init().
Signed-off-by: Paul Louvel (Schneider Electric) <paul.louvel@bootlin.com>
---
drivers/net/phy/marvell.c | 31 +++++++------------------------
1 file changed, 7 insertions(+), 24 deletions(-)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index aef5f8279133..b8b466eb1c45 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1394,31 +1394,14 @@ static int m88e1510_config_init(struct phy_device *phydev)
if (err < 0)
return err;
- /* SGMII-to-Copper mode initialization */
- if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
- /* Select page 18 */
- err = marvell_set_page(phydev, 18);
- if (err < 0)
- return err;
-
- /* In reg 20, write MODE[2:0] = 0x1 (SGMII to Copper) */
- err = phy_modify(phydev, MII_88E1510_GEN_CTRL_REG_1,
- MII_88E1510_GEN_CTRL_REG_1_MODE_MASK,
- MII_88E1510_GEN_CTRL_REG_1_MODE_SGMII);
- if (err < 0)
- return err;
-
- /* PHY reset is necessary after changing MODE[2:0] */
- err = phy_set_bits(phydev, MII_88E1510_GEN_CTRL_REG_1,
- MII_88E1510_GEN_CTRL_REG_1_RESET);
- if (err < 0)
- return err;
+ /* RGMII/SGMII-to-Copper mode initialization */
+ if (phydev->interface == PHY_INTERFACE_MODE_SGMII)
+ err = m88e1510_config_mode(phydev, MII_88E1510_GEN_CTRL_REG_1_MODE_SGMII);
+ else if (phy_interface_is_rgmii(phydev))
+ err = m88e1510_config_mode(phydev, MII_88E1510_GEN_CTRL_REG_1_MODE_RGMII);
+ if (err < 0)
+ return err;
- /* Reset page selection */
- err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE);
- if (err < 0)
- return err;
- }
err = m88e1011_set_downshift(phydev, 3);
if (err < 0)
return err;
--
2.56.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 2/2] net: phy: marvell: add RGMII-to-Copper mode configuration
2026-11-09 12:44 ` [PATCH net-next 2/2] net: phy: marvell: add RGMII-to-Copper mode configuration Paul Louvel
@ 2026-11-09 14:43 ` Marek Behún
0 siblings, 0 replies; 4+ messages in thread
From: Marek Behún @ 2026-11-09 14:43 UTC (permalink / raw)
To: Paul Louvel
Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Chevallier,
netdev, linux-kernel, Thomas Petazzoni, Miquel Raynal,
Herve Codina
On Mon, Nov 09, 2026 at 01:44:56PM +0100, Paul Louvel wrote:
> The driver currently programs it only for SGMII-to-Copper, based on the
> PHY interface mode.
>
> Some MAC connect to the PHY via RGMII. Add code to configure the device
> in m88e1510_config_init().
>
> Signed-off-by: Paul Louvel (Schneider Electric) <paul.louvel@bootlin.com>
> ---
> drivers/net/phy/marvell.c | 31 +++++++------------------------
> 1 file changed, 7 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
> index aef5f8279133..b8b466eb1c45 100644
> --- a/drivers/net/phy/marvell.c
> +++ b/drivers/net/phy/marvell.c
> @@ -1394,31 +1394,14 @@ static int m88e1510_config_init(struct phy_device *phydev)
> if (err < 0)
> return err;
>
> - /* SGMII-to-Copper mode initialization */
> - if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
> - /* Select page 18 */
> - err = marvell_set_page(phydev, 18);
> - if (err < 0)
> - return err;
> -
> - /* In reg 20, write MODE[2:0] = 0x1 (SGMII to Copper) */
> - err = phy_modify(phydev, MII_88E1510_GEN_CTRL_REG_1,
> - MII_88E1510_GEN_CTRL_REG_1_MODE_MASK,
> - MII_88E1510_GEN_CTRL_REG_1_MODE_SGMII);
> - if (err < 0)
> - return err;
> -
> - /* PHY reset is necessary after changing MODE[2:0] */
> - err = phy_set_bits(phydev, MII_88E1510_GEN_CTRL_REG_1,
> - MII_88E1510_GEN_CTRL_REG_1_RESET);
> - if (err < 0)
> - return err;
> + /* RGMII/SGMII-to-Copper mode initialization */
> + if (phydev->interface == PHY_INTERFACE_MODE_SGMII)
> + err = m88e1510_config_mode(phydev, MII_88E1510_GEN_CTRL_REG_1_MODE_SGMII);
This first part belongs either to the first patch (deduplicates the mode setting code)
or to a separate patch.
Marek
> + else if (phy_interface_is_rgmii(phydev))
> + err = m88e1510_config_mode(phydev, MII_88E1510_GEN_CTRL_REG_1_MODE_RGMII);
> + if (err < 0)
> + return err;
>
> - /* Reset page selection */
> - err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE);
> - if (err < 0)
> - return err;
> - }
> err = m88e1011_set_downshift(phydev, 3);
> if (err < 0)
> return err;
>
> --
> 2.56.0
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-09 14:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 12:44 [PATCH net-next 0/2] net: phy: marvell: add RGMII-to-Copper mode configuration Paul Louvel
2026-11-09 12:44 ` [PATCH net-next 1/2] net: phy: marvell: move mode configuration into standalone function Paul Louvel
2026-11-09 12:44 ` [PATCH net-next 2/2] net: phy: marvell: add RGMII-to-Copper mode configuration Paul Louvel
2026-11-09 14:43 ` Marek Behún
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®