[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <93ba0b97-45aa-e59d-1454-80c4f245acc0@starfivetech.com>
Date: Wed, 31 May 2023 14:19:16 +0800
From: William Qiu <william.qiu@...rfivetech.com>
To: Mark Brown <broonie@...nel.org>
CC: <devicetree@...r.kernel.org>, <linux-spi@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-riscv@...ts.infradead.org>,
"Rob Herring" <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
"Emil Renner Berthing" <kernel@...il.dk>,
Ziv Xu <ziv.xu@...rfivetech.com>
Subject: Re: [PATCH v1 2/3] spi: cadence-quadspi: Add clock configuration for
StarFive JH7110 QSPI
On 2023/5/30 18:33, Mark Brown wrote:
> On Tue, May 30, 2023 at 10:05:38AM +0800, William Qiu wrote:
>> On 2023/5/29 14:44, William Qiu wrote:
>> > On 2023/5/26 23:36, Mark Brown wrote:
>
>> >> Nothing ever disables or unprepares this clock as far as I can tell?
>> >> Perhaps also consider using the clk_bulk_ APIs.
>
>> > I will add in next version.
>
>> Now I want to replace the original devm_clk_get API in the
>> driver with devm_clk_bulk_get_all API, which can achieve compatibility,
>> but it seems that it is not good for other ip with only one clock, so I
>> want to ask about that can I replace it? Or define that inside jh7110?
>
> You could always specify a different array of clocks depending on which
> compatible the driver sees, just like you'd conditionally request clocks
> individually.
Hi Mark,
If specify a different array of clocks depending on which compatible
the driver sees, since there will also be clock operations in the suspend
and resume interfaces, this can make the code look complicated.
My thoughts are as follows:
Modify the following code
1658 /* Obtain QSPI clock. */
1659 cqspi->clk = devm_clk_get(dev, NULL);
1660 if (IS_ERR(cqspi->clk)) {
1661 dev_err(dev, "Cannot claim QSPI clock.\n");
1662 ret = PTR_ERR(cqspi->clk);
1663 return ret;
1664 }
as following:
/* Obtain QSPI clock. */
cqspi->num_clks = devm_clk_bulk_get_all(dev, &cqspi->clks);
if (cqspi->num_clks < 0) {
dev_err(dev, "Cannot claim QSPI clock: %u\n", cqspi->num_clks);
return -EINVAL;
}
This way, the code will look simpler and clearer. How do you think
about it.
Best Regards,
William
Powered by blists - more mailing lists