Re: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-05 Thread Sergei Shtylyov

Hello.

On 04-10-2010 23:15, Paul Walmsley wrote:


--- /dev/null
+++ b/arch/arm/plat-omap/32ksynctimer.c
@@ -0,0 +1,184 @@
+/*
+ * linux/arch/arm/plat-omap/clocksource.c



What name do you want to use? 32ksynctimer.c or clocksource.c?



Thanks, that's a bug.


   And also note that filenames in heading comments have been long discouraged.

WBR, Sergei
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-05 Thread Paul Walmsley
On Tue, 5 Oct 2010, Sergei Shtylyov wrote:

 Hello.
 
 On 04-10-2010 23:15, Paul Walmsley wrote:
 
--- /dev/null
+++ b/arch/arm/plat-omap/32ksynctimer.c
@@ -0,0 +1,184 @@
+/*
+ * linux/arch/arm/plat-omap/clocksource.c
 
   What name do you want to use? 32ksynctimer.c or clocksource.c?
 
  Thanks, that's a bug.
 
And also note that filenames in heading comments have been long
 discouraged.

Yeah, I dropped that from the updated patch, that was a pointless attempt 
at consistency with the old code.


- Paul
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Varadarajan, Charulatha
 

 -Original Message-
 From: linux-omap-ow...@vger.kernel.org 
 [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Paul Walmsley
 Sent: Saturday, October 02, 2010 3:06 AM
 To: linux-omap@vger.kernel.org; linux-arm-ker...@lists.infradead.org
 Subject: [PATCH 08/10] OMAP: split plat-omap/common.c
 
 Split plat-omap/common.c into three pieces:
 
 1. the 32KiHz sync timer and clocksource code, which now lives in
plat-omap/32ksynctimer.c;
 
 2. the OMAP2+ common code, which has been moved to 
 mach-omap2/common.c;
 
 3. and the remainder of the OMAP-wide common code, which includes the
deprecated ATAGs code and a deprecated video RAM 
 reservation function.
 
 The primary motivation for doing this is to move the 
 OMAP2+-specific parts
 into an OMAP2+-specific file, so that build breakage related to the
 System Control Module code can be resolved.
 
 Signed-off-by: Paul Walmsley p...@pwsan.com
 ---
  arch/arm/mach-omap2/Makefile  |3 
  arch/arm/mach-omap2/common.c  |  138 ++
  arch/arm/plat-omap/32ksynctimer.c |  184 +++
  arch/arm/plat-omap/Makefile   |2 
  arch/arm/plat-omap/common.c   |  291 
 -
  arch/arm/plat-omap/devices.c  |1 
  arch/arm/plat-omap/sram.c |3 
  7 files changed, 325 insertions(+), 297 deletions(-)
  create mode 100644 arch/arm/mach-omap2/common.c
  create mode 100644 arch/arm/plat-omap/32ksynctimer.c
 
 diff --git a/arch/arm/mach-omap2/Makefile 
 b/arch/arm/mach-omap2/Makefile
 index 9edacb0..d543533 100644
 --- a/arch/arm/mach-omap2/Makefile
 +++ b/arch/arm/mach-omap2/Makefile
 @@ -3,7 +3,8 @@
  #
  
  # Common support
 -obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o 
 timer-gp.o pm.o
 +obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o 
 timer-gp.o pm.o \
 +  common.o
  
  omap-2-3-common  = irq.o sdrc.o 
 prm2xxx_3xxx.o
  hwmod-common = omap_hwmod.o \
 diff --git a/arch/arm/mach-omap2/common.c 
 b/arch/arm/mach-omap2/common.c
 new file mode 100644
 index 000..4e0469d
 --- /dev/null
 +++ b/arch/arm/mach-omap2/common.c
 @@ -0,0 +1,138 @@
 +/*
 + * linux/arch/arm/mach-omap2/common.c
 + *
 + * Code common to all OMAP2+ machines.
 + *
 + * Copyright (C) 2009 Texas Instruments
 + * Copyright (C) 2010 Nokia Corporation
 + * Tony Lindgren t...@atomide.com
 + * Added OMAP4 support - Santosh Shilimkar santosh.shilim...@ti.com
 + * Paul Walmsley
 + *
 + * This program is free software; you can redistribute it 
 and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +#include linux/kernel.h
 +#include linux/init.h
 +#include linux/clk.h
 +#include linux/io.h
 +
 +#include plat/common.h
 +#include plat/board.h
 +#include plat/control.h
 +#include plat/mux.h
 +
 +#include plat/clock.h
 +
 +#include sdrc.h
 +
 +/* Global address base setup code */
 +
 +#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 +
 +static void __init __omap2_set_globals(struct omap_globals 
 *omap2_globals)
 +{
 + omap2_set_globals_tap(omap2_globals);
 + omap2_set_globals_sdrc(omap2_globals);
 + omap2_set_globals_control(omap2_globals);
 + omap2_set_globals_prcm(omap2_globals);
 + omap2_set_globals_uart(omap2_globals);
 +}
 +
 +#endif
 +
 +#if defined(CONFIG_ARCH_OMAP2420)
 +
 +static struct omap_globals omap242x_globals = {
 + .class  = OMAP242X_CLASS,
 + .tap= OMAP2_L4_IO_ADDRESS(0x48014000),
 + .sdrc   = OMAP2420_SDRC_BASE,
 + .sms= OMAP2420_SMS_BASE,
 + .ctrl   = OMAP242X_CTRL_BASE,
 + .prm= OMAP2420_PRM_BASE,
 + .cm = OMAP2420_CM_BASE,
 + .uart1_phys = OMAP2_UART1_BASE,
 + .uart2_phys = OMAP2_UART2_BASE,
 + .uart3_phys = OMAP2_UART3_BASE,
 +};
 +
 +void __init omap2_set_globals_242x(void)
 +{
 + __omap2_set_globals(omap242x_globals);
 +}
 +#endif
 +
 +#if defined(CONFIG_ARCH_OMAP2430)
 +
 +static struct omap_globals omap243x_globals = {
 + .class  = OMAP243X_CLASS,
 + .tap= OMAP2_L4_IO_ADDRESS(0x4900a000),
 + .sdrc   = OMAP243X_SDRC_BASE,
 + .sms= OMAP243X_SMS_BASE,
 + .ctrl   = OMAP243X_CTRL_BASE,
 + .prm= OMAP2430_PRM_BASE,
 + .cm = OMAP2430_CM_BASE,
 + .uart1_phys = OMAP2_UART1_BASE,
 + .uart2_phys = OMAP2_UART2_BASE,
 + .uart3_phys = OMAP2_UART3_BASE,
 +};
 +
 +void __init omap2_set_globals_243x(void)
 +{
 + __omap2_set_globals(omap243x_globals);
 +}
 +#endif
 +
 +#if defined(CONFIG_ARCH_OMAP3)

