[U-Boot] [PATCH v2 3/5] net: phy: Marvell 88E151x: Add support for RGMII
Joe Hershberger
joe.hershberger at gmail.com
Fri Dec 9 19:59:22 CET 2016
Hi Phil,
On Fri, Dec 9, 2016 at 7:38 AM, Phil Edworthy <phil.edworthy at renesas.com> wrote:
> 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
I'm not sure why this is needed. The HW reset value for the mode is
0x7 (RGMII auto detect mode). Would it not be sufficient to simply not
change it if the mode is RGMII?
> #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
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
More information about the U-Boot
mailing list