From: sebastian.hesselbarth@gmail.com (Sebastian Hesselbarth)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] cpufreq: Add a cpufreq driver for Marvell Dove
Date: Mon, 21 Oct 2013 17:38:58 +0100 [thread overview]
Message-ID: <526558A2.5050900@gmail.com> (raw)
In-Reply-To: <20131021154239.GB23593@lunn.ch>
On 10/21/2013 04:42 PM, Andrew Lunn wrote:
>>> + if (freqs.old != freqs.new) {
>>> + local_irq_disable();
>>> +
>>> + /* Mask IRQ and FIQ to CPU */
>>> + cr = readl(priv.pmu_cr);
>>> + cr |= MASK_IRQ | MASK_FIQ;
>>> + writel(cr, priv.pmu_cr);
>>> +
>>> + /* Set/Clear the CPU_SLOW_EN bit */
>>> + reg = readl_relaxed(priv.dfs + DFS_CR);
>>> + reg &= ~L2_RATIO_MASK;
>>> +
>>> + switch (state) {
>>> + case STATE_CPU_FREQ:
>>> + reg |= priv.xpratio;
>>> + reg &= ~CPU_SLOW_EN;
>>> + break;
>>> + case STATE_DDR_FREQ:
>>> + reg |= (priv.dpratio | CPU_SLOW_EN);
>>
>> Does slow mode really (only) depend on the value written into CPUL2CR?
>> Dove FS isn't that chatty about it and I cannot really test right now.
>> But reading it, I think there is two CPU PLL to {L2,DDR} ratios that you
>> can switch between by (de-)asserting CPU_SLOW_EN.
>
> The lack of details in the datasheet was very annoying. I spent many
> evenings looking at a frozen up cubox. In the end i had to risk eye
> cancer and look at the Marvell vendor code. It always sets these
> values on each transition, and it even calculated one of the ratios
> each time the frequency changed. I never actually tried setting them
> once and then leaving them alone. Worth a try once i have the hardware
> available.
I actually just tried it and realized that both xpratio and dpratio are
equal (=4). And I wonder that not setting l2 ratio hangs it, while not
setting ddr ratio is fine. Anyway, without proper documentation IMHO
your approach is as fine as it can get. We can have a closer look at
it, when we both have time/tools/space available.
>>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> + priv.dfs = devm_ioremap_resource(&pdev->dev, res);
>>> + if (IS_ERR(priv.dfs))
>>> + return PTR_ERR(priv.dfs);
>>> +
>>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>>> + priv.pmu_cr = devm_ioremap_resource(&pdev->dev, res);
>>> + if (IS_ERR(priv.pmu_cr))
>>
>> Cleanup path for most of the resources here and below is kind of
>> missing.
>
> Well, i'm using devm_ioremap_resources(). The cleanup for that should
> happen automagically. And platform_get_resource() is just a lookup
> function.
True. But e.g. on the clock errors, you do not drop node or clk. No
clk_disable_unprepare on irq failures or if cpufreq_register_driver
fails.
>> Also, maybe give names to the different areas and not depend
>> on ordering?
>
> Actually, they already have names, but you probably have not go to
> that patch yet. So swapping to platform_get_resource_byname() would be
> simple.
I did flip over the non-DT resources and now (finally) realized, that
there is no specific DT node (You told me at least twice before).
Currently, I don't see why cpufreq shouldn't get its own node as this
adds dependency to legacy code we are trying to get rid of. But as you
already said, let's wait for summit results on DT future.
BTW, have another look at the resource names and remove the ':' (or
add it to all).
See you soon,
Sebastian
next prev parent reply other threads:[~2013-10-21 16:38 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-19 12:37 [PATCH 0/4] Dove cpufreq driver Andrew Lunn
2013-10-19 12:37 ` [PATCH 1/4] cpufreq: Add a cpufreq driver for Marvell Dove Andrew Lunn
2013-10-19 23:09 ` Luka Perkov
2013-10-20 8:42 ` Andrew Lunn
2013-10-21 10:42 ` Sebastian Hesselbarth
2013-10-21 15:42 ` Andrew Lunn
2013-10-21 16:38 ` Sebastian Hesselbarth [this message]
2013-10-22 9:01 ` Viresh Kumar
2013-10-22 15:57 ` Andrew Lunn
2013-10-23 4:29 ` Viresh Kumar
2013-10-22 10:19 ` Sudeep KarkadaNagesha
2013-10-19 12:37 ` [PATCH 2/4] mvebu: Dove: Instantiate cpufreq driver Andrew Lunn
2013-10-21 10:47 ` Sebastian Hesselbarth
2013-10-21 15:26 ` Andrew Lunn
2013-10-19 12:37 ` [PATCH 3/4] mvebu: Dove: Enable cpufreq driver in defconfig Andrew Lunn
2013-10-19 12:37 ` [PATCH 4/4] mvebu: Dove: Add clocks and DFS interrupt to cpu node in DT Andrew Lunn
-- strict thread matches above, loose matches on Subject: below --
2013-10-23 13:04 [PATCH 1/4] cpufreq: Add a cpufreq driver for Marvell Dove Andrew Lunn
2013-10-23 13:40 ` Viresh Kumar
2013-10-23 13:51 ` Andrew Lunn
2013-10-23 14:25 ` Viresh Kumar
2013-10-23 14:36 ` Andrew Lunn
2013-10-23 15:00 ` Viresh Kumar
2013-10-23 14:59 ` Andrew Lunn
2013-10-24 2:17 ` Viresh Kumar
2013-10-28 11:31 ` Andrew Lunn
2013-10-29 11:33 ` Viresh Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=526558A2.5050900@gmail.com \
--to=sebastian.hesselbarth@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).