Skip to contentSkip to conversation

clocksource: improve Atmel TCB timer driver

PATCH Superseded Alexandre Belloni 5 participants 21 messages Apr 3, 2019 – Apr 25, 2019

Subsystems (7)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Alexandre Belloni

author maintainer
#0 lore raw

cover clocksource: improve Atmel TCB timer driver

Hi,

This series immproves the Atmel TCB clocksource driver to address the most urgent shortcomings:
- the current tcb_clksrc driver is probed too late to be able to be used at boot and we now have SoCs that don't have a PIT. They currently are not able to boot an upstream kernel.
- using the PIT doesn't work well with preempt-rt because its interrupt is shared (in particular with the UART) and their interrupt flags are incompatible). This also happen with the threadedirq command line switch.
- there is currently no high resolution sched_clock.

The plan is to get those changes upstream as soon as possible as they arre fixing real issues that people are facing. There are further changes needed on the clocksource driver to try to stop wasting a TCB channel.
the PWM TCB driver will also be changed to actually used the reviewed binding and this will allow to get rif of atmel_tclib.

Alexandre Belloni (12):
ARM: at91: move SoC specific definitions to SoC folder
misc: atmel_tclib: drop AVR32 support
misc: atmel_tclib: move definitions to header file clocksource/drivers/tcb_clksrc: stop depending on atmel_tclib clocksource/drivers/tcb_clksrc: Use tcb as sched_clock
ARM: at91: Implement clocksource selection clocksource/drivers/tcb_clksrc: move Kconfig option clocksource/drivers/timer-atmel-pit: rework Kconfig option clocksource/drivers/tcb_clksrc: Rename the file for consistency
ARM: configs: at91: unselect PIT
misc: atmel_tclib: do not probe already used TCBs clocksource/drivers/timer-atmel-tcb: Use ARRAY_SIZE instead of
hardcoded size

 arch/arm/configs/at91_dt_defconfig            |   1 +
 arch/arm/configs/sama5_defconfig              |   1 +
 arch/arm/mach-at91/Kconfig                    |  23 ++++
 drivers/clocksource/Kconfig                   |  12 +-
 drivers/clocksource/Makefile                  |   2 +-
 .../{tcb_clksrc.c => timer-atmel-tcb.c}       | 123 ++++++++++++------
 drivers/misc/Kconfig                          |  24 ----
 drivers/misc/atmel_tclib.c                    |  37 +-----
 drivers/pwm/pwm-atmel-tcb.c                   |   2 +-
 .../atmel_tc.h => soc/at91/atmel_tcb.h}       |  25 +++-
 10 files changed, 146 insertions(+), 104 deletions(-)
 rename drivers/clocksource/{tcb_clksrc.c => timer-atmel-tcb.c} (81%)
 rename include/{linux/atmel_tc.h => soc/at91/atmel_tcb.h} (95%)
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

PATCH 1/12 ARM: at91: move SoC specific definitions to SoC folder

Move linux/atmel_tc.h to the SoC specific folder include/soc/at91.

---
 drivers/clocksource/tcb_clksrc.c                   | 2 +-
 drivers/misc/atmel_tclib.c                         | 2 +-
 drivers/pwm/pwm-atmel-tcb.c                        | 2 +-
 include/{linux/atmel_tc.h => soc/at91/atmel_tcb.h} | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
 rename include/{linux/atmel_tc.h => soc/at91/atmel_tcb.h} (99%)
drivers/clocksource/tcb_clksrc.c +1 -1
index 43f4d5c4d6fa..138a12090149 100644
@@ -11,7 +11,7 @@
 #include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/syscore_ops.h>
-#include <linux/atmel_tc.h>
+#include <soc/at91/atmel_tcb.h>
 
 
 /*
drivers/misc/atmel_tclib.c +1 -1
index ac24a4bd63f7..194f774ab3a1 100644
@@ -1,4 +1,3 @@
-#include <linux/atmel_tc.h>
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/init.h>
@@ -10,6 +9,7 @@
 #include <linux/slab.h>
 #include <linux/export.h>
 #include <linux/of.h>
+#include <soc/at91/atmel_tcb.h>
 
 /*
  * This is a thin library to solve the problem of how to portably allocate
drivers/pwm/pwm-atmel-tcb.c +1 -1
index 0d0f8376bc35..d7e92fd552e4 100644
@@ -17,7 +17,7 @@
 #include <linux/ioport.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
-#include <linux/atmel_tc.h>
+#include <soc/at91/atmel_tcb.h>
 #include <linux/pwm.h>
 #include <linux/of_device.h>
 #include <linux/slab.h>
include/soc/at91/atmel_tcb.h renamed from include/linux/atmel_tc.h +2 -2
similarity index 99%
rename from include/linux/atmel_tc.h
rename to include/soc/at91/atmel_tcb.h
index 468fdfa643f0..c3c7200ce151 100644
@@ -7,8 +7,8 @@
  * (at your option) any later version.
  */
 
-#ifndef ATMEL_TC_H
-#define ATMEL_TC_H
+#ifndef __SOC_ATMEL_TCB_H
+#define __SOC_ATMEL_TCB_H
 
 #include <linux/compiler.h>
 #include <linux/list.h>
Signature · 1 line
2.20.1
Acked-by on v1 1/12
#2 lore raw

Re: [PATCH 01/12] ARM: at91: move SoC specific definitions to SoC folder

Quoted 47 lines · Alexandre Belloni

Move linux/atmel_tc.h to the SoC specific folder include/soc/at91.

---
 drivers/clocksource/tcb_clksrc.c                   | 2 +-
 drivers/misc/atmel_tclib.c                         | 2 +-
 drivers/pwm/pwm-atmel-tcb.c                        | 2 +-
 include/{linux/atmel_tc.h => soc/at91/atmel_tcb.h} | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
 rename include/{linux/atmel_tc.h => soc/at91/atmel_tcb.h} (99%)
drivers/clocksource/tcb_clksrc.c +1 -1
index 43f4d5c4d6fa..138a12090149 100644
@@ -11,7 +11,7 @@
 #include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/syscore_ops.h>
