Re: [PATCH v2 6/6] net: phy: DP83640: Add fiber mode enabling/disabling from device tree

Russell King (Oracle)
2024-02-27T11:01:33Z

On Tue, Feb 27, 2024 at 10:39:45AM +0100, Bastien Curutchet wrote:
> @@ -1141,6 +1147,17 @@ static int dp83640_config_init(struct phy_device *phydev)
> val = phy_read(phydev, PCFCR) & ~PCF_EN;
> phy_write(phydev, PCFCR, val);
>
> + if (dp83640->fiber != FIBER_MODE_DEFAULT) {
> + val = phy_read(phydev, PCSR) & ~FX_EN;
> + if (dp83640->fiber == FIBER_MODE_ENABLE)
> + val |= FX_EN;
> + phy_write(phydev, PCSR, val);

val = 0;
if (dp83640->fiber == FIBER_MODE_ENABLE)
val = FX_EN;

phy_modify(phydev, PCSR, FX_EN, val);

> +
> + /* Write SOFT_RESET bit to ensure configuration */
> + val = phy_read(phydev, PHYCR2) | SOFT_RESET;
> + phy_write(phydev, PHYCR2, val);

phy_set_bits(phydev, PHYCR2, SOFT_RESET);

...
> +#else
> +static int dp83640_of_init(struct phy_device *phydev)
> +{
> + dp83640->fiber = FIBER_MODE_DEFAULT;

This hasn't been build tested - dp83640 won't exist here.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!