[PATCH v3] net: zynq: Add support for PHY configuration in SGMII mode

Sean Anderson sean.anderson at seco.com
Tue Dec 28 18:00:53 CET 2021



On 12/15/21 5:00 AM, Michal Simek wrote:
> SGMII configuration depends on proper GT setting that's why when node has
> phys property call PSGTR driver to configure it properly.
> 
> Signed-off-by: Michal Simek <michal.simek at xilinx.com>
> ---
> 
> Changes in v3:
> - Separate phy init from phy power on (IP reset has to be between)
> 
> Changes in v2:
> - Handle also cases where phy reference doesn't exist which means
>    that u-boot doesn't need to configure it (configured via psu_init for
>    example)
> - Error out where reference exists but driver is not compiled in - reported
>    by Sean
> 
>   drivers/net/zynq_gem.c | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> index 5cbe8d28304b..b751d28e611f 100644
> --- a/drivers/net/zynq_gem.c
> +++ b/drivers/net/zynq_gem.c
> @@ -12,6 +12,7 @@
>   #include <common.h>
>   #include <cpu_func.h>
>   #include <dm.h>
> +#include <generic-phy.h>
>   #include <log.h>
>   #include <net.h>
>   #include <netdev.h>
> @@ -715,6 +716,19 @@ static int zynq_gem_probe(struct udevice *dev)
>   	void *bd_space;
>   	struct zynq_gem_priv *priv = dev_get_priv(dev);
>   	int ret;
> +	struct phy phy;
> +
> +	if (priv->interface == PHY_INTERFACE_MODE_SGMII) {
> +		ret = generic_phy_get_by_index(dev, 0, &phy);
> +		if (!ret) {
> +			ret = generic_phy_init(&phy);
> +			if (ret)
> +				return ret;
> +		} else if (ret != -ENOENT) {
> +			debug("could not get phy (err %d)\n", ret);
> +			return ret;
> +		}
> +	}
>   
>   	ret = zynq_gem_reset_init(dev);
>   	if (ret)
> @@ -771,6 +785,12 @@ static int zynq_gem_probe(struct udevice *dev)
>   	if (ret)
>   		goto err3;
>   
> +	if (priv->interface == PHY_INTERFACE_MODE_SGMII && phy.dev) {
> +		ret = generic_phy_power_on(&phy);
> +		if (ret)
> +			return ret;
> +	}
> +
>   	return ret;
>   
>   err3:
> 

Reviewed-by: Sean Anderson <seanga2 at gmail.com>


More information about the U-Boot mailing list