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

From: Maxime Chevallier
Date: Wed Dec 13 2023 - 05:09:02 EST


On Wed, 13 Dec 2023 16:09:53 +0800
Jie Luo <quic_luoj@xxxxxxxxxxx> wrote:

> On 12/12/2023 8:54 PM, Maxime Chevallier wrote:
> > Hello,
> >
> > I have some more minor comments for yoi :)
> >
> > On Tue, 12 Dec 2023 19:51:48 +0800
> > Luo Jie <quic_luoj@xxxxxxxxxxx> 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@xxxxxxxxxxx>
> >> ---
> >
> > [...]
> >
> >> +/* 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
>
> Ok, will correct this, thanks.
>
> >
> > [...]
> >
> >> @@ -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
> >
> As Russell mentioned, since this resource is optional,
> so devm_platform_ioremap_resource_byname can't be used here.
>

Indeed, my bad I missed that point. Sorry for the noise :/

Thanks,

Maxime