clocksource: dw_apb_timer: Add common DTS glue for dw_apb_timer
Subsystems (5)
PATCH v5 1/1 clocksource: dw_apb_timer: Add common DTS glue for dw_apb_timer
From: Dinh Nguyen <[email protected]>
Make a common device tree glue for clocksource/dw_apb_timer. Move mach-picoxcell/time.c to be a generic device tree application of the dw_apb_timer.
Configure mach-picoxcell to use the dw_apb_timer_of device tree implementation in drivers/clocksource.
--- Documentation/devicetree/bindings/rtc/dw-apb.txt | 25 ++++++++++ arch/arm/Kconfig | 1 + arch/arm/mach-picoxcell/Makefile | 1 - arch/arm/mach-picoxcell/common.c | 3 +- arch/arm/mach-picoxcell/common.h | 2 +- drivers/clocksource/Kconfig | 3 ++ drivers/clocksource/Makefile | 1 + .../clocksource/dw_apb_timer_of.c | 52 ++++++++++++-------- 8 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 Documentation/devicetree/bindings/rtc/dw-apb.txt rename arch/arm/mach-picoxcell/time.c => drivers/clocksource/dw_apb_timer_of.c (57%)
Documentation/devicetree/bindings/rtc/dw-apb.txt new file +25 -0
@@ -0,0 +1,25 @@ +* Designware APB timer + +Required properties: +- compatible: "snps,dw-apb-timer-sp" or "snps,dw-apb-timer-osc" +- reg: physical base address of the controller and length of memory mapped + region. +- interrupts: IRQ line for the timer. +- clock-frequency: The frequency in HZ of the timer. +- clock-freq: For backwards compatibility with picoxcell + +Example: + + timer1: timer at ffc09000 { + compatible = "snps,dw-apb-timer-sp"; + interrupts = <0 168 4>; + clock-frequency = <200000000>; + reg = <0xffc09000 0x1000>; + }; + + timer2: timer at ffd00000 { + compatible = "snps,dw-apb-timer-osc"; + interrupts = <0 169 4>; + clock-frequency = <200000000>; + reg = <0xffd00000 0x1000>; + };
arch/arm/Kconfig +1 -0
@@ -658,6 +658,7 @@ config ARCH_PICOXCELL select ARM_VIC select CPU_V6K select DW_APB_TIMER + select DW_APB_TIMER_OF select GENERIC_CLOCKEVENTS select GENERIC_GPIO select HAVE_TCM
arch/arm/mach-picoxcell/Makefile +0 -1
@@ -1,2 +1 @@ obj-y := common.o -obj-y += time.o
arch/arm/mach-picoxcell/common.c +2 -1
@@ -14,6 +14,7 @@#include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/of_platform.h> +#include <linux/dw_apb_timer.h> #include <asm/mach/arch.h> #include <asm/hardware/vic.h>
@@ -97,7 +98,7 @@ DT_MACHINE_START(PICOXCELL, "Picochip picoXcell") .nr_irqs = NR_IRQS_LEGACY, .init_irq = picoxcell_init_irq, .handle_irq = vic_handle_irq, - .timer = &picoxcell_timer, + .timer = &dw_apb_timer, .init_machine = picoxcell_init_machine, .dt_compat = picoxcell_dt_match, .restart = picoxcell_wdt_restart,
arch/arm/mach-picoxcell/common.h +1 -1
@@ -12,6 +12,6 @@#include <asm/mach/time.h> -extern struct sys_timer picoxcell_timer; +extern struct sys_timer dw_apb_timer;#endif /* __PICOXCELL_COMMON_H__ */
drivers/clocksource/Kconfig +3 -0
@@ -16,6 +16,9 @@ config CLKSRC_MMIO config DW_APB_TIMER bool +config DW_APB_TIMER_OF + bool + config CLKSRC_DBX500_PRCMU bool "Clocksource PRCMU Timer" depends on UX500_SOC_DB8500
drivers/clocksource/Makefile +1 -0
@@ -10,4 +10,5 @@ obj-$(CONFIG_EM_TIMER_STI) += em_sti.o obj-$(CONFIG_CLKBLD_I8253) += i8253.o obj-$(CONFIG_CLKSRC_MMIO) += mmio.o obj-$(CONFIG_DW_APB_TIMER) += dw_apb_timer.o +obj-$(CONFIG_DW_APB_TIMER_OF) += dw_apb_timer_of.o obj-$(CONFIG_CLKSRC_DBX500_PRCMU) += clksrc-dbx500-prcmu.o
drivers/clocksource/dw_apb_timer_of.c renamed from arch/arm/mach-picoxcell/time.c +31 -21
123 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v5 1/1 clocksource: dw_apb_timer: Add common DTS glue for dw_apb_timer
Hi!
Quoted 1 line
From: Dinh Nguyen <[email protected]>
Not that it matters, but it should probably be from: me, since I did the original version...
Quoted 8 lines
Make a common device tree glue for clocksource/dw_apb_timer. Move
mach-picoxcell/time.cto be a generic device tree application of thedw_apb_timer.Configure mach-picoxcell to use the
dw_apb_timer_ofdevice tree implementation indrivers/clocksource.
drivers/clocksource/dw_apb_timer_of.c static void timer_get_base_and_rate(struct device_node *np, · line 39
Quoted 10 lines
drivers/clocksource/dw_apb_timer_of.c renamed from arch/arm/mach-picoxcell/time.c +3
-2@@ -25,11 +32,12 @@ static void timer_get_base_and_rate(struct device_node *np,if (!*base)panic ("Unable to map regs for %s" , np->name); -if (of_property_read_u32 (np,"clock-freq" , rate)) -panic ("No clock-freq property for %s" , np->name); +if (of_property_read_u32 (np,"clock-freq" , rate) && +of_property_read_u32 (np,"clock-frequency" , rate)) +panic ("No clock-frequency property for %s" , np->name); }
But this should be ||, not &&, I guess.
Thanks for the patch,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH v5 1/1 clocksource: dw_apb_timer: Add common DTS glue for dw_apb_timer
Quoted 6 lines · Pavel Machek
Hi!
Quoted 1 line
From: Dinh Nguyen <[email protected]>
Not that it matters, but it should probably be from: me, since I did the original version...
I apologize, I just took over the next day since my submission for Altera's socfpga port is dependent on this.
Quoted 12 lines
Quoted 12 lines
Make a common device tree glue for clocksource/dw_apb_timer. Move
mach-picoxcell/time.cto be a generic device tree application of thedw_apb_timer.Configure mach-picoxcell to use the
dw_apb_timer_ofdevice tree implementation indrivers/clocksource.drivers/clocksource/dw_apb_timer_of.c renamed from arch/arm/mach-picoxcell/time.c +0
-0@@ -25,11 +32,12 @@ static void timer_get_base_and_rate(struct device_node *np,if (!*base)panic ("Unable to map regs for %s" , np->name);
Quoted 9 lines
drivers/clocksource/dw_apb_timer_of.c static void timer_get_base_and_rate(struct device_node *np, · line 39
Quoted 7 lines
drivers/clocksource/dw_apb_timer_of.c renamed from arch/arm/mach-picoxcell/time.c +3
-2-if (of_property_read_u32 (np,"clock-freq" , rate)) -panic ("No clock-freq property for %s" , np->name); +if (of_property_read_u32 (np,"clock-freq" , rate) && +of_property_read_u32 (np,"clock-frequency" , rate)) +panic ("No clock-frequency property for %s" , np->name); }But this should be ||, not &&, I guess.
Actually the way the code was written, it should be &&. Since of_property_read_u32 returns 0 for success, doing an OR will fail if 1 of the conditions is true. We only want to fail if both conditions fail.
Dinh
Quoted 4 lines
Thanks for the patch,
Pavel
PATCH v5 1/1 clocksource: dw_apb_timer: Add common DTS glue for dw_apb_timer
Hi!
Quoted 21 lines
Quoted 11 lines
Quoted 11 lines
Make a common device tree glue for clocksource/dw_apb_timer. Move
mach-picoxcell/time.cto be a generic device tree application of thedw_apb_timer.Configure mach-picoxcell to use the
dw_apb_timer_ofdevice tree implementation indrivers/clocksource.drivers/clocksource/dw_apb_timer_of.c renamed from arch/arm/mach-picoxcell/time.c +0
-0@@ -25,11 +32,12 @@ static void timer_get_base_and_rate(struct device_node *np,if (!*base)panic ("Unable to map regs for %s" , np->name);Quoted 9 lines
drivers/clocksource/dw_apb_timer_of.c static void timer_get_base_and_rate(struct device_node *np, · line 39
Quoted 7 lines
drivers/clocksource/dw_apb_timer_of.c renamed from arch/arm/mach-picoxcell/time.c +3
-2-if (of_property_read_u32 (np,"clock-freq" , rate)) -panic ("No clock-freq property for %s" , np->name); +if (of_property_read_u32 (np,"clock-freq" , rate) && +of_property_read_u32 (np,"clock-frequency" , rate)) +panic ("No clock-frequency property for %s" , np->name); }But this should be ||, not &&, I guess.
Quoted 3 lines
Actually the way the code was written, it should be &&. Since
of_property_read_u32returns 0 for success, doing an OR will fail if 1 of the conditions is true. We only want to fail if both conditions fail.
Oops, sorry, I was blind.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH v5 1/1 clocksource: dw_apb_timer: Add common DTS glue for dw_apb_timer
In reply to dinguyen at altera.comQuoted 6 lines · dinguyen at altera.com
From: Dinh Nguyen <[email protected]>
Make a common device tree glue for clocksource/dw_apb_timer. Move
mach-picoxcell/time.cto be a generic device tree application of thedw_apb_timer.
Quoted 6 lines
Configure mach-picoxcell to use the
dw_apb_timer_ofdevice tree implementation indrivers/clocksource.Signed-off-by Pavel Machek <[email protected]>Signed-off-by Dinh Nguyen <[email protected]>Acked-by Jamie Iles <[email protected]>
Please take it through the proper ARM/SoC tree so work depending on that does not get blocked.
Thanks,
tglx
PATCH 1/1 clocksource: dw_apb_timer: Add common DTS glue for dw_apb_timer
Quoted 11 lines · Thomas Gleixner
Quoted 9 lines · dinguyen at altera.com
From: Dinh Nguyen <[email protected]>
Make a common device tree glue for clocksource/dw_apb_timer. Move
mach-picoxcell/time.cto be a generic device tree application of thedw_apb_timer.Configure mach-picoxcell to use the
dw_apb_timer_ofdevice tree implementation indrivers/clocksource.
Quoted 8 lines
Quoted 3 lines
Signed-off-by Pavel Machek <[email protected]>Signed-off-by Dinh Nguyen <[email protected]>Acked-by Jamie Iles <[email protected]>Acked-by Thomas Gleixner <[email protected]>Please take it through the proper ARM/SoC tree so work depending on that does not get blocked.
Arnd, can you apply this? Or should we create public git tree to pull from?
Thanks,
Pavel
---
Make a common device tree glue for clocksource/dw_apb_timer. Move mach-picoxcell/time.c to be a generic device tree application of the dw_apb_timer.
Configure mach-picoxcell to use the dw_apb_timer_of device tree implementation in drivers/clocksource.
--- Documentation/devicetree/bindings/rtc/dw-apb.txt | 25 ++++++++++ arch/arm/Kconfig | 1 + arch/arm/mach-picoxcell/Makefile | 1 - arch/arm/mach-picoxcell/common.c | 3 +- arch/arm/mach-picoxcell/common.h | 2 +- drivers/clocksource/Kconfig | 3 ++ drivers/clocksource/Makefile | 1 + .../clocksource/dw_apb_timer_of.c | 52 ++++++++++++-------- 8 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 Documentation/devicetree/bindings/rtc/dw-apb.txt rename arch/arm/mach-picoxcell/time.c => drivers/clocksource/dw_apb_timer_of.c (57%)
Documentation/devicetree/bindings/rtc/dw-apb.txt new file +25 -0
@@ -0,0 +1,25 @@ +* Designware APB timer + +Required properties: +- compatible: "snps,dw-apb-timer-sp" or "snps,dw-apb-timer-osc" +- reg: physical base address of the controller and length of memory mapped + region. +- interrupts: IRQ line for the timer. +- clock-frequency: The frequency in HZ of the timer. +- clock-freq: For backwards compatibility with picoxcell + +Example: + + timer1: timer at ffc09000 { + compatible = "snps,dw-apb-timer-sp"; + interrupts = <0 168 4>; + clock-frequency = <200000000>; + reg = <0xffc09000 0x1000>; + }; + + timer2: timer at ffd00000 { + compatible = "snps,dw-apb-timer-osc"; + interrupts = <0 169 4>; + clock-frequency = <200000000>; + reg = <0xffd00000 0x1000>; + };
arch/arm/Kconfig +1 -0
@@ -658,6 +658,7 @@ config ARCH_PICOXCELL select ARM_VIC select CPU_V6K select DW_APB_TIMER + select DW_APB_TIMER_OF select GENERIC_CLOCKEVENTS select GENERIC_GPIO select HAVE_TCM
arch/arm/mach-picoxcell/Makefile +0 -1
@@ -1,2 +1 @@ obj-y := common.o -obj-y += time.o
arch/arm/mach-picoxcell/common.c +2 -1
@@ -14,6 +14,7 @@#include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/of_platform.h> +#include <linux/dw_apb_timer.h> #include <asm/mach/arch.h> #include <asm/hardware/vic.h>
@@ -97,7 +98,7 @@ DT_MACHINE_START(PICOXCELL, "Picochip picoXcell") .nr_irqs = NR_IRQS_LEGACY, .init_irq = picoxcell_init_irq, .handle_irq = vic_handle_irq, - .timer = &picoxcell_timer, + .timer = &dw_apb_timer, .init_machine = picoxcell_init_machine, .dt_compat = picoxcell_dt_match, .restart = picoxcell_wdt_restart,
arch/arm/mach-picoxcell/common.h +1 -1
@@ -12,6 +12,6 @@#include <asm/mach/time.h> -extern struct sys_timer picoxcell_timer; +extern struct sys_timer dw_apb_timer;#endif /* __PICOXCELL_COMMON_H__ */
drivers/clocksource/Kconfig +3 -0
@@ -16,6 +16,9 @@ config CLKSRC_MMIO config DW_APB_TIMER bool +config DW_APB_TIMER_OF + bool + config CLKSRC_DBX500_PRCMU bool "Clocksource PRCMU Timer" depends on UX500_SOC_DB8500
drivers/clocksource/Makefile +1 -0
@@ -10,4 +10,5 @@ obj-$(CONFIG_EM_TIMER_STI) += em_sti.o obj-$(CONFIG_CLKBLD_I8253) += i8253.o obj-$(CONFIG_CLKSRC_MMIO) += mmio.o obj-$(CONFIG_DW_APB_TIMER) += dw_apb_timer.o +obj-$(CONFIG_DW_APB_TIMER_OF) += dw_apb_timer_of.o obj-$(CONFIG_CLKSRC_DBX500_PRCMU) += clksrc-dbx500-prcmu.o
drivers/clocksource/dw_apb_timer_of.c renamed from arch/arm/mach-picoxcell/time.c +31 -21
123 lines not on this page · raw message
Signature · 11 lines
1.7.9.5 -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Arnd Bergmann
AppliedPATCH 1/1 clocksource: dw_apb_timer: Add common DTS glue for dw_apb_timer
Quoted 16 lines · Pavel Machek
Quoted 15 lines · Thomas Gleixner
Quoted 12 lines · dinguyen at altera.com
From: Dinh Nguyen <[email protected]>
Make a common device tree glue for clocksource/dw_apb_timer. Move
mach-picoxcell/time.cto be a generic device tree application of thedw_apb_timer.Configure mach-picoxcell to use the
dw_apb_timer_ofdevice tree implementation indrivers/clocksource.Signed-off-by Pavel Machek <[email protected]>Signed-off-by Dinh Nguyen <[email protected]>Acked-by Jamie Iles <[email protected]>
Quoted 7 lines
Quoted 4 lines
Acked-by Thomas Gleixner <[email protected]>Please take it through the proper ARM/SoC tree so work depending on that does not get blocked.
Arnd, can you apply this? Or should we create public git tree to pull from?
Applied to next/timer branch,
Thanks!
ARnd