All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
@ 2013-06-04  9:36 ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:36 UTC (permalink / raw)
  To: John Stultz, Thomas Gleixner
  Cc: Jamie Iles, Dinh Nguyen, Grant Likely, linux-arm-kernel,
	Rob Herring, devicetree-discuss, linux-kernel, Arnd Bergmann,
	Linus Walleij, Baruch Siach

This is split off of my Rockchip support series from yesterday. It's now
a patch more than before, as the third patch enables the timer to be used
thru clocksource_of_init and moves picoxcell and socfpga to it.

changes since v1:
- hopefully improve the patch description of patch 1
  after a suggestion by Linus Walleij
- move the selection of DW_APB_TIMER and CLKSRC_OF into DW_APB_TIMER_OF
  after a suggestion by Baruch Siach

Heiko Stuebner (4):
  clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
  clocksource: dw_apb_timer_of: add clock-handling
  clocksource: dw_apb_timer_of: select DW_APB_TIMER
  clocksource: dw_apb_timer_of: use clocksource_of_init

 Documentation/devicetree/bindings/rtc/dw-apb.txt |   19 +++++
 arch/arm/mach-picoxcell/Kconfig                  |    1 -
 arch/arm/mach-picoxcell/common.c                 |    2 -
 arch/arm/mach-socfpga/Kconfig                    |    1 -
 arch/arm/mach-socfpga/socfpga.c                  |    2 -
 drivers/clocksource/Kconfig                      |    2 +
 drivers/clocksource/dw_apb_timer_of.c            |   95 ++++++++++++++-------
 include/linux/dw_apb_timer.h                     |    1 -
 8 files changed, 84 insertions(+), 39 deletions(-)

-- 
1.7.2.3


^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
@ 2013-06-04  9:36 ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:36 UTC (permalink / raw)
  To: John Stultz, Thomas Gleixner
  Cc: Baruch Siach, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Grant Likely,
	Jamie Iles, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

This is split off of my Rockchip support series from yesterday. It's now
a patch more than before, as the third patch enables the timer to be used
thru clocksource_of_init and moves picoxcell and socfpga to it.

changes since v1:
- hopefully improve the patch description of patch 1
  after a suggestion by Linus Walleij
- move the selection of DW_APB_TIMER and CLKSRC_OF into DW_APB_TIMER_OF
  after a suggestion by Baruch Siach

Heiko Stuebner (4):
  clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
  clocksource: dw_apb_timer_of: add clock-handling
  clocksource: dw_apb_timer_of: select DW_APB_TIMER
  clocksource: dw_apb_timer_of: use clocksource_of_init

 Documentation/devicetree/bindings/rtc/dw-apb.txt |   19 +++++
 arch/arm/mach-picoxcell/Kconfig                  |    1 -
 arch/arm/mach-picoxcell/common.c                 |    2 -
 arch/arm/mach-socfpga/Kconfig                    |    1 -
 arch/arm/mach-socfpga/socfpga.c                  |    2 -
 drivers/clocksource/Kconfig                      |    2 +
 drivers/clocksource/dw_apb_timer_of.c            |   95 ++++++++++++++-------
 include/linux/dw_apb_timer.h                     |    1 -
 8 files changed, 84 insertions(+), 39 deletions(-)

-- 
1.7.2.3

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
@ 2013-06-04  9:36 ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:36 UTC (permalink / raw)
  To: linux-arm-kernel

This is split off of my Rockchip support series from yesterday. It's now
a patch more than before, as the third patch enables the timer to be used
thru clocksource_of_init and moves picoxcell and socfpga to it.

changes since v1:
- hopefully improve the patch description of patch 1
  after a suggestion by Linus Walleij
- move the selection of DW_APB_TIMER and CLKSRC_OF into DW_APB_TIMER_OF
  after a suggestion by Baruch Siach

Heiko Stuebner (4):
  clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
  clocksource: dw_apb_timer_of: add clock-handling
  clocksource: dw_apb_timer_of: select DW_APB_TIMER
  clocksource: dw_apb_timer_of: use clocksource_of_init

 Documentation/devicetree/bindings/rtc/dw-apb.txt |   19 +++++
 arch/arm/mach-picoxcell/Kconfig                  |    1 -
 arch/arm/mach-picoxcell/common.c                 |    2 -
 arch/arm/mach-socfpga/Kconfig                    |    1 -
 arch/arm/mach-socfpga/socfpga.c                  |    2 -
 drivers/clocksource/Kconfig                      |    2 +
 drivers/clocksource/dw_apb_timer_of.c            |   95 ++++++++++++++-------
 include/linux/dw_apb_timer.h                     |    1 -
 8 files changed, 84 insertions(+), 39 deletions(-)

-- 
1.7.2.3

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 1/4] clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
@ 2013-06-04  9:37   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:37 UTC (permalink / raw)
  To: John Stultz, Thomas Gleixner
  Cc: Jamie Iles, Dinh Nguyen, Grant Likely, linux-arm-kernel,
	Rob Herring, devicetree-discuss, linux-kernel, Arnd Bergmann,
	Linus Walleij, Baruch Siach

Currently the dw_apb_timer always expects a separate special timer to be
availbable for the sched_clock. Some devices using dw_apb_timers do not
have this sptimer but can use the clocksource as sched_clock instead.

Therefore enable the driver to distiguish between devices with and without
sptimer based on the devicetree data and select the correct timer as
sched_clock.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/clocksource/dw_apb_timer_of.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index ab09ed3..d6c0fda 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -57,6 +57,9 @@ static void add_clockevent(struct device_node *event_timer)
 	dw_apb_clockevent_register(ced);
 }
 
+static void __iomem *sched_io_base;
+static u32 sched_rate;
+
 static void add_clocksource(struct device_node *source_timer)
 {
 	void __iomem *iobase;
@@ -71,9 +74,15 @@ static void add_clocksource(struct device_node *source_timer)
 
 	dw_apb_clocksource_start(cs);
 	dw_apb_clocksource_register(cs);
-}
 
-static void __iomem *sched_io_base;
+	/*
+	 * Fallback to use the clocksource as sched_clock if no separate
+	 * timer is found. sched_io_base then points to the current_value
+	 * register of the clocksource timer.
+	 */
+	sched_io_base = iobase + 0x04;
+	sched_rate = rate;
+}
 
 static u32 read_sched_clock(void)
 {
@@ -89,16 +98,15 @@ static const struct of_device_id sptimer_ids[] __initconst = {
 static void init_sched_clock(void)
 {
 	struct device_node *sched_timer;
-	u32 rate;
 
 	sched_timer = of_find_matching_node(NULL, sptimer_ids);
-	if (!sched_timer)
-		panic("No RTC for sched clock to use");
-
-	timer_get_base_and_rate(sched_timer, &sched_io_base, &rate);
-	of_node_put(sched_timer);
+	if (sched_timer) {
+		timer_get_base_and_rate(sched_timer, &sched_io_base,
+					&sched_rate);
+		of_node_put(sched_timer);
+	}
 
-	setup_sched_clock(read_sched_clock, 32, rate);
+	setup_sched_clock(read_sched_clock, 32, sched_rate);
 }
 
 static const struct of_device_id osctimer_ids[] __initconst = {
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v2 1/4] clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
@ 2013-06-04  9:37   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:37 UTC (permalink / raw)
  To: John Stultz, Thomas Gleixner
  Cc: Baruch Siach, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Grant Likely,
	Jamie Iles, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Currently the dw_apb_timer always expects a separate special timer to be
availbable for the sched_clock. Some devices using dw_apb_timers do not
have this sptimer but can use the clocksource as sched_clock instead.

Therefore enable the driver to distiguish between devices with and without
sptimer based on the devicetree data and select the correct timer as
sched_clock.

Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
 drivers/clocksource/dw_apb_timer_of.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index ab09ed3..d6c0fda 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -57,6 +57,9 @@ static void add_clockevent(struct device_node *event_timer)
 	dw_apb_clockevent_register(ced);
 }
 
+static void __iomem *sched_io_base;
+static u32 sched_rate;
+
 static void add_clocksource(struct device_node *source_timer)
 {
 	void __iomem *iobase;
@@ -71,9 +74,15 @@ static void add_clocksource(struct device_node *source_timer)
 
 	dw_apb_clocksource_start(cs);
 	dw_apb_clocksource_register(cs);
-}
 
-static void __iomem *sched_io_base;
+	/*
+	 * Fallback to use the clocksource as sched_clock if no separate
+	 * timer is found. sched_io_base then points to the current_value
+	 * register of the clocksource timer.
+	 */
+	sched_io_base = iobase + 0x04;
+	sched_rate = rate;
+}
 
 static u32 read_sched_clock(void)
 {
@@ -89,16 +98,15 @@ static const struct of_device_id sptimer_ids[] __initconst = {
 static void init_sched_clock(void)
 {
 	struct device_node *sched_timer;
-	u32 rate;
 
 	sched_timer = of_find_matching_node(NULL, sptimer_ids);
-	if (!sched_timer)
-		panic("No RTC for sched clock to use");
-
-	timer_get_base_and_rate(sched_timer, &sched_io_base, &rate);
-	of_node_put(sched_timer);
+	if (sched_timer) {
+		timer_get_base_and_rate(sched_timer, &sched_io_base,
+					&sched_rate);
+		of_node_put(sched_timer);
+	}
 
-	setup_sched_clock(read_sched_clock, 32, rate);
+	setup_sched_clock(read_sched_clock, 32, sched_rate);
 }
 
 static const struct of_device_id osctimer_ids[] __initconst = {
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v2 1/4] clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
@ 2013-06-04  9:37   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:37 UTC (permalink / raw)
  To: linux-arm-kernel

Currently the dw_apb_timer always expects a separate special timer to be
availbable for the sched_clock. Some devices using dw_apb_timers do not
have this sptimer but can use the clocksource as sched_clock instead.

Therefore enable the driver to distiguish between devices with and without
sptimer based on the devicetree data and select the correct timer as
sched_clock.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/clocksource/dw_apb_timer_of.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index ab09ed3..d6c0fda 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -57,6 +57,9 @@ static void add_clockevent(struct device_node *event_timer)
 	dw_apb_clockevent_register(ced);
 }
 
+static void __iomem *sched_io_base;
+static u32 sched_rate;
+
 static void add_clocksource(struct device_node *source_timer)
 {
 	void __iomem *iobase;
@@ -71,9 +74,15 @@ static void add_clocksource(struct device_node *source_timer)
 
 	dw_apb_clocksource_start(cs);
 	dw_apb_clocksource_register(cs);
-}
 
-static void __iomem *sched_io_base;
+	/*
+	 * Fallback to use the clocksource as sched_clock if no separate
+	 * timer is found. sched_io_base then points to the current_value
+	 * register of the clocksource timer.
+	 */
+	sched_io_base = iobase + 0x04;
+	sched_rate = rate;
+}
 
 static u32 read_sched_clock(void)
 {
@@ -89,16 +98,15 @@ static const struct of_device_id sptimer_ids[] __initconst = {
 static void init_sched_clock(void)
 {
 	struct device_node *sched_timer;
-	u32 rate;
 
 	sched_timer = of_find_matching_node(NULL, sptimer_ids);
-	if (!sched_timer)
-		panic("No RTC for sched clock to use");
-
-	timer_get_base_and_rate(sched_timer, &sched_io_base, &rate);
-	of_node_put(sched_timer);
+	if (sched_timer) {
+		timer_get_base_and_rate(sched_timer, &sched_io_base,
+					&sched_rate);
+		of_node_put(sched_timer);
+	}
 
-	setup_sched_clock(read_sched_clock, 32, rate);
+	setup_sched_clock(read_sched_clock, 32, sched_rate);
 }
 
 static const struct of_device_id osctimer_ids[] __initconst = {
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v2 2/4] clocksource: dw_apb_timer_of: add clock-handling
@ 2013-06-04  9:37   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:37 UTC (permalink / raw)
  To: John Stultz, Thomas Gleixner
  Cc: Jamie Iles, Dinh Nguyen, Grant Likely, linux-arm-kernel,
	Rob Herring, devicetree-discuss, linux-kernel, Arnd Bergmann,
	Linus Walleij, Baruch Siach

Add the possibility to get the clock-frequency from a timer clock instead
of specifying it as dt property. Additionally also add the possibility
to also define a controlling periphal clock for the timer block.

The clock-frequency property is kept to act as fallback if no clocks
are specified.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 Documentation/devicetree/bindings/rtc/dw-apb.txt |   19 ++++++++++++++++
 drivers/clocksource/dw_apb_timer_of.c            |   26 +++++++++++++++++++++-
 2 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/rtc/dw-apb.txt b/Documentation/devicetree/bindings/rtc/dw-apb.txt
index 93e2b0f..eb2327b 100644
--- a/Documentation/devicetree/bindings/rtc/dw-apb.txt
+++ b/Documentation/devicetree/bindings/rtc/dw-apb.txt
@@ -5,9 +5,20 @@ Required properties:
 - reg: physical base address of the controller and length of memory mapped
   region.
 - interrupts: IRQ line for the timer.
+- either clocks+clock-names or clock-frequency properties
+
+Optional properties:
+- clocks	: list of clock specifiers, corresponding to entries in
+		  the clock-names property;
+- clock-names	: should contain "timer" and "pclk" entries, matching entries
+		  in the clocks property.
 - clock-frequency: The frequency in HZ of the timer.
 - clock-freq: For backwards compatibility with picoxcell
 
+If using the clock specifiers, the pclk clock is optional, as not all
+systems may use one.
+
+
 Example:
 
 		timer1: timer@ffc09000 {
@@ -23,3 +34,11 @@ Example:
 				clock-frequency = <200000000>;
 				reg = <0xffd00000 0x1000>;
 			};
+
+		timer3: timer@ffe00000 {
+				compatible = "snps,dw-apb-timer-osc";
+				interrupts = <0 170 4>;
+				reg = <0xffe00000 0x1000>;
+				clocks = <&timer_clk>, <&timer_pclk>;
+				clock-names = "timer", "pclk";
+			};
diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index d6c0fda..1964f87 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -20,6 +20,7 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/clk.h>
 
 #include <asm/mach/time.h>
 #include <asm/sched_clock.h>
@@ -27,14 +28,37 @@
 static void timer_get_base_and_rate(struct device_node *np,
 				    void __iomem **base, u32 *rate)
 {
+	struct clk *timer_clk;
+	struct clk *pclk;
+
 	*base = of_iomap(np, 0);
 
 	if (!*base)
 		panic("Unable to map regs for %s", np->name);
 
+	/*
+	 * Not all implementations use a periphal clock, so don't panic
+	 * if it's not present
+	 */
+	pclk = of_clk_get_by_name(np, "pclk");
+	if (!IS_ERR(pclk))
+		if (clk_prepare_enable(pclk))
+			pr_warn("pclk for %s is present, but could not be activated\n",
+				np->name);
+
+	timer_clk = of_clk_get_by_name(np, "timer");
+	if (IS_ERR(timer_clk))
+		goto try_clock_freq;
+
+	if (!clk_prepare_enable(timer_clk)) {
+		*rate = clk_get_rate(timer_clk);
+		return;
+	}
+
+try_clock_freq:
 	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);
+		panic("No clock nor clock-frequency property for %s", np->name);
 }
 
 static void add_clockevent(struct device_node *event_timer)
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v2 2/4] clocksource: dw_apb_timer_of: add clock-handling
@ 2013-06-04  9:37   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:37 UTC (permalink / raw)
  To: John Stultz, Thomas Gleixner
  Cc: Baruch Siach, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Grant Likely,
	Jamie Iles, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Add the possibility to get the clock-frequency from a timer clock instead
