Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "dw_apb_timer_of.c: Remove parts that were picoxcell-specific"

This reverts commit 55a68c23e0a675b2b8ac2656fd6edbf98b78e4c6.

In order to avoid a collision with dw_apb_timer changes in
the arm-soc tree, revert this change.

I'm leaving it to the arm-soc folks to sort out if they want
to keep the other side of the collision or if they're just going
to back it all out and try again during the next release cycle.

Reported-by: Dinh Nguyen <dinguyen@altera.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>

+38 -30
+2
arch/arm/mach-picoxcell/common.h
··· 12 12 13 13 #include <asm/mach/time.h> 14 14 15 + extern void dw_apb_timer_init(void); 16 + 15 17 #endif /* __PICOXCELL_COMMON_H__ */
+6
drivers/clocksource/dw_apb_timer.c
··· 21 21 #define APBT_MIN_PERIOD 4 22 22 #define APBT_MIN_DELTA_USEC 200 23 23 24 + #define APBTMR_N_LOAD_COUNT 0x00 25 + #define APBTMR_N_CURRENT_VALUE 0x04 26 + #define APBTMR_N_CONTROL 0x08 27 + #define APBTMR_N_EOI 0x0c 28 + #define APBTMR_N_INT_STATUS 0x10 29 + 24 30 #define APBTMRS_INT_STATUS 0xa0 25 31 #define APBTMRS_EOI 0xa4 26 32 #define APBTMRS_RAW_INT_STATUS 0xa8
+30 -24
drivers/clocksource/dw_apb_timer_of.c
··· 55 55 dw_apb_clockevent_register(ced); 56 56 } 57 57 58 - static void __iomem *sched_io_base; 59 - 60 - /* This is actually same as __apbt_read_clocksource(), but with 61 - different interface */ 62 - static u32 read_sched_clock_sptimer(void) 63 - { 64 - return ~__raw_readl(sched_io_base + APBTMR_N_CURRENT_VALUE); 65 - } 66 - 67 58 static void add_clocksource(struct device_node *source_timer) 68 59 { 69 60 void __iomem *iobase; ··· 69 78 70 79 dw_apb_clocksource_start(cs); 71 80 dw_apb_clocksource_register(cs); 81 + } 72 82 73 - sched_io_base = iobase; 74 - setup_sched_clock(read_sched_clock_sptimer, 32, rate); 83 + static void __iomem *sched_io_base; 84 + 85 + static u32 read_sched_clock(void) 86 + { 87 + return __raw_readl(sched_io_base); 88 + } 89 + 90 + static const struct of_device_id sptimer_ids[] __initconst = { 91 + { .compatible = "picochip,pc3x2-rtc" }, 92 + { .compatible = "snps,dw-apb-timer-sp" }, 93 + { /* Sentinel */ }, 94 + }; 95 + 96 + static void init_sched_clock(void) 97 + { 98 + struct device_node *sched_timer; 99 + u32 rate; 100 + 101 + sched_timer = of_find_matching_node(NULL, sptimer_ids); 102 + if (!sched_timer) 103 + panic("No RTC for sched clock to use"); 104 + 105 + timer_get_base_and_rate(sched_timer, &sched_io_base, &rate); 106 + of_node_put(sched_timer); 107 + 108 + setup_sched_clock(read_sched_clock, 32, rate); 75 109 } 76 110 77 111 static const struct of_device_id osctimer_ids[] __initconst = { 78 112 { .compatible = "picochip,pc3x2-timer" }, 79 113 { .compatible = "snps,dw-apb-timer-osc" }, 80 - { .compatible = "snps,dw-apb-timer-sp" }, 81 - { /* Sentinel */ }, 114 + {}, 82 115 }; 83 - 84 - /* 85 - You don't have to use dw_apb_timer for scheduler clock, 86 - this should also work fine on arm: 87 - 88 - twd_local_timer_of_register(); 89 - arch_timer_of_register(); 90 - arch_timer_sched_clock_init(); 91 - */ 92 - 93 116 94 117 void __init dw_apb_timer_init(void) 95 118 { ··· 119 114 panic("No timer for clocksource"); 120 115 add_clocksource(source_timer); 121 116 122 - of_node_put(event_timer); 123 117 of_node_put(source_timer); 118 + 119 + init_sched_clock(); 124 120 }
-6
include/linux/dw_apb_timer.h
··· 17 17 #include <linux/clocksource.h> 18 18 #include <linux/interrupt.h> 19 19 20 - #define APBTMR_N_LOAD_COUNT 0x00 21 - #define APBTMR_N_CURRENT_VALUE 0x04 22 - #define APBTMR_N_CONTROL 0x08 23 - #define APBTMR_N_EOI 0x0c 24 - #define APBTMR_N_INT_STATUS 0x10 25 - 26 20 #define APBTMRS_REG_SIZE 0x14 27 21 28 22 struct dw_apb_timer {