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

ARM/clocksource: use automatic DT probing for ux500 PRCMU

The ARM core kernel already calls clocksource_of_init() so why
go to all the trouble of locating and probing this node in the
machine. CLOCKSOURCE_OF_DECLARE() will take care of it in the
clocksource driver, and thus we can also get rid of the
dangling header file <linux/clksrc-dbx500-prcmu.h>

Suggested-by: Arnd Bergmann <arndb@linaro.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

authored by

Linus Walleij and committed by
Arnd Bergmann
9d2aa8c7 75305275

+7 -78
+1 -1
arch/arm/mach-ux500/Makefile
··· 2 2 # Makefile for the linux kernel, U8500 machine. 3 3 # 4 4 5 - obj-y := cpu.o id.o timer.o pm.o 5 + obj-y := cpu.o id.o pm.o 6 6 obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 7 7 obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o 8 8 obj-$(CONFIG_MACH_MOP500) += board-mop500-regulators.o \
-2
arch/arm/mach-ux500/cpu-db8500.c
··· 156 156 DT_MACHINE_START(U8500_DT, "ST-Ericsson Ux5x0 platform (Device Tree Support)") 157 157 .map_io = u8500_map_io, 158 158 .init_irq = ux500_init_irq, 159 - /* we re-use nomadik timer here */ 160 - .init_time = ux500_timer_init, 161 159 .init_machine = u8500_init_machine, 162 160 .init_late = NULL, 163 161 .dt_compat = stericsson_dt_platform_compat,
-1
arch/arm/mach-ux500/cpu.c
··· 9 9 #include <linux/platform_device.h> 10 10 #include <linux/io.h> 11 11 #include <linux/mfd/dbx500-prcmu.h> 12 - #include <linux/clksrc-dbx500-prcmu.h> 13 12 #include <linux/sys_soc.h> 14 13 #include <linux/err.h> 15 14 #include <linux/slab.h>
-3
arch/arm/mach-ux500/setup.h
··· 12 12 #define __ASM_ARCH_SETUP_H 13 13 14 14 #include <asm/mach/arch.h> 15 - #include <asm/mach/time.h> 16 15 #include <linux/init.h> 17 16 #include <linux/mfd/abx500/ab8500.h> 18 17 ··· 22 23 extern void __init ux500_init_irq(void); 23 24 24 25 extern struct device *ux500_soc_device_init(const char *soc_id); 25 - 26 - extern void ux500_timer_init(void); 27 26 28 27 extern void ux500_cpu_die(unsigned int cpu); 29 28
-48
arch/arm/mach-ux500/timer.c
··· 1 - /* 2 - * Copyright (C) ST-Ericsson SA 2011 3 - * 4 - * License Terms: GNU General Public License v2 5 - * Author: Mattias Wallin <mattias.wallin@stericsson.com> for ST-Ericsson 6 - */ 7 - #include <linux/io.h> 8 - #include <linux/errno.h> 9 - #include <linux/clksrc-dbx500-prcmu.h> 10 - #include <linux/clocksource.h> 11 - #include <linux/of.h> 12 - #include <linux/of_address.h> 13 - 14 - #include "setup.h" 15 - 16 - #include "db8500-regs.h" 17 - #include "id.h" 18 - 19 - static const struct of_device_id prcmu_timer_of_match[] __initconst = { 20 - { .compatible = "stericsson,db8500-prcmu-timer-4", }, 21 - { }, 22 - }; 23 - 24 - void __init ux500_timer_init(void) 25 - { 26 - void __iomem *prcmu_timer_base; 27 - void __iomem *tmp_base; 28 - struct device_node *np; 29 - 30 - if (cpu_is_u8500_family() || cpu_is_ux540_family()) 31 - prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); 32 - else 33 - ux500_unknown_soc(); 34 - 35 - np = of_find_matching_node(NULL, prcmu_timer_of_match); 36 - if (!np) 37 - goto dt_fail; 38 - 39 - tmp_base = of_iomap(np, 0); 40 - if (!tmp_base) 41 - goto dt_fail; 42 - 43 - prcmu_timer_base = tmp_base; 44 - 45 - dt_fail: 46 - clksrc_dbx500_prcmu_init(prcmu_timer_base); 47 - clocksource_probe(); 48 - }
+6 -3
drivers/clocksource/clksrc-dbx500-prcmu.c
··· 12 12 * power domain. We use the Timer 4 for our always-on clock 13 13 * source on DB8500. 14 14 */ 15 + #include <linux/of.h> 16 + #include <linux/of_address.h> 15 17 #include <linux/clockchips.h> 16 - #include <linux/clksrc-dbx500-prcmu.h> 17 18 #include <linux/sched_clock.h> 18 19 19 20 #define RATE_32K 32768 ··· 64 63 65 64 #endif 66 65 67 - void __init clksrc_dbx500_prcmu_init(void __iomem *base) 66 + static void __init clksrc_dbx500_prcmu_init(struct device_node *node) 68 67 { 69 - clksrc_dbx500_timer_base = base; 68 + clksrc_dbx500_timer_base = of_iomap(node, 0); 70 69 71 70 /* 72 71 * The A9 sub system expects the timer to be configured as ··· 86 85 #endif 87 86 clocksource_register_hz(&clocksource_dbx500_prcmu, RATE_32K); 88 87 } 88 + CLOCKSOURCE_OF_DECLARE(dbx500_prcmu, "stericsson,db8500-prcmu-timer-4", 89 + clksrc_dbx500_prcmu_init);
-20
include/linux/clksrc-dbx500-prcmu.h
··· 1 - /* 2 - * Copyright (C) ST-Ericsson SA 2011 3 - * 4 - * License Terms: GNU General Public License v2 5 - * Author: Mattias Wallin <mattias.wallin@stericsson.com> 6 - * 7 - */ 8 - #ifndef __CLKSRC_DBX500_PRCMU_H 9 - #define __CLKSRC_DBX500_PRCMU_H 10 - 11 - #include <linux/init.h> 12 - #include <linux/io.h> 13 - 14 - #ifdef CONFIG_CLKSRC_DBX500_PRCMU 15 - void __init clksrc_dbx500_prcmu_init(void __iomem *base); 16 - #else 17 - static inline void __init clksrc_dbx500_prcmu_init(void __iomem *base) {} 18 - #endif 19 - 20 - #endif