[Xenomai-core] [RFC] Port to AT91SAM9G45

2012-02-07 Thread Gregory CLEMENT
Hello,

I've done the port for AT91SAM9G45 on a AT91SAM9M10G45-EK board. The
following patch have to be applied on top of the
adeos-ipipe-2.6.38.8-arm-1.18-04.patch patch.

I also ran latency test under heavy stress using:
- hackbench to stress the scheduler
- netcat to stress the Ethernet interface and generate a lot of interrupts
- ls and dd( reading a /dev/mtdblock and writing on a tmpfs) for global stress

I join the results I had after running each latency test during 10 hours.

If the results I get seem the correct could you apply this patch in
Xenomai?

Should I also submit this patch to adeos project?

Regards
-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
+33 602 196 044
From 39a2100b7bc34755d22409ea1f0d23a94bd99ed8 Mon Sep 17 00:00:00 2001
From: Gregory CLEMENT gregory.clem...@free-electrons.com
Date: Sat, 29 Oct 2011 19:16:57 +0200
Subject: [PATCH 1/1] Adeos / Xenomai port for AT91SAM9M10G45-EK


Signed-off-by: Gregory CLEMENT gregory.clem...@free-electrons.com
---
 arch/arm/mach-at91/Makefile|1 +
 arch/arm/mach-at91/at91_ipipe_time.c   |   23 +
 arch/arm/mach-at91/at91sam9g45.c   |   50 +++-
 arch/arm/mach-at91/include/mach/hardware.h |2 +
 4 files changed, 68 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 5e11f9f..99c487d 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -105,4 +105,5 @@ obj-$(CONFIG_ARCH_AT91SAM9263)	+= at91_ipipe_time.o
 obj-$(CONFIG_ARCH_AT91SAM9RL)	+= at91_ipipe_time.o
 obj-$(CONFIG_ARCH_AT91SAM9G20)  += at91_ipipe_time.o
 obj-$(CONFIG_ARCH_AT91X40)	+= at91_ipipe_time.o
+obj-$(CONFIG_ARCH_AT91SAM9G45)	+= at91_ipipe_time.o
 endif
diff --git a/arch/arm/mach-at91/at91_ipipe_time.c b/arch/arm/mach-at91/at91_ipipe_time.c
index b0aa6a4..2e97a28 100644
--- a/arch/arm/mach-at91/at91_ipipe_time.c
+++ b/arch/arm/mach-at91/at91_ipipe_time.c
@@ -6,6 +6,9 @@
  * Adaptation to AT91SAM926x:
  * Copyright (C) 2007 Gregory CLEMENT, Adeneo
  *
+ * Adaptation to AT91SAM9G45:
+ * Copyright (C) 2011 Gregory CLEMENT, Free Electrons
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
@@ -55,6 +58,10 @@
 #define AT91_ID_TC0 AT91X40_ID_TC0
 #define AT91_ID_TC1 AT91X40_ID_TC1
 #define AT91_ID_TC2 AT91X40_ID_TC2
+#elif defined(CONFIG_ARCH_AT91SAM9G45)
+#define AT91_ID_TC0 AT91SAM9G45_ID_TCB
+#define AT91_ID_TC1 AT91SAM9G45_ID_TCB
+#define AT91_ID_TC2 AT91SAM9G45_ID_TCB
 #else
 #error AT91 processor unsupported by Adeos
 #endif
@@ -146,12 +153,14 @@ at91_tc_set_mode(enum clock_event_mode mode, struct clock_event_device *dev)
 	if (mode == CLOCK_EVT_MODE_PERIODIC) {
 		unsigned long v;
 
-#ifndef CONFIG_ARCH_AT91SAM9263
-		clk_enable(clk_get(NULL, tc
-   __stringify(CONFIG_IPIPE_AT91_TC) _clk));
-#else /* AT91SAM9263 */
+#ifdef CONFIG_ARCH_AT91SAM9263
 		clk_enable(clk_get(NULL, tcb_clk));
-#endif /* AT91SAM9263 */
+#elif CONFIG_ARCH_AT91SAM9G45
+		clk_enable(clk_get(NULL, tcb0_clk));
+#else /* AT91SAM9263 and AT91SAM9G45*/
+		clk_enable(clk_get(NULL, tc
+		   __stringify(CONFIG_IPIPE_AT91_TC) _clk));
+#endif 
 
 		/* No Sync. */
 		at91_tc_write(AT91_TC_BCR, 0);
@@ -246,7 +255,7 @@ void __init at91_timer_init(void)
 	(void) at91_sys_read(AT91_ST_SR);	/* Clear any pending interrupts */
 #elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9261) \
 	|| defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91SAM9RL) \
