Hi Andrew, On 2025-03-06 23:37, Andrew Lunn wrote: > On Thu, Mar 06, 2025 at 09:09:46PM +0000, Jonas Karlman wrote: >> All Rockchip GMAC variants require writing to GRF to configure e.g. >> interface mode and MAC rx/tx delay. The GRF syscon regmap is located >> with help of a rockchip,grf and rockchip,php-grf phandle. > >> @@ -1813,8 +1564,24 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, >> >> bsp_priv->grf = syscon_regmap_lookup_by_phandle(dev->of_node, >> "rockchip,grf"); >> - bsp_priv->php_grf = syscon_regmap_lookup_by_phandle(dev->of_node, >> - "rockchip,php-grf"); >> + if (IS_ERR(bsp_priv->grf)) { >> + ret = PTR_ERR(bsp_priv->grf); >> + dev_err_probe(dev, ret, "failed to lookup rockchip,grf\n"); >> + return ERR_PTR(ret); >> + } >> + >> + bsp_priv->php_grf = >> + syscon_regmap_lookup_by_phandle_optional(dev->of_node, >> + "rockchip,php-grf"); >> + if ((of_device_is_compatible(dev->of_node, "rockchip,rk3588-gmac") || >> + of_device_is_compatible(dev->of_node, "rockchip,rk3576-gmac")) && >> + !bsp_priv->php_grf) >> + bsp_priv->php_grf = ERR_PTR(-ENODEV); > > It seems odd you say all variants need this property, and then you > look for two specific variants here and do something different? Why > are these two special? rockchip,grf is required for all GMACs, rockchip,php-grf is also needed on rk3576 and rk3588 (+rk3562 that has been posted on ML) :-S Above use of of_device_is_compatible() was my attempt at requiring the syscon regmap for those variants that make use of php_grf. And still not break rk3562 depending on the order these would land. Should probably clarify a little bit with a code comment in a v2. Regards, Jonas > > Andrew