[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e1fecfd7-3de1-4719-879b-fd486fdc3815@lunn.ch>
Date: Wed, 15 Nov 2023 16:19:05 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Luo Jie <quic_luoj@...cinc.com>
Cc: agross@...nel.org, andersson@...nel.org, konrad.dybcio@...aro.org,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
hkallweit1@...il.com, linux@...linux.org.uk,
robert.marko@...tura.hr, linux-arm-msm@...r.kernel.org,
netdev@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, quic_srichara@...cinc.com
Subject: Re: [PATCH 4/9] net: mdio: ipq4019: configure CMN PLL clock for
ipq5332
> +static void ipq_cmn_clock_config(struct mii_bus *bus)
> +{
> + u32 reg_val;
> + const char *cmn_ref_clk;
> + struct ipq4019_mdio_data *priv = bus->priv;
Reverse christmass tree place.
> +
> + if (priv && priv->cmn_membase) {
Can priv be NULL? Can cmn_membase be NULL?
> + reg_val = readl(priv->cmn_membase + CMN_PLL_REFERENCE_CLOCK);
> + reg_val &= ~(CMN_PLL_REFCLK_EXTERNAL | CMN_PLL_REFCLK_INDEX);
> +
> + /* Select reference clock source */
> + cmn_ref_clk = of_get_property(bus->parent->of_node, "cmn_ref_clk", NULL);
> + if (!cmn_ref_clk) {
> + /* Internal 48MHZ selected by default */
> + reg_val |= FIELD_PREP(CMN_PLL_REFCLK_INDEX, 7);
> + } else {
> + if (!strcmp(cmn_ref_clk, "external_25MHz"))
Not strings, please use u32 values. You can then list the valid values
in the yaml file, and get te tools to verify the DT.
> + reg_val |= (CMN_PLL_REFCLK_EXTERNAL |
> + FIELD_PREP(CMN_PLL_REFCLK_INDEX, 3));
> + else if (!strcmp(cmn_ref_clk, "external_31250KHz"))
> + reg_val |= (CMN_PLL_REFCLK_EXTERNAL |
> + FIELD_PREP(CMN_PLL_REFCLK_INDEX, 4));
> + else if (!strcmp(cmn_ref_clk, "external_40MHz"))
> + reg_val |= (CMN_PLL_REFCLK_EXTERNAL |
> + FIELD_PREP(CMN_PLL_REFCLK_INDEX, 6));
> + else if (!strcmp(cmn_ref_clk, "external_48MHz"))
> + reg_val |= (CMN_PLL_REFCLK_EXTERNAL |
> + FIELD_PREP(CMN_PLL_REFCLK_INDEX, 7));
> + else if (!strcmp(cmn_ref_clk, "external_50MHz"))
> + reg_val |= (CMN_PLL_REFCLK_EXTERNAL |
> + FIELD_PREP(CMN_PLL_REFCLK_INDEX, 8));
> + else
> + reg_val |= FIELD_PREP(CMN_PLL_REFCLK_INDEX, 7);
If the value is not valid, return -EINVAL.
Andrew
Powered by blists - more mailing lists