Skip to contentSkip to conversation

at91: Add arch_preboot_os which disables PIT in a faster way

PATCH Superseded Alexander Stein 3 participants 6 messages Aug 4, 2010 – Sep 23, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 at91: Add arch_preboot_os which disables PIT in a faster way

When disabled the PIT runs until it reaches the CPIV value. The Linux PIT driver stops the PIT and waits until it stopped. This can take over 100ms. Simply stopping in u-boot isn't sufficient as the PIT will still be running when Linux is waiting until it stopped. So, we stop it in u-boot by setting the compare value to a value slightly greater than the current running counter to make the PIT stopped in short time.

---
 arch/arm/cpu/arm926ejs/at91/cpu.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
arch/arm/cpu/arm926ejs/at91/cpu.c +15 -0
index 141a7d1..af86ee2 100644
@@ -28,6 +28,7 @@
 
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_pit.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/io.h>
 
@@ -47,6 +48,20 @@ int arch_cpu_init(void)
 	return at91_clock_init(CONFIG_SYS_AT91_MAIN_CLOCK);
 }
 
+void arch_preboot_os(void)
+{
+	ulong cpiv;
+	at91_pit_t *pit = (at91_pit_t *) AT91_PIT_BASE;
+
+	cpiv = AT91_PIT_MR_PIV_MASK(readl(&pit->piir));
+
+	/*  Disble PITC
+	 * Add 0x1000 to current counter to stop it faster
+	 * without waiting for wrapping back to 0
+	 */
+	writel(cpiv + 0x1000, &pit->mr);
+}
+
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void)
 {
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 at91: Add arch_preboot_os which disables PIT in a faster way

Dear Alexander Stein,

arch/arm/cpu/arm926ejs/at91/cpu.c int arch_cpu_init(void) · line 62

Quoted 10 lines

...

...

arch/arm/cpu/arm926ejs/at91/cpu.c +5 -0
+	/*  Disble PITC
+	 * Add 0x1000 to current counter to stop it faster
+	 * without waiting for wrapping back to 0
+	 */
+	writel(cpiv + 0x1000, &pit->mr);
...

Please fix the multi-line comment.

Thanks, Reinhard

#2 lore raw

PATCH v2 1/1 at91: Add arch_preboot_os which disables PIT in a faster way

When disabled the PIT runs until it reaches the CPIV value. The Linux PIT driver stops the PIT and waits until it stopped. This can take over 100ms. Simply stopping in u-boot isn't sufficient as the PIT will still be running when Linux is waiting until it stopped. So, we stop it in u-boot by setting the compare value to a value slightly greater than the current running counter to make the PIT stopped in short time.

---

Changes in v2:
* Fix comment

 arch/arm/cpu/arm926ejs/at91/cpu.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
arch/arm/cpu/arm926ejs/at91/cpu.c +15 -0
index 141a7d1..62e7678 100644
@@ -28,6 +28,7 @@
 
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_pit.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/io.h>
 
@@ -47,6 +48,20 @@ int arch_cpu_init(void)
 	return at91_clock_init(CONFIG_SYS_AT91_MAIN_CLOCK);
 }
 
+void arch_preboot_os(void)
+{
+	ulong cpiv;
+	at91_pit_t *pit = (at91_pit_t *) AT91_PIT_BASE;
+
+	cpiv = AT91_PIT_MR_PIV_MASK(readl(&pit->piir));
+
+	/* Disable PITC
+	 * Add 0x1000 to current counter to stop it faster
+	 * without waiting for wrapping back to 0
+	 */
+	writel(cpiv + 0x1000, &pit->mr);
+}
+
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void)
 {
Signature · 1 line
1.7.1
#3 lore raw

PATCH v2 1/1 at91: Add arch_preboot_os which disables PIT in a faster way

Dear Alexander Stein,

arch/arm/cpu/arm926ejs/at91/cpu.c int arch_cpu_init(void) · line 61

Quoted 4 lines
arch/arm/cpu/arm926ejs/at91/cpu.c +4 -0
+	/* Disable PITC
+	 * Add 0x1000 to current counter to stop it faster
+	 * without waiting for wrapping back to 0
+	 */

Sorry, a multiline comment goes like this:
/*
* 1st line
* ...
* last line
*/
Best Regards,
Reinhard

-------------- next part --------------
A non-text attachment was scrubbed...
Name: reinhard_meyer.vcf
Type: text/x-vcard
Size: 370 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100910/c732d9a8/attachment.vcf

#4 lore raw

PATCH v3 1/1 at91: Add arch_preboot_os which disables PIT in a faster way

When disabled the PIT runs until it reaches the CPIV value. The Linux PIT driver stops the PIT and waits until it stopped. This can take over 100ms. Simply stopping in u-boot isn't sufficient as the PIT will still be running when Linux is waiting until it stopped. So, we stop it in u-boot by setting the compare value to a value slightly greater than the current running counter to make the PIT stopped in short time.

---

Changes in v3:
* Really fix comment

 arch/arm/cpu/arm926ejs/at91/cpu.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
arch/arm/cpu/arm926ejs/at91/cpu.c +16 -0
index 141a7d1..110c361 100644
@@ -28,6 +28,7 @@
 
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_pit.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/io.h>
 
@@ -47,6 +48,21 @@ int arch_cpu_init(void)
 	return at91_clock_init(CONFIG_SYS_AT91_MAIN_CLOCK);
 }
 
+void arch_preboot_os(void)
+{
+	ulong cpiv;
+	at91_pit_t *pit = (at91_pit_t *) AT91_PIT_BASE;
+
+	cpiv = AT91_PIT_MR_PIV_MASK(readl(&pit->piir));
+
+	/*
+	 * Disable PITC
+	 * Add 0x1000 to current counter to stop it faster
+	 * without waiting for wrapping back to 0
+	 */
+	writel(cpiv + 0x1000, &pit->mr);
+}
+
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void)
 {
Signature · 1 line
1.7.2.2
#5 lore raw

PATCH v3 1/1 at91: Add arch_preboot_os which disables PIT in a faster way

Dear Alexander Stein,

Quoted 8 lines

When disabled the PIT runs until it reaches the CPIV value. The Linux PIT driver stops the PIT and waits until it stopped. This can take over 100ms. Simply stopping in u-boot isn't sufficient as the PIT will still be running when Linux is waiting until it stopped. So, we stop it in u-boot by setting the compare value to a value slightly greater than the current running counter to make the PIT stopped in short time.

Quoted 5 lines

---

Changes in v3:
* Really fix comment

Applied to u-boot-atmel/at91.

Thanks,
Reinhard