Re: [net-next PATCH 07/14] net: phy: at803x: move at8035 specific DT parse to dedicated probe

From: Andrew Lunn
Date: Thu Nov 30 2023 - 10:29:30 EST


> +static int at8035_parse_dt(struct phy_device *phydev)
> +{
> + struct device_node *node = phydev->mdio.dev.of_node;
> + struct at803x_priv *priv = phydev->priv;
> + u32 freq;
> + int ret;
> +
> + if (!IS_ENABLED(CONFIG_OF_MDIO))
> + return 0;
> +
> + ret = of_property_read_u32(node, "qca,clk-out-frequency", &freq);
> + if (!ret) {

I don't think you need this. priv->clk_25m_reg and priv->clk_25m_mask
will default to 0. If qca,clk-out-frequency does not exist, they will
still be zero....

> + /* Fixup for the AR8030/AR8035. This chip has another mask and
> + * doesn't support the DSP reference. Eg. the lowest bit of the
> + * mask. The upper two bits select the same frequencies. Mask
> + * the lowest bit here.
> + *
> + * Warning:
> + * There was no datasheet for the AR8030 available so this is
> + * just a guess. But the AR8035 is listed as pin compatible
> + * to the AR8030 so there might be a good chance it works on
> + * the AR8030 too.
> + */
> + priv->clk_25m_reg &= AT8035_CLK_OUT_MASK;
> + priv->clk_25m_mask &= AT8035_CLK_OUT_MASK;

... so applying a mask to 0 does nothing.

It does change the code a little, but you can add a justification in
the commit message.

Andrew