All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree
@ 2012-06-05 17:34 Jon Hunter
  2012-06-05 17:34 ` [PATCH V4 01/12] ARM: OMAP: Remove unnecessary clk structure Jon Hunter
                   ` (11 more replies)
  0 siblings, 12 replies; 21+ messages in thread
From: Jon Hunter @ 2012-06-05 17:34 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Tarun Kanti DebBarma, Jon Hunter

In order to migrate the dmtimer driver to support device-tree I found that it
was first necessary to clean-up the timer platform data. The goal of this
series is to simplify the timer platform data structure from ...

struct dmtimer_platform_data {
	int (*set_timer_src)(struct platform_device *pdev, int source);
	int timer_ip_version;
	u32 needs_manual_reset:1;
	bool reserved;
	bool loses_context;
	int (*get_context_loss_count)(struct device *dev);
};

to ...

struct dmtimer_platform_data {
	/* set_timer_src - Only used for OMAP1 devices */
	int (*set_timer_src)(struct platform_device *pdev, int source);
	u32 timer_capability;
};

... where timer_capability is a bit mask that indicates the timer features
supported and uses the HWMOD timer capabilities flags described in
plat/dmtimer.h. For OMAP2+ devices this allows us to read the timer
capabilities from the HWMOD data and for OMAP1 devices the flags are simply
populated by the timer initialisation code. Eventually, the aim is to read the
timer capabilities from the device tree blob.

This series includes some fixes as well as clean-up. For instance OMAP1 dmtimer
support is currently completely broken and so I have included a fix for this.
If it is preferred to split the series into fixes and clean-up I can do that.

This series is based upon the current linux-omap master branch (3.5-rc1).

Testing:
- I have built both omap1 and omap2plus configurations as well as booted the
  respective kernels on the omap5912 OSK (omap1), OMAP3430 Beagle and OMAP4430
  Blaze.
- On the above boards I have also verified that I can request a dmtimer and set
  the parent clock.

V4:
- Well this is embarrassing! Somehow the removal of "needs_manual_reset"
  variable got dropped during the rebase to 3.5-rc1.
- Re-ordered patches to avoid any compilation breaks.