of specifying it as dt property. Additionally also add the possibility
to also define a controlling periphal clock for the timer block.

The clock-frequency property is kept to act as fallback if no clocks
are specified.

Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
 Documentation/devicetree/bindings/rtc/dw-apb.txt |   19 ++++++++++++++++
 drivers/clocksource/dw_apb_timer_of.c            |   26 +++++++++++++++++++++-
 2 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/rtc/dw-apb.txt b/Documentation/devicetree/bindings/rtc/dw-apb.txt
index 93e2b0f..eb2327b 100644
--- a/Documentation/devicetree/bindings/rtc/dw-apb.txt
+++ b/Documentation/devicetree/bindings/rtc/dw-apb.txt
@@ -5,9 +5,20 @@ Required properties:
 - reg: physical base address of the controller and length of memory mapped
   region.
 - interrupts: IRQ line for the timer.
+- either clocks+clock-names or clock-frequency properties
+
+Optional properties:
+- clocks	: list of clock specifiers, corresponding to entries in
+		  the clock-names property;
+- clock-names	: should contain "timer" and "pclk" entries, matching entries
+		  in the clocks property.
 - clock-frequency: The frequency in HZ of the timer.
 - clock-freq: For backwards compatibility with picoxcell
 
+If using the clock specifiers, the pclk clock is optional, as not all
+systems may use one.
+
+
 Example:
 
 		timer1: timer@ffc09000 {
@@ -23,3 +34,11 @@ Example:
 				clock-frequency = <200000000>;
 				reg = <0xffd00000 0x1000>;
 			};
+
+		timer3: timer@ffe00000 {
+				compatible = "snps,dw-apb-timer-osc";
+				interrupts = <0 170 4>;
+				reg = <0xffe00000 0x1000>;
+				clocks = <&timer_clk>, <&timer_pclk>;
+				clock-names = "timer", "pclk";
+			};
diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index d6c0fda..1964f87 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -20,6 +20,7 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/clk.h>
 
 #include <asm/mach/time.h>
 #include <asm/sched_clock.h>
@@ -27,14 +28,37 @@
 static void timer_get_base_and_rate(struct device_node *np,
 				    void __iomem **base, u32 *rate)
 {
+	struct clk *timer_clk;
+	struct clk *pclk;
+
 	*base = of_iomap(np, 0);
 
 	if (!*base)
 		panic("Unable to map regs for %s", np->name);
 
+	/*
+	 * Not all implementations use a periphal clock, so don't panic
+	 * if it's not present
+	 */
+	pclk = of_clk_get_by_name(np, "pclk");
+	if (!IS_ERR(pclk))
+		if (clk_prepare_enable(pclk))
+			pr_warn("pclk for %s is present, but could not be activated\n",
+				np->name);
+
+	timer_clk = of_clk_get_by_name(np, "timer");
+	if (IS_ERR(timer_clk))
+		goto try_clock_freq;
+
+	if (!clk_prepare_enable(timer_clk)) {
+		*rate = clk_get_rate(timer_clk);
+		return;
+	}
+
+try_clock_freq:
 	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);
+		panic("No clock nor clock-frequency property for %s", np->name);
 }
 
 static void add_clockevent(struct device_node *event_timer)
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v2 2/4] clocksource: dw_apb_timer_of: add clock-handling
@ 2013-06-04  9:37   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:37 UTC (permalink / raw)
  To: linux-arm-kernel

Add the possibility to get the clock-frequency from a timer clock instead
of specifying it as dt property. Additionally also add the possibility
to also define a controlling periphal clock for the timer block.

The clock-frequency property is kept to act as fallback if no clocks
are specified.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 Documentation/devicetree/bindings/rtc/dw-apb.txt |   19 ++++++++++++++++
 drivers/clocksource/dw_apb_timer_of.c            |   26 +++++++++++++++++++++-
 2 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/rtc/dw-apb.txt b/Documentation/devicetree/bindings/rtc/dw-apb.txt
index 93e2b0f..eb2327b 100644
--- a/Documentation/devicetree/bindings/rtc/dw-apb.txt
+++ b/Documentation/devicetree/bindings/rtc/dw-apb.txt
@@ -5,9 +5,20 @@ Required properties:
 - reg: physical base address of the controller and length of memory mapped
   region.
 - interrupts: IRQ line for the timer.
+- either clocks+clock-names or clock-frequency properties
+
+Optional properties:
+- clocks	: list of clock specifiers, corresponding to entries in
+		  the clock-names property;
+- clock-names	: should contain "timer" and "pclk" entries, matching entries
+		  in the clocks property.
 - clock-frequency: The frequency in HZ of the timer.
 - clock-freq: For backwards compatibility with picoxcell
 
+If using the clock specifiers, the pclk clock is optional, as not all
+systems may use one.
+
+
 Example:
 
 		timer1: timer at ffc09000 {
@@ -23,3 +34,11 @@ Example:
 				clock-frequency = <200000000>;
 				reg = <0xffd00000 0x1000>;
 			};
+
+		timer3: timer at ffe00000 {
+				compatible = "snps,dw-apb-timer-osc";
+				interrupts = <0 170 4>;
+				reg = <0xffe00000 0x1000>;
+				clocks = <&timer_clk>, <&timer_pclk>;
+				clock-names = "timer", "pclk";
+			};
diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index d6c0fda..1964f87 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -20,6 +20,7 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/clk.h>
 
 #include <asm/mach/time.h>
 #include <asm/sched_clock.h>
@@ -27,14 +28,37 @@
 static void timer_get_base_and_rate(struct device_node *np,
 				    void __iomem **base, u32 *rate)
 {
+	struct clk *timer_clk;
+	struct clk *pclk;
+
 	*base = of_iomap(np, 0);
 
 	if (!*base)
 		panic("Unable to map regs for %s", np->name);
 
+	/*
+	 * Not all implementations use a periphal clock, so don't panic
+	 * if it's not present
+	 */
+	pclk = of_clk_get_by_name(np, "pclk");
+	if (!IS_ERR(pclk))
+		if (clk_prepare_enable(pclk))
+			pr_warn("pclk for %s is present, but could not be activated\n",
+				np->name);
+
+	timer_clk = of_clk_get_by_name(np, "timer");
+	if (IS_ERR(timer_clk))
+		goto try_clock_freq;
+
+	if (!clk_prepare_enable(timer_clk)) {
+		*rate = clk_get_rate(timer_clk);
+		return;
+	}
+
+try_clock_freq:
 	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);
