From: Andrew Lunn <andrew@lunn.ch>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Andrew Lunn <andrew@lunn.ch>,
Sebastian Hesselbarth <sebastian.hesselbarth@googlemail.com>,
Jason Cooper <jason@lakedaemon.net>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/4] cpufreq: Add a cpufreq driver for Marvell Dove
Date: Tue, 22 Oct 2013 17:57:58 +0200 [thread overview]
Message-ID: <20131022155758.GA26694@lunn.ch> (raw)
In-Reply-To: <CAKohpok2scsSU7eFOP5LYmQar8xfOqG4-b3z4sVS6JOgnxVcpw@mail.gmail.com>
Hi Viresh
Thanks for your comments. I will include them in the next version.
> > +static irqreturn_t dove_cpufreq_irq(int irq, void *dev)
> > +{
> > + return IRQ_HANDLED;
> > +}
>
> what is this for?
The hardware raises an interrupt when the change is complete. This
interrupt is what brings the CPU out of the WFI. I don't know the
interrupt code too well, but i think it is necessary for the driver to
acknowledged it. The interrupt core code counts interrupts which
nobody acknowledges, and after 1000 are received, it disables the
interrupt. That would probably result in the machine locking solid,
never coming out of the WFI. So i'm playing it safe and handling the
interrupt.
> > +static int dove_cpufreq_probe(struct platform_device *pdev)
> > +{
> > + struct device_node *np;
> > + struct resource *res;
> > + int err;
> > + int irq;
>
> Above two can be merged.
Well, i was told the exact opposite by the USB serial maintainer :-)
I will use your coding style here, and his for USB code, and try to
keep everybody happy.
> > + priv.dev = &pdev->dev;
> > +
> > + 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))
> > + return PTR_ERR(priv.pmu_cr);
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
> > + priv.pmu_clk_div = devm_ioremap_resource(&pdev->dev, res);
> > + if (IS_ERR(priv.pmu_clk_div))
> > + return PTR_ERR(priv.pmu_clk_div);
> > +
> > + np = of_find_node_by_path("/cpus/cpu@0");
> > + if (!np)
> > + return -ENODEV;
> > +
> > + priv.cpu_clk = of_clk_get_by_name(np, "cpu_clk");
> > + if (IS_ERR(priv.cpu_clk)) {
> > + dev_err(priv.dev, "Unable to get cpuclk");
> > + return PTR_ERR(priv.cpu_clk);
> > + }
> > +
> > + clk_prepare_enable(priv.cpu_clk);
>
> this can fail..
In theory yes. In practice no. It is a fixed rate clock. prepare and
enable are actually NOPs for this type of clock. However the API
documentation explicitly states you need to call prepare and enable
before you can call clk_get_rate(). But i can add error checking if
you want.
>
> > + dove_freq_table[0].frequency = clk_get_rate(priv.cpu_clk) / 1000;
Andrew
next prev parent reply other threads:[~2013-10-22 16:02 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
2013-10-22 9:01 ` Viresh Kumar
2013-10-22 15:57 ` Andrew Lunn [this message]
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=20131022155758.GA26694@lunn.ch \
--to=andrew@lunn.ch \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=sebastian.hesselbarth@googlemail.com \
--cc=viresh.kumar@linaro.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).