V3:
- Unsquashed two patches (9 and 10) that I had previously managed to squash by
  accident :-(

V2:
- Fix OMAP1 dmtimer support which currently broken. Requesting a timer
  fails because clk_get() is called and this is not support for OMAP1
  devices.
- Only use "set_timer_src" function pointer for OMAP1 devices.

Jon Hunter (12):
  ARM: OMAP: Remove unnecessary clk structure
  ARM: OMAP2+: Remove unused max number of timers definition
  ARM: OMAP2+: Add dmtimer platform function to reserve systimers
  ARM: OMAP: Add DMTIMER capability variable to represent timer
    features
  ARM: OMAP2+: HWMOD: Correct timer device attributes
  ARM: OMAP2+: Fix external clock support for dmtimers
  ARM: OMAP: Remove loses_context variable from timer platform data
  ARM: OMAP: Remove timer function pointer for context loss counter
  ARM: OMAP: Add flag to indicate if a timer needs a manual reset
  ARM: OMAP1: Fix dmtimer support
  ARM: OMAP2+: Move dmtimer clock set function to dmtimer driver
  ARM: OMAP2+: Simplify dmtimer clock aliases

 arch/arm/mach-omap1/timer.c                        |    3 +-
 arch/arm/mach-omap2/clock2420_data.c               |   39 +------
 arch/arm/mach-omap2/clock2430_data.c               |   39 +------
 arch/arm/mach-omap2/clock3xxx_data.c               |   26 +----
 arch/arm/mach-omap2/clock44xx_data.c               |   34 +++---
 arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c |    8 --
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c         |   10 +-
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c         |    6 --
 arch/arm/mach-omap2/timer.c                        |   82 +--------------
 arch/arm/plat-omap/dmtimer.c                       |  111 +++++++++++++++-----
 arch/arm/plat-omap/include/plat/dmtimer.h          |   22 +---
 11 files changed, 118 insertions(+), 262 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH V4 01/12] ARM: OMAP: Remove unnecessary clk structure
  2012-06-05 17:34 [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree Jon Hunter
@ 2012-06-05 17:34 ` Jon Hunter
  2012-06-05 17:34 ` [PATCH V4 02/12] ARM: OMAP2+: Remove unused max number of timers definition Jon Hunter
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Jon Hunter @ 2012-06-05 17:34 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Tarun Kanti DebBarma, Jon Hunter

In the plat/dmtimer.h there is a structure named "clk" declared. This structure
is not used and appears to be left over from previous code. Hence, remove this
unused structure.

Verified that both omap1 and omap2plus kernel configurations build with this
change.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 arch/arm/plat-omap/include/plat/dmtimer.h |    1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 5da7356..5fdfaa4 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -71,7 +71,6 @@ struct omap_timer_capability_dev_attr {
 };
 
 struct omap_dm_timer;
-struct clk;
 
 struct timer_regs {
 	u32 tidr;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V4 02/12] ARM: OMAP2+: Remove unused max number of timers definition
  2012-06-05 17:34 [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree Jon Hunter
  2012-06-05 17:34 ` [PATCH V4 01/12] ARM: OMAP: Remove unnecessary clk structure Jon Hunter
@ 2012-06-05 17:34 ` Jon Hunter
  2012-06-05 17:34 ` [PATCH V4 03/12] ARM: OMAP2+: Add dmtimer platform function to reserve systimers Jon Hunter
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Jon Hunter @ 2012-06-05 17:34 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Tarun Kanti DebBarma, Jon Hunter

The OMAP2+ timer code has a definition for the maximum number of timers that
OMAP2+ devices have. This defintion is not used anywhere in the code and
appears to be left over. Furthermore the definition is not accurate for OMAP4
devices that only have 11 timers available because the 12th timer is reserved
as a secure timer and for OMAP3 devices the 12th timer is not available on
secure devices. Therefore, remove this definition.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 arch/arm/mach-omap2/timer.c |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index ea6a0eb..8350352 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -69,9 +69,6 @@
 #define OMAP3_SECURE_TIMER	1
 #endif
 
-/* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
-#define MAX_GPTIMER_ID		12
-
 static u32 sys_timer_reserved;
 
 /* Clockevent code */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V4 03/12] ARM: OMAP2+: Add dmtimer platform function to reserve systimers
  2012-06-05 17:34 [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree Jon Hunter
  2012-06-05 17:34 ` [PATCH V4 01/12] ARM: OMAP: Remove unnecessary clk structure Jon Hunter
  2012-06-05 17:34 ` [PATCH V4 02/12] ARM: OMAP2+: Remove unused max number of timers definition Jon Hunter
@ 2012-06-05 17:34 ` Jon Hunter
  2012-06-05 17:34 ` [PATCH V4 04/12] ARM: OMAP: Add DMTIMER capability variable to represent timer features Jon Hunter
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Jon Hunter @ 2012-06-05 17:34 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Tarun Kanti DebBarma, Jon Hunter

During early boot, one or two dmtimers are reserved by the kernel as system
timers (for clocksource and clockevents). These timers are marked as reserved
and the dmtimer driver is notified which timers have been reserved via the
platform data information.

For OMAP2+ devices the timers reserved may vary depending on device and compile
flags. Therefore, it is not easy to assume which timers we be reserved for the
system timers. In order to migrate the dmtimer driver to support device-tree we
need a way to pass the timers reserved for system timers to the dmtimer driver.
Using the platform data structure will not work in the same way as it is
currently used because the platform data structure will be stored statically in
the dmtimer itself and the platform data will be selected via the device-tree
match device function (of_match_device).

There are a couple ways to workaround this. One option is to store the system
timers reserved for the kernel in the device-tree and query them on boot.
The downside of this approach is that it adds some delay to parse the DT blob
to search for the system timers. Secondly, for OMAP3 devices we have a
dependency on compile time flags and the device-tree would not be aware of that
kernel compile flags and so we would need to address that.

The second option is to add a function to the dmtimer code to reserved the
system timers during boot and so the dmtimer knows exactly which timers are
being used for system timers. This also allows us to remove the "reserved"
member from the timer platform data. This seemed like the simpler approach and
so was implemented here.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 arch/arm/mach-omap2/timer.c               |    9 ++-------
 arch/arm/plat-omap/dmtimer.c              |   18 +++++++++++++++++-
 arch/arm/plat-omap/include/plat/dmtimer.h |    3 +--
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 8350352..732bdcf 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -69,8 +69,6 @@
 #define OMAP3_SECURE_TIMER	1
 #endif
 
-static u32 sys_timer_reserved;
-
 /* Clockevent code */
 
 static struct omap_dm_timer clkev;
@@ -177,7 +175,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 
 	omap_hwmod_enable(oh);
 
-	sys_timer_reserved |= (1 << (gptimer_id - 1));
+	if (omap_dm_timer_reserve_systimer(gptimer_id))
+		return -ENODEV;
 
 	if (gptimer_id != 12) {
 		struct clk *src;
@@ -506,10 +505,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
 	pdata->set_timer_src = omap2_dm_timer_set_src;
 	pdata->timer_ip_version = oh->class->rev;
 
-	/* Mark clocksource and clockevent timers as reserved */
-	if ((sys_timer_reserved >> (id - 1)) & 0x1)
-		pdata->reserved = 1;
-
 	pwrdm = omap_hwmod_get_pwrdm(oh);
 	pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
 #ifdef CONFIG_PM
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 3b0cfeb..f5b5c89 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -45,6 +45,7 @@
 
 #include <mach/hardware.h>
 
+static u32 omap_reserved_systimers;
 static LIST_HEAD(omap_timer_list);
 static DEFINE_SPINLOCK(dm_timer_lock);
 
@@ -152,6 +153,21 @@ int omap_dm_timer_prepare(struct omap_dm_timer *timer)
 	return ret;
 }
 
+static inline u32 omap_dm_timer_reserved_systimer(int id)
+{
+	return (omap_reserved_systimers & (1 << (id - 1))) ? 1 : 0;
+}
+
+int omap_dm_timer_reserve_systimer(int id)
+{
+	if (omap_dm_timer_reserved_systimer(id))
+		return -ENODEV;
+
+	omap_reserved_systimers |= (1 << (id - 1));
+
+	return 0;
+}
+
 struct omap_dm_timer *omap_dm_timer_request(void)
 {
 	struct omap_dm_timer *timer = NULL, *t;
@@ -674,7 +690,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
 
 	timer->id = pdev->id;
 	timer->irq = irq->start;
-	timer->reserved = pdata->reserved;
+	timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
 	timer->pdev = pdev;
 	timer->loses_context = pdata->loses_context;
 	timer->get_context_loss_count = pdata->get_context_loss_count;
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 5fdfaa4..1e5ce5d 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -98,13 +98,12 @@ struct dmtimer_platform_data {
 	int (*set_timer_src)(struct platform_device *pdev, int source);
 	int timer_ip_version;
 	u32 needs_manual_reset:1;
-	bool reserved;
-
 	bool loses_context;
 
 	int (*get_context_loss_count)(struct device *dev);
 };
 
+int omap_dm_timer_reserve_systimer(int id);
 struct omap_dm_timer *omap_dm_timer_request(void);
 struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id);
 int omap_dm_timer_free(struct omap_dm_timer *timer);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V4 04/12] ARM: OMAP: Add DMTIMER capability variable to represent timer features
  2012-06-05 17:34 [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree Jon Hunter
                   ` (2 preceding siblings ...)
  2012-06-05 17:34 ` [PATCH V4 03/12] ARM: OMAP2+: Add dmtimer platform function to reserve systimers Jon Hunter
@ 2012-06-05 17:34 ` Jon Hunter
  2012-06-05 17:34 ` [PATCH V4 05/12] ARM: OMAP2+: HWMOD: Correct timer device attributes Jon Hunter
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Jon Hunter @ 2012-06-05 17:34 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Tarun Kanti DebBarma, Jon Hunter

Although the OMAP timers share a common hardware design, there are some
differences between the timer instances in a given device. For example, a timer
maybe in a power domain that can be powered-of, so can lose its logic state and
need restoring where as another may be in power domain that is always be on.
Another example, is a timer may support different clock sources to drive the
timer. This information is passed to the dmtimer via the following platform data
structure.

struct dmtimer_platform_data {
	int (*set_timer_src)(struct platform_device *pdev, int source);
	int timer_ip_version;
	u32 needs_manual_reset:1;
	bool loses_context;
	int (*get_context_loss_count)(struct device *dev);
};

The above structure uses multiple variables to represent the timer features.
HWMOD also stores the timer capabilities using a bit-mask that represents the
features supported. By using the same format for representing the timer
features in the platform data as used by HWMOD, we can ...

1. Use the flags defined in the plat/dmtimer.h to represent the features
   supported.
2. For devices using HWMOD, we can retrieve the features supported from HWMOD.
3. Eventually, simplify the platform data structure to be ...

struct dmtimer_platform_data {
	int (*set_timer_src)(struct platform_device *pdev, int source);
	u32 timer_capability;
}

Another benefit from doing this, is that it will simplify the migration of the
dmtimer driver to device-tree. For example, in the current OMAP2+ timer code the
"loses_context" variable is configured at runtime by calling an architecture
specific function. For device tree this creates a problem, because we would need
to call the architecture specific function from within the dmtimer driver.
However, such attributes do not need to be queried at runtime and we can look up
the attributes via HWMOD or device-tree.

This changes a new "capability" variable to the platform data and timer
structure so we can start removing and simplifying the platform data structure.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 arch/arm/mach-omap2/timer.c               |    3 +++
 arch/arm/plat-omap/dmtimer.c              |    1 +
 arch/arm/plat-omap/include/plat/dmtimer.h |    2 ++
 3 files changed, 6 insertions(+)

diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 732bdcf..ddacb8f 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -505,6 +505,9 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
 	pdata->set_timer_src = omap2_dm_timer_set_src;
 	pdata->timer_ip_version = oh->class->rev;
 
+	if (timer_dev_attr)
+		pdata->timer_capability = timer_dev_attr->timer_capability;
+
 	pwrdm = omap_hwmod_get_pwrdm(oh);
 	pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
 #ifdef CONFIG_PM
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index f5b5c89..30742d8e6 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -694,6 +694,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
 	timer->pdev = pdev;
 	timer->loses_context = pdata->loses_context;
 	timer->get_context_loss_count = pdata->get_context_loss_count;
+	timer->capability = pdata->timer_capability;
 
 	/* Skip pm_runtime_enable for OMAP1 */
 	if (!pdata->needs_manual_reset) {
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 1e5ce5d..48e54ca 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -101,6 +101,7 @@ struct dmtimer_platform_data {
 	bool loses_context;
 
 	int (*get_context_loss_count)(struct device *dev);
+	u32 timer_capability;
 };
 
 int omap_dm_timer_reserve_systimer(int id);
@@ -273,6 +274,7 @@ struct omap_dm_timer {
 	bool loses_context;
 	int ctx_loss_count;
 	int revision;
+	u32 capability;
 	struct platform_device *pdev;
 	struct list_head node;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V4 05/12] ARM: OMAP2+: HWMOD: Correct timer device attributes
  2012-06-05 17:34 [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree Jon Hunter
                   ` (3 preceding siblings ...)
  2012-06-05 17:34 ` [PATCH V4 04/12] ARM: OMAP: Add DMTIMER capability variable to represent timer features Jon Hunter
@ 2012-06-05 17:34 ` Jon Hunter
  2012-06-08  7:40   ` Tony Lindgren
  2012-06-13 23:53   ` Paul Walmsley
  2012-06-05 17:34 ` [PATCH V4 06/12] ARM: OMAP2+: Fix external clock support for dmtimers Jon Hunter
                   ` (6 subsequent siblings)
  11 siblings, 2 replies; 21+ messages in thread
From: Jon Hunter @ 2012-06-05 17:34 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Tarun Kanti DebBarma, Jon Hunter

Fix the following issues with the timer device attributes for OMAP2+ devices:

1. For OMAP24xx devices, timers 2-8 have the ALWAYS-ON attribute indicating
   that these timers are in an ALWAYS-ON power domain. This is not the case
   only timer1 is in an ALWAYS-ON power domain.
2. For OMAP3xxx devices, timers 2-7 have the ALWAYS-ON attribute indicating
   that these timers are in an ALWAYS-ON power domain. This is not the case
   only timer1 and timer12 are in an ALWAYS-ON power domain.
3. For OMAP3xxx devices, timer12 does not have the ALWAYS-ON attribute but
   is in an always-on power domain.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c |    7 -------
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c         |    8 +-------
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c         |    6 ------
 3 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index 83eafd9..7814e83 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -257,7 +257,6 @@ struct omap_hwmod omap2xxx_timer2_hwmod = {
 			.idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 	.class		= &omap2xxx_timer_hwmod_class,
 };
 
@@ -276,7 +275,6 @@ struct omap_hwmod omap2xxx_timer3_hwmod = {
 			.idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 	.class		= &omap2xxx_timer_hwmod_class,
 };
 
@@ -295,7 +293,6 @@ struct omap_hwmod omap2xxx_timer4_hwmod = {
 			.idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 	.class		= &omap2xxx_timer_hwmod_class,
 };
 
@@ -314,7 +311,6 @@ struct omap_hwmod omap2xxx_timer5_hwmod = {
 			.idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 	.class		= &omap2xxx_timer_hwmod_class,
 };
 
@@ -333,7 +329,6 @@ struct omap_hwmod omap2xxx_timer6_hwmod = {
 			.idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 	.class		= &omap2xxx_timer_hwmod_class,
 };
 
@@ -352,7 +347,6 @@ struct omap_hwmod omap2xxx_timer7_hwmod = {
 			.idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 	.class		= &omap2xxx_timer_hwmod_class,
 };
 
@@ -371,7 +365,6 @@ struct omap_hwmod omap2xxx_timer8_hwmod = {
 			.idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 	.class		= &omap2xxx_timer_hwmod_class,
 };
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index b26d3c9..7b33094 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -150,7 +150,7 @@ static struct omap_hwmod_class omap3xxx_timer_hwmod_class = {
 
 /* secure timers dev attribute */
 static struct omap_timer_capability_dev_attr capability_secure_dev_attr = {
-	.timer_capability	= OMAP_TIMER_SECURE,
+	.timer_capability	= OMAP_TIMER_ALWON | OMAP_TIMER_SECURE,
 };
 
 /* always-on timers dev attribute */
@@ -195,7 +195,6 @@ static struct omap_hwmod omap3xxx_timer2_hwmod = {
 			.idlest_idle_bit = OMAP3430_ST_GPT2_SHIFT,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 	.class		= &omap3xxx_timer_1ms_hwmod_class,
 };
 
@@ -213,7 +212,6 @@ static struct omap_hwmod omap3xxx_timer3_hwmod = {
 			.idlest_idle_bit = OMAP3430_ST_GPT3_SHIFT,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 	.class		= &omap3xxx_timer_hwmod_class,
 };
 
@@ -231,7 +229,6 @@ static struct omap_hwmod omap3xxx_timer4_hwmod = {
 			.idlest_idle_bit = OMAP3430_ST_GPT4_SHIFT,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 	.class		= &omap3xxx_timer_hwmod_class,
 };
 
@@ -249,7 +246,6 @@ static struct omap_hwmod omap3xxx_timer5_hwmod = {
 			.idlest_idle_bit = OMAP3430_ST_GPT5_SHIFT,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 	.class		= &omap3xxx_timer_hwmod_class,
 };
 
@@ -267,7 +263,6 @@ static struct omap_hwmod omap3xxx_timer6_hwmod = {
 			.idlest_idle_bit = OMAP3430_ST_GPT6_SHIFT,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 	.class		= &omap3xxx_timer_hwmod_class,
 };
 
@@ -285,7 +280,6 @@ static struct omap_hwmod omap3xxx_timer7_hwmod = {
 			.idlest_idle_bit = OMAP3430_ST_GPT7_SHIFT,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 	.class		= &omap3xxx_timer_hwmod_class,
 };
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 950454a..ebf9657 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -2943,7 +2943,6 @@ static struct omap_hwmod omap44xx_timer2_hwmod = {
 			.modulemode   = MODULEMODE_SWCTRL,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 };
 
 /* timer3 */
@@ -2965,7 +2964,6 @@ static struct omap_hwmod omap44xx_timer3_hwmod = {
 			.modulemode   = MODULEMODE_SWCTRL,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 };
 
 /* timer4 */
@@ -2987,7 +2985,6 @@ static struct omap_hwmod omap44xx_timer4_hwmod = {
 			.modulemode   = MODULEMODE_SWCTRL,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 };
 
 /* timer5 */
@@ -3009,7 +3006,6 @@ static struct omap_hwmod omap44xx_timer5_hwmod = {
 			.modulemode   = MODULEMODE_SWCTRL,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 };
 
 /* timer6 */
@@ -3032,7 +3028,6 @@ static struct omap_hwmod omap44xx_timer6_hwmod = {
 			.modulemode   = MODULEMODE_SWCTRL,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 };
 
 /* timer7 */
@@ -3054,7 +3049,6 @@ static struct omap_hwmod omap44xx_timer7_hwmod = {
 			.modulemode   = MODULEMODE_SWCTRL,
 		},
 	},
-	.dev_attr	= &capability_alwon_dev_attr,
 };
 
 /* timer8 */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V4 06/12] ARM: OMAP2+: Fix external clock support for dmtimers
  2012-06-05 17:34 [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree Jon Hunter
                   ` (4 preceding siblings ...)
  2012-06-05 17:34 ` [PATCH V4 05/12] ARM: OMAP2+: HWMOD: Correct timer device attributes Jon Hunter
@ 2012-06-05 17:34 ` Jon Hunter
  2012-06-05 17:34 ` [PATCH V4 07/12] ARM: OMAP: Remove loses_context variable from timer platform data Jon Hunter
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Jon Hunter @ 2012-06-05 17:34 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Tarun Kanti DebBarma, Jon Hunter

Currently, the dmtimer determines whether an timer can support an external
clock source (sys_altclk) for driving the timer by the IP version. Only
OMAP24xx devices can support an external clock source, but the IP version
between OMAP24xx and OMAP3xxx is common and so this incorrectly indicates
that OMAP3 devices can use an external clock source.

Rather than use the IP version, just let the clock framework handle this.
If the "alt_ck" does not exist for a timer then the clock framework will fail
to find the clock and hence will return an error. By doing this we can eliminate
the "timer_ip_version" variable passed as part of the platform data and simplify
the code.

We can also remove the timer IP version from the HWMOD data because the dmtimer
driver uses the TIDR register to determine the IP version.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c |    1 -
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c         |    2 --
 arch/arm/mach-omap2/timer.c                        |   12 ++----------
 arch/arm/plat-omap/include/plat/dmtimer.h          |    7 -------
 4 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index 7814e83..afad69c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -68,7 +68,6 @@ static struct omap_hwmod_class_sysconfig omap2xxx_timer_sysc = {
 struct omap_hwmod_class omap2xxx_timer_hwmod_class = {
 	.name	= "timer",
 	.sysc	= &omap2xxx_timer_sysc,
-	.rev	= OMAP_TIMER_IP_VERSION_1,
 };
 
 /*
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 7b33094..0ea53bc 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -129,7 +129,6 @@ static struct omap_hwmod_class_sysconfig omap3xxx_timer_1ms_sysc = {
 static struct omap_hwmod_class omap3xxx_timer_1ms_hwmod_class = {
 	.name = "timer",
 	.sysc = &omap3xxx_timer_1ms_sysc,
-	.rev = OMAP_TIMER_IP_VERSION_1,
 };
 
 static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = {
@@ -145,7 +144,6 @@ static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = {
 static struct omap_hwmod_class omap3xxx_timer_hwmod_class = {
 	.name = "timer",
 	.sysc = &omap3xxx_timer_sysc,
-	.rev =  OMAP_TIMER_IP_VERSION_1,
 };
 
 /* secure timers dev attribute */
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index ddacb8f..62bc05e 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -402,7 +402,6 @@ OMAP_SYS_TIMER(4)
 static int omap2_dm_timer_set_src(struct platform_device *pdev, int source)
 {
 	int ret;
-	struct dmtimer_platform_data *pdata = pdev->dev.platform_data;
 	struct clk *fclk, *parent;
 	char *parent_name = NULL;
 
@@ -423,14 +422,8 @@ static int omap2_dm_timer_set_src(struct platform_device *pdev, int source)
 		break;
 
 	case OMAP_TIMER_SRC_EXT_CLK:
-		if (pdata->timer_ip_version == OMAP_TIMER_IP_VERSION_1) {
-			parent_name = "alt_ck";
-			break;
-		}
-		dev_err(&pdev->dev, "%s: %d: invalid clk src.\n",
-			__func__, __LINE__);
-		clk_put(fclk);
-		return -EINVAL;
+		parent_name = "alt_ck";
+		break;
 	}
 
 	parent = clk_get(&pdev->dev, parent_name);
@@ -503,7 +496,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
 	sscanf(oh->name, "timer%2d", &id);
 
 	pdata->set_timer_src = omap2_dm_timer_set_src;
-	pdata->timer_ip_version = oh->class->rev;
 
 	if (timer_dev_attr)
 		pdata->timer_capability = timer_dev_attr->timer_capability;
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 48e54ca..362cf97 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -55,12 +55,6 @@
 #define OMAP_TIMER_TRIGGER_OVERFLOW		0x01
 #define OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE	0x02
 
-/*
- * IP revision identifier so that Highlander IP
- * in OMAP4 can be distinguished.
- */
-#define OMAP_TIMER_IP_VERSION_1                        0x1
-
 /* timer capabilities used in hwmod database */
 #define OMAP_TIMER_SECURE				0x80000000
 #define OMAP_TIMER_ALWON				0x40000000
@@ -96,7 +90,6 @@ struct timer_regs {
 
 struct dmtimer_platform_data {
 	int (*set_timer_src)(struct platform_device *pdev, int source);
-	int timer_ip_version;
 	u32 needs_manual_reset:1;
 	bool loses_context;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V4 07/12] ARM: OMAP: Remove loses_context variable from timer platform data
  2012-06-05 17:34 [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree Jon Hunter
                   ` (5 preceding siblings ...)
  2012-06-05 17:34 ` [PATCH V4 06/12] ARM: OMAP2+: Fix external clock support for dmtimers Jon Hunter
@ 2012-06-05 17:34 ` Jon Hunter
  2012-06-05 17:34 ` [PATCH V4 08/12] ARM: OMAP: Remove timer function pointer for context loss counter Jon Hunter
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Jon Hunter @ 2012-06-05 17:34 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Tarun Kanti DebBarma, Jon Hunter

The platform data variable loses_context is used to determine if the timer may
lose its logic state during power transitions and so needs to be restored. This
information is also provided in the HWMOD device attributes for OMAP2+ devices
via the OMAP_TIMER_ALWON flag. When this flag is set the timer will not lose
context. So use the HWMOD device attributes to determine this.

For OMAP1 devices, loses_context is never set and so set the OMAP_TIMER_ALWON
flag for OMAP1 timers to ensure that code is equivalent.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 arch/arm/mach-omap1/timer.c               |    1 +
 arch/arm/mach-omap2/timer.c               |    3 ---
 arch/arm/plat-omap/dmtimer.c              |    8 ++++----
 arch/arm/plat-omap/include/plat/dmtimer.h |    3 ---
 4 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
index 64c65bc..b4bf48c 100644
--- a/arch/arm/mach-omap1/timer.c
+++ b/arch/arm/mach-omap1/timer.c
@@ -141,6 +141,7 @@ static int __init omap1_dm_timer_init(void)
 
 		pdata->set_timer_src = omap1_dm_timer_set_src;
 		pdata->needs_manual_reset = 1;
+		pdata->timer_capability = OMAP_TIMER_ALWON;
 
 		ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
 		if (ret) {
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 62bc05e..b75bc6b 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -467,7 +467,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
 	struct dmtimer_platform_data *pdata;
 	struct platform_device *pdev;
 	struct omap_timer_capability_dev_attr *timer_dev_attr;
-	struct powerdomain *pwrdm;
 
 	pr_debug("%s: %s\n", __func__, oh->name);
 
@@ -500,8 +499,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
 	if (timer_dev_attr)
 		pdata->timer_capability = timer_dev_attr->timer_capability;
 
-	pwrdm = omap_hwmod_get_pwrdm(oh);
-	pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
 #ifdef CONFIG_PM
 	pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
 #endif
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 30742d8e6..7aa1278 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -341,7 +341,7 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)
 
 	omap_dm_timer_enable(timer);
 
-	if (timer->loses_context) {
+	if (!(timer->capability & OMAP_TIMER_ALWON)) {
 		u32 ctx_loss_cnt_after =
 			timer->get_context_loss_count(&timer->pdev->dev);
 		if (ctx_loss_cnt_after != timer->ctx_loss_count)
@@ -374,7 +374,8 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
 
 	__omap_dm_timer_stop(timer, timer->posted, rate);
 
-	if (timer->loses_context && timer->get_context_loss_count)
+	if (!(timer->capability & OMAP_TIMER_ALWON) &&
+			timer->get_context_loss_count)
 		timer->ctx_loss_count =
 			timer->get_context_loss_count(&timer->pdev->dev);
 
@@ -447,7 +448,7 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
 
 	omap_dm_timer_enable(timer);
 
-	if (timer->loses_context) {
+	if (!(timer->capability & OMAP_TIMER_ALWON)) {
 		u32 ctx_loss_cnt_after =
 			timer->get_context_loss_count(&timer->pdev->dev);
 		if (ctx_loss_cnt_after != timer->ctx_loss_count)
@@ -692,7 +693,6 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
 	timer->irq = irq->start;
 	timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
 	timer->pdev = pdev;
-	timer->loses_context = pdata->loses_context;
 	timer->get_context_loss_count = pdata->get_context_loss_count;
 	timer->capability = pdata->timer_capability;
 
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 362cf97..0a7ed31 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -91,8 +91,6 @@ struct timer_regs {
 struct dmtimer_platform_data {
 	int (*set_timer_src)(struct platform_device *pdev, int source);
 	u32 needs_manual_reset:1;
-	bool loses_context;
-
 	int (*get_context_loss_count)(struct device *dev);
 	u32 timer_capability;
 };
@@ -264,7 +262,6 @@ struct omap_dm_timer {
 	unsigned reserved:1;
 	unsigned posted:1;
 	struct timer_regs context;
-	bool loses_context;
 	int ctx_loss_count;
 	int revision;
 	u32 capability;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V4 08/12] ARM: OMAP: Remove timer function pointer for context loss counter
  2012-06-05 17:34 [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree Jon Hunter
                   ` (6 preceding siblings ...)
  2012-06-05 17:34 ` [PATCH V4 07/12] ARM: OMAP: Remove loses_context variable from timer platform data Jon Hunter
@ 2012-06-05 17:34 ` Jon Hunter
  2012-06-05 17:34 ` [PATCH V4 09/12] ARM: OMAP: Add flag to indicate if a timer needs a manual reset Jon Hunter
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Jon Hunter @ 2012-06-05 17:34 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Tarun Kanti DebBarma, Jon Hunter

For OMAP2+ devices, a function pointer that returns the number of times a timer
power domain has lost context is passed to the dmtimer driver. This function
pointer is only populated for OMAP2+ devices and it is pointing to a platform
function. Given that this is a platform function, we can simplify the code by
removing the function pointer and referencing the function directly. We can use
the OMAP_TIMER_ALWON flag to determine if we need to call this function for
OMAP1 and OMAP2+ devices.

The benefit of this change is the we can remove the function pointer from the
platform data and simplifies the dmtimer migration to device-tree.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 arch/arm/mach-omap2/timer.c               |    3 ---
 arch/arm/plat-omap/dmtimer.c              |   17 +++++++----------
 arch/arm/plat-omap/include/plat/dmtimer.h |    3 ---
 3 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index b75bc6b..67a97cd 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -499,9 +499,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
 	if (timer_dev_attr)
 		pdata->timer_capability = timer_dev_attr->timer_capability;
 
-#ifdef CONFIG_PM
-	pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
-#endif
 	pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
 				 NULL, 0, 0);
 
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 7aa1278..7875eef 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -42,6 +42,7 @@
 #include <linux/pm_runtime.h>
 
 #include <plat/dmtimer.h>
+#include <plat/omap-pm.h>
 
 #include <mach/hardware.h>
 
@@ -342,9 +343,8 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)
 	omap_dm_timer_enable(timer);
 
 	if (!(timer->capability & OMAP_TIMER_ALWON)) {
-		u32 ctx_loss_cnt_after =
-			timer->get_context_loss_count(&timer->pdev->dev);
-		if (ctx_loss_cnt_after != timer->ctx_loss_count)
+		if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) !=
+				timer->ctx_loss_count)
 			omap_timer_restore_context(timer);
 	}
 
@@ -374,10 +374,9 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
 
 	__omap_dm_timer_stop(timer, timer->posted, rate);
 
-	if (!(timer->capability & OMAP_TIMER_ALWON) &&
-			timer->get_context_loss_count)
+	if (!(timer->capability & OMAP_TIMER_ALWON))
 		timer->ctx_loss_count =
-			timer->get_context_loss_count(&timer->pdev->dev);
+			omap_pm_get_dev_context_loss_count(&timer->pdev->dev);
 
 	/*
 	 * Since the register values are computed and written within
@@ -449,9 +448,8 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
 	omap_dm_timer_enable(timer);
 
 	if (!(timer->capability & OMAP_TIMER_ALWON)) {
-		u32 ctx_loss_cnt_after =
-			timer->get_context_loss_count(&timer->pdev->dev);
-		if (ctx_loss_cnt_after != timer->ctx_loss_count)
+		if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) !=
+				timer->ctx_loss_count)
 			omap_timer_restore_context(timer);
 	}
 
@@ -693,7 +691,6 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
 	timer->irq = irq->start;
 	timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
 	timer->pdev = pdev;
-	timer->get_context_loss_count = pdata->get_context_loss_count;
 	timer->capability = pdata->timer_capability;
 
 	/* Skip pm_runtime_enable for OMAP1 */
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 0a7ed31..e11c9ea 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -91,7 +91,6 @@ struct timer_regs {
 struct dmtimer_platform_data {
 	int (*set_timer_src)(struct platform_device *pdev, int source);
 	u32 needs_manual_reset:1;
-	int (*get_context_loss_count)(struct device *dev);
 	u32 timer_capability;
 };
 
@@ -267,8 +266,6 @@ struct omap_dm_timer {
 	u32 capability;
 	struct platform_device *pdev;
 	struct list_head node;
-
-	int (*get_context_loss_count)(struct device *dev);
 };
 
 int omap_dm_timer_prepare(struct omap_dm_timer *timer);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V4 09/12] ARM: OMAP: Add flag to indicate if a timer needs a manual reset
  2012-06-05 17:34 [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree Jon Hunter
                   ` (7 preceding siblings ...)
  2012-06-05 17:34 ` [PATCH V4 08/12] ARM: OMAP: Remove timer function pointer for context loss counter Jon Hunter
@ 2012-06-05 17:34 ` Jon Hunter
  2012-06-05 17:34 ` [PATCH V4 10/12] ARM: OMAP1: Fix dmtimer support Jon Hunter
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Jon Hunter @ 2012-06-05 17:34 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Tarun Kanti DebBarma, Jon Hunter

For OMAP1 devices, it is necessary to perform a manual reset of the timer.
Currently, this is indicating by setting the "needs_manual_reset" variable in
the platform data. Instead of using an extra variable to indicate this add a new
timer capabilities flag to indicate this and remove the "needs_manual_reset"
member from the platform data.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 arch/arm/mach-omap1/timer.c               |    4 ++--
 arch/arm/plat-omap/dmtimer.c              |    9 +++------
 arch/arm/plat-omap/include/plat/dmtimer.h |    2 +-
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
index b4bf48c..aa81593 100644
--- a/arch/arm/mach-omap1/timer.c
+++ b/arch/arm/mach-omap1/timer.c
@@ -140,8 +140,8 @@ static int __init omap1_dm_timer_init(void)
 		}
 
 		pdata->set_timer_src = omap1_dm_timer_set_src;
-		pdata->needs_manual_reset = 1;
-		pdata->timer_capability = OMAP_TIMER_ALWON;
+		pdata->timer_capability = OMAP_TIMER_ALWON |
+				OMAP_TIMER_NEEDS_RESET;
 
 		ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
 		if (ret) {
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 7875eef..e3e22b3 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -135,7 +135,6 @@ static void omap_dm_timer_reset(struct omap_dm_timer *timer)
 
 int omap_dm_timer_prepare(struct omap_dm_timer *timer)
 {
-	struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data;
 	int ret;
 
 	timer->fclk = clk_get(&timer->pdev->dev, "fck");
@@ -145,7 +144,7 @@ int omap_dm_timer_prepare(struct omap_dm_timer *timer)
 		return -EINVAL;
 	}
 
-	if (pdata->needs_manual_reset)
+	if (timer->capability & OMAP_TIMER_NEEDS_RESET)
 		omap_dm_timer_reset(timer);
 
 	ret = omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
@@ -363,13 +362,11 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_start);
 int omap_dm_timer_stop(struct omap_dm_timer *timer)
 {
 	unsigned long rate = 0;
-	struct dmtimer_platform_data *pdata;
 
 	if (unlikely(!timer))
 		return -EINVAL;
 
-	pdata = timer->pdev->dev.platform_data;
-	if (!pdata->needs_manual_reset)
+	if (!(timer->capability & OMAP_TIMER_NEEDS_RESET))
 		rate = clk_get_rate(timer->fclk);
 
 	__omap_dm_timer_stop(timer, timer->posted, rate);
@@ -694,7 +691,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
 	timer->capability = pdata->timer_capability;
 
 	/* Skip pm_runtime_enable for OMAP1 */
-	if (!pdata->needs_manual_reset) {
+	if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
 		pm_runtime_enable(&pdev->dev);
 		pm_runtime_irq_safe(&pdev->dev);
 	}
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index e11c9ea..c039e84 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -59,6 +59,7 @@
 #define OMAP_TIMER_SECURE				0x80000000
 #define OMAP_TIMER_ALWON				0x40000000
 #define OMAP_TIMER_HAS_PWM				0x20000000
+#define OMAP_TIMER_NEEDS_RESET				0x10000000
 
 struct omap_timer_capability_dev_attr {
 	u32 timer_capability;
@@ -90,7 +91,6 @@ struct timer_regs {
 
 struct dmtimer_platform_data {
 	int (*set_timer_src)(struct platform_device *pdev, int source);
-	u32 needs_manual_reset:1;
 	u32 timer_capability;
 };
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V4 10/12] ARM: OMAP1: Fix dmtimer support
  2012-06-05 17:34 [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree Jon Hunter
                   ` (8 preceding siblings ...)
  2012-06-05 17:34 ` [PATCH V4 09/12] ARM: OMAP: Add flag to indicate if a timer needs a manual reset Jon Hunter
@ 2012-06-05 17:34 ` Jon Hunter
  2012-06-05 17:34 ` [PATCH V4 11/12] ARM: OMAP2+: Move dmtimer clock set function to dmtimer driver Jon Hunter
  2012-06-05 17:35 ` [PATCH V4 12/12] ARM: OMAP2+: Simplify dmtimer clock aliases Jon Hunter
  11 siblings, 0 replies; 21+ messages in thread
From: Jon Hunter @ 2012-06-05 17:34 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Tarun Kanti DebBarma, Jon Hunter

OMAP1 dmtimer support is currently broken. When a dmtimer is requested by the
omap_dm_timer_request() function fails to allocate a dmtimer because the call
to clk_get() inside omap_dm_timer_prepare fails. The clk_get() fails simply
because the clock data for the OMAP1 dmtimers is not present.

Ideally this should be fixed by moving OMAP1 dmtimers to use the clock
framework. For now simply fix this by using the "TIMER_NEEDS_RESET" flag to
identify an OMAP1 device and avoid calling clk_get(). Although this is not
the ideal fix and should be corrected, this flag has already been use for the
same purpose in omap_dm_timer_stop().

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 arch/arm/plat-omap/dmtimer.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index e3e22b3..6510e5e 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -137,11 +137,17 @@ int omap_dm_timer_prepare(struct omap_dm_timer *timer)
 {
 	int ret;
 
-	timer->fclk = clk_get(&timer->pdev->dev, "fck");
-	if (WARN_ON_ONCE(IS_ERR_OR_NULL(timer->fclk))) {
-		timer->fclk = NULL;
-		dev_err(&timer->pdev->dev, ": No fclk handle.\n");
-		return -EINVAL;
+	/*
+	 * FIXME: OMAP1 devices do not use the clock framework for dmtimers so
+	 * do not call clk_get() for these devices.
+	 */
+	if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
+		timer->fclk = clk_get(&timer->pdev->dev, "fck");
+		if (WARN_ON_ONCE(IS_ERR_OR_NULL(timer->fclk))) {
+			timer->fclk = NULL;
+			dev_err(&timer->pdev->dev, ": No fclk handle.\n");
+			return -EINVAL;
+		}
 	}
 
 	if (timer->capability & OMAP_TIMER_NEEDS_RESET)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V4 11/12] ARM: OMAP2+: Move dmtimer clock set function to dmtimer driver
  2012-06-05 17:34 [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree Jon Hunter
                   ` (9 preceding siblings ...)
  2012-06-05 17:34 ` [PATCH V4 10/12] ARM: OMAP1: Fix dmtimer support Jon Hunter
@ 2012-06-05 17:34 ` Jon Hunter
  2012-06-05 17:35 ` [PATCH V4 12/12] ARM: OMAP2+: Simplify dmtimer clock aliases Jon Hunter
  11 siblings, 0 replies; 21+ messages in thread
From: Jon Hunter @ 2012-06-05 17:34 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Tarun Kanti DebBarma, Jon Hunter

OMAP1 uses an architecture specific function for setting the dmtimer clock
source, where as the OMAP2+ devices use the clock framework. Eventually OMAP1
device should also use the clock framework and hence we should not any
architecture specific functions.

For now move the OMAP2+ function for configuring the clock source into the
dmtimer driver. Therefore, we do no longer need to specify an architecture
specific function for setting the clock source for OMAP2+ devices. This will
simplify device tree migration of the dmtimers for OMAP2+ devices.

>From now on, only OMAP1 devices should specify an architecture specific
function for setting the clock source via the platform data set_dmtimer_src()
function pointer.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 arch/arm/mach-omap2/timer.c               |   55 -----------------------------
 arch/arm/plat-omap/dmtimer.c              |   46 +++++++++++++++++++++++-
 arch/arm/plat-omap/include/plat/dmtimer.h |    1 +
 3 files changed, 46 insertions(+), 56 deletions(-)

diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 67a97cd..b5b5d92 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -395,59 +395,6 @@ OMAP_SYS_TIMER(4)
 #endif
 
 /**
- * omap2_dm_timer_set_src - change the timer input clock source
- * @pdev:	timer platform device pointer
- * @source:	array index of parent clock source
- */
-static int omap2_dm_timer_set_src(struct platform_device *pdev, int source)
-{
-	int ret;
-	struct clk *fclk, *parent;
-	char *parent_name = NULL;
-
-	fclk = clk_get(&pdev->dev, "fck");
-	if (IS_ERR_OR_NULL(fclk)) {
-		dev_err(&pdev->dev, "%s: %d: clk_get() FAILED\n",
-				__func__, __LINE__);
-		return -EINVAL;
-	}
-
-	switch (source) {
-	case OMAP_TIMER_SRC_SYS_CLK:
-		parent_name = "sys_ck";
-		break;
-
-	case OMAP_TIMER_SRC_32_KHZ:
-		parent_name = "32k_ck";
-		break;
-
-	case OMAP_TIMER_SRC_EXT_CLK:
-		parent_name = "alt_ck";
-		break;
-	}
-
-	parent = clk_get(&pdev->dev, parent_name);
-	if (IS_ERR_OR_NULL(parent)) {
-		dev_err(&pdev->dev, "%s: %d: clk_get() %s FAILED\n",
-			__func__, __LINE__, parent_name);
-		clk_put(fclk);
-		return -EINVAL;
-	}
-
-	ret = clk_set_parent(fclk, parent);
-	if (IS_ERR_VALUE(ret)) {
-		dev_err(&pdev->dev, "%s: clk_set_parent() to %s FAILED\n",
-			__func__, parent_name);
-		ret = -EINVAL;
-	}
-
-	clk_put(parent);
-	clk_put(fclk);
-
-	return ret;
-}
-
-/**
  * omap_timer_init - build and register timer device with an
  * associated timer hwmod
  * @oh:	timer hwmod pointer to be used to build timer device
@@ -494,8 +441,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
 	 */
 	sscanf(oh->name, "timer%2d", &id);
 
-	pdata->set_timer_src = omap2_dm_timer_set_src;
-
 	if (timer_dev_attr)
 		pdata->timer_capability = timer_dev_attr->timer_capability;
 
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 6510e5e..6a70889 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -397,6 +397,8 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
 int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
 {
 	int ret;
+	char *parent_name = NULL;
+	struct clk *fclk, *parent;
 	struct dmtimer_platform_data *pdata;
 
 	if (unlikely(!timer))
@@ -407,7 +409,49 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
 	if (source < 0 || source >= 3)
 		return -EINVAL;
 
-	ret = pdata->set_timer_src(timer->pdev, source);
+	/*
+	 * FIXME: Used for OMAP1 devices only because they do not currently
+	 * use the clock framework to set the parent clock. To be removed
+	 * once OMAP1 migrated to using clock framework for dmtimers
+	 */
+	if (pdata->set_timer_src)
+		return pdata->set_timer_src(timer->pdev, source);
+
+	fclk = clk_get(&timer->pdev->dev, "fck");
+	if (IS_ERR_OR_NULL(fclk)) {
+		pr_err("%s: fck not found\n", __func__);
+		return -EINVAL;
+	}
+
+	switch (source) {
+	case OMAP_TIMER_SRC_SYS_CLK:
+		parent_name = "sys_ck";
+		break;
+
+	case OMAP_TIMER_SRC_32_KHZ:
+		parent_name = "32k_ck";
+		break;
+
+	case OMAP_TIMER_SRC_EXT_CLK:
+		parent_name = "alt_ck";
+		break;
+	}
+
+	parent = clk_get(&timer->pdev->dev, parent_name);
+	if (IS_ERR_OR_NULL(parent)) {
+		pr_err("%s: %s not found\n", __func__, parent_name);
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret = clk_set_parent(fclk, parent);
+	if (IS_ERR_VALUE(ret))
+		pr_err("%s: failed to set %s as parent\n", __func__,
+			parent_name);
+
+	clk_put(parent);
+out:
+	clk_put(fclk);
 
 	return ret;
 }
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index c039e84..19e7fa5 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -90,6 +90,7 @@ struct timer_regs {
 };
 
 struct dmtimer_platform_data {
+	/* set_timer_src - Only used for OMAP1 devices */
 	int (*set_timer_src)(struct platform_device *pdev, int source);
 	u32 timer_capability;
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V4 12/12] ARM: OMAP2+: Simplify dmtimer clock aliases
  2012-06-05 17:34 [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree Jon Hunter
                   ` (10 preceding siblings ...)
  2012-06-05 17:34 ` [PATCH V4 11/12] ARM: OMAP2+: Move dmtimer clock set function to dmtimer driver Jon Hunter
@ 2012-06-05 17:35 ` Jon Hunter
  2012-06-14 20:31   ` Paul Walmsley
  2012-06-16  1:38   ` Paul Walmsley
  11 siblings, 2 replies; 21+ messages in thread
From: Jon Hunter @ 2012-06-05 17:35 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Tarun Kanti DebBarma, Jon Hunter

The OMAP dmtimer driver allows you to dynamically configure the functional
clock that drives the timer logic. The dmtimer driver uses the device name and
a "con-id" string to search for the appropriate functional clock.

Currently, we define a clock alias for each functional clock source each timer
supports. Some functional clock sources are common to all of the timers on a
device and so for these clock sources we can use a single alias with a unique
con-id string.

The possible functional clock sources for an OMAP device are a 32kHz clock,
a system (MHz range) clock and (for OMAP2 only) an external clock. By defining
a unique con-id name for each of these (timer_32k_ck, timer_sys_ck and
timer_ext_ck) we can eliminate a lot of the clock aliases for timers. This
reduces code, speeds-up searches and clock initialisation time.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 arch/arm/mach-omap2/clock2420_data.c |   39 +++-------------------------------
 arch/arm/mach-omap2/clock2430_data.c |   39 +++-------------------------------
 arch/arm/mach-omap2/clock3xxx_data.c |   26 ++---------------------
 arch/arm/mach-omap2/clock44xx_data.c |   34 +++++++++++------------------
 arch/arm/plat-omap/dmtimer.c         |    6 +++---
 5 files changed, 23 insertions(+), 121 deletions(-)

diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index bace930..861767e 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -1901,42 +1901,9 @@ static struct omap_clk omap2420_clks[] = {
 	CLK(NULL,	"pka_ick",	&pka_ick,	CK_242X),
 	CLK(NULL,	"usb_fck",	&usb_fck,	CK_242X),
 	CLK("musb-hdrc",	"fck",	&osc_ck,	CK_242X),
-	CLK("omap_timer.1",	"32k_ck",	&func_32k_ck,	CK_243X),
-	CLK("omap_timer.2",	"32k_ck",	&func_32k_ck,	CK_243X),
-	CLK("omap_timer.3",	"32k_ck",	&func_32k_ck,	CK_243X),
-	CLK("omap_timer.4",	"32k_ck",	&func_32k_ck,	CK_243X),
-	CLK("omap_timer.5",	"32k_ck",	&func_32k_ck,	CK_243X),
-	CLK("omap_timer.6",	"32k_ck",	&func_32k_ck,	CK_243X),
-	CLK("omap_timer.7",	"32k_ck",	&func_32k_ck,	CK_243X),
-	CLK("omap_timer.8",	"32k_ck",	&func_32k_ck,	CK_243X),
-	CLK("omap_timer.9",	"32k_ck",	&func_32k_ck,	CK_243X),
-	CLK("omap_timer.10",	"32k_ck",	&func_32k_ck,	CK_243X),
-	CLK("omap_timer.11",	"32k_ck",	&func_32k_ck,	CK_243X),
-	CLK("omap_timer.12",	"32k_ck",	&func_32k_ck,	CK_243X),
-	CLK("omap_timer.1",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.2",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.3",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.4",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.5",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.6",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.7",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.8",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.9",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.10",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.11",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.12",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.1",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.2",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.3",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.4",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.5",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.6",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.7",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.8",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.9",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.10",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.11",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.12",	"alt_ck",	&alt_ck,	CK_243X),
+	CLK(NULL,	"timer_32k_ck",	&func_32k_ck,	CK_243X),
+	CLK(NULL,	"timer_sys_ck",	&sys_ck,	CK_243X),
+	CLK(NULL,	"timer_ext_ck",	&alt_ck,	CK_243X),
 };
 
 /*
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
index 3b4d09a..5577810 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -2000,42 +2000,9 @@ static struct omap_clk omap2430_clks[] = {
 	CLK(NULL,	"mdm_intc_ick",	&mdm_intc_ick,	CK_243X),
 	CLK("omap_hsmmc.0", "mmchsdb_fck",	&mmchsdb1_fck,	CK_243X),
 	CLK("omap_hsmmc.1", "mmchsdb_fck",	&mmchsdb2_fck,	CK_243X),
-	CLK("omap_timer.1",	"32k_ck",  &func_32k_ck,   CK_243X),
-	CLK("omap_timer.2",	"32k_ck",  &func_32k_ck,   CK_243X),
-	CLK("omap_timer.3",	"32k_ck",  &func_32k_ck,   CK_243X),
-	CLK("omap_timer.4",	"32k_ck",  &func_32k_ck,   CK_243X),
-	CLK("omap_timer.5",	"32k_ck",  &func_32k_ck,   CK_243X),
-	CLK("omap_timer.6",	"32k_ck",  &func_32k_ck,   CK_243X),
-	CLK("omap_timer.7",	"32k_ck",  &func_32k_ck,   CK_243X),
-	CLK("omap_timer.8",	"32k_ck",  &func_32k_ck,   CK_243X),
-	CLK("omap_timer.9",	"32k_ck",  &func_32k_ck,   CK_243X),
-	CLK("omap_timer.10",	"32k_ck",  &func_32k_ck,   CK_243X),
-	CLK("omap_timer.11",	"32k_ck",  &func_32k_ck,   CK_243X),
-	CLK("omap_timer.12",	"32k_ck",  &func_32k_ck,   CK_243X),
-	CLK("omap_timer.1",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.2",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.3",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.4",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.5",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.6",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.7",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.8",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.9",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.10",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.11",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.12",	"sys_ck",	&sys_ck,	CK_243X),
-	CLK("omap_timer.1",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.2",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.3",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.4",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.5",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.6",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.7",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.8",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.9",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.10",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.11",	"alt_ck",	&alt_ck,	CK_243X),
-	CLK("omap_timer.12",	"alt_ck",	&alt_ck,	CK_243X),
+	CLK(NULL,	"timer_32k_ck",  &func_32k_ck,   CK_243X),
+	CLK(NULL,	"timer_sys_ck",	&sys_ck,	CK_243X),
+	CLK(NULL,	"timer_ext_ck",	&alt_ck,	CK_243X),
 };
 
 /*
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index 1efdec2..0d81462 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3482,30 +3482,8 @@ static struct omap_clk omap3xxx_clks[] = {
 	CLK("musb-am35x",	"fck",		&hsotgusb_fck_am35xx,	CK_AM35XX),
 	CLK(NULL,	"hecc_ck",	&hecc_ck,	CK_AM35XX),
 	CLK(NULL,	"uart4_ick",	&uart4_ick_am35xx,	CK_AM35XX),
-	CLK("omap_timer.1",	"32k_ck",	&omap_32k_fck,  CK_3XXX),
-	CLK("omap_timer.2",	"32k_ck",	&omap_32k_fck,  CK_3XXX),
-	CLK("omap_timer.3",	"32k_ck",	&omap_32k_fck,  CK_3XXX),
-	CLK("omap_timer.4",	"32k_ck",	&omap_32k_fck,  CK_3XXX),
-	CLK("omap_timer.5",	"32k_ck",	&omap_32k_fck,  CK_3XXX),
-	CLK("omap_timer.6",	"32k_ck",	&omap_32k_fck,  CK_3XXX),
-	CLK("omap_timer.7",	"32k_ck",	&omap_32k_fck,  CK_3XXX),
-	CLK("omap_timer.8",	"32k_ck",	&omap_32k_fck,  CK_3XXX),
-	CLK("omap_timer.9",	"32k_ck",	&omap_32k_fck,  CK_3XXX),
-	CLK("omap_timer.10",	"32k_ck",	&omap_32k_fck,  CK_3XXX),
-	CLK("omap_timer.11",	"32k_ck",	&omap_32k_fck,  CK_3XXX),
-	CLK("omap_timer.12",	"32k_ck",	&omap_32k_fck,  CK_3XXX),
-	CLK("omap_timer.1",	"sys_ck",	&sys_ck,	CK_3XXX),
-	CLK("omap_timer.2",	"sys_ck",	&sys_ck,	CK_3XXX),
-	CLK("omap_timer.3",	"sys_ck",	&sys_ck,	CK_3XXX),
-	CLK("omap_timer.4",	"sys_ck",	&sys_ck,	CK_3XXX),
-	CLK("omap_timer.5",	"sys_ck",	&sys_ck,	CK_3XXX),
-	CLK("omap_timer.6",	"sys_ck",	&sys_ck,	CK_3XXX),
-	CLK("omap_timer.7",	"sys_ck",	&sys_ck,	CK_3XXX),
-	CLK("omap_timer.8",	"sys_ck",	&sys_ck,	CK_3XXX),
-	CLK("omap_timer.9",	"sys_ck",	&sys_ck,	CK_3XXX),
-	CLK("omap_timer.10",	"sys_ck",	&sys_ck,	CK_3XXX),
-	CLK("omap_timer.11",	"sys_ck",	&sys_ck,	CK_3XXX),
-	CLK("omap_timer.12",	"sys_ck",	&sys_ck,	CK_3XXX),
+	CLK(NULL,	"timer_32k_ck",	&omap_32k_fck,  CK_3XXX),
+	CLK(NULL,	"timer_sys_ck",	&sys_ck,	CK_3XXX),
 };
 
 
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 2172f66..51f7424 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3380,28 +3380,18 @@ static struct omap_clk omap44xx_clks[] = {
 	CLK("usbhs_omap",	"usbhost_ick",		&dummy_ck,		CK_443X),
 	CLK("usbhs_omap",	"usbtll_fck",		&dummy_ck,	CK_443X),
 	CLK("omap_wdt",	"ick",				&dummy_ck,	CK_443X),
-	CLK("omap_timer.1",	"32k_ck",	&sys_32k_ck,	CK_443X),
-	CLK("omap_timer.2",	"32k_ck",	&sys_32k_ck,	CK_443X),
-	CLK("omap_timer.3",	"32k_ck",	&sys_32k_ck,	CK_443X),
-	CLK("omap_timer.4",	"32k_ck",	&sys_32k_ck,	CK_443X),
-	CLK("omap_timer.5",	"32k_ck",	&sys_32k_ck,	CK_443X),
-	CLK("omap_timer.6",	"32k_ck",	&sys_32k_ck,	CK_443X),
-	CLK("omap_timer.7",	"32k_ck",	&sys_32k_ck,	CK_443X),
-	CLK("omap_timer.8",	"32k_ck",	&sys_32k_ck,	CK_443X),
-	CLK("omap_timer.9",	"32k_ck",	&sys_32k_ck,	CK_443X),
-	CLK("omap_timer.10",	"32k_ck",	&sys_32k_ck,	CK_443X),
-	CLK("omap_timer.11",	"32k_ck",	&sys_32k_ck,	CK_443X),
-	CLK("omap_timer.1",	"sys_ck",	&sys_clkin_ck,	CK_443X),
-	CLK("omap_timer.2",	"sys_ck",	&sys_clkin_ck,	CK_443X),
-	CLK("omap_timer.3",	"sys_ck",	&sys_clkin_ck,	CK_443X),
-	CLK("omap_timer.4",	"sys_ck",	&sys_clkin_ck,	CK_443X),
-	CLK("omap_timer.9",	"sys_ck",	&sys_clkin_ck,	CK_443X),
-	CLK("omap_timer.10",	"sys_ck",	&sys_clkin_ck,	CK_443X),
-	CLK("omap_timer.11",	"sys_ck",	&sys_clkin_ck,	CK_443X),
-	CLK("omap_timer.5",	"sys_ck",	&syc_clk_div_ck,	CK_443X),
-	CLK("omap_timer.6",	"sys_ck",	&syc_clk_div_ck,	CK_443X),
-	CLK("omap_timer.7",	"sys_ck",	&syc_clk_div_ck,	CK_443X),
-	CLK("omap_timer.8",	"sys_ck",	&syc_clk_div_ck,	CK_443X),
+	CLK(NULL,	"timer_32k_ck",	&sys_32k_ck,	CK_443X),
+	CLK("omap_timer.1",	"timer_sys_ck",	&sys_clkin_ck,	CK_443X),
+	CLK("omap_timer.2",	"timer_sys_ck",	&sys_clkin_ck,	CK_443X),
+	CLK("omap_timer.3",	"timer_sys_ck",	&sys_clkin_ck,	CK_443X),
+	CLK("omap_timer.4",	"timer_sys_ck",	&sys_clkin_ck,	CK_443X),
+	CLK("omap_timer.9",	"timer_sys_ck",	&sys_clkin_ck,	CK_443X),
+	CLK("omap_timer.10",	"timer_sys_ck",	&sys_clkin_ck,	CK_443X),
+	CLK("omap_timer.11",	"timer_sys_ck",	&sys_clkin_ck,	CK_443X),
+	CLK("omap_timer.5",	"timer_sys_ck",	&syc_clk_div_ck,	CK_443X),
+	CLK("omap_timer.6",	"timer_sys_ck",	&syc_clk_div_ck,	CK_443X),
+	CLK("omap_timer.7",	"timer_sys_ck",	&syc_clk_div_ck,	CK_443X),
+	CLK("omap_timer.8",	"timer_sys_ck",	&syc_clk_div_ck,	CK_443X),
 };
 
 int __init omap4xxx_clk_init(void)
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 6a70889..54ed4e6 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -425,15 +425,15 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
 
 	switch (source) {
 	case OMAP_TIMER_SRC_SYS_CLK:
-		parent_name = "sys_ck";
+		parent_name = "timer_sys_ck";
 		break;
 
 	case OMAP_TIMER_SRC_32_KHZ:
-		parent_name = "32k_ck";
+		parent_name = "timer_32k_ck";
 		break;
 
 	case OMAP_TIMER_SRC_EXT_CLK:
-		parent_name = "alt_ck";
+		parent_name = "timer_ext_ck";
 		break;
 	}
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH V4 05/12] ARM: OMAP2+: HWMOD: Correct timer device attributes
  2012-06-05 17:34 ` [PATCH V4 05/12] ARM: OMAP2+: HWMOD: Correct timer device attributes Jon Hunter
@ 2012-06-08  7:40   ` Tony Lindgren
  2012-06-13 23:53     ` Paul Walmsley
  2012-06-13 23:53   ` Paul Walmsley
  1 sibling, 1 reply; 21+ messages in thread
From: Tony Lindgren @ 2012-06-08  7:40 UTC (permalink / raw)
  To: Paul Walmsley, Jon Hunter; +Cc: linux-omap, Tarun Kanti DebBarma

Paul,

* Jon Hunter <jon-hunter@ti.com> [120605 10:39]:
> Fix the following issues with the timer device attributes for OMAP2+ devices:
> 
> 1. For OMAP24xx devices, timers 2-8 have the ALWAYS-ON attribute indicating
>    that these timers are in an ALWAYS-ON power domain. This is not the case
>    only timer1 is in an ALWAYS-ON power domain.
> 2. For OMAP3xxx devices, timers 2-7 have the ALWAYS-ON attribute indicating
>    that these timers are in an ALWAYS-ON power domain. This is not the case
>    only timer1 and timer12 are in an ALWAYS-ON power domain.
> 3. For OMAP3xxx devices, timer12 does not have the ALWAYS-ON attribute but
>    is in an always-on power domain.

Care to review and potentially ack the hwmod parts of this series?

We should try to merge this early into linux-omap master for testing.

Regards,

Tony
 
> Signed-off-by: Jon Hunter <jon-hunter@ti.com>
> ---
>  arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c |    7 -------
>  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c         |    8 +-------
>  arch/arm/mach-omap2/omap_hwmod_44xx_data.c         |    6 ------
>  3 files changed, 1 insertion(+), 20 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
> index 83eafd9..7814e83 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
> @@ -257,7 +257,6 @@ struct omap_hwmod omap2xxx_timer2_hwmod = {
>  			.idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  	.class		= &omap2xxx_timer_hwmod_class,
>  };
>  
> @@ -276,7 +275,6 @@ struct omap_hwmod omap2xxx_timer3_hwmod = {
>  			.idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  	.class		= &omap2xxx_timer_hwmod_class,
>  };
>  
> @@ -295,7 +293,6 @@ struct omap_hwmod omap2xxx_timer4_hwmod = {
>  			.idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  	.class		= &omap2xxx_timer_hwmod_class,
>  };
>  
> @@ -314,7 +311,6 @@ struct omap_hwmod omap2xxx_timer5_hwmod = {
>  			.idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  	.class		= &omap2xxx_timer_hwmod_class,
>  };
>  
> @@ -333,7 +329,6 @@ struct omap_hwmod omap2xxx_timer6_hwmod = {
>  			.idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  	.class		= &omap2xxx_timer_hwmod_class,
>  };
>  
> @@ -352,7 +347,6 @@ struct omap_hwmod omap2xxx_timer7_hwmod = {
>  			.idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  	.class		= &omap2xxx_timer_hwmod_class,
>  };
>  
> @@ -371,7 +365,6 @@ struct omap_hwmod omap2xxx_timer8_hwmod = {
>  			.idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  	.class		= &omap2xxx_timer_hwmod_class,
>  };
>  
> diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
> index b26d3c9..7b33094 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
> @@ -150,7 +150,7 @@ static struct omap_hwmod_class omap3xxx_timer_hwmod_class = {
>  
>  /* secure timers dev attribute */
>  static struct omap_timer_capability_dev_attr capability_secure_dev_attr = {
> -	.timer_capability	= OMAP_TIMER_SECURE,
> +	.timer_capability	= OMAP_TIMER_ALWON | OMAP_TIMER_SECURE,
>  };
>  
>  /* always-on timers dev attribute */
> @@ -195,7 +195,6 @@ static struct omap_hwmod omap3xxx_timer2_hwmod = {
>  			.idlest_idle_bit = OMAP3430_ST_GPT2_SHIFT,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  	.class		= &omap3xxx_timer_1ms_hwmod_class,
>  };
>  
> @@ -213,7 +212,6 @@ static struct omap_hwmod omap3xxx_timer3_hwmod = {
>  			.idlest_idle_bit = OMAP3430_ST_GPT3_SHIFT,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  	.class		= &omap3xxx_timer_hwmod_class,
>  };
>  
> @@ -231,7 +229,6 @@ static struct omap_hwmod omap3xxx_timer4_hwmod = {
>  			.idlest_idle_bit = OMAP3430_ST_GPT4_SHIFT,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  	.class		= &omap3xxx_timer_hwmod_class,
>  };
>  
> @@ -249,7 +246,6 @@ static struct omap_hwmod omap3xxx_timer5_hwmod = {
>  			.idlest_idle_bit = OMAP3430_ST_GPT5_SHIFT,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  	.class		= &omap3xxx_timer_hwmod_class,
>  };
>  
> @@ -267,7 +263,6 @@ static struct omap_hwmod omap3xxx_timer6_hwmod = {
>  			.idlest_idle_bit = OMAP3430_ST_GPT6_SHIFT,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  	.class		= &omap3xxx_timer_hwmod_class,
>  };
>  
> @@ -285,7 +280,6 @@ static struct omap_hwmod omap3xxx_timer7_hwmod = {
>  			.idlest_idle_bit = OMAP3430_ST_GPT7_SHIFT,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  	.class		= &omap3xxx_timer_hwmod_class,
>  };
>  
> diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> index 950454a..ebf9657 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> @@ -2943,7 +2943,6 @@ static struct omap_hwmod omap44xx_timer2_hwmod = {
>  			.modulemode   = MODULEMODE_SWCTRL,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  };
>  
>  /* timer3 */
> @@ -2965,7 +2964,6 @@ static struct omap_hwmod omap44xx_timer3_hwmod = {
>  			.modulemode   = MODULEMODE_SWCTRL,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  };
>  
>  /* timer4 */
> @@ -2987,7 +2985,6 @@ static struct omap_hwmod omap44xx_timer4_hwmod = {
>  			.modulemode   = MODULEMODE_SWCTRL,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  };
>  
>  /* timer5 */
> @@ -3009,7 +3006,6 @@ static struct omap_hwmod omap44xx_timer5_hwmod = {
>  			.modulemode   = MODULEMODE_SWCTRL,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  };
>  
>  /* timer6 */
> @@ -3032,7 +3028,6 @@ static struct omap_hwmod omap44xx_timer6_hwmod = {
>  			.modulemode   = MODULEMODE_SWCTRL,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  };
>  
>  /* timer7 */
> @@ -3054,7 +3049,6 @@ static struct omap_hwmod omap44xx_timer7_hwmod = {
>  			.modulemode   = MODULEMODE_SWCTRL,
>  		},
>  	},
> -	.dev_attr	= &capability_alwon_dev_attr,
>  };
>  
>  /* timer8 */
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V4 05/12] ARM: OMAP2+: HWMOD: Correct timer device attributes
  2012-06-05 17:34 ` [PATCH V4 05/12] ARM: OMAP2+: HWMOD: Correct timer device attributes Jon Hunter
  2012-06-08  7:40   ` Tony Lindgren
@ 2012-06-13 23:53   ` Paul Walmsley
  1 sibling, 0 replies; 21+ messages in thread
From: Paul Walmsley @ 2012-06-13 23:53 UTC (permalink / raw)
  To: Tony Lindgren, Jon Hunter; +Cc: linux-omap, Tarun Kanti DebBarma

On Tue, 5 Jun 2012, Jon Hunter wrote:

> Fix the following issues with the timer device attributes for OMAP2+ devices:
> 
> 1. For OMAP24xx devices, timers 2-8 have the ALWAYS-ON attribute indicating
>    that these timers are in an ALWAYS-ON power domain. This is not the case
>    only timer1 is in an ALWAYS-ON power domain.
> 2. For OMAP3xxx devices, timers 2-7 have the ALWAYS-ON attribute indicating
>    that these timers are in an ALWAYS-ON power domain. This is not the case
>    only timer1 and timer12 are in an ALWAYS-ON power domain.
> 3. For OMAP3xxx devices, timer12 does not have the ALWAYS-ON attribute but
>    is in an always-on power domain.
> 
> Signed-off-by: Jon Hunter <jon-hunter@ti.com>

Thanks Jon.

Acked-by: Paul Walmsley <paul@pwsan.com>


- Paul

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V4 05/12] ARM: OMAP2+: HWMOD: Correct timer device attributes
  2012-06-08  7:40   ` Tony Lindgren
@ 2012-06-13 23:53     ` Paul Walmsley
  2012-06-14  9:44       ` Tony Lindgren
  0 siblings, 1 reply; 21+ messages in thread
From: Paul Walmsley @ 2012-06-13 23:53 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Jon Hunter, linux-omap, Tarun Kanti DebBarma

On Fri, 8 Jun 2012, Tony Lindgren wrote:

> Care to review and potentially ack the hwmod parts of this series?

Done.

- Paul

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V4 05/12] ARM: OMAP2+: HWMOD: Correct timer device attributes
  2012-06-13 23:53     ` Paul Walmsley
@ 2012-06-14  9:44       ` Tony Lindgren
  0 siblings, 0 replies; 21+ messages in thread
From: Tony Lindgren @ 2012-06-14  9:44 UTC (permalink / raw)
  To: Paul Walmsley; +Cc: Jon Hunter, linux-omap, Tarun Kanti DebBarma

* Paul Walmsley <paul@pwsan.com> [120613 16:58]:
> On Fri, 8 Jun 2012, Tony Lindgren wrote:
> 
> > Care to review and potentially ack the hwmod parts of this series?
> 
> Done.

Thanks I'll apply these into devel-dmtimer branch for v3.6 merge window,
and will merge into linux-omap master branch for more testing.

Regards,

Tony

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V4 12/12] ARM: OMAP2+: Simplify dmtimer clock aliases
  2012-06-05 17:35 ` [PATCH V4 12/12] ARM: OMAP2+: Simplify dmtimer clock aliases Jon Hunter
@ 2012-06-14 20:31   ` Paul Walmsley
  2012-06-15 15:27     ` Jon Hunter
  2012-06-16  1:38   ` Paul Walmsley
  1 sibling, 1 reply; 21+ messages in thread
From: Paul Walmsley @ 2012-06-14 20:31 UTC (permalink / raw)
  To: Jon Hunter; +Cc: linux-omap, Tony Lindgren, Tarun Kanti DebBarma

Hi Jon

On Tue, 5 Jun 2012, Jon Hunter wrote:

> The OMAP dmtimer driver allows you to dynamically configure the functional
> clock that drives the timer logic. The dmtimer driver uses the device name and
> a "con-id" string to search for the appropriate functional clock.
> 
> Currently, we define a clock alias for each functional clock source each timer
> supports. Some functional clock sources are common to all of the timers on a
> device and so for these clock sources we can use a single alias with a unique
> con-id string.
> 
> The possible functional clock sources for an OMAP device are a 32kHz clock,
> a system (MHz range) clock and (for OMAP2 only) an external clock. By defining
> a unique con-id name for each of these (timer_32k_ck, timer_sys_ck and
> timer_ext_ck) we can eliminate a lot of the clock aliases for timers. This
> reduces code, speeds-up searches and clock initialisation time.
> 
> Signed-off-by: Jon Hunter <jon-hunter@ti.com>

Sorry to make you change this, but how about adding the optional clock 
aliases to the hwmod data instead?

So rather than:

> +	CLK(NULL,	"timer_32k_ck",	&func_32k_ck,	CK_243X),
> +	CLK(NULL,	"timer_sys_ck",	&sys_ck,	CK_243X),
> +	CLK(NULL,	"timer_ext_ck",	&alt_ck,	CK_243X),

add something like (rough example):

static struct omap_hwmod_opt_clk timer_opt_clks[] = {
	{ .role = "32k", .clk = "func_32k_ck" },
	{ .role = "sys", .clk = "sys_ck" },
	{ .role = "alt", .clk = "alt_ck" },
};

and then add the .opt_clks and .opt_clks_cnt fields to the struct 
omap_hwmod records; see for example omap44xx_dss_hwmod.

Doing it this way will remove the clkdev entries, which we're trying to 
get rid of.  I hope also that these should be auto-generatable from the 
hardware data at some point.  And adding the opt_clk data should result in 
a faster search time for these aliases, since only the omap_hwmod_opt_clk 
records would need to be iterated over, rather than the clkdev data which 
is quite a bit larger.


regards,

- Paul

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V4 12/12] ARM: OMAP2+: Simplify dmtimer clock aliases
  2012-06-14 20:31   ` Paul Walmsley
@ 2012-06-15 15:27     ` Jon Hunter
  2012-06-16  1:34       ` Paul Walmsley
  0 siblings, 1 reply; 21+ messages in thread
From: Jon Hunter @ 2012-06-15 15:27 UTC (permalink / raw)
  To: Paul Walmsley; +Cc: linux-omap, Tony Lindgren, Tarun Kanti DebBarma

Hi Paul,

On 06/14/2012 03:31 PM, Paul Walmsley wrote:
> Hi Jon
> 
> On Tue, 5 Jun 2012, Jon Hunter wrote:
> 
>> The OMAP dmtimer driver allows you to dynamically configure the functional
>> clock that drives the timer logic. The dmtimer driver uses the device name and
>> a "con-id" string to search for the appropriate functional clock.
>>
>> Currently, we define a clock alias for each functional clock source each timer
>> supports. Some functional clock sources are common to all of the timers on a
>> device and so for these clock sources we can use a single alias with a unique
>> con-id string.
>>
>> The possible functional clock sources for an OMAP device are a 32kHz clock,
>> a system (MHz range) clock and (for OMAP2 only) an external clock. By defining
>> a unique con-id name for each of these (timer_32k_ck, timer_sys_ck and
>> timer_ext_ck) we can eliminate a lot of the clock aliases for timers. This
>> reduces code, speeds-up searches and clock initialisation time.
>>
>> Signed-off-by: Jon Hunter <jon-hunter@ti.com>
> 
> Sorry to make you change this, but how about adding the optional clock 
> aliases to the hwmod data instead?

Yes, we can do. However, technically these are not optional clocks but
parents clocks. So if you are ok with that we can.

> So rather than:
> 
>> +	CLK(NULL,	"timer_32k_ck",	&func_32k_ck,	CK_243X),
>> +	CLK(NULL,	"timer_sys_ck",	&sys_ck,	CK_243X),
>> +	CLK(NULL,	"timer_ext_ck",	&alt_ck,	CK_243X),
> 
> add something like (rough example):
> 
> static struct omap_hwmod_opt_clk timer_opt_clks[] = {
> 	{ .role = "32k", .clk = "func_32k_ck" },
> 	{ .role = "sys", .clk = "sys_ck" },
> 	{ .role = "alt", .clk = "alt_ck" },
> };
> 
> and then add the .opt_clks and .opt_clks_cnt fields to the struct 
> omap_hwmod records; see for example omap44xx_dss_hwmod.
> 
> Doing it this way will remove the clkdev entries, which we're trying to 
> get rid of.  I hope also that these should be auto-generatable from the 
> hardware data at some point.  And adding the opt_clk data should result in 
> a faster search time for these aliases, since only the omap_hwmod_opt_clk 
> records would need to be iterated over, rather than the clkdev data which 
> is quite a bit larger.

Ok, but what it not clear to me is how I retrieve the clock handle from
the driver. Is there an API I can use to retrieve the optional clocks
using the device structure? In other words, similar to clk_get()?

Cheers
Jon

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V4 12/12] ARM: OMAP2+: Simplify dmtimer clock aliases
  2012-06-15 15:27     ` Jon Hunter
@ 2012-06-16  1:34       ` Paul Walmsley
  0 siblings, 0 replies; 21+ messages in thread
From: Paul Walmsley @ 2012-06-16  1:34 UTC (permalink / raw)
  To: Jon Hunter; +Cc: linux-omap, Tony Lindgren, Tarun Kanti DebBarma

On Fri, 15 Jun 2012, Jon Hunter wrote:

> On 06/14/2012 03:31 PM, Paul Walmsley wrote:
> 
> > Sorry to make you change this, but how about adding the optional clock 
> > aliases to the hwmod data instead?
> 
> Yes, we can do. However, technically these are not optional clocks but
> parents clocks. So if you are ok with that we can.

OK.  The hwmod optional clocks weren't intended to map directly to the 
OMAP4 notion of optional clocks.  But sounds like this would require a bit 
more thought.  So let's go with your original patch.  Will ack it after 
sending this.

> Ok, but what it not clear to me is how I retrieve the clock handle from
> the driver. Is there an API I can use to retrieve the optional clocks
> using the device structure? In other words, similar to clk_get()?

It works via clk_get(), so using the hwmod optional clocks would require 
no driver changes.


- Paul

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V4 12/12] ARM: OMAP2+: Simplify dmtimer clock aliases
  2012-06-05 17:35 ` [PATCH V4 12/12] ARM: OMAP2+: Simplify dmtimer clock aliases Jon Hunter
  2012-06-14 20:31   ` Paul Walmsley
@ 2012-06-16  1:38   ` Paul Walmsley
  1 sibling, 0 replies; 21+ messages in thread
From: Paul Walmsley @ 2012-06-16  1:38 UTC (permalink / raw)
  To: Jon Hunter; +Cc: linux-omap, Tony Lindgren, Tarun Kanti DebBarma

On Tue, 5 Jun 2012, Jon Hunter wrote:

> The OMAP dmtimer driver allows you to dynamically configure the functional
> clock that drives the timer logic. The dmtimer driver uses the device name and
> a "con-id" string to search for the appropriate functional clock.
> 
> Currently, we define a clock alias for each functional clock source each timer
> supports. Some functional clock sources are common to all of the timers on a
> device and so for these clock sources we can use a single alias with a unique
> con-id string.
> 
> The possible functional clock sources for an OMAP device are a 32kHz clock,
> a system (MHz range) clock and (for OMAP2 only) an external clock. By defining
> a unique con-id name for each of these (timer_32k_ck, timer_sys_ck and
> timer_ext_ck) we can eliminate a lot of the clock aliases for timers. This
> reduces code, speeds-up searches and clock initialisation time.
> 
> Signed-off-by: Jon Hunter <jon-hunter@ti.com>

Acked-by: Paul Walmsley <paul@pwsan.com>

At some point we should probably investigate moving these aliases into the 
hwmod optional clocks, but this requires more thought.


- Paul

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2012-06-16  1:38 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-05 17:34 [PATCH V4 00/12] ARM: OMAP: DMTIMER clean-up and fixes in preparation for device-tree Jon Hunter
2012-06-05 17:34 ` [PATCH V4 01/12] ARM: OMAP: Remove unnecessary clk structure Jon Hunter
2012-06-05 17:34 ` [PATCH V4 02/12] ARM: OMAP2+: Remove unused max number of timers definition Jon Hunter
2012-06-05 17:34 ` [PATCH V4 03/12] ARM: OMAP2+: Add dmtimer platform function to reserve systimers Jon Hunter
2012-06-05 17:34 ` [PATCH V4 04/12] ARM: OMAP: Add DMTIMER capability variable to represent timer features Jon Hunter
2012-06-05 17:34 ` [PATCH V4 05/12] ARM: OMAP2+: HWMOD: Correct timer device attributes Jon Hunter
2012-06-08  7:40   ` Tony Lindgren
2012-06-13 23:53     ` Paul Walmsley
2012-06-14  9:44       ` Tony Lindgren
2012-06-13 23:53   ` Paul Walmsley
2012-06-05 17:34 ` [PATCH V4 06/12] ARM: OMAP2+: Fix external clock support for dmtimers Jon Hunter
2012-06-05 17:34 ` [PATCH V4 07/12] ARM: OMAP: Remove loses_context variable from timer platform data Jon Hunter
2012-06-05 17:34 ` [PATCH V4 08/12] ARM: OMAP: Remove timer function pointer for context loss counter Jon Hunter
2012-06-05 17:34 ` [PATCH V4 09/12] ARM: OMAP: Add flag to indicate if a timer needs a manual reset Jon Hunter
2012-06-05 17:34 ` [PATCH V4 10/12] ARM: OMAP1: Fix dmtimer support Jon Hunter
2012-06-05 17:34 ` [PATCH V4 11/12] ARM: OMAP2+: Move dmtimer clock set function to dmtimer driver Jon Hunter
2012-06-05 17:35 ` [PATCH V4 12/12] ARM: OMAP2+: Simplify dmtimer clock aliases Jon Hunter
2012-06-14 20:31   ` Paul Walmsley
2012-06-15 15:27     ` Jon Hunter
2012-06-16  1:34       ` Paul Walmsley
2012-06-16  1:38   ` Paul Walmsley

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.