Do you really need these #ifdefs?
It would be better to avoid these #ifdefs and use cpu_is* checks.
Same comment holds good across this patch.

 +
 +static struct omap_globals omap3_globals = {
 + .class  = OMAP343X_CLASS,
 + .tap= OMAP2_L4_IO_ADDRESS(0x4830A000),
 + .sdrc   = OMAP343X_SDRC_BASE,
 + .sms= OMAP343X_SMS_BASE,
 + 

RE: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread DebBarma, Tarun Kanti

 -Original Message-
 From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-
 ow...@vger.kernel.org] On Behalf Of Cousson, Benoit
 Sent: Monday, October 04, 2010 2:39 PM
 To: Paul Walmsley
 Cc: linux-omap@vger.kernel.org; linux-arm-ker...@lists.infradead.org
 Subject: Re: [PATCH 08/10] OMAP: split plat-omap/common.c

 Hi Paul,

 On 10/1/2010 11:35 PM, Paul Walmsley wrote:
  Split plat-omap/common.c into three pieces:
 
  1. the 32KiHz sync timer and clocksource code, which now lives in
  plat-omap/32ksynctimer.c;
 
  2. the OMAP2+ common code, which has been moved to mach-omap2/common.c;
 
  3. and the remainder of the OMAP-wide common code, which includes the
  deprecated ATAGs code and a deprecated video RAM reservation
 function.
 
  The primary motivation for doing this is to move the OMAP2+-specific
 parts
  into an OMAP2+-specific file, so that build breakage related to the
  System Control Module code can be resolved.
 
  Signed-off-by: Paul Walmsleyp...@pwsan.com
  ---

 ...

  diff --git a/arch/arm/plat-omap/32ksynctimer.c b/arch/arm/plat-
 omap/32ksynctimer.c
  new file mode 100644
  index 000..b7f458c
  --- /dev/null
  +++ b/arch/arm/plat-omap/32ksynctimer.c
  @@ -0,0 +1,184 @@
  +/*
  + * linux/arch/arm/plat-omap/clocksource.c

 What name do you want to use? 32ksynctimer.c or clocksource.c?

 If this file is dedicated for the 32k sync timer, maybe we should now
 use the new OMAP4 name: counter_32k.

 Noboby knows what the sync stand for, and at the end this is just a 32k
 counter. Hence the new name :-)
One of the points to be kept in mind while naming is that we are able to relate 
our driver easily to the hardware device. In this regard the TRM terms this 
module as 32-kHz Synchronized Timer. Therefore we should be careful in our 
naming. With regard to the meaning of the word here is the extract from the TRM.

OMAP4430 ES2.0 TRM
...
The sync logic ensures the read transaction correctness by synchronizing the 
counter register read access on 32KSYNCNT_ICLK because the 32KSYNCNT_ICLK clock 
signal is completely asynchronous with S32KSYNCNT_FCLK.
...


 Benoit

  + *
  + * OMAP clocksource-related code
  + *
  + * Copyright (C) 2009 Texas Instruments
  + * Copyright (C) 2010 Nokia Corporation
  + * Tony Lindgrent...@atomide.com
  + * Added OMAP4 support - Santosh Shilimkarsantosh.shilim...@ti.com
  + * Paul Walmsley
  + *
  + * This program is free software; you can redistribute it and/or modify
  + * it under the terms of the GNU General Public License version 2 as
  + * published by the Free Software Foundation.
  + */
  +#includelinux/kernel.h
  +#includelinux/init.h
  +#includelinux/clk.h
  +#includelinux/io.h
  +
  +#includeplat/common.h
  +#includeplat/board.h
  +
  +#includeplat/clock.h
  +
  +
  +/*
  + * 32KHz clocksource ... always available, on pretty most chips except
  + * OMAP 730 and 1510.  Other timers could be used as clocksources, with
  + * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
  + * but systems won't necessarily want to spend resources that way.
  + */
  +
  +#define OMAP16XX_TIMER_32K_SYNCHRONIZED0xfffbc410
  +
  +#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
  +
  +#includelinux/clocksource.h
  +
  +/*
  + * offset_32k holds the init time counter value. It is then subtracted
  + * from every counter read to achieve a counter that counts time from
 the
  + * kernel boot (needed for sched_clock()).
  + */
  +static u32 offset_32k __read_mostly;
  +
  +#ifdef CONFIG_ARCH_OMAP16XX
  +static cycle_t omap16xx_32k_read(struct clocksource *cs)
  +{
  +   return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
  +}
  +#else
  +#define omap16xx_32k_read  NULL
  +#endif
  +
  +#ifdef CONFIG_ARCH_OMAP2420
  +static cycle_t omap2420_32k_read(struct clocksource *cs)
  +{
  +   return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
  +}
  +#else
  +#define omap2420_32k_read  NULL
  +#endif
  +
  +#ifdef CONFIG_ARCH_OMAP2430
  +static cycle_t omap2430_32k_read(struct clocksource *cs)
  +{
  +   return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
  +}
  +#else
  +#define omap2430_32k_read  NULL
  +#endif
  +
  +#ifdef CONFIG_ARCH_OMAP3
  +static cycle_t omap34xx_32k_read(struct clocksource *cs)
  +{
  +   return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
  +}
  +#else
  +#define omap34xx_32k_read  NULL
  +#endif
  +
  +#ifdef CONFIG_ARCH_OMAP4
  +static cycle_t omap44xx_32k_read(struct clocksource *cs)
  +{
  +   return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
  +}
  +#else
  +#define omap44xx_32k_read  NULL
  +#endif
  +
  +/*
  + * Kernel assumes that sched_clock can be called early but may not have
  + * things ready yet.
  + */
  +static cycle_t omap_32k_read_dummy(struct clocksource *cs)
  +{
  +   return 0;
  +}
  +
  +static struct clocksource clocksource_32k = {
  +   .name

RE: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Varadarajan, Charulatha
Paul,

snip

 
   +static 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()) {
   + struct clk *sync_32k_ick;
   +
   + if (cpu_is_omap16xx())
 
  Avoid cpu_is* checks in plat-omap.
 
 OK, I'll bite.  Why?

I think this is being looked for all the new code introduced
in plat-omap layer for the following reasons:
Adding cpu-is-* checks makes code unmaintainable going fwd.
plat-omap layer needs to handle common code for all omap platforms.

This was raised for GPIO driver because of which, there was a
requirement to clean-up the gpio driver.

Is this stand changed? Are cpu_is* checks allowed in plat-omap?

   + clocksource_32k.read = omap16xx_32k_read;
   + else if (cpu_is_omap2420())
   + clocksource_32k.read = omap2420_32k_read;
   + else if (cpu_is_omap2430())
   + clocksource_32k.read = omap2430_32k_read;
   + else if (cpu_is_omap34xx())
   + clocksource_32k.read = omap34xx_32k_read;
   + else if (cpu_is_omap44xx())
   + clocksource_32k.read = omap44xx_32k_read;
   + else
   + return -ENODEV;
   +
   + sync_32k_ick = clk_get(NULL, omap_32ksync_ick);
   + if (sync_32k_ick)
   + clk_enable(sync_32k_ick);
   +
   + clocksource_32k.mult = clocksource_hz2mult(32768,
   + clocksource_32k.shift);
   +
   + offset_32k = clocksource_32k.read(clocksource_32k);
   +
   + if (clocksource_register(clocksource_32k))
   + printk(err, clocksource_32k.name);
   + }
   + return 0;
   +}
   +arch_initcall(omap_init_clocksource_32k);
   +


-V Charulatha
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Shilimkar, Santosh
 -Original Message-
 From: Balbi, Felipe
 Sent: Monday, October 04, 2010 12:31 PM
 To: Balbi, Felipe
 Cc: Shilimkar, Santosh; Paul Walmsley; linux-omap@vger.kernel.org; linux-
 arm-ker...@lists.infradead.org
 Subject: Re: [PATCH 08/10] OMAP: split plat-omap/common.c
 
 On Mon, Oct 04, 2010 at 01:56:24AM -0500, Balbi, Felipe wrote:
 On Mon, Oct 04, 2010 at 12:34:48AM -0500, Shilimkar, Santosh wrote:
 Felipe,
 
  -Original Message-
  From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-
  ow...@vger.kernel.org] On Behalf Of Paul Walmsley
  Sent: Saturday, October 02, 2010 3:06 AM
  To: linux-omap@vger.kernel.org; linux-arm-ker...@lists.infradead.org
  Subject: [PATCH 08/10] OMAP: split plat-omap/common.c
 
  Split plat-omap/common.c into three pieces:
 
  1. the 32KiHz sync timer and clocksource code, which now lives in
 plat-omap/32ksynctimer.c;
 
 I remember you have converted the 32k sync time code to a platform
 driver.
 That was also addressing the multi-omap build and was removing all
 the compile time switches.
 Do you plan to rebase it and post it again ?
 
 I still have that sitting on my gitorious tree. The patch is attached
 to this mail. I compile tested (only) for omap3_defconfig, it probably
 needs to start using pm_runtime functions at some point and probably
 move to drivers/clocksource instead of arch/arm/plat-omap.
 
 patch is also available at [1]
 
 [1] git://gitorious.org/usb/usb.git clksource
 
 I made a few changes to make checkpatch.pl --strict happy. Attached
 
