diff options
-rw-r--r-- | arch/arm/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/configs/netx_defconfig | 6 | ||||
-rw-r--r-- | arch/arm/configs/picotux200_defconfig | 6 | ||||
-rw-r--r-- | arch/arm/kernel/ftrace.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91rm9200_time.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-netx/include/mach/netx-regs.h | 22 | ||||
-rw-r--r-- | arch/arm/mach-netx/time.c | 98 | ||||
-rw-r--r-- | arch/arm/mach-netx/xc.c | 6 |
8 files changed, 127 insertions, 25 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f1a3b10cfa9e..4f870207f496 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -156,7 +156,6 @@ config ARCH_MTD_XIP | |||
156 | bool | 156 | bool |
157 | 157 | ||
158 | config GENERIC_HARDIRQS_NO__DO_IRQ | 158 | config GENERIC_HARDIRQS_NO__DO_IRQ |
159 | bool | ||
160 | def_bool y | 159 | def_bool y |
161 | 160 | ||
162 | if OPROFILE | 161 | if OPROFILE |
@@ -288,6 +287,8 @@ config ARCH_NETX | |||
288 | bool "Hilscher NetX based" | 287 | bool "Hilscher NetX based" |
289 | select CPU_ARM926T | 288 | select CPU_ARM926T |
290 | select ARM_VIC | 289 | select ARM_VIC |
290 | select GENERIC_CLOCKEVENTS | ||
291 | select GENERIC_TIME | ||
291 | help | 292 | help |
292 | This enables support for systems based on the Hilscher NetX Soc | 293 | This enables support for systems based on the Hilscher NetX Soc |
293 | 294 | ||
diff --git a/arch/arm/configs/netx_defconfig b/arch/arm/configs/netx_defconfig index 0884f2370c3a..61d0fc5b2417 100644 --- a/arch/arm/configs/netx_defconfig +++ b/arch/arm/configs/netx_defconfig | |||
@@ -728,9 +728,9 @@ CONFIG_RTC_CLASS=m | |||
728 | # | 728 | # |
729 | # RTC interfaces | 729 | # RTC interfaces |
730 | # | 730 | # |
731 | CONFIG_RTC_INTF_SYSFS=m | 731 | CONFIG_RTC_INTF_SYSFS=y |
732 | CONFIG_RTC_INTF_PROC=m | 732 | CONFIG_RTC_INTF_PROC=y |
733 | CONFIG_RTC_INTF_DEV=m | 733 | CONFIG_RTC_INTF_DEV=y |
734 | 734 | ||
735 | # | 735 | # |
736 | # RTC drivers | 736 | # RTC drivers |
diff --git a/arch/arm/configs/picotux200_defconfig b/arch/arm/configs/picotux200_defconfig index 14826f0dabde..59e4463c2da2 100644 --- a/arch/arm/configs/picotux200_defconfig +++ b/arch/arm/configs/picotux200_defconfig | |||
@@ -1069,9 +1069,9 @@ CONFIG_RTC_CLASS=m | |||
1069 | # | 1069 | # |
1070 | # RTC interfaces | 1070 | # RTC interfaces |
1071 | # | 1071 | # |
1072 | CONFIG_RTC_INTF_SYSFS=m | 1072 | CONFIG_RTC_INTF_SYSFS=y |
1073 | CONFIG_RTC_INTF_PROC=m | 1073 | CONFIG_RTC_INTF_PROC=y |
1074 | CONFIG_RTC_INTF_DEV=m | 1074 | CONFIG_RTC_INTF_DEV=y |
1075 | # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set | 1075 | # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set |
1076 | 1076 | ||
1077 | # | 1077 | # |
diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c index 6c90479e8974..c63842766229 100644 --- a/arch/arm/kernel/ftrace.c +++ b/arch/arm/kernel/ftrace.c | |||
@@ -95,7 +95,7 @@ int ftrace_update_ftrace_func(ftrace_func_t func) | |||
95 | return ret; | 95 | return ret; |
96 | } | 96 | } |
97 | 97 | ||
98 | /* run from kstop_machine */ | 98 | /* run from ftrace_init with irqs disabled */ |
99 | int __init ftrace_dyn_arch_init(void *data) | 99 | int __init ftrace_dyn_arch_init(void *data) |
100 | { | 100 | { |
101 | ftrace_mcount_set(data); | 101 | ftrace_mcount_set(data); |
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c index a72e798a2a40..d140eae53ded 100644 --- a/arch/arm/mach-at91/at91rm9200_time.c +++ b/arch/arm/mach-at91/at91rm9200_time.c | |||
@@ -141,6 +141,15 @@ clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev) | |||
141 | /* Use "raw" primitives so we behave correctly on RT kernels. */ | 141 | /* Use "raw" primitives so we behave correctly on RT kernels. */ |
142 | raw_local_irq_save(flags); | 142 | raw_local_irq_save(flags); |
143 | 143 | ||
144 | /* | ||
145 | * According to Thomas Gleixner irqs are already disabled here. Simply | ||
146 | * removing raw_local_irq_save above (and the matching | ||
147 | * raw_local_irq_restore) was not accepted. See | ||
148 | * http://thread.gmane.org/gmane.linux.ports.arm.kernel/41174 | ||
149 | * So for now (2008-11-20) just warn once if irqs were not disabled ... | ||
150 | */ | ||
151 | WARN_ON_ONCE(!raw_irqs_disabled_flags(flags)); | ||
152 | |||
144 | /* The alarm IRQ uses absolute time (now+delta), not the relative | 153 | /* The alarm IRQ uses absolute time (now+delta), not the relative |
145 | * time (delta) in our calling convention. Like all clockevents | 154 | * time (delta) in our calling convention. Like all clockevents |
146 | * using such "match" hardware, we have a race to defend against. | 155 | * using such "match" hardware, we have a race to defend against. |
diff --git a/arch/arm/mach-netx/include/mach/netx-regs.h b/arch/arm/mach-netx/include/mach/netx-regs.h index 5104a00d40f4..08c60ff227be 100644 --- a/arch/arm/mach-netx/include/mach/netx-regs.h +++ b/arch/arm/mach-netx/include/mach/netx-regs.h | |||
@@ -328,6 +328,28 @@ | |||
328 | #define NETX_PFIFO_FILL_LEVEL(pfifo) NETX_PFIFO_REG(0x180 + ((pfifo)<<2)) | 328 | #define NETX_PFIFO_FILL_LEVEL(pfifo) NETX_PFIFO_REG(0x180 + ((pfifo)<<2)) |
329 | #define NETX_PFIFO_XPEC_ISR(xpec) NETX_PFIFO_REG(0x400 + ((xpec) << 2)) | 329 | #define NETX_PFIFO_XPEC_ISR(xpec) NETX_PFIFO_REG(0x400 + ((xpec) << 2)) |
330 | 330 | ||
331 | |||
332 | /******************************* | ||
333 | * Memory Controller * | ||
334 | *******************************/ | ||
335 | |||
336 | /* Registers */ | ||
337 | #define NETX_MEMCR_REG(ofs) __io(NETX_VA_MEMCR + (ofs)) | ||
338 | #define NETX_MEMCR_SRAM_CTRL(cs) NETX_MEMCR_REG(0x0 + 4 * (cs)) /* SRAM for CS 0..2 */ | ||
339 | #define NETX_MEMCR_SDRAM_CFG_CTRL NETX_MEMCR_REG(0x40) | ||
340 | #define NETX_MEMCR_SDRAM_TIMING_CTRL NETX_MEMCR_REG(0x44) | ||
341 | #define NETX_MEMCR_SDRAM_MODE NETX_MEMCR_REG(0x48) | ||
342 | #define NETX_MEMCR_SDRAM_EXT_MODE NETX_MEMCR_REG(0x4c) | ||
343 | #define NETX_MEMCR_PRIO_TIMESLOT_CTRL NETX_MEMCR_REG(0x80) | ||
344 | #define NETX_MEMCR_PRIO_ACCESS_CTRL NETX_MEMCR_REG(0x84) | ||
345 | |||
346 | /* Bits */ | ||
347 | #define NETX_MEMCR_SRAM_CTRL_WIDTHEXTMEM(x) (((x) & 0x3) << 24) | ||
348 | #define NETX_MEMCR_SRAM_CTRL_WSPOSTPAUSEEXTMEM(x) (((x) & 0x3) << 16) | ||
349 | #define NETX_MEMCR_SRAM_CTRL_WSPREPASEEXTMEM(x) (((x) & 0x3) << 8) | ||
350 | #define NETX_MEMCR_SRAM_CTRL_WSEXTMEM(x) (((x) & 0x1f) << 0) | ||
351 | |||
352 | |||
331 | /******************************* | 353 | /******************************* |
332 | * Dual Port Memory * | 354 | * Dual Port Memory * |
333 | *******************************/ | 355 | *******************************/ |
diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c index 7c540c1f01fa..d51d627ce7cf 100644 --- a/arch/arm/mach-netx/time.c +++ b/arch/arm/mach-netx/time.c | |||
@@ -21,43 +21,100 @@ | |||
21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/irq.h> | 22 | #include <linux/irq.h> |
23 | #include <linux/clocksource.h> | 23 | #include <linux/clocksource.h> |
24 | #include <linux/clockchips.h> | ||
24 | #include <linux/io.h> | 25 | #include <linux/io.h> |
25 | 26 | ||
26 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
27 | #include <asm/mach/time.h> | 28 | #include <asm/mach/time.h> |
28 | #include <mach/netx-regs.h> | 29 | #include <mach/netx-regs.h> |
29 | 30 | ||
31 | #define TIMER_CLOCKEVENT 0 | ||
32 | #define TIMER_CLOCKSOURCE 1 | ||
33 | |||
34 | static void netx_set_mode(enum clock_event_mode mode, | ||
35 | struct clock_event_device *clk) | ||
36 | { | ||
37 | u32 tmode; | ||
38 | |||
39 | /* disable timer */ | ||
40 | writel(0, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT)); | ||
41 | |||
42 | switch (mode) { | ||
43 | case CLOCK_EVT_MODE_PERIODIC: | ||
44 | writel(LATCH, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT)); | ||
45 | tmode = NETX_GPIO_COUNTER_CTRL_RST_EN | | ||
46 | NETX_GPIO_COUNTER_CTRL_IRQ_EN | | ||
47 | NETX_GPIO_COUNTER_CTRL_RUN; | ||
48 | break; | ||
49 | |||
50 | case CLOCK_EVT_MODE_ONESHOT: | ||
51 | writel(0, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT)); | ||
52 | tmode = NETX_GPIO_COUNTER_CTRL_IRQ_EN | | ||
53 | NETX_GPIO_COUNTER_CTRL_RUN; | ||
54 | break; | ||
55 | |||
56 | default: | ||
57 | WARN(1, "%s: unhandled mode %d\n", __func__, mode); | ||
58 | /* fall through */ | ||
59 | |||
60 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
61 | case CLOCK_EVT_MODE_UNUSED: | ||
62 | case CLOCK_EVT_MODE_RESUME: | ||
63 | tmode = 0; | ||
64 | break; | ||
65 | } | ||
66 | |||
67 | writel(tmode, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT)); | ||
68 | } | ||
69 | |||
70 | static int netx_set_next_event(unsigned long evt, | ||
71 | struct clock_event_device *clk) | ||
72 | { | ||
73 | writel(0 - evt, NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKEVENT)); | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static struct clock_event_device netx_clockevent = { | ||
78 | .name = "netx-timer" __stringify(TIMER_CLOCKEVENT), | ||
79 | .shift = 32, | ||
80 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | ||
81 | .set_next_event = netx_set_next_event, | ||
82 | .set_mode = netx_set_mode, | ||
83 | }; | ||
84 | |||
30 | /* | 85 | /* |
31 | * IRQ handler for the timer | 86 | * IRQ handler for the timer |
32 | */ | 87 | */ |
33 | static irqreturn_t | 88 | static irqreturn_t |
34 | netx_timer_interrupt(int irq, void *dev_id) | 89 | netx_timer_interrupt(int irq, void *dev_id) |
35 | { | 90 | { |
36 | timer_tick(); | 91 | struct clock_event_device *evt = &netx_clockevent; |
37 | 92 | ||
38 | /* acknowledge interrupt */ | 93 | /* acknowledge interrupt */ |
39 | writel(COUNTER_BIT(0), NETX_GPIO_IRQ); | 94 | writel(COUNTER_BIT(0), NETX_GPIO_IRQ); |
40 | 95 | ||
96 | evt->event_handler(evt); | ||
97 | |||
41 | return IRQ_HANDLED; | 98 | return IRQ_HANDLED; |
42 | } | 99 | } |
43 | 100 | ||
44 | static struct irqaction netx_timer_irq = { | 101 | static struct irqaction netx_timer_irq = { |
45 | .name = "NetX Timer Tick", | 102 | .name = "NetX Timer Tick", |
46 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | 103 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, |
47 | .handler = netx_timer_interrupt, | 104 | .handler = netx_timer_interrupt, |
48 | }; | 105 | }; |
49 | 106 | ||
50 | cycle_t netx_get_cycles(void) | 107 | cycle_t netx_get_cycles(void) |
51 | { | 108 | { |
52 | return readl(NETX_GPIO_COUNTER_CURRENT(1)); | 109 | return readl(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE)); |
53 | } | 110 | } |
54 | 111 | ||
55 | static struct clocksource clocksource_netx = { | 112 | static struct clocksource clocksource_netx = { |
56 | .name = "netx_timer", | 113 | .name = "netx_timer", |
57 | .rating = 200, | 114 | .rating = 200, |
58 | .read = netx_get_cycles, | 115 | .read = netx_get_cycles, |
59 | .mask = CLOCKSOURCE_MASK(32), | 116 | .mask = CLOCKSOURCE_MASK(32), |
60 | .shift = 20, | 117 | .shift = 20, |
61 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 118 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
62 | }; | 119 | }; |
63 | 120 | ||
@@ -77,24 +134,37 @@ static void __init netx_timer_init(void) | |||
77 | /* acknowledge interrupt */ | 134 | /* acknowledge interrupt */ |
78 | writel(COUNTER_BIT(0), NETX_GPIO_IRQ); | 135 | writel(COUNTER_BIT(0), NETX_GPIO_IRQ); |
79 | 136 | ||
80 | /* Enable the interrupt in the specific timer register and start timer */ | 137 | /* Enable the interrupt in the specific timer |
138 | * register and start timer | ||
139 | */ | ||
81 | writel(COUNTER_BIT(0), NETX_GPIO_IRQ_ENABLE); | 140 | writel(COUNTER_BIT(0), NETX_GPIO_IRQ_ENABLE); |
82 | writel(NETX_GPIO_COUNTER_CTRL_IRQ_EN | NETX_GPIO_COUNTER_CTRL_RUN, | 141 | writel(NETX_GPIO_COUNTER_CTRL_IRQ_EN | NETX_GPIO_COUNTER_CTRL_RUN, |
83 | NETX_GPIO_COUNTER_CTRL(0)); | 142 | NETX_GPIO_COUNTER_CTRL(0)); |
84 | 143 | ||
85 | setup_irq(NETX_IRQ_TIMER0, &netx_timer_irq); | 144 | setup_irq(NETX_IRQ_TIMER0, &netx_timer_irq); |
86 | 145 | ||
87 | /* Setup timer one for clocksource */ | 146 | /* Setup timer one for clocksource */ |
88 | writel(0, NETX_GPIO_COUNTER_CTRL(1)); | 147 | writel(0, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKSOURCE)); |
89 | writel(0, NETX_GPIO_COUNTER_CURRENT(1)); | 148 | writel(0, NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE)); |
90 | writel(0xFFFFFFFF, NETX_GPIO_COUNTER_MAX(1)); | 149 | writel(0xffffffff, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKSOURCE)); |
91 | 150 | ||
92 | writel(NETX_GPIO_COUNTER_CTRL_RUN, | 151 | writel(NETX_GPIO_COUNTER_CTRL_RUN, |
93 | NETX_GPIO_COUNTER_CTRL(1)); | 152 | NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKSOURCE)); |
94 | 153 | ||
95 | clocksource_netx.mult = | 154 | clocksource_netx.mult = |
96 | clocksource_hz2mult(CLOCK_TICK_RATE, clocksource_netx.shift); | 155 | clocksource_hz2mult(CLOCK_TICK_RATE, clocksource_netx.shift); |
97 | clocksource_register(&clocksource_netx); | 156 | clocksource_register(&clocksource_netx); |
157 | |||
158 | netx_clockevent.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC, | ||
159 | netx_clockevent.shift); | ||
160 | netx_clockevent.max_delta_ns = | ||
161 | clockevent_delta2ns(0xfffffffe, &netx_clockevent); | ||
162 | /* with max_delta_ns >= delta2ns(0x800) the system currently runs fine. | ||
163 | * Adding some safety ... */ | ||
164 | netx_clockevent.min_delta_ns = | ||
165 | clockevent_delta2ns(0xa00, &netx_clockevent); | ||
166 | netx_clockevent.cpumask = cpumask_of_cpu(0); | ||
167 | clockevents_register_device(&netx_clockevent); | ||
98 | } | 168 | } |
99 | 169 | ||
100 | struct sys_timer netx_timer = { | 170 | struct sys_timer netx_timer = { |
diff --git a/arch/arm/mach-netx/xc.c b/arch/arm/mach-netx/xc.c index 32eabf5dfa4f..8fc6205dc3a5 100644 --- a/arch/arm/mach-netx/xc.c +++ b/arch/arm/mach-netx/xc.c | |||
@@ -92,10 +92,10 @@ static int xc_check_ptr(struct xc *x, unsigned long adr, unsigned int size) | |||
92 | return -1; | 92 | return -1; |
93 | } | 93 | } |
94 | 94 | ||
95 | static int xc_patch(struct xc *x, void *patch, int count) | 95 | static int xc_patch(struct xc *x, const void *patch, int count) |
96 | { | 96 | { |
97 | unsigned int val, adr; | 97 | unsigned int val, adr; |
98 | unsigned int *data = patch; | 98 | const unsigned int *data = patch; |
99 | 99 | ||
100 | int i; | 100 | int i; |
101 | for (i = 0; i < count; i++) { | 101 | for (i = 0; i < count; i++) { |
@@ -117,7 +117,7 @@ int xc_request_firmware(struct xc *x) | |||
117 | struct fw_header *head; | 117 | struct fw_header *head; |
118 | unsigned int size; | 118 | unsigned int size; |
119 | int i; | 119 | int i; |
120 | void *src; | 120 | const void *src; |
121 | unsigned long dst; | 121 | unsigned long dst; |
122 | 122 | ||
123 | sprintf(name, "xc%d.bin", x->no); | 123 | sprintf(name, "xc%d.bin", x->no); |