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

Merge tag 'timer' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull "ARM: timer cleanup work" from Arnd Bergmann:
"These are split out from the generic soc and driver updates because
there was a lot of conflicting work by multiple people. Marc Zyngier
worked on simplifying the "localtimer" interfaces, and some of the
platforms are touching the same code as they move to device tree based
booting.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>"

* tag 'timer' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (61 commits)
ARM: tegra: select USB_ULPI if USB is selected
arm/tegra: pcie: fix return value of function
ARM: ux500: fix compilation after local timer rework
ARM: shmobile: remove additional __io() macro use
ARM: local timers: make the runtime registration interface mandatory
ARM: local timers: convert MSM to runtime registration interface
ARM: local timers: convert exynos to runtime registration interface
ARM: smp_twd: remove old local timer interface
ARM: imx6q: convert to twd_local_timer_register() interface
ARM: highbank: convert to twd_local_timer_register() interface
ARM: ux500: convert to twd_local_timer_register() interface
ARM: shmobile: convert to twd_local_timer_register() interface
ARM: tegra: convert to twd_local_timer_register() interface
ARM: plat-versatile: convert to twd_local_timer_register() interface
ARM: OMAP4: convert to twd_local_timer_register() interface
ARM: smp_twd: add device tree support
ARM: smp_twd: add runtime registration support
ARM: local timers: introduce a new registration interface
ARM: smp_twd: make local_timer_stop a symbol instead of a #define
ARM: mach-shmobile: default to no earlytimer
...

