[PATCH] net: phy: mdio: add clock support for PHYs

Andrew Lunn andrew at lunn.ch
Mon Jul 4 01:05:31 PDT 2022


> +static int mdiobus_register_clock(struct mdio_device *mdiodev)
> +{
> +	struct clk *clk;
> +
> +	clk = devm_clk_get_optional(&mdiodev->dev, NULL);
> +	if (IS_ERR(clk))
> +		return PTR_ERR(clk);

How does this interact with the clock code of the micrel and smsc
drivers?

Please document this clock in the binding, ethernet-phy.yaml.

> diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c
> index 250742ffdfd9..e8424a46a81e 100644
> --- a/drivers/net/phy/mdio_device.c
> +++ b/drivers/net/phy/mdio_device.c
> @@ -6,6 +6,7 @@
>  
>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>  
> +#include <linux/clk.h>
>  #include <linux/delay.h>
>  #include <linux/errno.h>
>  #include <linux/gpio.h>
> @@ -136,6 +137,14 @@ void mdio_device_reset(struct mdio_device *mdiodev, int value)
>  }
>  EXPORT_SYMBOL(mdio_device_reset);
>  
> +static void mdio_device_toggle_clock(struct mdio_device *mdiodev, int value)

Not sure this is the best name, you are not toggling the clock, you
are toggling the clock gate. And you are not really toggling it, since
you pass value.

    Andrew



More information about the linux-arm-kernel mailing list