2013-06-04 09:36:29

by Heiko Stuebner

[permalink] [raw]
Subject: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support

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


2013-06-04 09:37:51

by Heiko Stuebner

[permalink] [raw]
Subject: [PATCH v2 2/4] clocksource: dw_apb_timer_of: add clock-handling

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 <[email protected]>
---
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

2013-06-04 09:38:25

by Heiko Stuebner

[permalink] [raw]
Subject: [PATCH v2 3/4] clocksource: dw_apb_timer_of: select DW_APB_TIMER

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 <[email protected]>
---
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

2013-06-04 09:38:59

by Heiko Stuebner

[permalink] [raw]
Subject: [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init

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 <[email protected]>
Acked-by: Rob Herring <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
---
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

2013-06-04 09:37:37

by Heiko Stuebner

[permalink] [raw]
Subject: [PATCH v2 1/4] clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock

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 <[email protected]>
---
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

2013-06-04 10:52:25

by Heiko Stuebner

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock

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 <[email protected]>

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 <[email protected]>

2013-06-04 14:13:50

by Jamie Iles

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock

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 <[email protected]>

Acked-by: Jamie Iles <[email protected]>

2013-06-04 14:15:34

by Jamie Iles

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] clocksource: dw_apb_timer_of: add clock-handling

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 <[email protected]>

Acked-by: Jamie Iles <[email protected]>

2013-06-04 14:16:19

by Jamie Iles

[permalink] [raw]
Subject: Re: [PATCH v2 3/4] clocksource: dw_apb_timer_of: select DW_APB_TIMER

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 <[email protected]>

Acked-by: Jamie Iles <[email protected]>

2013-06-04 14:21:33

by Jamie Iles

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init

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 <[email protected]>
> Acked-by: Rob Herring <[email protected]>
> Acked-by: Arnd Bergmann <[email protected]>
> ---
...
> -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 <[email protected]>

Thanks,

Jamie

2013-06-04 15:06:46

by Heiko Stuebner

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init

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 <[email protected]>
> > Acked-by: Rob Herring <[email protected]>
> > Acked-by: Arnd Bergmann <[email protected]>
> > ---
>
> ...
>
> > -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 <[email protected]>

thanks

2013-06-04 15:26:39

by Dinh Nguyen

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support

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 <[email protected]>

Thanks,
Dinh

2013-06-12 08:56:11

by Heiko Stuebner

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support

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

2013-06-12 09:46:39

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support

On Wed, Jun 12, 2013 at 10:55 AM, Heiko St?bner <[email protected]> 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

2013-06-12 17:51:40

by Olof Johansson

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support

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 <[email protected]> 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 [email protected] on the
final posting.


-Olof

2013-06-12 17:53:09

by Olof Johansson

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support

On Wed, Jun 12, 2013 at 10:51 AM, Olof Johansson <[email protected]> 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 <[email protected]> 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 [email protected] on the
> final posting.

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


-Olof