[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b5ac9e36-235c-906c-9f95-80dabd971be5@kernel.org>
Date: Sat, 20 Nov 2021 18:38:13 +0100
From: Sylwester Nawrocki <snawrocki@...nel.org>
To: Sam Protsenko <semen.protsenko@...aro.org>
Cc: Sumit Semwal <sumit.semwal@...aro.org>, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-samsung-soc@...r.kernel.org,
Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
Paweł Chmiel <pawel.mikolaj.chmiel@...il.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Tomasz Figa <tomasz.figa@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Stephen Boyd <sboyd@...nel.org>,
Michael Turquette <mturquette@...libre.com>,
Sylwester Nawrocki <s.nawrocki@...sung.com>
Subject: Re: [PATCH v2 1/1] clk: samsung: exynos850: Register clocks early
On 20.11.2021 17:47, Sam Protsenko wrote:
>>> @@ -920,8 +929,12 @@ static int __init exynos850_cmu_probe(struct platform_device *pdev)
>>> struct device_node *np = dev->of_node;
>>>
>>> info = of_device_get_match_data(dev);
>>> - exynos850_init_clocks(np, info->clk_regs, info->nr_clk_regs);
>>> - samsung_cmu_register_one(np, info);
>>> +
>>> + /* Early clocks are already registered using CLK_OF_DECLARE_DRIVER() */
>>> + if (info != &peri_cmu_info) {
>>> + exynos850_init_clocks(np, info->clk_regs, info->nr_clk_regs);
>>> + samsung_cmu_register_one(np, info);
>>> + }
>> Don't you also need to register early CMU_TOP, which provides clocks
>> for CMU_PERI? I'm afraid it might not work properly when you register
>> CMU_PERI clocks early and only later in probe() you enable parent clock
>> required for the already registered clocks to be usable.
> Good point, I'll do that in v2. Not sure how I missed that dependency
> point, but thank you for noticing that. Guess it only works for me
> because clocks are already enabled in bootloader, and I'm using
> "clk_ignore_unused" param for now.
>
>> How about registering also CMU_TOP early and enabling parent clock
>> also in OF_CLK_DECLARE init callback, i.e. using either OF_CLK_DECLARE
>> or platform driver for a CMU?
>>
> If you mean doing clk_prepare_enable() for "dout_peri_bus" clock in
> exynos850_cmu_peri_init(), I don't think it's possible. clk_get()
> needs "struct device *dev", and we only have that in platform driver
> probe. Trying to pass dev=NULL won't work, so that's why I'm enabling
> parent clocks in platform driver probe.
Sorry, I didn't notice it earlier, actually CMU_TOP is already being
initialized with OF_CLK_DECLARE.
You could use of_clk_get() to get the clock, the consumer clock indexes
are fixed and defined in the DT binding. There is also
of_clk_get_by_name() which works similarly to clk_get().
Powered by blists - more mailing lists