lkml.org 
[lkml]   [2024]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 3/3] net: phy: bcm-phy-lib: Implement BroadR-Reach link modes
On Mon, May 06, 2024 at 04:40:15PM +0200, Kamil Horák - 2N wrote:
> Implement single-pair BroadR-Reach modes on bcm5481x PHY by Broadcom.
> Create set of functions alternative to IEEE 802.3 to handle configuration
> of these modes on compatible Broadcom PHYs.
>
> Signed-off-by: Kamil Horák - 2N <kamilh@axis.com>
> ---
> drivers/net/phy/bcm-phy-lib.c | 122 ++++++++++++
> drivers/net/phy/bcm-phy-lib.h | 4 +
> drivers/net/phy/broadcom.c | 338 ++++++++++++++++++++++++++++++++--
> 3 files changed, 449 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c
> index 876f28fd8256..9fa2a20e641f 100644
> --- a/drivers/net/phy/bcm-phy-lib.c
> +++ b/drivers/net/phy/bcm-phy-lib.c
> @@ -794,6 +794,46 @@ static int _bcm_phy_cable_test_get_status(struct phy_device *phydev,
> return ret;
> }
>
> +static int bcm_setup_forced(struct phy_device *phydev)
> +{
> + u16 ctl = 0;
> +
> + phydev->pause = 0;
> + phydev->asym_pause = 0;
> +
> + if (phydev->speed == SPEED_100)
> + ctl |= LRECR_SPEED100;
> +
> + if (phydev->duplex != DUPLEX_FULL)
> + return -EOPNOTSUPP;

Is this even possible? I don't actually known, but you don't define a
HALF link mode, so how is this requested?

> +/**
> + * bcm_linkmode_adv_to_mii_adv_t
> + * @advertising: the linkmode advertisement settings
> + *
> + * A small helper function that translates linkmode advertisement
> + * settings to phy autonegotiation advertisements for the
> + * MII_BCM54XX_LREANAA register.
> + */
> +static inline u32 bcm_linkmode_adv_to_mii_adv_t(unsigned long *advertising)

No inline functions in .c files please, let the compiler decide.

> +int bcm_setup_master_slave(struct phy_device *phydev);
> +int bcm_config_aneg(struct phy_device *phydev, bool changed);
> +int bcm_config_advert(struct phy_device *phydev);

These are all BroadReach specific, so i would put something in there
name to indicate this. Otherwise somebody is going to try to use them
when not appropriate.

Andrew

\
 
 \ /
  Last update: 2024-05-27 18:17    [W:0.087 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site