aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/patches-3.18/0066-cevt.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ramips/patches-3.18/0066-cevt.patch')
-rw-r--r--target/linux/ramips/patches-3.18/0066-cevt.patch30
1 files changed, 15 insertions, 15 deletions
diff --git a/target/linux/ramips/patches-3.18/0066-cevt.patch b/target/linux/ramips/patches-3.18/0066-cevt.patch
index 01cb588cd9..9eb6cb612b 100644
--- a/target/linux/ramips/patches-3.18/0066-cevt.patch
+++ b/target/linux/ramips/patches-3.18/0066-cevt.patch
@@ -3,7 +3,7 @@
@@ -45,18 +45,33 @@ static void (*systick_freq_scaling)(stru
static void systick_set_clock_mode(enum clock_event_mode mode,
struct clock_event_device *evt);
-
+
+static inline unsigned int read_count(struct systick_device *sdev)
+{
+ return ioread32(sdev->membase + SYSTICK_COUNT);
@@ -25,7 +25,7 @@
struct systick_device *sdev;
- u32 count;
+ int res;
-
+
sdev = container_of(evt, struct systick_device, dev);
- count = ioread32(sdev->membase + SYSTICK_COUNT);
- count = (count + delta) % SYSTICK_FREQ;
@@ -33,21 +33,21 @@
+ delta += read_count(sdev);
+ write_compare(sdev, delta);
+ res = ((int)(read_count(sdev) - delta) >= 0) ? -ETIME : 0;
-
+
- return 0;
+ return res;
}
-
+
static void systick_event_handler(struct clock_event_device *dev)
@@ -66,20 +81,25 @@ static void systick_event_handler(struct
-
+
static irqreturn_t systick_interrupt(int irq, void *dev_id)
{
- struct clock_event_device *dev = (struct clock_event_device *) dev_id;
+ int ret = 0;
+ struct clock_event_device *cdev;
+ struct systick_device *sdev;
-
+
- dev->event_handler(dev);
+ if (read_c0_cause() & STATUSF_IP7) {
+ cdev = (struct clock_event_device *) dev_id;
@@ -58,11 +58,11 @@
+ cdev->event_handler(cdev);
+ ret = 1;
+ }
-
+
- return IRQ_HANDLED;
+ return IRQ_RETVAL(ret);
}
-
+
static struct systick_device systick = {
.dev = {
- /*
@@ -76,7 +76,7 @@
@@ -126,13 +146,14 @@ static void systick_set_clock_mode(enum
systick_freq_scaling(sdev, 1);
break;
-
+
+ case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
if (systick_freq_scaling)
@@ -88,26 +88,26 @@
- iowrite32(0, systick.membase + SYSTICK_CONFIG);
+ iowrite32(CFG_CNT_EN, systick.membase + SYSTICK_CONFIG);
break;
-
+
default:
@@ -142,38 +163,45 @@ static void systick_set_clock_mode(enum
}
-
+
static const struct of_device_id systick_match[] = {
- { .compatible = "ralink,mt7620-systick", .data = mt7620_freq_scaling},
+ { .compatible = "ralink,mt7620a-systick", .data = mt7620_freq_scaling},
{},
};
-
+
static void __init ralink_systick_init(struct device_node *np)
{
const struct of_device_id *match;
+ int rating = 200;
-
+
systick.membase = of_iomap(np, 0);
if (!systick.membase)
return;
-
+
match = of_match_node(systick_match, np);
- if (match)
+ if (match) {
@@ -118,7 +118,7 @@
+ */
+ rating = 310;
+ }
-
+
- systick_irqaction.name = np->name;
- systick.dev.name = np->name;
- clockevents_calc_mult_shift(&systick.dev, SYSTICK_FREQ, 60);