-#include <linux/atmel_tc.h>
+#include <soc/at91/atmel_tcb.h>
 
 
 /*
drivers/misc/atmel_tclib.c +1 -1
index ac24a4bd63f7..194f774ab3a1 100644
@@ -1,4 +1,3 @@
-#include <linux/atmel_tc.h>
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/init.h>
@@ -10,6 +9,7 @@
 #include <linux/slab.h>
 #include <linux/export.h>
 #include <linux/of.h>
+#include <soc/at91/atmel_tcb.h>
 
 /*
  * This is a thin library to solve the problem of how to portably allocate
drivers/pwm/pwm-atmel-tcb.c +0 -0
index 0d0f8376bc35..d7e92fd552e4 100644

drivers/pwm/pwm-atmel-tcb.c line 20

Quoted 5 lines
drivers/pwm/pwm-atmel-tcb.c +1 -1
@@ -17,7 +17,7 @@
 #include <linux/ioport.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
-#include <linux/atmel_tc.h>
+#include <soc/at91/atmel_tcb.h>

Sort this below the linux/* includes. With that:

author maintainer
#4 lore raw

PATCH 2/12 misc: atmel_tclib: drop AVR32 support

In reply to Alexandre Belloni

AVR32 is gone from the kernel, remove its support from tclib.

---
 drivers/misc/atmel_tclib.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/misc/atmel_tclib.c +0 -8
index 194f774ab3a1..3af27ce7e514 100644
@@ -17,18 +17,10 @@
  * share individual timers between different drivers.
  */
 
-#if defined(CONFIG_AVR32)
-/* AVR32 has these divide PBB */
-const u8 atmel_tc_divisors[5] = { 0, 4, 8, 16, 32, };
-EXPORT_SYMBOL(atmel_tc_divisors);
-
-#elif defined(CONFIG_ARCH_AT91)
 /* AT91 has these divide MCK */
 const u8 atmel_tc_divisors[5] = { 2, 8, 32, 128, 0, };
 EXPORT_SYMBOL(atmel_tc_divisors);
 
-#endif
-
 static DEFINE_SPINLOCK(tc_list_lock);
 static LIST_HEAD(tc_list);
 
Signature · 1 line
2.20.1
author maintainer
#5 lore raw

PATCH 3/12 misc: atmel_tclib: move definitions to header file

In reply to Alexandre Belloni

Move atmel_tc_divisors and atmel_tcb_dt_ids definitions to the header file so they can be used without using tclib.

---
 drivers/misc/atmel_tclib.c   | 24 ------------------------
 include/soc/at91/atmel_tcb.h | 21 ++++++++++++++++++++-
 2 files changed, 20 insertions(+), 25 deletions(-)
drivers/misc/atmel_tclib.c +0 -24
index 3af27ce7e514..c79190525862 100644
@@ -17,10 +17,6 @@
  * share individual timers between different drivers.
  */
 
-/* AT91 has these divide MCK */
-const u8 atmel_tc_divisors[5] = { 2, 8, 32, 128, 0, };
-EXPORT_SYMBOL(atmel_tc_divisors);
-
 static DEFINE_SPINLOCK(tc_list_lock);
 static LIST_HEAD(tc_list);
 
@@ -72,26 +68,6 @@ void atmel_tc_free(struct atmel_tc *tc)
 EXPORT_SYMBOL_GPL(atmel_tc_free);
 
 #if defined(CONFIG_OF)
-static struct atmel_tcb_config tcb_rm9200_config = {
-	.counter_width = 16,
-};
-
-static struct atmel_tcb_config tcb_sam9x5_config = {
-	.counter_width = 32,
-};
-
-static const struct of_device_id atmel_tcb_dt_ids[] = {
-	{
-		.compatible = "atmel,at91rm9200-tcb",
-		.data = &tcb_rm9200_config,
-	}, {
-		.compatible = "atmel,at91sam9x5-tcb",
-		.data = &tcb_sam9x5_config,
-	}, {
-		/* sentinel */
-	}
-};
-
 MODULE_DEVICE_TABLE(of, atmel_tcb_dt_ids);
 #endif
 
include/soc/at91/atmel_tcb.h +20 -1
index c3c7200ce151..cb0c5f53cd46 100644
@@ -76,8 +76,27 @@ extern struct atmel_tc *atmel_tc_alloc(unsigned block);
 extern void atmel_tc_free(struct atmel_tc *tc);
 
 /* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */
-extern const u8 atmel_tc_divisors[5];
+static const u8 atmel_tc_divisors[] = { 2, 8, 32, 128, 0, };
 
+static const struct atmel_tcb_config tcb_rm9200_config = {
+	.counter_width = 16,
+};
+
+static const struct atmel_tcb_config tcb_sam9x5_config = {
+	.counter_width = 32,
+};
+
+static const struct of_device_id atmel_tcb_dt_ids[] = {
+	{
+		.compatible = "atmel,at91rm9200-tcb",
+		.data = &tcb_rm9200_config,
+	}, {
+		.compatible = "atmel,at91sam9x5-tcb",
+		.data = &tcb_sam9x5_config,
+	}, {
+		/* sentinel */
+	}
+};
 
 /*
  * Two registers have block-wide controls.  These are: configuring the three
Signature · 1 line
2.20.1
#6 lore raw

Re: [PATCH 03/12] misc: atmel_tclib: move definitions to header file

Quoted 2 lines · Alexandre Belloni

Move atmel_tc_divisors and atmel_tcb_dt_ids definitions to the header file so they can be used without using tclib.

Why not kill those structure and use the TIMER_OF_DECLARE with the corresponding probe function which will initialize to 16 or 32 counter width?

Quoted 82 lines
---
 drivers/misc/atmel_tclib.c   | 24 ------------------------
 include/soc/at91/atmel_tcb.h | 21 ++++++++++++++++++++-
 2 files changed, 20 insertions(+), 25 deletions(-)
drivers/misc/atmel_tclib.c +0 -24
index 3af27ce7e514..c79190525862 100644
@@ -17,10 +17,6 @@
  * share individual timers between different drivers.
  */
 
-/* AT91 has these divide MCK */
-const u8 atmel_tc_divisors[5] = { 2, 8, 32, 128, 0, };
-EXPORT_SYMBOL(atmel_tc_divisors);
-
 static DEFINE_SPINLOCK(tc_list_lock);
 static LIST_HEAD(tc_list);
 
