[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SEZPR06MB6959CF6875201BFFDC6EF4DD964C2@SEZPR06MB6959.apcprd06.prod.outlook.com>
Date: Fri, 16 Feb 2024 21:58:21 +0800
From: Yang Xiwen <forbidden405@...look.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Yisen Zhuang <yisen.zhuang@...wei.com>,
Salil Mehta <salil.mehta@...wei.com>, "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>, Yang Xiwen <forbidden405@...mail.com>,
Heiner Kallweit <hkallweit1@...il.com>, Russell King
<linux@...linux.org.uk>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH 1/6] net: hisilicon: add support for hisi_femac core on
Hi3798MV200
On 2/16/2024 9:49 PM, Andrew Lunn wrote:
> On Fri, Feb 16, 2024 at 07:59:19AM +0800, Yang Xiwen wrote:
>> On 2/16/2024 7:57 AM, Andrew Lunn wrote:
>>>> + for (i = 0; i < CLK_NUM; i++) {
>>>> + priv->clks[i] = devm_clk_get_enabled(&pdev->dev, clk_strs[i]);
>>>> + if (IS_ERR(priv->clks[i])) {
>>>> + dev_err(dev, "failed to get enabled clk %s: %ld\n", clk_strs[i],
>>>> + PTR_ERR(priv->clks[i]));
>>>> + ret = -ENODEV;
>>>> + goto out_free_netdev;
>>>> + }
>>> The clk API has devm_clk_bulk_ versions. Please take a look at them, and see
>>> if it will simplify the code.
>> I know this API, but it can't be used. We need to control clocks
>> individually in reset procedure.
> /**
> * struct clk_bulk_data - Data used for bulk clk operations.
> *
> * @id: clock consumer ID
> * @clk: struct clk * to store the associated clock
> *
> * The CLK APIs provide a series of clk_bulk_() API calls as
> * a convenience to consumers which require multiple clks. This
> * structure is used to manage data for these calls.
> */
> struct clk_bulk_data {
> const char *id;
> struct clk *clk;
> };
>
> You pass the bulk API calls an array of this structure. After the get
> has completed, you can access the individual clocks via the clk
> pointer. So you can use the bulk API on probe and remove when you need
> to operate on all three, and the single clk API for your reset handler
> etc.
seems okay. I'll implement this in next version.
>
> Andrew
--
Regards,
Yang Xiwen
Powered by blists - more mailing lists