+		panic("No clock nor clock-frequency property for %s", np->name);
 }
 
 static void add_clockevent(struct device_node *event_timer)
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v2 3/4] clocksource: dw_apb_timer_of: select DW_APB_TIMER
@ 2013-06-04  9:38   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:38 UTC (permalink / raw)
  To: John Stultz
  Cc: Thomas Gleixner, Jamie Iles, Dinh Nguyen, Grant Likely,
	linux-arm-kernel, Rob Herring, devicetree-discuss, linux-kernel,
	Arnd Bergmann, Linus Walleij, Baruch Siach

dw_apb_timer_of is the driver part facing devicetree platforms and
calls into dw_apb_timer with the data gathered from the dt.

Currently the two platforms using the dw_apb_timer_of select both
the options for the core timer and the dt addon.

As dw_apb_timer_of always depends on dw_apb_timer let it select
DW_APB_TIMER itself without the need for every platform to do it.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/mach-picoxcell/Kconfig |    1 -
 arch/arm/mach-socfpga/Kconfig   |    1 -
 drivers/clocksource/Kconfig     |    1 +
 3 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-picoxcell/Kconfig b/arch/arm/mach-picoxcell/Kconfig
index 13bae78..b1022f4 100644
--- a/arch/arm/mach-picoxcell/Kconfig
+++ b/arch/arm/mach-picoxcell/Kconfig
@@ -4,7 +4,6 @@ config ARCH_PICOXCELL
 	select ARM_PATCH_PHYS_VIRT
 	select ARM_VIC
 	select CPU_V6K
-	select DW_APB_TIMER
 	select DW_APB_TIMER_OF
 	select GENERIC_CLOCKEVENTS
 	select HAVE_TCM
diff --git a/arch/arm/mach-socfpga/Kconfig b/arch/arm/mach-socfpga/Kconfig
index 566e804..a279fb3 100644
--- a/arch/arm/mach-socfpga/Kconfig
+++ b/arch/arm/mach-socfpga/Kconfig
@@ -7,7 +7,6 @@ config ARCH_SOCFPGA
 	select CLKDEV_LOOKUP
 	select COMMON_CLK
 	select CPU_V7
-	select DW_APB_TIMER
 	select DW_APB_TIMER_OF
 	select GENERIC_CLOCKEVENTS
 	select GPIO_PL061 if GPIOLIB
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index f151c6c..48a0f2e 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -21,6 +21,7 @@ config DW_APB_TIMER
 
 config DW_APB_TIMER_OF
 	bool
+	select DW_APB_TIMER
 
 config ARMADA_370_XP_TIMER
 	bool
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v2 3/4] clocksource: dw_apb_timer_of: select DW_APB_TIMER
@ 2013-06-04  9:38   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:38 UTC (permalink / raw)
  To: John Stultz
  Cc: Baruch Siach, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Grant Likely,
	Jamie Iles, Thomas Gleixner,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

dw_apb_timer_of is the driver part facing devicetree platforms and
calls into dw_apb_timer with the data gathered from the dt.

Currently the two platforms using the dw_apb_timer_of select both
the options for the core timer and the dt addon.

As dw_apb_timer_of always depends on dw_apb_timer let it select
DW_APB_TIMER itself without the need for every platform to do it.

Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
 arch/arm/mach-picoxcell/Kconfig |    1 -
 arch/arm/mach-socfpga/Kconfig   |    1 -
 drivers/clocksource/Kconfig     |    1 +
 3 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-picoxcell/Kconfig b/arch/arm/mach-picoxcell/Kconfig
index 13bae78..b1022f4 100644
--- a/arch/arm/mach-picoxcell/Kconfig
+++ b/arch/arm/mach-picoxcell/Kconfig
@@ -4,7 +4,6 @@ config ARCH_PICOXCELL
 	select ARM_PATCH_PHYS_VIRT
 	select ARM_VIC
 	select CPU_V6K
-	select DW_APB_TIMER
 	select DW_APB_TIMER_OF
 	select GENERIC_CLOCKEVENTS
 	select HAVE_TCM
diff --git a/arch/arm/mach-socfpga/Kconfig b/arch/arm/mach-socfpga/Kconfig
index 566e804..a279fb3 100644
--- a/arch/arm/mach-socfpga/Kconfig
+++ b/arch/arm/mach-socfpga/Kconfig
@@ -7,7 +7,6 @@ config ARCH_SOCFPGA
 	select CLKDEV_LOOKUP
 	select COMMON_CLK
 	select CPU_V7
-	select DW_APB_TIMER
 	select DW_APB_TIMER_OF
 	select GENERIC_CLOCKEVENTS
 	select GPIO_PL061 if GPIOLIB
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index f151c6c..48a0f2e 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -21,6 +21,7 @@ config DW_APB_TIMER
 
 config DW_APB_TIMER_OF
 	bool
+	select DW_APB_TIMER
 
 config ARMADA_370_XP_TIMER
 	bool
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v2 3/4] clocksource: dw_apb_timer_of: select DW_APB_TIMER
@ 2013-06-04  9:38   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

dw_apb_timer_of is the driver part facing devicetree platforms and
calls into dw_apb_timer with the data gathered from the dt.

Currently the two platforms using the dw_apb_timer_of select both
the options for the core timer and the dt addon.

As dw_apb_timer_of always depends on dw_apb_timer let it select
DW_APB_TIMER itself without the need for every platform to do it.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/mach-picoxcell/Kconfig |    1 -
 arch/arm/mach-socfpga/Kconfig   |    1 -
 drivers/clocksource/Kconfig     |    1 +
 3 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-picoxcell/Kconfig b/arch/arm/mach-picoxcell/Kconfig
index 13bae78..b1022f4 100644
--- a/arch/arm/mach-picoxcell/Kconfig
+++ b/arch/arm/mach-picoxcell/Kconfig
@@ -4,7 +4,6 @@ config ARCH_PICOXCELL
 	select ARM_PATCH_PHYS_VIRT
 	select ARM_VIC
 	select CPU_V6K
-	select DW_APB_TIMER
 	select DW_APB_TIMER_OF
 	select GENERIC_CLOCKEVENTS
 	select HAVE_TCM
diff --git a/arch/arm/mach-socfpga/Kconfig b/arch/arm/mach-socfpga/Kconfig
index 566e804..a279fb3 100644
--- a/arch/arm/mach-socfpga/Kconfig
+++ b/arch/arm/mach-socfpga/Kconfig
@@ -7,7 +7,6 @@ config ARCH_SOCFPGA
 	select CLKDEV_LOOKUP
 	select COMMON_CLK
 	select CPU_V7
-	select DW_APB_TIMER
 	select DW_APB_TIMER_OF
 	select GENERIC_CLOCKEVENTS
 	select GPIO_PL061 if GPIOLIB
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index f151c6c..48a0f2e 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -21,6 +21,7 @@ config DW_APB_TIMER
 
 config DW_APB_TIMER_OF
 	bool
+	select DW_APB_TIMER
 
 config ARMADA_370_XP_TIMER
 	bool
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init
@ 2013-06-04  9:38   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:38 UTC (permalink / raw)
  To: John Stultz
  Cc: Thomas Gleixner, Jamie Iles, Dinh Nguyen, Grant Likely,
	linux-arm-kernel, Rob Herring, devicetree-discuss, linux-kernel,
	Arnd Bergmann, Linus Walleij, Baruch Siach

dw_apb_timer_init used to search the devicetree for matching timer
devices, making calls to it from board files necessary.

Change the dw_apb_timer_init to work with CLOCKSOURCE_OF_DECLARE.
With this change the function gets called once for each timer node
and tracks these number of calls to attach clockevent and clocksource
devices to the nodes.

Also remove the calls to dw_apb_timer_init from all previous users, as
clocksource_of_init is the default for init_time now.

Tested on the upcoming rk3066 code.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-picoxcell/common.c      |    2 -
 arch/arm/mach-socfpga/socfpga.c       |    2 -
 drivers/clocksource/Kconfig           |    1 +
 drivers/clocksource/dw_apb_timer_of.c |   41 ++++++++++++++++-----------------
 include/linux/dw_apb_timer.h          |    1 -
 5 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-picoxcell/common.c b/arch/arm/mach-picoxcell/common.c
index 70b441a..7cde042 100644
--- a/arch/arm/mach-picoxcell/common.c
+++ b/arch/arm/mach-picoxcell/common.c
@@ -15,7 +15,6 @@
 #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/mach/map.h>
@@ -88,7 +87,6 @@ DT_MACHINE_START(PICOXCELL, "Picochip picoXcell")
 	.map_io		= picoxcell_map_io,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= irqchip_init,
-	.init_time	= dw_apb_timer_init,
 	.init_machine	= picoxcell_init_machine,
 	.dt_compat	= picoxcell_dt_match,
 	.restart	= picoxcell_wdt_restart,
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index 46a0513..8ea11b47 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -14,7 +14,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-#include <linux/dw_apb_timer.h>
 #include <linux/clk-provider.h>
 #include <linux/irqchip.h>
 #include <linux/of_address.h>
@@ -120,7 +119,6 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA")
 	.smp		= smp_ops(socfpga_smp_ops),
 	.map_io		= socfpga_map_io,
 	.init_irq	= socfpga_init_irq,
-	.init_time	= dw_apb_timer_init,
 	.init_machine	= socfpga_cyclone5_init,
 	.restart	= socfpga_cyclone5_restart,
 	.dt_compat	= altera_dt_match,
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 48a0f2e..5871933 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -22,6 +22,7 @@ config DW_APB_TIMER
 config DW_APB_TIMER_OF
 	bool
 	select DW_APB_TIMER
+	select CLKSRC_OF
 
 config ARMADA_370_XP_TIMER
 	bool
diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index 1964f87..cef5544 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -133,27 +133,26 @@ static void init_sched_clock(void)
 	setup_sched_clock(read_sched_clock, 32, sched_rate);
 }
 
-static const struct of_device_id osctimer_ids[] __initconst = {
-	{ .compatible = "picochip,pc3x2-timer" },
-	{ .compatible = "snps,dw-apb-timer-osc" },
-	{},
-};
-
-void __init dw_apb_timer_init(void)
+static int num_called;
+static void __init dw_apb_timer_init(struct device_node *timer)
 {
-	struct device_node *event_timer, *source_timer;
-
-	event_timer = of_find_matching_node(NULL, osctimer_ids);
-	if (!event_timer)
-		panic("No timer for clockevent");
-	add_clockevent(event_timer);
-
-	source_timer = of_find_matching_node(event_timer, osctimer_ids);
-	if (!source_timer)
-		panic("No timer for clocksource");
-	add_clocksource(source_timer);
-
-	of_node_put(source_timer);
+	switch (num_called) {
+	case 0:
+		pr_debug("%s: found clockevent timer\n", __func__);
+		add_clockevent(timer);
+		of_node_put(timer);
+		break;
+	case 1:
+		pr_debug("%s: found clocksource timer\n", __func__);
+		add_clocksource(timer);
+		of_node_put(timer);
+		init_sched_clock();
+		break;
+	default:
+		break;
+	}
 
-	init_sched_clock();
+	num_called++;
 }
+CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init);
+CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init);
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
index dd755ce..07261d5 100644
--- a/include/linux/dw_apb_timer.h
+++ b/include/linux/dw_apb_timer.h
@@ -53,5 +53,4 @@ void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
 cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
 void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs);
 
-extern void dw_apb_timer_init(void);
 #endif /* __DW_APB_TIMER_H__ */
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init
@ 2013-06-04  9:38   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:38 UTC (permalink / raw)
  To: John Stultz
  Cc: Baruch Siach, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Grant Likely,
	Jamie Iles, Thomas Gleixner,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

dw_apb_timer_init used to search the devicetree for matching timer
devices, making calls to it from board files necessary.

Change the dw_apb_timer_init to work with CLOCKSOURCE_OF_DECLARE.
With this change the function gets called once for each timer node
and tracks these number of calls to attach clockevent and clocksource
devices to the nodes.

Also remove the calls to dw_apb_timer_init from all previous users, as
clocksource_of_init is the default for init_time now.

Tested on the upcoming rk3066 code.

Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
Acked-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
 arch/arm/mach-picoxcell/common.c      |    2 -
 arch/arm/mach-socfpga/socfpga.c       |    2 -
 drivers/clocksource/Kconfig           |    1 +
 drivers/clocksource/dw_apb_timer_of.c |   41 ++++++++++++++++-----------------
 include/linux/dw_apb_timer.h          |    1 -
 5 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-picoxcell/common.c b/arch/arm/mach-picoxcell/common.c
index 70b441a..7cde042 100644
--- a/arch/arm/mach-picoxcell/common.c
+++ b/arch/arm/mach-picoxcell/common.c
@@ -15,7 +15,6 @@
 #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/mach/map.h>
@@ -88,7 +87,6 @@ DT_MACHINE_START(PICOXCELL, "Picochip picoXcell")
 	.map_io		= picoxcell_map_io,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= irqchip_init,
-	.init_time	= dw_apb_timer_init,
 	.init_machine	= picoxcell_init_machine,
 	.dt_compat	= picoxcell_dt_match,
 	.restart	= picoxcell_wdt_restart,
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index 46a0513..8ea11b47 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -14,7 +14,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-#include <linux/dw_apb_timer.h>
 #include <linux/clk-provider.h>
 #include <linux/irqchip.h>
 #include <linux/of_address.h>
@@ -120,7 +119,6 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA")
 	.smp		= smp_ops(socfpga_smp_ops),
 	.map_io		= socfpga_map_io,
 	.init_irq	= socfpga_init_irq,
-	.init_time	= dw_apb_timer_init,
 	.init_machine	= socfpga_cyclone5_init,
 	.restart	= socfpga_cyclone5_restart,
 	.dt_compat	= altera_dt_match,
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 48a0f2e..5871933 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -22,6 +22,7 @@ config DW_APB_TIMER
 config DW_APB_TIMER_OF
 	bool
 	select DW_APB_TIMER
+	select CLKSRC_OF
 
 config ARMADA_370_XP_TIMER
 	bool
diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index 1964f87..cef5544 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -133,27 +133,26 @@ static void init_sched_clock(void)
 	setup_sched_clock(read_sched_clock, 32, sched_rate);
 }
 
-static const struct of_device_id osctimer_ids[] __initconst = {
-	{ .compatible = "picochip,pc3x2-timer" },
-	{ .compatible = "snps,dw-apb-timer-osc" },
-	{},
-};
-
-void __init dw_apb_timer_init(void)
+static int num_called;
+static void __init dw_apb_timer_init(struct device_node *timer)
 {
-	struct device_node *event_timer, *source_timer;
-
-	event_timer = of_find_matching_node(NULL, osctimer_ids);
-	if (!event_timer)
-		panic("No timer for clockevent");
-	add_clockevent(event_timer);
-
-	source_timer = of_find_matching_node(event_timer, osctimer_ids);
-	if (!source_timer)
-		panic("No timer for clocksource");
-	add_clocksource(source_timer);
-
-	of_node_put(source_timer);
+	switch (num_called) {
+	case 0:
+		pr_debug("%s: found clockevent timer\n", __func__);
+		add_clockevent(timer);
+		of_node_put(timer);
+		break;
+	case 1:
+		pr_debug("%s: found clocksource timer\n", __func__);
+		add_clocksource(timer);
+		of_node_put(timer);
+		init_sched_clock();
+		break;
+	default:
+		break;
+	}
 
-	init_sched_clock();
+	num_called++;
 }
+CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init);
+CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init);
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
index dd755ce..07261d5 100644
--- a/include/linux/dw_apb_timer.h
+++ b/include/linux/dw_apb_timer.h
@@ -53,5 +53,4 @@ void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
 cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
 void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs);
 
-extern void dw_apb_timer_init(void);
 #endif /* __DW_APB_TIMER_H__ */
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init
@ 2013-06-04  9:38   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

dw_apb_timer_init used to search the devicetree for matching timer
devices, making calls to it from board files necessary.

Change the dw_apb_timer_init to work with CLOCKSOURCE_OF_DECLARE.
With this change the function gets called once for each timer node
and tracks these number of calls to attach clockevent and clocksource
devices to the nodes.

Also remove the calls to dw_apb_timer_init from all previous users, as
clocksource_of_init is the default for init_time now.

Tested on the upcoming rk3066 code.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-picoxcell/common.c      |    2 -
 arch/arm/mach-socfpga/socfpga.c       |    2 -
 drivers/clocksource/Kconfig           |    1 +
 drivers/clocksource/dw_apb_timer_of.c |   41 ++++++++++++++++-----------------
 include/linux/dw_apb_timer.h          |    1 -
 5 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-picoxcell/common.c b/arch/arm/mach-picoxcell/common.c
index 70b441a..7cde042 100644
--- a/arch/arm/mach-picoxcell/common.c
+++ b/arch/arm/mach-picoxcell/common.c
@@ -15,7 +15,6 @@
 #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/mach/map.h>
@@ -88,7 +87,6 @@ DT_MACHINE_START(PICOXCELL, "Picochip picoXcell")
 	.map_io		= picoxcell_map_io,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= irqchip_init,
-	.init_time	= dw_apb_timer_init,
 	.init_machine	= picoxcell_init_machine,
 	.dt_compat	= picoxcell_dt_match,
 	.restart	= picoxcell_wdt_restart,
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index 46a0513..8ea11b47 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -14,7 +14,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-#include <linux/dw_apb_timer.h>
 #include <linux/clk-provider.h>
 #include <linux/irqchip.h>
 #include <linux/of_address.h>
@@ -120,7 +119,6 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA")
 	.smp		= smp_ops(socfpga_smp_ops),
 	.map_io		= socfpga_map_io,
 	.init_irq	= socfpga_init_irq,
-	.init_time	= dw_apb_timer_init,
 	.init_machine	= socfpga_cyclone5_init,
 	.restart	= socfpga_cyclone5_restart,
 	.dt_compat	= altera_dt_match,
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 48a0f2e..5871933 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -22,6 +22,7 @@ config DW_APB_TIMER
 config DW_APB_TIMER_OF
 	bool
 	select DW_APB_TIMER
+	select CLKSRC_OF
 
 config ARMADA_370_XP_TIMER
 	bool
diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index 1964f87..cef5544 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -133,27 +133,26 @@ static void init_sched_clock(void)
 	setup_sched_clock(read_sched_clock, 32, sched_rate);
 }
 
-static const struct of_device_id osctimer_ids[] __initconst = {
-	{ .compatible = "picochip,pc3x2-timer" },
-	{ .compatible = "snps,dw-apb-timer-osc" },
-	{},
-};
-
-void __init dw_apb_timer_init(void)
+static int num_called;
+static void __init dw_apb_timer_init(struct device_node *timer)
 {
-	struct device_node *event_timer, *source_timer;
-
-	event_timer = of_find_matching_node(NULL, osctimer_ids);
-	if (!event_timer)
-		panic("No timer for clockevent");
-	add_clockevent(event_timer);
-
-	source_timer = of_find_matching_node(event_timer, osctimer_ids);
-	if (!source_timer)
-		panic("No timer for clocksource");
-	add_clocksource(source_timer);
-
-	of_node_put(source_timer);
+	switch (num_called) {
+	case 0:
+		pr_debug("%s: found clockevent timer\n", __func__);
+		add_clockevent(timer);
+		of_node_put(timer);
+		break;
+	case 1:
+		pr_debug("%s: found clocksource timer\n", __func__);
+		add_clocksource(timer);
+		of_node_put(timer);
+		init_sched_clock();
+		break;
+	default:
+		break;
+	}
 
-	init_sched_clock();
+	num_called++;
 }
+CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init);
+CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init);
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
index dd755ce..07261d5 100644
--- a/include/linux/dw_apb_timer.h
+++ b/include/linux/dw_apb_timer.h
@@ -53,5 +53,4 @@ void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
 cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
 void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs);
 
-extern void dw_apb_timer_init(void);
 #endif /* __DW_APB_TIMER_H__ */
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 1/4] clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
@ 2013-06-04 10:52     ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04 10:52 UTC (permalink / raw)
  To: John Stultz
  Cc: Thomas Gleixner, Jamie Iles, Dinh Nguyen, Grant Likely,
	linux-arm-kernel, Rob Herring, devicetree-discuss, linux-kernel,
	Arnd Bergmann, Linus Walleij, Baruch Siach

Am Dienstag, 4. Juni 2013, 11:37:02 schrieb Heiko Stübner:
> Currently the dw_apb_timer always expects a separate special timer to be
> availbable for the sched_clock. Some devices using dw_apb_timers do not
> have this sptimer but can use the clocksource as sched_clock instead.
> 
> Therefore enable the driver to distiguish between devices with and without
> sptimer based on the devicetree data and select the correct timer as
> sched_clock.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

in the original thread "arm: add basic support for Rockchip Cortex-A9 SoCs" 
this patch with the updated description now also got a


Acked-by: Linus Walleij <linus.walleij@linaro.org>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 1/4] clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
@ 2013-06-04 10:52     ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04 10:52 UTC (permalink / raw)
  To: John Stultz
  Cc: Baruch Siach, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Grant Likely,
	Jamie Iles, Thomas Gleixner,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Am Dienstag, 4. Juni 2013, 11:37:02 schrieb Heiko Stübner:
> Currently the dw_apb_timer always expects a separate special timer to be
> availbable for the sched_clock. Some devices using dw_apb_timers do not
> have this sptimer but can use the clocksource as sched_clock instead.
> 
> Therefore enable the driver to distiguish between devices with and without
> sptimer based on the devicetree data and select the correct timer as
> sched_clock.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

in the original thread "arm: add basic support for Rockchip Cortex-A9 SoCs" 
this patch with the updated description now also got a


Acked-by: Linus Walleij <linus.walleij@linaro.org>
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 1/4] clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
@ 2013-06-04 10:52     ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04 10:52 UTC (permalink / raw)
  To: linux-arm-kernel

