From: balbi@ti.com (Felipe Balbi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] ARM: OMAP2+: 32k-counter: Use hwmod lookup to check presence of 32k timer
Date: Mon, 12 Mar 2012 11:39:24 +0200 [thread overview]
Message-ID: <20120312093921.GA5375@legolas.emea.dhcp.ti.com> (raw)
In-Reply-To: <79CD15C6BA57404B839C016229A409A83180F73D@DBDE01.ent.ti.com>
On Fri, Mar 09, 2012 at 05:58:00PM +0000, Hiremath, Vaibhav wrote:
> On Tue, Mar 06, 2012 at 04:25:30, Tony Lindgren wrote:
> > Hi,
> >
> > * Vaibhav Hiremath <hvaibhav@ti.com> [120119 06:01]:
> > > OMAP device has 32k-sync timer which is currently used as a
> > > clocksource in the kernel (omap2plus_defconfig).
> > > The current implementation uses compile time selection between
> > > gp-timer and 32k-sync timer, which breaks multi-omap build for
> > > the devices like AM33xx, where 32k-sync timer is not available.
> > >
> > > So use hwmod database lookup mechanism, through which at run-time
> > > we can identify availability of 32k-sync timer on the device,
> > > else fall back to gp-timer.
> > ...
> >
> > > --- a/arch/arm/plat-omap/counter_32k.c
> > > +++ b/arch/arm/plat-omap/counter_32k.c
> > > @@ -69,52 +69,55 @@ void read_persistent_clock(struct timespec *ts)
> > >
> > > int __init omap_init_clocksource_32k(void)
> > > {
> > > - static char err[] __initdata = KERN_ERR
> > > - "%s: can't register clocksource!\n";
> > > -
> > > - if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
> > > - u32 pbase;
> > > - unsigned long size = SZ_4K;
> > > - void __iomem *base;
> > > - struct clk *sync_32k_ick;
> > > -
> > > - if (cpu_is_omap16xx()) {
> > > - pbase = OMAP16XX_TIMER_32K_SYNCHRONIZED;
> > > - size = SZ_1K;
> > > - } else if (cpu_is_omap2420())
> > > - pbase = OMAP2420_32KSYNCT_BASE + 0x10;
> > > - else if (cpu_is_omap2430())
> > > - pbase = OMAP2430_32KSYNCT_BASE + 0x10;
> > > - else if (cpu_is_omap34xx())
> > > - pbase = OMAP3430_32KSYNCT_BASE + 0x10;
> > > - else if (cpu_is_omap44xx())
> > > - pbase = OMAP4430_32KSYNCT_BASE + 0x10;
> > > - else
> > > + u32 pbase;
> > > + unsigned long size = SZ_4K;
> > > + void __iomem *base;
> > > + struct clk *sync_32k_ick;
> > > +
> > > + if (cpu_is_omap16xx()) {
> > > + pbase = OMAP16XX_TIMER_32K_SYNCHRONIZED;
> > > + size = SZ_1K;
> > > + } else if (cpu_class_is_omap2()) {
> > > + struct omap_hwmod *oh;
> > > + const char *oh_name = "counter_32k";
> > > +
> > > + oh = omap_hwmod_lookup(oh_name);
> > > + if (!oh || oh->slaves_cnt == 0) {
> > > + pr_err("Could not lookup %s hwmod\n", oh_name);
> > > return -ENODEV;
> > > + }
> > > + pbase = oh->slaves[0]->addr->pa_start + 0x10;
> > > + } else {
> > > + return -ENODEV;
> > > + }
> >
> > How about have separate omap1 and omap2+ init functions that
> > call a common function and passes the pbase as a parameter?
> >
> > That way we can get rid of the cpu_is_omapxxxx tests here.
> >
>
> Tony,
>
> In the morning, I replied very soon, without much thinking...
>
> Just now I started working on the patch, I was just reviewing the code,
> and I felt that, it is unnecessary to split the code between omap1 and
> omap2+.
>
> The reason is,
>
> Currently Only OMAP16xx base-address is hardcoded with
> cpu_is_omap16xx() macro, For all other omap family of devices the
> complete information is fetched from HWDMO api's/data.
In that case, why don't you create the platform_device by hand on
arch/arm/mach-omap1/devices.c and move the omap2+ (which is based on
hwmod) to arch/arm/mach-omap2/devices.c ?
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120312/db5510d9/attachment-0001.sig>
next prev parent reply other threads:[~2012-03-12 9:39 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-19 14:28 [PATCH 0/3] ARM: OMAP1/2+: 32k-timer: Add hwmod lookup for 32k-timer Vaibhav Hiremath
2012-01-19 14:28 ` [PATCH 1/3] ARM: OMAP2+: 32k-counter: Use hwmod lookup to check presence of 32k timer Vaibhav Hiremath
2012-01-23 23:38 ` Kevin Hilman
2012-01-24 8:53 ` Hiremath, Vaibhav
2012-01-24 17:47 ` Kevin Hilman
2012-02-01 8:00 ` Hiremath, Vaibhav
2012-03-13 11:37 ` Ming Lei
2012-03-19 11:11 ` Hiremath, Vaibhav
2012-03-19 11:44 ` Ming Lei
2012-03-19 12:15 ` Santosh Shilimkar
2012-03-21 11:42 ` Hiremath, Vaibhav
2012-03-21 14:00 ` Shilimkar, Santosh
2012-03-28 14:16 ` Hiremath, Vaibhav
2012-03-28 14:20 ` Shilimkar, Santosh
2012-03-28 14:37 ` Hiremath, Vaibhav
2012-03-28 14:49 ` Shilimkar, Santosh
2012-03-30 6:34 ` Hiremath, Vaibhav
2012-03-30 7:41 ` Shilimkar, Santosh
2012-03-30 8:32 ` Hiremath, Vaibhav
2012-03-30 8:38 ` Santosh Shilimkar
2012-03-30 9:12 ` Hiremath, Vaibhav
2012-03-30 9:20 ` Shilimkar, Santosh
2012-03-30 9:28 ` Hiremath, Vaibhav
2012-03-30 9:42 ` Shilimkar, Santosh
2012-03-30 11:29 ` Hiremath, Vaibhav
2012-03-30 11:35 ` Santosh Shilimkar
2012-03-31 1:30 ` Ming Lei
2012-03-31 6:30 ` Shilimkar, Santosh
2012-03-31 8:39 ` Ming Lei
2012-03-31 19:10 ` Shilimkar, Santosh
2012-04-01 1:39 ` Ming Lei
2012-04-01 5:53 ` Shilimkar, Santosh
2012-04-02 18:35 ` Kevin Hilman
2012-04-03 5:50 ` Shilimkar, Santosh
2012-04-03 15:35 ` Hiremath, Vaibhav
2012-04-04 9:04 ` Shilimkar, Santosh
2012-04-04 10:39 ` Hiremath, Vaibhav
2012-04-05 9:36 ` Hiremath, Vaibhav
2012-04-05 9:52 ` Russell King - ARM Linux
2012-04-05 10:31 ` Hiremath, Vaibhav
2012-04-05 10:46 ` Santosh Shilimkar
2012-04-05 21:33 ` Kevin Hilman
2012-04-06 5:21 ` Hiremath, Vaibhav
2012-04-06 18:04 ` Tony Lindgren
2012-04-09 6:19 ` Hiremath, Vaibhav
2012-04-09 20:18 ` Jon Hunter
2012-04-10 5:42 ` Hiremath, Vaibhav
2012-04-10 8:44 ` Russell King - ARM Linux
2012-04-10 8:57 ` Santosh Shilimkar
2012-04-10 9:29 ` Russell King - ARM Linux
2012-04-10 9:51 ` Shilimkar, Santosh
2012-04-10 21:03 ` Jon Hunter
2012-04-11 1:00 ` Ming Lei
2012-04-11 7:47 ` Shilimkar, Santosh
2012-04-06 21:18 ` Kevin Hilman
2012-04-09 6:25 ` Hiremath, Vaibhav
2012-03-21 11:29 ` Hiremath, Vaibhav
2012-03-23 8:20 ` Ming Lei
2012-03-30 6:39 ` Hiremath, Vaibhav
2012-03-05 22:55 ` Tony Lindgren
2012-03-07 9:48 ` Hiremath, Vaibhav
2012-03-09 17:58 ` Hiremath, Vaibhav
2012-03-12 9:39 ` Felipe Balbi [this message]
2012-03-12 9:48 ` Hiremath, Vaibhav
2012-03-12 10:17 ` Felipe Balbi
2012-03-12 10:39 ` Hiremath, Vaibhav
2012-01-19 14:28 ` [PATCH 2/3] ARM: OMAP2/3: Add idle_st bits for ST_32KSYNC timer to prcm-common header Vaibhav Hiremath
2012-03-05 22:56 ` Tony Lindgren
2012-03-07 9:49 ` Hiremath, Vaibhav
2012-01-19 14:28 ` [PATCH 3/3] ARM: OMAP2+: hwmod data: Add 32k-sync timer data to hwmod database Vaibhav Hiremath
2012-01-23 8:47 ` [PATCH 0/3] ARM: OMAP1/2+: 32k-timer: Add hwmod lookup for 32k-timer Hiremath, Vaibhav
2012-03-05 22:57 ` Tony Lindgren
2012-03-07 9:50 ` Hiremath, Vaibhav
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=20120312093921.GA5375@legolas.emea.dhcp.ti.com \
--to=balbi@ti.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).