linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Andrew Lunn <andrew@lunn.ch>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Jason Cooper <jason@lakedaemon.net>,
	Sebastian Hesselbarth <sebastian.hesselbarth@googlemail.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v4 1/4] cpufreq: Add a cpufreq driver for Marvell Dove
Date: Tue, 17 Dec 2013 23:06:57 +0100	[thread overview]
Message-ID: <20131217220657.GE2281@lunn.ch> (raw)
In-Reply-To: <CAKohpo=cPMF+Op_EOwPy2Nn0wz=7bSepCy08DPJAvpmcN7o0AA@mail.gmail.com>

> > diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
> > index ce52ed949249..af7c4947f218 100644
> > --- a/drivers/cpufreq/Kconfig.arm
> > +++ b/drivers/cpufreq/Kconfig.arm
> > @@ -8,6 +8,11 @@ config ARM_BIG_LITTLE_CPUFREQ
> >         help
> >           This enables the Generic CPUfreq driver for ARM big.LITTLE platforms.
> >
> > +config ARM_DOVE_CPUFREQ
> > +       def_bool ARCH_DOVE && OF
> > +       help
> > +         This adds the CPUFreq driver for Marvell Dove SoCs.
> 
> Please add this one after DT_BL one.. I know you wanted to keep
> them in alphabetical order (probably we need to rename DT_BL),
> but keeping both BIG LITTLE options makes more sense.
> 
> I will do the renaming later.

O.K, once the binding is agreed, i will make this change.
 
> >  config ARM_DT_BL_CPUFREQ
> >         tristate "Generic probing via DT for ARM big LITTLE CPUfreq driver"
> >         depends on ARM_BIG_LITTLE_CPUFREQ && OF
> 
> > diff --git a/drivers/cpufreq/dove-cpufreq.c b/drivers/cpufreq/dove-cpufreq.c
> > +static int dove_cpufreq_probe(struct platform_device *pdev)
> > +{
> > +       struct device *cpu_dev;
> > +       struct resource *res;
> > +       int err, irq;
> > +
> > +       memset(&priv, 0, sizeof(priv));
> > +       priv.dev = &pdev->dev;
> > +
> > +       res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> > +                                          "cpufreq: DFS");
> > +       priv.dfs = devm_ioremap_resource(&pdev->dev, res);
> > +       if (IS_ERR(priv.dfs))
> > +               return PTR_ERR(priv.dfs);
> > +
> > +       res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> > +                                          "cpufreq: PMU CR");
> > +       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_byname(pdev, IORESOURCE_MEM,
> > +                                          "cpufreq: PMU Clk Div");
> > +       priv.pmu_clk_div = devm_ioremap_resource(&pdev->dev, res);
> > +       if (IS_ERR(priv.pmu_clk_div))
> > +               return PTR_ERR(priv.pmu_clk_div);
> > +
> > +       cpu_dev = get_cpu_device(0);
> > +
> > +       priv.cpu_clk = devm_clk_get(cpu_dev, "cpu_clk");
> > +       if (IS_ERR(priv.cpu_clk)) {
> > +               err = PTR_ERR(priv.cpu_clk);
> > +               goto out;
> > +       }
> 
> You are doing clk_disable_unprepare in out, and you haven't enabled
> them yet. So, just return error from here.

You are missing part of the clk API, which makes this work, and keeps
the code simple. NULL is a valid clock, and enable/disable and
prepare/unprepare are NOP with a NULL clock. So the code after out:
should mostly do the right thing. However what i do have wrong is not
checking for IS_ERR() before clk_disable_unprepare(). I will fix that.

> > +
> > +       dove_freq_table[1].frequency = clk_get_rate(priv.ddr_clk) / 1000;
> 
> Because you are using 0 and 1 in index for CPU and DDR freq at multiple
> places, probably makes sense to make Macros for them ?

O.K.
 
Thanks for the review,

       Andrew

  reply	other threads:[~2013-12-17 22:07 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-04 14:17 [PATCH v4 0/4] Dove cpufreq driver Andrew Lunn
2013-12-04 14:17 ` [PATCH v4 1/4] cpufreq: Add a cpufreq driver for Marvell Dove Andrew Lunn
2013-12-04 14:33   ` Jason Cooper
2013-12-04 14:56     ` Andrew Lunn
2013-12-04 15:01       ` Jason Cooper
2013-12-04 14:54   ` Mark Rutland
2013-12-04 15:27     ` Andrew Lunn
2013-12-05 18:23       ` Mark Rutland
2013-12-17 21:41     ` [RFC PATCH v5 0/4] Dove Cpufreq driver Andrew Lunn
2013-12-17 21:41       ` [RFC PATCH v5 1/4] cpufreq: Add a cpufreq driver for Marvell Dove Andrew Lunn
2013-12-20  3:32         ` Jason Cooper
2013-12-21 16:26           ` Andrew Lunn
2013-12-21 19:25             ` Jason Cooper
2013-12-21 21:54               ` Andrew Lunn
2013-12-22  4:00                 ` Jason Cooper
2013-12-17 21:41       ` [RFC PATCH v5 2/4] mvebu: Dove: Indicate the architecture supports cpufreq Andrew Lunn
2013-12-17 21:41       ` [RFC PATCH v5 3/4] mvebu: Dove: Enable cpufreq driver in defconfig Andrew Lunn
2013-12-17 21:41       ` [RFC PATCH v5 4/4] mvebu: Dove: Add PMU node for cpufreq driver Andrew Lunn
2013-12-16  8:40   ` [PATCH v4 1/4] cpufreq: Add a cpufreq driver for Marvell Dove Viresh Kumar
2013-12-17 22:06     ` Andrew Lunn [this message]
2013-12-04 14:17 ` [PATCH v4 2/4] mvebu: Dove: Instantiate cpufreq driver Andrew Lunn
2013-12-04 14:36   ` Mark Rutland
2013-12-04 15:02     ` Andrew Lunn
2013-12-05 17:54       ` Mark Rutland
2013-12-05 18:29         ` Andrew Lunn
2013-12-08  0:50           ` Jason Cooper
2013-12-04 14:17 ` [PATCH v4 3/4] mvebu: Dove: Enable cpufreq driver in defconfig Andrew Lunn
2013-12-04 14:17 ` [PATCH v4 4/4] mvebu: Dove: Add clocks and DFS interrupt to cpu node in DT Andrew Lunn
2013-12-04 14:39   ` Mark Rutland
2013-12-04 14:55     ` Mark Rutland
2013-12-04 14:43   ` Jason Cooper

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=20131217220657.GE2281@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).