Am Dienstag, 4. Juni 2013, 11:37:02 schrieb Heiko St?bner:
> Currently the dw_apb_timer always expects a separate special timer to be
> availbable for the sched_clock. Some devices using dw_apb_timers do not
> have this sptimer but can use the clocksource as sched_clock instead.
> 
> Therefore enable the driver to distiguish between devices with and without
> sptimer based on the devicetree data and select the correct timer as
> sched_clock.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

in the original thread "arm: add basic support for Rockchip Cortex-A9 SoCs" 
this patch with the updated description now also got a


Acked-by: Linus Walleij <linus.walleij@linaro.org>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 1/4] clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
  2013-06-04  9:37   ` Heiko Stübner
@ 2013-06-04 14:13     ` Jamie Iles
  -1 siblings, 0 replies; 44+ messages in thread
From: Jamie Iles @ 2013-06-04 14:13 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: John Stultz, Thomas Gleixner, Jamie Iles, Dinh Nguyen,
	Grant Likely, linux-arm-kernel, Rob Herring, devicetree-discuss,
	linux-kernel, Arnd Bergmann, Linus Walleij, Baruch Siach

Looks goot to me, Heiko!

On Tue, Jun 04, 2013 at 11:37:02AM +0200, Heiko Stübner wrote:
> Currently the dw_apb_timer always expects a separate special timer to be
> availbable for the sched_clock. Some devices using dw_apb_timers do not
> have this sptimer but can use the clocksource as sched_clock instead.
> 
> Therefore enable the driver to distiguish between devices with and without
> sptimer based on the devicetree data and select the correct timer as
> sched_clock.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Acked-by: Jamie Iles <jamie@jamieiles.com>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 1/4] clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
@ 2013-06-04 14:13     ` Jamie Iles
  0 siblings, 0 replies; 44+ messages in thread
From: Jamie Iles @ 2013-06-04 14:13 UTC (permalink / raw)
  To: linux-arm-kernel

Looks goot to me, Heiko!

On Tue, Jun 04, 2013 at 11:37:02AM +0200, Heiko St?bner wrote:
> Currently the dw_apb_timer always expects a separate special timer to be
> availbable for the sched_clock. Some devices using dw_apb_timers do not
> have this sptimer but can use the clocksource as sched_clock instead.
> 
> Therefore enable the driver to distiguish between devices with and without
> sptimer based on the devicetree data and select the correct timer as
> sched_clock.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Acked-by: Jamie Iles <jamie@jamieiles.com>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 2/4] clocksource: dw_apb_timer_of: add clock-handling
  2013-06-04  9:37   ` Heiko Stübner
@ 2013-06-04 14:15     ` Jamie Iles
  -1 siblings, 0 replies; 44+ messages in thread
From: Jamie Iles @ 2013-06-04 14:15 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: John Stultz, Thomas Gleixner, Jamie Iles, Dinh Nguyen,
	Grant Likely, linux-arm-kernel, Rob Herring, devicetree-discuss,
	linux-kernel, Arnd Bergmann, Linus Walleij, Baruch Siach

On Tue, Jun 04, 2013 at 11:37:36AM +0200, Heiko Stübner wrote:
> Add the possibility to get the clock-frequency from a timer clock instead
> of specifying it as dt property. Additionally also add the possibility
> to also define a controlling periphal clock for the timer block.
> 
> The clock-frequency property is kept to act as fallback if no clocks
> are specified.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Acked-by: Jamie Iles <jamie@jamieiles.com>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 2/4] clocksource: dw_apb_timer_of: add clock-handling
@ 2013-06-04 14:15     ` Jamie Iles
  0 siblings, 0 replies; 44+ messages in thread
From: Jamie Iles @ 2013-06-04 14:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 04, 2013 at 11:37:36AM +0200, Heiko St?bner wrote:
> Add the possibility to get the clock-frequency from a timer clock instead
> of specifying it as dt property. Additionally also add the possibility
> to also define a controlling periphal clock for the timer block.
> 
> The clock-frequency property is kept to act as fallback if no clocks
> are specified.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Acked-by: Jamie Iles <jamie@jamieiles.com>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 3/4] clocksource: dw_apb_timer_of: select DW_APB_TIMER
@ 2013-06-04 14:15     ` Jamie Iles
  0 siblings, 0 replies; 44+ messages in thread
From: Jamie Iles @ 2013-06-04 14:15 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: John Stultz, Thomas Gleixner, Jamie Iles, Dinh Nguyen,
	Grant Likely, linux-arm-kernel, Rob Herring, devicetree-discuss,
	linux-kernel, Arnd Bergmann, Linus Walleij, Baruch Siach

On Tue, Jun 04, 2013 at 11:38:11AM +0200, Heiko Stübner wrote:
> dw_apb_timer_of is the driver part facing devicetree platforms and
> calls into dw_apb_timer with the data gathered from the dt.
> 
> Currently the two platforms using the dw_apb_timer_of select both
> the options for the core timer and the dt addon.
> 
> As dw_apb_timer_of always depends on dw_apb_timer let it select
> DW_APB_TIMER itself without the need for every platform to do it.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Acked-by: Jamie Iles <jamie@jamieiles.com>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 3/4] clocksource: dw_apb_timer_of: select DW_APB_TIMER
@ 2013-06-04 14:15     ` Jamie Iles
  0 siblings, 0 replies; 44+ messages in thread
From: Jamie Iles @ 2013-06-04 14:15 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: Baruch Siach, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, John Stultz,
	Grant Likely, Jamie Iles, Thomas Gleixner,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Tue, Jun 04, 2013 at 11:38:11AM +0200, Heiko Stübner wrote:
> dw_apb_timer_of is the driver part facing devicetree platforms and
> calls into dw_apb_timer with the data gathered from the dt.
> 
> Currently the two platforms using the dw_apb_timer_of select both
> the options for the core timer and the dt addon.
> 
> As dw_apb_timer_of always depends on dw_apb_timer let it select
> DW_APB_TIMER itself without the need for every platform to do it.
> 
> Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>

Acked-by: Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 3/4] clocksource: dw_apb_timer_of: select DW_APB_TIMER
@ 2013-06-04 14:15     ` Jamie Iles
  0 siblings, 0 replies; 44+ messages in thread
From: Jamie Iles @ 2013-06-04 14:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 04, 2013 at 11:38:11AM +0200, Heiko St?bner wrote:
> dw_apb_timer_of is the driver part facing devicetree platforms and
> calls into dw_apb_timer with the data gathered from the dt.
> 
> Currently the two platforms using the dw_apb_timer_of select both
> the options for the core timer and the dt addon.
> 
> As dw_apb_timer_of always depends on dw_apb_timer let it select
> DW_APB_TIMER itself without the need for every platform to do it.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Acked-by: Jamie Iles <jamie@jamieiles.com>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init
@ 2013-06-04 14:21     ` Jamie Iles
  0 siblings, 0 replies; 44+ messages in thread
From: Jamie Iles @ 2013-06-04 14:21 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: John Stultz, Thomas Gleixner, Jamie Iles, Dinh Nguyen,
	Grant Likely, linux-arm-kernel, Rob Herring, devicetree-discuss,
	linux-kernel, Arnd Bergmann, Linus Walleij, Baruch Siach

Hi Heiko,

On Tue, Jun 04, 2013 at 11:38:42AM +0200, Heiko Stübner wrote:
> dw_apb_timer_init used to search the devicetree for matching timer
> devices, making calls to it from board files necessary.
> 
> Change the dw_apb_timer_init to work with CLOCKSOURCE_OF_DECLARE.
> With this change the function gets called once for each timer node
> and tracks these number of calls to attach clockevent and clocksource
> devices to the nodes.
> 
> Also remove the calls to dw_apb_timer_init from all previous users, as
> clocksource_of_init is the default for init_time now.
> 
> Tested on the upcoming rk3066 code.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> Acked-by: Rob Herring <rob.herring@calxeda.com>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> ---
...
> -void __init dw_apb_timer_init(void)
> +static int num_called;
> +static void __init dw_apb_timer_init(struct device_node *timer)
>  {
> -	struct device_node *event_timer, *source_timer;
> -
> -	event_timer = of_find_matching_node(NULL, osctimer_ids);
> -	if (!event_timer)
> -		panic("No timer for clockevent");
> -	add_clockevent(event_timer);
> -
> -	source_timer = of_find_matching_node(event_timer, osctimer_ids);
> -	if (!source_timer)
> -		panic("No timer for clocksource");
> -	add_clocksource(source_timer);
> -
> -	of_node_put(source_timer);
> +	switch (num_called) {
> +	case 0:
> +		pr_debug("%s: found clockevent timer\n", __func__);
> +		add_clockevent(timer);
> +		of_node_put(timer);
> +		break;
> +	case 1:
> +		pr_debug("%s: found clocksource timer\n", __func__);
> +		add_clocksource(timer);
> +		of_node_put(timer);
> +		init_sched_clock();
> +		break;
> +	default:
> +		break;
> +	}
>  
> -	init_sched_clock();
> +	num_called++;
>  }
> +CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init);
> +CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init);

I think maybe we also want CLOCKSOURCE_OF_DECLARE() instances for the 
contents of sptimer_ids for completeness, otherwise looks good.

Acked-by: Jamie Iles <jamie@jamieiles.com>

Thanks,

Jamie

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init
@ 2013-06-04 14:21     ` Jamie Iles
  0 siblings, 0 replies; 44+ messages in thread
From: Jamie Iles @ 2013-06-04 14:21 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: Baruch Siach, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, John Stultz,
	Grant Likely, Jamie Iles, Thomas Gleixner,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi Heiko,

On Tue, Jun 04, 2013 at 11:38:42AM +0200, Heiko Stübner wrote:
> dw_apb_timer_init used to search the devicetree for matching timer
> devices, making calls to it from board files necessary.
> 
> Change the dw_apb_timer_init to work with CLOCKSOURCE_OF_DECLARE.
> With this change the function gets called once for each timer node
> and tracks these number of calls to attach clockevent and clocksource
> devices to the nodes.
> 
> Also remove the calls to dw_apb_timer_init from all previous users, as
> clocksource_of_init is the default for init_time now.
> 
> Tested on the upcoming rk3066 code.
> 
> Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
> Acked-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> ---
...
> -void __init dw_apb_timer_init(void)
> +static int num_called;
> +static void __init dw_apb_timer_init(struct device_node *timer)
>  {
> -	struct device_node *event_timer, *source_timer;
> -
> -	event_timer = of_find_matching_node(NULL, osctimer_ids);
> -	if (!event_timer)
> -		panic("No timer for clockevent");
> -	add_clockevent(event_timer);
> -
> -	source_timer = of_find_matching_node(event_timer, osctimer_ids);
> -	if (!source_timer)
> -		panic("No timer for clocksource");
> -	add_clocksource(source_timer);
> -
> -	of_node_put(source_timer);
> +	switch (num_called) {
> +	case 0:
> +		pr_debug("%s: found clockevent timer\n", __func__);
> +		add_clockevent(timer);
> +		of_node_put(timer);
> +		break;
> +	case 1:
> +		pr_debug("%s: found clocksource timer\n", __func__);
> +		add_clocksource(timer);
> +		of_node_put(timer);
> +		init_sched_clock();
> +		break;
> +	default:
> +		break;
> +	}
>  
> -	init_sched_clock();
> +	num_called++;
>  }
> +CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init);
> +CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init);

I think maybe we also want CLOCKSOURCE_OF_DECLARE() instances for the 
contents of sptimer_ids for completeness, otherwise looks good.

Acked-by: Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>

Thanks,

Jamie

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init
@ 2013-06-04 14:21     ` Jamie Iles
  0 siblings, 0 replies; 44+ messages in thread