@@ -72,26 +68,6 @@ void atmel_tc_free(struct atmel_tc *tc)
 EXPORT_SYMBOL_GPL(atmel_tc_free);
 
 #if defined(CONFIG_OF)
-static struct atmel_tcb_config tcb_rm9200_config = {
-	.counter_width = 16,
-};
-
-static struct atmel_tcb_config tcb_sam9x5_config = {
-	.counter_width = 32,
-};
-
-static const struct of_device_id atmel_tcb_dt_ids[] = {
-	{
-		.compatible = "atmel,at91rm9200-tcb",
-		.data = &tcb_rm9200_config,
-	}, {
-		.compatible = "atmel,at91sam9x5-tcb",
-		.data = &tcb_sam9x5_config,
-	}, {
-		/* sentinel */
-	}
-};
-
 MODULE_DEVICE_TABLE(of, atmel_tcb_dt_ids);
 #endif
 
include/soc/at91/atmel_tcb.h +20 -1
index c3c7200ce151..cb0c5f53cd46 100644
@@ -76,8 +76,27 @@ extern struct atmel_tc *atmel_tc_alloc(unsigned block);
 extern void atmel_tc_free(struct atmel_tc *tc);
 
 /* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */
-extern const u8 atmel_tc_divisors[5];
+static const u8 atmel_tc_divisors[] = { 2, 8, 32, 128, 0, };
 
+static const struct atmel_tcb_config tcb_rm9200_config = {
+	.counter_width = 16,
+};
+
+static const struct atmel_tcb_config tcb_sam9x5_config = {
+	.counter_width = 32,
+};
+
+static const struct of_device_id atmel_tcb_dt_ids[] = {
+	{
+		.compatible = "atmel,at91rm9200-tcb",
+		.data = &tcb_rm9200_config,
+	}, {
+		.compatible = "atmel,at91sam9x5-tcb",
+		.data = &tcb_sam9x5_config,
+	}, {
+		/* sentinel */
+	}
+};
 
 /*
  * Two registers have block-wide controls.  These are: configuring the three
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
author maintainer
#7 lore raw

Re: [PATCH 03/12] misc: atmel_tclib: move definitions to header file

Quoted 8 lines · Daniel Lezcano
Quoted 2 lines · Alexandre Belloni

Move atmel_tc_divisors and atmel_tcb_dt_ids definitions to the header file so they can be used without using tclib.

Why not kill those structure and use the TIMER_OF_DECLARE with the corresponding probe function which will initialize to 16 or 32 counter width?

I'm dropping this patch and the structures but doing the differentiation with TIMER_OF_DECLARE is not possible as this has to match "atmel,tcb-timer" and the differentiation is done on the parent compatible.

Quoted 93 lines
Quoted 84 lines
---
 drivers/misc/atmel_tclib.c   | 24 ------------------------
 include/soc/at91/atmel_tcb.h | 21 ++++++++++++++++++++-
 2 files changed, 20 insertions(+), 25 deletions(-)
drivers/misc/atmel_tclib.c +0 -24
index 3af27ce7e514..c79190525862 100644
@@ -17,10 +17,6 @@
  * share individual timers between different drivers.
  */
 
-/* AT91 has these divide MCK */
-const u8 atmel_tc_divisors[5] = { 2, 8, 32, 128, 0, };
-EXPORT_SYMBOL(atmel_tc_divisors);
-
 static DEFINE_SPINLOCK(tc_list_lock);
 static LIST_HEAD(tc_list);
 
@@ -72,26 +68,6 @@ void atmel_tc_free(struct atmel_tc *tc)
 EXPORT_SYMBOL_GPL(atmel_tc_free);
 
 #if defined(CONFIG_OF)
-static struct atmel_tcb_config tcb_rm9200_config = {
-	.counter_width = 16,
-};
-
-static struct atmel_tcb_config tcb_sam9x5_config = {
-	.counter_width = 32,
-};
-
-static const struct of_device_id atmel_tcb_dt_ids[] = {
-	{
-		.compatible = "atmel,at91rm9200-tcb",
-		.data = &tcb_rm9200_config,
-	}, {
-		.compatible = "atmel,at91sam9x5-tcb",
-		.data = &tcb_sam9x5_config,
-	}, {
-		/* sentinel */
-	}
-};
-
 MODULE_DEVICE_TABLE(of, atmel_tcb_dt_ids);
 #endif
 
include/soc/at91/atmel_tcb.h +20 -1
index c3c7200ce151..cb0c5f53cd46 100644
@@ -76,8 +76,27 @@ extern struct atmel_tc *atmel_tc_alloc(unsigned block);
 extern void atmel_tc_free(struct atmel_tc *tc);
 
 /* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */
-extern const u8 atmel_tc_divisors[5];
+static const u8 atmel_tc_divisors[] = { 2, 8, 32, 128, 0, };
 