-	|| defined(CONFIG_ARCH_AT91SAM9G20)
+	|| defined(CONFIG_ARCH_AT91SAM9G20) || defined(CONFIG_ARCH_AT91SAM9G45)
 	at91_sys_write(AT91_PIT_MR, 0);
 
 	/* Clear any pending interrupts */
@@ -303,7 +312,7 @@ void __init at91_timer_init(void)
 struct sys_timer at91rm9200_timer = {
 #elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9261) \
 	|| defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91SAM9RL) \
-	|| defined(CONFIG_ARCH_AT91SAM9G20)
+	|| defined(CONFIG_ARCH_AT91SAM9G20) || defined(CONFIG_ARCH_AT91SAM9G45)
 struct sys_timer at91sam926x_timer = {
 #elif defined(CONFIG_ARCH_AT91X40)
 struct sys_timer at91x40_timer = {
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index c67b47f..d0ef1af 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -31,7 +31,16 @@ static struct map_desc at91sam9g45_io_desc[] __initdata = {
 		.pfn		= __phys_to_pfn(AT91_BASE_SYS),
 		.length		= SZ_16K,
 		.type		= MT_DEVICE,
-	}, {
+	},
+#ifdef CONFIG_IPIPE
+	{
+		.virtual	= AT91_VA_BASE_TCB0,
+		.pfn		= __phys_to_pfn(AT91_BASE_TCB0),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	},
+#endif /* CONFIG_IPIPE */
+	{
 		.virtual	= AT91_IO_VIRT_BASE - AT91SAM9G45_SRAM_SIZE,
 		.pfn		= 

Re: [Xenomai-core] [RFC] Port to AT91SAM9G45

2012-02-07 Thread Gilles Chanteperdrix
On 02/07/2012 02:01 PM, Gregory CLEMENT wrote:
 Hello,
 
 I've done the port for AT91SAM9G45 on a AT91SAM9M10G45-EK board. The
 following patch have to be applied on top of the
 adeos-ipipe-2.6.38.8-arm-1.18-04.patch patch.
 
 I also ran latency test under heavy stress using:
 - hackbench to stress the scheduler
 - netcat to stress the Ethernet interface and generate a lot of interrupts
 - ls and dd( reading a /dev/mtdblock and writing on a tmpfs) for global stress
 
 I join the results I had after running each latency test during 10 hours.
 
 If the results I get seem the correct could you apply this patch in
 Xenomai?
 
 Should I also submit this patch to adeos project?

We will merge this patch in the adeos patch, yes. Thanks. Note that
xenomai-2.6.0 provides a dohell command in order to generate some
load, and a xeno-test script which runs latency under dohell load.

Are the results obtained with or without the FCSE option enabled?

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] [RFC] Port to AT91SAM9G45

2012-02-07 Thread Gregory CLEMENT
On 02/07/2012 04:55 PM, Gilles Chanteperdrix wrote:
 On 02/07/2012 02:01 PM, Gregory CLEMENT wrote:
 Hello,

 I've done the port for AT91SAM9G45 on a AT91SAM9M10G45-EK board. The
 following patch have to be applied on top of the
 adeos-ipipe-2.6.38.8-arm-1.18-04.patch patch.

 I also ran latency test under heavy stress using:
 - hackbench to stress the scheduler
 - netcat to stress the Ethernet interface and generate a lot of interrupts
 - ls and dd( reading a /dev/mtdblock and writing on a tmpfs) for global 
 stress

 I join the results I had after running each latency test during 10 hours.

 If the results I get seem the correct could you apply this patch in
 Xenomai?

 Should I also submit this patch to adeos project?
 
 We will merge this patch in the adeos patch, yes. Thanks. Note that
 xenomai-2.6.0 provides a dohell command in order to generate some
 load, and a xeno-test script which runs latency under dohell load.
 


Thanks for the pointer. Theses scripts cover almost all I've done,
expect the case involving 'dd'. I chose to read the flash and no to
write on a mount point located in flash to no wear it.
Next time I will use these scripts and just tune them for my need.

 Are the results obtained with or without the FCSE option enabled?
 

They are obtained with the FCSE option enabled. Do you want the kernel
config file ?

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
+33 602 196 044

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core