From: Jamie Iles @ 2013-06-04 14:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Heiko,

On Tue, Jun 04, 2013 at 11:38:42AM +0200, Heiko St?bner wrote:
> dw_apb_timer_init used to search the devicetree for matching timer
> devices, making calls to it from board files necessary.
> 
> Change the dw_apb_timer_init to work with CLOCKSOURCE_OF_DECLARE.
> With this change the function gets called once for each timer node
> and tracks these number of calls to attach clockevent and clocksource
> devices to the nodes.
> 
> Also remove the calls to dw_apb_timer_init from all previous users, as
> clocksource_of_init is the default for init_time now.
> 
> Tested on the upcoming rk3066 code.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> Acked-by: Rob Herring <rob.herring@calxeda.com>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> ---
...
> -void __init dw_apb_timer_init(void)
> +static int num_called;
> +static void __init dw_apb_timer_init(struct device_node *timer)
>  {
> -	struct device_node *event_timer, *source_timer;
> -
> -	event_timer = of_find_matching_node(NULL, osctimer_ids);
> -	if (!event_timer)
> -		panic("No timer for clockevent");
> -	add_clockevent(event_timer);
> -
> -	source_timer = of_find_matching_node(event_timer, osctimer_ids);
> -	if (!source_timer)
> -		panic("No timer for clocksource");
> -	add_clocksource(source_timer);
> -
> -	of_node_put(source_timer);
> +	switch (num_called) {
> +	case 0:
> +		pr_debug("%s: found clockevent timer\n", __func__);
> +		add_clockevent(timer);
> +		of_node_put(timer);
> +		break;
> +	case 1:
> +		pr_debug("%s: found clocksource timer\n", __func__);
> +		add_clocksource(timer);
> +		of_node_put(timer);
> +		init_sched_clock();
> +		break;
> +	default:
> +		break;
> +	}
>  
> -	init_sched_clock();
> +	num_called++;
>  }
> +CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init);
> +CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init);

I think maybe we also want CLOCKSOURCE_OF_DECLARE() instances for the 
contents of sptimer_ids for completeness, otherwise looks good.

Acked-by: Jamie Iles <jamie@jamieiles.com>

Thanks,

Jamie

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init
  2013-06-04 14:21     ` Jamie Iles
  (?)
@ 2013-06-04 15:06       ` Heiko Stübner
  -1 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04 15:06 UTC (permalink / raw)
  To: Jamie Iles
  Cc: John Stultz, Thomas Gleixner, Dinh Nguyen, Grant Likely,
	linux-arm-kernel, Rob Herring, devicetree-discuss, linux-kernel,
	Arnd Bergmann, Linus Walleij, Baruch Siach

Am Dienstag, 4. Juni 2013, 16:21:20 schrieb Jamie Iles:
> Hi Heiko,
> 
> On Tue, Jun 04, 2013 at 11:38:42AM +0200, Heiko Stübner wrote:
> > dw_apb_timer_init used to search the devicetree for matching timer
> > devices, making calls to it from board files necessary.
> > 
> > Change the dw_apb_timer_init to work with CLOCKSOURCE_OF_DECLARE.
> > With this change the function gets called once for each timer node
> > and tracks these number of calls to attach clockevent and clocksource
> > devices to the nodes.
> > 
> > Also remove the calls to dw_apb_timer_init from all previous users, as
> > clocksource_of_init is the default for init_time now.
> > 
> > Tested on the upcoming rk3066 code.
> > 
> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > Acked-by: Rob Herring <rob.herring@calxeda.com>
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> 
> ...
> 
> > -void __init dw_apb_timer_init(void)
> > +static int num_called;
> > +static void __init dw_apb_timer_init(struct device_node *timer)
> > 
> >  {
> > 
> > -	struct device_node *event_timer, *source_timer;
> > -
> > -	event_timer = of_find_matching_node(NULL, osctimer_ids);
> > -	if (!event_timer)
> > -		panic("No timer for clockevent");
> > -	add_clockevent(event_timer);
> > -
> > -	source_timer = of_find_matching_node(event_timer, osctimer_ids);
> > -	if (!source_timer)
> > -		panic("No timer for clocksource");
> > -	add_clocksource(source_timer);
> > -
> > -	of_node_put(source_timer);
> > +	switch (num_called) {
> > +	case 0:
> > +		pr_debug("%s: found clockevent timer\n", __func__);
> > +		add_clockevent(timer);
> > +		of_node_put(timer);
> > +		break;
> > +	case 1:
> > +		pr_debug("%s: found clocksource timer\n", __func__);
> > +		add_clocksource(timer);
> > +		of_node_put(timer);
> > +		init_sched_clock();
> > +		break;
> > +	default:
> > +		break;
> > +	}
> > 
> > -	init_sched_clock();
> > +	num_called++;
> > 
> >  }
> > 
> > +CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer",
> > dw_apb_timer_init); +CLOCKSOURCE_OF_DECLARE(apb_timer,
> > "snps,dw-apb-timer-osc", dw_apb_timer_init);
> 
> I think maybe we also want CLOCKSOURCE_OF_DECLARE() instances for the
> contents of sptimer_ids for completeness, otherwise looks good.

Hmm ... difficult.

As you can see, currently we call init_sched_clock when the second timer is 
found, which then tries to find the sptimer or uses the clocksource as 
sched_clock.

So to use CLOCKSOURCE_OF_DECLARE for the sptimer the init_sched_clock call 
would need to move to its init function. So on system without sptimer (like 
mine) this third call would never happen, and the system would be missing a 
sched_clock.

Or I just don't see the solution currently. In any case this could probably be 
handled by someone with the relevant hardware to test ;-) .


> Acked-by: Jamie Iles <jamie@jamieiles.com>

thanks

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init
@ 2013-06-04 15:06       ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04 15:06 UTC (permalink / raw)
  To: Jamie Iles
  Cc: Baruch Siach, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, John Stultz,
	Grant Likely, Thomas Gleixner,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Am Dienstag, 4. Juni 2013, 16:21:20 schrieb Jamie Iles:
> Hi Heiko,
> 
> On Tue, Jun 04, 2013 at 11:38:42AM +0200, Heiko Stübner wrote:
> > dw_apb_timer_init used to search the devicetree for matching timer
> > devices, making calls to it from board files necessary.
> > 
> > Change the dw_apb_timer_init to work with CLOCKSOURCE_OF_DECLARE.
> > With this change the function gets called once for each timer node
> > and tracks these number of calls to attach clockevent and clocksource
> > devices to the nodes.
> > 
> > Also remove the calls to dw_apb_timer_init from all previous users, as
> > clocksource_of_init is the default for init_time now.
> > 
> > Tested on the upcoming rk3066 code.
> > 
> > Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
> > Acked-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> > Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> > ---
> 
> ...
> 
> > -void __init dw_apb_timer_init(void)
> > +static int num_called;
> > +static void __init dw_apb_timer_init(struct device_node *timer)
> > 
> >  {
> > 
> > -	struct device_node *event_timer, *source_timer;
> > -
> > -	event_timer = of_find_matching_node(NULL, osctimer_ids);
> > -	if (!event_timer)
> > -		panic("No timer for clockevent");
> > -	add_clockevent(event_timer);
> > -
> > -	source_timer = of_find_matching_node(event_timer, osctimer_ids);
> > -	if (!source_timer)
> > -		panic("No timer for clocksource");
> > -	add_clocksource(source_timer);
> > -
> > -	of_node_put(source_timer);
> > +	switch (num_called) {
> > +	case 0:
> > +		pr_debug("%s: found clockevent timer\n", __func__);
> > +		add_clockevent(timer);
> > +		of_node_put(timer);
> > +		break;
> > +	case 1:
> > +		pr_debug("%s: found clocksource timer\n", __func__);
> > +		add_clocksource(timer);
> > +		of_node_put(timer);
> > +		init_sched_clock();
> > +		break;
> > +	default:
> > +		break;
> > +	}
> > 
> > -	init_sched_clock();
> > +	num_called++;
> > 
> >  }
> > 
> > +CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer",
> > dw_apb_timer_init); +CLOCKSOURCE_OF_DECLARE(apb_timer,
> > "snps,dw-apb-timer-osc", dw_apb_timer_init);
> 
> I think maybe we also want CLOCKSOURCE_OF_DECLARE() instances for the
> contents of sptimer_ids for completeness, otherwise looks good.

Hmm ... difficult.

As you can see, currently we call init_sched_clock when the second timer is 
found, which then tries to find the sptimer or uses the clocksource as 
sched_clock.

So to use CLOCKSOURCE_OF_DECLARE for the sptimer the init_sched_clock call 
would need to move to its init function. So on system without sptimer (like 
mine) this third call would never happen, and the system would be missing a 
sched_clock.

Or I just don't see the solution currently. In any case this could probably be 
handled by someone with the relevant hardware to test ;-) .


> Acked-by: Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>

thanks

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init
@ 2013-06-04 15:06       ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-04 15:06 UTC (permalink / raw)
  To: linux-arm-kernel

Am Dienstag, 4. Juni 2013, 16:21:20 schrieb Jamie Iles:
> Hi Heiko,
> 
> On Tue, Jun 04, 2013 at 11:38:42AM +0200, Heiko St?bner wrote:
> > dw_apb_timer_init used to search the devicetree for matching timer
> > devices, making calls to it from board files necessary.
> > 
> > Change the dw_apb_timer_init to work with CLOCKSOURCE_OF_DECLARE.
> > With this change the function gets called once for each timer node
> > and tracks these number of calls to attach clockevent and clocksource
> > devices to the nodes.
> > 
> > Also remove the calls to dw_apb_timer_init from all previous users, as
> > clocksource_of_init is the default for init_time now.
> > 
> > Tested on the upcoming rk3066 code.
> > 
> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > Acked-by: Rob Herring <rob.herring@calxeda.com>
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> 
> ...
> 
> > -void __init dw_apb_timer_init(void)
> > +static int num_called;
> > +static void __init dw_apb_timer_init(struct device_node *timer)
> > 
> >  {
> > 
> > -	struct device_node *event_timer, *source_timer;
> > -
> > -	event_timer = of_find_matching_node(NULL, osctimer_ids);
> > -	if (!event_timer)
> > -		panic("No timer for clockevent");
> > -	add_clockevent(event_timer);
> > -
> > -	source_timer = of_find_matching_node(event_timer, osctimer_ids);
> > -	if (!source_timer)
> > -		panic("No timer for clocksource");
> > -	add_clocksource(source_timer);
> > -
> > -	of_node_put(source_timer);
> > +	switch (num_called) {
> > +	case 0:
> > +		pr_debug("%s: found clockevent timer\n", __func__);
> > +		add_clockevent(timer);
> > +		of_node_put(timer);
> > +		break;
> > +	case 1:
> > +		pr_debug("%s: found clocksource timer\n", __func__);
> > +		add_clocksource(timer);
> > +		of_node_put(timer);
> > +		init_sched_clock();
> > +		break;
> > +	default:
> > +		break;
> > +	}
> > 
> > -	init_sched_clock();
> > +	num_called++;
> > 
> >  }
> > 
> > +CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer",
> > dw_apb_timer_init); +CLOCKSOURCE_OF_DECLARE(apb_timer,
> > "snps,dw-apb-timer-osc", dw_apb_timer_init);
> 
> I think maybe we also want CLOCKSOURCE_OF_DECLARE() instances for the
> contents of sptimer_ids for completeness, otherwise looks good.