+static const struct atmel_tcb_config tcb_rm9200_config = {
+	.counter_width = 16,
+};
+
+static const struct atmel_tcb_config tcb_sam9x5_config = {
+	.counter_width = 32,
+};
+
+static const struct of_device_id atmel_tcb_dt_ids[] = {
+	{
+		.compatible = "atmel,at91rm9200-tcb",
+		.data = &tcb_rm9200_config,
+	}, {
+		.compatible = "atmel,at91sam9x5-tcb",
+		.data = &tcb_sam9x5_config,
+	}, {
+		/* sentinel */
+	}
+};
 
 /*
  * Two registers have block-wide controls.  These are: configuring the three
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author maintainer
#8 lore raw

PATCH 4/12 clocksource/drivers/tcb_clksrc: stop depending on atmel_tclib

In reply to Alexandre Belloni

atmel_tclib is probed too late in the boot process to be able to use the TCB as the boot clocksource. This is an issue for SoCs without the PIT (sams70, samv70 and samv71 families) as they simply currently can't boot.

Get rid of the atmel_tclib dependency and probe everything on our own using the correct device tree binding.

This also allows getting rid of ATMEL_TCB_CLKSRC_BLOCK and makes the driver a bit more flexible as the TCB is not hardcoded in the kernel anymore.

---
 drivers/clocksource/tcb_clksrc.c | 103 +++++++++++++++++++------------
 drivers/misc/Kconfig             |  14 +----
 2 files changed, 66 insertions(+), 51 deletions(-)
drivers/clocksource/tcb_clksrc.c +64 -39
index 138a12090149..c7eec9808289 100644
@@ -9,7 +9,8 @@
 #include <linux/err.h>
 #include <linux/ioport.h>
 #include <linux/io.h>
-#include <linux/platform_device.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 #include <linux/syscore_ops.h>
 #include <soc/at91/atmel_tcb.h>
 
@@ -28,13 +29,6 @@
  *     source, used in either periodic or oneshot mode.  This runs
  *     at 32 KiHZ, and can handle delays of up to two seconds.
  *
- * A boot clocksource and clockevent source are also currently needed,
- * unless the relevant platforms (ARM/AT91, AVR32/AT32) are changed so
- * this code can be used when init_timers() is called, well before most
- * devices are set up.  (Some low end AT91 parts, which can run uClinux,
- * have only the timers in one TC block... they currently don't support
- * the tclib code, because of that initialization issue.)
- *
  * REVISIT behavior during system suspend states... we should disable
  * all clocks and save the power.  Easily done for clockevent devices,
  * but clocksources won't necessarily get the needed notifications.
@@ -112,7 +106,6 @@ void tc_clksrc_resume(struct clocksource *cs)
 }
 
 static struct clocksource clksrc = {
-	.name           = "tcb_clksrc",
 	.rating         = 200,
 	.read           = tc_get_cycles,
 	.mask           = CLOCKSOURCE_MASK(32),
@@ -214,7 +207,6 @@ static int tc_next_event(unsigned long delta, struct clock_event_device *d)
 
 static struct tc_clkevt_device clkevt = {
 	.clkevt	= {
-		.name			= "tc_clkevt",
 		.features		= CLOCK_EVT_FEAT_PERIODIC |
 					  CLOCK_EVT_FEAT_ONESHOT,
 		/* Should be lower than at91rm9200's system timer */
@@ -330,33 +322,64 @@ static void __init tcb_setup_single_chan(struct atmel_tc *tc, int mck_divisor_id
 	writel(ATMEL_TC_SYNC, tcaddr + ATMEL_TC_BCR);
 }
 
-static int __init tcb_clksrc_init(void)
+static int __init tcb_clksrc_init(struct device_node *node)
 {
-	static char bootinfo[] __initdata
-		= KERN_DEBUG "%s: tc%d at %d.%03d MHz\n";
-
-	struct platform_device *pdev;
-	struct atmel_tc *tc;
+	struct atmel_tc tc;
 	struct clk *t0_clk;
+	const struct of_device_id *match;
+	int irq;
 	u32 rate, divided_rate = 0;
 	int best_divisor_idx = -1;
 	int clk32k_divisor_idx = -1;
 	int i;
 	int ret;
 
-	tc = atmel_tc_alloc(CONFIG_ATMEL_TCB_CLKSRC_BLOCK);
-	if (!tc) {
-		pr_debug("can't alloc TC for clocksource\n");
-		return -ENODEV;
-	}
-	tcaddr = tc->regs;
-	pdev = tc->pdev;
+	/* Protect against multiple calls */
+	if (tcaddr)
+		return 0;
+
+	tc.regs = of_iomap(node->parent, 0);
+	if (!tc.regs)
+		return -ENXIO;
+
+	t0_clk = of_clk_get_by_name(node->parent, "t0_clk");
+	if (IS_ERR(t0_clk))
+		return PTR_ERR(t0_clk);
+
+	tc.slow_clk = of_clk_get_by_name(node->parent, "slow_clk");
+	if (IS_ERR(tc.slow_clk))
+		return PTR_ERR(tc.slow_clk);
+
+	irq = of_irq_get(node->parent, 0);
+	if (irq <= 0)
+		return -EINVAL;
+
+	tc.clk[0] = t0_clk;
+	tc.clk[1] = of_clk_get_by_name(node->parent, "t1_clk");
+	if (IS_ERR(tc.clk[1]))
+		tc.clk[1] = t0_clk;
+	tc.clk[2] = of_clk_get_by_name(node->parent, "t2_clk");
+	if (IS_ERR(tc.clk[2]))
+		tc.clk[2] = t0_clk;
+
+	tc.irq[0] = irq;
+	tc.irq[1] = of_irq_get(node->parent, 1);
+	if (tc.irq[1] <= 0)
+		tc.irq[1] = irq;
+	tc.irq[2] = of_irq_get(node->parent, 2);
+	if (tc.irq[2] <= 0)
+		tc.irq[2] = irq;
+
+	match = of_match_node(atmel_tcb_dt_ids, node->parent);
+	tc.tcb_config = match->data;
+
+	for (i = 0; i < ARRAY_SIZE(tc.irq); i++)
+		writel(ATMEL_TC_ALL_IRQ, tc.regs + ATMEL_TC_REG(i, IDR));
 
-	t0_clk = tc->clk[0];
 	ret = clk_prepare_enable(t0_clk);
 	if (ret) {
 		pr_debug("can't enable T0 clk\n");
-		goto err_free_tc;
+		return ret;
 	}
 
 	/* How fast will we be counting?  Pick something over 5 MHz.  */
@@ -381,27 +404,29 @@ static int __init tcb_clksrc_init(void)
 		best_divisor_idx = i;
 	}
 
