[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231206103826.4e396513@device.home>
Date: Wed, 6 Dec 2023 10:38:26 +0100
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: Daniel Golle <daniel@...rotopia.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Chunfeng Yun <chunfeng.yun@...iatek.com>,
Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Felix Fietkau <nbd@....name>, John Crispin <john@...ozen.org>,
Sean Wang <sean.wang@...iatek.com>,
Mark Lee <Mark-MC.Lee@...iatek.com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
Alexander Couzens <lynxis@...0.eu>,
Qingfang Deng <dqfext@...il.com>,
SkyLake Huang <SkyLake.Huang@...iatek.com>,
Philipp Zabel <p.zabel@...gutronix.de>, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-phy@...ts.infradead.org
Subject: Re: [RFC PATCH v2 3/8] net: pcs: pcs-mtk-lynxi: add platform driver
for MT7988
Hello Daniel,
My two cents below :
On Wed, 6 Dec 2023 01:44:17 +0000
Daniel Golle <daniel@...rotopia.org> wrote:
> Introduce a proper platform MFD driver for the LynxI (H)SGMII PCS which
> is going to initially be used for the MT7988 SoC.
>
> Signed-off-by: Daniel Golle <daniel@...rotopia.org>
[ ... ]
> +static int mtk_pcs_lynxi_enable(struct phylink_pcs *pcs)
> +{
> + struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
> +
> + if (mpcs->sgmii_tx && mpcs->sgmii_rx) {
> + clk_prepare_enable(mpcs->sgmii_rx);
> + clk_prepare_enable(mpcs->sgmii_tx);
You can use the clk_bulk_prepare_enable() here
> + }
> +
> + return 0;
> +}
> +
> static void mtk_pcs_lynxi_disable(struct phylink_pcs *pcs)
> {
> struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
>
> + regmap_set_bits(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, SGMII_PHYA_PWD);
> +
> + if (mpcs->sgmii_tx && mpcs->sgmii_rx) {
> + clk_disable_unprepare(mpcs->sgmii_tx);
> + clk_disable_unprepare(mpcs->sgmii_rx);
and clk_bulk_disable_unprepare() here
[...]
> +static int mtk_pcs_lynxi_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct device_node *np = dev->of_node;
> + struct mtk_pcs_lynxi *mpcs;
> + struct phylink_pcs *pcs;
> + struct regmap *regmap;
> + u32 flags = 0;
> +
> + mpcs = devm_kzalloc(dev, sizeof(*mpcs), GFP_KERNEL);
> + if (!mpcs)
> + return -ENOMEM;
> +
> + regmap = syscon_node_to_regmap(np->parent);
> + if (IS_ERR(regmap))
> + return PTR_ERR(regmap);
> +
> + if (of_property_read_bool(np->parent, "mediatek,pnswap"))
> + flags |= MTK_SGMII_FLAG_PN_SWAP;
> +
> + mpcs->rstc = of_reset_control_get_shared(np->parent, NULL);
> + if (IS_ERR(mpcs->rstc))
> + return PTR_ERR(mpcs->rstc);
> +
> + reset_control_deassert(mpcs->rstc);
> + mpcs->sgmii_sel = devm_clk_get_enabled(dev, "sgmii_sel");
> + if (IS_ERR(mpcs->sgmii_sel))
> + return PTR_ERR(mpcs->sgmii_sel);
> +
> + mpcs->sgmii_rx = devm_clk_get(dev, "sgmii_rx");
> + if (IS_ERR(mpcs->sgmii_rx))
> + return PTR_ERR(mpcs->sgmii_rx);
> +
> + mpcs->sgmii_tx = devm_clk_get(dev, "sgmii_tx");
> + if (IS_ERR(mpcs->sgmii_tx))
> + return PTR_ERR(mpcs->sgmii_tx);
and clk bulk operations here as well ?
Maxime
Powered by blists - more mailing lists