Hmm ... difficult.

As you can see, currently we call init_sched_clock when the second timer is 
found, which then tries to find the sptimer or uses the clocksource as 
sched_clock.

So to use CLOCKSOURCE_OF_DECLARE for the sptimer the init_sched_clock call 
would need to move to its init function. So on system without sptimer (like 
mine) this third call would never happen, and the system would be missing a 
sched_clock.

Or I just don't see the solution currently. In any case this could probably be 
handled by someone with the relevant hardware to test ;-) .


> Acked-by: Jamie Iles <jamie@jamieiles.com>

thanks

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
  2013-06-04  9:36 ` Heiko Stübner
  (?)
@ 2013-06-04 15:28   ` Dinh Nguyen
  -1 siblings, 0 replies; 44+ messages in thread
From: Dinh Nguyen @ 2013-06-04 15:28 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: John Stultz, Thomas Gleixner, Jamie Iles, Grant Likely,
	linux-arm-kernel, Rob Herring, devicetree-discuss, linux-kernel,
	Arnd Bergmann, Linus Walleij, Baruch Siach

Hi Heiko,

On Tue, 2013-06-04 at 11:36 +0200, Heiko Stübner wrote:
> This is split off of my Rockchip support series from yesterday. It's now
> a patch more than before, as the third patch enables the timer to be used
> thru clocksource_of_init and moves picoxcell and socfpga to it.
> 
> changes since v1:
> - hopefully improve the patch description of patch 1
>   after a suggestion by Linus Walleij
> - move the selection of DW_APB_TIMER and CLKSRC_OF into DW_APB_TIMER_OF
>   after a suggestion by Baruch Siach
> 
> Heiko Stuebner (4):
>   clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
>   clocksource: dw_apb_timer_of: add clock-handling
>   clocksource: dw_apb_timer_of: select DW_APB_TIMER
>   clocksource: dw_apb_timer_of: use clocksource_of_init
> 
>  Documentation/devicetree/bindings/rtc/dw-apb.txt |   19 +++++
>  arch/arm/mach-picoxcell/Kconfig                  |    1 -
>  arch/arm/mach-picoxcell/common.c                 |    2 -
>  arch/arm/mach-socfpga/Kconfig                    |    1 -
>  arch/arm/mach-socfpga/socfpga.c                  |    2 -
>  drivers/clocksource/Kconfig                      |    2 +
>  drivers/clocksource/dw_apb_timer_of.c            |   95 ++++++++++++++-------
>  include/linux/dw_apb_timer.h                     |    1 -
>  8 files changed, 84 insertions(+), 39 deletions(-)
> 

For all the mach-socfpga parts:

Acked-by: Dinh Nguyen <dinguyen@altera.com>

Thanks,
Dinh



^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
@ 2013-06-04 15:28   ` Dinh Nguyen
  0 siblings, 0 replies; 44+ messages in thread
From: Dinh Nguyen @ 2013-06-04 15:28 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: John Stultz, Thomas Gleixner, Jamie Iles, Grant Likely,
	linux-arm-kernel, Rob Herring, devicetree-discuss, linux-kernel,
	Arnd Bergmann, Linus Walleij, Baruch Siach

Hi Heiko,

On Tue, 2013-06-04 at 11:36 +0200, Heiko Stübner wrote:
> This is split off of my Rockchip support series from yesterday. It's now
> a patch more than before, as the third patch enables the timer to be used
> thru clocksource_of_init and moves picoxcell and socfpga to it.
> 
> changes since v1:
> - hopefully improve the patch description of patch 1
>   after a suggestion by Linus Walleij
> - move the selection of DW_APB_TIMER and CLKSRC_OF into DW_APB_TIMER_OF
>   after a suggestion by Baruch Siach
> 
> Heiko Stuebner (4):
>   clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
>   clocksource: dw_apb_timer_of: add clock-handling
>   clocksource: dw_apb_timer_of: select DW_APB_TIMER
>   clocksource: dw_apb_timer_of: use clocksource_of_init
> 
>  Documentation/devicetree/bindings/rtc/dw-apb.txt |   19 +++++
>  arch/arm/mach-picoxcell/Kconfig                  |    1 -
>  arch/arm/mach-picoxcell/common.c                 |    2 -
>  arch/arm/mach-socfpga/Kconfig                    |    1 -
>  arch/arm/mach-socfpga/socfpga.c                  |    2 -
>  drivers/clocksource/Kconfig                      |    2 +
>  drivers/clocksource/dw_apb_timer_of.c            |   95 ++++++++++++++-------
>  include/linux/dw_apb_timer.h                     |    1 -
>  8 files changed, 84 insertions(+), 39 deletions(-)
> 

For all the mach-socfpga parts:

Acked-by: Dinh Nguyen <dinguyen@altera.com>

Thanks,
Dinh

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
@ 2013-06-04 15:28   ` Dinh Nguyen
  0 siblings, 0 replies; 44+ messages in thread
From: Dinh Nguyen @ 2013-06-04 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Heiko,

On Tue, 2013-06-04 at 11:36 +0200, Heiko St?bner wrote:
> This is split off of my Rockchip support series from yesterday. It's now
> a patch more than before, as the third patch enables the timer to be used
> thru clocksource_of_init and moves picoxcell and socfpga to it.
> 
> changes since v1:
> - hopefully improve the patch description of patch 1
>   after a suggestion by Linus Walleij
> - move the selection of DW_APB_TIMER and CLKSRC_OF into DW_APB_TIMER_OF
>   after a suggestion by Baruch Siach
> 
> Heiko Stuebner (4):
>   clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock
>   clocksource: dw_apb_timer_of: add clock-handling
>   clocksource: dw_apb_timer_of: select DW_APB_TIMER
>   clocksource: dw_apb_timer_of: use clocksource_of_init
> 
>  Documentation/devicetree/bindings/rtc/dw-apb.txt |   19 +++++
>  arch/arm/mach-picoxcell/Kconfig                  |    1 -
>  arch/arm/mach-picoxcell/common.c                 |    2 -
>  arch/arm/mach-socfpga/Kconfig                    |    1 -
>  arch/arm/mach-socfpga/socfpga.c                  |    2 -
>  drivers/clocksource/Kconfig                      |    2 +
>  drivers/clocksource/dw_apb_timer_of.c            |   95 ++++++++++++++-------
>  include/linux/dw_apb_timer.h                     |    1 -
>  8 files changed, 84 insertions(+), 39 deletions(-)
> 

For all the mach-socfpga parts:

Acked-by: Dinh Nguyen <dinguyen@altera.com>

Thanks,
Dinh

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
@ 2013-06-12  8:55   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-12  8:55 UTC (permalink / raw)
  To: John Stultz
  Cc: Thomas Gleixner, Jamie Iles, Dinh Nguyen, Grant Likely,
	linux-arm-kernel, Rob Herring, devicetree-discuss, linux-kernel,
	Arnd Bergmann, Linus Walleij, Baruch Siach, Olof Johansson

Am Dienstag, 4. Juni 2013, 11:36:09 schrieb Heiko Stübner:
> This is split off of my Rockchip support series from yesterday. It's now
> a patch more than before, as the third patch enables the timer to be used
> thru clocksource_of_init and moves picoxcell and socfpga to it.
> 
> changes since v1:
> - hopefully improve the patch description of patch 1
>   after a suggestion by Linus Walleij
> - move the selection of DW_APB_TIMER and CLKSRC_OF into DW_APB_TIMER_OF
>   after a suggestion by Baruch Siach
> 
> Heiko Stuebner (4):
>   clocksource: dw_apb_timer_of: enable the use the clocksource as sched
> clock clocksource: dw_apb_timer_of: add clock-handling
>   clocksource: dw_apb_timer_of: select DW_APB_TIMER
>   clocksource: dw_apb_timer_of: use clocksource_of_init
> 
>  Documentation/devicetree/bindings/rtc/dw-apb.txt |   19 +++++
>  arch/arm/mach-picoxcell/Kconfig                  |    1 -
>  arch/arm/mach-picoxcell/common.c                 |    2 -
>  arch/arm/mach-socfpga/Kconfig                    |    1 -
>  arch/arm/mach-socfpga/socfpga.c                  |    2 -
>  drivers/clocksource/Kconfig                      |    2 +
>  drivers/clocksource/dw_apb_timer_of.c            |   95
> ++++++++++++++------- include/linux/dw_apb_timer.h                     |  
>  1 -
>  8 files changed, 84 insertions(+), 39 deletions(-)

with clocksource_of conversion of picoxcell and socfpga, this series stands on 
its own. Is anybody going to pick it up?


Thanks
Heiko

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
@ 2013-06-12  8:55   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-12  8:55 UTC (permalink / raw)
  To: John Stultz
  Cc: Baruch Siach, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Grant Likely,
	Jamie Iles, Thomas Gleixner,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Am Dienstag, 4. Juni 2013, 11:36:09 schrieb Heiko Stübner:
> This is split off of my Rockchip support series from yesterday. It's now
> a patch more than before, as the third patch enables the timer to be used
> thru clocksource_of_init and moves picoxcell and socfpga to it.
> 
> changes since v1:
> - hopefully improve the patch description of patch 1
>   after a suggestion by Linus Walleij
> - move the selection of DW_APB_TIMER and CLKSRC_OF into DW_APB_TIMER_OF
>   after a suggestion by Baruch Siach
> 
> Heiko Stuebner (4):
>   clocksource: dw_apb_timer_of: enable the use the clocksource as sched
> clock clocksource: dw_apb_timer_of: add clock-handling
>   clocksource: dw_apb_timer_of: select DW_APB_TIMER
>   clocksource: dw_apb_timer_of: use clocksource_of_init
> 
>  Documentation/devicetree/bindings/rtc/dw-apb.txt |   19 +++++
>  arch/arm/mach-picoxcell/Kconfig                  |    1 -
>  arch/arm/mach-picoxcell/common.c                 |    2 -
>  arch/arm/mach-socfpga/Kconfig                    |    1 -
>  arch/arm/mach-socfpga/socfpga.c                  |    2 -
>  drivers/clocksource/Kconfig                      |    2 +
>  drivers/clocksource/dw_apb_timer_of.c            |   95
> ++++++++++++++------- include/linux/dw_apb_timer.h                     |  
>  1 -
>  8 files changed, 84 insertions(+), 39 deletions(-)

with clocksource_of conversion of picoxcell and socfpga, this series stands on 
its own. Is anybody going to pick it up?


Thanks
Heiko
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
@ 2013-06-12  8:55   ` Heiko Stübner
  0 siblings, 0 replies; 44+ messages in thread
From: Heiko Stübner @ 2013-06-12  8:55 UTC (permalink / raw)
  To: linux-arm-kernel

Am Dienstag, 4. Juni 2013, 11:36:09 schrieb Heiko St?bner:
> This is split off of my Rockchip support series from yesterday. It's now
> a patch more than before, as the third patch enables the timer to be used
> thru clocksource_of_init and moves picoxcell and socfpga to it.
> 
> changes since v1:
> - hopefully improve the patch description of patch 1
>   after a suggestion by Linus Walleij
> - move the selection of DW_APB_TIMER and CLKSRC_OF into DW_APB_TIMER_OF
>   after a suggestion by Baruch Siach
> 
> Heiko Stuebner (4):
>   clocksource: dw_apb_timer_of: enable the use the clocksource as sched
> clock clocksource: dw_apb_timer_of: add clock-handling
>   clocksource: dw_apb_timer_of: select DW_APB_TIMER
>   clocksource: dw_apb_timer_of: use clocksource_of_init
> 
>  Documentation/devicetree/bindings/rtc/dw-apb.txt |   19 +++++
>  arch/arm/mach-picoxcell/Kconfig                  |    1 -
>  arch/arm/mach-picoxcell/common.c                 |    2 -
>  arch/arm/mach-socfpga/Kconfig                    |    1 -
>  arch/arm/mach-socfpga/socfpga.c                  |    2 -
>  drivers/clocksource/Kconfig                      |    2 +
>  drivers/clocksource/dw_apb_timer_of.c            |   95
> ++++++++++++++------- include/linux/dw_apb_timer.h                     |  
>  1 -
>  8 files changed, 84 insertions(+), 39 deletions(-)

with clocksource_of conversion of picoxcell and socfpga, this series stands on 
its own. Is anybody going to pick it up?


Thanks
Heiko

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
  2013-06-12  8:55   ` Heiko Stübner
  (?)
@ 2013-06-12  9:46     ` Linus Walleij
  -1 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2013-06-12  9:46 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: John Stultz, Thomas Gleixner, Jamie Iles, Dinh Nguyen,
	Grant Likely, linux-arm-kernel, Rob Herring, devicetree-discuss,
	linux-kernel, Arnd Bergmann, Baruch Siach, Olof Johansson

On Wed, Jun 12, 2013 at 10:55 AM, Heiko Stübner <heiko@sntech.de> wrote:

> with clocksource_of conversion of picoxcell and socfpga, this series stands on
> its own. Is anybody going to pick it up?

I would suggest you send a pull request to the ARM SoC maintainers.
This is where most clocksource code and refactorings related to
ARM things come in.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
@ 2013-06-12  9:46     ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2013-06-12  9:46 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: John Stultz, Thomas Gleixner, Jamie Iles, Dinh Nguyen,
	Grant Likely, linux-arm-kernel, Rob Herring, devicetree-discuss,
	linux-kernel, Arnd Bergmann, Baruch Siach, Olof Johansson

On Wed, Jun 12, 2013 at 10:55 AM, Heiko Stübner <heiko@sntech.de> wrote:

> with clocksource_of conversion of picoxcell and socfpga, this series stands on
> its own. Is anybody going to pick it up?

I would suggest you send a pull request to the ARM SoC maintainers.
This is where most clocksource code and refactorings related to
ARM things come in.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
@ 2013-06-12  9:46     ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2013-06-12  9:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 12, 2013 at 10:55 AM, Heiko St?bner <heiko@sntech.de> wrote:

> with clocksource_of conversion of picoxcell and socfpga, this series stands on
> its own. Is anybody going to pick it up?

I would suggest you send a pull request to the ARM SoC maintainers.
This is where most clocksource code and refactorings related to
ARM things come in.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
  2013-06-12  9:46     ` Linus Walleij
@ 2013-06-12 17:51       ` Olof Johansson
  -1 siblings, 0 replies; 44+ messages in thread
From: Olof Johansson @ 2013-06-12 17:51 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Heiko Stübner, John Stultz, Thomas Gleixner, Jamie Iles,
	Dinh Nguyen, Grant Likely, linux-arm-kernel, Rob Herring,
	devicetree-discuss, linux-kernel, Arnd Bergmann, Baruch Siach

On Wed, Jun 12, 2013 at 11:46:37AM +0200, Linus Walleij wrote:
> On Wed, Jun 12, 2013 at 10:55 AM, Heiko Stübner <heiko@sntech.de> wrote:
> 
> > with clocksource_of conversion of picoxcell and socfpga, this series stands on
> > its own. Is anybody going to pick it up?
> 
> I would suggest you send a pull request to the ARM SoC maintainers.
> This is where most clocksource code and refactorings related to
> ARM things come in.

Yeah, or we can pick them up and apply from the list too. Have you collected
all Acked-bys and reposted a final version? If not, cc arm@kenrel.org on the
final posting.


-Olof

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
@ 2013-06-12 17:51       ` Olof Johansson
  0 siblings, 0 replies; 44+ messages in thread
From: Olof Johansson @ 2013-06-12 17:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 12, 2013 at 11:46:37AM +0200, Linus Walleij wrote:
> On Wed, Jun 12, 2013 at 10:55 AM, Heiko St?bner <heiko@sntech.de> wrote:
> 
> > with clocksource_of conversion of picoxcell and socfpga, this series stands on
> > its own. Is anybody going to pick it up?
> 
> I would suggest you send a pull request to the ARM SoC maintainers.
> This is where most clocksource code and refactorings related to
> ARM things come in.

Yeah, or we can pick them up and apply from the list too. Have you collected
all Acked-bys and reposted a final version? If not, cc arm at kenrel.org on the
final posting.


-Olof

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
  2013-06-12 17:51       ` Olof Johansson
@ 2013-06-12 17:53         ` Olof Johansson
  -1 siblings, 0 replies; 44+ messages in thread
From: Olof Johansson @ 2013-06-12 17:53 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Heiko Stübner, John Stultz, Thomas Gleixner, Jamie Iles,
	Dinh Nguyen, Grant Likely, linux-arm-kernel, Rob Herring,
	devicetree-discuss, linux-kernel, Arnd Bergmann, Baruch Siach

On Wed, Jun 12, 2013 at 10:51 AM, Olof Johansson <olof@lixom.net> wrote:
> On Wed, Jun 12, 2013 at 11:46:37AM +0200, Linus Walleij wrote:
>> On Wed, Jun 12, 2013 at 10:55 AM, Heiko Stübner <heiko@sntech.de> wrote:
>>
>> > with clocksource_of conversion of picoxcell and socfpga, this series stands on
>> > its own. Is anybody going to pick it up?
>>
>> I would suggest you send a pull request to the ARM SoC maintainers.
>> This is where most clocksource code and refactorings related to
>> ARM things come in.
>
> Yeah, or we can pick them up and apply from the list too. Have you collected
> all Acked-bys and reposted a final version? If not, cc arm@kenrel.org on the
> final posting.

Nevermind, I just came across the pull request. :-)


-Olof

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support
@ 2013-06-12 17:53         ` Olof Johansson
  0 siblings, 0 replies; 44+ messages in thread
From: Olof Johansson @ 2013-06-12 17:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 12, 2013 at 10:51 AM, Olof Johansson <olof@lixom.net> wrote:
> On Wed, Jun 12, 2013 at 11:46:37AM +0200, Linus Walleij wrote:
>> On Wed, Jun 12, 2013 at 10:55 AM, Heiko St?bner <heiko@sntech.de> wrote:
>>
>> > with clocksource_of conversion of picoxcell and socfpga, this series stands on
>> > its own. Is anybody going to pick it up?
>>
>> I would suggest you send a pull request to the ARM SoC maintainers.
>> This is where most clocksource code and refactorings related to
>> ARM things come in.
>
> Yeah, or we can pick them up and apply from the list too. Have you collected
> all Acked-bys and reposted a final version? If not, cc arm at kenrel.org on the
> final posting.

Nevermind, I just came across the pull request. :-)


-Olof

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2013-06-12 17:53 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-04  9:36 [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support Heiko Stübner
2013-06-04  9:36 ` Heiko Stübner
2013-06-04  9:36 ` Heiko Stübner
2013-06-04  9:37 ` [PATCH v2 1/4] clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock Heiko Stübner
2013-06-04  9:37   ` Heiko Stübner
2013-06-04  9:37   ` Heiko Stübner
2013-06-04 10:52   ` Heiko Stübner
2013-06-04 10:52     ` Heiko Stübner
2013-06-04 10:52     ` Heiko Stübner
2013-06-04 14:13   ` Jamie Iles
2013-06-04 14:13     ` Jamie Iles
2013-06-04  9:37 ` [PATCH v2 2/4] clocksource: dw_apb_timer_of: add clock-handling Heiko Stübner
2013-06-04  9:37   ` Heiko Stübner
2013-06-04  9:37   ` Heiko Stübner
2013-06-04 14:15   ` Jamie Iles
2013-06-04 14:15     ` Jamie Iles
2013-06-04  9:38 ` [PATCH v2 3/4] clocksource: dw_apb_timer_of: select DW_APB_TIMER Heiko Stübner
2013-06-04  9:38   ` Heiko Stübner
2013-06-04  9:38   ` Heiko Stübner
2013-06-04 14:15   ` Jamie Iles
2013-06-04 14:15     ` Jamie Iles
2013-06-04 14:15     ` Jamie Iles
2013-06-04  9:38 ` [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init Heiko Stübner
2013-06-04  9:38   ` Heiko Stübner
2013-06-04  9:38   ` Heiko Stübner
2013-06-04 14:21   ` Jamie Iles
2013-06-04 14:21     ` Jamie Iles
2013-06-04 14:21     ` Jamie Iles
2013-06-04 15:06     ` Heiko Stübner
2013-06-04 15:06       ` Heiko Stübner
2013-06-04 15:06       ` Heiko Stübner
2013-06-04 15:28 ` [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support Dinh Nguyen
2013-06-04 15:28   ` Dinh Nguyen
2013-06-04 15:28   ` Dinh Nguyen
2013-06-12  8:55 ` Heiko Stübner
2013-06-12  8:55   ` Heiko Stübner
2013-06-12  8:55   ` Heiko Stübner
2013-06-12  9:46   ` Linus Walleij
2013-06-12  9:46     ` Linus Walleij
2013-06-12  9:46     ` Linus Walleij
2013-06-12 17:51     ` Olof Johansson
2013-06-12 17:51       ` Olof Johansson
2013-06-12 17:53       ` Olof Johansson
2013-06-12 17:53         ` Olof Johansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.