+966 -1001
+48
Documentation/devicetree/bindings/arm/twd.txt
··· 1 + * ARM Timer Watchdog 2 + 3 + ARM 11MP, Cortex-A5 and Cortex-A9 are often associated with a per-core 4 + Timer-Watchdog (aka TWD), which provides both a per-cpu local timer 5 + and watchdog. 6 + 7 + The TWD is usually attached to a GIC to deliver its two per-processor 8 + interrupts. 9 + 10 + ** Timer node required properties: 11 + 12 + - compatible : Should be one of: 13 + "arm,cortex-a9-twd-timer" 14 + "arm,cortex-a5-twd-timer" 15 + "arm,arm11mp-twd-timer" 16 + 17 + - interrupts : One interrupt to each core 18 + 19 + - reg : Specify the base address and the size of the TWD timer 20 + register window. 21 + 22 + Example: 23 + 24 + twd-timer@2c000600 { 25 + compatible = "arm,arm11mp-twd-timer""; 26 + reg = <0x2c000600 0x20>; 27 + interrupts = <1 13 0xf01>; 28 + }; 29 + 30 + ** Watchdog node properties: 31 + 32 + - compatible : Should be one of: 33 + "arm,cortex-a9-twd-wdt" 34 + "arm,cortex-a5-twd-wdt" 35 + "arm,arm11mp-twd-wdt" 36 + 37 + - interrupts : One interrupt to each core 38 + 39 + - reg : Specify the base address and the size of the TWD watchdog 40 + register window. 41 + 42 + Example: 43 + 44 + twd-watchdog@2c000620 { 45 + compatible = "arm,arm11mp-twd-wdt"; 46 + reg = <0x2c000620 0x20>; 47 + interrupts = <1 14 0xf01>; 48 + };
+4 -4
arch/arm/boot/dts/highbank.dts
··· 72 72 ranges; 73 73 74 74 timer@fff10600 { 75 - compatible = "arm,smp-twd"; 75 + compatible = "arm,cortex-a9-twd-timer"; 76 76 reg = <0xfff10600 0x20>; 77 - interrupts = <1 13 0xf04>; 77 + interrupts = <1 13 0xf01>; 78 78 }; 79 79 80 80 watchdog@fff10620 { 81 - compatible = "arm,cortex-a9-wdt"; 81 + compatible = "arm,cortex-a9-twd-wdt"; 82 82 reg = <0xfff10620 0x20>; 83 - interrupts = <1 14 0xf04>; 83 + interrupts = <1 14 0xf01>; 84 84 }; 85 85 86 86 intc: interrupt-controller@fff11000 {
+3 -3
arch/arm/boot/dts/imx6q.dtsi
··· 88 88 ranges; 89 89 90 90 timer@00a00600 { 91 - compatible = "arm,smp-twd"; 92 - reg = <0x00a00600 0x100>; 93 - interrupts = <1 13 0xf4>; 91 + compatible = "arm,cortex-a9-twd-timer"; 92 + reg = <0x00a00600 0x20>; 93 + interrupts = <1 13 0xf01>; 94 94 }; 95 95 96 96 L2: l2-cache@00a02000 {
+5
arch/arm/include/asm/hardware/arm_timer.h
··· 9 9 * 10 10 * Integrator AP has 16-bit timers, Integrator CP, Versatile and Realview 11 11 * can have 16-bit or 32-bit selectable via a bit in the control register. 12 + * 13 + * Every SP804 contains two identical timers. 12 14 */ 15 + #define TIMER_1_BASE 0x00 16 + #define TIMER_2_BASE 0x20 17 + 13 18 #define TIMER_LOAD 0x00 /* ACVR rw */ 14 19 #define TIMER_VALUE 0x04 /* ACVR ro */ 15 20 #define TIMER_CTRL 0x08 /* ACVR rw */
+7 -30
arch/arm/include/asm/localtimer.h
··· 11 11 #define __ASM_ARM_LOCALTIMER_H 12 12 13 13 #include <linux/errno.h> 14 - #include <linux/interrupt.h> 15 14 16 15 struct clock_event_device; 17 16 18 - /* 19 - * Setup a per-cpu timer, whether it be a local timer or dummy broadcast 20 - */ 21 - void percpu_timer_setup(void); 17 + struct local_timer_ops { 18 + int (*setup)(struct clock_event_device *); 19 + void (*stop)(struct clock_event_device *); 20 + }; 22 21 23 22 #ifdef CONFIG_LOCAL_TIMERS 24 - 25 - #ifdef CONFIG_HAVE_ARM_TWD 26 - 27 - #include "smp_twd.h" 28 - 29 - #define local_timer_stop(c) twd_timer_stop((c)) 30 - 31 - #else 32 - 33 23 /* 34 - * Stop the local timer 24 + * Register a local timer driver 35 25 */ 36 - void local_timer_stop(struct clock_event_device *); 37 - 38 - #endif 39 - 40 - /* 41 - * Setup a local timer interrupt for a CPU. 42 - */ 43 - int local_timer_setup(struct clock_event_device *); 44 - 26 + int local_timer_register(struct local_timer_ops *); 45 27 #else 46 - 47 - static inline int local_timer_setup(struct clock_event_device *evt) 28 + static inline int local_timer_register(struct local_timer_ops *ops) 48 29 { 49 30 return -ENXIO; 50 - } 51 - 52 - static inline void local_timer_stop(struct clock_event_device *evt) 53 - { 54 31 } 55 32 #endif 56 33
+21 -4
arch/arm/include/asm/smp_twd.h
··· 18 18 #define TWD_TIMER_CONTROL_PERIODIC (1 << 1) 19 19 #define TWD_TIMER_CONTROL_IT_ENABLE (1 << 2) 20 20 21 - struct clock_event_device; 21 + #include <linux/ioport.h> 22 22 23 - extern void __iomem *twd_base; 23 + struct twd_local_timer { 24 + struct resource res[2]; 25 + }; 24 26 25 - void twd_timer_setup(struct clock_event_device *); 26 - void twd_timer_stop(struct clock_event_device *); 27 + #define DEFINE_TWD_LOCAL_TIMER(name,base,irq) \ 28 + struct twd_local_timer name __initdata = { \ 29 + .res = { \ 30 + DEFINE_RES_MEM(base, 0x10), \ 31 + DEFINE_RES_IRQ(irq), \ 32 + }, \ 33 + }; 34 + 35 + int twd_local_timer_register(struct twd_local_timer *); 36 + 37 + #ifdef CONFIG_HAVE_ARM_TWD 38 + void twd_local_timer_of_register(void); 39 + #else 40 + static inline void twd_local_timer_of_register(void) 41 + { 42 + } 43 + #endif 27 44 28 45 #endif
+19 -3
arch/arm/kernel/smp.c
··· 246 246 store_cpu_topology(cpuid); 247 247 } 248 248 249 + static void percpu_timer_setup(void); 250 + 249 251 /* 250 252 * This is the secondary CPU boot entry. We're using this CPUs 251 253 * idle thread stack, but a set of temporary page tables. ··· 454 452 clockevents_register_device(evt); 455 453 } 456 454 457 - void __cpuinit percpu_timer_setup(void) 455 + static struct local_timer_ops *lt_ops; 456 + 457 + #ifdef CONFIG_LOCAL_TIMERS 458 + int local_timer_register(struct local_timer_ops *ops) 459 + { 460 + if (lt_ops) 461 + return -EBUSY; 462 + 463 + lt_ops = ops; 464 + return 0; 465 + } 466 + #endif 467 + 468 + static void __cpuinit percpu_timer_setup(void) 458 469 { 459 470 unsigned int cpu = smp_processor_id(); 460 471 struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu); ··· 475 460 evt->cpumask = cpumask_of(cpu); 476 461 evt->broadcast = smp_timer_broadcast; 477 462 478 - if (local_timer_setup(evt)) 463 + if (!lt_ops || lt_ops->setup(evt)) 479 464 broadcast_timer_setup(evt); 480 465 } 481 466 ··· 490 475 unsigned int cpu = smp_processor_id(); 491 476 struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu); 492 477 493 - local_timer_stop(evt); 478 + if (lt_ops) 479 + lt_ops->stop(evt); 494 480 } 495 481 #endif 496 482
+100 -23
arch/arm/kernel/smp_twd.c
··· 18 18 #include <linux/smp.h> 19 19 #include <linux/jiffies.h> 20 20 #include <linux/clockchips.h> 21 - #include <linux/irq.h> 21 + #include <linux/interrupt.h> 22 22 #include <linux/io.h> 23 + #include <linux/of_irq.h> 24 + #include <linux/of_address.h> 23 25 24 26 #include <asm/smp_twd.h> 25 27 #include <asm/localtimer.h> 26 28 #include <asm/hardware/gic.h> 27 29 28 30 /* set up by the platform code */ 29 - void __iomem *twd_base; 31 + static void __iomem *twd_base; 30 32 31 33 static struct clk *twd_clk; 32 34 static unsigned long twd_timer_rate; 33 35 34 36 static struct clock_event_device __percpu **twd_evt; 37 + static int twd_ppi; 35 38 36 39 static void twd_set_mode(enum clock_event_mode mode, 37 40 struct clock_event_device *clk) ··· 80 77 * If a local timer interrupt has occurred, acknowledge and return 1. 81 78 * Otherwise, return 0. 82 79 */ 83 - int twd_timer_ack(void) 80 + static int twd_timer_ack(void) 84 81 { 85 82 if (__raw_readl(twd_base + TWD_TIMER_INTSTAT)) { 86 83 __raw_writel(1, twd_base + TWD_TIMER_INTSTAT); ··· 90 87 return 0; 91 88 } 92 89 93 - void twd_timer_stop(struct clock_event_device *clk) 90 + static void twd_timer_stop(struct clock_event_device *clk) 94 91 { 95 92 twd_set_mode(CLOCK_EVT_MODE_UNUSED, clk); 96 93 disable_percpu_irq(clk->irq); ··· 225 222 /* 226 223 * Setup the local clock events for a CPU. 227 224 */ 228 - void __cpuinit twd_timer_setup(struct clock_event_device *clk) 225 + static int __cpuinit twd_timer_setup(struct clock_event_device *clk) 229 226 { 230 227 struct clock_event_device **this_cpu_clk; 231 - 232 - if (!twd_evt) { 233 - int err; 234 - 235 - twd_evt = alloc_percpu(struct clock_event_device *); 236 - if (!twd_evt) { 237 - pr_err("twd: can't allocate memory\n"); 238 - return; 239 - } 240 - 241 - err = request_percpu_irq(clk->irq, twd_handler, 242 - "twd", twd_evt); 243 - if (err) { 244 - pr_err("twd: can't register interrupt %d (%d)\n", 245 - clk->irq, err); 246 - return; 247 - } 248 - } 249 228 250 229 if (!twd_clk) 251 230 twd_clk = twd_get_clock(); ··· 245 260 clk->rating = 350; 246 261 clk->set_mode = twd_set_mode; 247 262 clk->set_next_event = twd_set_next_event; 263 + clk->irq = twd_ppi; 248 264 249 265 this_cpu_clk = __this_cpu_ptr(twd_evt); 250 266 *this_cpu_clk = clk; ··· 253 267 clockevents_config_and_register(clk, twd_timer_rate, 254 268 0xf, 0xffffffff); 255 269 enable_percpu_irq(clk->irq, 0); 270 + 271 + return 0; 256 272 } 273 + 274 + static struct local_timer_ops twd_lt_ops __cpuinitdata = { 275 + .setup = twd_timer_setup, 276 + .stop = twd_timer_stop, 277 + }; 278 + 279 + static int __init twd_local_timer_common_register(void) 280 + { 281 + int err; 282 + 283 + twd_evt = alloc_percpu(struct clock_event_device *); 284 + if (!twd_evt) { 285 + err = -ENOMEM; 286 + goto out_free; 287 + } 288 + 289 + err = request_percpu_irq(twd_ppi, twd_handler, "twd", twd_evt); 290 + if (err) { 291 + pr_err("twd: can't register interrupt %d (%d)\n", twd_ppi, err); 292 + goto out_free; 293 + } 294 + 295 + err = local_timer_register(&twd_lt_ops); 296 + if (err) 297 + goto out_irq; 298 + 299 + return 0; 300 + 301 + out_irq: 302 + free_percpu_irq(twd_ppi, twd_evt); 303 + out_free: 304 + iounmap(twd_base); 305 + twd_base = NULL; 306 + free_percpu(twd_evt); 307 + 308 + return err; 309 + } 310 + 311 + int __init twd_local_timer_register(struct twd_local_timer *tlt) 312 + { 313 + if (twd_base || twd_evt) 314 + return -EBUSY; 315 + 316 + twd_ppi = tlt->res[1].start; 317 + 318 + twd_base = ioremap(tlt->res[0].start, resource_size(&tlt->res[0])); 319 + if (!twd_base) 320 + return -ENOMEM; 321 + 322 + return twd_local_timer_common_register(); 323 + } 324 + 325 + #ifdef CONFIG_OF 326 + const static struct of_device_id twd_of_match[] __initconst = { 327 + { .compatible = "arm,cortex-a9-twd-timer", }, 328 + { .compatible = "arm,cortex-a5-twd-timer", }, 329 + { .compatible = "arm,arm11mp-twd-timer", }, 330 + { }, 331 + }; 332 + 333 + void __init twd_local_timer_of_register(void) 334 + { 335 + struct device_node *np; 336 + int err; 337 + 338 + np = of_find_matching_node(NULL, twd_of_match); 339 + if (!np) { 340 + err = -ENODEV; 341 + goto out; 342 + } 343 + 344 + twd_ppi = irq_of_parse_and_map(np, 0); 345 + if (!twd_ppi) { 346 + err = -EINVAL; 347 + goto out; 348 + } 349 + 350 + twd_base = of_iomap(np, 0); 351 + if (!twd_base) { 352 + err = -ENOMEM; 353 + goto out; 354 + } 355 + 356 + err = twd_local_timer_common_register(); 357 + 358 + out: 359 + WARN(err, "twd_local_timer_of_register failed (%d)\n", err); 360 + } 361 + #endif
+10 -8
arch/arm/mach-exynos/mct.c
··· 21 21 #include <linux/percpu.h> 22 22 23 23 #include <asm/hardware/gic.h> 24 + #include <asm/localtimer.h> 24 25 25 26 #include <plat/cpu.h> 26 27 ··· 376 375 .handler = exynos4_mct_tick_isr, 377 376 }; 378 377 379 - static void exynos4_mct_tick_init(struct clock_event_device *evt) 378 + static int __cpuinit exynos4_local_timer_setup(struct clock_event_device *evt) 380 379 { 381 380 struct mct_clock_event_device *mevt; 382 381 unsigned int cpu = smp_processor_id(); ··· 418 417 } else { 419 418 enable_percpu_irq(IRQ_MCT_LOCALTIMER, 0); 420 419 } 421 - } 422 - 423 - /* Setup the local clock events for a CPU */ 424 - int __cpuinit local_timer_setup(struct clock_event_device *evt) 425 - { 426 - exynos4_mct_tick_init(evt); 427 420 428 421 return 0; 429 422 } 430 423 431 - void local_timer_stop(struct clock_event_device *evt) 424 + static void exynos4_local_timer_stop(struct clock_event_device *evt) 432 425 { 433 426 unsigned int cpu = smp_processor_id(); 434 427 evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); ··· 434 439 else 435 440 disable_percpu_irq(IRQ_MCT_LOCALTIMER); 436 441 } 442 + 443 + static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = { 444 + .setup = exynos4_local_timer_setup, 445 + .stop = exynos4_local_timer_stop, 446 + }; 437 447 #endif /* CONFIG_LOCAL_TIMERS */ 438 448 439 449 static void __init exynos4_timer_resources(void) ··· 458 458 WARN(err, "MCT: can't request IRQ %d (%d)\n", 459 459 IRQ_MCT_LOCALTIMER, err); 460 460 } 461 + 462 + local_timer_register(&exynos4_mct_tick_ops); 461 463 #endif /* CONFIG_LOCAL_TIMERS */ 462 464 } 463 465
-1
arch/arm/mach-highbank/Makefile
··· 1 1 obj-y := clock.o highbank.o system.o 2 2 obj-$(CONFIG_DEBUG_HIGHBANK_UART) += lluart.o 3 3 obj-$(CONFIG_SMP) += platsmp.o 4 - obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o 5 4 obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 6 5 obj-$(CONFIG_PM_SLEEP) += pm.o
+3
arch/arm/mach-highbank/highbank.c
··· 27 27 #include <asm/cacheflush.h> 28 28 #include <asm/smp_plat.h> 29 29 #include <asm/smp_scu.h> 30 + #include <asm/smp_twd.h> 30 31 #include <asm/hardware/arm_timer.h> 31 32 #include <asm/hardware/timer-sp.h> 32 33 #include <asm/hardware/gic.h> ··· 112 111 113 112 sp804_clocksource_init(timer_base + 0x20, "timer1"); 114 113 sp804_clockevents_init(timer_base, irq, "timer0"); 114 + 115 + twd_local_timer_of_register(); 115 116 } 116 117 117 118 static struct sys_timer highbank_timer = {
-40
arch/arm/mach-highbank/localtimer.c
··· 1 - /* 2 - * Copyright 2010-2011 Calxeda, Inc. 3 - * Based on localtimer.c, Copyright (C) 2002 ARM Ltd. 4 - * 5 - * This program is free software; you can redistribute it and/or modify it 6 - * under the terms and conditions of the GNU General Public License, 7 - * version 2, as published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope it will be useful, but WITHOUT 10 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 - * more details. 13 - * 14 - * You should have received a copy of the GNU General Public License along with 15 - * this program. If not, see <http://www.gnu.org/licenses/>. 16 - */ 17 - #include <linux/init.h> 18 - #include <linux/clockchips.h> 19 - #include <linux/of.h> 20 - #include <linux/of_address.h> 21 - #include <linux/of_irq.h> 22 - 23 - #include <asm/smp_twd.h> 24 - 25 - /* 26 - * Setup the local clock events for a CPU. 27 - */ 28 - int __cpuinit local_timer_setup(struct clock_event_device *evt) 29 - { 30 - struct device_node *np; 31 - 32 - np = of_find_compatible_node(NULL, NULL, "arm,smp-twd"); 33 - if (!twd_base) { 34 - twd_base = of_iomap(np, 0); 35 - WARN_ON(!twd_base); 36 - } 37 - evt->irq = irq_of_parse_and_map(np, 0); 38 - twd_timer_setup(evt); 39 - return 0; 40 - }
-1
arch/arm/mach-imx/Makefile
··· 71 71 AFLAGS_head-v7.o :=-Wa,-march=armv7-a 72 72 obj-$(CONFIG_SMP) += platsmp.o 73 73 obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 74 - obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o 75 74 obj-$(CONFIG_SOC_IMX6Q) += clock-imx6q.o mach-imx6q.o 76 75 77 76 ifeq ($(CONFIG_PM),y)
-35
arch/arm/mach-imx/localtimer.c
··· 1 - /* 2 - * Copyright 2011 Freescale Semiconductor, Inc. 3 - * Copyright 2011 Linaro Ltd. 4 - * 5 - * The code contained herein is licensed under the GNU General Public 6 - * License. You may obtain a copy of the GNU General Public License 7 - * Version 2 or later at the following locations: 8 - * 9 - * http://www.opensource.org/licenses/gpl-license.html 10 - * http://www.gnu.org/copyleft/gpl.html 11 - */ 12 - 13 - #include <linux/init.h> 14 - #include <linux/clockchips.h> 15 - #include <linux/of_address.h> 16 - #include <linux/of_irq.h> 17 - #include <asm/smp_twd.h> 18 - 19 - /* 20 - * Setup the local clock events for a CPU. 21 - */ 22 - int __cpuinit local_timer_setup(struct clock_event_device *evt) 23 - { 24 - struct device_node *np; 25 - 26 - np = of_find_compatible_node(NULL, NULL, "arm,smp-twd"); 27 - if (!twd_base) { 28 - twd_base = of_iomap(np, 0); 29 - WARN_ON(!twd_base); 30 - } 31 - evt->irq = irq_of_parse_and_map(np, 0); 32 - twd_timer_setup(evt); 33 - 34 - return 0; 35 - }
+2
arch/arm/mach-imx/mach-imx6q.c
··· 21 21 #include <linux/of_platform.h> 22 22 #include <linux/phy.h> 23 23 #include <linux/micrel_phy.h> 24 + #include <asm/smp_twd.h> 24 25 #include <asm/hardware/cache-l2x0.h> 25 26 #include <asm/hardware/gic.h> 26 27 #include <asm/mach/arch.h> ··· 121 120 static void __init imx6q_timer_init(void) 122 121 { 123 122 mx6q_clocks_init(); 123 + twd_local_timer_of_register(); 124 124 } 125 125 126 126 static struct sys_timer imx6q_timer = {
+44 -35
arch/arm/mach-msm/timer.c
··· 127 127 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 128 128 }; 129 129 130 + #ifdef CONFIG_LOCAL_TIMERS 131 + static int __cpuinit msm_local_timer_setup(struct clock_event_device *evt) 132 + { 133 + /* Use existing clock_event for cpu 0 */ 134 + if (!smp_processor_id()) 135 + return 0; 136 + 137 + writel_relaxed(0, event_base + TIMER_ENABLE); 138 + writel_relaxed(0, event_base + TIMER_CLEAR); 139 + writel_relaxed(~0, event_base + TIMER_MATCH_VAL); 140 + evt->irq = msm_clockevent.irq; 141 + evt->name = "local_timer"; 142 + evt->features = msm_clockevent.features; 143 + evt->rating = msm_clockevent.rating; 144 + evt->set_mode = msm_timer_set_mode; 145 + evt->set_next_event = msm_timer_set_next_event; 146 + evt->shift = msm_clockevent.shift; 147 + evt->mult = div_sc(GPT_HZ, NSEC_PER_SEC, evt->shift); 148 + evt->max_delta_ns = clockevent_delta2ns(0xf0000000, evt); 149 + evt->min_delta_ns = clockevent_delta2ns(4, evt); 150 + 151 + *__this_cpu_ptr(msm_evt.percpu_evt) = evt; 152 + clockevents_register_device(evt); 153 + enable_percpu_irq(evt->irq, 0); 154 + return 0; 155 + } 156 + 157 + static void msm_local_timer_stop(struct clock_event_device *evt) 158 + { 159 + evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); 160 + disable_percpu_irq(evt->irq); 161 + } 162 + 163 + static struct local_timer_ops msm_local_timer_ops __cpuinitdata = { 164 + .setup = msm_local_timer_setup, 165 + .stop = msm_local_timer_stop, 166 + }; 167 + #endif /* CONFIG_LOCAL_TIMERS */ 168 + 130 169 static void __init msm_timer_init(void) 131 170 { 132 171 struct clock_event_device *ce = &msm_clockevent; ··· 212 173 *__this_cpu_ptr(msm_evt.percpu_evt) = ce; 213 174 res = request_percpu_irq(ce->irq, msm_timer_interrupt, 214 175 ce->name, msm_evt.percpu_evt); 215 - if (!res) 176 + if (!res) { 216 177 enable_percpu_irq(ce->irq, 0); 178 + #ifdef CONFIG_LOCAL_TIMERS 179 + local_timer_register(&msm_local_timer_ops); 180 + #endif 181 + } 217 182 } else { 218 183 msm_evt.evt = ce; 219 184 res = request_irq(ce->irq, msm_timer_interrupt, ··· 233 190 if (res) 234 191 pr_err("clocksource_register failed\n"); 235 192 } 236 - 237 - #ifdef CONFIG_LOCAL_TIMERS 238 - int __cpuinit local_timer_setup(struct clock_event_device *evt) 239 - { 240 - /* Use existing clock_event for cpu 0 */ 241 - if (!smp_processor_id()) 242 - return 0; 243 - 244 - writel_relaxed(0, event_base + TIMER_ENABLE); 245 - writel_relaxed(0, event_base + TIMER_CLEAR); 246 - writel_relaxed(~0, event_base + TIMER_MATCH_VAL); 247 - evt->irq = msm_clockevent.irq; 248 - evt->name = "local_timer"; 249 - evt->features = msm_clockevent.features; 250 - evt->rating = msm_clockevent.rating; 251 - evt->set_mode = msm_timer_set_mode; 252 - evt->set_next_event = msm_timer_set_next_event; 253 - evt->shift = msm_clockevent.shift; 254 - evt->mult = div_sc(GPT_HZ, NSEC_PER_SEC, evt->shift); 255 - evt->max_delta_ns = clockevent_delta2ns(0xf0000000, evt); 256 - evt->min_delta_ns = clockevent_delta2ns(4, evt); 257 - 258 - *__this_cpu_ptr(msm_evt.percpu_evt) = evt; 259 - clockevents_register_device(evt); 260 - enable_percpu_irq(evt->irq, 0); 261 - return 0; 262 - } 263 - 264 - void local_timer_stop(struct clock_event_device *evt) 265 - { 266 - evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); 267 - disable_percpu_irq(evt->irq); 268 - } 269 - #endif /* CONFIG_LOCAL_TIMERS */ 270 193 271 194 struct sys_timer msm_timer = { 272 195 .init = msm_timer_init
+2 -5
arch/arm/mach-nomadik/board-nhk8815.c
··· 27 27 #include <asm/mach/arch.h> 28 28 #include <asm/mach/irq.h> 29 29 #include <asm/mach/flash.h> 30 + #include <asm/mach/time.h> 30 31 31 32 #include <plat/gpio-nomadik.h> 32 33 #include <plat/mtu.h> 33 34 34 - #include <mach/setup.h> 35 35 #include <mach/nand.h> 36 36 #include <mach/fsmc.h> 37 37 ··· 246 246 src_cr |= SRC_CR_INIT_VAL; 247 247 writel(src_cr, io_p2v(NOMADIK_SRC_BASE)); 248 248 249 - /* Save global pointer to mtu, used by platform timer code */ 250 - mtu_base = io_p2v(NOMADIK_MTU0_BASE); 251 - 252 - nmdk_timer_init(); 249 + nmdk_timer_init(io_p2v(NOMADIK_MTU0_BASE)); 253 250 } 254 251 255 252 static struct sys_timer nomadik_timer = {
-19
arch/arm/mach-nomadik/include/mach/setup.h
··· 1 - 2 - /* 3 - * These symbols are needed for board-specific files to call their 4 - * own cpu-specific files 5 - */ 6 - 7 - #ifndef __ASM_ARCH_SETUP_H 8 - #define __ASM_ARCH_SETUP_H 9 - 10 - #include <asm/mach/time.h> 11 - #include <linux/init.h> 12 - 13 - #ifdef CONFIG_NOMADIK_8815 14 - 15 - extern void nmdk_timer_init(void); 16 - 17 - #endif /* NOMADIK_8815 */ 18 - 19 - #endif /* __ASM_ARCH_SETUP_H */
-1
arch/arm/mach-omap2/Makefile
··· 25 25 26 26 # SMP support ONLY available for OMAP4 27 27 obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o 28 - obj-$(CONFIG_LOCAL_TIMERS) += timer-mpu.o 29 28 obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o 30 29 obj-$(CONFIG_ARCH_OMAP4) += omap4-common.o omap-wakeupgen.o \ 31 30 sleep44xx.o
-39
arch/arm/mach-omap2/timer-mpu.c
··· 1 - /* 2 - * The MPU local timer source file. In OMAP4, both cortex-a9 cores have 3 - * own timer in it's MPU domain. These timers will be driving the 4 - * linux kernel SMP tick framework when active. These timers are not 5 - * part of the wake up domain. 6 - * 7 - * Copyright (C) 2009 Texas Instruments, Inc. 8 - * 9 - * Author: 10 - * Santosh Shilimkar <santosh.shilimkar@ti.com> 11 - * 12 - * This file is based on arm realview smp platform file. 13 - * Copyright (C) 2002 ARM Ltd. 14 - * 15 - * This program is free software; you can redistribute it and/or modify 16 - * it under the terms of the GNU General Public License version 2 as 17 - * published by the Free Software Foundation. 18 - */ 19 - #include <linux/init.h> 20 - #include <linux/smp.h> 21 - #include <linux/clockchips.h> 22 - #include <asm/irq.h> 23 - #include <asm/smp_twd.h> 24 - #include <asm/localtimer.h> 25 - 26 - /* 27 - * Setup the local clock events for a CPU. 28 - */ 29 - int __cpuinit local_timer_setup(struct clock_event_device *evt) 30 - { 31 - /* Local timers are not supprted on OMAP4430 ES1.0 */ 32 - if (omap_rev() == OMAP4430_REV_ES1_0) 33 - return -ENXIO; 34 - 35 - evt->irq = OMAP44XX_IRQ_LOCALTIMER; 36 - twd_timer_setup(evt); 37 - return 0; 38 - } 39 -
+17 -5
arch/arm/mach-omap2/timer.c
··· 39 39 40 40 #include <asm/mach/time.h> 41 41 #include <plat/dmtimer.h> 42 - #include <asm/localtimer.h> 42 + #include <asm/smp_twd.h> 43 43 #include <asm/sched_clock.h> 44 44 #include "common.h" 45 45 #include <plat/omap_hwmod.h> ··· 324 324 #endif 325 325 326 326 #ifdef CONFIG_ARCH_OMAP4 327 + #ifdef CONFIG_LOCAL_TIMERS 328 + static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 329 + OMAP44XX_LOCAL_TWD_BASE, 330 + OMAP44XX_IRQ_LOCALTIMER); 331 + #endif 332 + 327 333 static void __init omap4_timer_init(void) 328 334 { 329 - #ifdef CONFIG_LOCAL_TIMERS 330 - twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_256); 331 - BUG_ON(!twd_base); 332 - #endif 333 335 omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE); 334 336 omap2_gp_clocksource_init(2, OMAP4_MPU_SOURCE); 337 + #ifdef CONFIG_LOCAL_TIMERS 338 + /* Local timers are not supprted on OMAP4430 ES1.0 */ 339 + if (omap_rev() != OMAP4430_REV_ES1_0) { 340 + int err; 341 + 342 + err = twd_local_timer_register(&twd_local_timer); 343 + if (err) 344 + pr_err("twd_local_timer_register failed %d\n", err); 345 + } 346 + #endif 335 347 } 336 348 OMAP_SYS_TIMER(4) 337 349 #endif
+21 -6
arch/arm/mach-realview/realview_eb.c
··· 36 36 #include <asm/pgtable.h> 37 37 #include <asm/hardware/gic.h> 38 38 #include <asm/hardware/cache-l2x0.h> 39 - #include <asm/localtimer.h> 39 + #include <asm/smp_twd.h> 40 40 41 41 #include <asm/mach/arch.h> 42 42 #include <asm/mach/map.h> ··· 383 383 realview_eb_isp1761_resources[1].end = IRQ_EB11MP_USB; 384 384 } 385 385 386 + #ifdef CONFIG_HAVE_ARM_TWD 387 + static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 388 + REALVIEW_EB11MP_TWD_BASE, 389 + IRQ_LOCALTIMER); 390 + 391 + static void __init realview_eb_twd_init(void) 392 + { 393 + if (core_tile_eb11mp() || core_tile_a9mp()) { 394 + int err = twd_local_timer_register(&twd_local_timer); 395 + if (err) 396 + pr_err("twd_local_timer_register failed %d\n", err); 397 + } 398 + } 399 + #else 400 + #define realview_eb_twd_init() do { } while(0) 401 + #endif 402 + 386 403 static void __init realview_eb_timer_init(void) 387 404 { 388 405 unsigned int timer_irq; ··· 409 392 timer2_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE); 410 393 timer3_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE) + 0x20; 411 394 412 - if (core_tile_eb11mp() || core_tile_a9mp()) { 413 - #ifdef CONFIG_LOCAL_TIMERS 414 - twd_base = __io_address(REALVIEW_EB11MP_TWD_BASE); 415 - #endif 395 + if (core_tile_eb11mp() || core_tile_a9mp()) 416 396 timer_irq = IRQ_EB11MP_TIMER0_1; 417 - } else 397 + else 418 398 timer_irq = IRQ_EB_TIMER0_1; 419 399 420 400 realview_timer_init(timer_irq); 401 + realview_eb_twd_init(); 421 402 } 422 403 423 404 static struct sys_timer realview_eb_timer = {
+17 -4
arch/arm/mach-realview/realview_pb11mp.c
··· 36 36 #include <asm/pgtable.h> 37 37 #include <asm/hardware/gic.h> 38 38 #include <asm/hardware/cache-l2x0.h> 39 - #include <asm/localtimer.h> 39 + #include <asm/smp_twd.h> 40 40 41 41 #include <asm/mach/arch.h> 42 42 #include <asm/mach/flash.h> ··· 290 290 gic_cascade_irq(1, IRQ_TC11MP_PB_IRQ1); 291 291 } 292 292 293 + #ifdef CONFIG_HAVE_ARM_TWD 294 + static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 295 + REALVIEW_TC11MP_TWD_BASE, 296 + IRQ_LOCALTIMER); 297 + 298 + static void __init realview_pb11mp_twd_init(void) 299 + { 300 + int err = twd_local_timer_register(&twd_local_timer); 301 + if (err) 302 + pr_err("twd_local_timer_register failed %d\n", err); 303 + } 304 + #else 305 + #define realview_pb11mp_twd_init() do {} while(0) 306 + #endif 307 + 293 308 static void __init realview_pb11mp_timer_init(void) 294 309 { 295 310 timer0_va_base = __io_address(REALVIEW_PB11MP_TIMER0_1_BASE); ··· 312 297 timer2_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE); 313 298 timer3_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE) + 0x20; 314 299 315 - #ifdef CONFIG_LOCAL_TIMERS 316 - twd_base = __io_address(REALVIEW_TC11MP_TWD_BASE); 317 - #endif 318 300 realview_timer_init(IRQ_TC11MP_TIMER0_1); 301 + realview_pb11mp_twd_init(); 319 302 } 320 303 321 304 static struct sys_timer realview_pb11mp_timer = {
+16 -4
arch/arm/mach-realview/realview_pbx.c
··· 298 298 } 299 299 } 300 300 301 + #ifdef CONFIG_HAVE_ARM_TWD 302 + static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 303 + REALVIEW_PBX_TILE_TWD_BASE, 304 + IRQ_LOCALTIMER); 305 + 306 + static void __init realview_pbx_twd_init(void) 307 + { 308 + int err = twd_local_timer_register(&twd_local_timer); 309 + if (err) 310 + pr_err("twd_local_timer_register failed %d\n", err); 311 + } 312 + #else 313 + #define realview_pbx_twd_init() do { } while(0) 314 + #endif 315 + 301 316 static void __init realview_pbx_timer_init(void) 302 317 { 303 318 timer0_va_base = __io_address(REALVIEW_PBX_TIMER0_1_BASE); ··· 320 305 timer2_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE); 321 306 timer3_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE) + 0x20; 322 307 323 - #ifdef CONFIG_LOCAL_TIMERS 324 - if (core_tile_pbx11mp() || core_tile_pbxa9mp()) 325 - twd_base = __io_address(REALVIEW_PBX_TILE_TWD_BASE); 326 - #endif 327 308 realview_timer_init(IRQ_PBX_TIMER0_1); 309 + realview_pbx_twd_init(); 328 310 } 329 311 330 312 static struct sys_timer realview_pbx_timer = {
-1
arch/arm/mach-shmobile/Makefile
··· 16 16 # SMP objects 17 17 smp-y := platsmp.o headsmp.o 18 18 smp-$(CONFIG_HOTPLUG_CPU) += hotplug.o 19 - smp-$(CONFIG_LOCAL_TIMERS) += localtimer.o 20 19 smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o 21 20 smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o 22 21
+3 -36
arch/arm/mach-shmobile/board-ag5evm.c
··· 47 47 #include <mach/common.h> 48 48 #include <asm/mach-types.h> 49 49 #include <asm/mach/arch.h> 50 - #include <asm/mach/map.h> 51 - #include <asm/mach/time.h> 52 50 #include <asm/hardware/gic.h> 53 51 #include <asm/hardware/cache-l2x0.h> 54 52 #include <asm/traps.h> ··· 475 477 &sdhi1_device, 476 478 }; 477 479 478 - static struct map_desc ag5evm_io_desc[] __initdata = { 479 - /* create a 1:1 entity map for 0xe6xxxxxx 480 - * used by CPGA, INTC and PFC. 481 - */ 482 - { 483 - .virtual = 0xe6000000, 484 - .pfn = __phys_to_pfn(0xe6000000), 485 - .length = 256 << 20, 486 - .type = MT_DEVICE_NONSHARED 487 - }, 488 - }; 489 - 490 - static void __init ag5evm_map_io(void) 491 - { 492 - iotable_init(ag5evm_io_desc, ARRAY_SIZE(ag5evm_io_desc)); 493 - 494 - /* setup early devices and console here as well */ 495 - sh73a0_add_early_devices(); 496 - shmobile_setup_console(); 497 - } 498 - 499 480 static void __init ag5evm_init(void) 500 481 { 501 482 sh73a0_pinmux_init(); ··· 590 613 platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices)); 591 614 } 592 615 593 - static void __init ag5evm_timer_init(void) 594 - { 595 - sh73a0_clock_init(); 596 - shmobile_timer.init(); 597 - return; 598 - } 599 - 600 - struct sys_timer ag5evm_timer = { 601 - .init = ag5evm_timer_init, 602 - }; 603 - 604 616 MACHINE_START(AG5EVM, "ag5evm") 605 - .map_io = ag5evm_map_io, 617 + .map_io = sh73a0_map_io, 618 + .init_early = sh73a0_add_early_devices, 606 619 .nr_irqs = NR_IRQS_LEGACY, 607 620 .init_irq = sh73a0_init_irq, 608 621 .handle_irq = gic_handle_irq, 609 622 .init_machine = ag5evm_init, 610 - .timer = &ag5evm_timer, 623 + .timer = &shmobile_timer, 611 624 MACHINE_END
+6 -38
arch/arm/mach-shmobile/board-ap4evb.c
··· 61 61 62 62 #include <asm/mach-types.h> 63 63 #include <asm/mach/arch.h> 64 - #include <asm/mach/map.h> 65 - #include <asm/mach/time.h> 66 64 #include <asm/setup.h> 67 65 68 66 /* ··· 1186 1188 }, 1187 1189 }; 1188 1190 1189 - static struct map_desc ap4evb_io_desc[] __initdata = { 1190 - /* create a 1:1 entity map for 0xe6xxxxxx 1191 - * used by CPGA, INTC and PFC. 1192 - */ 1193 - { 1194 - .virtual = 0xe6000000, 1195 - .pfn = __phys_to_pfn(0xe6000000), 1196 - .length = 256 << 20, 1197 - .type = MT_DEVICE_NONSHARED 1198 - }, 1199 - }; 1200 - 1201 - static void __init ap4evb_map_io(void) 1202 - { 1203 - iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc)); 1204 - 1205 - /* setup early devices and console here as well */ 1206 - sh7372_add_early_devices(); 1207 - shmobile_setup_console(); 1208 - } 1209 - 1210 1191 #define GPIO_PORT9CR 0xE6051009 1211 1192 #define GPIO_PORT10CR 0xE605100A 1212 1193 #define USCCR1 0xE6058144 ··· 1193 1216 { 1194 1217 u32 srcr4; 1195 1218 struct clk *clk; 1219 + 1220 + /* External clock source */ 1221 + clk_set_rate(&sh7372_dv_clki_clk, 27000000); 1196 1222 1197 1223 sh7372_pinmux_init(); 1198 1224 ··· 1433 1453 pm_clk_add(&lcdc1_device.dev, "hdmi"); 1434 1454 } 1435 1455 1436 - static void __init ap4evb_timer_init(void) 1437 - { 1438 - sh7372_clock_init(); 1439 - shmobile_timer.init(); 1440 - 1441 - /* External clock source */ 1442 - clk_set_rate(&sh7372_dv_clki_clk, 27000000); 1443 - } 1444 - 1445 - static struct sys_timer ap4evb_timer = { 1446 - .init = ap4evb_timer_init, 1447 - }; 1448 - 1449 1456 MACHINE_START(AP4EVB, "ap4evb") 1450 - .map_io = ap4evb_map_io, 1457 + .map_io = sh7372_map_io, 1458 + .init_early = sh7372_add_early_devices, 1451 1459 .init_irq = sh7372_init_irq, 1452 1460 .handle_irq = shmobile_handle_irq_intc, 1453 1461 .init_machine = ap4evb_init, 1454 - .timer = &ap4evb_timer, 1462 + .timer = &shmobile_timer, 1455 1463 MACHINE_END
+12 -32
arch/arm/mach-shmobile/board-bonito.c
··· 328 328 * map I/O 329 329 */ 330 330 static struct map_desc bonito_io_desc[] __initdata = { 331 - /* 332 - * for CPGA/INTC/PFC 333 - * 0xe6000000-0xefffffff -> 0xe6000000-0xefffffff 334 - */ 335 - { 336 - .virtual = 0xe6000000, 337 - .pfn = __phys_to_pfn(0xe6000000), 338 - .length = 160 << 20, 339 - .type = MT_DEVICE_NONSHARED 340 - }, 341 - #ifdef CONFIG_CACHE_L2X0 342 - /* 343 - * for l2x0_init() 344 - * 0xf0100000-0xf0101000 -> 0xf0002000-0xf0003000 345 - */ 346 - { 347 - .virtual = 0xf0002000, 348 - .pfn = __phys_to_pfn(0xf0100000), 349 - .length = PAGE_SIZE, 350 - .type = MT_DEVICE_NONSHARED 351 - }, 352 - #endif 353 331 /* 354 332 * for FPGA (0x1800000-0x19ffffff) 355 333 * 0x18000000-0x18002000 -> 0xf0003000-0xf0005000 ··· 342 364 343 365 static void __init bonito_map_io(void) 344 366 { 367 + r8a7740_map_io(); 345 368 iotable_init(bonito_io_desc, ARRAY_SIZE(bonito_io_desc)); 346 - 347 - /* setup early devices and console here as well */ 348 - r8a7740_add_early_devices(); 349 - shmobile_setup_console(); 350 369 } 351 370 352 371 /* ··· 467 492 } 468 493 } 469 494 470 - static void __init bonito_timer_init(void) 495 + static void __init bonito_earlytimer_init(void) 471 496 { 472 497 u16 val; 473 498 u8 md_ck = 0; ··· 482 507 md_ck |= MD_CK0; 483 508 484 509 r8a7740_clock_init(md_ck); 485 - shmobile_timer.init(); 510 + shmobile_earlytimer_init(); 486 511 } 487 512 488 - struct sys_timer bonito_timer = { 489 - .init = bonito_timer_init, 490 - }; 513 + void __init bonito_add_early_devices(void) 514 + { 515 + r8a7740_add_early_devices(); 516 + 517 + /* override timer setup with board-specific code */ 518 + shmobile_timer.init = bonito_earlytimer_init; 519 + } 491 520 492 521 MACHINE_START(BONITO, "bonito") 493 522 .map_io = bonito_map_io, 523 + .init_early = bonito_add_early_devices, 494 524 .init_irq = r8a7740_init_irq, 495 525 .handle_irq = shmobile_handle_irq_intc, 496 526 .init_machine = bonito_init, 497 - .timer = &bonito_timer, 527 + .timer = &shmobile_timer, 498 528 MACHINE_END
+3 -35
arch/arm/mach-shmobile/board-g3evm.c
··· 37 37 #include <mach/common.h> 38 38 #include <asm/mach-types.h> 39 39 #include <asm/mach/arch.h> 40 - #include <asm/mach/map.h> 41 - #include <asm/mach/time.h> 42 40 43 41 /* 44 42 * IrDA ··· 244 246 &irda_device, 245 247 }; 246 248 247 - static struct map_desc g3evm_io_desc[] __initdata = { 248 - /* create a 1:1 entity map for 0xe6xxxxxx 249 - * used by CPGA, INTC and PFC. 250 - */ 251 - { 252 - .virtual = 0xe6000000, 253 - .pfn = __phys_to_pfn(0xe6000000), 254 - .length = 256 << 20, 255 - .type = MT_DEVICE_NONSHARED 256 - }, 257 - }; 258 - 259 - static void __init g3evm_map_io(void) 260 - { 261 - iotable_init(g3evm_io_desc, ARRAY_SIZE(g3evm_io_desc)); 262 - 263 - /* setup early devices and console here as well */ 264 - sh7367_add_early_devices(); 265 - shmobile_setup_console(); 266 - } 267 - 268 249 static void __init g3evm_init(void) 269 250 { 270 251 sh7367_pinmux_init(); ··· 331 354 platform_add_devices(g3evm_devices, ARRAY_SIZE(g3evm_devices)); 332 355 } 333 356 334 - static void __init g3evm_timer_init(void) 335 - { 336 - sh7367_clock_init(); 337 - shmobile_timer.init(); 338 - } 339 - 340 - static struct sys_timer g3evm_timer = { 341 - .init = g3evm_timer_init, 342 - }; 343 - 344 357 MACHINE_START(G3EVM, "g3evm") 345 - .map_io = g3evm_map_io, 358 + .map_io = sh7367_map_io, 359 + .init_early = sh7367_add_early_devices, 346 360 .init_irq = sh7367_init_irq, 347 361 .handle_irq = shmobile_handle_irq_intc, 348 362 .init_machine = g3evm_init, 349 - .timer = &g3evm_timer, 363 + .timer = &shmobile_timer, 350 364 MACHINE_END
+3 -35
arch/arm/mach-shmobile/board-g4evm.c
··· 38 38 #include <mach/common.h> 39 39 #include <asm/mach-types.h> 40 40 #include <asm/mach/arch.h> 41 - #include <asm/mach/map.h> 42 - #include <asm/mach/time.h> 43 41 44 42 /* 45 43 * SDHI ··· 258 260 &sdhi1_device, 259 261 }; 260 262 261 - static struct map_desc g4evm_io_desc[] __initdata = { 262 - /* create a 1:1 entity map for 0xe6xxxxxx 263 - * used by CPGA, INTC and PFC. 264 - */ 265 - { 266 - .virtual = 0xe6000000, 267 - .pfn = __phys_to_pfn(0xe6000000), 268 - .length = 256 << 20, 269 - .type = MT_DEVICE_NONSHARED 270 - }, 271 - }; 272 - 273 - static void __init g4evm_map_io(void) 274 - { 275 - iotable_init(g4evm_io_desc, ARRAY_SIZE(g4evm_io_desc)); 276 - 277 - /* setup early devices and console here as well */ 278 - sh7377_add_early_devices(); 279 - shmobile_setup_console(); 280 - } 281 - 282 263 #define GPIO_SDHID0_D0 0xe60520fc 283 264 #define GPIO_SDHID0_D1 0xe60520fd 284 265 #define GPIO_SDHID0_D2 0xe60520fe ··· 374 397 platform_add_devices(g4evm_devices, ARRAY_SIZE(g4evm_devices)); 375 398 } 376 399 377 - static void __init g4evm_timer_init(void) 378 - { 379 - sh7377_clock_init(); 380 - shmobile_timer.init(); 381 - } 382 - 383 - static struct sys_timer g4evm_timer = { 384 - .init = g4evm_timer_init, 385 - }; 386 - 387 400 MACHINE_START(G4EVM, "g4evm") 388 - .map_io = g4evm_map_io, 401 + .map_io = sh7377_map_io, 402 + .init_early = sh7377_add_early_devices, 389 403 .init_irq = sh7377_init_irq, 390 404 .handle_irq = shmobile_handle_irq_intc, 391 405 .init_machine = g4evm_init, 392 - .timer = &g4evm_timer, 406 + .timer = &shmobile_timer, 393 407 MACHINE_END
+3 -35
arch/arm/mach-shmobile/board-kota2.c
··· 43 43 #include <mach/common.h> 44 44 #include <asm/mach-types.h> 45 45 #include <asm/mach/arch.h> 46 - #include <asm/mach/map.h> 47 46 #include <asm/mach/time.h> 48 47 #include <asm/hardware/gic.h> 49 48 #include <asm/hardware/cache-l2x0.h> ··· 408 409 &sdhi1_device, 409 410 }; 410 411 411 - static struct map_desc kota2_io_desc[] __initdata = { 412 - /* create a 1:1 entity map for 0xe6xxxxxx 413 - * used by CPGA, INTC and PFC. 414 - */ 415 - { 416 - .virtual = 0xe6000000, 417 - .pfn = __phys_to_pfn(0xe6000000), 418 - .length = 256 << 20, 419 - .type = MT_DEVICE_NONSHARED 420 - }, 421 - }; 422 - 423 - static void __init kota2_map_io(void) 424 - { 425 - iotable_init(kota2_io_desc, ARRAY_SIZE(kota2_io_desc)); 426 - 427 - /* setup early devices and console here as well */ 428 - sh73a0_add_early_devices(); 429 - shmobile_setup_console(); 430 - } 431 - 432 412 static void __init kota2_init(void) 433 413 { 434 414 sh73a0_pinmux_init(); ··· 513 535 platform_add_devices(kota2_devices, ARRAY_SIZE(kota2_devices)); 514 536 } 515 537 516 - static void __init kota2_timer_init(void) 517 - { 518 - sh73a0_clock_init(); 519 - shmobile_timer.init(); 520 - return; 521 - } 522 - 523 - struct sys_timer kota2_timer = { 524 - .init = kota2_timer_init, 525 - }; 526 - 527 538 MACHINE_START(KOTA2, "kota2") 528 - .map_io = kota2_map_io, 539 + .map_io = sh73a0_map_io, 540 + .init_early = sh73a0_add_early_devices, 529 541 .nr_irqs = NR_IRQS_LEGACY, 530 542 .init_irq = sh73a0_init_irq, 531 543 .handle_irq = gic_handle_irq, 532 544 .init_machine = kota2_init, 533 - .timer = &kota2_timer, 545 + .timer = &shmobile_timer, 534 546 MACHINE_END
+6 -33
arch/arm/mach-shmobile/board-mackerel.c
··· 57 57 #include <mach/sh7372.h> 58 58 59 59 #include <asm/mach/arch.h> 60 - #include <asm/mach/time.h> 61 - #include <asm/mach/map.h> 62 60 #include <asm/mach-types.h> 63 61 64 62 /* ··· 1327 1329 }, 1328 1330 }; 1329 1331 1330 - static struct map_desc mackerel_io_desc[] __initdata = { 1331 - /* create a 1:1 entity map for 0xe6xxxxxx 1332 - * used by CPGA, INTC and PFC. 1333 - */ 1334 - { 1335 - .virtual = 0xe6000000, 1336 - .pfn = __phys_to_pfn(0xe6000000), 1337 - .length = 256 << 20, 1338 - .type = MT_DEVICE_NONSHARED 1339 - }, 1340 - }; 1341 - 1342 1332 static void __init mackerel_map_io(void) 1343 1333 { 1344 - iotable_init(mackerel_io_desc, ARRAY_SIZE(mackerel_io_desc)); 1334 + sh7372_map_io(); 1345 1335 /* DMA memory at 0xff200000 - 0xffdfffff. The default 2MB size isn't 1346 1336 * enough to allocate the frame buffer memory. 1347 1337 */ 1348 1338 init_consistent_dma_size(12 << 20); 1349 - 1350 - /* setup early devices and console here as well */ 1351 - sh7372_add_early_devices(); 1352 - shmobile_setup_console(); 1353 1339 } 1354 1340 1355 1341 #define GPIO_PORT9CR 0xE6051009 ··· 1347 1365 u32 srcr4; 1348 1366 struct clk *clk; 1349 1367 int ret; 1368 + 1369 + /* External clock source */ 1370 + clk_set_rate(&sh7372_dv_clki_clk, 27000000); 1350 1371 1351 1372 sh7372_pinmux_init(); 1352 1373 ··· 1554 1569 pm_clk_add(&hdmi_lcdc_device.dev, "hdmi"); 1555 1570 } 1556 1571 1557 - static void __init mackerel_timer_init(void) 1558 - { 1559 - sh7372_clock_init(); 1560 - shmobile_timer.init(); 1561 - 1562 - /* External clock source */ 1563 - clk_set_rate(&sh7372_dv_clki_clk, 27000000); 1564 - } 1565 - 1566 - static struct sys_timer mackerel_timer = { 1567 - .init = mackerel_timer_init, 1568 - }; 1569 - 1570 1572 MACHINE_START(MACKEREL, "mackerel") 1571 1573 .map_io = mackerel_map_io, 1574 + .init_early = sh7372_add_early_devices, 1572 1575 .init_irq = sh7372_init_irq, 1573 1576 .handle_irq = shmobile_handle_irq_intc, 1574 1577 .init_machine = mackerel_init, 1575 - .timer = &mackerel_timer, 1578 + .timer = &shmobile_timer, 1576 1579 MACHINE_END
+3 -59
arch/arm/mach-shmobile/board-marzen.c
··· 33 33 #include <mach/common.h> 34 34 #include <asm/mach-types.h> 35 35 #include <asm/mach/arch.h> 36 - #include <asm/mach/map.h> 37 - #include <asm/mach/time.h> 38 36 #include <asm/hardware/gic.h> 39 37 #include <asm/traps.h> 40 38 ··· 70 72 &eth_device, 71 73 }; 72 74 73 - static struct map_desc marzen_io_desc[] __initdata = { 74 - /* 2M entity map for 0xf0000000 (MPCORE) */ 75 - { 76 - .virtual = 0xf0000000, 77 - .pfn = __phys_to_pfn(0xf0000000), 78 - .length = SZ_2M, 79 - .type = MT_DEVICE_NONSHARED 80 - }, 81 - /* 16M entity map for 0xfexxxxxx (DMAC-S/HPBREG/INTC2/LRAM/DBSC) */ 82 - { 83 - .virtual = 0xfe000000, 84 - .pfn = __phys_to_pfn(0xfe000000), 85 - .length = SZ_16M, 86 - .type = MT_DEVICE_NONSHARED 87 - }, 88 - }; 89 - 90 - static void __init marzen_map_io(void) 91 - { 92 - iotable_init(marzen_io_desc, ARRAY_SIZE(marzen_io_desc)); 93 - } 94 - 95 - static void __init marzen_init_early(void) 96 - { 97 - r8a7779_add_early_devices(); 98 - 99 - /* Early serial console setup is not included here due to 100 - * memory map collisions. The SCIF serial ports in r8a7779 101 - * are difficult to entity map 1:1 due to collision with the 102 - * virtual memory range used by the coherent DMA code on ARM. 103 - * 104 - * Anyone wanting to debug early can remove UPF_IOREMAP from 105 - * the sh-sci serial console platform data, adjust mapbase 106 - * to a static M:N virt:phys mapping that needs to be added to 107 - * the mappings passed with iotable_init() above. 108 - * 109 - * Then add a call to shmobile_setup_console() from this function. 110 - * 111 - * As a final step pass earlyprint=sh-sci.2,115200 on the kernel 112 - * command line. 113 - */ 114 - } 115 - 116 75 static void __init marzen_init(void) 117 76 { 118 77 r8a7779_pinmux_init(); ··· 90 135 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); 91 136 } 92 137 93 - static void __init marzen_timer_init(void) 94 - { 95 - r8a7779_clock_init(); 96 - shmobile_timer.init(); 97 - return; 98 - } 99 - 100 - struct sys_timer marzen_timer = { 101 - .init = marzen_timer_init, 102 - }; 103 - 104 138 MACHINE_START(MARZEN, "marzen") 105 - .map_io = marzen_map_io, 106 - .init_early = marzen_init_early, 139 + .map_io = r8a7779_map_io, 140 + .init_early = r8a7779_add_early_devices, 107 141 .nr_irqs = NR_IRQS_LEGACY, 108 142 .init_irq = r8a7779_init_irq, 109 143 .handle_irq = gic_handle_irq, 110 144 .init_machine = marzen_init, 111 - .timer = &marzen_timer, 145 + .timer = &shmobile_timer, 112 146 MACHINE_END
+4 -4
arch/arm/mach-shmobile/clock-r8a7740.c
··· 93 93 return clk->parent->rate / (int)(clk->priv); 94 94 } 95 95 96 - static struct clk_ops div_clk_ops = { 96 + static struct sh_clk_ops div_clk_ops = { 97 97 .recalc = div_recalc, 98 98 }; 99 99 ··· 125 125 .parent = &extal2_clk, 126 126 }; 127 127 128 - static struct clk_ops followparent_clk_ops = { 128 + static struct sh_clk_ops followparent_clk_ops = { 129 129 .recalc = followparent_recalc, 130 130 }; 131 131 ··· 156 156 return clk->parent->rate * mult; 157 157 } 158 158 159 - static struct clk_ops pllc01_clk_ops = { 159 + static struct sh_clk_ops pllc01_clk_ops = { 160 160 .recalc = pllc01_recalc, 161 161 }; 162 162 ··· 376 376 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 377 377 378 378 if (!ret) 379 - clk_init(); 379 + shmobile_clk_init(); 380 380 else 381 381 panic("failed to setup r8a7740 clocks\n"); 382 382 }
+2 -2
arch/arm/mach-shmobile/clock-r8a7779.c
··· 107 107 return clk->parent->rate * 4; 108 108 } 109 109 110 - static struct clk_ops mul4_clk_ops = { 110 + static struct sh_clk_ops mul4_clk_ops = { 111 111 .recalc = mul4_recalc, 112 112 }; 113 113 ··· 170 170 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 171 171 172 172 if (!ret) 173 - clk_init(); 173 + shmobile_clk_init(); 174 174 else 175 175 panic("failed to setup r8a7779 clocks\n"); 176 176 }
+4 -4
arch/arm/mach-shmobile/clock-sh7367.c
··· 74 74 return clk->parent->rate / 2; 75 75 } 76 76 77 - static struct clk_ops div2_clk_ops = { 77 + static struct sh_clk_ops div2_clk_ops = { 78 78 .recalc = div2_recalc, 79 79 }; 80 80 ··· 101 101 return clk->parent->rate * mult; 102 102 } 103 103 104 - static struct clk_ops pllc1_clk_ops = { 104 + static struct sh_clk_ops pllc1_clk_ops = { 105 105 .recalc = pllc1_recalc, 106 106 }; 107 107 ··· 128 128 return clk->parent->rate * mult; 129 129 } 130 130 131 - static struct clk_ops pllc2_clk_ops = { 131 + static struct sh_clk_ops pllc2_clk_ops = { 132 132 .recalc = pllc2_recalc, 133 133 }; 134 134 ··· 349 349 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 350 350 351 351 if (!ret) 352 - clk_init(); 352 + shmobile_clk_init(); 353 353 else 354 354 panic("failed to setup sh7367 clocks\n"); 355 355 }
+5 -5
arch/arm/mach-shmobile/clock-sh7372.c
··· 89 89 return clk->parent->rate / 2; 90 90 } 91 91 92 - static struct clk_ops div2_clk_ops = { 92 + static struct sh_clk_ops div2_clk_ops = { 93 93 .recalc = div2_recalc, 94 94 }; 95 95 ··· 128 128 return clk->parent->rate * mult; 129 129 } 130 130 131 - static struct clk_ops pllc01_clk_ops = { 131 + static struct sh_clk_ops pllc01_clk_ops = { 132 132 .recalc = pllc01_recalc, 133 133 }; 134 134 ··· 276 276 return 0; 277 277 } 278 278 279 - static struct clk_ops pllc2_clk_ops = { 279 + static struct sh_clk_ops pllc2_clk_ops = { 280 280 .recalc = pllc2_recalc, 281 281 .round_rate = pllc2_round_rate, 282 282 .set_rate = pllc2_set_rate, ··· 468 468 return 0; 469 469 } 470 470 471 - static struct clk_ops fsidiv_clk_ops = { 471 + static struct sh_clk_ops fsidiv_clk_ops = { 472 472 .recalc = fsidiv_recalc, 473 473 .round_rate = fsidiv_round_rate, 474 474 .set_rate = fsidiv_set_rate, ··· 710 710 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 711 711 712 712 if (!ret) 713 - clk_init(); 713 + shmobile_clk_init(); 714 714 else 715 715 panic("failed to setup sh7372 clocks\n"); 716 716
+4 -4
arch/arm/mach-shmobile/clock-sh7377.c
··· 77 77 return clk->parent->rate / 2; 78 78 } 79 79 80 - static struct clk_ops div2_clk_ops = { 80 + static struct sh_clk_ops div2_clk_ops = { 81 81 .recalc = div2_recalc, 82 82 }; 83 83 ··· 110 110 return clk->parent->rate * mult; 111 111 } 112 112 113 - static struct clk_ops pllc1_clk_ops = { 113 + static struct sh_clk_ops pllc1_clk_ops = { 114 114 .recalc = pllc1_recalc, 115 115 }; 116 116 ··· 137 137 return clk->parent->rate * mult; 138 138 } 139 139 140 - static struct clk_ops pllc2_clk_ops = { 140 + static struct sh_clk_ops pllc2_clk_ops = { 141 141 .recalc = pllc2_recalc, 142 142 }; 143 143 ··· 360 360 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 361 361 362 362 if (!ret) 363 - clk_init(); 363 + shmobile_clk_init(); 364 364 else 365 365 panic("failed to setup sh7377 clocks\n"); 366 366 }
+7 -7
arch/arm/mach-shmobile/clock-sh73a0.c
··· 88 88 return clk->parent->rate / 2; 89 89 } 90 90 91 - static struct clk_ops div2_clk_ops = { 91 + static struct sh_clk_ops div2_clk_ops = { 92 92 .recalc = div2_recalc, 93 93 }; 94 94 ··· 97 97 return clk->parent->rate / 7; 98 98 } 99 99 100 - static struct clk_ops div7_clk_ops = { 100 + static struct sh_clk_ops div7_clk_ops = { 101 101 .recalc = div7_recalc, 102 102 }; 103 103 ··· 106 106 return clk->parent->rate / 13; 107 107 } 108 108 109 - static struct clk_ops div13_clk_ops = { 109 + static struct sh_clk_ops div13_clk_ops = { 110 110 .recalc = div13_recalc, 111 111 }; 112 112 ··· 122 122 .parent = &sh73a0_extal2_clk, 123 123 }; 124 124 125 - static struct clk_ops main_clk_ops = { 125 + static struct sh_clk_ops main_clk_ops = { 126 126 .recalc = followparent_recalc, 127 127 }; 128 128 ··· 156 156 return clk->parent->rate * mult; 157 157 } 158 158 159 - static struct clk_ops pll_clk_ops = { 159 + static struct sh_clk_ops pll_clk_ops = { 160 160 .recalc = pll_recalc, 161 161 }; 162 162 ··· 438 438 return 0; 439 439 } 440 440 441 - static struct clk_ops dsiphy_clk_ops = { 441 + static struct sh_clk_ops dsiphy_clk_ops = { 442 442 .recalc = dsiphy_recalc, 443 443 .round_rate = dsiphy_round_rate, 444 444 .set_rate = dsiphy_set_rate, ··· 620 620 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 621 621 622 622 if (!ret) 623 - clk_init(); 623 + shmobile_clk_init(); 624 624 else 625 625 panic("failed to setup sh73a0 clocks\n"); 626 626 }
+1 -1
arch/arm/mach-shmobile/clock.c
··· 24 24 #include <linux/sh_clk.h> 25 25 #include <linux/export.h> 26 26 27 - int __init clk_init(void) 27 + int __init shmobile_clk_init(void) 28 28 { 29 29 /* Kick the child clocks.. */ 30 30 recalculate_root_clocks();
+10 -1
arch/arm/mach-shmobile/include/mach/common.h
··· 1 1 #ifndef __ARCH_MACH_COMMON_H 2 2 #define __ARCH_MACH_COMMON_H 3 3 4 + extern void shmobile_earlytimer_init(void); 4 5 extern struct sys_timer shmobile_timer; 6 + struct twd_local_timer; 7 + void shmobile_twd_init(struct twd_local_timer *twd_local_timer); 5 8 extern void shmobile_setup_console(void); 6 9 extern void shmobile_secondary_vector(void); 7 10 extern int shmobile_platform_cpu_kill(unsigned int cpu); 8 11 struct clk; 9 - extern int clk_init(void); 12 + extern int shmobile_clk_init(void); 10 13 extern void shmobile_handle_irq_intc(struct pt_regs *); 11 14 extern struct platform_suspend_ops shmobile_suspend_ops; 12 15 struct cpuidle_driver; ··· 17 14 extern void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv); 18 15 19 16 extern void sh7367_init_irq(void); 17 + extern void sh7367_map_io(void); 20 18 extern void sh7367_add_early_devices(void); 21 19 extern void sh7367_add_standard_devices(void); 22 20 extern void sh7367_clock_init(void); ··· 26 22 extern struct clk sh7367_extal2_clk; 27 23 28 24 extern void sh7377_init_irq(void); 25 + extern void sh7377_map_io(void); 29 26 extern void sh7377_add_early_devices(void); 30 27 extern void sh7377_add_standard_devices(void); 31 28 extern void sh7377_clock_init(void); ··· 35 30 extern struct clk sh7377_extal2_clk; 36 31 37 32 extern void sh7372_init_irq(void); 33 + extern void sh7372_map_io(void); 38 34 extern void sh7372_add_early_devices(void); 39 35 extern void sh7372_add_standard_devices(void); 40 36 extern void sh7372_clock_init(void); ··· 47 41 extern struct clk sh7372_extal2_clk; 48 42 49 43 extern void sh73a0_init_irq(void); 44 + extern void sh73a0_map_io(void); 50 45 extern void sh73a0_add_early_devices(void); 51 46 extern void sh73a0_add_standard_devices(void); 52 47 extern void sh73a0_clock_init(void); ··· 63 56 extern void sh73a0_smp_prepare_cpus(void); 64 57 65 58 extern void r8a7740_init_irq(void); 59 + extern void r8a7740_map_io(void); 66 60 extern void r8a7740_add_early_devices(void); 67 61 extern void r8a7740_add_standard_devices(void); 68 62 extern void r8a7740_clock_init(u8 md_ck); 69 63 extern void r8a7740_pinmux_init(void); 70 64 71 65 extern void r8a7779_init_irq(void); 66 + extern void r8a7779_map_io(void); 72 67 extern void r8a7779_add_early_devices(void); 73 68 extern void r8a7779_add_standard_devices(void); 74 69 extern void r8a7779_clock_init(void);
-26
arch/arm/mach-shmobile/localtimer.c
··· 1 - /* 2 - * SMP support for R-Mobile / SH-Mobile - local timer portion 3 - * 4 - * Copyright (C) 2010 Magnus Damm 5 - * 6 - * Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 - */ 12 - #include <linux/init.h> 13 - #include <linux/smp.h> 14 - #include <linux/clockchips.h> 15 - #include <asm/smp_twd.h> 16 - #include <asm/localtimer.h> 17 - 18 - /* 19 - * Setup the local clock events for a CPU. 20 - */ 21 - int __cpuinit local_timer_setup(struct clock_event_device *evt) 22 - { 23 - evt->irq = 29; 24 - twd_timer_setup(evt); 25 - return 0; 26 - }
-1
arch/arm/mach-shmobile/platsmp.c
··· 17 17 #include <linux/smp.h> 18 18 #include <linux/io.h> 19 19 #include <asm/hardware/gic.h> 20 - #include <asm/localtimer.h> 21 20 #include <asm/mach-types.h> 22 21 #include <mach/common.h> 23 22
+45
arch/arm/mach-shmobile/setup-r8a7740.c
··· 25 25 #include <linux/serial_sci.h> 26 26 #include <linux/sh_timer.h> 27 27 #include <mach/r8a7740.h> 28 + #include <mach/common.h> 28 29 #include <asm/mach-types.h> 30 + #include <asm/mach/map.h> 29 31 #include <asm/mach/arch.h> 32 + #include <asm/mach/time.h> 33 + 34 + static struct map_desc r8a7740_io_desc[] __initdata = { 35 + /* 36 + * for CPGA/INTC/PFC 37 + * 0xe6000000-0xefffffff -> 0xe6000000-0xefffffff 38 + */ 39 + { 40 + .virtual = 0xe6000000, 41 + .pfn = __phys_to_pfn(0xe6000000), 42 + .length = 160 << 20, 43 + .type = MT_DEVICE_NONSHARED 44 + }, 45 + #ifdef CONFIG_CACHE_L2X0 46 + /* 47 + * for l2x0_init() 48 + * 0xf0100000-0xf0101000 -> 0xf0002000-0xf0003000 49 + */ 50 + { 51 + .virtual = 0xf0002000, 52 + .pfn = __phys_to_pfn(0xf0100000), 53 + .length = PAGE_SIZE, 54 + .type = MT_DEVICE_NONSHARED 55 + }, 56 + #endif 57 + }; 58 + 59 + void __init r8a7740_map_io(void) 60 + { 61 + iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc)); 62 + } 30 63 31 64 /* SCIFA0 */ 32 65 static struct plat_sci_port scif0_platform_data = { ··· 378 345 ARRAY_SIZE(r8a7740_late_devices)); 379 346 } 380 347 348 + static void __init r8a7740_earlytimer_init(void) 349 + { 350 + r8a7740_clock_init(0); 351 + shmobile_earlytimer_init(); 352 + } 353 + 381 354 void __init r8a7740_add_early_devices(void) 382 355 { 383 356 early_platform_add_devices(r8a7740_early_devices, 384 357 ARRAY_SIZE(r8a7740_early_devices)); 358 + 359 + /* setup early console here as well */ 360 + shmobile_setup_console(); 361 + 362 + /* override timer setup with soc-specific code */ 363 + shmobile_timer.init = r8a7740_earlytimer_init; 385 364 }
+54
arch/arm/mach-shmobile/setup-r8a7779.c
··· 33 33 #include <mach/common.h> 34 34 #include <asm/mach-types.h> 35 35 #include <asm/mach/arch.h> 36 + #include <asm/mach/time.h> 37 + #include <asm/mach/map.h> 38 + #include <asm/hardware/cache-l2x0.h> 39 + 40 + static struct map_desc r8a7779_io_desc[] __initdata = { 41 + /* 2M entity map for 0xf0000000 (MPCORE) */ 42 + { 43 + .virtual = 0xf0000000, 44 + .pfn = __phys_to_pfn(0xf0000000), 45 + .length = SZ_2M, 46 + .type = MT_DEVICE_NONSHARED 47 + }, 48 + /* 16M entity map for 0xfexxxxxx (DMAC-S/HPBREG/INTC2/LRAM/DBSC) */ 49 + { 50 + .virtual = 0xfe000000, 51 + .pfn = __phys_to_pfn(0xfe000000), 52 + .length = SZ_16M, 53 + .type = MT_DEVICE_NONSHARED 54 + }, 55 + }; 56 + 57 + void __init r8a7779_map_io(void) 58 + { 59 + iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc)); 60 + } 36 61 37 62 static struct plat_sci_port scif0_platform_data = { 38 63 .mapbase = 0xffe40000, ··· 244 219 245 220 void __init r8a7779_add_standard_devices(void) 246 221 { 222 + #ifdef CONFIG_CACHE_L2X0 223 + /* Early BRESP enable, Shared attribute override enable, 64K*16way */ 224 + l2x0_init((void __iomem __force *)(0xf0100000), 0x40470000, 0x82000fff); 225 + #endif 247 226 r8a7779_pm_init(); 248 227 249 228 r8a7779_init_pm_domain(&r8a7779_sh4a); ··· 261 232 ARRAY_SIZE(r8a7779_late_devices)); 262 233 } 263 234 235 + static void __init r8a7779_earlytimer_init(void) 236 + { 237 + r8a7779_clock_init(); 238 + shmobile_earlytimer_init(); 239 + } 240 + 264 241 void __init r8a7779_add_early_devices(void) 265 242 { 266 243 early_platform_add_devices(r8a7779_early_devices, 267 244 ARRAY_SIZE(r8a7779_early_devices)); 245 + 246 + /* Early serial console setup is not included here due to 247 + * memory map collisions. The SCIF serial ports in r8a7779 248 + * are difficult to entity map 1:1 due to collision with the 249 + * virtual memory range used by the coherent DMA code on ARM. 250 + * 251 + * Anyone wanting to debug early can remove UPF_IOREMAP from 252 + * the sh-sci serial console platform data, adjust mapbase 253 + * to a static M:N virt:phys mapping that needs to be added to 254 + * the mappings passed with iotable_init() above. 255 + * 256 + * Then add a call to shmobile_setup_console() from this function. 257 + * 258 + * As a final step pass earlyprint=sh-sci.2,115200 on the kernel 259 + * command line in case of the marzen board. 260 + */ 261 + 262 + /* override timer setup with soc-specific code */ 263 + shmobile_timer.init = r8a7779_earlytimer_init; 268 264 }
+32
arch/arm/mach-shmobile/setup-sh7367.c
··· 29 29 #include <linux/serial_sci.h> 30 30 #include <linux/sh_timer.h> 31 31 #include <mach/hardware.h> 32 + #include <mach/common.h> 32 33 #include <asm/mach-types.h> 33 34 #include <asm/mach/arch.h> 35 + #include <asm/mach/map.h> 36 + #include <asm/mach/time.h> 37 + 38 + static struct map_desc sh7367_io_desc[] __initdata = { 39 + /* create a 1:1 entity map for 0xe6xxxxxx 40 + * used by CPGA, INTC and PFC. 41 + */ 42 + { 43 + .virtual = 0xe6000000, 44 + .pfn = __phys_to_pfn(0xe6000000), 45 + .length = 256 << 20, 46 + .type = MT_DEVICE_NONSHARED 47 + }, 48 + }; 49 + 50 + void __init sh7367_map_io(void) 51 + { 52 + iotable_init(sh7367_io_desc, ARRAY_SIZE(sh7367_io_desc)); 53 + } 34 54 35 55 /* SCIFA0 */ 36 56 static struct plat_sci_port scif0_platform_data = { ··· 455 435 ARRAY_SIZE(sh7367_devices)); 456 436 } 457 437 438 + static void __init sh7367_earlytimer_init(void) 439 + { 440 + sh7367_clock_init(); 441 + shmobile_earlytimer_init(); 442 + } 443 + 458 444 #define SYMSTPCR2 0xe6158048 459 445 #define SYMSTPCR2_CMT1 (1 << 29) 460 446 ··· 471 445 472 446 early_platform_add_devices(sh7367_early_devices, 473 447 ARRAY_SIZE(sh7367_early_devices)); 448 + 449 + /* setup early console here as well */ 450 + shmobile_setup_console(); 451 + 452 + /* override timer setup with soc-specific code */ 453 + shmobile_timer.init = sh7367_earlytimer_init; 474 454 }
+32
arch/arm/mach-shmobile/setup-sh7372.c
··· 33 33 #include <linux/pm_domain.h> 34 34 #include <mach/hardware.h> 35 35 #include <mach/sh7372.h> 36 + #include <mach/common.h> 37 + #include <asm/mach/map.h> 36 38 #include <asm/mach-types.h> 37 39 #include <asm/mach/arch.h> 40 + #include <asm/mach/time.h> 41 + 42 + static struct map_desc sh7372_io_desc[] __initdata = { 43 + /* create a 1:1 entity map for 0xe6xxxxxx 44 + * used by CPGA, INTC and PFC. 45 + */ 46 + { 47 + .virtual = 0xe6000000, 48 + .pfn = __phys_to_pfn(0xe6000000), 49 + .length = 256 << 20, 50 + .type = MT_DEVICE_NONSHARED 51 + }, 52 + }; 53 + 54 + void __init sh7372_map_io(void) 55 + { 56 + iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc)); 57 + } 38 58 39 59 /* SCIFA0 */ 40 60 static struct plat_sci_port scif0_platform_data = { ··· 1067 1047 sh7372_add_device_to_domain(&sh7372_a4r, &tmu01_device); 1068 1048 } 1069 1049 1050 + static void __init sh7372_earlytimer_init(void) 1051 + { 1052 + sh7372_clock_init(); 1053 + shmobile_earlytimer_init(); 1054 + } 1055 + 1070 1056 void __init sh7372_add_early_devices(void) 1071 1057 { 1072 1058 early_platform_add_devices(sh7372_early_devices, 1073 1059 ARRAY_SIZE(sh7372_early_devices)); 1060 + 1061 + /* setup early console here as well */ 1062 + shmobile_setup_console(); 1063 + 1064 + /* override timer setup with soc-specific code */ 1065 + shmobile_timer.init = sh7372_earlytimer_init; 1074 1066 }
+32
arch/arm/mach-shmobile/setup-sh7377.c
··· 30 30 #include <linux/sh_intc.h> 31 31 #include <linux/sh_timer.h> 32 32 #include <mach/hardware.h> 33 + #include <mach/common.h> 34 + #include <asm/mach/map.h> 33 35 #include <asm/mach-types.h> 34 36 #include <asm/mach/arch.h> 37 + #include <asm/mach/time.h> 38 + 39 + static struct map_desc sh7377_io_desc[] __initdata = { 40 + /* create a 1:1 entity map for 0xe6xxxxxx 41 + * used by CPGA, INTC and PFC. 42 + */ 43 + { 44 + .virtual = 0xe6000000, 45 + .pfn = __phys_to_pfn(0xe6000000), 46 + .length = 256 << 20, 47 + .type = MT_DEVICE_NONSHARED 48 + }, 49 + }; 50 + 51 + void __init sh7377_map_io(void) 52 + { 53 + iotable_init(sh7377_io_desc, ARRAY_SIZE(sh7377_io_desc)); 54 + } 35 55 36 56 /* SCIFA0 */ 37 57 static struct plat_sci_port scif0_platform_data = { ··· 476 456 ARRAY_SIZE(sh7377_devices)); 477 457 } 478 458 459 + static void __init sh7377_earlytimer_init(void) 460 + { 461 + sh7377_clock_init(); 462 + shmobile_earlytimer_init(); 463 + } 464 + 479 465 #define SMSTPCR3 0xe615013c 480 466 #define SMSTPCR3_CMT1 (1 << 29) 481 467 ··· 492 466 493 467 early_platform_add_devices(sh7377_early_devices, 494 468 ARRAY_SIZE(sh7377_early_devices)); 469 + 470 + /* setup early console here as well */ 471 + shmobile_setup_console(); 472 + 473 + /* override timer setup with soc-specific code */ 474 + shmobile_timer.init = sh7377_earlytimer_init; 495 475 }
+32
arch/arm/mach-shmobile/setup-sh73a0.c
··· 32 32 #include <linux/sh_timer.h> 33 33 #include <mach/hardware.h> 34 34 #include <mach/sh73a0.h> 35 + #include <mach/common.h> 35 36 #include <asm/mach-types.h> 37 + #include <asm/mach/map.h> 36 38 #include <asm/mach/arch.h> 39 + #include <asm/mach/time.h> 40 + 41 + static struct map_desc sh73a0_io_desc[] __initdata = { 42 + /* create a 1:1 entity map for 0xe6xxxxxx 43 + * used by CPGA, INTC and PFC. 44 + */ 45 + { 46 + .virtual = 0xe6000000, 47 + .pfn = __phys_to_pfn(0xe6000000), 48 + .length = 256 << 20, 49 + .type = MT_DEVICE_NONSHARED 50 + }, 51 + }; 52 + 53 + void __init sh73a0_map_io(void) 54 + { 55 + iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc)); 56 + } 37 57 38 58 static struct plat_sci_port scif0_platform_data = { 39 59 .mapbase = 0xe6c40000, ··· 687 667 ARRAY_SIZE(sh73a0_late_devices)); 688 668 } 689 669 670 + static void __init sh73a0_earlytimer_init(void) 671 + { 672 + sh73a0_clock_init(); 673 + shmobile_earlytimer_init(); 674 + } 675 + 690 676 void __init sh73a0_add_early_devices(void) 691 677 { 692 678 early_platform_add_devices(sh73a0_early_devices, 693 679 ARRAY_SIZE(sh73a0_early_devices)); 680 + 681 + /* setup early console here as well */ 682 + shmobile_setup_console(); 683 + 684 + /* override timer setup with soc-specific code */ 685 + shmobile_timer.init = sh73a0_earlytimer_init; 694 686 }
+3 -5
arch/arm/mach-shmobile/smp-r8a7779.c
··· 64 64 static DEFINE_SPINLOCK(scu_lock); 65 65 static unsigned long tmp; 66 66 67 + static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); 68 + 67 69 static void modify_scu_cpu_psr(unsigned long set, unsigned long clr) 68 70 { 69 71 void __iomem *scu_base = scu_base_addr(); ··· 84 82 { 85 83 void __iomem *scu_base = scu_base_addr(); 86 84 87 - #ifdef CONFIG_HAVE_ARM_TWD 88 - /* twd_base needs to be initialized before percpu_timer_setup() */ 89 - twd_base = (void __iomem *)0xf0000600; 90 - #endif 91 - 85 + shmobile_twd_init(&twd_local_timer); 92 86 return scu_get_core_count(scu_base); 93 87 } 94 88
+3 -5
arch/arm/mach-shmobile/smp-sh73a0.c
··· 42 42 static DEFINE_SPINLOCK(scu_lock); 43 43 static unsigned long tmp; 44 44 45 + static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); 46 + 45 47 static void modify_scu_cpu_psr(unsigned long set, unsigned long clr) 46 48 { 47 49 void __iomem *scu_base = scu_base_addr(); ··· 62 60 { 63 61 void __iomem *scu_base = scu_base_addr(); 64 62 65 - #ifdef CONFIG_HAVE_ARM_TWD 66 - /* twd_base needs to be initialized before percpu_timer_setup() */ 67 - twd_base = (void __iomem *)0xf0000600; 68 - #endif 69 - 63 + shmobile_twd_init(&twd_local_timer); 70 64 return scu_get_core_count(scu_base); 71 65 } 72 66
+15 -1
arch/arm/mach-shmobile/timer.c
··· 20 20 */ 21 21 #include <linux/platform_device.h> 22 22 #include <asm/mach/time.h> 23 + #include <asm/smp_twd.h> 23 24 24 25 static void __init shmobile_late_time_init(void) 25 26 { ··· 37 36 early_platform_driver_probe("earlytimer", 2, 0); 38 37 } 39 38 40 - static void __init shmobile_timer_init(void) 39 + void __init shmobile_earlytimer_init(void) 41 40 { 42 41 late_time_init = shmobile_late_time_init; 42 + } 43 + 44 + static void __init shmobile_timer_init(void) 45 + { 46 + } 47 + 48 + void __init shmobile_twd_init(struct twd_local_timer *twd_local_timer) 49 + { 50 + #ifdef CONFIG_HAVE_ARM_TWD 51 + int err = twd_local_timer_register(twd_local_timer); 52 + if (err) 53 + pr_err("twd_local_timer_register failed %d\n", err); 54 + #endif 43 55 } 44 56 45 57 struct sys_timer shmobile_timer = {
+2 -2
arch/arm/mach-tegra/Kconfig
··· 10 10 select PINCTRL 11 11 select PINCTRL_TEGRA20 12 12 select USB_ARCH_HAS_EHCI if USB_SUPPORT 13 - select USB_ULPI if USB_SUPPORT 13 + select USB_ULPI if USB 14 14 select USB_ULPI_VIEWPORT if USB_SUPPORT 15 15 select ARM_ERRATA_720789 16 16 select ARM_ERRATA_742230 ··· 32 32 select PINCTRL 33 33 select PINCTRL_TEGRA30 34 34 select USB_ARCH_HAS_EHCI if USB_SUPPORT 35 - select USB_ULPI if USB_SUPPORT 35 + select USB_ULPI if USB 36 36 select USB_ULPI_VIEWPORT if USB_SUPPORT 37 37 select USE_OF 38 38 select ARM_ERRATA_743622
-1
arch/arm/mach-tegra/Makefile
··· 14 14 obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += pinmux-tegra30-tables.o 15 15 obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o 16 16 obj-$(CONFIG_SMP) += platsmp.o headsmp.o 17 - obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o 18 17 obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 19 18 obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o 20 19 obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o
+3 -3
arch/arm/mach-tegra/board-harmony-pinmux.c
··· 53 53 {TEGRA_PINGROUP_GME, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 54 54 {TEGRA_PINGROUP_GPU, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 55 55 {TEGRA_PINGROUP_GPU7, TEGRA_MUX_RTCK, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 56 - {TEGRA_PINGROUP_GPV, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 56 + {TEGRA_PINGROUP_GPV, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 57 57 {TEGRA_PINGROUP_HDINT, TEGRA_MUX_HDMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 58 58 {TEGRA_PINGROUP_I2CP, TEGRA_MUX_I2C, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 59 59 {TEGRA_PINGROUP_IRRX, TEGRA_MUX_UARTA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, ··· 112 112 {TEGRA_PINGROUP_SDC, TEGRA_MUX_PWM, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 113 113 {TEGRA_PINGROUP_SDD, TEGRA_MUX_PWM, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 114 114 {TEGRA_PINGROUP_SDIO1, TEGRA_MUX_SDIO1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 115 - {TEGRA_PINGROUP_SLXA, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 115 + {TEGRA_PINGROUP_SLXA, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 116 116 {TEGRA_PINGROUP_SLXC, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 117 117 {TEGRA_PINGROUP_SLXD, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 118 - {TEGRA_PINGROUP_SLXK, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 118 + {TEGRA_PINGROUP_SLXK, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 119 119 {TEGRA_PINGROUP_SPDI, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 120 120 {TEGRA_PINGROUP_SPDO, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 121 121 {TEGRA_PINGROUP_SPIA, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
-26
arch/arm/mach-tegra/localtimer.c
··· 1 - /* 2 - * arch/arm/mach-tegra/localtimer.c 3 - * 4 - * Copyright (C) 2002 ARM Ltd. 5 - * All Rights Reserved 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 - */ 11 - #include <linux/init.h> 12 - #include <linux/smp.h> 13 - #include <linux/clockchips.h> 14 - #include <asm/irq.h> 15 - #include <asm/smp_twd.h> 16 - #include <asm/localtimer.h> 17 - 18 - /* 19 - * Setup the local clock events for a CPU. 20 - */ 21 - int __cpuinit local_timer_setup(struct clock_event_device *evt) 22 - { 23 - evt->irq = IRQ_LOCALTIMER; 24 - twd_timer_setup(evt); 25 - return 0; 26 - }
+12 -4
arch/arm/mach-tegra/pcie.c
··· 585 585 afi_writel(0, AFI_MSI_BAR_SZ); 586 586 } 587 587 588 - static void tegra_pcie_enable_controller(void) 588 + static int tegra_pcie_enable_controller(void) 589 589 { 590 590 u32 val, reg; 591 - int i; 591 + int i, timeout; 592 592 593 593 /* Enable slot clock and pulse the reset signals */ 594 594 for (i = 0, reg = AFI_PEX0_CTRL; i < 2; i++, reg += 0x8) { ··· 639 639 pads_writel(0xfa5cfa5c, 0xc8); 640 640 641 641 /* Wait for the PLL to lock */ 642 + timeout = 300; 642 643 do { 643 644 val = pads_readl(PADS_PLL_CTL); 645 + usleep_range(1000, 1000); 646 + if (--timeout == 0) { 647 + pr_err("Tegra PCIe error: timeout waiting for PLL\n"); 648 + return -EBUSY; 649 + } 644 650 } while (!(val & PADS_PLL_CTL_LOCKDET)); 645 651 646 652 /* turn off IDDQ override */ ··· 677 671 /* Disable all execptions */ 678 672 afi_writel(0, AFI_FPCI_ERROR_MASKS); 679 673 680 - return; 674 + return 0; 681 675 } 682 676 683 677 static void tegra_pcie_xclk_clamp(bool clamp) ··· 927 921 if (err) 928 922 return err; 929 923 930 - tegra_pcie_enable_controller(); 924 + err = tegra_pcie_enable_controller(); 925 + if (err) 926 + return err; 931 927 932 928 /* setup the AFI address translations */ 933 929 tegra_pcie_setup_translations();
+17 -5
arch/arm/mach-tegra/timer.c
··· 28 28 #include <linux/io.h> 29 29 30 30 #include <asm/mach/time.h> 31 - #include <asm/localtimer.h> 31 + #include <asm/smp_twd.h> 32 32 #include <asm/sched_clock.h> 33 33 34 34 #include <mach/iomap.h> ··· 162 162 .irq = INT_TMR3, 163 163 }; 164 164 165 + #ifdef CONFIG_HAVE_ARM_TWD 166 + static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 167 + TEGRA_ARM_PERIF_BASE + 0x600, 168 + IRQ_LOCALTIMER); 169 + 170 + static void __init tegra_twd_init(void) 171 + { 172 + int err = twd_local_timer_register(&twd_local_timer); 173 + if (err) 174 + pr_err("twd_local_timer_register failed %d\n", err); 175 + } 176 + #else 177 + #define tegra_twd_init() do {} while(0) 178 + #endif 179 + 165 180 static void __init tegra_init_timer(void) 166 181 { 167 182 struct clk *clk; ··· 202 187 pr_warn("Unable to get rtc-tegra clock\n"); 203 188 else 204 189 clk_enable(clk); 205 - 206 - #ifdef CONFIG_HAVE_ARM_TWD 207 - twd_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x600); 208 - #endif 209 190 210 191 switch (rate) { 211 192 case 12000000: ··· 242 231 tegra_clockevent.cpumask = cpu_all_mask; 243 232 tegra_clockevent.irq = tegra_timer_irq.irq; 244 233 clockevents_register_device(&tegra_clockevent); 234 + tegra_twd_init(); 245 235 } 246 236 247 237 struct sys_timer tegra_timer = {
-1
arch/arm/mach-ux500/Makefile
··· 15 15 obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o 16 16 obj-$(CONFIG_SMP) += platsmp.o headsmp.o 17 17 obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 18 - obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o 19 18 obj-$(CONFIG_U5500_MODEM_IRQ) += modem-irq-db5500.o 20 19 obj-$(CONFIG_U5500_MBOX) += mbox-db5500.o 21 20
-1
arch/arm/mach-ux500/cpu.c
··· 14 14 15 15 #include <asm/hardware/gic.h> 16 16 #include <asm/mach/map.h> 17 - #include <asm/localtimer.h> 18 17 19 18 #include <mach/hardware.h> 20 19 #include <mach/setup.h>
-3
arch/arm/mach-ux500/include/mach/setup.h
··· 27 27 28 28 extern void __init db5500_dma_init(void); 29 29 30 - /* We re-use nomadik_timer for this platform */ 31 - extern void nmdk_timer_init(void); 32 - 33 30 struct amba_device; 34 31 extern void __init amba_add_devices(struct amba_device *devs[], int num); 35 32
-29
arch/arm/mach-ux500/localtimer.c
··· 1 - /* 2 - * Copyright (C) 2008-2009 ST-Ericsson 3 - * Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> 4 - * 5 - * This file is heavily based on relaview platform, almost a copy. 6 - * 7 - * Copyright (C) 2002 ARM Ltd. 8 - * 9 - * This program is free software; you can redistribute it and/or modify 10 - * it under the terms of the GNU General Public License version 2 as 11 - * published by the Free Software Foundation. 12 - */ 13 - #include <linux/init.h> 14 - #include <linux/smp.h> 15 - #include <linux/clockchips.h> 16 - 17 - #include <asm/irq.h> 18 - #include <asm/smp_twd.h> 19 - #include <asm/localtimer.h> 20 - 21 - /* 22 - * Setup the local clock events for a CPU. 23 - */ 24 - int __cpuinit local_timer_setup(struct clock_event_device *evt) 25 - { 26 - evt->irq = IRQ_LOCALTIMER; 27 - twd_timer_setup(evt); 28 - return 0; 29 - }
+29 -10
arch/arm/mach-ux500/timer.c
··· 8 8 #include <linux/errno.h> 9 9 #include <linux/clksrc-dbx500-prcmu.h> 10 10 11 - #include <asm/localtimer.h> 11 + #include <asm/smp_twd.h> 12 12 13 13 #include <plat/mtu.h> 14 14 15 15 #include <mach/setup.h> 16 16 #include <mach/hardware.h> 17 + #include <mach/irqs.h> 18 + 19 + #ifdef CONFIG_HAVE_ARM_TWD 20 + static DEFINE_TWD_LOCAL_TIMER(u5500_twd_local_timer, 21 + U5500_TWD_BASE, IRQ_LOCALTIMER); 22 + static DEFINE_TWD_LOCAL_TIMER(u8500_twd_local_timer, 23 + U8500_TWD_BASE, IRQ_LOCALTIMER); 24 + 25 + static void __init ux500_twd_init(void) 26 + { 27 + struct twd_local_timer *twd_local_timer; 28 + int err; 29 + 30 + twd_local_timer = cpu_is_u5500() ? &u5500_twd_local_timer : 31 + &u8500_twd_local_timer; 32 + 33 + err = twd_local_timer_register(twd_local_timer); 34 + if (err) 35 + pr_err("twd_local_timer_register failed %d\n", err); 36 + } 37 + #else 38 + #define ux500_twd_init() do { } while(0) 39 + #endif 17 40 18 41 static void __init ux500_timer_init(void) 19 42 { 43 + void __iomem *mtu_timer_base; 20 44 void __iomem *prcmu_timer_base; 21 45 22 46 if (cpu_is_u5500()) { 23 - #ifdef CONFIG_LOCAL_TIMERS 24 - twd_base = __io_address(U5500_TWD_BASE); 25 - #endif 26 - mtu_base = __io_address(U5500_MTU0_BASE); 47 + mtu_timer_base = __io_address(U5500_MTU0_BASE); 27 48 prcmu_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE); 28 49 } else if (cpu_is_u8500()) { 29 - #ifdef CONFIG_LOCAL_TIMERS 30 - twd_base = __io_address(U8500_TWD_BASE); 31 - #endif 32 - mtu_base = __io_address(U8500_MTU0_BASE); 50 + mtu_timer_base = __io_address(U8500_MTU0_BASE); 33 51 prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); 34 52 } else { 35 53 ux500_unknown_soc(); ··· 70 52 * 71 53 */ 72 54 73 - nmdk_timer_init(); 55 + nmdk_timer_init(mtu_timer_base); 74 56 clksrc_dbx500_prcmu_init(prcmu_timer_base); 57 + ux500_twd_init(); 75 58 } 76 59 77 60 static void ux500_timer_reset(void)
+5 -2
arch/arm/mach-vexpress/core.h
··· 1 - #define __MMIO_P2V(x) (((x) & 0xfffff) | (((x) & 0x0f000000) >> 4) | 0xf8000000) 2 - #define MMIO_P2V(x) ((void __iomem *)__MMIO_P2V(x)) 1 + /* 2MB large area for motherboard's peripherals static mapping */ 2 + #define V2M_PERIPH 0xf8000000 3 + 4 + /* Tile's peripherals static mappings should start here */ 5 + #define V2T_PERIPH 0xf8200000
+31 -40
arch/arm/mach-vexpress/ct-ca9x4.c
··· 30 30 31 31 #include <plat/clcd.h> 32 32 33 - #define V2M_PA_CS7 0x10000000 34 - 35 33 static struct map_desc ct_ca9x4_io_desc[] __initdata = { 36 34 { 37 - .virtual = __MMIO_P2V(CT_CA9X4_MPIC), 38 - .pfn = __phys_to_pfn(CT_CA9X4_MPIC), 39 - .length = SZ_16K, 40 - .type = MT_DEVICE, 41 - }, { 42 - .virtual = __MMIO_P2V(CT_CA9X4_SP804_TIMER), 43 - .pfn = __phys_to_pfn(CT_CA9X4_SP804_TIMER), 44 - .length = SZ_4K, 45 - .type = MT_DEVICE, 46 - }, { 47 - .virtual = __MMIO_P2V(CT_CA9X4_L2CC), 48 - .pfn = __phys_to_pfn(CT_CA9X4_L2CC), 49 - .length = SZ_4K, 50 - .type = MT_DEVICE, 35 + .virtual = V2T_PERIPH, 36 + .pfn = __phys_to_pfn(CT_CA9X4_MPIC), 37 + .length = SZ_8K, 38 + .type = MT_DEVICE, 51 39 }, 52 40 }; 53 41 54 42 static void __init ct_ca9x4_map_io(void) 55 43 { 56 - #ifdef CONFIG_LOCAL_TIMERS 57 - twd_base = MMIO_P2V(A9_MPCORE_TWD); 58 - #endif 59 44 iotable_init(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc)); 60 45 } 61 46 47 + #ifdef CONFIG_HAVE_ARM_TWD 48 + static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, A9_MPCORE_TWD, IRQ_LOCALTIMER); 49 + 50 + static void __init ca9x4_twd_init(void) 51 + { 52 + int err = twd_local_timer_register(&twd_local_timer); 53 + if (err) 54 + pr_err("twd_local_timer_register failed %d\n", err); 55 + } 56 + #else 57 + #define ca9x4_twd_init() do {} while(0) 58 + #endif 59 + 62 60 static void __init ct_ca9x4_init_irq(void) 63 61 { 64 - gic_init(0, 29, MMIO_P2V(A9_MPCORE_GIC_DIST), 65 - MMIO_P2V(A9_MPCORE_GIC_CPU)); 62 + gic_init(0, 29, ioremap(A9_MPCORE_GIC_DIST, SZ_4K), 63 + ioremap(A9_MPCORE_GIC_CPU, SZ_256)); 64 + ca9x4_twd_init(); 66 65 } 67 - 68 - #if 0 69 - static void __init ct_ca9x4_timer_init(void) 70 - { 71 - writel(0, MMIO_P2V(CT_CA9X4_TIMER0) + TIMER_CTRL); 72 - writel(0, MMIO_P2V(CT_CA9X4_TIMER1) + TIMER_CTRL); 73 - 74 - sp804_clocksource_init(MMIO_P2V(CT_CA9X4_TIMER1), "ct-timer1"); 75 - sp804_clockevents_init(MMIO_P2V(CT_CA9X4_TIMER0), IRQ_CT_CA9X4_TIMER0, 76 - "ct-timer0"); 77 - } 78 - 79 - static struct sys_timer ct_ca9x4_timer = { 80 - .init = ct_ca9x4_timer_init, 81 - }; 82 - #endif 83 66 84 67 static void ct_ca9x4_clcd_enable(struct clcd_fb *fb) 85 68 { ··· 184 201 int i; 185 202 186 203 #ifdef CONFIG_CACHE_L2X0 187 - void __iomem *l2x0_base = MMIO_P2V(CT_CA9X4_L2CC); 204 + void __iomem *l2x0_base = ioremap(CT_CA9X4_L2CC, SZ_4K); 188 205 189 206 /* set RAM latencies to 1 cycle for this core tile. */ 190 207 writel(0, l2x0_base + L2X0_TAG_LATENCY_CTRL); ··· 200 217 } 201 218 202 219 #ifdef CONFIG_SMP 220 + static void *ct_ca9x4_scu_base __initdata; 221 + 203 222 static void __init ct_ca9x4_init_cpu_map(void) 204 223 { 205 - int i, ncores = scu_get_core_count(MMIO_P2V(A9_MPCORE_SCU)); 224 + int i, ncores; 225 + 226 + ct_ca9x4_scu_base = ioremap(A9_MPCORE_SCU, SZ_128); 227 + if (WARN_ON(!ct_ca9x4_scu_base)) 228 + return; 229 + 230 + ncores = scu_get_core_count(ct_ca9x4_scu_base); 206 231 207 232 if (ncores > nr_cpu_ids) { 208 233 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n", ··· 226 235 227 236 static void __init ct_ca9x4_smp_enable(unsigned int max_cpus) 228 237 { 229 - scu_enable(MMIO_P2V(A9_MPCORE_SCU)); 238 + scu_enable(ct_ca9x4_scu_base); 230 239 } 231 240 #endif 232 241
-3
arch/arm/mach-vexpress/include/mach/ct-ca9x4.h
··· 22 22 #define CT_CA9X4_SYSWDT (0x1e007000) 23 23 #define CT_CA9X4_L2CC (0x1e00a000) 24 24 25 - #define CT_CA9X4_TIMER0 (CT_CA9X4_SP804_TIMER + 0x000) 26 - #define CT_CA9X4_TIMER1 (CT_CA9X4_SP804_TIMER + 0x020) 27 - 28 25 #define A9_MPCORE_SCU (CT_CA9X4_MPIC + 0x0000) 29 26 #define A9_MPCORE_GIC_CPU (CT_CA9X4_MPIC + 0x0100) 30 27 #define A9_MPCORE_GIT (CT_CA9X4_MPIC + 0x0200)
+25 -27
arch/arm/mach-vexpress/include/mach/motherboard.h
··· 39 39 #define V2M_CF (V2M_PA_CS7 + 0x0001a000) 40 40 #define V2M_CLCD (V2M_PA_CS7 + 0x0001f000) 41 41 42 - #define V2M_SYS_ID (V2M_SYSREGS + 0x000) 43 - #define V2M_SYS_SW (V2M_SYSREGS + 0x004) 44 - #define V2M_SYS_LED (V2M_SYSREGS + 0x008) 45 - #define V2M_SYS_100HZ (V2M_SYSREGS + 0x024) 46 - #define V2M_SYS_FLAGS (V2M_SYSREGS + 0x030) 47 - #define V2M_SYS_FLAGSSET (V2M_SYSREGS + 0x030) 48 - #define V2M_SYS_FLAGSCLR (V2M_SYSREGS + 0x034) 49 - #define V2M_SYS_NVFLAGS (V2M_SYSREGS + 0x038) 50 - #define V2M_SYS_NVFLAGSSET (V2M_SYSREGS + 0x038) 51 - #define V2M_SYS_NVFLAGSCLR (V2M_SYSREGS + 0x03c) 52 - #define V2M_SYS_MCI (V2M_SYSREGS + 0x048) 53 - #define V2M_SYS_FLASH (V2M_SYSREGS + 0x03c) 54 - #define V2M_SYS_CFGSW (V2M_SYSREGS + 0x058) 55 - #define V2M_SYS_24MHZ (V2M_SYSREGS + 0x05c) 56 - #define V2M_SYS_MISC (V2M_SYSREGS + 0x060) 57 - #define V2M_SYS_DMA (V2M_SYSREGS + 0x064) 58 - #define V2M_SYS_PROCID0 (V2M_SYSREGS + 0x084) 59 - #define V2M_SYS_PROCID1 (V2M_SYSREGS + 0x088) 60 - #define V2M_SYS_CFGDATA (V2M_SYSREGS + 0x0a0) 61 - #define V2M_SYS_CFGCTRL (V2M_SYSREGS + 0x0a4) 62 - #define V2M_SYS_CFGSTAT (V2M_SYSREGS + 0x0a8) 63 - 64 - #define V2M_TIMER0 (V2M_TIMER01 + 0x000) 65 - #define V2M_TIMER1 (V2M_TIMER01 + 0x020) 66 - 67 - #define V2M_TIMER2 (V2M_TIMER23 + 0x000) 68 - #define V2M_TIMER3 (V2M_TIMER23 + 0x020) 42 + /* 43 + * Offsets from SYSREGS base 44 + */ 45 + #define V2M_SYS_ID 0x000 46 + #define V2M_SYS_SW 0x004 47 + #define V2M_SYS_LED 0x008 48 + #define V2M_SYS_100HZ 0x024 49 + #define V2M_SYS_FLAGS 0x030 50 + #define V2M_SYS_FLAGSSET 0x030 51 + #define V2M_SYS_FLAGSCLR 0x034 52 + #define V2M_SYS_NVFLAGS 0x038 53 + #define V2M_SYS_NVFLAGSSET 0x038 54 + #define V2M_SYS_NVFLAGSCLR 0x03c 55 + #define V2M_SYS_MCI 0x048 56 + #define V2M_SYS_FLASH 0x03c 57 + #define V2M_SYS_CFGSW 0x058 58 + #define V2M_SYS_24MHZ 0x05c 59 + #define V2M_SYS_MISC 0x060 60 + #define V2M_SYS_DMA 0x064 61 + #define V2M_SYS_PROCID0 0x084 62 + #define V2M_SYS_PROCID1 0x088 63 + #define V2M_SYS_CFGDATA 0x0a0 64 + #define V2M_SYS_CFGCTRL 0x0a4 65 + #define V2M_SYS_CFGSTAT 0x0a8 69 66 70 67 71 68 /* ··· 114 117 115 118 int v2m_cfg_write(u32 devfn, u32 data); 116 119 int v2m_cfg_read(u32 devfn, u32 *data); 120 + void v2m_flags_set(u32 data); 117 121 118 122 /* 119 123 * Core tile IDs
+1 -4
arch/arm/mach-vexpress/platsmp.c
··· 14 14 #include <linux/io.h> 15 15 16 16 #include <mach/motherboard.h> 17 - #define V2M_PA_CS7 0x10000000 18 17 19 18 #include "core.h" 20 19 ··· 42 43 * until it receives a soft interrupt, and then the 43 44 * secondary CPU branches to this address. 44 45 */ 45 - writel(~0, MMIO_P2V(V2M_SYS_FLAGSCLR)); 46 - writel(virt_to_phys(versatile_secondary_startup), 47 - MMIO_P2V(V2M_SYS_FLAGSSET)); 46 + v2m_flags_set(virt_to_phys(versatile_secondary_startup)); 48 47 }
+46 -22
arch/arm/mach-vexpress/v2m.c
··· 40 40 41 41 static struct map_desc v2m_io_desc[] __initdata = { 42 42 { 43 - .virtual = __MMIO_P2V(V2M_PA_CS7), 43 + .virtual = V2M_PERIPH, 44 44 .pfn = __phys_to_pfn(V2M_PA_CS7), 45 45 .length = SZ_128K, 46 46 .type = MT_DEVICE, 47 47 }, 48 48 }; 49 49 50 - static void __init v2m_timer_init(void) 50 + static void __iomem *v2m_sysreg_base; 51 + 52 + static void __init v2m_sysctl_init(void __iomem *base) 51 53 { 52 54 u32 scctrl; 53 55 56 + if (WARN_ON(!base)) 57 + return; 58 + 54 59 /* Select 1MHz TIMCLK as the reference clock for SP804 timers */ 55 - scctrl = readl(MMIO_P2V(V2M_SYSCTL + SCCTRL)); 60 + scctrl = readl(base + SCCTRL); 56 61 scctrl |= SCCTRL_TIMEREN0SEL_TIMCLK; 57 62 scctrl |= SCCTRL_TIMEREN1SEL_TIMCLK; 58 - writel(scctrl, MMIO_P2V(V2M_SYSCTL + SCCTRL)); 63 + writel(scctrl, base + SCCTRL); 64 + } 59 65 60 - writel(0, MMIO_P2V(V2M_TIMER0) + TIMER_CTRL); 61 - writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL); 66 + static void __init v2m_sp804_init(void __iomem *base, unsigned int irq) 67 + { 68 + if (WARN_ON(!base || irq == NO_IRQ)) 69 + return; 62 70 63 - sp804_clocksource_init(MMIO_P2V(V2M_TIMER1), "v2m-timer1"); 64 - sp804_clockevents_init(MMIO_P2V(V2M_TIMER0), IRQ_V2M_TIMER0, 65 - "v2m-timer0"); 71 + writel(0, base + TIMER_1_BASE + TIMER_CTRL); 72 + writel(0, base + TIMER_2_BASE + TIMER_CTRL); 73 + 74 + sp804_clocksource_init(base + TIMER_2_BASE, "v2m-timer1"); 75 + sp804_clockevents_init(base + TIMER_1_BASE, irq, "v2m-timer0"); 76 + } 77 + 78 + static void __init v2m_timer_init(void) 79 + { 80 + v2m_sysctl_init(ioremap(V2M_SYSCTL, SZ_4K)); 81 + v2m_sp804_init(ioremap(V2M_TIMER01, SZ_4K), IRQ_V2M_TIMER0); 66 82 } 67 83 68 84 static struct sys_timer v2m_timer = { ··· 98 82 devfn |= SYS_CFG_START | SYS_CFG_WRITE; 99 83 100 84 spin_lock(&v2m_cfg_lock); 101 - val = readl(MMIO_P2V(V2M_SYS_CFGSTAT)); 102 - writel(val & ~SYS_CFG_COMPLETE, MMIO_P2V(V2M_SYS_CFGSTAT)); 85 + val = readl(v2m_sysreg_base + V2M_SYS_CFGSTAT); 86 + writel(val & ~SYS_CFG_COMPLETE, v2m_sysreg_base + V2M_SYS_CFGSTAT); 103 87 104 - writel(data, MMIO_P2V(V2M_SYS_CFGDATA)); 105 - writel(devfn, MMIO_P2V(V2M_SYS_CFGCTRL)); 88 + writel(data, v2m_sysreg_base + V2M_SYS_CFGDATA); 89 + writel(devfn, v2m_sysreg_base + V2M_SYS_CFGCTRL); 106 90 107 91 do { 108 - val = readl(MMIO_P2V(V2M_SYS_CFGSTAT)); 92 + val = readl(v2m_sysreg_base + V2M_SYS_CFGSTAT); 109 93 } while (val == 0); 110 94 spin_unlock(&v2m_cfg_lock); 111 95 ··· 119 103 devfn |= SYS_CFG_START; 120 104 121 105 spin_lock(&v2m_cfg_lock); 122 - writel(0, MMIO_P2V(V2M_SYS_CFGSTAT)); 123 - writel(devfn, MMIO_P2V(V2M_SYS_CFGCTRL)); 106 + writel(0, v2m_sysreg_base + V2M_SYS_CFGSTAT); 107 + writel(devfn, v2m_sysreg_base + V2M_SYS_CFGCTRL); 124 108 125 109 mb(); 126 110 127 111 do { 128 112 cpu_relax(); 129 - val = readl(MMIO_P2V(V2M_SYS_CFGSTAT)); 113 + val = readl(v2m_sysreg_base + V2M_SYS_CFGSTAT); 130 114 } while (val == 0); 131 115 132 - *data = readl(MMIO_P2V(V2M_SYS_CFGDATA)); 116 + *data = readl(v2m_sysreg_base + V2M_SYS_CFGDATA); 133 117 spin_unlock(&v2m_cfg_lock); 134 118 135 119 return !!(val & SYS_CFG_ERR); 120 + } 121 + 122 + void __init v2m_flags_set(u32 data) 123 + { 124 + writel(~0, v2m_sysreg_base + V2M_SYS_FLAGSCLR); 125 + writel(data, v2m_sysreg_base + V2M_SYS_FLAGSSET); 136 126 } 137 127 138 128 ··· 226 204 227 205 static void v2m_flash_set_vpp(struct platform_device *pdev, int on) 228 206 { 229 - writel(on != 0, MMIO_P2V(V2M_SYS_FLASH)); 207 + writel(on != 0, v2m_sysreg_base + V2M_SYS_FLASH); 230 208 } 231 209 232 210 static struct physmap_flash_data v2m_flash_data = { ··· 280 258 281 259 static unsigned int v2m_mmci_status(struct device *dev) 282 260 { 283 - return readl(MMIO_P2V(V2M_SYS_MCI)) & (1 << 0); 261 + return readl(v2m_sysreg_base + V2M_SYS_MCI) & (1 << 0); 284 262 } 285 263 286 264 static struct mmci_platform_data v2m_mmci_data = { ··· 393 371 { 394 372 ct_desc->init_early(); 395 373 clkdev_add_table(v2m_lookups, ARRAY_SIZE(v2m_lookups)); 396 - versatile_sched_clock_init(MMIO_P2V(V2M_SYS_24MHZ), 24000000); 374 + versatile_sched_clock_init(v2m_sysreg_base + V2M_SYS_24MHZ, 24000000); 397 375 } 398 376 399 377 static void v2m_power_off(void) ··· 422 400 u32 current_tile_id; 423 401 424 402 ct_desc = NULL; 425 - current_tile_id = readl(MMIO_P2V(V2M_SYS_PROCID0)) & V2M_CT_ID_MASK; 403 + current_tile_id = readl(v2m_sysreg_base + V2M_SYS_PROCID0) 404 + & V2M_CT_ID_MASK; 426 405 427 406 for (i = 0; i < ARRAY_SIZE(ct_descs) && !ct_desc; ++i) 428 407 if (ct_descs[i]->id == current_tile_id) ··· 437 414 static void __init v2m_map_io(void) 438 415 { 439 416 iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc)); 417 + v2m_sysreg_base = ioremap(V2M_SYSREGS, SZ_4K); 440 418 v2m_populate_ct_desc(); 441 419 ct_desc->map_io(); 442 420 }
+1 -3
arch/arm/plat-nomadik/include/plat/mtu.h
··· 1 1 #ifndef __PLAT_MTU_H 2 2 #define __PLAT_MTU_H 3 3 4 - /* should be set by the platform code */ 5 - extern void __iomem *mtu_base; 6 - 4 + void nmdk_timer_init(void __iomem *base); 7 5 void nmdk_clkevt_reset(void); 8 6 void nmdk_clksrc_reset(void); 9 7
+8 -25
arch/arm/plat-nomadik/timer.c
··· 21 21 #include <asm/sched_clock.h> 22 22 23 23 /* 24 - * Guaranteed runtime conversion range in seconds for 25 - * the clocksource and clockevent. 26 - */ 27 - #define MTU_MIN_RANGE 4 28 - 29 - /* 30 24 * The MTU device hosts four different counters, with 4 set of 31 25 * registers. These are register names. 32 26 */ ··· 60 66 #define MTU_PCELL2 0xff8 61 67 #define MTU_PCELL3 0xffC 62 68 69 + static void __iomem *mtu_base; 63 70 static bool clkevt_periodic; 64 71 static u32 clk_prescale; 65 72 static u32 nmdk_cycle; /* write-once */ 66 - 67 - void __iomem *mtu_base; /* Assigned by machine code */ 68 73 69 74 #ifdef CONFIG_NOMADIK_MTU_SCHED_CLOCK 70 75 /* ··· 96 103 void nmdk_clkevt_reset(void) 97 104 { 98 105 if (clkevt_periodic) { 99 - 100 106 /* Timer: configure load and background-load, and fire it up */ 101 107 writel(nmdk_cycle, mtu_base + MTU_LR(1)); 102 108 writel(nmdk_cycle, mtu_base + MTU_BGLR(1)); ··· 113 121 static void nmdk_clkevt_mode(enum clock_event_mode mode, 114 122 struct clock_event_device *dev) 115 123 { 116 - 117 124 switch (mode) { 118 125 case CLOCK_EVT_MODE_PERIODIC: 119 126 clkevt_periodic = true; ··· 174 183 mtu_base + MTU_CR(0)); 175 184 } 176 185 177 - void __init nmdk_timer_init(void) 186 + void __init nmdk_timer_init(void __iomem *base) 178 187 { 179 188 unsigned long rate; 180 189 struct clk *clk0; 181 190 191 + mtu_base = base; 182 192 clk0 = clk_get_sys("mtu0", NULL); 183 193 BUG_ON(IS_ERR(clk0)); 184 - 185 - clk_enable(clk0); 194 + BUG_ON(clk_prepare(clk0) < 0); 195 + BUG_ON(clk_enable(clk0) < 0); 186 196 187 197 /* 188 198 * Tick rate is 2.4MHz for Nomadik and 2.4Mhz, 100MHz or 133 MHz ··· 216 224 setup_sched_clock(nomadik_read_sched_clock, 32, rate); 217 225 #endif 218 226 219 - /* Timer 1 is used for events */ 220 - 221 - clockevents_calc_mult_shift(&nmdk_clkevt, rate, MTU_MIN_RANGE); 222 - 223 - nmdk_clkevt.max_delta_ns = 224 - clockevent_delta2ns(0xffffffff, &nmdk_clkevt); 225 - nmdk_clkevt.min_delta_ns = 226 - clockevent_delta2ns(0x00000002, &nmdk_clkevt); 227 - nmdk_clkevt.cpumask = cpumask_of(0); 228 - 229 - /* Register irq and clockevents */ 227 + /* Timer 1 is used for events, register irq and clockevents */ 230 228 setup_irq(IRQ_MTU0, &nmdk_timer_irq); 231 - clockevents_register_device(&nmdk_clkevt); 229 + nmdk_clkevt.cpumask = cpumask_of(0); 230 + clockevents_config_and_register(&nmdk_clkevt, rate, 2, 0xffffffffU); 232 231 }
-1
arch/arm/plat-versatile/Makefile
··· 1 1 obj-y := clock.o 2 - obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o 3 2 obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o 4 3 obj-$(CONFIG_PLAT_VERSATILE_FPGA_IRQ) += fpga-irq.o 5 4 obj-$(CONFIG_PLAT_VERSATILE_LEDS) += leds.o
-27
arch/arm/plat-versatile/localtimer.c
··· 1 - /* 2 - * linux/arch/arm/plat-versatile/localtimer.c 3 - * 4 - * Copyright (C) 2002 ARM Ltd. 5 - * All Rights Reserved 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 - */ 11 - #include <linux/init.h> 12 - #include <linux/smp.h> 13 - #include <linux/clockchips.h> 14 - 15 - #include <asm/smp_twd.h> 16 - #include <asm/localtimer.h> 17 - #include <mach/irqs.h> 18 - 19 - /* 20 - * Setup the local clock events for a CPU. 21 - */ 22 - int __cpuinit local_timer_setup(struct clock_event_device *evt) 23 - { 24 - evt->irq = IRQ_LOCALTIMER; 25 - twd_timer_setup(evt); 26 - return 0; 27 - }
+1 -1
arch/sh/boards/mach-highlander/setup.c
··· 322 322 __raw_writew(__raw_readw(PA_IVDRCTL) & ~(1 << IVDR_CK_ON), PA_IVDRCTL); 323 323 } 324 324 325 - static struct clk_ops ivdr_clk_ops = { 325 + static struct sh_clk_ops ivdr_clk_ops = { 326 326 .enable = ivdr_clk_enable, 327 327 .disable = ivdr_clk_disable, 328 328 };
+1 -1
arch/sh/boards/mach-sdk7786/setup.c
··· 167 167 fpga_write_reg(fpga_read_reg(PCIECR) & ~PCIECR_CLKEN, PCIECR); 168 168 } 169 169 170 - static struct clk_ops sdk7786_pcie_clk_ops = { 170 + static struct sh_clk_ops sdk7786_pcie_clk_ops = { 171 171 .enable = sdk7786_pcie_clk_enable, 172 172 .disable = sdk7786_pcie_clk_disable, 173 173 };
+1 -1
arch/sh/include/asm/clock.h
··· 4 4 #include <linux/sh_clk.h> 5 5 6 6 /* Should be defined by processor-specific code */ 7 - void __deprecated arch_init_clk_ops(struct clk_ops **, int type); 7 + void __deprecated arch_init_clk_ops(struct sh_clk_ops **, int type); 8 8 int __init arch_clk_init(void); 9 9 10 10 /* arch/sh/kernel/cpu/clock-cpg.c */
+6 -6
arch/sh/kernel/cpu/sh2/clock-sh7619.c
··· 28 28 clk->rate *= pll2_mult * pll1rate[(__raw_readw(FREQCR) >> 8) & 7]; 29 29 } 30 30 31 - static struct clk_ops sh7619_master_clk_ops = { 31 + static struct sh_clk_ops sh7619_master_clk_ops = { 32 32 .init = master_clk_init, 33 33 }; 34 34 ··· 38 38 return clk->parent->rate / pfc_divisors[idx]; 39 39 } 40 40 41 - static struct clk_ops sh7619_module_clk_ops = { 41 + static struct sh_clk_ops sh7619_module_clk_ops = { 42 42 .recalc = module_clk_recalc, 43 43 }; 44 44 ··· 47 47 return clk->parent->rate / pll1rate[(__raw_readw(FREQCR) >> 8) & 7]; 48 48 } 49 49 50 - static struct clk_ops sh7619_bus_clk_ops = { 50 + static struct sh_clk_ops sh7619_bus_clk_ops = { 51 51 .recalc = bus_clk_recalc, 52 52 }; 53 53 54 - static struct clk_ops sh7619_cpu_clk_ops = { 54 + static struct sh_clk_ops sh7619_cpu_clk_ops = { 55 55 .recalc = followparent_recalc, 56 56 }; 57 57 58 - static struct clk_ops *sh7619_clk_ops[] = { 58 + static struct sh_clk_ops *sh7619_clk_ops[] = { 59 59 &sh7619_master_clk_ops, 60 60 &sh7619_module_clk_ops, 61 61 &sh7619_bus_clk_ops, 62 62 &sh7619_cpu_clk_ops, 63 63 }; 64 64 65 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 65 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 66 66 { 67 67 if (test_mode_pin(MODE_PIN2 | MODE_PIN0) || 68 68 test_mode_pin(MODE_PIN2 | MODE_PIN1))
+6 -6
arch/sh/kernel/cpu/sh2a/clock-sh7201.c
··· 30 30 pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007]; 31 31 } 32 32 33 - static struct clk_ops sh7201_master_clk_ops = { 33 + static struct sh_clk_ops sh7201_master_clk_ops = { 34 34 .init = master_clk_init, 35 35 }; 36 36 ··· 40 40 return clk->parent->rate / pfc_divisors[idx]; 41 41 } 42 42 43 - static struct clk_ops sh7201_module_clk_ops = { 43 + static struct sh_clk_ops sh7201_module_clk_ops = { 44 44 .recalc = module_clk_recalc, 45 45 }; 46 46 ··· 50 50 return clk->parent->rate / pfc_divisors[idx]; 51 51 } 52 52 53 - static struct clk_ops sh7201_bus_clk_ops = { 53 + static struct sh_clk_ops sh7201_bus_clk_ops = { 54 54 .recalc = bus_clk_recalc, 55 55 }; 56 56 ··· 60 60 return clk->parent->rate / ifc_divisors[idx]; 61 61 } 62 62 63 - static struct clk_ops sh7201_cpu_clk_ops = { 63 + static struct sh_clk_ops sh7201_cpu_clk_ops = { 64 64 .recalc = cpu_clk_recalc, 65 65 }; 66 66 67 - static struct clk_ops *sh7201_clk_ops[] = { 67 + static struct sh_clk_ops *sh7201_clk_ops[] = { 68 68 &sh7201_master_clk_ops, 69 69 &sh7201_module_clk_ops, 70 70 &sh7201_bus_clk_ops, 71 71 &sh7201_cpu_clk_ops, 72 72 }; 73 73 74 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 74 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 75 75 { 76 76 if (test_mode_pin(MODE_PIN1 | MODE_PIN0)) 77 77 pll2_mult = 1;
+6 -6
arch/sh/kernel/cpu/sh2a/clock-sh7203.c
··· 32 32 clk->rate *= pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0003] * pll2_mult; 33 33 } 34 34 35 - static struct clk_ops sh7203_master_clk_ops = { 35 + static struct sh_clk_ops sh7203_master_clk_ops = { 36 36 .init = master_clk_init, 37 37 }; 38 38 ··· 42 42 return clk->parent->rate / pfc_divisors[idx]; 43 43 } 44 44 45 - static struct clk_ops sh7203_module_clk_ops = { 45 + static struct sh_clk_ops sh7203_module_clk_ops = { 46 46 .recalc = module_clk_recalc, 47 47 }; 48 48 ··· 52 52 return clk->parent->rate / pfc_divisors[idx-2]; 53 53 } 54 54 55 - static struct clk_ops sh7203_bus_clk_ops = { 55 + static struct sh_clk_ops sh7203_bus_clk_ops = { 56 56 .recalc = bus_clk_recalc, 57 57 }; 58 58 59 - static struct clk_ops sh7203_cpu_clk_ops = { 59 + static struct sh_clk_ops sh7203_cpu_clk_ops = { 60 60 .recalc = followparent_recalc, 61 61 }; 62 62 63 - static struct clk_ops *sh7203_clk_ops[] = { 63 + static struct sh_clk_ops *sh7203_clk_ops[] = { 64 64 &sh7203_master_clk_ops, 65 65 &sh7203_module_clk_ops, 66 66 &sh7203_bus_clk_ops, 67 67 &sh7203_cpu_clk_ops, 68 68 }; 69 69 70 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 70 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 71 71 { 72 72 if (test_mode_pin(MODE_PIN1)) 73 73 pll2_mult = 4;
+6 -6
arch/sh/kernel/cpu/sh2a/clock-sh7206.c
··· 29 29 clk->rate *= pll2_mult * pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007]; 30 30 } 31 31 32 - static struct clk_ops sh7206_master_clk_ops = { 32 + static struct sh_clk_ops sh7206_master_clk_ops = { 33 33 .init = master_clk_init, 34 34 }; 35 35 ··· 39 39 return clk->parent->rate / pfc_divisors[idx]; 40 40 } 41 41 42 - static struct clk_ops sh7206_module_clk_ops = { 42 + static struct sh_clk_ops sh7206_module_clk_ops = { 43 43 .recalc = module_clk_recalc, 44 44 }; 45 45 ··· 48 48 return clk->parent->rate / pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007]; 49 49 } 50 50 51 - static struct clk_ops sh7206_bus_clk_ops = { 51 + static struct sh_clk_ops sh7206_bus_clk_ops = { 52 52 .recalc = bus_clk_recalc, 53 53 }; 54 54 ··· 58 58 return clk->parent->rate / ifc_divisors[idx]; 59 59 } 60 60 61 - static struct clk_ops sh7206_cpu_clk_ops = { 61 + static struct sh_clk_ops sh7206_cpu_clk_ops = { 62 62 .recalc = cpu_clk_recalc, 63 63 }; 64 64 65 - static struct clk_ops *sh7206_clk_ops[] = { 65 + static struct sh_clk_ops *sh7206_clk_ops[] = { 66 66 &sh7206_master_clk_ops, 67 67 &sh7206_module_clk_ops, 68 68 &sh7206_bus_clk_ops, 69 69 &sh7206_cpu_clk_ops, 70 70 }; 71 71 72 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 72 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 73 73 { 74 74 if (test_mode_pin(MODE_PIN2 | MODE_PIN1 | MODE_PIN0)) 75 75 pll2_mult = 1;
+6 -6
arch/sh/kernel/cpu/sh3/clock-sh3.c
··· 34 34 clk->rate *= pfc_divisors[idx]; 35 35 } 36 36 37 - static struct clk_ops sh3_master_clk_ops = { 37 + static struct sh_clk_ops sh3_master_clk_ops = { 38 38 .init = master_clk_init, 39 39 }; 40 40 ··· 46 46 return clk->parent->rate / pfc_divisors[idx]; 47 47 } 48 48 49 - static struct clk_ops sh3_module_clk_ops = { 49 + static struct sh_clk_ops sh3_module_clk_ops = { 50 50 .recalc = module_clk_recalc, 51 51 }; 52 52 ··· 58 58 return clk->parent->rate / stc_multipliers[idx]; 59 59 } 60 60 61 - static struct clk_ops sh3_bus_clk_ops = { 61 + static struct sh_clk_ops sh3_bus_clk_ops = { 62 62 .recalc = bus_clk_recalc, 63 63 }; 64 64 ··· 70 70 return clk->parent->rate / ifc_divisors[idx]; 71 71 } 72 72 73 - static struct clk_ops sh3_cpu_clk_ops = { 73 + static struct sh_clk_ops sh3_cpu_clk_ops = { 74 74 .recalc = cpu_clk_recalc, 75 75 }; 76 76 77 - static struct clk_ops *sh3_clk_ops[] = { 77 + static struct sh_clk_ops *sh3_clk_ops[] = { 78 78 &sh3_master_clk_ops, 79 79 &sh3_module_clk_ops, 80 80 &sh3_bus_clk_ops, 81 81 &sh3_cpu_clk_ops, 82 82 }; 83 83 84 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 84 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 85 85 { 86 86 if (idx < ARRAY_SIZE(sh3_clk_ops)) 87 87 *ops = sh3_clk_ops[idx];
+6 -6
arch/sh/kernel/cpu/sh3/clock-sh7705.c
··· 35 35 clk->rate *= pfc_divisors[__raw_readw(FRQCR) & 0x0003]; 36 36 } 37 37 38 - static struct clk_ops sh7705_master_clk_ops = { 38 + static struct sh_clk_ops sh7705_master_clk_ops = { 39 39 .init = master_clk_init, 40 40 }; 41 41 ··· 45 45 return clk->parent->rate / pfc_divisors[idx]; 46 46 } 47 47 48 - static struct clk_ops sh7705_module_clk_ops = { 48 + static struct sh_clk_ops sh7705_module_clk_ops = { 49 49 .recalc = module_clk_recalc, 50 50 }; 51 51 ··· 55 55 return clk->parent->rate / stc_multipliers[idx]; 56 56 } 57 57 58 - static struct clk_ops sh7705_bus_clk_ops = { 58 + static struct sh_clk_ops sh7705_bus_clk_ops = { 59 59 .recalc = bus_clk_recalc, 60 60 }; 61 61 ··· 65 65 return clk->parent->rate / ifc_divisors[idx]; 66 66 } 67 67 68 - static struct clk_ops sh7705_cpu_clk_ops = { 68 + static struct sh_clk_ops sh7705_cpu_clk_ops = { 69 69 .recalc = cpu_clk_recalc, 70 70 }; 71 71 72 - static struct clk_ops *sh7705_clk_ops[] = { 72 + static struct sh_clk_ops *sh7705_clk_ops[] = { 73 73 &sh7705_master_clk_ops, 74 74 &sh7705_module_clk_ops, 75 75 &sh7705_bus_clk_ops, 76 76 &sh7705_cpu_clk_ops, 77 77 }; 78 78 79 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 79 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 80 80 { 81 81 if (idx < ARRAY_SIZE(sh7705_clk_ops)) 82 82 *ops = sh7705_clk_ops[idx];
+6 -6
arch/sh/kernel/cpu/sh3/clock-sh7706.c
··· 30 30 clk->rate *= pfc_divisors[idx]; 31 31 } 32 32 33 - static struct clk_ops sh7706_master_clk_ops = { 33 + static struct sh_clk_ops sh7706_master_clk_ops = { 34 34 .init = master_clk_init, 35 35 }; 36 36 ··· 42 42 return clk->parent->rate / pfc_divisors[idx]; 43 43 } 44 44 45 - static struct clk_ops sh7706_module_clk_ops = { 45 + static struct sh_clk_ops sh7706_module_clk_ops = { 46 46 .recalc = module_clk_recalc, 47 47 }; 48 48 ··· 54 54 return clk->parent->rate / stc_multipliers[idx]; 55 55 } 56 56 57 - static struct clk_ops sh7706_bus_clk_ops = { 57 + static struct sh_clk_ops sh7706_bus_clk_ops = { 58 58 .recalc = bus_clk_recalc, 59 59 }; 60 60 ··· 66 66 return clk->parent->rate / ifc_divisors[idx]; 67 67 } 68 68 69 - static struct clk_ops sh7706_cpu_clk_ops = { 69 + static struct sh_clk_ops sh7706_cpu_clk_ops = { 70 70 .recalc = cpu_clk_recalc, 71 71 }; 72 72 73 - static struct clk_ops *sh7706_clk_ops[] = { 73 + static struct sh_clk_ops *sh7706_clk_ops[] = { 74 74 &sh7706_master_clk_ops, 75 75 &sh7706_module_clk_ops, 76 76 &sh7706_bus_clk_ops, 77 77 &sh7706_cpu_clk_ops, 78 78 }; 79 79 80 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 80 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 81 81 { 82 82 if (idx < ARRAY_SIZE(sh7706_clk_ops)) 83 83 *ops = sh7706_clk_ops[idx];
+6 -6
arch/sh/kernel/cpu/sh3/clock-sh7709.c
··· 30 30 clk->rate *= pfc_divisors[idx]; 31 31 } 32 32 33 - static struct clk_ops sh7709_master_clk_ops = { 33 + static struct sh_clk_ops sh7709_master_clk_ops = { 34 34 .init = master_clk_init, 35 35 }; 36 36 ··· 42 42 return clk->parent->rate / pfc_divisors[idx]; 43 43 } 44 44 45 - static struct clk_ops sh7709_module_clk_ops = { 45 + static struct sh_clk_ops sh7709_module_clk_ops = { 46 46 .recalc = module_clk_recalc, 47 47 }; 48 48 ··· 55 55 return clk->parent->rate * stc_multipliers[idx]; 56 56 } 57 57 58 - static struct clk_ops sh7709_bus_clk_ops = { 58 + static struct sh_clk_ops sh7709_bus_clk_ops = { 59 59 .recalc = bus_clk_recalc, 60 60 }; 61 61 ··· 67 67 return clk->parent->rate / ifc_divisors[idx]; 68 68 } 69 69 70 - static struct clk_ops sh7709_cpu_clk_ops = { 70 + static struct sh_clk_ops sh7709_cpu_clk_ops = { 71 71 .recalc = cpu_clk_recalc, 72 72 }; 73 73 74 - static struct clk_ops *sh7709_clk_ops[] = { 74 + static struct sh_clk_ops *sh7709_clk_ops[] = { 75 75 &sh7709_master_clk_ops, 76 76 &sh7709_module_clk_ops, 77 77 &sh7709_bus_clk_ops, 78 78 &sh7709_cpu_clk_ops, 79 79 }; 80 80 81 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 81 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 82 82 { 83 83 if (idx < ARRAY_SIZE(sh7709_clk_ops)) 84 84 *ops = sh7709_clk_ops[idx];
+6 -6
arch/sh/kernel/cpu/sh3/clock-sh7710.c
··· 29 29 clk->rate *= md_table[__raw_readw(FRQCR) & 0x0007]; 30 30 } 31 31 32 - static struct clk_ops sh7710_master_clk_ops = { 32 + static struct sh_clk_ops sh7710_master_clk_ops = { 33 33 .init = master_clk_init, 34 34 }; 35 35 ··· 39 39 return clk->parent->rate / md_table[idx]; 40 40 } 41 41 42 - static struct clk_ops sh7710_module_clk_ops = { 42 + static struct sh_clk_ops sh7710_module_clk_ops = { 43 43 .recalc = module_clk_recalc, 44 44 }; 45 45 ··· 49 49 return clk->parent->rate / md_table[idx]; 50 50 } 51 51 52 - static struct clk_ops sh7710_bus_clk_ops = { 52 + static struct sh_clk_ops sh7710_bus_clk_ops = { 53 53 .recalc = bus_clk_recalc, 54 54 }; 55 55 ··· 59 59 return clk->parent->rate / md_table[idx]; 60 60 } 61 61 62 - static struct clk_ops sh7710_cpu_clk_ops = { 62 + static struct sh_clk_ops sh7710_cpu_clk_ops = { 63 63 .recalc = cpu_clk_recalc, 64 64 }; 65 65 66 - static struct clk_ops *sh7710_clk_ops[] = { 66 + static struct sh_clk_ops *sh7710_clk_ops[] = { 67 67 &sh7710_master_clk_ops, 68 68 &sh7710_module_clk_ops, 69 69 &sh7710_bus_clk_ops, 70 70 &sh7710_cpu_clk_ops, 71 71 }; 72 72 73 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 73 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 74 74 { 75 75 if (idx < ARRAY_SIZE(sh7710_clk_ops)) 76 76 *ops = sh7710_clk_ops[idx];
+5 -5
arch/sh/kernel/cpu/sh3/clock-sh7712.c
··· 29 29 clk->rate *= multipliers[idx]; 30 30 } 31 31 32 - static struct clk_ops sh7712_master_clk_ops = { 32 + static struct sh_clk_ops sh7712_master_clk_ops = { 33 33 .init = master_clk_init, 34 34 }; 35 35 ··· 41 41 return clk->parent->rate / divisors[idx]; 42 42 } 43 43 44 - static struct clk_ops sh7712_module_clk_ops = { 44 + static struct sh_clk_ops sh7712_module_clk_ops = { 45 45 .recalc = module_clk_recalc, 46 46 }; 47 47 ··· 53 53 return clk->parent->rate / divisors[idx]; 54 54 } 55 55 56 - static struct clk_ops sh7712_cpu_clk_ops = { 56 + static struct sh_clk_ops sh7712_cpu_clk_ops = { 57 57 .recalc = cpu_clk_recalc, 58 58 }; 59 59 60 - static struct clk_ops *sh7712_clk_ops[] = { 60 + static struct sh_clk_ops *sh7712_clk_ops[] = { 61 61 &sh7712_master_clk_ops, 62 62 &sh7712_module_clk_ops, 63 63 &sh7712_cpu_clk_ops, 64 64 }; 65 65 66 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 66 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 67 67 { 68 68 if (idx < ARRAY_SIZE(sh7712_clk_ops)) 69 69 *ops = sh7712_clk_ops[idx];
+3 -3
arch/sh/kernel/cpu/sh4/clock-sh4-202.c
··· 41 41 return 5; 42 42 } 43 43 44 - static struct clk_ops sh4202_emi_clk_ops = { 44 + static struct sh_clk_ops sh4202_emi_clk_ops = { 45 45 .recalc = emi_clk_recalc, 46 46 }; 47 47 ··· 56 56 return clk->parent->rate / frqcr3_divisors[idx]; 57 57 } 58 58 59 - static struct clk_ops sh4202_femi_clk_ops = { 59 + static struct sh_clk_ops sh4202_femi_clk_ops = { 60 60 .recalc = femi_clk_recalc, 61 61 }; 62 62 ··· 130 130 return 0; 131 131 } 132 132 133 - static struct clk_ops sh4202_shoc_clk_ops = { 133 + static struct sh_clk_ops sh4202_shoc_clk_ops = { 134 134 .init = shoc_clk_init, 135 135 .recalc = shoc_clk_recalc, 136 136 .set_rate = shoc_clk_set_rate,
+6 -6
arch/sh/kernel/cpu/sh4/clock-sh4.c
··· 31 31 clk->rate *= pfc_divisors[__raw_readw(FRQCR) & 0x0007]; 32 32 } 33 33 34 - static struct clk_ops sh4_master_clk_ops = { 34 + static struct sh_clk_ops sh4_master_clk_ops = { 35 35 .init = master_clk_init, 36 36 }; 37 37 ··· 41 41 return clk->parent->rate / pfc_divisors[idx]; 42 42 } 43 43 44 - static struct clk_ops sh4_module_clk_ops = { 44 + static struct sh_clk_ops sh4_module_clk_ops = { 45 45 .recalc = module_clk_recalc, 46 46 }; 47 47 ··· 51 51 return clk->parent->rate / bfc_divisors[idx]; 52 52 } 53 53 54 - static struct clk_ops sh4_bus_clk_ops = { 54 + static struct sh_clk_ops sh4_bus_clk_ops = { 55 55 .recalc = bus_clk_recalc, 56 56 }; 57 57 ··· 61 61 return clk->parent->rate / ifc_divisors[idx]; 62 62 } 63 63 64 - static struct clk_ops sh4_cpu_clk_ops = { 64 + static struct sh_clk_ops sh4_cpu_clk_ops = { 65 65 .recalc = cpu_clk_recalc, 66 66 }; 67 67 68 - static struct clk_ops *sh4_clk_ops[] = { 68 + static struct sh_clk_ops *sh4_clk_ops[] = { 69 69 &sh4_master_clk_ops, 70 70 &sh4_module_clk_ops, 71 71 &sh4_bus_clk_ops, 72 72 &sh4_cpu_clk_ops, 73 73 }; 74 74 75 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 75 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 76 76 { 77 77 if (idx < ARRAY_SIZE(sh4_clk_ops)) 78 78 *ops = sh4_clk_ops[idx];
+2 -2
arch/sh/kernel/cpu/sh4a/clock-sh7343.c
··· 61 61 return clk->parent->rate * mult; 62 62 } 63 63 64 - static struct clk_ops dll_clk_ops = { 64 + static struct sh_clk_ops dll_clk_ops = { 65 65 .recalc = dll_recalc, 66 66 }; 67 67 ··· 81 81 return clk->parent->rate * mult; 82 82 } 83 83 84 - static struct clk_ops pll_clk_ops = { 84 + static struct sh_clk_ops pll_clk_ops = { 85 85 .recalc = pll_recalc, 86 86 }; 87 87
+2 -2
arch/sh/kernel/cpu/sh4a/clock-sh7366.c
··· 61 61 return clk->parent->rate * mult; 62 62 } 63 63 64 - static struct clk_ops dll_clk_ops = { 64 + static struct sh_clk_ops dll_clk_ops = { 65 65 .recalc = dll_recalc, 66 66 }; 67 67 ··· 84 84 return (clk->parent->rate * mult) / div; 85 85 } 86 86 87 - static struct clk_ops pll_clk_ops = { 87 + static struct sh_clk_ops pll_clk_ops = { 88 88 .recalc = pll_recalc, 89 89 }; 90 90
+2 -2
arch/sh/kernel/cpu/sh4a/clock-sh7722.c
··· 64 64 return clk->parent->rate * mult; 65 65 } 66 66 67 - static struct clk_ops dll_clk_ops = { 67 + static struct sh_clk_ops dll_clk_ops = { 68 68 .recalc = dll_recalc, 69 69 }; 70 70 ··· 87 87 return (clk->parent->rate * mult) / div; 88 88 } 89 89 90 - static struct clk_ops pll_clk_ops = { 90 + static struct sh_clk_ops pll_clk_ops = { 91 91 .recalc = pll_recalc, 92 92 }; 93 93
+2 -2
arch/sh/kernel/cpu/sh4a/clock-sh7723.c
··· 65 65 return clk->parent->rate * mult; 66 66 } 67 67 68 - static struct clk_ops dll_clk_ops = { 68 + static struct sh_clk_ops dll_clk_ops = { 69 69 .recalc = dll_recalc, 70 70 }; 71 71 ··· 88 88 return (clk->parent->rate * mult) / div; 89 89 } 90 90 91 - static struct clk_ops pll_clk_ops = { 91 + static struct sh_clk_ops pll_clk_ops = { 92 92 .recalc = pll_recalc, 93 93 }; 94 94
+3 -3
arch/sh/kernel/cpu/sh4a/clock-sh7724.c
··· 70 70 return (clk->parent->rate * mult) / div; 71 71 } 72 72 73 - static struct clk_ops fll_clk_ops = { 73 + static struct sh_clk_ops fll_clk_ops = { 74 74 .recalc = fll_recalc, 75 75 }; 76 76 ··· 90 90 return clk->parent->rate * mult; 91 91 } 92 92 93 - static struct clk_ops pll_clk_ops = { 93 + static struct sh_clk_ops pll_clk_ops = { 94 94 .recalc = pll_recalc, 95 95 }; 96 96 ··· 105 105 return clk->parent->rate / 3; 106 106 } 107 107 108 - static struct clk_ops div3_clk_ops = { 108 + static struct sh_clk_ops div3_clk_ops = { 109 109 .recalc = div3_recalc, 110 110 }; 111 111
+1 -1
arch/sh/kernel/cpu/sh4a/clock-sh7757.c
··· 33 33 return clk->parent->rate * multiplier; 34 34 } 35 35 36 - static struct clk_ops pll_clk_ops = { 36 + static struct sh_clk_ops pll_clk_ops = { 37 37 .recalc = pll_recalc, 38 38 }; 39 39
+7 -7
arch/sh/kernel/cpu/sh4a/clock-sh7763.c
··· 27 27 clk->rate *= p0fc_divisors[(__raw_readl(FRQCR) >> 4) & 0x07]; 28 28 } 29 29 30 - static struct clk_ops sh7763_master_clk_ops = { 30 + static struct sh_clk_ops sh7763_master_clk_ops = { 31 31 .init = master_clk_init, 32 32 }; 33 33 ··· 37 37 return clk->parent->rate / p0fc_divisors[idx]; 38 38 } 39 39 40 - static struct clk_ops sh7763_module_clk_ops = { 40 + static struct sh_clk_ops sh7763_module_clk_ops = { 41 41 .recalc = module_clk_recalc, 42 42 }; 43 43 ··· 47 47 return clk->parent->rate / bfc_divisors[idx]; 48 48 } 49 49 50 - static struct clk_ops sh7763_bus_clk_ops = { 50 + static struct sh_clk_ops sh7763_bus_clk_ops = { 51 51 .recalc = bus_clk_recalc, 52 52 }; 53 53 54 - static struct clk_ops sh7763_cpu_clk_ops = { 54 + static struct sh_clk_ops sh7763_cpu_clk_ops = { 55 55 .recalc = followparent_recalc, 56 56 }; 57 57 58 - static struct clk_ops *sh7763_clk_ops[] = { 58 + static struct sh_clk_ops *sh7763_clk_ops[] = { 59 59 &sh7763_master_clk_ops, 60 60 &sh7763_module_clk_ops, 61 61 &sh7763_bus_clk_ops, 62 62 &sh7763_cpu_clk_ops, 63 63 }; 64 64 65 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 65 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 66 66 { 67 67 if (idx < ARRAY_SIZE(sh7763_clk_ops)) 68 68 *ops = sh7763_clk_ops[idx]; ··· 74 74 return clk->parent->rate / cfc_divisors[idx]; 75 75 } 76 76 77 - static struct clk_ops sh7763_shyway_clk_ops = { 77 + static struct sh_clk_ops sh7763_shyway_clk_ops = { 78 78 .recalc = shyway_clk_recalc, 79 79 }; 80 80
+6 -6
arch/sh/kernel/cpu/sh4a/clock-sh7770.c
··· 24 24 clk->rate *= pfc_divisors[(__raw_readl(FRQCR) >> 28) & 0x000f]; 25 25 } 26 26 27 - static struct clk_ops sh7770_master_clk_ops = { 27 + static struct sh_clk_ops sh7770_master_clk_ops = { 28 28 .init = master_clk_init, 29 29 }; 30 30 ··· 34 34 return clk->parent->rate / pfc_divisors[idx]; 35 35 } 36 36 37 - static struct clk_ops sh7770_module_clk_ops = { 37 + static struct sh_clk_ops sh7770_module_clk_ops = { 38 38 .recalc = module_clk_recalc, 39 39 }; 40 40 ··· 44 44 return clk->parent->rate / bfc_divisors[idx]; 45 45 } 46 46 47 - static struct clk_ops sh7770_bus_clk_ops = { 47 + static struct sh_clk_ops sh7770_bus_clk_ops = { 48 48 .recalc = bus_clk_recalc, 49 49 }; 50 50 ··· 54 54 return clk->parent->rate / ifc_divisors[idx]; 55 55 } 56 56 57 - static struct clk_ops sh7770_cpu_clk_ops = { 57 + static struct sh_clk_ops sh7770_cpu_clk_ops = { 58 58 .recalc = cpu_clk_recalc, 59 59 }; 60 60 61 - static struct clk_ops *sh7770_clk_ops[] = { 61 + static struct sh_clk_ops *sh7770_clk_ops[] = { 62 62 &sh7770_master_clk_ops, 63 63 &sh7770_module_clk_ops, 64 64 &sh7770_bus_clk_ops, 65 65 &sh7770_cpu_clk_ops, 66 66 }; 67 67 68 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 68 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 69 69 { 70 70 if (idx < ARRAY_SIZE(sh7770_clk_ops)) 71 71 *ops = sh7770_clk_ops[idx];
+7 -7
arch/sh/kernel/cpu/sh4a/clock-sh7780.c
··· 27 27 clk->rate *= pfc_divisors[__raw_readl(FRQCR) & 0x0003]; 28 28 } 29 29 30 - static struct clk_ops sh7780_master_clk_ops = { 30 + static struct sh_clk_ops sh7780_master_clk_ops = { 31 31 .init = master_clk_init, 32 32 }; 33 33 ··· 37 37 return clk->parent->rate / pfc_divisors[idx]; 38 38 } 39 39 40 - static struct clk_ops sh7780_module_clk_ops = { 40 + static struct sh_clk_ops sh7780_module_clk_ops = { 41 41 .recalc = module_clk_recalc, 42 42 }; 43 43 ··· 47 47 return clk->parent->rate / bfc_divisors[idx]; 48 48 } 49 49 50 - static struct clk_ops sh7780_bus_clk_ops = { 50 + static struct sh_clk_ops sh7780_bus_clk_ops = { 51 51 .recalc = bus_clk_recalc, 52 52 }; 53 53 ··· 57 57 return clk->parent->rate / ifc_divisors[idx]; 58 58 } 59 59 60 - static struct clk_ops sh7780_cpu_clk_ops = { 60 + static struct sh_clk_ops sh7780_cpu_clk_ops = { 61 61 .recalc = cpu_clk_recalc, 62 62 }; 63 63 64 - static struct clk_ops *sh7780_clk_ops[] = { 64 + static struct sh_clk_ops *sh7780_clk_ops[] = { 65 65 &sh7780_master_clk_ops, 66 66 &sh7780_module_clk_ops, 67 67 &sh7780_bus_clk_ops, 68 68 &sh7780_cpu_clk_ops, 69 69 }; 70 70 71 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 71 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 72 72 { 73 73 if (idx < ARRAY_SIZE(sh7780_clk_ops)) 74 74 *ops = sh7780_clk_ops[idx]; ··· 80 80 return clk->parent->rate / cfc_divisors[idx]; 81 81 } 82 82 83 - static struct clk_ops sh7780_shyway_clk_ops = { 83 + static struct sh_clk_ops sh7780_shyway_clk_ops = { 84 84 .recalc = shyway_clk_recalc, 85 85 }; 86 86
+1 -1
arch/sh/kernel/cpu/sh4a/clock-sh7785.c
··· 36 36 return clk->parent->rate * multiplier; 37 37 } 38 38 39 - static struct clk_ops pll_clk_ops = { 39 + static struct sh_clk_ops pll_clk_ops = { 40 40 .recalc = pll_recalc, 41 41 }; 42 42
+1 -1
arch/sh/kernel/cpu/sh4a/clock-sh7786.c
··· 38 38 return clk->parent->rate * multiplier; 39 39 } 40 40 41 - static struct clk_ops pll_clk_ops = { 41 + static struct sh_clk_ops pll_clk_ops = { 42 42 .recalc = pll_recalc, 43 43 }; 44 44
+1 -1
arch/sh/kernel/cpu/sh4a/clock-shx3.c
··· 32 32 return clk->parent->rate * 72; 33 33 } 34 34 35 - static struct clk_ops pll_clk_ops = { 35 + static struct sh_clk_ops pll_clk_ops = { 36 36 .recalc = pll_recalc, 37 37 }; 38 38
+6 -6
arch/sh/kernel/cpu/sh5/clock-sh5.c
··· 28 28 clk->rate *= ifc_table[idx]; 29 29 } 30 30 31 - static struct clk_ops sh5_master_clk_ops = { 31 + static struct sh_clk_ops sh5_master_clk_ops = { 32 32 .init = master_clk_init, 33 33 }; 34 34 ··· 38 38 return clk->parent->rate / ifc_table[idx]; 39 39 } 40 40 41 - static struct clk_ops sh5_module_clk_ops = { 41 + static struct sh_clk_ops sh5_module_clk_ops = { 42 42 .recalc = module_clk_recalc, 43 43 }; 44 44 ··· 48 48 return clk->parent->rate / ifc_table[idx]; 49 49 } 50 50 51 - static struct clk_ops sh5_bus_clk_ops = { 51 + static struct sh_clk_ops sh5_bus_clk_ops = { 52 52 .recalc = bus_clk_recalc, 53 53 }; 54 54 ··· 58 58 return clk->parent->rate / ifc_table[idx]; 59 59 } 60 60 61 - static struct clk_ops sh5_cpu_clk_ops = { 61 + static struct sh_clk_ops sh5_cpu_clk_ops = { 62 62 .recalc = cpu_clk_recalc, 63 63 }; 64 64 65 - static struct clk_ops *sh5_clk_ops[] = { 65 + static struct sh_clk_ops *sh5_clk_ops[] = { 66 66 &sh5_master_clk_ops, 67 67 &sh5_module_clk_ops, 68 68 &sh5_bus_clk_ops, 69 69 &sh5_cpu_clk_ops, 70 70 }; 71 71 72 - void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 72 + void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) 73 73 { 74 74 cprc_base = (unsigned long)ioremap_nocache(CPRC_BASE, 1024); 75 75 BUG_ON(!cprc_base);
+8 -8
drivers/sh/clk/cpg.c
··· 26 26 clk->mapped_reg); 27 27 } 28 28 29 - static struct clk_ops sh_clk_mstp32_clk_ops = { 29 + static struct sh_clk_ops sh_clk_mstp32_clk_ops = { 30 30 .enable = sh_clk_mstp32_enable, 31 31 .disable = sh_clk_mstp32_disable, 32 32 .recalc = followparent_recalc, ··· 150 150 iowrite32(value, clk->mapped_reg); 151 151 } 152 152 153 - static struct clk_ops sh_clk_div6_clk_ops = { 153 + static struct sh_clk_ops sh_clk_div6_clk_ops = { 154 154 .recalc = sh_clk_div6_recalc, 155 155 .round_rate = sh_clk_div_round_rate, 156 156 .set_rate = sh_clk_div6_set_rate, ··· 158 158 .disable = sh_clk_div6_disable, 159 159 }; 160 160 161 - static struct clk_ops sh_clk_div6_reparent_clk_ops = { 161 + static struct sh_clk_ops sh_clk_div6_reparent_clk_ops = { 162 162 .recalc = sh_clk_div6_recalc, 163 163 .round_rate = sh_clk_div_round_rate, 164 164 .set_rate = sh_clk_div6_set_rate, ··· 200 200 } 201 201 202 202 static int __init sh_clk_div6_register_ops(struct clk *clks, int nr, 203 - struct clk_ops *ops) 203 + struct sh_clk_ops *ops) 204 204 { 205 205 struct clk *clkp; 206 206 void *freq_table; ··· 317 317 iowrite32(ioread32(clk->mapped_reg) | (1 << 8), clk->mapped_reg); 318 318 } 319 319 320 - static struct clk_ops sh_clk_div4_clk_ops = { 320 + static struct sh_clk_ops sh_clk_div4_clk_ops = { 321 321 .recalc = sh_clk_div4_recalc, 322 322 .set_rate = sh_clk_div4_set_rate, 323 323 .round_rate = sh_clk_div_round_rate, 324 324 }; 325 325 326 - static struct clk_ops sh_clk_div4_enable_clk_ops = { 326 + static struct sh_clk_ops sh_clk_div4_enable_clk_ops = { 327 327 .recalc = sh_clk_div4_recalc, 328 328 .set_rate = sh_clk_div4_set_rate, 329 329 .round_rate = sh_clk_div_round_rate, ··· 331 331 .disable = sh_clk_div4_disable, 332 332 }; 333 333 334 - static struct clk_ops sh_clk_div4_reparent_clk_ops = { 334 + static struct sh_clk_ops sh_clk_div4_reparent_clk_ops = { 335 335 .recalc = sh_clk_div4_recalc, 336 336 .set_rate = sh_clk_div4_set_rate, 337 337 .round_rate = sh_clk_div_round_rate, ··· 341 341 }; 342 342 343 343 static int __init sh_clk_div4_register_ops(struct clk *clks, int nr, 344 - struct clk_div4_table *table, struct clk_ops *ops) 344 + struct clk_div4_table *table, struct sh_clk_ops *ops) 345 345 { 346 346 struct clk *clkp; 347 347 void *freq_table;
+3 -2
include/linux/sh_clk.h
··· 18 18 struct kref ref; 19 19 }; 20 20 21 - struct clk_ops { 21 + 22 + struct sh_clk_ops { 22 23 #ifdef CONFIG_SH_CLK_CPG_LEGACY 23 24 void (*init)(struct clk *clk); 24 25 #endif ··· 38 37 unsigned short parent_num; /* choose between */ 39 38 unsigned char src_shift; /* source clock field in the */ 40 39 unsigned char src_width; /* configuration register */ 41 - struct clk_ops *ops; 40 + struct sh_clk_ops *ops; 42 41 43 42 struct list_head children; 44 43 struct list_head sibling; /* node for children */