Skip to contentSkip to conversation

Update clocksource registration

PATCH New Russell King - ARM Linux 10 participants 39 messages Dec 13, 2010 – Dec 20, 2010

Subsystems (15)
lore
Share & tools
lore
#0 lore raw

cover Update clocksource registration

John Stultz notes in his commit:

clocksource: Add clocksource_register_hz/khz interface

How to pick good mult/shift pairs has always been difficult to describe to folks writing clocksource drivers, since it requires careful tradeoffs in adjustment accuracy vs overflow limits.

Now, with the clocks_calc_mult_shift function, its much easier. However, not many clocksources have converted to using that function, and there is still the issue of the max interval length assumption being made by each clocksource driver independently.

So this patch simplifies the registration process by having clocksources be registered with a hz/khz value and the registration function taking care of setting mult/shift.

This should take most of the confusion out of writing a clocksource driver.

Additionally it also keeps the shift size tradeoff (more accuracy vs longer possible nohz times) centralized so the timekeeping core can keep track of the assumptions being made.

This patch series updates all ARM platforms clocksource registration to use the new clocksource_register_hz()/clocksource_register_khz() functions, simplifying the selection of the multiply/shift constants.

#1 lore raw

PATCH 1/24 ARM: AT91: update clock source registration

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-at91/at91rm9200_time.c  |    4 +---
 arch/arm/mach-at91/at91sam926x_time.c |    4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
arch/arm/mach-at91/at91rm9200_time.c +1 -3
index 2500f41..1dd69c8 100644
@@ -101,7 +101,6 @@ static struct clocksource clk32k = {
 	.rating		= 150,
 	.read		= read_clk32k,
 	.mask		= CLOCKSOURCE_MASK(20),
-	.shift		= 10,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -201,8 +200,7 @@ void __init at91rm9200_timer_init(void)
 	clockevents_register_device(&clkevt);
 
 	/* register clocksource */
-	clk32k.mult = clocksource_hz2mult(AT91_SLOW_CLOCK, clk32k.shift);
-	clocksource_register(&clk32k);
+	clocksource_register_hz(&clk32k, AT91_SLOW_CLOCK);
 }
 
 struct sys_timer at91rm9200_timer = {
arch/arm/mach-at91/at91sam926x_time.c +1 -3
index 608a632..4ba8549 100644
@@ -51,7 +51,6 @@ static struct clocksource pit_clk = {
 	.name		= "pit",
 	.rating		= 175,
 	.read		= read_pit_clk,
-	.shift		= 20,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -163,10 +162,9 @@ static void __init at91sam926x_pit_init(void)
 	 * Register clocksource.  The high order bits of PIV are unused,
 	 * so this isn't a 32-bit counter unless we get clockevent irqs.
 	 */
-	pit_clk.mult = clocksource_hz2mult(pit_rate, pit_clk.shift);
 	bits = 12 /* PICNT */ + ilog2(pit_cycle) /* PIV */;
 	pit_clk.mask = CLOCKSOURCE_MASK(bits);
-	clocksource_register(&pit_clk);
+	clocksource_register_hz(&pit_clk, pit_rate);
 
 	/* Set up irq handler */
 	setup_irq(AT91_ID_SYS, &at91sam926x_pit_irq);
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 2/24 ARM: bcmring: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-bcmring/core.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
arch/arm/mach-bcmring/core.c +4 -10
index d3f959e..b91b1b0 100644
@@ -294,7 +294,6 @@ static struct clocksource clocksource_bcmring_timer1 = {
 	.rating = 200,
 	.read = bcmring_get_cycles_timer1,
 	.mask = CLOCKSOURCE_MASK(32),
-	.shift = 20,
 	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -303,7 +302,6 @@ static struct clocksource clocksource_bcmring_timer3 = {
 	.rating = 100,
 	.read = bcmring_get_cycles_timer3,
 	.mask = CLOCKSOURCE_MASK(32),
-	.shift = 20,
 	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -316,10 +314,8 @@ static int __init bcmring_clocksource_init(void)
 	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
 	       TIMER1_VA_BASE + TIMER_CTRL);
 
-	clocksource_bcmring_timer1.mult =
-	    clocksource_khz2mult(TIMER1_FREQUENCY_MHZ * 1000,
-				 clocksource_bcmring_timer1.shift);
-	clocksource_register(&clocksource_bcmring_timer1);
+	clocksource_register_khz(&clocksource_bcmring_timer1,
+				 TIMER1_FREQUENCY_MHZ * 1000);
 
 	/* setup timer3 as free-running clocksource */
 	writel(0, TIMER3_VA_BASE + TIMER_CTRL);
@@ -328,10 +324,8 @@ static int __init bcmring_clocksource_init(void)
 	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
 	       TIMER3_VA_BASE + TIMER_CTRL);
 
-	clocksource_bcmring_timer3.mult =
-	    clocksource_khz2mult(TIMER3_FREQUENCY_KHZ,
-				 clocksource_bcmring_timer3.shift);
-	clocksource_register(&clocksource_bcmring_timer3);
+	clocksource_register_khz(&clocksource_bcmring_timer3,
+				 TIMER3_FREQUENCY_KHZ);
 
 	return 0;
 }
Signature · 1 line
1.6.2.5
#3 lore raw

PATCH 2/24 ARM: bcmring: update clock source registration

Quoted 10 lines

-----Original Message-----
From: Russell King [mailto:rmk at arm.linux.org.uk] On Behalf Of Russell King - ARM Linux
Sent: December 13, 2010 11:16 AM
To: linux-arm-kernel at lists.infradead.org
Cc: Leo Chen; Scott Branden
Subject: [PATCH 02/24] ARM: bcmring: update clock source registration

Quoted 6 lines

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the
divisor shift/mult constants. Switch over to using this new interface.

Changes follow John Stultz' notes from his commit

Quoted 58 lines
---
 arch/arm/mach-bcmring/core.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-bcmring/core.c +0 -0

bcmring/core.c
index d3f959e..b91b1b0 100644

arch/arm/mach-bcmring/core.c +2 -6
@@ -294,7 +294,6 @@ static struct clocksource
 clocksource_bcmring_timer1 = {
 	.rating = 200,
 	.read = bcmring_get_cycles_timer1,
 	.mask = CLOCKSOURCE_MASK(32),
-	.shift = 20,
 	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
 };
@@ -303,7 +302,6 @@ static struct clocksource
 clocksource_bcmring_timer3 = {
 	.rating = 100,
 	.read = bcmring_get_cycles_timer3,
 	.mask = CLOCKSOURCE_MASK(32),
-	.shift = 20,
 	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
 };
@@ -316,10 +314,8 @@ static int __init bcmring_clocksource_init(void)
 	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE |
 TIMER_CTRL_PERIODIC,
 	       TIMER1_VA_BASE + TIMER_CTRL);
 
-	clocksource_bcmring_timer1.mult =
-	    clocksource_khz2mult(TIMER1_FREQUENCY_MHZ * 1000,
-				 clocksource_bcmring_timer1.shift);
-	clocksource_register(&clocksource_bcmring_timer1);
+	clocksource_register_khz(&clocksource_bcmring_timer1,
+				 TIMER1_FREQUENCY_MHZ * 1000);
 
 	/* setup timer3 as free-running clocksource */
arch/arm/mach-bcmring/core.c +2 -4
 	writel(0, TIMER3_VA_BASE + TIMER_CTRL);
@@ -328,10 +324,8 @@ static int __init bcmring_clocksource_init(void)
 	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE |
 TIMER_CTRL_PERIODIC,
 	       TIMER3_VA_BASE + TIMER_CTRL);
 
-	clocksource_bcmring_timer3.mult =
-	    clocksource_khz2mult(TIMER3_FREQUENCY_KHZ,
-				 clocksource_bcmring_timer3.shift);
-	clocksource_register(&clocksource_bcmring_timer3);
+	clocksource_register_khz(&clocksource_bcmring_timer3,
+				 TIMER3_FREQUENCY_KHZ);
 
 	return 0;

}
--
1.6.2.5

#4 lore raw

{PATCH] BCMRING maintainer change (was RE: [PATCH 02/24] ARM: bcmring: update clock source registration)

Hello,

This is second time I submit this patch because there are complains about Leo Chen's email is not valid and reachable.

I am Jiandong Zheng working on BCMRING in Broadcom Canada Ltd. I am replacing Leo Chen (leochen at broadcom.com) as " ARM/BCMRING ARM ARCHITECTURE" and " ARM/BCMRING MTD NAND DRIVER" maintainer from Broadcom as he is no longer the maintainer of these components.

Here is the patch to MAINTAINERS file in linux 2.6.36 about this change.

Subject: [PATCH] Change bcmring Maintainer list.

---
 MAINTAINERS |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
MAINTAINERS +2 -2
index f2a2b8e..8968ba3 100644
@@ -572,14 +572,14 @@ W:	http://maxim.org.za/at91_26.html
 S:	Maintained
 
 ARM/BCMRING ARM ARCHITECTURE
-M:	Leo Chen <[email protected]>
+M:	Jiandong Zheng <[email protected]>
 M:	Scott Branden <[email protected]>
 L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
 S:	Maintained
 F:	arch/arm/mach-bcmring
 
 ARM/BCMRING MTD NAND DRIVER
-M:	Leo Chen <[email protected]>
+M:	Jiandong Zheng <[email protected]>
 M:	Scott Branden <[email protected]>
 L:	linux-mtd at lists.infradead.org
 S:	Maintained
Signature · 4 lines
1.7.1

Thanks,
JD (Jiandong) Zheng
Quoted 8 lines

-----Original Message-----
From: Russell King [mailto:rmk at arm.linux.org.uk] On Behalf Of Russell King - ARM Linux
Sent: December 13, 2010 11:16 AM
To: linux-arm-kernel at lists.infradead.org
Cc: Leo Chen; Scott Branden
Subject: [PATCH 02/24] ARM: bcmring: update clock source registration

Quoted 6 lines

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the
divisor shift/mult constants. Switch over to using this new interface.

Changes follow John Stultz' notes from his commit

Quoted 58 lines
---
 arch/arm/mach-bcmring/core.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-bcmring/core.c +0 -0

bcmring/core.c
index d3f959e..b91b1b0 100644

arch/arm/mach-bcmring/core.c +2 -6
@@ -294,7 +294,6 @@ static struct clocksource
 clocksource_bcmring_timer1 = {
 	.rating = 200,
 	.read = bcmring_get_cycles_timer1,
 	.mask = CLOCKSOURCE_MASK(32),
-	.shift = 20,
 	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
 };
@@ -303,7 +302,6 @@ static struct clocksource
 clocksource_bcmring_timer3 = {
 	.rating = 100,
 	.read = bcmring_get_cycles_timer3,
 	.mask = CLOCKSOURCE_MASK(32),
-	.shift = 20,
 	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
 };
@@ -316,10 +314,8 @@ static int __init bcmring_clocksource_init(void)
 	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE |
 TIMER_CTRL_PERIODIC,
 	       TIMER1_VA_BASE + TIMER_CTRL);
 
-	clocksource_bcmring_timer1.mult =
-	    clocksource_khz2mult(TIMER1_FREQUENCY_MHZ * 1000,
-				 clocksource_bcmring_timer1.shift);
-	clocksource_register(&clocksource_bcmring_timer1);
+	clocksource_register_khz(&clocksource_bcmring_timer1,
+				 TIMER1_FREQUENCY_MHZ * 1000);
 
 	/* setup timer3 as free-running clocksource */
arch/arm/mach-bcmring/core.c +2 -4
 	writel(0, TIMER3_VA_BASE + TIMER_CTRL);
@@ -328,10 +324,8 @@ static int __init bcmring_clocksource_init(void)
 	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE |
 TIMER_CTRL_PERIODIC,
 	       TIMER3_VA_BASE + TIMER_CTRL);
 
-	clocksource_bcmring_timer3.mult =
-	    clocksource_khz2mult(TIMER3_FREQUENCY_KHZ,
-				 clocksource_bcmring_timer3.shift);
-	clocksource_register(&clocksource_bcmring_timer3);
+	clocksource_register_khz(&clocksource_bcmring_timer3,
+				 TIMER3_FREQUENCY_KHZ);
 
 	return 0;

}
--
1.6.2.5

Acked-by
#5 lore raw

{PATCH] BCMRING maintainer change (was RE: [PATCH 02/24] ARM: bcmring: update clock source registration)

Quoted 24 lines

-----Original Message-----
From: JD (Jiandong) Zheng
Sent: December 13, 2010 12:29 PM
To: Russell King - ARM Linux; linux-arm-kernel at lists.infradead.org
Cc: Scott Branden
Subject: {PATCH] BCMRING maintainer change (was RE: [PATCH 02/24] ARM:
bcmring: update clock source registration)

Hello,

This is second time I submit this patch because there are complains about Leo
Chen's email is not valid and reachable.

I am Jiandong Zheng working on BCMRING in Broadcom Canada Ltd. I am replacing
Leo Chen (leochen at broadcom.com) as " ARM/BCMRING ARM ARCHITECTURE" and "
ARM/BCMRING MTD NAND DRIVER" maintainer from Broadcom as he is no longer the
maintainer of these components.

Quoted 4 lines

Here is the patch to MAINTAINERS file in linux 2.6.36 about this change.

Quoted 112 lines

Subject: [PATCH] Change bcmring Maintainer list.

---
 MAINTAINERS |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
MAINTAINERS +2 -2
index f2a2b8e..8968ba3 100644
@@ -572,14 +572,14 @@ W:	http://maxim.org.za/at91_26.html
 S:	Maintained
 
 ARM/BCMRING ARM ARCHITECTURE
-M:	Leo Chen <[email protected]>
+M:	Jiandong Zheng <[email protected]>
 M:	Scott Branden <[email protected]>
 L:	linux-arm-kernel at lists.infradead.org (moderated for non-
 subscribers)
 S:	Maintained
 F:	arch/arm/mach-bcmring
 
 ARM/BCMRING MTD NAND DRIVER
-M:	Leo Chen <[email protected]>
+M:	Jiandong Zheng <[email protected]>
 M:	Scott Branden <[email protected]>
 L:	linux-mtd at lists.infradead.org

S: Maintained
--
1.7.1

Thanks,
JD (Jiandong) Zheng

Quoted 9 lines

-----Original Message-----
From: Russell King [mailto:rmk at arm.linux.org.uk] On Behalf Of Russell King - ARM Linux
Sent: December 13, 2010 11:16 AM
To: linux-arm-kernel at lists.infradead.org
Cc: Leo Chen; Scott Branden
Subject: [PATCH 02/24] ARM: bcmring: update clock source registration

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface)

new

Quoted 3 lines

interfaces were added which simplify (and optimize) the selection of the
divisor shift/mult constants. Switch over to using this new

interface.

Quoted 2 lines

Changes follow John Stultz' notes from his commit

Quoted 58 lines
---
 arch/arm/mach-bcmring/core.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-bcmring/core.c +0 -0

bcmring/core.c
index d3f959e..b91b1b0 100644

arch/arm/mach-bcmring/core.c +2 -6
@@ -294,7 +294,6 @@ static struct clocksource
 clocksource_bcmring_timer1 = {
 	.rating = 200,
 	.read = bcmring_get_cycles_timer1,
 	.mask = CLOCKSOURCE_MASK(32),
-	.shift = 20,
 	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
 };
@@ -303,7 +302,6 @@ static struct clocksource
 clocksource_bcmring_timer3 = {
 	.rating = 100,
 	.read = bcmring_get_cycles_timer3,
 	.mask = CLOCKSOURCE_MASK(32),
-	.shift = 20,
 	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
 };
@@ -316,10 +314,8 @@ static int __init bcmring_clocksource_init(void)
 	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE |
 TIMER_CTRL_PERIODIC,
 	       TIMER1_VA_BASE + TIMER_CTRL);
 
-	clocksource_bcmring_timer1.mult =
-	    clocksource_khz2mult(TIMER1_FREQUENCY_MHZ * 1000,
-				 clocksource_bcmring_timer1.shift);
-	clocksource_register(&clocksource_bcmring_timer1);
+	clocksource_register_khz(&clocksource_bcmring_timer1,
+				 TIMER1_FREQUENCY_MHZ * 1000);
 
 	/* setup timer3 as free-running clocksource */
arch/arm/mach-bcmring/core.c +2 -4
 	writel(0, TIMER3_VA_BASE + TIMER_CTRL);
@@ -328,10 +324,8 @@ static int __init bcmring_clocksource_init(void)
 	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE |
 TIMER_CTRL_PERIODIC,
 	       TIMER3_VA_BASE + TIMER_CTRL);
 
-	clocksource_bcmring_timer3.mult =
-	    clocksource_khz2mult(TIMER3_FREQUENCY_KHZ,
-				 clocksource_bcmring_timer3.shift);
-	clocksource_register(&clocksource_bcmring_timer3);
+	clocksource_register_khz(&clocksource_bcmring_timer3,
+				 TIMER3_FREQUENCY_KHZ);
 
 	return 0;

}
--
1.6.2.5

author Acked-by Scott Branden
#6 lore raw

{PATCH] BCMRING maintainer change (was RE: [PATCH 02/24] ARM: bcmring: update clock source registration)

In reply to JD (Jiandong) Zheng
Quoted 10 lines · JD (Jiandong) Zheng

Hello,

This is second time I submit this patch because there are complains about Leo Chen's email is not valid and reachable.

I am Jiandong Zheng working on BCMRING in Broadcom Canada Ltd. I am replacing Leo Chen (leochen at broadcom.com) as " ARM/BCMRING ARM ARCHITECTURE" and " ARM/BCMRING MTD NAND DRIVER" maintainer from Broadcom as he is no longer the maintainer of these components.

Quoted 5 lines

Here is the patch to MAINTAINERS file in linux 2.6.36 about this change.

Subject: [PATCH] Change bcmring Maintainer list.

I've commited this manually, to fix up the text of the commit message:

Change bcmring Maintainer list.

I am Jiandong Zheng working on BCMRING in Broadcom Canada Ltd. I am replacing Leo Chen (leochen at broadcom.com) as "ARM/BCMRING ARM ARCHITECTURE" and "ARM/BCMRING MTD NAND DRIVER" maintainer from Broadcom as he is no longer the maintainer of these components.

A few notes for future:

1. don't overflow more than 72 characters, unless you're quoting kernel messages.
2. The patch summary should be in the email subject, so 'git am' can safely parse it.
3. sign-offs should be the last thing before the "---" line before the diffstat.
4. commentry about how many times a patch has been sent, and that this is a patch should go after the "---" line.

#7 lore raw

