|
@@ -1,7 +1,7 @@
|
|
|
/*
|
|
|
- * arch/arm/mach-ns9xxx/time.c
|
|
|
+ * arch/arm/mach-ns9xxx/time-ns9360.c
|
|
|
*
|
|
|
- * Copyright (C) 2006 by Digi International Inc.
|
|
|
+ * Copyright (C) 2006,2007 by Digi International Inc.
|
|
|
* All rights reserved.
|
|
|
*
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
@@ -15,8 +15,8 @@
|
|
|
#include <linux/clocksource.h>
|
|
|
#include <linux/clockchips.h>
|
|
|
|
|
|
-#include <asm/arch-ns9xxx/regs-sys.h>
|
|
|
-#include <asm/arch-ns9xxx/clock.h>
|
|
|
+#include <asm/arch-ns9xxx/processor-ns9360.h>
|
|
|
+#include <asm/arch-ns9xxx/regs-sys-ns9360.h>
|
|
|
#include <asm/arch-ns9xxx/irqs.h>
|
|
|
#include <asm/arch/system.h>
|
|
|
#include "generic.h"
|
|
@@ -25,26 +25,26 @@
|
|
|
#define TIMER_CLOCKEVENT 1
|
|
|
static u32 latch;
|
|
|
|
|
|
-static cycle_t ns9xxx_clocksource_read(void)
|
|
|
+static cycle_t ns9360_clocksource_read(void)
|
|
|
{
|
|
|
return __raw_readl(SYS_TR(TIMER_CLOCKSOURCE));
|
|
|
}
|
|
|
|
|
|
-static struct clocksource ns9xxx_clocksource = {
|
|
|
- .name = "ns9xxx-timer" __stringify(TIMER_CLOCKSOURCE),
|
|
|
+static struct clocksource ns9360_clocksource = {
|
|
|
+ .name = "ns9360-timer" __stringify(TIMER_CLOCKSOURCE),
|
|
|
.rating = 300,
|
|
|
- .read = ns9xxx_clocksource_read,
|
|
|
+ .read = ns9360_clocksource_read,
|
|
|
.mask = CLOCKSOURCE_MASK(32),
|
|
|
.shift = 20,
|
|
|
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
|
|
};
|
|
|
|
|
|
-static void ns9xxx_clockevent_setmode(enum clock_event_mode mode,
|
|
|
+static void ns9360_clockevent_setmode(enum clock_event_mode mode,
|
|
|
struct clock_event_device *clk)
|
|
|
{
|
|
|
u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT));
|
|
|
|
|
|
- switch(mode) {
|
|
|
+ switch (mode) {
|
|
|
case CLOCK_EVT_MODE_PERIODIC:
|
|
|
__raw_writel(latch, SYS_TRC(TIMER_CLOCKEVENT));
|
|
|
REGSET(tc, SYS_TCx, REN, EN);
|
|
@@ -69,7 +69,7 @@ static void ns9xxx_clockevent_setmode(enum clock_event_mode mode,
|
|
|
__raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT));
|
|
|
}
|
|
|
|
|
|
-static int ns9xxx_clockevent_setnextevent(unsigned long evt,
|
|
|
+static int ns9360_clockevent_setnextevent(unsigned long evt,
|
|
|
struct clock_event_device *clk)
|
|
|
{
|
|
|
u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT));
|
|
@@ -88,20 +88,20 @@ static int ns9xxx_clockevent_setnextevent(unsigned long evt,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static struct clock_event_device ns9xxx_clockevent_device = {
|
|
|
- .name = "ns9xxx-timer" __stringify(TIMER_CLOCKEVENT),
|
|
|
+static struct clock_event_device ns9360_clockevent_device = {
|
|
|
+ .name = "ns9360-timer" __stringify(TIMER_CLOCKEVENT),
|
|
|
.shift = 20,
|
|
|
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
|
|
|
- .set_mode = ns9xxx_clockevent_setmode,
|
|
|
- .set_next_event = ns9xxx_clockevent_setnextevent,
|
|
|
+ .set_mode = ns9360_clockevent_setmode,
|
|
|
+ .set_next_event = ns9360_clockevent_setnextevent,
|
|
|
};
|
|
|
|
|
|
-static irqreturn_t ns9xxx_clockevent_handler(int irq, void *dev_id)
|
|
|
+static irqreturn_t ns9360_clockevent_handler(int irq, void *dev_id)
|
|
|
{
|
|
|
- int timerno = irq - IRQ_TIMER0;
|
|
|
+ int timerno = irq - IRQ_NS9360_TIMER0;
|
|
|
u32 tc;
|
|
|
|
|
|
- struct clock_event_device *evt = &ns9xxx_clockevent_device;
|
|
|
+ struct clock_event_device *evt = &ns9360_clockevent_device;
|
|
|
|
|
|
/* clear irq */
|
|
|
tc = __raw_readl(SYS_TC(timerno));
|
|
@@ -119,13 +119,13 @@ static irqreturn_t ns9xxx_clockevent_handler(int irq, void *dev_id)
|
|
|
return IRQ_HANDLED;
|
|
|
}
|
|
|
|
|
|
-static struct irqaction ns9xxx_clockevent_action = {
|
|
|
- .name = "ns9xxx-timer" __stringify(TIMER_CLOCKEVENT),
|
|
|
+static struct irqaction ns9360_clockevent_action = {
|
|
|
+ .name = "ns9360-timer" __stringify(TIMER_CLOCKEVENT),
|
|
|
.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
|
|
|
- .handler = ns9xxx_clockevent_handler,
|
|
|
+ .handler = ns9360_clockevent_handler,
|
|
|
};
|
|
|
|
|
|
-static void __init ns9xxx_timer_init(void)
|
|
|
+static void __init ns9360_timer_init(void)
|
|
|
{
|
|
|
int tc;
|
|
|
|
|
@@ -148,12 +148,12 @@ static void __init ns9xxx_timer_init(void)
|
|
|
|
|
|
__raw_writel(tc, SYS_TC(TIMER_CLOCKSOURCE));
|
|
|
|
|
|
- ns9xxx_clocksource.mult = clocksource_hz2mult(ns9xxx_cpuclock(),
|
|
|
- ns9xxx_clocksource.shift);
|
|
|
+ ns9360_clocksource.mult = clocksource_hz2mult(ns9360_cpuclock(),
|
|
|
+ ns9360_clocksource.shift);
|
|
|
|
|
|
- clocksource_register(&ns9xxx_clocksource);
|
|
|
+ clocksource_register(&ns9360_clocksource);
|
|
|
|
|
|
- latch = SH_DIV(ns9xxx_cpuclock(), HZ, 0);
|
|
|
+ latch = SH_DIV(ns9360_cpuclock(), HZ, 0);
|
|
|
|
|
|
tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT));
|
|
|
REGSET(tc, SYS_TCx, TEN, DIS);
|
|
@@ -166,19 +166,20 @@ static void __init ns9xxx_timer_init(void)
|
|
|
REGSET(tc, SYS_TCx, REN, EN);
|
|
|
__raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT));
|
|
|
|
|
|
- ns9xxx_clockevent_device.mult = div_sc(ns9xxx_cpuclock(),
|
|
|
- NSEC_PER_SEC, ns9xxx_clockevent_device.shift);
|
|
|
- ns9xxx_clockevent_device.max_delta_ns =
|
|
|
- clockevent_delta2ns(-1, &ns9xxx_clockevent_device);
|
|
|
- ns9xxx_clockevent_device.min_delta_ns =
|
|
|
- clockevent_delta2ns(1, &ns9xxx_clockevent_device);
|
|
|
+ ns9360_clockevent_device.mult = div_sc(ns9360_cpuclock(),
|
|
|
+ NSEC_PER_SEC, ns9360_clockevent_device.shift);
|
|
|
+ ns9360_clockevent_device.max_delta_ns =
|
|
|
+ clockevent_delta2ns(-1, &ns9360_clockevent_device);
|
|
|
+ ns9360_clockevent_device.min_delta_ns =
|
|
|
+ clockevent_delta2ns(1, &ns9360_clockevent_device);
|
|
|
|
|
|
- ns9xxx_clockevent_device.cpumask = cpumask_of_cpu(0);
|
|
|
- clockevents_register_device(&ns9xxx_clockevent_device);
|
|
|
+ ns9360_clockevent_device.cpumask = cpumask_of_cpu(0);
|
|
|
+ clockevents_register_device(&ns9360_clockevent_device);
|
|
|
|
|
|
- setup_irq(IRQ_TIMER0 + TIMER_CLOCKEVENT, &ns9xxx_clockevent_action);
|
|
|
+ setup_irq(IRQ_NS9360_TIMER0 + TIMER_CLOCKEVENT,
|
|
|
+ &ns9360_clockevent_action);
|
|
|
}
|
|
|
|
|
|
-struct sys_timer ns9xxx_timer = {
|
|
|
- .init = ns9xxx_timer_init,
|
|
|
+struct sys_timer ns9360_timer = {
|
|
|
+ .init = ns9360_timer_init,
|
|
|
};
|