Good !!
This patch addresses splitting as well as multi-omap builds and probably
also a better candidate in case we need to convert sync timer to hwmod
driver.

Paul, what's your take?

Regards,
Santosh

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Paul Walmsley
On Mon, 4 Oct 2010, Varadarajan, Charulatha wrote:

  -Original Message-
  From: linux-omap-ow...@vger.kernel.org 
  [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Paul Walmsley
  Sent: Saturday, October 02, 2010 3:06 AM
  To: linux-omap@vger.kernel.org; linux-arm-ker...@lists.infradead.org
  Subject: [PATCH 08/10] OMAP: split plat-omap/common.c
  
  Split plat-omap/common.c into three pieces:

...

  +#if defined(CONFIG_ARCH_OMAP2430)
  +
  +static struct omap_globals omap243x_globals = {
  +   .class  = OMAP243X_CLASS,
  +   .tap= OMAP2_L4_IO_ADDRESS(0x4900a000),
  +   .sdrc   = OMAP243X_SDRC_BASE,
  +   .sms= OMAP243X_SMS_BASE,
  +   .ctrl   = OMAP243X_CTRL_BASE,
  +   .prm= OMAP2430_PRM_BASE,
  +   .cm = OMAP2430_CM_BASE,
  +   .uart1_phys = OMAP2_UART1_BASE,
  +   .uart2_phys = OMAP2_UART2_BASE,
  +   .uart3_phys = OMAP2_UART3_BASE,
  +};
  +
  +void __init omap2_set_globals_243x(void)
  +{
  +   __omap2_set_globals(omap243x_globals);
  +}
  +#endif
  +
  +#if defined(CONFIG_ARCH_OMAP3)
 
 Do you really need these #ifdefs?
 It would be better to avoid these #ifdefs and use cpu_is* checks.
 Same comment holds good across this patch.

If you think you can do it better, please create a patch for the 2.6.38 
time frame.  I personally am not interested in changing any of this code 
(which was not added by this patch; the patch just splits the existing 
code) for the .37 merge window.

  +static 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()) {
  +   struct clk *sync_32k_ick;
  +
  +   if (cpu_is_omap16xx())
 
 Avoid cpu_is* checks in plat-omap.

OK, I'll bite.  Why?


- Paul
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Felipe Balbi

On Mon, Oct 04, 2010 at 12:34:48AM -0500, Shilimkar, Santosh wrote:

Felipe,


-Original Message-
From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-
ow...@vger.kernel.org] On Behalf Of Paul Walmsley
Sent: Saturday, October 02, 2010 3:06 AM
To: linux-omap@vger.kernel.org; linux-arm-ker...@lists.infradead.org
Subject: [PATCH 08/10] OMAP: split plat-omap/common.c

Split plat-omap/common.c into three pieces:

1. the 32KiHz sync timer and clocksource code, which now lives in
   plat-omap/32ksynctimer.c;


I remember you have converted the 32k sync time code to a platform driver.
That was also addressing the multi-omap build and was removing all
the compile time switches.
Do you plan to rebase it and post it again ?


I still have that sitting on my gitorious tree. The patch is attached
to this mail. I compile tested (only) for omap3_defconfig, it probably
needs to start using pm_runtime functions at some point and probably
move to drivers/clocksource instead of arch/arm/plat-omap.

patch is also available at [1]

[1] git://gitorious.org/usb/usb.git clksource

8--- cut here -

From 9aad17796072a2ee88aa11c0431fa99e8e9609f0 Mon Sep 17 00:00:00 2001
From: Felipe Balbi ba...@ti.com
Date: Tue, 23 Mar 2010 12:54:14 +0200
Subject: [PATCH] arm: omap1/2/3/4: convert 32k-sync driver to a platform_driver
Organization: Texas Instruments\n

Convert the omap32k clocksource driver into a platform_driver
and while at that, also remove the ifdeferry around the code.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 arch/arm/mach-omap1/devices.c|   24 
 arch/arm/mach-omap2/clock2420_data.c |2 +-
 arch/arm/mach-omap2/clock2430_data.c |2 +-
 arch/arm/mach-omap2/clock3xxx_data.c |2 +-
 arch/arm/mach-omap2/devices.c|   35 +
 arch/arm/plat-omap/Makefile  |4 +-
 arch/arm/plat-omap/common.c  |  158 -
 arch/arm/plat-omap/counter-32k.c |  251 ++
 8 files changed, 315 insertions(+), 163 deletions(-)
 create mode 100644 arch/arm/plat-omap/counter-32k.c

diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index aa07256..b276b4b 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -28,6 +28,29 @@
 
 /*-*/
 
+#define OMAP16XX_TIMER_32K_BASE		0xfffbc400

+
+static struct resource omap_32k_resources[] = {
+   {
+   .start  = OMAP16XX_TIMER_32K_BASE,
+   .end= SZ_4K,
+   .flags  = IORESOURCE_MEM,
+   },
+};
+
+static struct platform_device omap_32k_device = {
+   .name   = omap-counter-32k,
+   .id = -1,
+   .num_resources  = ARRAY_SIZE(omap_32k_resources),
+   .resource   = omap_32k_resources,
+};
+
+static void omap_init_32k(void)
+{
+   if (cpu_is_omap16xx())
+  (void) platform_device_register(omap_32k_device);
+};
+
 #if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE)
 
 #define	OMAP_RTC_BASE		0xfffb4800

@@ -223,6 +246,7 @@ static int __init omap1_init_devices(void)
 * in alphabetical order so they're easier to sort through.
 */
 
+	omap_init_32k();