-
-	printk(bootinfo, clksrc.name, CONFIG_ATMEL_TCB_CLKSRC_BLOCK,
-			divided_rate / 1000000,
+	clksrc.name = kbasename(node->parent->full_name);
+	clkevt.clkevt.name = kbasename(node->parent->full_name);
+	pr_debug("%s at %d.%03d MHz\n", clksrc.name, divided_rate / 1000000,
 			((divided_rate % 1000000) + 500) / 1000);
 
-	if (tc->tcb_config && tc->tcb_config->counter_width == 32) {
+	tcaddr = tc.regs;
+
+	if (tc.tcb_config->counter_width == 32) {
 		/* use apropriate function to read 32 bit counter */
 		clksrc.read = tc_get_cycles32;
 		/* setup ony channel 0 */
-		tcb_setup_single_chan(tc, best_divisor_idx);
+		tcb_setup_single_chan(&tc, best_divisor_idx);
 	} else {
-		/* tclib will give us three clocks no matter what the
+		/* we have three clocks no matter what the
 		 * underlying platform supports.
 		 */
-		ret = clk_prepare_enable(tc->clk[1]);
+		ret = clk_prepare_enable(tc.clk[1]);
 		if (ret) {
 			pr_debug("can't enable T1 clk\n");
 			goto err_disable_t0;
 		}
 		/* setup both channel 0 & 1 */
-		tcb_setup_dual_chan(tc, best_divisor_idx);
+		tcb_setup_dual_chan(&tc, best_divisor_idx);
 	}
 
 	/* and away we go! */
@@ -410,7 +435,7 @@ static int __init tcb_clksrc_init(void)
 		goto err_disable_t1;
 
 	/* channel 2:  periodic and oneshot timer support */
-	ret = setup_clkevents(tc, clk32k_divisor_idx);
+	ret = setup_clkevents(&tc, clk32k_divisor_idx);
 	if (ret)
 		goto err_unregister_clksrc;
 
@@ -420,14 +445,14 @@ static int __init tcb_clksrc_init(void)
 	clocksource_unregister(&clksrc);
 
 err_disable_t1:
-	if (!tc->tcb_config || tc->tcb_config->counter_width != 32)
-		clk_disable_unprepare(tc->clk[1]);
+	if (tc.tcb_config->counter_width != 32)
+		clk_disable_unprepare(tc.clk[1]);
 
 err_disable_t0:
 	clk_disable_unprepare(t0_clk);
 
-err_free_tc:
-	atmel_tc_free(tc);
+	tcaddr = NULL;
+
 	return ret;
 }
-arch_initcall(tcb_clksrc_init);
+TIMER_OF_DECLARE(atmel_tcb_clksrc, "atmel,tcb-timer", tcb_clksrc_init);
drivers/misc/Kconfig +2 -12
index 42ab8ec92a04..268a01d3d6f3 100644
@@ -61,7 +61,8 @@ config ATMEL_TCLIB
 
 config ATMEL_TCB_CLKSRC
 	bool "TC Block Clocksource"
-	depends on ATMEL_TCLIB
+	depends on ARCH_AT91
+	select TIMER_OF if OF
 	default y
 	help
 	  Select this to get a high precision clocksource based on a
@@ -72,17 +73,6 @@ config ATMEL_TCB_CLKSRC
 	  may be used as a clock event device supporting oneshot mode
 	  (delays of up to two seconds) based on the 32 KiHz clock.
 
-config ATMEL_TCB_CLKSRC_BLOCK
-	int
-	depends on ATMEL_TCB_CLKSRC
-	default 0
-	range 0 1
-	help
-	  Some chips provide more than one TC block, so you have the
-	  choice of which one to use for the clock framework.  The other
-	  TC can be used for other purposes, such as PWM generation and
-	  interval timing.
-
 config DUMMY_IRQ
 	tristate "Dummy IRQ handler"
 	default n
Signature · 1 line
2.20.1
#9 lore raw

Re: [PATCH 04/12] clocksource/drivers/tcb_clksrc: stop depending on atmel_tclib

Quoted 113 lines · Alexandre Belloni

atmel_tclib is probed too late in the boot process to be able to use the TCB as the boot clocksource. This is an issue for SoCs without the PIT (sams70, samv70 and samv71 families) as they simply currently can't boot.

Get rid of the atmel_tclib dependency and probe everything on our own using the correct device tree binding.

This also allows getting rid of ATMEL_TCB_CLKSRC_BLOCK and makes the driver a bit more flexible as the TCB is not hardcoded in the kernel anymore.

---
 drivers/clocksource/tcb_clksrc.c | 103 +++++++++++++++++++------------
 drivers/misc/Kconfig             |  14 +----
 2 files changed, 66 insertions(+), 51 deletions(-)
drivers/clocksource/tcb_clksrc.c +30 -23
index 138a12090149..c7eec9808289 100644
@@ -9,7 +9,8 @@
 #include <linux/err.h>
 #include <linux/ioport.h>
 #include <linux/io.h>
-#include <linux/platform_device.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 #include <linux/syscore_ops.h>
 #include <soc/at91/atmel_tcb.h>
 
@@ -28,13 +29,6 @@
  *     source, used in either periodic or oneshot mode.  This runs
  *     at 32 KiHZ, and can handle delays of up to two seconds.
  *
- * A boot clocksource and clockevent source are also currently needed,
- * unless the relevant platforms (ARM/AT91, AVR32/AT32) are changed so
- * this code can be used when init_timers() is called, well before most
- * devices are set up.  (Some low end AT91 parts, which can run uClinux,
- * have only the timers in one TC block... they currently don't support
- * the tclib code, because of that initialization issue.)
- *
  * REVISIT behavior during system suspend states... we should disable
  * all clocks and save the power.  Easily done for clockevent devices,
  * but clocksources won't necessarily get the needed notifications.
@@ -112,7 +106,6 @@ void tc_clksrc_resume(struct clocksource *cs)
 }
 
 static struct clocksource clksrc = {
-	.name           = "tcb_clksrc",
 	.rating         = 200,
 	.read           = tc_get_cycles,
 	.mask           = CLOCKSOURCE_MASK(32),
@@ -214,7 +207,6 @@ static int tc_next_event(unsigned long delta, struct clock_event_device *d)
 
 static struct tc_clkevt_device clkevt = {
 	.clkevt	= {
-		.name			= "tc_clkevt",
 		.features		= CLOCK_EVT_FEAT_PERIODIC |
 					  CLOCK_EVT_FEAT_ONESHOT,
 		/* Should be lower than at91rm9200's system timer */
@@ -330,33 +322,64 @@ static void __init tcb_setup_single_chan(struct atmel_tc *tc, int mck_divisor_id
 	writel(ATMEL_TC_SYNC, tcaddr + ATMEL_TC_BCR);
 }
 
-static int __init tcb_clksrc_init(void)
+static int __init tcb_clksrc_init(struct device_node *node)
 {
-	static char bootinfo[] __initdata
-		= KERN_DEBUG "%s: tc%d at %d.%03d MHz\n";
-
-	struct platform_device *pdev;
-	struct atmel_tc *tc;
+	struct atmel_tc tc;
 	struct clk *t0_clk;
+	const struct of_device_id *match;
+	int irq;
 	u32 rate, divided_rate = 0;
 	int best_divisor_idx = -1;
 	int clk32k_divisor_idx = -1;
 	int i;
 	int ret;
 
-	tc = atmel_tc_alloc(CONFIG_ATMEL_TCB_CLKSRC_BLOCK);
-	if (!tc) {
-		pr_debug("can't alloc TC for clocksource\n");
-		return -ENODEV;
-	}
-	tcaddr = tc->regs;
-	pdev = tc->pdev;
+	/* Protect against multiple calls */
+	if (tcaddr)
+		return 0;
+
+	tc.regs = of_iomap(node->parent, 0);
+	if (!tc.regs)
+		return -ENXIO;
+
+	t0_clk = of_clk_get_by_name(node->parent, "t0_clk");
+	if (IS_ERR(t0_clk))
+		return PTR_ERR(t0_clk);
+
+	tc.slow_clk = of_clk_get_by_name(node->parent, "slow_clk");
+	if (IS_ERR(tc.slow_clk))
+		return PTR_ERR(tc.slow_clk);
+
+	irq = of_irq_get(node->parent, 0);
+	if (irq <= 0)
+		return -EINVAL;
+
+	tc.clk[0] = t0_clk;
+	tc.clk[1] = of_clk_get_by_name(node->parent, "t1_clk");
+	if (IS_ERR(tc.clk[1]))
+		tc.clk[1] = t0_clk;

drivers/clocksource/tcb_clksrc.c static void __init tcb_setup_single_chan(struct atmel_tc *tc, int mck_divisor_id · line 370

Quoted 10 lines
drivers/clocksource/tcb_clksrc.c +10 -0
+	tc.clk[2] = of_clk_get_by_name(node->parent, "t2_clk");
+	if (IS_ERR(tc.clk[2]))
+		tc.clk[2] = t0_clk;
+	tc.irq[0] = irq;
+	tc.irq[1] = of_irq_get(node->parent, 1);
+	if (tc.irq[1] <= 0)
+		tc.irq[1] = irq;
+	tc.irq[2] = of_irq_get(node->parent, 2);
+	if (tc.irq[2] <= 0)
+		tc.irq[2] = irq;

Why are clk[1/2] and irq[1/2] defaulting back to t0 in case of error?

[ ... ]

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
author maintainer
#10 lore raw

Re: [PATCH 04/12] clocksource/drivers/tcb_clksrc: stop depending on atmel_tclib

Quoted 8 lines · Daniel Lezcano
Quoted 8 lines
drivers/clocksource/tcb_clksrc.c +8 -0
+	tc.clk[0] = t0_clk;
+	tc.clk[1] = of_clk_get_by_name(node->parent, "t1_clk");
+	if (IS_ERR(tc.clk[1]))
+		tc.clk[1] = t0_clk;
+	tc.clk[2] = of_clk_get_by_name(node->parent, "t2_clk");
+	if (IS_ERR(tc.clk[2]))
+		tc.clk[2] = t0_clk;
+	tc.irq[0] = irq;
Quoted 9 lines

drivers/clocksource/tcb_clksrc.c static void __init tcb_setup_single_chan(struct atmel_tc *tc, int mck_divisor_id · line 371

Quoted 6 lines
drivers/clocksource/tcb_clksrc.c +6 -0
+	tc.irq[1] = of_irq_get(node->parent, 1);
+	if (tc.irq[1] <= 0)
+		tc.irq[1] = irq;
+	tc.irq[2] = of_irq_get(node->parent, 2);
+	if (tc.irq[2] <= 0)
+		tc.irq[2] = irq;

Why are clk[1/2] and irq[1/2] defaulting back to t0 in case of error?

This is how the DT binding is madewhen the same IRQ/clk is used for all the channels of the TCB, then it is only specified once. Unfortunately, this has to be kept to keep backward DT compatibility. Still, I'm reworking the irq paring as the driver only needs the irq for channel 2.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author maintainer
#11 lore raw

PATCH 5/12 clocksource/drivers/tcb_clksrc: Use tcb as sched_clock

In reply to Alexandre Belloni

Now that the driver is registered early enough, use the TCB as the sched_clock which is much more accurate than the jiffies implementation.

---
 drivers/clocksource/tcb_clksrc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/clocksource/tcb_clksrc.c +16 -0
index c7eec9808289..10350dffd157 100644
@@ -11,6 +11,7 @@
 #include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/sched_clock.h>
 #include <linux/syscore_ops.h>
 #include <soc/at91/atmel_tcb.h>
 
@@ -114,6 +115,16 @@ static struct clocksource clksrc = {
 	.resume		= tc_clksrc_resume,
 };
 
+static u64 notrace tc_sched_clock_read(void)
+{
+	return tc_get_cycles(&clksrc);
+}
+
+static u64 notrace tc_sched_clock_read32(void)
+{
+	return tc_get_cycles32(&clksrc);
+}
+
 #ifdef CONFIG_GENERIC_CLOCKEVENTS
 
 struct tc_clkevt_device {
@@ -327,6 +338,7 @@ static int __init tcb_clksrc_init(struct device_node *node)
 	struct atmel_tc tc;
 	struct clk *t0_clk;
 	const struct of_device_id *match;
+	u64 (*tc_sched_clock)(void);
 	int irq;
 	u32 rate, divided_rate = 0;
 	int best_divisor_idx = -1;
@@ -416,6 +428,7 @@ static int __init tcb_clksrc_init(struct device_node *node)
 		clksrc.read = tc_get_cycles32;
 		/* setup ony channel 0 */
 		tcb_setup_single_chan(&tc, best_divisor_idx);
+		tc_sched_clock = tc_sched_clock_read32;
 	} else {
 		/* we have three clocks no matter what the
 		 * underlying platform supports.
@@ -427,6 +440,7 @@ static int __init tcb_clksrc_init(struct device_node *node)
 		}
 		/* setup both channel 0 & 1 */
 		tcb_setup_dual_chan(&tc, best_divisor_idx);
+		tc_sched_clock = tc_sched_clock_read;
 	}
 
 	/* and away we go! */
@@ -439,6 +453,8 @@ static int __init tcb_clksrc_init(struct device_node *node)
 	if (ret)
 		goto err_unregister_clksrc;
 
+	sched_clock_register(tc_sched_clock, 32, divided_rate);
+
 	return 0;
 
 err_unregister_clksrc:
Signature · 1 line
2.20.1
author maintainer
#12 lore raw

PATCH 6/12 ARM: at91: Implement clocksource selection

In reply to Alexandre Belloni

Allow selecting and unselecting the PIT clocksource driver so it doesn't have to be compiled when unused.

---
 arch/arm/mach-at91/Kconfig | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm/mach-at91/Kconfig +23 -0
index 903f23c309df..da1d97a06c53 100644
@@ -107,6 +107,29 @@ config SOC_AT91SAM9
 	    AT91SAM9X35
 	    AT91SAM9XE
 
+comment "Clocksource driver selection"
+
+config ATMEL_CLOCKSOURCE_PIT
+	bool "Periodic Interval Timer (PIT) support"
+	depends on SOC_AT91SAM9 || SOC_SAMA5
+	default SOC_AT91SAM9 || SOC_SAMA5
+	select ATMEL_PIT
+	help
+	  Select this to get a clocksource based on the Atmel Periodic Interval
+	  Timer. It has a relatively low resolution and the TC Block clocksource
+	  should be preferred.
+
+config ATMEL_CLOCKSOURCE_TCB
+	bool "Timer Counter Blocks (TCB) support"
+	default SOC_AT91RM9200 || SOC_AT91SAM9 || SOC_SAMA5
+	select ATMEL_TCB_CLKSRC
+	help
+	  Select this to get a high precision clocksource based on a
+	  TC block with a 5+ MHz base clock rate.
+	  On platforms with 16-bit counters, two timer channels are combined
+	  to make a single 32-bit timer.
+	  It can also be used as a clock event device supporting oneshot mode.
+
 config HAVE_AT91_UTMI
 	bool
 
Signature · 1 line
2.20.1
author maintainer
#13 lore raw

PATCH 7/12 clocksource/drivers/tcb_clksrc: move Kconfig option

In reply to Alexandre Belloni

Move the ATMEL_TCB_CLKSRC option to drivers/clocksource and make it silent if COMPILE_TEST is not selected.

---
 drivers/clocksource/Kconfig |  7 +++++++
 drivers/misc/Kconfig        | 14 --------------
 2 files changed, 7 insertions(+), 14 deletions(-)
drivers/clocksource/Kconfig +7 -0
index 171502a356aa..e38ef4906e30 100644
@@ -410,6 +410,13 @@ config ATMEL_ST
 	help
 	  Support for the Atmel ST timer.
 
+config ATMEL_TCB_CLKSRC
+	bool "Atmel TC Block timer driver" if COMPILE_TEST
+	depends on HAS_IOMEM
+	select TIMER_OF if OF
+	help
+	  Support for Timer Counter Blocks on Atmel SoCs.
+
 config CLKSRC_EXYNOS_MCT
 	bool "Exynos multi core timer driver" if COMPILE_TEST
 	depends on ARM || ARM64
drivers/misc/Kconfig +0 -14
index 268a01d3d6f3..c84033909395 100644
@@ -59,20 +59,6 @@ config ATMEL_TCLIB
 	  blocks found on many Atmel processors.  This facilitates using
 	  these blocks by different drivers despite processor differences.
 
-config ATMEL_TCB_CLKSRC
-	bool "TC Block Clocksource"
-	depends on ARCH_AT91
-	select TIMER_OF if OF
-	default y
-	help
-	  Select this to get a high precision clocksource based on a
-	  TC block with a 5+ MHz base clock rate.  Two timer channels
-	  are combined to make a single 32-bit timer.
-
-	  When GENERIC_CLOCKEVENTS is defined, the third timer channel
-	  may be used as a clock event device supporting oneshot mode
-	  (delays of up to two seconds) based on the 32 KiHz clock.
-
 config DUMMY_IRQ
 	tristate "Dummy IRQ handler"
 	default n
Signature · 1 line
2.20.1
author maintainer
#14 lore raw

PATCH 8/12 clocksource/drivers/timer-atmel-pit: rework Kconfig option

In reply to Alexandre Belloni

Allow building the PIT driver when COMPILE_TEST is enabled. Also remove its default value so it can be disabled.

---
 drivers/clocksource/Kconfig | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clocksource/Kconfig +4 -1
index e38ef4906e30..c73736f87600 100644
@@ -399,8 +399,11 @@ config ARMV7M_SYSTICK
 	  This options enables support for the ARMv7M system timer unit
 
 config ATMEL_PIT
+	bool "Atmel PIT support" if COMPILE_TEST
+	depends on HAS_IOMEM
 	select TIMER_OF if OF
-	def_bool SOC_AT91SAM9 || SOC_SAMA5
+	help
+	  Support for the Periodic Interval Timer found on Atmel SoCs.
 
 config ATMEL_ST
 	bool "Atmel ST timer support" if COMPILE_TEST
Signature · 1 line
2.20.1
author maintainer
#15 lore raw

PATCH 9/12 clocksource/drivers/tcb_clksrc: Rename the file for consistency

In reply to Alexandre Belloni

For the sake of consistency, let's rename the file to a name similar to other file names in this directory.

---
 drivers/clocksource/Makefile                            | 2 +-
 drivers/clocksource/{tcb_clksrc.c => timer-atmel-tcb.c} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename drivers/clocksource/{tcb_clksrc.c => timer-atmel-tcb.c} (100%)
drivers/clocksource/Makefile +1 -1
index be6e0fbc7489..923b9b60c909 100644
@@ -3,7 +3,7 @@ obj-$(CONFIG_TIMER_OF)		+= timer-of.o
 obj-$(CONFIG_TIMER_PROBE)	+= timer-probe.o
 obj-$(CONFIG_ATMEL_PIT)		+= timer-atmel-pit.o
 obj-$(CONFIG_ATMEL_ST)		+= timer-atmel-st.o
-obj-$(CONFIG_ATMEL_TCB_CLKSRC)	+= tcb_clksrc.o
+obj-$(CONFIG_ATMEL_TCB_CLKSRC)	+= timer-atmel-tcb.o
 obj-$(CONFIG_X86_PM_TIMER)	+= acpi_pm.o
 obj-$(CONFIG_SCx200HR_TIMER)	+= scx200_hrt.o
 obj-$(CONFIG_CS5535_CLOCK_EVENT_SRC)	+= timer-cs5535.o
drivers/clocksource/timer-atmel-tcb.c renamed from drivers/clocksource/tcb_clksrc.c +0 -0
similarity index 100%
rename from drivers/clocksource/tcb_clksrc.c
rename to drivers/clocksource/timer-atmel-tcb.c
Signature · 1 line
2.20.1
author maintainer
#16 lore raw

PATCH 10/12 ARM: configs: at91: unselect PIT

In reply to Alexandre Belloni

The PIT is not required anymore to successfully boot and may actually harm in case preempt-rt is used because the PIT interrupt is shared. Disable it so the TCB clocksource is used.

---
 arch/arm/configs/at91_dt_defconfig | 1 +
 arch/arm/configs/sama5_defconfig   | 1 +
 2 files changed, 2 insertions(+)
arch/arm/configs/at91_dt_defconfig +1 -0
index e4b1be66b3f5..c8876d0ca41a 100644
@@ -19,6 +19,7 @@ CONFIG_ARCH_MULTI_V5=y
 CONFIG_ARCH_AT91=y
 CONFIG_SOC_AT91RM9200=y
 CONFIG_SOC_AT91SAM9=y
+# CONFIG_ATMEL_CLOCKSOURCE_PIT is not set
 CONFIG_AEABI=y
 CONFIG_UACCESS_WITH_MEMCPY=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
arch/arm/configs/sama5_defconfig +1 -0
index b0026f73083d..10ebc9481f72 100644
@@ -20,6 +20,7 @@ CONFIG_ARCH_AT91=y
 CONFIG_SOC_SAMA5D2=y
 CONFIG_SOC_SAMA5D3=y
 CONFIG_SOC_SAMA5D4=y
+# CONFIG_ATMEL_CLOCKSOURCE_PIT is not set
 CONFIG_AEABI=y
 CONFIG_UACCESS_WITH_MEMCPY=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
Signature · 1 line
2.20.1
author maintainer
#17 lore raw

PATCH 11/12 misc: atmel_tclib: do not probe already used TCBs

In reply to Alexandre Belloni

The TCBs that have children are using the new (proper) DT bindings and don't need to be handled by tclib.

---
 drivers/misc/atmel_tclib.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/misc/atmel_tclib.c +3 -0
index c79190525862..b610cc894cd8 100644
@@ -79,6 +79,9 @@ static int __init tc_probe(struct platform_device *pdev)
 	struct resource	*r;
 	unsigned int	i;
 
+	if (of_get_child_count(pdev->dev.of_node))
+		return 0;
+
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
 		return -EINVAL;
Signature · 1 line
2.20.1
author maintainer
#19 lore raw

PATCH 12/12 clocksource/drivers/timer-atmel-tcb: Use ARRAY_SIZE instead of hardcoded size

In reply to Alexandre Belloni

Use ARRAY_SIZE to replace the hardcoded size so we will never have a mismatch.

---
 drivers/clocksource/timer-atmel-tcb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/timer-atmel-tcb.c +1 -1
index 10350dffd157..eab5beadf2ca 100644
@@ -396,7 +396,7 @@ static int __init tcb_clksrc_init(struct device_node *node)
 
 	/* How fast will we be counting?  Pick something over 5 MHz.  */
 	rate = (u32) clk_get_rate(t0_clk);
-	for (i = 0; i < 5; i++) {
+	for (i = 0; i < ARRAY_SIZE(atmel_tc_divisors); i++) {
 		unsigned divisor = atmel_tc_divisors[i];
 		unsigned tmp;
 
Signature · 1 line
2.20.1
#20 lore raw
In reply to Alexandre Belloni

Hi Alexandre,

except the comment for 3/12, the series looks good to me.

Quoted 49 lines · Alexandre Belloni

Hi,

This series immproves the Atmel TCB clocksource driver to address the most urgent shortcomings:
- the current tcb_clksrc driver is probed too late to be able to be used at boot and we now have SoCs that don't have a PIT. They currently are not able to boot an upstream kernel.
- using the PIT doesn't work well with preempt-rt because its interrupt is shared (in particular with the UART) and their interrupt flags are incompatible). This also happen with the threadedirq command line switch.
- there is currently no high resolution sched_clock.

The plan is to get those changes upstream as soon as possible as they arre fixing real issues that people are facing. There are further changes needed on the clocksource driver to try to stop wasting a TCB channel.
the PWM TCB driver will also be changed to actually used the reviewed binding and this will allow to get rif of atmel_tclib.

Alexandre Belloni (12):
ARM: at91: move SoC specific definitions to SoC folder
misc: atmel_tclib: drop AVR32 support
misc: atmel_tclib: move definitions to header file clocksource/drivers/tcb_clksrc: stop depending on atmel_tclib clocksource/drivers/tcb_clksrc: Use tcb as sched_clock
ARM: at91: Implement clocksource selection clocksource/drivers/tcb_clksrc: move Kconfig option clocksource/drivers/timer-atmel-pit: rework Kconfig option clocksource/drivers/tcb_clksrc: Rename the file for consistency
ARM: configs: at91: unselect PIT
misc: atmel_tclib: do not probe already used TCBs clocksource/drivers/timer-atmel-tcb: Use ARRAY_SIZE instead of
hardcoded size

 arch/arm/configs/at91_dt_defconfig            |   1 +
 arch/arm/configs/sama5_defconfig              |   1 +
 arch/arm/mach-at91/Kconfig                    |  23 ++++
 drivers/clocksource/Kconfig                   |  12 +-
 drivers/clocksource/Makefile                  |   2 +-
 .../{tcb_clksrc.c => timer-atmel-tcb.c}       | 123 ++++++++++++------
 drivers/misc/Kconfig                          |  24 ----
 drivers/misc/atmel_tclib.c                    |  37 +-----
 drivers/pwm/pwm-atmel-tcb.c                   |   2 +-
 .../atmel_tc.h => soc/at91/atmel_tcb.h}       |  25 +++-
 10 files changed, 146 insertions(+), 104 deletions(-)
 rename drivers/clocksource/{tcb_clksrc.c => timer-atmel-tcb.c} (81%)
 rename include/{linux/atmel_tc.h => soc/at91/atmel_tcb.h} (95%)
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog