mips hpt cleanup: make clocksource_mips public
Subsystems (2)
PATCH 1/1 mips hpt cleanup: make clocksource_mips public
Note: This patch can be applied after the patch titled:
"[PATCH] mips hpt cleanup: get rid of mips_hpt_init" in lmo linux-queue tree (or 2.6.19-rc5-mm1).
Make clocksource_mips public and get rid of mips_hpt_read, mips_hpt_mask.
arch/mips/dec/time.c | 4 +-- arch/mips/jmr3927/rbhma3100/setup.c | 4 +-- arch/mips/kernel/time.c | 42 +++++++++++++----------------------- arch/mips/sgi-ip27/ip27-timer.c | 4 +-- arch/mips/sibyte/bcm1480/time.c | 4 +-- arch/mips/sibyte/sb1250/time.c | 8 +++--- include/asm-mips/time.h | 8 +++--- 7 files changed, 32 insertions(+), 42 deletions(-)
arch/mips/dec/time.c +2 -2
@@ -151,7 +151,7 @@ static void dec_timer_ack(void)CMOS_READ (RTC_REG_C );/* Ack the RTC interrupt. */ } -static unsigned int dec_ioasic_hpt_read (void ) +static cycle_t dec_ioasic_hpt_read (void ) {/* * The free-running counter is 32-bit which is good for about
@@ -171,7 +171,7 @@ void __init dec_time_init(void)if (!cpu_has_counter &&IOASIC )/* For pre-R4k systems we use the I/O ASIC's counter. */ - mips_hpt_read = dec_ioasic_hpt_read; + clocksource_mips.read = dec_ioasic_hpt_read;/* Set up the rate of periodic DS1287 interrupts. */ CMOS_WRITE (RTC_REF_CLCK_32KHZ | (16 -__ffs (HZ )),RTC_REG_A );
arch/mips/jmr3927/rbhma3100/setup.c +2 -2
@@ -170,7 +170,7 @@ static void jmr3927_machine_power_off(vowhile (1 ); } -static unsigned int jmr3927_hpt_read (void ) +static cycle_t jmr3927_hpt_read (void ) {/* We assume this function is called xtime_lock held. */ return jiffies * (JMR3927_TIMER_CLK /HZ ) + jmr3927_tmrptr->trr;
@@ -182,7 +182,7 @@ extern void rtc_ds1742_init(unsigned lon#endif static void __init jmr3927_time_init (void ) { - mips_hpt_read = jmr3927_hpt_read; + clocksource_mips.read = jmr3927_hpt_read; mips_hpt_frequency =JMR3927_TIMER_CLK ;#ifdef USE_RTC_DS1742 if (jmr3927_have_nvram ()) {
arch/mips/kernel/time.c +16 -26
114 lines not on this page · raw message
arch/mips/sgi-ip27/ip27-timer.c +2 -2
@@ -239,14 +239,14 @@ void __init plat_timer_setup(struct irqasetup_irq (irqno, &rt_irqaction); } -static unsigned int ip27_hpt_read (void ) +static cycle_t ip27_hpt_read (void ) {return REMOTE_HUB_L (cputonasid (0 ),PI_RT_COUNT ); }void __init ip27_time_init (void ) { - mips_hpt_read = ip27_hpt_read; + clocksource_mips.read = ip27_hpt_read; mips_hpt_frequency =CYCLES_PER_SEC ; xtime.tv_sec =get_m48t35_time (); xtime.tv_nsec =0 ;
arch/mips/sibyte/bcm1480/time.c +2 -2
@@ -119,7 +119,7 @@ void bcm1480_timer_interrupt(void) } } -static unsigned int bcm1480_hpt_read (void ) +static cycle_t bcm1480_hpt_read (void ) {/* We assume this function is called xtime_lock held. */ unsigned long count =
@@ -129,6 +129,6 @@ static unsigned int bcm1480_hpt_read(voivoid __init bcm1480_hpt_setup (void ) { - mips_hpt_read = bcm1480_hpt_read; + clocksource_mips.read = bcm1480_hpt_read; mips_hpt_frequency =BCM1480_HPT_VALUE ; }
arch/mips/sibyte/sb1250/time.c +4 -4
@@ -51,7 +51,7 @@ #define SB1250_HPT_VALUE M_SCD_TIMER_CNTextern int sb1250_steal_irq (int irq); -static unsigned int sb1250_hpt_read (void ); +static cycle_t sb1250_hpt_read (void );void __init sb1250_hpt_setup (void ) {
@@ -66,8 +66,8 @@ void __init sb1250_hpt_setup(void) IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM, R_SCD_TIMER_CFG))); mips_hpt_frequency =V_SCD_TIMER_FREQ ; - mips_hpt_read = sb1250_hpt_read; - mips_hpt_mask =M_SCD_TIMER_INIT ; + clocksource_mips.read = sb1250_hpt_read; + clocksource_mips.mask =M_SCD_TIMER_INIT ; } }
@@ -143,7 +143,7 @@ void sb1250_timer_interrupt(void)* The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over * again. */ -static unsigned int sb1250_hpt_read (void ) +static cycle_t sb1250_hpt_read (void ) {unsigned int count;
include/asm-mips/time.h +4 -4
@@ -21,6 +21,7 @@ #include <linux/linkage.h>#include <linux/ptrace.h> #include <linux/rtc.h> #include <linux/spinlock.h> +#include <linux/clocksource.h> extern spinlock_t rtc_lock;
@@ -44,11 +45,10 @@ extern int (*mips_timer_state)(void);extern void (*mips_timer_ack)(void );/* -* High precision timer functions. -* If mips_hpt_read is NULL, an R4k-compatible timer setup is attempted. +* High precision timer clocksource. +* If .read is NULL, an R4k-compatible timer setup is attempted. */ -extern unsigned int (*mips_hpt_read)(void ); -extern unsigned int mips_hpt_mask; +extern struct clocksource clocksource_mips;/* * to_tm() converts system time back to (year, mon, day, hour, min, sec).
Hello.
Quoted 6 lines · Atsushi Nemoto
Note: This patch can be applied after the patch titled:
"[PATCH] mips hpt cleanup: get rid ofmips_hpt_init" in lmo linux-queue tree (or 2.6.19-rc5-mm1).Make
clocksource_mipspublic and get rid ofmips_hpt_read,mips_hpt_mask.
Good to see it. :-)
I have a suggestion though...
Quoted 25 lines
Signed-off-by Atsushi Nemoto <[email protected]>arch/mips/dec/time.c | 4 +-- arch/mips/jmr3927/rbhma3100/setup.c | 4 +-- arch/mips/kernel/time.c | 42 +++++++++++++----------------------- arch/mips/sgi-ip27/ip27-timer.c | 4 +-- arch/mips/sibyte/bcm1480/time.c | 4 +-- arch/mips/sibyte/sb1250/time.c | 8 +++--- include/asm-mips/time.h | 8 +++--- 7 files changed, 32 insertions(+), 42 deletions(-)arch/mips/dec/time.c +1
-1@@ -151,7 +151,7 @@ static void dec_timer_ack(void)CMOS_READ (RTC_REG_C );/* Ack the RTC interrupt. */ } -static unsigned int dec_ioasic_hpt_read (void ) +static cycle_t dec_ioasic_hpt_read (void ) {/* * The free-running counter is 32-bit which is good for about
arch/mips/dec/time.c void __init dec_time_init(void) · line 174
Quoted 5 lines
arch/mips/dec/time.c +1
-1@@ -171,7 +171,7 @@ void __init dec_time_init(void)if (!cpu_has_counter &&IOASIC )/* For pre-R4k systems we use the I/O ASIC's counter. */ - mips_hpt_read = dec_ioasic_hpt_read; + clocksource_mips.read = dec_ioasic_hpt_read;
I'd like to see clocksource_mips.name overriden there as well.
Quoted 16 lines
arch/mips/dec/time.c +0
-0/* Set up the rate of periodic DS1287 interrupts. */ CMOS_WRITE (RTC_REF_CLCK_32KHZ | (16 -__ffs (HZ )),RTC_REG_A );arch/mips/jmr3927/rbhma3100/setup.c +1
-1@@ -170,7 +170,7 @@ static void jmr3927_machine_power_off(vowhile (1 ); } -static unsigned int jmr3927_hpt_read (void ) +static cycle_t jmr3927_hpt_read (void ) {/* We assume this function is called xtime_lock held. */ return jiffies * (JMR3927_TIMER_CLK /HZ ) + jmr3927_tmrptr->trr;
arch/mips/jmr3927/rbhma3100/setup.c extern void rtc_ds1742_init(unsigned lon · line 185
Quoted 5 lines
arch/mips/jmr3927/rbhma3100/setup.c +1
-1@@ -182,7 +182,7 @@ extern void rtc_ds1742_init(unsigned lon#endif static void __init jmr3927_time_init (void ) { - mips_hpt_read = jmr3927_hpt_read; + clocksource_mips.read = jmr3927_hpt_read;
And the same here as well as this is TX3927-specific timer.
Quoted 3 lines
arch/mips/jmr3927/rbhma3100/setup.c +0
-0mips_hpt_frequency =JMR3927_TIMER_CLK ;#ifdef USE_RTC_DS1742 if (jmr3927_have_nvram ()) {
[...]
Quoted 8 lines
arch/mips/sgi-ip27/ip27-timer.c +0
-0@@ -239,14 +239,14 @@ void __init plat_timer_setup(struct irqasetup_irq (irqno, &rt_irqaction); }
arch/mips/sgi-ip27/ip27-timer.c void __init plat_timer_setup(struct irqa · line 249
Quoted 10 lines
arch/mips/sgi-ip27/ip27-timer.c +2
-2-static unsigned int ip27_hpt_read (void ) +static cycle_t ip27_hpt_read (void ) {return REMOTE_HUB_L (cputonasid (0 ),PI_RT_COUNT ); }void __init ip27_time_init (void ) { - mips_hpt_read = ip27_hpt_read; + clocksource_mips.read = ip27_hpt_read;
Again, would be good to override clocksource_mips.name here...
Quoted 17 lines
arch/mips/sgi-ip27/ip27-timer.c +0
-0mips_hpt_frequency =CYCLES_PER_SEC ; xtime.tv_sec =get_m48t35_time (); xtime.tv_nsec =0 ;arch/mips/sibyte/bcm1480/time.c +1
-1@@ -119,7 +119,7 @@ void bcm1480_timer_interrupt(void) } } -static unsigned int bcm1480_hpt_read (void ) +static cycle_t bcm1480_hpt_read (void ) {/* We assume this function is called xtime_lock held. */ unsigned long count =
arch/mips/sibyte/bcm1480/time.c static unsigned int bcm1480_hpt_read(voi · line 132
Quoted 5 lines
arch/mips/sibyte/bcm1480/time.c +1
-1@@ -129,6 +129,6 @@ static unsigned int bcm1480_hpt_read(voivoid __init bcm1480_hpt_setup (void ) { - mips_hpt_read = bcm1480_hpt_read; + clocksource_mips.read = bcm1480_hpt_read;
Here...
Quoted 16 lines
arch/mips/sibyte/bcm1480/time.c +0
-0mips_hpt_frequency =BCM1480_HPT_VALUE ; }arch/mips/sibyte/sb1250/time.c +1
-1@@ -51,7 +51,7 @@ #define SB1250_HPT_VALUE M_SCD_TIMER_CNTextern int sb1250_steal_irq (int irq); -static unsigned int sb1250_hpt_read (void ); +static cycle_t sb1250_hpt_read (void );void __init sb1250_hpt_setup (void ) {
arch/mips/sibyte/sb1250/time.c void __init sb1250_hpt_setup(void) · line 70
Quoted 7 lines
arch/mips/sibyte/sb1250/time.c +2
-2@@ -66,8 +66,8 @@ void __init sb1250_hpt_setup(void) IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM, R_SCD_TIMER_CFG))); mips_hpt_frequency =V_SCD_TIMER_FREQ ; - mips_hpt_read = sb1250_hpt_read; - mips_hpt_mask =M_SCD_TIMER_INIT ; + clocksource_mips.read = sb1250_hpt_read; + clocksource_mips.mask =M_SCD_TIMER_INIT ;
And here as well...
arch/mips/sibyte/sb1250/time.c void __init sb1250_hpt_setup(void) · line 73
Quoted 3 lines
arch/mips/sibyte/sb1250/time.c +0
-0} }
WBR, Sergei
Quoted 7 lines · Sergei Shtylyov
arch/mips/dec/time.c void __init dec_time_init(void) · line 174
Quoted 4 lines
if (!cpu_has_counter && IOASIC) /* For pre-R4k systems we use the I/O ASIC's counter. */arch/mips/dec/time.c +1
-1- mips_hpt_read = dec_ioasic_hpt_read; + clocksource_mips.read = dec_ioasic_hpt_read;I'd like to see clocksource_mips.name overriden there as well.
Quoted 7 lines
arch/mips/jmr3927/rbhma3100/setup.c extern void rtc_ds1742_init(unsigned lon · line 185
Quoted 5 lines
#endif
static void__initjmr3927_time_init(void)
{arch/mips/jmr3927/rbhma3100/setup.c +1
-1- mips_hpt_read = jmr3927_hpt_read; + clocksource_mips.read = jmr3927_hpt_read;And the same here as well as this is TX3927-specific timer.
...
The whole MIPS clocksource is only a stop gap solution until all platforms have provided their own clocksource drivers.
Ralf
Quoted 2 lines · Sergei Shtylyov
Good to see it. :-)
I have a suggestion though...
Thank you for review.
Quoted 4 lines
arch/mips/dec/time.c void __init dec_time_init(void) · line 174
Quoted 2 lines
arch/mips/dec/time.c +1
-1- mips_hpt_read = dec_ioasic_hpt_read; + clocksource_mips.read = dec_ioasic_hpt_read;I'd like to see clocksource_mips.name overriden there as well.
Yes now it is possible without touching generic code. You can do it if you wanted. I do not have strong feeling for custom name :)
Main purpose of this patch is to remove mips_hpt_read (which saves a few cycles).
---
Atsushi Nemoto
Hello.
Quoted 4 lines · Atsushi Nemoto
Quoted 4 lines
arch/mips/dec/time.c void __init dec_time_init(void) · line 174
Quoted 2 lines
arch/mips/dec/time.c +1
-1- mips_hpt_read = dec_ioasic_hpt_read; + clocksource_mips.read = dec_ioasic_hpt_read;I'd like to see clocksource_mips.name overriden there as well.
And also I forgot about that clocksource continuity thing: TX3927 and
other clocksource making use of jiffies should not be considered countinous. This is not an issue though, till GENERIC_CLOCKEVENTS are ported to these platforms...
Quoted 2 lines
Yes now it is possible without touching generic code. You can do it if you wanted. I do not have strong feeling for custom name :)
Well, it seems Ralf wants this to be converted into serveral clocksources
eventually...
Quoted 2 lines
---
Atsushi Nemoto
WBR, Sergei