Re: [PATCH v2 3/5] net: mdio: ipq4019: configure CMN PLL clock for ipq5332

Maxime Chevallier
2023-12-12T12:54:21Z

Hello,

I have some more minor comments for yoi :)

On Tue, 12 Dec 2023 19:51:48 +0800
Luo Jie <quic_luoj@quicinc.com> wrote:

> The reference clock of CMN PLL block is selectable, the internal
> 48MHZ is used by default.
>
> The output clock of CMN PLL block is for providing the clock
> source of ethernet device(such as qca8084), there are 1 * 25MHZ
> and 3 * 50MHZ output clocks available for the ethernet devices.
>
> Signed-off-by: Luo Jie <quic_luoj@quicinc.com>
> ---

[...]

> +/* For the CMN PLL block, the reference clock can be configured according to
> + * the device tree property "cmn-reference-clock", the internal 48MHZ is used
> + * by default on the ipq533 platform.
> + *
> + * The output clock of CMN PLL block is provided to the ethernet devices,
> + * threre are 4 CMN PLL output clocks (1*25MHZ + 3*50MHZ) enabled by default.
> + *
> + * Such as the output 50M clock for the qca8084 ethernet PHY.
> + */
> +static int ipq_cmn_clock_config(struct mii_bus *bus)
> +{
> + int ret;
> + u32 reg_val, src_sel, ref_clk;
> + struct ipq4019_mdio_data *priv;

Here you should also use reverse christmas-tree notation

[...]

> @@ -317,6 +441,17 @@ static int ipq4019_mdio_probe(struct platform_device *pdev)
> }
> }
>
> + /* The CMN block resource is for providing clock source to ethernet,
> + * which can be optionally configured on the platform ipq9574 and
> + * ipq5332.
> + */
> + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cmn_blk");
> + if (res) {
> + priv->cmn_membase = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(priv->cmn_membase))
> + return PTR_ERR(priv->cmn_membase);
> + }
> +

And here you can simplify a bit by using
devm_platform_ioremap_resource_byname()

Thanks,

Maxime