omap_init_mbox();
omap_init_rtc();
omap_init_spi100k();
diff --git a/arch/arm/mach-omap2/clock2420_data.c 
b/arch/arm/mach-omap2/clock2420_data.c
index 37d65d6..781bfeb 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -1806,7 +1806,7 @@ static struct omap_clk omap2420_clks[] = {
CLK(NULL,   gpios_fck,  gpios_fck, CK_242X),
CLK(omap_wdt,   ick,mpu_wdt_ick,   
CK_242X),
CLK(omap_wdt,   fck,mpu_wdt_fck,   
CK_242X),
-   CLK(NULL,   sync_32k_ick,   sync_32k_ick,  CK_242X),
+   CLK(omap-counter-32k,   ick,sync_32k_ick,  
CK_242X),
CLK(NULL,   wdt1_ick,   wdt1_ick,  CK_242X),
CLK(NULL,   omapctrl_ick,   omapctrl_ick,  CK_242X),
CLK(omap24xxcam, fck,   cam_fck,   CK_242X),
diff --git a/arch/arm/mach-omap2/clock2430_data.c 
b/arch/arm/mach-omap2/clock2430_data.c
index b33118f..e997692 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -1900,7 +1900,7 @@ static struct omap_clk omap2430_clks[] = {
CLK(NULL,   gpios_fck,  gpios_fck, CK_243X),
CLK(omap_wdt,   ick,mpu_wdt_ick,   
CK_243X),
CLK(omap_wdt,   fck,mpu_wdt_fck,   
CK_243X),
-   CLK(NULL,   sync_32k_ick,   sync_32k_ick,  CK_243X),
+   CLK(omap-counter-32k,   ick,sync_32k_ick,  
CK_243X),
CLK(NULL,   wdt1_ick,   wdt1_ick,  CK_243X),
CLK(NULL,   

Re: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Felipe Balbi

On Mon, Oct 04, 2010 at 01:56:24AM -0500, Balbi, Felipe wrote:

On Mon, Oct 04, 2010 at 12:34:48AM -0500, Shilimkar, Santosh wrote:

Felipe,


-Original Message-
From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-
ow...@vger.kernel.org] On Behalf Of Paul Walmsley
Sent: Saturday, October 02, 2010 3:06 AM
To: linux-omap@vger.kernel.org; linux-arm-ker...@lists.infradead.org
Subject: [PATCH 08/10] OMAP: split plat-omap/common.c

Split plat-omap/common.c into three pieces:

1. the 32KiHz sync timer and clocksource code, which now lives in
   plat-omap/32ksynctimer.c;


I remember you have converted the 32k sync time code to a platform driver.
That was also addressing the multi-omap build and was removing all
the compile time switches.
Do you plan to rebase it and post it again ?


I still have that sitting on my gitorious tree. The patch is attached
to this mail. I compile tested (only) for omap3_defconfig, it probably
needs to start using pm_runtime functions at some point and probably
move to drivers/clocksource instead of arch/arm/plat-omap.

patch is also available at [1]

[1] git://gitorious.org/usb/usb.git clksource


I made a few changes to make checkpatch.pl --strict happy. Attached

--
balbi
From 42dddbbd0738b36106e8aa9851ab16851642bdd0 Mon Sep 17 00:00:00 2001
From: Felipe Balbi ba...@ti.com
Date: Tue, 23 Mar 2010 12:54:14 +0200
Subject: [PATCH] arm: omap1/2/3/4: convert 32k-sync driver to a platform_driver
Organization: Texas Instruments\n

Convert the omap32k clocksource driver into a platform_driver
and while at that, also remove the ifdeferry around the code.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 arch/arm/mach-omap1/devices.c|   24 
 arch/arm/mach-omap2/clock2420_data.c |2 +-
 arch/arm/mach-omap2/clock2430_data.c |2 +-
 arch/arm/mach-omap2/clock3xxx_data.c |2 +-
 arch/arm/mach-omap2/devices.c|   35 +
 arch/arm/plat-omap/Makefile  |4 +-
 arch/arm/plat-omap/common.c  |  158 -
 arch/arm/plat-omap/counter-32k.c |  253 ++
 8 files changed, 317 insertions(+), 163 deletions(-)
 create mode 100644 arch/arm/plat-omap/counter-32k.c

diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index aa07256..62170fd 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -28,6 +28,29 @@
 
 /*-*/
 
+#define OMAP16XX_TIMER_32K_BASE		0xfffbc400
+
+static struct resource omap_32k_resources[] = {
+	{
+		.start		= OMAP16XX_TIMER_32K_BASE,
+		.end		= SZ_4K,
+		.flags		= IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device omap_32k_device = {
+	.name			= omap-counter-32k,
+	.id			= -1,
+	.num_resources		= ARRAY_SIZE(omap_32k_resources),
+	.resource		= omap_32k_resources,
+};
+
+static void omap_init_32k(void)
+{
+	if (cpu_is_omap16xx())
+		(void) platform_device_register(omap_32k_device);
+};
+
 #if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE)
 
 #define	OMAP_RTC_BASE		0xfffb4800
@@ -223,6 +246,7 @@ static int __init omap1_init_devices(void)
 	 * in alphabetical order so they're easier to sort through.
 	 */
 
+	omap_init_32k();
 	omap_init_mbox();
 	omap_init_rtc();
 	omap_init_spi100k();
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index 37d65d6..781bfeb 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -1806,7 +1806,7 @@ static struct omap_clk omap2420_clks[] = {
 	CLK(NULL,	gpios_fck,	gpios_fck,	CK_242X),
 	CLK(omap_wdt,	ick,		mpu_wdt_ick,	CK_242X),
 	CLK(omap_wdt,	fck,		mpu_wdt_fck,	CK_242X),
-	CLK(NULL,	sync_32k_ick,	sync_32k_ick,	CK_242X),
+	CLK(omap-counter-32k,	ick,	sync_32k_ick,	CK_242X),
 	CLK(NULL,	wdt1_ick,	wdt1_ick,	CK_242X),
 	CLK(NULL,	omapctrl_ick,	omapctrl_ick,	CK_242X),
 	CLK(omap24xxcam, fck,	cam_fck,	CK_242X),
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
index b33118f..e997692 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -1900,7 +1900,7 @@ static struct omap_clk omap2430_clks[] = {
 	CLK(NULL,	gpios_fck,	gpios_fck,	CK_243X),
 	CLK(omap_wdt,	ick,		mpu_wdt_ick,	CK_243X),
 	CLK(omap_wdt,	fck,		mpu_wdt_fck,	CK_243X),
-	CLK(NULL,	sync_32k_ick,	sync_32k_ick,	CK_243X),
+	CLK(omap-counter-32k,	ick,	sync_32k_ick,	CK_243X),
 	CLK(NULL,	wdt1_ick,	wdt1_ick,	CK_243X),
 	CLK(NULL,	omapctrl_ick,	omapctrl_ick,	CK_243X),
 	CLK(NULL,	icr_ick,	icr_ick,	CK_243X),
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index dfdce2d..257a8fe 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3343,7 +3343,7 @@ static struct omap_clk omap3xxx_clks[] = {
 	CLK(omap_wdt,	ick,		wdt2_ick,	CK_3XXX),
 	CLK(NULL,	wdt1_ick,	wdt1_ick,	CK_3XXX),
 	CLK(NULL,	gpio1_ick,	gpio1_ick,	CK_3XXX),
-	

Re: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Cousson, Benoit

Hi Paul,

On 10/1/2010 11:35 PM, Paul Walmsley wrote:

Split plat-omap/common.c into three pieces:

1. the 32KiHz sync timer and clocksource code, which now lives in
plat-omap/32ksynctimer.c;

2. the OMAP2+ common code, which has been moved to mach-omap2/common.c;

3. and the remainder of the OMAP-wide common code, which includes the
deprecated ATAGs code and a deprecated video RAM reservation function.

The primary motivation for doing this is to move the OMAP2+-specific parts
into an OMAP2+-specific file, so that build breakage related to the
System Control Module code can be resolved.

Signed-off-by: Paul Walmsleyp...@pwsan.com
---


...


diff --git a/arch/arm/plat-omap/32ksynctimer.c 
b/arch/arm/plat-omap/32ksynctimer.c
new file mode 100644
index 000..b7f458c
--- /dev/null
+++ b/arch/arm/plat-omap/32ksynctimer.c
@@ -0,0 +1,184 @@
+/*
+ * linux/arch/arm/plat-omap/clocksource.c


What name do you want to use? 32ksynctimer.c or clocksource.c?

If this file is dedicated for the 32k sync timer, maybe we should now 
use the new OMAP4 name: counter_32k.


Noboby knows what the sync stand for, and at the end this is just a 32k 
counter. Hence the new name :-)


Benoit


+ *
+ * OMAP clocksource-related code
+ *
+ * Copyright (C) 2009 Texas Instruments
+ * Copyright (C) 2010 Nokia Corporation
+ * Tony Lindgrent...@atomide.com
+ * Added OMAP4 support - Santosh Shilimkarsantosh.shilim...@ti.com
+ * Paul Walmsley
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#includelinux/kernel.h
+#includelinux/init.h
+#includelinux/clk.h
+#includelinux/io.h
+
+#includeplat/common.h
+#includeplat/board.h
+
+#includeplat/clock.h
+
+
+/*
+ * 32KHz clocksource ... always available, on pretty most chips except
+ * OMAP 730 and 1510.  Other timers could be used as clocksources, with
+ * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
+ * but systems won't necessarily want to spend resources that way.
+ */
+
+#define OMAP16XX_TIMER_32K_SYNCHRONIZED0xfffbc410
+
+#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
+
+#includelinux/clocksource.h
+
+/*
+ * offset_32k holds the init time counter value. It is then subtracted
+ * from every counter read to achieve a counter that counts time from the
+ * kernel boot (needed for sched_clock()).
+ */
+static u32 offset_32k __read_mostly;
+
+#ifdef CONFIG_ARCH_OMAP16XX
+static cycle_t omap16xx_32k_read(struct clocksource *cs)
+{
+   return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
+}
+#else
+#define omap16xx_32k_read  NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP2420
+static cycle_t omap2420_32k_read(struct clocksource *cs)
+{
+   return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap2420_32k_read  NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP2430
+static cycle_t omap2430_32k_read(struct clocksource *cs)
+{
+   return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap2430_32k_read  NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP3
+static cycle_t omap34xx_32k_read(struct clocksource *cs)
+{
+   return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap34xx_32k_read  NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP4
+static cycle_t omap44xx_32k_read(struct clocksource *cs)
+{
+   return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap44xx_32k_read  NULL
+#endif
+
+/*
+ * Kernel assumes that sched_clock can be called early but may not have
+ * things ready yet.
+ */
+static cycle_t omap_32k_read_dummy(struct clocksource *cs)
+{
+   return 0;
+}
+
+static struct clocksource clocksource_32k = {
+   .name   = 32k_counter,
+   .rating = 250,
+   .read   = omap_32k_read_dummy,
+   .mask   = CLOCKSOURCE_MASK(32),
+   .shift  = 10,
+   .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
+};
+
+/*
+ * Returns current time from boot in nsecs. It's OK for this to wrap
+ * around for now, as it's just a relative time stamp.
+ */
+unsigned long long sched_clock(void)
+{
+   return clocksource_cyc2ns(clocksource_32k.read(clocksource_32k),
+ clocksource_32k.mult, clocksource_32k.shift);
+}
+
+/**
+ * read_persistent_clock -  Return time from a persistent clock.
+ *
+ * Reads the time from a source which isn't disabled during PM, the
+ * 32k sync timer.  Convert the cycles elapsed since last read into
+ * nsecs and adds to a monotonically increasing timespec.
+ */
+static struct timespec persistent_ts;
+static cycles_t cycles, last_cycles;
+void read_persistent_clock(struct timespec *ts)
+{
+   unsigned long long nsecs;
+   cycles_t delta;
+   struct timespec *tsp =persistent_ts;
+
+   last_cycles = cycles;
+   cycles = 

Re: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Cousson, Benoit

Hi Tarun,

On 10/4/2010 11:35 AM, DebBarma, Tarun Kanti wrote:



-Original Message-
From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-
ow...@vger.kernel.org] On Behalf Of Cousson, Benoit
Sent: Monday, October 04, 2010 2:39 PM
To: Paul Walmsley
Cc: linux-omap@vger.kernel.org; linux-arm-ker...@lists.infradead.org
Subject: Re: [PATCH 08/10] OMAP: split plat-omap/common.c

Hi Paul,

On 10/1/2010 11:35 PM, Paul Walmsley wrote:

Split plat-omap/common.c into three pieces:

1. the 32KiHz sync timer and clocksource code, which now lives in
 plat-omap/32ksynctimer.c;

2. the OMAP2+ common code, which has been moved to mach-omap2/common.c;

3. and the remainder of the OMAP-wide common code, which includes the
 deprecated ATAGs code and a deprecated video RAM reservation

function.


The primary motivation for doing this is to move the OMAP2+-specific

parts

into an OMAP2+-specific file, so that build breakage related to the
System Control Module code can be resolved.

Signed-off-by: Paul Walmsleyp...@pwsan.com
---


...


diff --git a/arch/arm/plat-omap/32ksynctimer.c b/arch/arm/plat-

omap/32ksynctimer.c

new file mode 100644
index 000..b7f458c
--- /dev/null
+++ b/arch/arm/plat-omap/32ksynctimer.c
@@ -0,0 +1,184 @@
+/*
+ * linux/arch/arm/plat-omap/clocksource.c


What name do you want to use? 32ksynctimer.c or clocksource.c?

If this file is dedicated for the 32k sync timer, maybe we should now
use the new OMAP4 name: counter_32k.

Noboby knows what the sync stand for, and at the end this is just a 32k
counter. Hence the new name :-)

One of the points to be kept in mind while naming is that we are able to relate 
our driver easily to the hardware device. In this regard the TRM terms this 
module as 32-kHz Synchronized Timer. Therefore we should be careful in our 
naming. With regard to the meaning of the word here is the extract from the TRM.


The TRM will have to be fixed anyway to stick to the new convention.
We are just anticipating in order to avoid changing that again for the 
next revision.




OMAP4430 ES2.0 TRM
...
The sync logic ensures the read transaction correctness by synchronizing the 
counter register read access on 32KSYNCNT_ICLK because the 32KSYNCNT_ICLK clock 
signal is completely asynchronous with S32KSYNCNT_FCLK.


Thanks, but if this is where the sync came from, then this is the case 
for all modules with a very slow functional clock or even as soon as the 
fclk is not derived from its iclk.

This is not a functionality, it is just how it should be implemented.

Regards,
Benoit


...



Benoit


+ *
+ * OMAP clocksource-related code
+ *
+ * Copyright (C) 2009 Texas Instruments
+ * Copyright (C) 2010 Nokia Corporation
+ * Tony Lindgrent...@atomide.com
+ * Added OMAP4 support - Santosh Shilimkarsantosh.shilim...@ti.com
+ * Paul Walmsley
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#includelinux/kernel.h
+#includelinux/init.h
+#includelinux/clk.h
+#includelinux/io.h
+
+#includeplat/common.h
+#includeplat/board.h
+
+#includeplat/clock.h
+
+
+/*
+ * 32KHz clocksource ... always available, on pretty most chips except
+ * OMAP 730 and 1510.  Other timers could be used as clocksources, with
+ * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
+ * but systems won't necessarily want to spend resources that way.
+ */
+
+#define OMAP16XX_TIMER_32K_SYNCHRONIZED0xfffbc410
+
+#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
+
+#includelinux/clocksource.h
+
+/*
+ * offset_32k holds the init time counter value. It is then subtracted
+ * from every counter read to achieve a counter that counts time from

the

+ * kernel boot (needed for sched_clock()).
+ */
+static u32 offset_32k __read_mostly;
+
+#ifdef CONFIG_ARCH_OMAP16XX
+static cycle_t omap16xx_32k_read(struct clocksource *cs)
+{
+   return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
+}
+#else
+#define omap16xx_32k_read  NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP2420
+static cycle_t omap2420_32k_read(struct clocksource *cs)
+{
+   return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap2420_32k_read  NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP2430
+static cycle_t omap2430_32k_read(struct clocksource *cs)
+{
+   return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap2430_32k_read  NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP3
+static cycle_t omap34xx_32k_read(struct clocksource *cs)
+{
+   return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap34xx_32k_read  NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP4
+static cycle_t omap44xx_32k_read(struct clocksource *cs)
+{
+   return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap44xx_32k_read  NULL
+#endif

RE: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Shilimkar, Santosh
Felipe,

 -Original Message-
 From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-
 ow...@vger.kernel.org] On Behalf Of Paul Walmsley
 Sent: Saturday, October 02, 2010 3:06 AM
 To: linux-omap@vger.kernel.org; linux-arm-ker...@lists.infradead.org
 Subject: [PATCH 08/10] OMAP: split plat-omap/common.c

 Split plat-omap/common.c into three pieces:

 1. the 32KiHz sync timer and clocksource code, which now lives in
plat-omap/32ksynctimer.c;

I remember you have converted the 32k sync time code to a platform driver.
That was also addressing the multi-omap build and was removing all
the compile time switches.
Do you plan to rebase it and post it again ?

 2. the OMAP2+ common code, which has been moved to mach-omap2/common.c;

 3. and the remainder of the OMAP-wide common code, which includes the
deprecated ATAGs code and a deprecated video RAM reservation function.

 The primary motivation for doing this is to move the OMAP2+-specific parts
 into an OMAP2+-specific file, so that build breakage related to the
 System Control Module code can be resolved.

 Signed-off-by: Paul Walmsley p...@pwsan.com
 ---
  arch/arm/mach-omap2/Makefile  |3
  arch/arm/mach-omap2/common.c  |  138 ++
  arch/arm/plat-omap/32ksynctimer.c |  184 +++
  arch/arm/plat-omap/Makefile   |2
  arch/arm/plat-omap/common.c   |  291 
 -
  arch/arm/plat-omap/devices.c  |1
  arch/arm/plat-omap/sram.c |3
  7 files changed, 325 insertions(+), 297 deletions(-)
  create mode 100644 arch/arm/mach-omap2/common.c
  create mode 100644 arch/arm/plat-omap/32ksynctimer.c

 diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
 index 9edacb0..d543533 100644
 --- a/arch/arm/mach-omap2/Makefile
 +++ b/arch/arm/mach-omap2/Makefile
 @@ -3,7 +3,8 @@
  #

  # Common support
 -obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o
 pm.o
 +obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o
 pm.o \
 +  common.o

  omap-2-3-common  = irq.o sdrc.o prm2xxx_3xxx.o
  hwmod-common = omap_hwmod.o \
 diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
 new file mode 100644
 index 000..4e0469d
 --- /dev/null
 +++ b/arch/arm/mach-omap2/common.c
 @@ -0,0 +1,138 @@
 +/*
 + * linux/arch/arm/mach-omap2/common.c
 + *
 + * Code common to all OMAP2+ machines.
 + *
 + * Copyright (C) 2009 Texas Instruments
 + * Copyright (C) 2010 Nokia Corporation
 + * Tony Lindgren t...@atomide.com
 + * Added OMAP4 support - Santosh Shilimkar santosh.shilim...@ti.com
 + * Paul Walmsley
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +#include linux/kernel.h
 +#include linux/init.h
 +#include linux/clk.h
 +#include linux/io.h
 +
 +#include plat/common.h
 +#include plat/board.h
 +#include plat/control.h
 +#include plat/mux.h
 +
 +#include plat/clock.h
 +
 +#include sdrc.h
 +
 +/* Global address base setup code */
 +
 +#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 +
 +static void __init __omap2_set_globals(struct omap_globals
 *omap2_globals)
 +{
 + omap2_set_globals_tap(omap2_globals);
 + omap2_set_globals_sdrc(omap2_globals);
 + omap2_set_globals_control(omap2_globals);
 + omap2_set_globals_prcm(omap2_globals);
 + omap2_set_globals_uart(omap2_globals);
 +}
 +
 +#endif
 +
 +#if defined(CONFIG_ARCH_OMAP2420)
 +
 +static struct omap_globals omap242x_globals = {
 + .class  = OMAP242X_CLASS,
 + .tap= OMAP2_L4_IO_ADDRESS(0x48014000),
 + .sdrc   = OMAP2420_SDRC_BASE,
 + .sms= OMAP2420_SMS_BASE,
 + .ctrl   = OMAP242X_CTRL_BASE,
 + .prm= OMAP2420_PRM_BASE,
 + .cm = OMAP2420_CM_BASE,
 + .uart1_phys = OMAP2_UART1_BASE,
 + .uart2_phys = OMAP2_UART2_BASE,
 + .uart3_phys = OMAP2_UART3_BASE,
 +};
 +
 +void __init omap2_set_globals_242x(void)
 +{
 + __omap2_set_globals(omap242x_globals);
 +}
 +#endif
 +
 +#if defined(CONFIG_ARCH_OMAP2430)
 +
 +static struct omap_globals omap243x_globals = {
 + .class  = OMAP243X_CLASS,
 + .tap= OMAP2_L4_IO_ADDRESS(0x4900a000),
 + .sdrc   = OMAP243X_SDRC_BASE,
 + .sms= OMAP243X_SMS_BASE,
 + .ctrl   = OMAP243X_CTRL_BASE,
 + .prm= OMAP2430_PRM_BASE,
 + .cm = OMAP2430_CM_BASE,
 + .uart1_phys = OMAP2_UART1_BASE,
 + .uart2_phys = OMAP2_UART2_BASE,
 + .uart3_phys = OMAP2_UART3_BASE,
 +};
 +
 +void __init omap2_set_globals_243x(void)
 +{
 + __omap2_set_globals(omap243x_globals);
 +}
 +#endif
 +
 +#if defined(CONFIG_ARCH_OMAP3)
 +
 +static struct omap_globals omap3_globals = {
 + .class  = OMAP343X_CLASS,
 + .tap= OMAP2_L4_IO_ADDRESS(0x4830A000),
 + .sdrc   = 

Re: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Tony Lindgren
* Shilimkar, Santosh santosh.shilim...@ti.com [101004 00:20]:
  
  [1] git://gitorious.org/usb/usb.git clksource
  
  I made a few changes to make checkpatch.pl --strict happy. Attached
  
 Good !!
 This patch addresses splitting as well as multi-omap builds and probably
 also a better candidate in case we need to convert sync timer to hwmod
 driver.
 
 Paul, what's your take?

I think we need to first merge Paul's series to fix the omap1
compile issue and the ASoC module compile issue.

The other changes should be trivial to rebase on top of that.

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Tony Lindgren
* Varadarajan, Charulatha ch...@ti.com [101004 01:20]:
 Paul,
 
 snip
 
  
+static 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()) {
+   struct clk *sync_32k_ick;
+
+   if (cpu_is_omap16xx())
  
   Avoid cpu_is* checks in plat-omap.
  
  OK, I'll bite.  Why?
 
 I think this is being looked for all the new code introduced
 in plat-omap layer for the following reasons:
 Adding cpu-is-* checks makes code unmaintainable going fwd.
 plat-omap layer needs to handle common code for all omap platforms.
 
 This was raised for GPIO driver because of which, there was a
 requirement to clean-up the gpio driver.
 
 Is this stand changed? Are cpu_is* checks allowed in plat-omap?

We should only need to do cpu_is* checks in arch/arm/mach-omap2,
and only in few places during the init.

However, this patch series moves around the existing code to
avoid having oma2plus specific code be in plat-omap.

Again, further patches can be done easily on this.

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Paul Walmsley
On Mon, 4 Oct 2010, Cousson, Benoit wrote:

  --- /dev/null
  +++ b/arch/arm/plat-omap/32ksynctimer.c
  @@ -0,0 +1,184 @@
  +/*
  + * linux/arch/arm/plat-omap/clocksource.c
 
 What name do you want to use? 32ksynctimer.c or clocksource.c?

Thanks, that's a bug.

 If this file is dedicated for the 32k sync timer, maybe we should now use the
 new OMAP4 name: counter_32k.
 
 Noboby knows what the sync stand for, and at the end this is just a 32k
 counter. Hence the new name :-)

Yep, let's use counter_32k.c.


- Paul
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Paul Walmsley

Here's the updated patch:


- Paul

From b535de7eb9130d13b6121d0c67f86df7ee697850 Mon Sep 17 00:00:00 2001
From: Paul Walmsley p...@pwsan.com
Date: Fri, 1 Oct 2010 15:46:41 -0600
Subject: [PATCH] OMAP2+: Kconfig: disallow builds for boards that don't use the 
currently-selected SoC

Currently, if, for example, CONFIG_ARCH_OMAP2420 is not selected, OMAP2420
board files can still be included in the build.  This results in link errors:

arch/arm/mach-omap2/built-in.o: In function `omap_generic_map_io':
.../arch/arm/mach-omap2/board-generic.c:51: undefined reference to 
`omap2_set_globals_242x'
arch/arm/mach-omap2/built-in.o: In function `omap_h4_init':
.../arch/arm/mach-omap2/board-h4.c:330: undefined reference to 
`omap2420_mux_init'
arch/arm/mach-omap2/built-in.o: In function `omap_h4_map_io':
.../arch/arm/mach-omap2/board-h4.c:373: undefined reference to 
`omap2_set_globals_242x'
arch/arm/mach-omap2/built-in.o: In function `omap_apollon_init':
.../arch/arm/mach-omap2/board-apollon.c:325: undefined reference to 
`omap2420_mux_init'
arch/arm/mach-omap2/built-in.o: In function `omap_apollon_map_io':
.../arch/arm/mach-omap2/board-apollon.c:353: undefined reference to 
`omap2_set_globals_242x'
make: *** [.tmp_vmlinux1] Error 1

Fix this by making the boards depend on the Kconfig option for the
specific SoC that they use.

Also, while here, fix the mach-omap2/board-generic.c file to remove the
dependency on OMAP2420.

Charulatha Varadarajan ch...@ti.com caught a typo - thanks Charu.

Signed-off-by: Paul Walmsley p...@pwsan.com
Cc: Tony Lindgren t...@atomide.com
Cc: Charulatha Varadarajan ch...@ti.com
---
 arch/arm/mach-omap2/Kconfig |6 +++---
 arch/arm/mach-omap2/board-generic.c |   16 ++--
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 1c4b237..7f740bd 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -101,20 +101,20 @@ config MACH_OMAP2_TUSB6010
 
 config MACH_OMAP_H4
bool OMAP 2420 H4 board
-   depends on ARCH_OMAP2
+   depends on ARCH_OMAP2420
default y
select OMAP_PACKAGE_ZAF
select OMAP_DEBUG_DEVICES
 
 config MACH_OMAP_APOLLON
bool OMAP 2420 Apollon board
-   depends on ARCH_OMAP2
+   depends on ARCH_OMAP2420
default y
select OMAP_PACKAGE_ZAC
 
 config MACH_OMAP_2430SDP
bool OMAP 2430 SDP board
-   depends on ARCH_OMAP2
+   depends on ARCH_OMAP2430
default y
select OMAP_PACKAGE_ZAC
 
diff --git a/arch/arm/mach-omap2/board-generic.c 
b/arch/arm/mach-omap2/board-generic.c
index 3482b99..8aee862 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -48,10 +48,22 @@ static void __init omap_generic_init(void)
 
 static void __init omap_generic_map_io(void)
 {
-   omap2_set_globals_242x(); /* should be 242x, 243x, or 343x */
-   omap242x_map_common_io();
+   if (cpu_is_omap242x()) {
+   omap2_set_globals_242x();
+   omap242x_map_common_io();
+   } else if (cpu_is_omap243x()) {
+   omap2_set_globals_243x();
+   omap243x_map_common_io();
+   } else if (cpu_is_omap34xx()) {
+   omap2_set_globals_3xxx();
+   omap34xx_map_common_io();
+   } else if (cpu_is_omap44xx()) {
+   omap2_set_globals_443x();
+   omap44xx_map_common_io();
+   }
 }
 
+/* XXX This machine entry name should be updated */
 MACHINE_START(OMAP_GENERIC, Generic OMAP24xx)
/* Maintainer: Paul Mundt paul.mu...@nokia.com */
.phys_io= 0x4800,
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Paul Walmsley
On Mon, 4 Oct 2010, Paul Walmsley wrote:

 On Mon, 4 Oct 2010, Cousson, Benoit wrote:
 
   --- /dev/null
   +++ b/arch/arm/plat-omap/32ksynctimer.c
   @@ -0,0 +1,184 @@
   +/*
   + * linux/arch/arm/plat-omap/clocksource.c
  
  What name do you want to use? 32ksynctimer.c or clocksource.c?
 
 Thanks, that's a bug.
 
  If this file is dedicated for the 32k sync timer, maybe we should now use 
  the
  new OMAP4 name: counter_32k.
  
  Noboby knows what the sync stand for, and at the end this is just a 32k
  counter. Hence the new name :-)
 
 Yep, let's use counter_32k.c.

Here's the updated patch:


- Paul

From 38a26f5b30116df2f0f82acdae3b0a5f8aa25ac7 Mon Sep 17 00:00:00 2001
From: Paul Walmsley p...@pwsan.com
Date: Fri, 1 Oct 2010 15:46:44 -0600
Subject: [PATCH] OMAP: split plat-omap/common.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Split plat-omap/common.c into three pieces:

1. the 32KiHz sync timer and clocksource code, which now lives in
   plat-omap/counter_32k.c;

2. the OMAP2+ common code, which has been moved to mach-omap2/common.c;

3. and the remainder of the OMAP-wide common code, which includes the
   deprecated ATAGs code and a deprecated video RAM reservation function.

The primary motivation for doing this is to move the OMAP2+-specific parts
into an OMAP2+-specific file, so that build breakage related to the
System Control Module code can be resolved.

Benoît Cousson b-cous...@ti.com suggested a new filename and found
some bugs in the counter_32k.c comments - thanks Benoît.

Signed-off-by: Paul Walmsley p...@pwsan.com
Cc: Benoît Cousson b-cous...@ti.com
---
 arch/arm/mach-omap2/Makefile |3 +-
 arch/arm/mach-omap2/common.c |  137 ++
 arch/arm/plat-omap/Makefile  |2 +-
 arch/arm/plat-omap/common.c  |  291 --
 arch/arm/plat-omap/counter_32k.c |  183 
 arch/arm/plat-omap/devices.c |1 -
 arch/arm/plat-omap/sram.c|3 -
 7 files changed, 323 insertions(+), 297 deletions(-)
 create mode 100644 arch/arm/mach-omap2/common.c
 create mode 100644 arch/arm/plat-omap/counter_32k.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 9edacb0..d543533 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -3,7 +3,8 @@
 #
 
 # Common support
-obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o
+obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \
+common.o
 
 omap-2-3-common= irq.o sdrc.o prm2xxx_3xxx.o
 hwmod-common   = omap_hwmod.o \
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
new file mode 100644
index 000..d613738
--- /dev/null
+++ b/arch/arm/mach-omap2/common.c
@@ -0,0 +1,137 @@
+/*
+ * linux/arch/arm/mach-omap2/common.c
+ *
+ * Code common to all OMAP2+ machines.
+ *
+ * Copyright (C) 2009 Texas Instruments
+ * Copyright (C) 2010 Nokia Corporation
+ * Tony Lindgren t...@atomide.com
+ * Added OMAP4 support - Santosh Shilimkar santosh.shilim...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include linux/kernel.h
+#include linux/init.h
+#include linux/clk.h
+#include linux/io.h
+
+#include plat/common.h
+#include plat/board.h
+#include plat/control.h
+#include plat/mux.h
+
+#include plat/clock.h
+
+#include sdrc.h
+
+/* Global address base setup code */
+
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
+
+static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
+{
+   omap2_set_globals_tap(omap2_globals);
+   omap2_set_globals_sdrc(omap2_globals);
+   omap2_set_globals_control(omap2_globals);
+   omap2_set_globals_prcm(omap2_globals);
+   omap2_set_globals_uart(omap2_globals);
+}
+
+#endif
+
+#if defined(CONFIG_ARCH_OMAP2420)
+
+static struct omap_globals omap242x_globals = {
+   .class  = OMAP242X_CLASS,
+   .tap= OMAP2_L4_IO_ADDRESS(0x48014000),
+   .sdrc   = OMAP2420_SDRC_BASE,
+   .sms= OMAP2420_SMS_BASE,
+   .ctrl   = OMAP242X_CTRL_BASE,
+   .prm= OMAP2420_PRM_BASE,
+   .cm = OMAP2420_CM_BASE,
+   .uart1_phys = OMAP2_UART1_BASE,
+   .uart2_phys = OMAP2_UART2_BASE,
+   .uart3_phys = OMAP2_UART3_BASE,
+};
+
+void __init omap2_set_globals_242x(void)
+{
+   __omap2_set_globals(omap242x_globals);
+}
+#endif
+
+#if defined(CONFIG_ARCH_OMAP2430)
+
+static struct omap_globals omap243x_globals = {
+   .class  = OMAP243X_CLASS,
+   .tap= OMAP2_L4_IO_ADDRESS(0x4900a000),
+   .sdrc   = OMAP243X_SDRC_BASE,
+   .sms= OMAP243X_SMS_BASE,
+   .ctrl   = OMAP243X_CTRL_BASE,
+   .prm= OMAP2430_PRM_BASE,
+   .cm = OMAP2430_CM_BASE,
+   

RE: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Paul Walmsley
On Mon, 4 Oct 2010, Shilimkar, Santosh wrote:

  -Original Message-
  From: Balbi, Felipe
  Sent: Monday, October 04, 2010 12:31 PM
  
  On Mon, Oct 04, 2010 at 01:56:24AM -0500, Balbi, Felipe wrote:
  
  I still have that sitting on my gitorious tree. The patch is attached
  to this mail. I compile tested (only) for omap3_defconfig, it probably
  needs to start using pm_runtime functions at some point and probably
  move to drivers/clocksource instead of arch/arm/plat-omap.
  
  patch is also available at [1]
  
  [1] git://gitorious.org/usb/usb.git clksource
  
  I made a few changes to make checkpatch.pl --strict happy. Attached
  
 Good !!
 This patch addresses splitting as well as multi-omap builds and probably
 also a better candidate in case we need to convert sync timer to hwmod
 driver.
 
 Paul, what's your take?

It's great that this is getting cleaned up but it's too late for 2.6.37.  
We stop taking new code after -rc6 comes out so we can try to get all of 
the changes integrated with each other and fix any bugs.

The best thing for you and Felipe to do is to convert the driver to use 
hwmod data and pm_runtime and test on more platforms, then post it to the 
list after 2.6.37 comes out.

- Paul
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Shilimkar, Santosh
 -Original Message-
 From: Paul Walmsley [mailto:p...@pwsan.com]
 Sent: Tuesday, October 05, 2010 1:02 AM
 To: Shilimkar, Santosh
 Cc: Balbi, Felipe; linux-omap@vger.kernel.org; linux-arm-
 ker...@lists.infradead.org
 Subject: RE: [PATCH 08/10] OMAP: split plat-omap/common.c
 
 On Mon, 4 Oct 2010, Shilimkar, Santosh wrote:
 
   -Original Message-
   From: Balbi, Felipe
   Sent: Monday, October 04, 2010 12:31 PM
  
   On Mon, Oct 04, 2010 at 01:56:24AM -0500, Balbi, Felipe wrote:
   
   I still have that sitting on my gitorious tree. The patch is attached
   to this mail. I compile tested (only) for omap3_defconfig, it
 probably
   needs to start using pm_runtime functions at some point and probably
   move to drivers/clocksource instead of arch/arm/plat-omap.
   
   patch is also available at [1]
   
   [1] git://gitorious.org/usb/usb.git clksource
  
   I made a few changes to make checkpatch.pl --strict happy. Attached
  
  Good !!
  This patch addresses splitting as well as multi-omap builds and probably
  also a better candidate in case we need to convert sync timer to hwmod
  driver.
 
  Paul, what's your take?
 
 It's great that this is getting cleaned up but it's too late for 2.6.37.
 We stop taking new code after -rc6 comes out so we can try to get all of
 the changes integrated with each other and fix any bugs.

The patch was lying on the list for quite some time but didn't get much
attention before.
 
 The best thing for you and Felipe to do is to convert the driver to use
 hwmod data and pm_runtime and test on more platforms, then post it to the
 list after 2.6.37 comes out.
Probably this make sense.  

Regards,
Santosh
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Paul Walmsley
On Tue, 5 Oct 2010, Shilimkar, Santosh wrote:

  -Original Message-
  From: Paul Walmsley [mailto:p...@pwsan.com]
  Sent: Tuesday, October 05, 2010 1:02 AM
  
  It's great that this is getting cleaned up but it's too late for 2.6.37.
  We stop taking new code after -rc6 comes out so we can try to get all of
  the changes integrated with each other and fix any bugs.
 
 The patch was lying on the list for quite some time but didn't get much
 attention before.

According to my archives, it looks like Kevin did quite a bit of review on 
it and requested that it be converted to use omap_hwmod, after which there 
was no response.  If it was converted to use hwmod and pm_runtime, it 
probably could have gone in with the other hwmod conversions in the .37 
merge window.

  The best thing for you and Felipe to do is to convert the driver to use
  hwmod data and pm_runtime and test on more platforms, then post it to the
  list after 2.6.37 comes out.
 Probably this make sense.  


- Paul
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 08/10] OMAP: split plat-omap/common.c

2010-10-04 Thread Shilimkar, Santosh
 -Original Message-
 From: Paul Walmsley [mailto:p...@pwsan.com]
 Sent: Tuesday, October 05, 2010 10:26 AM
 To: Shilimkar, Santosh
 Cc: Balbi, Felipe; khil...@deeprootsystems.com; linux-
 o...@vger.kernel.org; linux-arm-ker...@lists.infradead.org
 Subject: RE: [PATCH 08/10] OMAP: split plat-omap/common.c
 
 On Tue, 5 Oct 2010, Shilimkar, Santosh wrote:
 
   -Original Message-
   From: Paul Walmsley [mailto:p...@pwsan.com]
   Sent: Tuesday, October 05, 2010 1:02 AM
  
   It's great that this is getting cleaned up but it's too late for
 2.6.37.
   We stop taking new code after -rc6 comes out so we can try to get all
 of
   the changes integrated with each other and fix any bugs.
  
  The patch was lying on the list for quite some time but didn't get much
  attention before.
 
 According to my archives, it looks like Kevin did quite a bit of review on
 it and requested that it be converted to use omap_hwmod, after which there
 was no response.  If it was converted to use hwmod and pm_runtime, it
 probably could have gone in with the other hwmod conversions in the .37
 merge window.
 
Thanks Paul. As aligned, the hwmod + runtime is way to go for this one then.

-Santosh
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html