Skip to content

Commit

Permalink
microblaze: timer: Replace microblaze_ prefix by xilinx_
Browse files Browse the repository at this point in the history
The main reason that this driver can be used by ARM
and PPC. The part of preparing of move to generic location.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
  • Loading branch information
Michal Simek committed Sep 3, 2013
1 parent 1e52980 commit 5955563
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions arch/microblaze/kernel/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ static unsigned int timer_clock_freq;
#define TCSR_PWMA (1<<9)
#define TCSR_ENALL (1<<10)

static inline void microblaze_timer0_stop(void)
static inline void xilinx_timer0_stop(void)
{
out_be32(timer_baseaddr + TCSR0,
in_be32(timer_baseaddr + TCSR0) & ~TCSR_ENT);
}

static inline void microblaze_timer0_start_periodic(unsigned long load_val)
static inline void xilinx_timer0_start_periodic(unsigned long load_val)
{
if (!load_val)
load_val = 1;
Expand All @@ -75,7 +75,7 @@ static inline void microblaze_timer0_start_periodic(unsigned long load_val)
TCSR_TINT|TCSR_ENIT|TCSR_ENT|TCSR_ARHT|TCSR_UDT);
}

static inline void microblaze_timer0_start_oneshot(unsigned long load_val)
static inline void xilinx_timer0_start_oneshot(unsigned long load_val)
{
if (!load_val)
load_val = 1;
Expand All @@ -89,21 +89,21 @@ static inline void microblaze_timer0_start_oneshot(unsigned long load_val)
TCSR_TINT|TCSR_ENIT|TCSR_ENT|TCSR_ARHT|TCSR_UDT);
}

