2011-07-08 17:40:12 +08:00
|
|
|
/*
|
|
|
|
* System timer for CSR SiRFprimaII
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
|
|
|
|
*
|
|
|
|
* Licensed under GPLv2 or later.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/clockchips.h>
|
|
|
|
#include <linux/clocksource.h>
|
|
|
|
#include <linux/bitops.h>
|
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/clk.h>
|
|
|
|
#include <linux/err.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/of.h>
|
2013-03-19 22:31:08 +08:00
|
|
|
#include <linux/of_irq.h>
|
2011-07-08 17:40:12 +08:00
|
|
|
#include <linux/of_address.h>
|
2013-06-02 14:39:40 +08:00
|
|
|
#include <linux/sched_clock.h>
|
2011-07-08 17:40:12 +08:00
|
|
|
|
2013-11-12 04:06:11 +08:00
|
|
|
#define PRIMA2_CLOCK_FREQ 1000000
|
|
|
|
|
2011-07-08 17:40:12 +08:00
|
|
|
#define SIRFSOC_TIMER_COUNTER_LO 0x0000
|
|
|
|
#define SIRFSOC_TIMER_COUNTER_HI 0x0004
|
|
|
|
#define SIRFSOC_TIMER_MATCH_0 0x0008
|
|
|
|
#define SIRFSOC_TIMER_MATCH_1 0x000C
|
|
|
|
#define SIRFSOC_TIMER_MATCH_2 0x0010
|
|
|
|
#define SIRFSOC_TIMER_MATCH_3 0x0014
|
|
|
|
#define SIRFSOC_TIMER_MATCH_4 0x0018
|
|
|
|
#define SIRFSOC_TIMER_MATCH_5 0x001C
|
|
|
|
#define SIRFSOC_TIMER_STATUS 0x0020
|
|
|
|
#define SIRFSOC_TIMER_INT_EN 0x0024
|
|
|
|
#define SIRFSOC_TIMER_WATCHDOG_EN 0x0028
|
|
|
|
#define SIRFSOC_TIMER_DIV 0x002C
|
|
|
|
#define SIRFSOC_TIMER_LATCH 0x0030
|
|
|
|
#define SIRFSOC_TIMER_LATCHED_LO 0x0034
|
|
|
|
#define SIRFSOC_TIMER_LATCHED_HI 0x0038
|
|
|
|
|
|
|
|
#define SIRFSOC_TIMER_WDT_INDEX 5
|
|
|
|
|
|
|
|
#define SIRFSOC_TIMER_LATCH_BIT BIT(0)
|
|
|
|
|
2011-09-21 20:56:33 +08:00
|
|
|
#define SIRFSOC_TIMER_REG_CNT 11
|
|
|
|
|
|
|
|
static const u32 sirfsoc_timer_reg_list[SIRFSOC_TIMER_REG_CNT] = {
|
|
|
|
SIRFSOC_TIMER_MATCH_0, SIRFSOC_TIMER_MATCH_1, SIRFSOC_TIMER_MATCH_2,
|
|
|
|
SIRFSOC_TIMER_MATCH_3, SIRFSOC_TIMER_MATCH_4, SIRFSOC_TIMER_MATCH_5,
|
|
|
|
SIRFSOC_TIMER_INT_EN, SIRFSOC_TIMER_WATCHDOG_EN, SIRFSOC_TIMER_DIV,
|
|
|
|
SIRFSOC_TIMER_LATCHED_LO, SIRFSOC_TIMER_LATCHED_HI,
|
|
|
|
};
|
|
|
|
|
|
|
|
static u32 sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT];
|
|
|
|
|
2011-07-08 17:40:12 +08:00
|
|
|
static void __iomem *sirfsoc_timer_base;
|
|
|
|
|
|
|
|
/* timer0 interrupt handler */
|
|
|
|
static irqreturn_t sirfsoc_timer_interrupt(int irq, void *dev_id)
|
|
|
|
{
|
|
|
|
struct clock_event_device *ce = dev_id;
|
|
|
|
|
clocksource: prima2: fix some minor checkpatch issues
Fix the "line over 80 characters". users of the codes - key customers
really care about that.
WARNING: line over 80 characters
64: FILE: timer-prima2.c:64:
+ WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) & BIT(0)));
WARNING: line over 80 characters
80: FILE: timer-prima2.c:80:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
82: FILE: timer-prima2.c:82:
+ cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
WARNING: line over 80 characters
92: FILE: timer-prima2.c:92:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
96: FILE: timer-prima2.c:96:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
111: FILE: timer-prima2.c:111:
+ writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
114: FILE: timer-prima2.c:114:
+ writel_relaxed(val & ~BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
126: FILE: timer-prima2.c:126:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
129: FILE: timer-prima2.c:129:
+ sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
137: FILE: timer-prima2.c:137:
+ writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
139: FILE: timer-prima2.c:139:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
WARNING: line over 80 characters
140: FILE: timer-prima2.c:140:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
WARNING: line over 80 characters
216: FILE: timer-prima2.c:216:
+CLOCKSOURCE_OF_DECLARE(sirfsoc_prima2_timer, "sirf,prima2-tick", sirfsoc_prima2_timer_init);
total: 0 errors, 13 warnings, 216 lines checked
timer-prima2.c has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Signed-off-by: Bin Shi <Bin.Shi@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
2014-05-06 22:42:29 +08:00
|
|
|
WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) &
|
|
|
|
BIT(0)));
|
2011-07-08 17:40:12 +08:00
|
|
|
|
|
|
|
/* clear timer0 interrupt */
|
|
|
|
writel_relaxed(BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_STATUS);
|
|
|
|
|
|
|
|
ce->event_handler(ce);
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read 64-bit timer counter */
|
2016-12-22 03:32:01 +08:00
|
|
|
static u64 notrace sirfsoc_timer_read(struct clocksource *cs)
|
2011-07-08 17:40:12 +08:00
|
|
|
{
|
|
|
|
u64 cycles;
|
|
|
|
|
|
|
|
/* latch the 64-bit timer counter */
|
clocksource: prima2: fix some minor checkpatch issues
Fix the "line over 80 characters". users of the codes - key customers
really care about that.
WARNING: line over 80 characters
64: FILE: timer-prima2.c:64:
+ WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) & BIT(0)));
WARNING: line over 80 characters
80: FILE: timer-prima2.c:80:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
82: FILE: timer-prima2.c:82:
+ cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
WARNING: line over 80 characters
92: FILE: timer-prima2.c:92:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
96: FILE: timer-prima2.c:96:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
111: FILE: timer-prima2.c:111:
+ writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
114: FILE: timer-prima2.c:114:
+ writel_relaxed(val & ~BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
126: FILE: timer-prima2.c:126:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
129: FILE: timer-prima2.c:129:
+ sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
137: FILE: timer-prima2.c:137:
+ writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
139: FILE: timer-prima2.c:139:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
WARNING: line over 80 characters
140: FILE: timer-prima2.c:140:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
WARNING: line over 80 characters
216: FILE: timer-prima2.c:216:
+CLOCKSOURCE_OF_DECLARE(sirfsoc_prima2_timer, "sirf,prima2-tick", sirfsoc_prima2_timer_init);
total: 0 errors, 13 warnings, 216 lines checked
timer-prima2.c has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Signed-off-by: Bin Shi <Bin.Shi@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
2014-05-06 22:42:29 +08:00
|
|
|
writel_relaxed(SIRFSOC_TIMER_LATCH_BIT,
|
|
|
|
sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
|
2011-07-08 17:40:12 +08:00
|
|
|
cycles = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_HI);
|
clocksource: prima2: fix some minor checkpatch issues
Fix the "line over 80 characters". users of the codes - key customers
really care about that.
WARNING: line over 80 characters
64: FILE: timer-prima2.c:64:
+ WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) & BIT(0)));
WARNING: line over 80 characters
80: FILE: timer-prima2.c:80:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
82: FILE: timer-prima2.c:82:
+ cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
WARNING: line over 80 characters
92: FILE: timer-prima2.c:92:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
96: FILE: timer-prima2.c:96:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
111: FILE: timer-prima2.c:111:
+ writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
114: FILE: timer-prima2.c:114:
+ writel_relaxed(val & ~BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
126: FILE: timer-prima2.c:126:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
129: FILE: timer-prima2.c:129:
+ sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
137: FILE: timer-prima2.c:137:
+ writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
139: FILE: timer-prima2.c:139:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
WARNING: line over 80 characters
140: FILE: timer-prima2.c:140:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
WARNING: line over 80 characters
216: FILE: timer-prima2.c:216:
+CLOCKSOURCE_OF_DECLARE(sirfsoc_prima2_timer, "sirf,prima2-tick", sirfsoc_prima2_timer_init);
total: 0 errors, 13 warnings, 216 lines checked
timer-prima2.c has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Signed-off-by: Bin Shi <Bin.Shi@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
2014-05-06 22:42:29 +08:00
|
|
|
cycles = (cycles << 32) |
|
|
|
|
readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
|
2011-07-08 17:40:12 +08:00
|
|
|
|
|
|
|
return cycles;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int sirfsoc_timer_set_next_event(unsigned long delta,
|
|
|
|
struct clock_event_device *ce)
|
|
|
|
{
|
|
|
|
unsigned long now, next;
|
|
|
|
|
clocksource: prima2: fix some minor checkpatch issues
Fix the "line over 80 characters". users of the codes - key customers
really care about that.
WARNING: line over 80 characters
64: FILE: timer-prima2.c:64:
+ WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) & BIT(0)));
WARNING: line over 80 characters
80: FILE: timer-prima2.c:80:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
82: FILE: timer-prima2.c:82:
+ cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
WARNING: line over 80 characters
92: FILE: timer-prima2.c:92:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
96: FILE: timer-prima2.c:96:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
111: FILE: timer-prima2.c:111:
+ writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
114: FILE: timer-prima2.c:114:
+ writel_relaxed(val & ~BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
126: FILE: timer-prima2.c:126:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
129: FILE: timer-prima2.c:129:
+ sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
137: FILE: timer-prima2.c:137:
+ writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
139: FILE: timer-prima2.c:139:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
WARNING: line over 80 characters
140: FILE: timer-prima2.c:140:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
WARNING: line over 80 characters
216: FILE: timer-prima2.c:216:
+CLOCKSOURCE_OF_DECLARE(sirfsoc_prima2_timer, "sirf,prima2-tick", sirfsoc_prima2_timer_init);
total: 0 errors, 13 warnings, 216 lines checked
timer-prima2.c has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Signed-off-by: Bin Shi <Bin.Shi@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
2014-05-06 22:42:29 +08:00
|
|
|
writel_relaxed(SIRFSOC_TIMER_LATCH_BIT,
|
|
|
|
sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
|
2011-07-08 17:40:12 +08:00
|
|
|
now = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
|
|
|
|
next = now + delta;
|
|
|
|
writel_relaxed(next, sirfsoc_timer_base + SIRFSOC_TIMER_MATCH_0);
|
clocksource: prima2: fix some minor checkpatch issues
Fix the "line over 80 characters". users of the codes - key customers
really care about that.
WARNING: line over 80 characters
64: FILE: timer-prima2.c:64:
+ WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) & BIT(0)));
WARNING: line over 80 characters
80: FILE: timer-prima2.c:80:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
82: FILE: timer-prima2.c:82:
+ cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
WARNING: line over 80 characters
92: FILE: timer-prima2.c:92:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
96: FILE: timer-prima2.c:96:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
111: FILE: timer-prima2.c:111:
+ writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
114: FILE: timer-prima2.c:114:
+ writel_relaxed(val & ~BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
126: FILE: timer-prima2.c:126:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
129: FILE: timer-prima2.c:129:
+ sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
137: FILE: timer-prima2.c:137:
+ writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
139: FILE: timer-prima2.c:139:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
WARNING: line over 80 characters
140: FILE: timer-prima2.c:140:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
WARNING: line over 80 characters
216: FILE: timer-prima2.c:216:
+CLOCKSOURCE_OF_DECLARE(sirfsoc_prima2_timer, "sirf,prima2-tick", sirfsoc_prima2_timer_init);
total: 0 errors, 13 warnings, 216 lines checked
timer-prima2.c has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Signed-off-by: Bin Shi <Bin.Shi@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
2014-05-06 22:42:29 +08:00
|
|
|
writel_relaxed(SIRFSOC_TIMER_LATCH_BIT,
|
|
|
|
sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
|
2011-07-08 17:40:12 +08:00
|
|
|
now = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
|
|
|
|
|
|
|
|
return next - now > delta ? -ETIME : 0;
|
|
|
|
}
|
|
|
|
|
2015-06-18 18:54:49 +08:00
|
|
|
static int sirfsoc_timer_shutdown(struct clock_event_device *evt)
|
2011-07-08 17:40:12 +08:00
|
|
|
{
|
|
|
|
u32 val = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
|
2015-06-18 18:54:49 +08:00
|
|
|
|
|
|
|
writel_relaxed(val & ~BIT(0),
|
|
|
|
sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int sirfsoc_timer_set_oneshot(struct clock_event_device *evt)
|
|
|
|
{
|
|
|
|
u32 val = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
|
|
|
|
|
|
|
|
writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
|
|
|
|
return 0;
|
2011-07-08 17:40:12 +08:00
|
|
|
}
|
|
|
|
|
2011-09-21 20:56:33 +08:00
|
|
|
static void sirfsoc_clocksource_suspend(struct clocksource *cs)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
clocksource: prima2: fix some minor checkpatch issues
Fix the "line over 80 characters". users of the codes - key customers
really care about that.
WARNING: line over 80 characters
64: FILE: timer-prima2.c:64:
+ WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) & BIT(0)));
WARNING: line over 80 characters
80: FILE: timer-prima2.c:80:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
82: FILE: timer-prima2.c:82:
+ cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
WARNING: line over 80 characters
92: FILE: timer-prima2.c:92:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
96: FILE: timer-prima2.c:96:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
111: FILE: timer-prima2.c:111:
+ writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
114: FILE: timer-prima2.c:114:
+ writel_relaxed(val & ~BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
126: FILE: timer-prima2.c:126:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
129: FILE: timer-prima2.c:129:
+ sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
137: FILE: timer-prima2.c:137:
+ writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
139: FILE: timer-prima2.c:139:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
WARNING: line over 80 characters
140: FILE: timer-prima2.c:140:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
WARNING: line over 80 characters
216: FILE: timer-prima2.c:216:
+CLOCKSOURCE_OF_DECLARE(sirfsoc_prima2_timer, "sirf,prima2-tick", sirfsoc_prima2_timer_init);
total: 0 errors, 13 warnings, 216 lines checked
timer-prima2.c has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Signed-off-by: Bin Shi <Bin.Shi@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
2014-05-06 22:42:29 +08:00
|
|
|
writel_relaxed(SIRFSOC_TIMER_LATCH_BIT,
|
|
|
|
sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
|
2011-09-21 20:56:33 +08:00
|
|
|
|
|
|
|
for (i = 0; i < SIRFSOC_TIMER_REG_CNT; i++)
|
clocksource: prima2: fix some minor checkpatch issues
Fix the "line over 80 characters". users of the codes - key customers
really care about that.
WARNING: line over 80 characters
64: FILE: timer-prima2.c:64:
+ WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) & BIT(0)));
WARNING: line over 80 characters
80: FILE: timer-prima2.c:80:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
82: FILE: timer-prima2.c:82:
+ cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
WARNING: line over 80 characters
92: FILE: timer-prima2.c:92:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
96: FILE: timer-prima2.c:96:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
111: FILE: timer-prima2.c:111:
+ writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
114: FILE: timer-prima2.c:114:
+ writel_relaxed(val & ~BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
126: FILE: timer-prima2.c:126:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
129: FILE: timer-prima2.c:129:
+ sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
137: FILE: timer-prima2.c:137:
+ writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
139: FILE: timer-prima2.c:139:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
WARNING: line over 80 characters
140: FILE: timer-prima2.c:140:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
WARNING: line over 80 characters
216: FILE: timer-prima2.c:216:
+CLOCKSOURCE_OF_DECLARE(sirfsoc_prima2_timer, "sirf,prima2-tick", sirfsoc_prima2_timer_init);
total: 0 errors, 13 warnings, 216 lines checked
timer-prima2.c has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Signed-off-by: Bin Shi <Bin.Shi@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
2014-05-06 22:42:29 +08:00
|
|
|
sirfsoc_timer_reg_val[i] =
|
|
|
|
readl_relaxed(sirfsoc_timer_base +
|
|
|
|
sirfsoc_timer_reg_list[i]);
|
2011-09-21 20:56:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void sirfsoc_clocksource_resume(struct clocksource *cs)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2012-07-30 13:29:30 +08:00
|
|
|
for (i = 0; i < SIRFSOC_TIMER_REG_CNT - 2; i++)
|
clocksource: prima2: fix some minor checkpatch issues
Fix the "line over 80 characters". users of the codes - key customers
really care about that.
WARNING: line over 80 characters
64: FILE: timer-prima2.c:64:
+ WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) & BIT(0)));
WARNING: line over 80 characters
80: FILE: timer-prima2.c:80:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
82: FILE: timer-prima2.c:82:
+ cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
WARNING: line over 80 characters
92: FILE: timer-prima2.c:92:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
96: FILE: timer-prima2.c:96:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
111: FILE: timer-prima2.c:111:
+ writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
114: FILE: timer-prima2.c:114:
+ writel_relaxed(val & ~BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
126: FILE: timer-prima2.c:126:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
129: FILE: timer-prima2.c:129:
+ sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
137: FILE: timer-prima2.c:137:
+ writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
139: FILE: timer-prima2.c:139:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
WARNING: line over 80 characters
140: FILE: timer-prima2.c:140:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
WARNING: line over 80 characters
216: FILE: timer-prima2.c:216:
+CLOCKSOURCE_OF_DECLARE(sirfsoc_prima2_timer, "sirf,prima2-tick", sirfsoc_prima2_timer_init);
total: 0 errors, 13 warnings, 216 lines checked
timer-prima2.c has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Signed-off-by: Bin Shi <Bin.Shi@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
2014-05-06 22:42:29 +08:00
|
|
|
writel_relaxed(sirfsoc_timer_reg_val[i],
|
|
|
|
sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
|
2011-09-21 20:56:33 +08:00
|
|
|
|
clocksource: prima2: fix some minor checkpatch issues
Fix the "line over 80 characters". users of the codes - key customers
really care about that.
WARNING: line over 80 characters
64: FILE: timer-prima2.c:64:
+ WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) & BIT(0)));
WARNING: line over 80 characters
80: FILE: timer-prima2.c:80:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
82: FILE: timer-prima2.c:82:
+ cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
WARNING: line over 80 characters
92: FILE: timer-prima2.c:92:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
96: FILE: timer-prima2.c:96:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
111: FILE: timer-prima2.c:111:
+ writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
114: FILE: timer-prima2.c:114:
+ writel_relaxed(val & ~BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
126: FILE: timer-prima2.c:126:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
129: FILE: timer-prima2.c:129:
+ sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
137: FILE: timer-prima2.c:137:
+ writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
139: FILE: timer-prima2.c:139:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
WARNING: line over 80 characters
140: FILE: timer-prima2.c:140:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
WARNING: line over 80 characters
216: FILE: timer-prima2.c:216:
+CLOCKSOURCE_OF_DECLARE(sirfsoc_prima2_timer, "sirf,prima2-tick", sirfsoc_prima2_timer_init);
total: 0 errors, 13 warnings, 216 lines checked
timer-prima2.c has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Signed-off-by: Bin Shi <Bin.Shi@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
2014-05-06 22:42:29 +08:00
|
|
|
writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2],
|
|
|
|
sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
|
|
|
|
writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1],
|
|
|
|
sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
|
2011-09-21 20:56:33 +08:00
|
|
|
}
|
|
|
|
|
2011-07-08 17:40:12 +08:00
|
|
|
static struct clock_event_device sirfsoc_clockevent = {
|
|
|
|
.name = "sirfsoc_clockevent",
|
|
|
|
.rating = 200,
|
|
|
|
.features = CLOCK_EVT_FEAT_ONESHOT,
|
2015-06-18 18:54:49 +08:00
|
|
|
.set_state_shutdown = sirfsoc_timer_shutdown,
|
|
|
|
.set_state_oneshot = sirfsoc_timer_set_oneshot,
|
2011-07-08 17:40:12 +08:00
|
|
|
.set_next_event = sirfsoc_timer_set_next_event,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clocksource sirfsoc_clocksource = {
|
|
|
|
.name = "sirfsoc_clocksource",
|
|
|
|
.rating = 200,
|
|
|
|
.mask = CLOCKSOURCE_MASK(64),
|
|
|
|
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
|
|
|
.read = sirfsoc_timer_read,
|
2011-09-21 20:56:33 +08:00
|
|
|
.suspend = sirfsoc_clocksource_suspend,
|
|
|
|
.resume = sirfsoc_clocksource_resume,
|
2011-07-08 17:40:12 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct irqaction sirfsoc_timer_irq = {
|
|
|
|
.name = "sirfsoc_timer0",
|
|
|
|
.flags = IRQF_TIMER,
|
|
|
|
.irq = 0,
|
|
|
|
.handler = sirfsoc_timer_interrupt,
|
|
|
|
.dev_id = &sirfsoc_clockevent,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Overwrite weak default sched_clock with more precise one */
|
2013-07-19 07:21:28 +08:00
|
|
|
static u64 notrace sirfsoc_read_sched_clock(void)
|
2011-07-08 17:40:12 +08:00
|
|
|
{
|
2013-07-19 07:21:28 +08:00
|
|
|
return sirfsoc_timer_read(NULL);
|
2011-07-08 17:40:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void __init sirfsoc_clockevent_init(void)
|
|
|
|
{
|
|
|
|
sirfsoc_clockevent.cpumask = cpumask_of(0);
|
2013-11-12 04:06:11 +08:00
|
|
|
clockevents_config_and_register(&sirfsoc_clockevent, PRIMA2_CLOCK_FREQ,
|
2013-01-12 19:50:05 +08:00
|
|
|
2, -2);
|
2011-07-08 17:40:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize the kernel jiffy timer source */
|
2016-06-07 05:02:59 +08:00
|
|
|
static int __init sirfsoc_prima2_timer_init(struct device_node *np)
|
2011-07-08 17:40:12 +08:00
|
|
|
{
|
|
|
|
unsigned long rate;
|
2012-08-20 14:42:36 +08:00
|
|
|
struct clk *clk;
|
2016-06-07 05:02:59 +08:00
|
|
|
int ret;
|
2012-08-20 14:42:36 +08:00
|
|
|
|
2014-05-05 19:30:04 +08:00
|
|
|
clk = of_clk_get(np, 0);
|
2016-06-07 05:02:59 +08:00
|
|
|
if (IS_ERR(clk)) {
|
2017-03-09 17:47:10 +08:00
|
|
|
pr_err("Failed to get clock\n");
|
2016-06-07 05:02:59 +08:00
|
|
|
return PTR_ERR(clk);
|
|
|
|
}
|
2014-07-03 20:52:51 +08:00
|
|
|
|
2016-06-07 05:02:59 +08:00
|
|
|
ret = clk_prepare_enable(clk);
|
|
|
|
if (ret) {
|
2017-03-09 17:47:10 +08:00
|
|
|
pr_err("Failed to enable clock\n");
|
2016-06-07 05:02:59 +08:00
|
|
|
return ret;
|
|
|
|
}
|
2014-07-03 20:52:51 +08:00
|
|
|
|
2011-07-08 17:40:12 +08:00
|
|
|
rate = clk_get_rate(clk);
|
|
|
|
|
2016-06-07 05:02:59 +08:00
|
|
|
if (rate < PRIMA2_CLOCK_FREQ || rate % PRIMA2_CLOCK_FREQ) {
|
2017-03-09 17:47:10 +08:00
|
|
|
pr_err("Invalid clock rate\n");
|
2016-06-07 05:02:59 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
2011-07-08 17:40:12 +08:00
|
|
|
|
2013-03-19 22:27:22 +08:00
|
|
|
sirfsoc_timer_base = of_iomap(np, 0);
|
2016-06-07 05:02:59 +08:00
|
|
|
if (!sirfsoc_timer_base) {
|
|
|
|
pr_err("unable to map timer cpu registers\n");
|
|
|
|
return -ENXIO;
|
|
|
|
}
|
2013-03-19 22:27:22 +08:00
|
|
|
|
|
|
|
sirfsoc_timer_irq.irq = irq_of_parse_and_map(np, 0);
|
2012-01-16 19:44:12 +08:00
|
|
|
|
2013-11-12 04:06:11 +08:00
|
|
|
writel_relaxed(rate / PRIMA2_CLOCK_FREQ / 2 - 1,
|
clocksource: prima2: fix some minor checkpatch issues
Fix the "line over 80 characters". users of the codes - key customers
really care about that.
WARNING: line over 80 characters
64: FILE: timer-prima2.c:64:
+ WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) & BIT(0)));
WARNING: line over 80 characters
80: FILE: timer-prima2.c:80:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
82: FILE: timer-prima2.c:82:
+ cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
WARNING: line over 80 characters
92: FILE: timer-prima2.c:92:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
96: FILE: timer-prima2.c:96:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
111: FILE: timer-prima2.c:111:
+ writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
114: FILE: timer-prima2.c:114:
+ writel_relaxed(val & ~BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
126: FILE: timer-prima2.c:126:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
129: FILE: timer-prima2.c:129:
+ sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
137: FILE: timer-prima2.c:137:
+ writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
139: FILE: timer-prima2.c:139:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
WARNING: line over 80 characters
140: FILE: timer-prima2.c:140:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
WARNING: line over 80 characters
216: FILE: timer-prima2.c:216:
+CLOCKSOURCE_OF_DECLARE(sirfsoc_prima2_timer, "sirf,prima2-tick", sirfsoc_prima2_timer_init);
total: 0 errors, 13 warnings, 216 lines checked
timer-prima2.c has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Signed-off-by: Bin Shi <Bin.Shi@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
2014-05-06 22:42:29 +08:00
|
|
|
sirfsoc_timer_base + SIRFSOC_TIMER_DIV);
|
2011-07-08 17:40:12 +08:00
|
|
|
writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
|
|
|
|
writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
|
|
|
|
writel_relaxed(BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_STATUS);
|
|
|
|
|
2016-06-07 05:02:59 +08:00
|
|
|
ret = clocksource_register_hz(&sirfsoc_clocksource, PRIMA2_CLOCK_FREQ);
|
|
|
|
if (ret) {
|
2017-03-09 17:47:10 +08:00
|
|
|
pr_err("Failed to register clocksource\n");
|
2016-06-07 05:02:59 +08:00
|
|
|
return ret;
|
|
|
|
}
|
2011-07-08 17:40:12 +08:00
|
|
|
|
2013-11-12 04:06:11 +08:00
|
|
|
sched_clock_register(sirfsoc_read_sched_clock, 64, PRIMA2_CLOCK_FREQ);
|
2012-01-16 19:44:12 +08:00
|
|
|
|
2016-06-07 05:02:59 +08:00
|
|
|
ret = setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq);
|
|
|
|
if (ret) {
|
2017-03-09 17:47:10 +08:00
|
|
|
pr_err("Failed to setup irq\n");
|
2016-06-07 05:02:59 +08:00
|
|
|
return ret;
|
|
|
|
}
|
2011-07-08 17:40:12 +08:00
|
|
|
|
|
|
|
sirfsoc_clockevent_init();
|
2016-06-07 05:02:59 +08:00
|
|
|
|
|
|
|
return 0;
|
2011-07-08 17:40:12 +08:00
|
|
|
}
|
2016-06-07 06:27:44 +08:00
|
|
|
CLOCKSOURCE_OF_DECLARE(sirfsoc_prima2_timer,
|
clocksource: prima2: fix some minor checkpatch issues
Fix the "line over 80 characters". users of the codes - key customers
really care about that.
WARNING: line over 80 characters
64: FILE: timer-prima2.c:64:
+ WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) & BIT(0)));
WARNING: line over 80 characters
80: FILE: timer-prima2.c:80:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
82: FILE: timer-prima2.c:82:
+ cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
WARNING: line over 80 characters
92: FILE: timer-prima2.c:92:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
96: FILE: timer-prima2.c:96:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
111: FILE: timer-prima2.c:111:
+ writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
114: FILE: timer-prima2.c:114:
+ writel_relaxed(val & ~BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
WARNING: line over 80 characters
126: FILE: timer-prima2.c:126:
+ writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
WARNING: line over 80 characters
129: FILE: timer-prima2.c:129:
+ sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
137: FILE: timer-prima2.c:137:
+ writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
WARNING: line over 80 characters
139: FILE: timer-prima2.c:139:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
WARNING: line over 80 characters
140: FILE: timer-prima2.c:140:
+ writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
WARNING: line over 80 characters
216: FILE: timer-prima2.c:216:
+CLOCKSOURCE_OF_DECLARE(sirfsoc_prima2_timer, "sirf,prima2-tick", sirfsoc_prima2_timer_init);
total: 0 errors, 13 warnings, 216 lines checked
timer-prima2.c has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Signed-off-by: Bin Shi <Bin.Shi@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
2014-05-06 22:42:29 +08:00
|
|
|
"sirf,prima2-tick", sirfsoc_prima2_timer_init);
|