PATCH 3/24 ARM: davinci: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-davinci/time.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
arch/arm/mach-davinci/time.c +2 -5
index 0f21c36..c148671 100644
@@ -276,7 +276,6 @@ static struct clocksource clocksource_davinci = {
 	.rating		= 300,
 	.read		= read_cycles,
 	.mask		= CLOCKSOURCE_MASK(32),
-	.shift		= 24,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -378,10 +377,8 @@ static void __init davinci_timer_init(void)
 
 	/* setup clocksource */
 	clocksource_davinci.name = id_to_name[clocksource_id];
-	clocksource_davinci.mult =
-		clocksource_khz2mult(davinci_clock_tick_rate/1000,
-				     clocksource_davinci.shift);
-	if (clocksource_register(&clocksource_davinci))
+	if (clocksource_register_hz(&clocksource_davinci,
+				    davinci_clock_tick_rate))
 		printk(err, clocksource_davinci.name);
 
 	/* setup clockevent */
Signature · 1 line
1.6.2.5
#8 lore raw

PATCH 4/24 ARM: integrator: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-integrator/integrator_ap.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/mach-integrator/integrator_ap.c +1 -3
index 548208f..2774df8 100644
@@ -372,7 +372,6 @@ static struct clocksource clocksource_timersp = {
 	.rating		= 200,
 	.read		= timersp_read,
 	.mask		= CLOCKSOURCE_MASK(16),
-	.shift		= 16,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -390,8 +389,7 @@ static void integrator_clocksource_init(u32 khz)
 	writel(ctrl, base + TIMER_CTRL);
 	writel(0xffff, base + TIMER_LOAD);
 
-	cs->mult = clocksource_khz2mult(khz, cs->shift);
-	clocksource_register(cs);
+	clocksource_register_khz(cs, khz);
 }
 
 static void __iomem * const clkevt_base = (void __iomem *)TIMER1_VA_BASE;
Signature · 1 line
1.6.2.5
#9 lore raw

PATCH 5/24 ARM: ixp4xx: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-ixp4xx/common.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/mach-ixp4xx/common.c +1 -5
index 0bce097..82fc003 100644
@@ -411,7 +411,6 @@ static struct clocksource clocksource_ixp4xx = {
 	.rating		= 200,
 	.read		= ixp4xx_get_cycles,
 	.mask		= CLOCKSOURCE_MASK(32),
-	.shift 		= 20,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -419,10 +418,7 @@ unsigned long ixp4xx_timer_freq = FREQ;
 EXPORT_SYMBOL(ixp4xx_timer_freq);
 static void __init ixp4xx_clocksource_init(void)
 {
-	clocksource_ixp4xx.mult =
-		clocksource_hz2mult(ixp4xx_timer_freq,
-				    clocksource_ixp4xx.shift);
-	clocksource_register(&clocksource_ixp4xx);
+	clocksource_register_hz(&clocksource_ixp4xx, ixp4xx_timer_freq);
 }
 
 /*
Signature · 1 line
1.6.2.5
#10 lore raw

PATCH 6/24 ARM: lpc32xx: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-lpc32xx/timer.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
arch/arm/mach-lpc32xx/timer.c +1 -4
index 630dd4a..6162ac3 100644
@@ -38,7 +38,6 @@ static cycle_t lpc32xx_clksrc_read(struct clocksource *cs)
 
 static struct clocksource lpc32xx_clksrc = {
 	.name	= "lpc32xx_clksrc",
-	.shift	= 24,
 	.rating	= 300,
 	.read	= lpc32xx_clksrc_read,
 	.mask	= CLOCKSOURCE_MASK(32),
@@ -171,9 +170,7 @@ static void __init lpc32xx_timer_init(void)
 	__raw_writel(0, LCP32XX_TIMER_MCR(LPC32XX_TIMER1_BASE));
 	__raw_writel(LCP32XX_TIMER_CNTR_TCR_EN,
 		LCP32XX_TIMER_TCR(LPC32XX_TIMER1_BASE));
-	lpc32xx_clksrc.mult = clocksource_hz2mult(clkrate,
-		lpc32xx_clksrc.shift);
-	clocksource_register(&lpc32xx_clksrc);
+	clocksource_register_hz(&lpc32xx_clksrc, clkrate);
 }
 
 struct sys_timer lpc32xx_timer = {
Signature · 1 line
1.6.2.5
#11 lore raw

PATCH 7/24 ARM: mmp: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-mmp/time.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
arch/arm/mach-mmp/time.c +1 -4
index 6652819..0c0ab09 100644
@@ -146,7 +146,6 @@ static cycle_t clksrc_read(struct clocksource *cs)
 
 static struct clocksource cksrc = {
 	.name		= "clocksource",
-	.shift		= 20,
 	.rating		= 200,
 	.read		= clksrc_read,
 	.mask		= CLOCKSOURCE_MASK(32),
@@ -193,10 +192,8 @@ void __init timer_init(int irq)
 	ckevt.min_delta_ns = clockevent_delta2ns(MIN_DELTA, &ckevt);
 	ckevt.cpumask = cpumask_of(0);
 
-	cksrc.mult = clocksource_hz2mult(CLOCK_TICK_RATE, cksrc.shift);
-
 	setup_irq(irq, &timer_irq);
 
-	clocksource_register(&cksrc);
+	clocksource_register_hz(&cksrc, CLOCK_TICK_RATE);
 	clockevents_register_device(&ckevt);
 }
Signature · 1 line
1.6.2.5
#12 lore raw

PATCH 8/24 ARM: MSM: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-msm/timer.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
arch/arm/mach-msm/timer.c +1 -4
index 950100f..595be7f 100644
@@ -137,7 +137,6 @@ static struct msm_clock msm_clocks[] = {
 			.rating         = 200,
 			.read           = msm_gpt_read,
 			.mask           = CLOCKSOURCE_MASK(32),
-			.shift          = 17,
 			.flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 		},
 		.irq = {
@@ -164,7 +163,6 @@ static struct msm_clock msm_clocks[] = {
 			.rating         = 300,
 			.read           = msm_dgt_read,
 			.mask           = CLOCKSOURCE_MASK((32 - MSM_DGT_SHIFT)),
-			.shift          = 24 - MSM_DGT_SHIFT,
 			.flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 		},
 		.irq = {
@@ -205,8 +203,7 @@ static void __init msm_timer_init(void)
 		ce->min_delta_ns = clockevent_delta2ns(4, ce);
 		ce->cpumask = cpumask_of(0);
 
-		cs->mult = clocksource_hz2mult(clock->freq, cs->shift);
-		res = clocksource_register(cs);
+		res = clocksource_register_hz(cs, clock->freq);
 		if (res)
 			printk(KERN_ERR "msm_timer_init: clocksource_register "
 			       "failed for %s\n", cs->name);
Signature · 1 line
1.6.2.5
#13 lore raw

PATCH 8/24 ARM: MSM: update clock source registration

Quoted 5 lines · Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#14 lore raw

PATCH 9/24 ARM: netx: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-netx/time.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
arch/arm/mach-netx/time.c +1 -4
index 82801db..f12f22d 100644
@@ -114,7 +114,6 @@ static struct clocksource clocksource_netx = {
 	.rating		= 200,
 	.read		= netx_get_cycles,
 	.mask		= CLOCKSOURCE_MASK(32),
-	.shift		= 20,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -151,9 +150,7 @@ static void __init netx_timer_init(void)
 	writel(NETX_GPIO_COUNTER_CTRL_RUN,
 			NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKSOURCE));
 
-	clocksource_netx.mult =
-		clocksource_hz2mult(CLOCK_TICK_RATE, clocksource_netx.shift);
-	clocksource_register(&clocksource_netx);
+	clocksource_register_hz(&clocksource_netx, CLOCK_TICK_RATE);
 
 	netx_clockevent.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC,
 			netx_clockevent.shift);
Signature · 1 line
1.6.2.5
#15 lore raw

PATCH 10/24 ARM: ns9xxx: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-ns9xxx/time-ns9360.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/mach-ns9xxx/time-ns9360.c +1 -5
index 7728126..9ca32f5 100644
@@ -35,7 +35,6 @@ static struct clocksource ns9360_clocksource = {
 	.rating	= 300,
 	.read	= ns9360_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(32),
-	.shift	= 20,
 	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -148,10 +147,7 @@ static void __init ns9360_timer_init(void)
 
 	__raw_writel(tc, SYS_TC(TIMER_CLOCKSOURCE));
 
-	ns9360_clocksource.mult = clocksource_hz2mult(ns9360_cpuclock(),
-			ns9360_clocksource.shift);
-
-	clocksource_register(&ns9360_clocksource);
+	clocksource_register_hz(&ns9360_clocksource, ns9360_cpuclock());
 
 	latch = SH_DIV(ns9360_cpuclock(), HZ, 0);
 
Signature · 1 line
1.6.2.5
#16 lore raw

PATCH 11/24 ARM: omap: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-omap1/time.c       |    6 +-----
 arch/arm/mach-omap2/timer-gp.c   |    5 +----
 arch/arm/plat-omap/counter_32k.c |    6 +-----
 3 files changed, 3 insertions(+), 14 deletions(-)
arch/arm/mach-omap1/time.c +1 -5
index 1be6a21..abb34ff 100644
@@ -208,7 +208,6 @@ static struct clocksource clocksource_mpu = {
 	.rating		= 300,
 	.read		= mpu_read,
 	.mask		= CLOCKSOURCE_MASK(32),
-	.shift		= 24,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -217,13 +216,10 @@ static void __init omap_init_clocksource(unsigned long rate)
 	static char err[] __initdata = KERN_ERR
 			"%s: can't register clocksource!\n";
 
-	clocksource_mpu.mult
-		= clocksource_khz2mult(rate/1000, clocksource_mpu.shift);
-
 	setup_irq(INT_TIMER2, &omap_mpu_timer2_irq);
 	omap_mpu_timer_start(1, ~0, 1);
 
-	if (clocksource_register(&clocksource_mpu))
+	if (clocksource_register_hz(&clocksource_mpu, rate))
 		printk(err, clocksource_mpu.name);
 }
 
arch/arm/mach-omap2/timer-gp.c +1 -4
index e13c29e..a7816db 100644
@@ -195,7 +195,6 @@ static struct clocksource clocksource_gpt = {
 	.rating		= 300,
 	.read		= clocksource_read_cycles,
 	.mask		= CLOCKSOURCE_MASK(32),
-	.shift		= 24,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -220,9 +219,7 @@ static void __init omap2_gp_clocksource_init(void)
 
 	omap_dm_timer_set_load_start(gpt, 1, 0);
 
-	clocksource_gpt.mult =
-		clocksource_khz2mult(tick_rate/1000, clocksource_gpt.shift);
-	if (clocksource_register(&clocksource_gpt))
+	if (clocksource_register_hz(&clocksource_gpt, tick_rate))
 		printk(err2, clocksource_gpt.name);
 }
 #endif
arch/arm/plat-omap/counter_32k.c +1 -5
index 155fe43..8f149f5 100644
@@ -102,7 +102,6 @@ static struct clocksource clocksource_32k = {
 	.rating		= 250,
 	.read		= omap_32k_read_dummy,
 	.mask		= CLOCKSOURCE_MASK(32),
-	.shift		= 10,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -167,12 +166,9 @@ static int __init omap_init_clocksource_32k(void)
 		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))
+		if (clocksource_register_hz(&clocksource_32k, 32768))
 			printk(err, clocksource_32k.name);
 	}
 	return 0;
Signature · 1 line
1.6.2.5
#17 lore raw

PATCH 12/24 ARM: PXA: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-pxa/time.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/mach-pxa/time.c +1 -5
index 293e40a..caf92c0 100644
@@ -127,7 +127,6 @@ static struct clocksource cksrc_pxa_oscr0 = {
 	.rating         = 200,
 	.read           = pxa_read_oscr,
 	.mask           = CLOCKSOURCE_MASK(32),
-	.shift          = 20,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -155,12 +154,9 @@ static void __init pxa_timer_init(void)
 		clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_pxa_osmr0) + 1;
 	ckevt_pxa_osmr0.cpumask = cpumask_of(0);
 
-	cksrc_pxa_oscr0.mult =
-		clocksource_hz2mult(clock_tick_rate, cksrc_pxa_oscr0.shift);
-
 	setup_irq(IRQ_OST0, &pxa_ost0_irq);
 
-	clocksource_register(&cksrc_pxa_oscr0);
+	clocksource_register_hz(&cksrc_pxa_oscr0, clock_tick_rate);
 	clockevents_register_device(&ckevt_pxa_osmr0);
 }
 
Signature · 1 line
1.6.2.5
#18 lore raw

PATCH 12/24 ARM: PXA: update clock source registration

Quoted 4 lines · Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. ?Switch over to using this new interface.

Russell,

This has been already addressed in Haojian's previous patch posted and merged in my tree:

http://git.kernel.org/?p=linux/kernel/git/ycmiao/pxa-linux-2.6.git;a=commitdiff;h=ee5ed917c3c412e0e13d1c198b5f09f82c03eea4

I'll send the pull request out early today to sort this out.

Quoted 35 lines

---
?arch/arm/mach-pxa/time.c | ? ?6 +-----
?1 files changed, 1 insertions(+), 5 deletions(-)

arch/arm/mach-pxa/time.c +1 -6
index 293e40a..caf92c0 100644
@@ -127,7 +127,6 @@ static struct clocksource cksrc_pxa_oscr0 = {
 ? ? ? ?.rating ? ? ? ? = 200,
 ? ? ? ?.read ? ? ? ? ? = pxa_read_oscr,
 ? ? ? ?.mask ? ? ? ? ? = CLOCKSOURCE_MASK(32),
- ? ? ? .shift ? ? ? ? ?= 20,
 ? ? ? ?.flags ? ? ? ? ?= CLOCK_SOURCE_IS_CONTINUOUS,
 ?};
 
@@ -155,12 +154,9 @@ static void __init pxa_timer_init(void)
 ? ? ? ? ? ? ? ?clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_pxa_osmr0) + 1;
 ? ? ? ?ckevt_pxa_osmr0.cpumask = cpumask_of(0);
 
- ? ? ? cksrc_pxa_oscr0.mult =
- ? ? ? ? ? ? ? clocksource_hz2mult(clock_tick_rate, cksrc_pxa_oscr0.shift);
-
 ? ? ? ?setup_irq(IRQ_OST0, &pxa_ost0_irq);
 
- ? ? ? clocksource_register(&cksrc_pxa_oscr0);
+ ? ? ? clocksource_register_hz(&cksrc_pxa_oscr0, clock_tick_rate);
 ? ? ? ?clockevents_register_device(&ckevt_pxa_osmr0);
 ?}
 
--

1.6.2.5

#19 lore raw

PATCH 12/24 ARM: PXA: update clock source registration

Quoted 7 lines · Eric Miao
Quoted 4 lines · Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. ?Switch over to using this new interface.

Quoted 8 lines

Russell,

This has been already addressed in Haojian's previous patch posted and merged in my tree:

http://git.kernel.org/?p=linux/kernel/git/ycmiao/pxa-linux-2.6.git;a=commitdiff;h=ee5ed917c3c412e0e13d1c198b5f09f82c03eea4

I'll send the pull request out early today to sort this out.

That's not quite the same. clocksource_calc_mult_shift() was introduced in November 2009, whereas clocksource_register_hz() was introduced in May 2010. I'm updating everything to the latest interface.

The newer interface removes the burden of having to figure out what to pass as the 'minsec' parameter, as well as simplifying the clocksource registration code down to one line.

#20 lore raw

PATCH 12/24 ARM: PXA: update clock source registration

Quoted 17 lines · Russell King - ARM Linux
Quoted 7 lines · Eric Miao
Quoted 4 lines · Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. ?Switch over to using this new interface.

Quoted 8 lines

Russell,

This has been already addressed in Haojian's previous patch posted and merged in my tree:

http://git.kernel.org/?p=linux/kernel/git/ycmiao/pxa-linux-2.6.git;a=commitdiff;h=ee5ed917c3c412e0e13d1c198b5f09f82c03eea4

I'll send the pull request out early today to sort this out.

Quoted 9 lines

That's not quite the same. ?clocksource_calc_mult_shift() was introduced in November 2009, whereas clocksource_register_hz() was introduced in May 2010. ?I'm updating everything to the latest interface.

The newer interface removes the burden of having to figure out what to pass as the 'minsec' parameter, as well as simplifying the clocksource registration code down to one line.

OK. I'll drop the patch from my queue.

#21 lore raw

PATCH 13/24 ARM: s5pv310: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-s5pv310/time.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/mach-s5pv310/time.c +1 -5
index 01b012a..b262d46 100644
@@ -211,7 +211,6 @@ struct clocksource pwm_clocksource = {
 	.rating		= 250,
 	.read		= s5pv310_pwm4_read,
 	.mask		= CLOCKSOURCE_MASK(32),
-	.shift		= 20,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS ,
 };
 
@@ -230,10 +229,7 @@ static void __init s5pv310_clocksource_init(void)
 	s5pv310_pwm_init(4, ~0);
 	s5pv310_pwm_start(4, 1);
 
-	pwm_clocksource.mult =
-		clocksource_khz2mult(clock_rate/1000, pwm_clocksource.shift);
-
-	if (clocksource_register(&pwm_clocksource))
+	if (clocksource_register_hz(&pwm_clocksource, clock_rate))
 		panic("%s: can't register clocksource\n", pwm_clocksource.name);
 }
 
Signature · 1 line
1.6.2.5
#22 lore raw

PATCH 13/24 ARM: s5pv310: update clock source registration

Quoted 6 lines · Russell King

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

Quoted 17 lines
---
 arch/arm/mach-s5pv310/time.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/mach-s5pv310/time.c +0 -1
index 01b012a..b262d46 100644
@@ -211,7 +211,6 @@ struct clocksource pwm_clocksource = {
 	.rating		= 250,
 	.read		= s5pv310_pwm4_read,
 	.mask		= CLOCKSOURCE_MASK(32),
-	.shift		= 20,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS ,
 };
 

arch/arm/mach-s5pv310/time.c static void __init s5pv310_clocksource_init(void) · line 234

Quoted 5 lines
arch/arm/mach-s5pv310/time.c +0 -2
@@ -230,10 +229,7 @@ static void __init s5pv310_clocksource_init(void)
 	s5pv310_pwm_init(4, ~0);
 	s5pv310_pwm_start(4, 1);
 
-	pwm_clocksource.mult =
-		clocksource_khz2mult(clock_rate/1000,

pwm_clocksource.shift);

arch/arm/mach-s5pv310/time.c static void __init s5pv310_clocksource_init(void)

Quoted 8 lines
arch/arm/mach-s5pv310/time.c +1 -3
-
-	if (clocksource_register(&pwm_clocksource))
+	if (clocksource_register_hz(&pwm_clocksource, clock_rate))
 		panic("%s: can't register clocksource\n",
 pwm_clocksource.name);
 }
 
--

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#23 lore raw

PATCH 14/24 ARM: SA11x0: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-sa1100/time.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/mach-sa1100/time.c +1 -5
index 74b6e0e..96154f5 100644
@@ -81,7 +81,6 @@ static struct clocksource cksrc_sa1100_oscr = {
 	.rating		= 200,
 	.read		= sa1100_read_oscr,
 	.mask		= CLOCKSOURCE_MASK(32),
-	.shift		= 20,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -105,12 +104,9 @@ static void __init sa1100_timer_init(void)
 		clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_sa1100_osmr0) + 1;
 	ckevt_sa1100_osmr0.cpumask = cpumask_of(0);
 
-	cksrc_sa1100_oscr.mult =
-		clocksource_hz2mult(CLOCK_TICK_RATE, cksrc_sa1100_oscr.shift);
-
 	setup_irq(IRQ_OST0, &sa1100_timer_irq);
 
-	clocksource_register(&cksrc_sa1100_oscr);
+	clocksource_register_hz(&cksrc_sa1100_oscr, CLOCK_TICK_RATE);
 	clockevents_register_device(&ckevt_sa1100_osmr0);
 }
 
Signature · 1 line
1.6.2.5
#24 lore raw

PATCH 15/24 ARM: tcc8k: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-tcc8k/time.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
arch/arm/mach-tcc8k/time.c +1 -4
index 78d0600..e0a8d60 100644
@@ -35,7 +35,6 @@ static struct clocksource clocksource_tcc = {
 	.rating		= 200,
 	.read		= tcc_get_cycles,
 	.mask		= CLOCKSOURCE_MASK(32),
-	.shift		= 28,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -103,9 +102,7 @@ static int __init tcc_clockevent_init(struct clk *clock)
 {
 	unsigned int c = clk_get_rate(clock);
 
-	clocksource_tcc.mult = clocksource_hz2mult(c,
-					clocksource_tcc.shift);
-	clocksource_register(&clocksource_tcc);
+	clocksource_register_hz(&clocksource_tcc, c);
 
 	clockevent_tcc.mult = div_sc(c, NSEC_PER_SEC,
 					clockevent_tcc.shift);
Signature · 1 line
1.6.2.5
#25 lore raw

PATCH 16/24 ARM: U300: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-u300/timer.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/mach-u300/timer.c +1 -3
index 3fc4472..377ff7f 100644
@@ -412,9 +412,7 @@ static void __init u300_timer_init(void)
 	writel(U300_TIMER_APP_EGPT2_TIMER_ENABLE,
 		U300_TIMER_APP_VBASE + U300_TIMER_APP_EGPT2);
 
-	clocksource_calc_mult_shift(&clocksource_u300_1mhz,
-				    rate, APPTIMER_MIN_RANGE);
-	if (clocksource_register(&clocksource_u300_1mhz))
+	if (clocksource_register_hz(&clocksource_u300_1mhz, rate))
 		printk(KERN_ERR "timer: failed to initialize clock "
 		       "source %s\n", clocksource_u300_1mhz.name);
 
Signature · 1 line
1.6.2.5
#26 lore raw

PATCH 16/24 ARM: U300: update clock source registration

Quoted 7 lines

-----Original Message-----
In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the
divisor shift/mult constants. Switch over to using this new interface.

I remember pushing TGLX about simplifying mult/shift calculation very early, it's nice to see it being ever more consolidated!

Yours,
Linus Walleij

#27 lore raw

PATCH 17/24 ARM: nuc: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/mach-w90x900/time.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
arch/arm/mach-w90x900/time.c +1 -4
index b80f769..4b089cb 100644
@@ -153,7 +153,6 @@ static struct clocksource clocksource_nuc900 = {
 	.rating	= 200,
 	.read	= nuc900_get_cycles,
 	.mask	= CLOCKSOURCE_MASK(TDR_SHIFT),
-	.shift	= 10,
 	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -176,9 +175,7 @@ static void __init nuc900_clocksource_init(void)
 	val |= (COUNTEN | PERIOD | PRESCALE);
 	__raw_writel(val, REG_TCSR1);
 
-	clocksource_nuc900.mult =
-		clocksource_khz2mult((rate / 1000), clocksource_nuc900.shift);
-	clocksource_register(&clocksource_nuc900);
+	clocksource_register_hz(&clocksource_nuc900, rate);
 }
 
 static void __init nuc900_timer_init(void)
Signature · 1 line
1.6.2.5
#28 lore raw

PATCH 18/24 ARM: iop: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/plat-iop/time.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/plat-iop/time.c +1 -3
index 558cdfa..432a5b7 100644
@@ -172,7 +172,5 @@ void __init iop_init_time(unsigned long tick_rate)
 	write_trr1(0xffffffff);
 	write_tcr1(0xffffffff);
 	write_tmr1(timer_ctl);
-	clocksource_calc_mult_shift(&iop_clocksource, tick_rate,
-				    IOP_MIN_RANGE);
-	clocksource_register(&iop_clocksource);
+	clocksource_register_hz(&iop_clocksource, tick_rate);
 }
Signature · 1 line
1.6.2.5
#29 lore raw

PATCH 19/24 ARM: mxc: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/plat-mxc/epit.c |    5 +----
 arch/arm/plat-mxc/time.c |    5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)
arch/arm/plat-mxc/epit.c +1 -4
index ee9582f..d69d343 100644
@@ -93,7 +93,6 @@ static struct clocksource clocksource_epit = {
 	.rating		= 200,
 	.read		= epit_read,
 	.mask		= CLOCKSOURCE_MASK(32),
-	.shift		= 20,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -101,9 +100,7 @@ static int __init epit_clocksource_init(struct clk *timer_clk)
 {
 	unsigned int c = clk_get_rate(timer_clk);
 
-	clocksource_epit.mult = clocksource_hz2mult(c,
-					clocksource_epit.shift);
-	clocksource_register(&clocksource_epit);
+	clocksource_register_hz(&clocksource_epit, c);
 
 	return 0;
 }
arch/arm/plat-mxc/time.c +1 -4
index f9a1b05..9f0c261 100644
@@ -120,7 +120,6 @@ static struct clocksource clocksource_mxc = {
 	.rating		= 200,
 	.read		= mx1_2_get_cycles,
 	.mask		= CLOCKSOURCE_MASK(32),
-	.shift 		= 20,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -131,9 +130,7 @@ static int __init mxc_clocksource_init(struct clk *timer_clk)
 	if (timer_is_v2())
 		clocksource_mxc.read = v2_get_cycles;
 
-	clocksource_mxc.mult = clocksource_hz2mult(c,
-					clocksource_mxc.shift);
-	clocksource_register(&clocksource_mxc);
+	clocksource_register_hz(&clocksource_mxc, c);
 
 	return 0;
 }
Signature · 1 line
1.6.2.5
maintainer
#30 lore raw

PATCH 19/24 ARM: mxc: update clock source registration

Quoted 5 lines · Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#31 lore raw

PATCH 20/24 ARM: nomadik: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/plat-nomadik/timer.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
arch/arm/plat-nomadik/timer.c +1 -2
index 63cdc60..b0bd6df 100644
@@ -222,7 +222,6 @@ void __init nmdk_timer_init(void)
 	} else {
 		cr |= MTU_CRn_PRESCALE_1;
 	}
-	clocksource_calc_mult_shift(&nmdk_clksrc, rate, MTU_MIN_RANGE);
 
 	/* Timer 0 is the free running clocksource */
 	writel(cr, mtu_base + MTU_CR(0));
@@ -233,7 +232,7 @@ void __init nmdk_timer_init(void)
 	/* Now the clock source is ready */
 	nmdk_clksrc.read = nmdk_read_timer;
 
-	if (clocksource_register(&nmdk_clksrc))
+	if (clocksource_register_hz(&nmdk_clksrc, rate))
 		pr_err("timer: failed to initialize clock source %s\n",
 		       nmdk_clksrc.name);
 
Signature · 1 line
1.6.2.5
#32 lore raw

PATCH 20/24 ARM: nomadik: update clock source registration

Quoted 8 lines

From: Russell King [mailto:rmk at arm.linux.org.uk] On Behalf Of Russell

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the
divisor shift/mult constants. Switch over to using this new interface.

Yours,
Linus Walleij

#33 lore raw

PATCH 21/24 ARM: spear: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/plat-spear/time.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/plat-spear/time.c +1 -5
index ab21165..839c88d 100644
@@ -81,8 +81,6 @@ static struct clocksource clksrc = {
 	.rating = 200,		/* its a pretty decent clock */
 	.read = clocksource_read_cycles,
 	.mask = 0xFFFF,		/* 16 bits */
-	.mult = 0,		/* to be computed */
-	.shift = 0,		/* to be computed */
 	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -105,10 +103,8 @@ static void spear_clocksource_init(void)
 	val |= CTRL_ENABLE ;
 	writew(val, gpt_base + CR(CLKSRC));
 
-	clocksource_calc_mult_shift(&clksrc, tick_rate, SPEAR_MIN_RANGE);
-
 	/* register the clocksource */
-	clocksource_register(&clksrc);
+	clocksource_register_hz(&clksrc, tick_rate);
 }
 
 static struct clock_event_device clkevt = {
Signature · 1 line
1.6.2.5
#34 lore raw

PATCH 21/24 ARM: spear: update clock source registration

Quoted 24 lines · Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/plat-spear/time.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/plat-spear/time.c +0 -2
index ab21165..839c88d 100644
@@ -81,8 +81,6 @@ static struct clocksource clksrc = {
 	.rating = 200,		/* its a pretty decent clock */
 	.read = clocksource_read_cycles,
 	.mask = 0xFFFF,		/* 16 bits */
-	.mult = 0,		/* to be computed */
-	.shift = 0,		/* to be computed */
 	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -105,10 +103,8 @@ static void spear_clocksource_init(void)
 	val |= CTRL_ENABLE ;

arch/arm/plat-spear/time.c static void spear_clocksource_init(void) · line 110

Quoted 10 lines
arch/arm/plat-spear/time.c +1 -3
 	writew(val, gpt_base + CR(CLKSRC));
 
-	clocksource_calc_mult_shift(&clksrc, tick_rate, SPEAR_MIN_RANGE);
-
 	/* register the clocksource */
-	clocksource_register(&clksrc);
+	clocksource_register_hz(&clksrc, tick_rate);
 }
 
 static struct clock_event_device clkevt = {
#35 lore raw

PATCH 22/24 ARM: orion: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/plat-orion/time.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/plat-orion/time.c +1 -3
index 715a301..11e2583 100644
@@ -102,7 +102,6 @@ static cycle_t orion_clksrc_read(struct clocksource *cs)
 
 static struct clocksource orion_clksrc = {
 	.name		= "orion_clocksource",
-	.shift		= 20,
 	.rating		= 300,
 	.read		= orion_clksrc_read,
 	.mask		= CLOCKSOURCE_MASK(32),
@@ -245,8 +244,7 @@ void __init orion_time_init(unsigned int irq, unsigned int tclk)
 	writel(u & ~BRIDGE_INT_TIMER0, BRIDGE_MASK);
 	u = readl(TIMER_CTRL);
 	writel(u | TIMER0_EN | TIMER0_RELOAD_EN, TIMER_CTRL);
-	orion_clksrc.mult = clocksource_hz2mult(tclk, orion_clksrc.shift);
-	clocksource_register(&orion_clksrc);
+	clocksource_register_hz(&orion_clksrc, tclk);
 
 	/*
 	 * Setup clockevent timer (interrupt-driven.)
Signature · 1 line
1.6.2.5
#36 lore raw

PATCH 22/24 ARM: orion: update clock source registration

Quoted 5 lines · Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

Quoted 29 lines
---
 arch/arm/plat-orion/time.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/plat-orion/time.c +1 -3
index 715a301..11e2583 100644
@@ -102,7 +102,6 @@ static cycle_t orion_clksrc_read(struct clocksource *cs)
 
 static struct clocksource orion_clksrc = {
 	.name		= "orion_clocksource",
-	.shift		= 20,
 	.rating		= 300,
 	.read		= orion_clksrc_read,
 	.mask		= CLOCKSOURCE_MASK(32),
@@ -245,8 +244,7 @@ void __init orion_time_init(unsigned int irq, unsigned int tclk)
 	writel(u & ~BRIDGE_INT_TIMER0, BRIDGE_MASK);
 	u = readl(TIMER_CTRL);
 	writel(u | TIMER0_EN | TIMER0_RELOAD_EN, TIMER_CTRL);
-	orion_clksrc.mult = clocksource_hz2mult(tclk, orion_clksrc.shift);
-	clocksource_register(&orion_clksrc);
+	clocksource_register_hz(&orion_clksrc, tclk);
 
 	/*
 	 * Setup clockevent timer (interrupt-driven.)
Signature · 1 line
1.6.2.5
#37 lore raw

PATCH 23/24 ARM: stmp: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/plat-stmp3xxx/timer.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
arch/arm/plat-stmp3xxx/timer.c +1 -4
index 063c7bc..c395630 100644
@@ -89,7 +89,6 @@ static struct clocksource cksrc_stmp3xxx = {
 	.rating         = 250,
 	.read           = stmp3xxx_clock_read,
 	.mask           = CLOCKSOURCE_MASK(16),
-	.shift          = 10,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -106,8 +105,6 @@ static struct irqaction stmp3xxx_timer_irq = {
  */
 static void __init stmp3xxx_init_timer(void)
 {
-	cksrc_stmp3xxx.mult = clocksource_hz2mult(CLOCK_TICK_RATE,
-				cksrc_stmp3xxx.shift);
 	ckevt_timrot.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC,
 				ckevt_timrot.shift);
 	ckevt_timrot.min_delta_ns = clockevent_delta2ns(2, &ckevt_timrot);
@@ -140,7 +137,7 @@ static void __init stmp3xxx_init_timer(void)
 
 	setup_irq(IRQ_TIMER0, &stmp3xxx_timer_irq);
 
-	clocksource_register(&cksrc_stmp3xxx);
+	clocksource_register_hz(&cksrc_stmp3xxx, CLOCK_TICK_RATE);
 	clockevents_register_device(&ckevt_timrot);
 }
 
Signature · 1 line
1.6.2.5
#38 lore raw

PATCH 24/24 ARM: realview/versatile: update clock source registration

In reply to Russell King - ARM Linux

In d7e81c2 (clocksource: Add clocksource_register_hz/khz interface) new interfaces were added which simplify (and optimize) the selection of the divisor shift/mult constants. Switch over to using this new interface.

---
 arch/arm/plat-versatile/timer-sp.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/plat-versatile/timer-sp.c +1 -3
index fb0d1c2..f09941b 100644
@@ -46,7 +46,6 @@ static struct clocksource clocksource_sp804 = {
 	.rating		= 200,
 	.read		= sp804_read,
 	.mask		= CLOCKSOURCE_MASK(32),
-	.shift		= 20,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -63,8 +62,7 @@ void __init sp804_clocksource_init(void __iomem *base)
 	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
 		clksrc_base + TIMER_CTRL);
 
-	cs->mult = clocksource_khz2mult(TIMER_FREQ_KHZ, cs->shift);
-	clocksource_register(cs);
+	clocksource_register_khz(cs, TIMER_FREQ_KHZ);
 }
 
 
Signature · 1 line
1.6.2.5