All of lore.kernel.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] cpufreq for freescale mx51
Date: Wed, 6 Oct 2010 13:15:58 +0200	[thread overview]
Message-ID: <201010061315.58771.arnd@arndb.de> (raw)
In-Reply-To: <AANLkTin7N8g1KdkyJ5ZsaKp=vUfvrffzvK8j+Z78bU0P@mail.gmail.com>

On Wednesday 06 October 2010, Yong Shen wrote:
> Hi Arnd,
> 
> Really appreciate your valuable comments. Most of them are accepted. I have
> different option about two comments.
> 1.
> 
> > It would be better to make this code a proper device driver,
> > probably a platform_driver unless you have a way to probe
> > the presence of the registers on another bus.
> >
> > Making it a driver that registers to a bus lets you separate
> > the probing from the implementation, and gives you a structure
> > to add your private variables to.
> >
> cpufreq is supposed to be registered using cpufreq_register_driver directly,
> so no other platform data is needed. You can also find out other cpufreq
> driver is designed this way, like omap cpufreq driver.

Ok, it is indeed different from what I thought.

My thought was that you have resources that need to be attached
to a device which then can get matched to a device_driver.

However, this is not how it works with the generic clock framework.
The device that you are controlling is not a random platform
device but the actual CPU, which has a node in the device tree
already (/sys/devices/system/cpu/*) and that gets controlled by
the generic cpufreq layer, while the resources are tied to the
struct clk that you are controlling.

So if anything, the clk is what needs to be a platform device,
not an artificial cpufreq device. You are only adding another
clock to the clock-mx51.c file and you are consistent with the
existing clocks in there, so I'm not asking you to change anything
here.

I wonder however if we can create a common cpufreq driver that
would work for all platforms that just need to call clk_set_rate
in the end and can operate from platform specific tables otherwise.
About half the cpufreq drivers in arm seem to be a variation of
this already, so we might be able to make the clock framework
good enough for this.

> 2.
> 
> > Don't use __raw_readl but readl/ioread32, which have more well-defined
> > behaviour.
> >
> I think __raw_readl is ok here, since in the platform related code, we know
> the register layout and length, this is more efficient. Also this is
> extensively used in arch/arm/.

I still disagree, but it's not important. IMHO most of the uses of
__raw_readl should be converted to readl or readl_relaxed if you are
worried about efficiency.

The main difference between __raw_readl and readl_relaxed is that the
endianess is well-defined on readl_relaxed.

	Arnd

  reply	other threads:[~2010-10-06 11:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-05 11:58 mx51 cpufreq driver yong.shen at linaro.org
2010-10-05 11:58 ` [PATCH] cpufreq for freescale mx51 yong.shen at linaro.org
2010-10-05 12:25   ` Arnd Bergmann
2010-10-06  5:38     ` Yong Shen
2010-10-06 11:15       ` Arnd Bergmann [this message]
2010-10-07  4:10         ` Yong Shen
  -- strict thread matches above, loose matches on Subject: below --
2010-10-07  5:36 mx51 cpufreq driver yong.shen at linaro.org
2010-10-07  5:36 ` [PATCH] cpufreq for freescale mx51 yong.shen at linaro.org
2010-10-07  8:03   ` Amit Kucheria
2010-10-07 11:33     ` Yong Shen
2010-10-07 11:45       ` Amit Kucheria
     [not found] <1285738417-1638-1-git-send-email-yong.shen@linaro.org>
2010-09-30 10:48 ` Amit Kucheria
2010-10-01  4:06   ` Yong Shen
2010-10-04  7:43     ` Amit Kucheria
2010-10-06  9:51   ` Sascha Hauer
2010-10-07  3:36     ` Yong Shen
2010-10-07  7:30       ` Sascha Hauer
2010-10-07 12:00         ` Yong Shen
2010-10-07  7:40       ` Amit Kucheria
2010-10-07  7:50         ` Sascha Hauer

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=201010061315.58771.arnd@arndb.de \
    --to=arnd@arndb.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.