static int microblaze_timer_set_next_event(unsigned long delta,
static int xilinx_timer_set_next_event(unsigned long delta,
struct clock_event_device *dev)
{
pr_debug("%s: next event, delta %x\n", __func__, (u32)delta);
microblaze_timer0_start_oneshot(delta);
xilinx_timer0_start_oneshot(delta);
return 0;
}

static void microblaze_timer_set_mode(enum clock_event_mode mode,
static void xilinx_timer_set_mode(enum clock_event_mode mode,
struct clock_event_device *evt)
{
switch (mode) {
case CLOCK_EVT_MODE_PERIODIC:
pr_info("%s: periodic\n", __func__);
microblaze_timer0_start_periodic(freq_div_hz);
xilinx_timer0_start_periodic(freq_div_hz);
break;
case CLOCK_EVT_MODE_ONESHOT:
pr_info("%s: oneshot\n", __func__);
Expand All @@ -113,21 +113,21 @@ static void microblaze_timer_set_mode(enum clock_event_mode mode,
break;
case CLOCK_EVT_MODE_SHUTDOWN:
pr_info("%s: shutdown\n", __func__);
microblaze_timer0_stop();
xilinx_timer0_stop();
break;
case CLOCK_EVT_MODE_RESUME:
pr_info("%s: resume\n", __func__);
break;
}
}

static struct clock_event_device clockevent_microblaze_timer = {
.name = "microblaze_clockevent",
static struct clock_event_device clockevent_xilinx_timer = {
.name = "xilinx_clockevent",
.features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
.shift = 8,
.rating = 300,
.set_next_event = microblaze_timer_set_next_event,
.set_mode = microblaze_timer_set_mode,
.set_next_event = xilinx_timer_set_next_event,
.set_mode = xilinx_timer_set_mode,
};

static inline void timer_ack(void)
Expand All @@ -137,7 +137,7 @@ static inline void timer_ack(void)

static irqreturn_t timer_interrupt(int irq, void *dev_id)
{
struct clock_event_device *evt = &clockevent_microblaze_timer;
struct clock_event_device *evt = &clockevent_xilinx_timer;
#ifdef CONFIG_HEART_BEAT
heartbeat();
#endif
Expand All @@ -150,62 +150,62 @@ static struct irqaction timer_irqaction = {
.handler = timer_interrupt,
.flags = IRQF_DISABLED | IRQF_TIMER,
.name = "timer",
.dev_id = &clockevent_microblaze_timer,
.dev_id = &clockevent_xilinx_timer,
};

static __init void microblaze_clockevent_init(void)
static __init void xilinx_clockevent_init(void)
{
clockevent_microblaze_timer.mult =
clockevent_xilinx_timer.mult =
div_sc(timer_clock_freq, NSEC_PER_SEC,
clockevent_microblaze_timer.shift);
clockevent_microblaze_timer.max_delta_ns =
clockevent_delta2ns((u32)~0, &clockevent_microblaze_timer);
clockevent_microblaze_timer.min_delta_ns =
clockevent_delta2ns(1, &clockevent_microblaze_timer);
clockevent_microblaze_timer.cpumask = cpumask_of(0);
clockevents_register_device(&clockevent_microblaze_timer);
clockevent_xilinx_timer.shift);
clockevent_xilinx_timer.max_delta_ns =
clockevent_delta2ns((u32)~0, &clockevent_xilinx_timer);
clockevent_xilinx_timer.min_delta_ns =
clockevent_delta2ns(1, &clockevent_xilinx_timer);
clockevent_xilinx_timer.cpumask = cpumask_of(0);
clockevents_register_device(&clockevent_xilinx_timer);
}

static cycle_t microblaze_read(struct clocksource *cs)
static cycle_t xilinx_read(struct clocksource *cs)
{
/* reading actual value of timer 1 */
return (cycle_t) (in_be32(timer_baseaddr + TCR1));
}

static struct timecounter microblaze_tc = {
static struct timecounter xilinx_tc = {
.cc = NULL,
};

static cycle_t microblaze_cc_read(const struct cyclecounter *cc)
static cycle_t xilinx_cc_read(const struct cyclecounter *cc)
{
return microblaze_read(NULL);
return xilinx_read(NULL);
}

static struct cyclecounter microblaze_cc = {
.read = microblaze_cc_read,
static struct cyclecounter xilinx_cc = {
.read = xilinx_cc_read,
.mask = CLOCKSOURCE_MASK(32),
.shift = 8,
};

static int __init init_microblaze_timecounter(void)
static int __init init_xilinx_timecounter(void)
{
microblaze_cc.mult = div_sc(timer_clock_freq, NSEC_PER_SEC,
microblaze_cc.shift);
xilinx_cc.mult = div_sc(timer_clock_freq, NSEC_PER_SEC,
xilinx_cc.shift);

timecounter_init(&microblaze_tc, &microblaze_cc, sched_clock());
timecounter_init(&xilinx_tc, &xilinx_cc, sched_clock());

return 0;
}

static struct clocksource clocksource_microblaze = {
.name = "microblaze_clocksource",
.name = "xilinx_clocksource",
.rating = 300,
.read = microblaze_read,
.read = xilinx_read,
.mask = CLOCKSOURCE_MASK(32),
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};

static int __init microblaze_clocksource_init(void)
static int __init xilinx_clocksource_init(void)
{
if (clocksource_register_hz(&clocksource_microblaze, timer_clock_freq))
panic("failed to register clocksource");
Expand All @@ -217,7 +217,7 @@ static int __init microblaze_clocksource_init(void)
out_be32(timer_baseaddr + TCSR1, TCSR_TINT|TCSR_ENT|TCSR_ARHT);

/* register timecounter - for ftrace support */
init_microblaze_timecounter();
init_xilinx_timecounter();
return 0;
}

Expand Down Expand Up @@ -260,8 +260,8 @@ static void __init xilinx_timer_init(struct device_node *timer)
#ifdef CONFIG_HEART_BEAT
setup_heartbeat();
#endif
microblaze_clocksource_init();
microblaze_clockevent_init();
xilinx_clocksource_init();
xilinx_clockevent_init();
timer_initialized = 1;
}

Expand Down

0 comments on commit 5955563

Please sign in to comment.