[Linux-stm32] [net-next v1 v1 4/5] net: stmmac: starfive: Add JHB100 SGMII interface

Andrew Lunn andrew at lunn.ch
Wed Apr 8 15:36:44 UTC 2026


> +	dwmac->sgmii_rx = devm_clk_get_optional(&pdev->dev, "rx");
> +	if (IS_ERR(dwmac->sgmii_rx))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(dwmac->sgmii_rx),
> +				     "error getting sgmii rx clock\n");
> +

The SGMII clock is optional...

>  	/* Generally, the rgmii_tx clock is provided by the internal clock,
>  	 * which needs to match the corresponding clock frequency according
>  	 * to different speeds. If the rgmii_tx clock is provided by the
>  	 * external rgmii_rxin, there is no need to configure the clock
>  	 * internally, because rgmii_rxin will be adaptively adjusted.
>  	 */
> -	if (!device_property_read_bool(&pdev->dev, "starfive,tx-use-rgmii-clk"))
> -		plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate;
> +	if (!device_property_read_bool(&pdev->dev, "starfive,tx-use-rgmii-clk")) {
> +		if (plat_dat->phy_interface == PHY_INTERFACE_MODE_SGMII)
> +			plat_dat->set_clk_tx_rate = stmmac_starfive_sgmii_set_clk_rate;

So you probably want to return an error here if it is missing.

Or you might want to look at the compatible, and make the clock
mandatory for this device.

   Andrew



More information about the Linux-stm32 mailing list