iop clocksource support for 2.6.33
Subsystems (2)
Hi Russell, please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/djbw/xscaleiop.git next
...to receive Mikael's conversion of the plat-iop time implementation to clocksource. This caught a difference between proc-xscale.S and proc-xsc3.S in that the latter is not enabling cp6 access by default.
Thanks,
Dan
Mikael Pettersson (4):
iop: clocksource support
iop: clockevent support
iop: enable generic time
iop: implement sched_clock()
arch/arm/Kconfig | 2 + arch/arm/include/asm/hardware/iop3xx.h | 18 +++- arch/arm/mach-iop13xx/include/mach/time.h | 18 +++- arch/arm/mach-iop13xx/iq81340mc.c | 1 - arch/arm/mach-iop13xx/iq81340sc.c | 1 - arch/arm/mach-iop32x/em7210.c | 1 - arch/arm/mach-iop32x/glantank.c | 1 - arch/arm/mach-iop32x/iq31244.c | 1 - arch/arm/mach-iop32x/iq80321.c | 1 - arch/arm/mach-iop32x/n2100.c | 1 - arch/arm/mach-iop33x/iq80331.c | 1 - arch/arm/mach-iop33x/iq80332.c | 1 - arch/arm/mm/proc-xsc3.S | 2 +- arch/arm/plat-iop/time.c | 176 +++++++++++++++++++++++------ 14 files changed, 178 insertions(+), 47 deletions(-)
arch/arm/Kconfig +2 -0
@@ -810,6 +810,8 @@ config ARCH_ACORN config PLAT_IOP bool + select GENERIC_CLOCKEVENTS + select GENERIC_TIME config PLAT_ORION bool
arch/arm/include/asm/hardware/iop3xx.h +17 -1
@@ -234,7 +234,13 @@ extern int iop3xx_get_init_atu(void);void iop3xx_map_io (void );void iop_init_cp6_handler (void );void iop_init_time (unsigned long tickrate); -unsigned long iop_gettimeoffset (void ); + +static inline u32 read_tmr0 (void ) +{ +u32 val; + asmvolatile ("mrc p6, 0, %0, c0, c1, 0" :"=r" (val)); +return val; +}static inline void write_tmr0 (u32 val) {
@@ -253,6 +259,11 @@ static inline u32 read_tcr0(void)return val; } +static inline void write_tcr0 (u32 val) +{ + asmvolatile ("mcr p6, 0, %0, c2, c1, 0" : :"r" (val)); +} +static inline u32 read_tcr1 (void ) {u32 val;
@@ -260,6 +271,11 @@ static inline u32 read_tcr1(void)return val; } +static inline void write_tcr1 (u32 val) +{ + asmvolatile ("mcr p6, 0, %0, c3, c1, 0" : :"r" (val)); +} +static inline void write_trr0 (u32 val) { asmvolatile ("mcr p6, 0, %0, c4, c1, 0" : :"r" (val));
arch/arm/mach-iop13xx/include/mach/time.h +17 -1
@@ -20,7 +20,6 @@#define IOP13XX_CORE_FREQ_1200 (5 << 16)void iop_init_time (unsigned long tickrate); -unsigned long iop_gettimeoffset (void );static inline unsigned long iop13xx_core_freq (void ) {
@@ -66,6 +65,13 @@ static inline unsigned long iop13xx_xsi_bus_ratio(void)return 2 ; } +static inline u32 read_tmr0 (void ) +{ +u32 val; + asmvolatile ("mrc p6, 0, %0, c0, c9, 0" :"=r" (val)); +return val; +} +static inline void write_tmr0 (u32 val) { asmvolatile ("mcr p6, 0, %0, c0, c9, 0" : :"r" (val));
@@ -83,6 +89,11 @@ static inline u32 read_tcr0(void)return val; } +static inline void write_tcr0 (u32 val) +{ + asmvolatile ("mcr p6, 0, %0, c2, c9, 0" : :"r" (val)); +} +static inline u32 read_tcr1 (void ) {u32 val;
@@ -90,6 +101,11 @@ static inline u32 read_tcr1(void)return val; } +static inline void write_tcr1 (u32 val) +{ + asmvolatile ("mcr p6, 0, %0, c3, c9, 0" : :"r" (val)); +} +static inline void write_trr0 (u32 val) { asmvolatile ("mcr p6, 0, %0, c4, c9, 0" : :"r" (val));
arch/arm/mach-iop13xx/iq81340mc.c +0 -1
@@ -87,7 +87,6 @@ static void __init iq81340mc_timer_init(void)static struct sys_timer iq81340mc_timer = { .init = iq81340mc_timer_init, - .offset = iop_gettimeoffset, };MACHINE_START (IQ81340MC ,"Intel IQ81340MC" )
arch/arm/mach-iop13xx/iq81340sc.c +0 -1
@@ -89,7 +89,6 @@ static void __init iq81340sc_timer_init(void)static struct sys_timer iq81340sc_timer = { .init = iq81340sc_timer_init, - .offset = iop_gettimeoffset, };MACHINE_START (IQ81340SC ,"Intel IQ81340SC" )
arch/arm/mach-iop32x/em7210.c +0 -1
@@ -42,7 +42,6 @@ static void __init em7210_timer_init(void)static struct sys_timer em7210_timer = { .init = em7210_timer_init, - .offset = iop_gettimeoffset, };/*
arch/arm/mach-iop32x/glantank.c +0 -1
@@ -47,7 +47,6 @@ static void __init glantank_timer_init(void)static struct sys_timer glantank_timer = { .init = glantank_timer_init, - .offset = iop_gettimeoffset, };
arch/arm/mach-iop32x/iq31244.c +0 -1
@@ -78,7 +78,6 @@ static void __init iq31244_timer_init(void)static struct sys_timer iq31244_timer = { .init = iq31244_timer_init, - .offset = iop_gettimeoffset, };
arch/arm/mach-iop32x/iq80321.c +0 -1
@@ -46,7 +46,6 @@ static void __init iq80321_timer_init(void)static struct sys_timer iq80321_timer = { .init = iq80321_timer_init, - .offset = iop_gettimeoffset, };
arch/arm/mach-iop32x/n2100.c +0 -1
@@ -53,7 +53,6 @@ static void __init n2100_timer_init(void)static struct sys_timer n2100_timer = { .init = n2100_timer_init, - .offset = iop_gettimeoffset, };
arch/arm/mach-iop33x/iq80331.c +0 -1
@@ -48,7 +48,6 @@ static void __init iq80331_timer_init(void)static struct sys_timer iq80331_timer = { .init = iq80331_timer_init, - .offset = iop_gettimeoffset, };
arch/arm/mach-iop33x/iq80332.c +0 -1
@@ -48,7 +48,6 @@ static void __init iq80332_timer_init(void)static struct sys_timer iq80332_timer = { .init = iq80332_timer_init, - .offset = iop_gettimeoffset, };
arch/arm/mm/proc-xsc3.S +1 -1
@@ -396,7 +396,7 @@ __xsc3_setup: orr r4, r4, #0x18 @ cache the page table in L2 mcr p15, 0, r4, c2, c0, 0 @ load page table pointer - mov r0, #0 @ don't allow CP access + mov r0, #1 << 6 @ cp6 access for early sched_clock mcr p15, 0, r0, c15, c1, 0 @ write CP access register mrc p15, 0, r0, c1, c0, 1 @ get auxiliary control reg
arch/arm/plat-iop/time.c +141 -35
219 lines not on this page · raw message
2009/11/20 Dan Williams <[email protected]>:
(...)
Quoted 20 lines
(quoted diff) +20
-0+static void __init iop_clocksource_set_hz(struct clocksource *cs, unsigned int hz) +{ + ? ? ? u64 temp; + ? ? ? u32 shift; + + ? ? ? /* Find shift and mult values for hz. */ + ? ? ? shift = 32; + ? ? ? do { + ? ? ? ? ? ? ? temp = (u64) NSEC_PER_SEC << shift; + ? ? ? ? ? ? ? do_div(temp, hz); + ? ? ? ? ? ? ? if ((temp >> 32) == 0) + ? ? ? ? ? ? ? ? ? ? ? break; + ? ? ? } while (--shift != 0); + + ? ? ? cs->shift = shift; + ? ? ? cs->mult = (u32) temp; + + ? ? ? printk(KERN_INFO "clocksource: %s uses shift %u mult %#x\n", + ? ? ? ? ? ? ?cs->name, cs->shift, cs->mult); +}
(...)
Quoted 19 lines
(quoted diff) +19
-0+static void __init iop_clockevent_set_hz(struct clock_event_device *ce, unsigned int hz) +{ + ? ? ? u64 temp; + ? ? ? u32 shift; + + ? ? ? /* Find shift and mult values for hz. */ + ? ? ? shift = 32; + ? ? ? do { + ? ? ? ? ? ? ? temp = (u64) hz << shift; + ? ? ? ? ? ? ? do_div(temp, NSEC_PER_SEC); + ? ? ? ? ? ? ? if ((temp >> 32) == 0) + ? ? ? ? ? ? ? ? ? ? ? break; + ? ? ? } while (--shift != 0); + + ? ? ? ce->shift = shift; + ? ? ? ce->mult = (u32) temp; + + ? ? ? printk(KERN_INFO "clockevent: %s uses shift %u mult %#lx\n", + ? ? ? ? ? ? ?ce->name, ce->shift, ce->mult);
Quoted 1 line
?}
I only recently annoyed TGLX enough to have this generified from the MIPS versions in a few recent patches visible in linux-next.
Not that it can't be fixed afterwards, so no blocker.
Yours,
Linus Walleij
Quoted 51 lines · Linus Walleij
2009/11/20 Dan Williams <[email protected]>:
(...)
Quoted 20 lines
(quoted diff) +20
-0+static void __init iop_clocksource_set_hz(struct clocksource *cs, unsigned int hz) +{ + ? ? ? u64 temp; + ? ? ? u32 shift; + + ? ? ? /* Find shift and mult values for hz. */ + ? ? ? shift = 32; + ? ? ? do { + ? ? ? ? ? ? ? temp = (u64) NSEC_PER_SEC << shift; + ? ? ? ? ? ? ? do_div(temp, hz); + ? ? ? ? ? ? ? if ((temp >> 32) == 0) + ? ? ? ? ? ? ? ? ? ? ? break; + ? ? ? } while (--shift != 0); + + ? ? ? cs->shift = shift; + ? ? ? cs->mult = (u32) temp; + + ? ? ? printk(KERN_INFO "clocksource: %s uses shift %u mult %#x\n", + ? ? ? ? ? ? ?cs->name, cs->shift, cs->mult); +}(...)
Quoted 19 lines
(quoted diff) +19
-0+static void __init iop_clockevent_set_hz(struct clock_event_device *ce, unsigned int hz) +{ + ? ? ? u64 temp; + ? ? ? u32 shift; + + ? ? ? /* Find shift and mult values for hz. */ + ? ? ? shift = 32; + ? ? ? do { + ? ? ? ? ? ? ? temp = (u64) hz << shift; + ? ? ? ? ? ? ? do_div(temp, NSEC_PER_SEC); + ? ? ? ? ? ? ? if ((temp >> 32) == 0) + ? ? ? ? ? ? ? ? ? ? ? break; + ? ? ? } while (--shift != 0); + + ? ? ? ce->shift = shift; + ? ? ? ce->mult = (u32) temp; + + ? ? ? printk(KERN_INFO "clockevent: %s uses shift %u mult %#lx\n", + ? ? ? ? ? ? ?ce->name, ce->shift, ce->mult);Quoted 1 line
?}
I only recently annoyed TGLX enough to have this generified from the MIPS versions in a few recent patches visible in linux-next.
Quoted 1 line
Not that it can't be fixed afterwards, so no blocker.
If/when Linus' tree has both the iop clocks update and Thomas' update to make the MIPS shift/mult compute functions generic, I'll send in a cleanup to make iop's time code use the new generic functions instead (I've already tested that combo). The iop update does not conflict with Thomas', but there will temporarily be a little bit of code duplication.