[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231217130221.GZ6288@kernel.org>
Date: Sun, 17 Dec 2023 13:02:21 +0000
From: Simon Horman <horms@...nel.org>
To: Luo Jie <quic_luoj@...cinc.com>
Cc: andrew@...n.ch, 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, corbet@....net,
p.zabel@...gutronix.de, f.fainelli@...il.com,
netdev@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org
Subject: Re: [PATCH v8 13/14] net: phy: at803x: configure qca8084 work mode
On Fri, Dec 15, 2023 at 03:40:03PM +0800, Luo Jie wrote:
...
> @@ -1038,6 +1045,46 @@ static int qca8084_common_clock_init(struct phy_device *phydev)
> return clk_prepare_enable(priv->clk[MDIO_MASTER_AHB_CLK]);
> }
>
> +static int qca8084_parse_and_set_work_mode(struct phy_device *phydev)
> +{
> + struct device_node *node;
> + struct at803x_priv *priv;
> + u32 value, work_mode;
> + int ret;
> +
> + node = phydev->mdio.dev.of_node;
> + priv = phydev->priv;
Hi Luo Jie,
a minor nit from my side: priv is set but otherwise unused in this function.
> +
> + /* The property "qcom,phy-work-mode" is only defined in one
> + * PHY device tree node.
> + */
> + ret = of_property_read_u32(node, "qcom,phy-work-mode", &value);
> + if (ret)
> + return ret == -EINVAL ? 0 : ret;
> +
> + switch (value) {
> + case 0:
> + work_mode = QCA8084_WORK_MODE_QXGMII;
> + break;
> + case 1:
> + work_mode = QCA8084_WORK_MODE_QXGMII_PORT4_SGMII;
> + break;
> + case 2:
> + work_mode = QCA8084_WORK_MODE_SWITCH;
> + break;
> + case 3:
> + work_mode = QCA8084_WORK_MODE_SWITCH_PORT4_SGMII;
> + break;
> + default:
> + phydev_err(phydev, "invalid qcom,phy-work-mode %d\n", value);
> + return -EINVAL;
> + }
> +
> + return qca8084_mii_modify(phydev, QCA8084_WORK_MODE_CFG,
> + QCA8084_WORK_MODE_MASK,
> + FIELD_PREP(QCA8084_WORK_MODE_MASK, work_mode));
> +}
...
Powered by blists - more mailing lists