[Xenomai-core] [PATCH] Support for Atmel AT91SAM9G20 processor

2009-06-04 Thread martin mangard
Hello

I made a patch in order to support the Atmel AT91SAM9G20 processor,
which has to be applied after the adeos-ipipe-2.6.27-arm-* patch.
Due to the similarities between the AT91SAM9260 and the AT91SAM9G20
processor, only a few changes were necessary. I booted the system on a
AT91SAM9G20-EK development
board and executed latencytest and clocktest. Are there plans to
officially support this processor in the future?

Martin

Thu Jun  4 12:19:58 UTC 2009
running: ./run -- -p 200 -t0 # latency
*
*
* Type ^C to stop this application.
*
*
== Sampling period: 200 us
== Test mode: periodic user-mode task
== All results in microseconds
warming up...
RTT|  00:00:01  (periodic user-mode task, 200 us period, priority 99)
RTH|-lat min|-lat avg|-lat max|-overrun|lat best|---lat worst
RTD|  37.790|  47.480|  71.705|   0|  37.790|  71.705
RTD|  10.658|  47.480|  74.612|   0|  10.658|  74.612
RTD|  21.317|  47.480|  71.705|   0|  10.658|  74.612
RTD|  21.317|  47.480|  71.705|   0|  10.658|  74.612
RTD|  20.348|  47.480|  71.705|   0|  10.658|  74.612
RTD|  20.348|  47.480|  71.705|   0|  10.658|  74.612
.
.

r...@at91sam9g20ek-xenomai:/usr/xenomai/bin# ./clocktest
== Tested clock: 0 (CLOCK_REALTIME)
CPU  ToD offset [us] ToD drift [us/s]  warps max delta [us]
---   -- --
  0  -1244111499212379.2   -0.040  00.0




diff -urp a/arch/arm/mach-at91/at91_ipipe_time.c
b/arch/arm/mach-at91/at91_ipipe_time.c
--- a/arch/arm/mach-at91/at91_ipipe_time.c  2009-06-03
15:23:30.0 +0200
+++ b/arch/arm/mach-at91/at91_ipipe_time.c  2009-06-03
15:24:59.0 +0200
@@ -34,7 +34,7 @@
 #define AT91_ID_TC0 AT91RM9200_ID_TC0
 #define AT91_ID_TC1 AT91RM9200_ID_TC1
 #define AT91_ID_TC2 AT91RM9200_ID_TC2
-#elif defined(CONFIG_ARCH_AT91SAM9260)
+#elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20)
 #define AT91_ID_TC0 AT91SAM9260_ID_TC0
 #define AT91_ID_TC1 AT91SAM9260_ID_TC1
 #define AT91_ID_TC2 AT91SAM9260_ID_TC2
@@ -339,7 +339,7 @@ void __init at91_timer_init(void)
at91_sys_write(AT91_ST_IDR, AT91_ST_PITS | AT91_ST_WDOVF |
AT91_ST_RTTINC | AT91_ST_ALMS);
(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_AT91SAM9263) ||
defined(CONFIG_ARCH_AT91SAM9RL) || defined(CONFIG_ARCH_AT91SAM9G20)
at91_sys_write(AT91_PIT_MR, 0);

/* Clear any pending interrupts */
@@ -399,7 +399,7 @@ void __init at91_timer_init(void)
 #ifdef CONFIG_ARCH_AT91RM9200
 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_AT91SAM9263) ||
defined(CONFIG_ARCH_AT91SAM9RL)|| defined(CONFIG_ARCH_AT91SAM9RL) ||
defined(CONFIG_ARCH_AT91SAM9G20)
 struct sys_timer at91sam926x_timer = {
 #elif defined(CONFIG_ARCH_AT91X40)
 struct sys_timer at91x40_timer = {
diff -urp a/arch/arm/mach-at91/include/mach/cpu.h
b/arch/arm/mach-at91/include/mach/cpu.h
--- a/arch/arm/mach-at91/include/mach/cpu.h 2009-06-03
15:23:30.0 +0200
+++ b/arch/arm/mach-at91/include/mach/cpu.h 2009-06-03
15:24:59.0 +0200
@@ -69,7 +69,7 @@ static inline unsigned long at91cap9_rev

 #ifdef CONFIG_ARCH_AT91SAM9260
 #define cpu_is_at91sam9xe()(at91_arch_identify() == ARCH_FAMILY_AT91SAM9XE)
-#define cpu_is_at91sam9260()   ((at91_cpu_identify() ==
ARCH_ID_AT91SAM9260) || cpu_is_at91sam9xe())
+#define cpu_is_at91sam9260()   ((at91_cpu_identify() ==
ARCH_ID_AT91SAM9260) || cpu_is_at91sam9xe() ||
(at91_cpu_identify()==ARCH_ID_AT91SAM9G20)))
 #else
 #define cpu_is_at91sam9xe()(0)
 #define cpu_is_at91sam9260()   (0)
diff -urp a/arch/arm/mach-at91/include/mach/hardware.h
b/arch/arm/mach-at91/include/mach/hardware.h
--- a/arch/arm/mach-at91/include/mach/hardware.h2009-06-03
15:23:30.0 +0200
+++ b/arch/arm/mach-at91/include/mach/hardware.h2009-06-03
15:24:59.0 +0200
@@ -64,7 +64,7 @@
 #ifdef CONFIG_IPIPE
 #if defined(CONFIG_ARCH_AT91RM9200)
 #define AT91_BASE_TCB0 AT91RM9200_BASE_TCB0
-#elif defined(CONFIG_ARCH_AT91SAM9260)
+#elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20)
 #define AT91_BASE_TCB0 AT91SAM9260_BASE_TCB0
 #elif defined(CONFIG_ARCH_AT91SAM9261)
 #define AT91_BASE_TCB0 AT91SAM9261_BASE_TCB0
diff -urp a/arch/arm/mach-at91/include/mach/irqs.h
b/arch/arm/mach-at91/include/mach/irqs.h
--- a/arch/arm/mach-at91/include/mach/irqs.h2009-06-03
15:23:30.0 +0200
+++ b/arch/arm/mach-at91/include/mach/irqs.h

Re: [Xenomai-core] [PATCH] Support for Atmel AT91SAM9G20 processor

2009-06-04 Thread Gilles Chanteperdrix
martin mangard wrote:
 Hello
 
 I made a patch in order to support the Atmel AT91SAM9G20 processor,
 which has to be applied after the adeos-ipipe-2.6.27-arm-* patch.
 Due to the similarities between the AT91SAM9260 and the AT91SAM9G20
 processor, only a few changes were necessary. I booted the system on a
 AT91SAM9G20-EK development
 board and executed latencytest and clocktest. Are there plans to
 officially support this processor in the future?

Well, now that you sent the patch, this should be included in the next
adeos patch. However:
- your mailer mangled the patch, so I can not apply it, please configure
your mailer to avoid mangling the patch, or if that is not possible,
send the patch as attachment;
-  there is one change in your patch that I do not like:

  #ifdef CONFIG_ARCH_AT91SAM9260
  #define cpu_is_at91sam9xe()(at91_arch_identify() == 
 ARCH_FAMILY_AT91SAM9XE)
 -#define cpu_is_at91sam9260()   ((at91_cpu_identify() ==
 ARCH_ID_AT91SAM9260) || cpu_is_at91sam9xe())
 +#define cpu_is_at91sam9260()   ((at91_cpu_identify() ==
 ARCH_ID_AT91SAM9260) || cpu_is_at91sam9xe() ||
 (at91_cpu_identify()==ARCH_ID_AT91SAM9G20)))

You are touching mailine code here. It this patch is really needed by
mainline, then post it to the linux arm kernel mailing list.

-- 
Gilles.

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


Re: [Xenomai-core] [PATCH] Support for Atmel AT91SAM9G20 processor

2009-06-04 Thread Gilles Chanteperdrix
Gilles Chanteperdrix wrote:
 martin mangard wrote:
 Hello

 I made a patch in order to support the Atmel AT91SAM9G20 processor,
 which has to be applied after the adeos-ipipe-2.6.27-arm-* patch.
 Due to the similarities between the AT91SAM9260 and the AT91SAM9G20
 processor, only a few changes were necessary. I booted the system on a
 AT91SAM9G20-EK development
 board and executed latencytest and clocktest. Are there plans to
 officially support this processor in the future?
 
 Well, now that you sent the patch, this should be included in the next
 adeos patch. However:
 - your mailer mangled the patch, so I can not apply it, please configure
 your mailer to avoid mangling the patch, or if that is not possible,
 send the patch as attachment;
 -  there is one change in your patch that I do not like:
 
  #ifdef CONFIG_ARCH_AT91SAM9260
  #define cpu_is_at91sam9xe()(at91_arch_identify() == 
 ARCH_FAMILY_AT91SAM9XE)
 -#define cpu_is_at91sam9260()   ((at91_cpu_identify() ==
 ARCH_ID_AT91SAM9260) || cpu_is_at91sam9xe())
 +#define cpu_is_at91sam9260()   ((at91_cpu_identify() ==
 ARCH_ID_AT91SAM9260) || cpu_is_at91sam9xe() ||
 (at91_cpu_identify()==ARCH_ID_AT91SAM9G20)))
 
 You are touching mailine code here. It this patch is really needed by
 mainline, then post it to the linux arm kernel mailing list.
 

Also, please send it as a patch to the current kernel i.e. 2.6.29.

-- 
Gilles.

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


Re: [Xenomai-core] [PATCH] Support for Atmel AT91SAM9G20 processor

2009-06-04 Thread martin mangard
Hello

You are right! This part of the patch is not necessary and is ignored
if the AT91SAM9G20 is selected in the kernel configuration. I made
this  change  during a test with another kernel configuration. Sadly
this change was still present during the creation of the patch. The
attached patch does not contain this part any more.


On Thu, Jun 4, 2009 at 1:15 PM, Gilles Chanteperdrix
gilles.chanteperd...@xenomai.org wrote:
 martin mangard wrote:
 Hello

 I made a patch in order to support the Atmel AT91SAM9G20 processor,
 which has to be applied after the adeos-ipipe-2.6.27-arm-* patch.
 Due to the similarities between the AT91SAM9260 and the AT91SAM9G20
 processor, only a few changes were necessary. I booted the system on a
 AT91SAM9G20-EK development
 board and executed latencytest and clocktest. Are there plans to
 officially support this processor in the future?

 Well, now that you sent the patch, this should be included in the next
 adeos patch. However:
 - your mailer mangled the patch, so I can not apply it, please configure
 your mailer to avoid mangling the patch, or if that is not possible,
 send the patch as attachment;
 -  there is one change in your patch that I do not like:

  #ifdef CONFIG_ARCH_AT91SAM9260
  #define cpu_is_at91sam9xe()    (at91_arch_identify() == 
 ARCH_FAMILY_AT91SAM9XE)
 -#define cpu_is_at91sam9260()   ((at91_cpu_identify() ==
 ARCH_ID_AT91SAM9260) || cpu_is_at91sam9xe())
 +#define cpu_is_at91sam9260()   ((at91_cpu_identify() ==
 ARCH_ID_AT91SAM9260) || cpu_is_at91sam9xe() ||
 (at91_cpu_identify()==ARCH_ID_AT91SAM9G20)))

 You are touching mailine code here. It this patch is really needed by
 mainline, then post it to the linux arm kernel mailing list.

 --
                                            Gilles.

diff -urp a/arch/arm/mach-at91/at91_ipipe_time.c b/arch/arm/mach-at91/at91_ipipe_time.c
--- a/arch/arm/mach-at91/at91_ipipe_time.c	2009-06-03 15:23:30.0 +0200
+++ b/arch/arm/mach-at91/at91_ipipe_time.c	2009-06-03 15:24:59.0 +0200
@@ -34,7 +34,7 @@
 #define AT91_ID_TC0 AT91RM9200_ID_TC0
 #define AT91_ID_TC1 AT91RM9200_ID_TC1
 #define AT91_ID_TC2 AT91RM9200_ID_TC2
-#elif defined(CONFIG_ARCH_AT91SAM9260)
+#elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20)
 #define AT91_ID_TC0 AT91SAM9260_ID_TC0
 #define AT91_ID_TC1 AT91SAM9260_ID_TC1
 #define AT91_ID_TC2 AT91SAM9260_ID_TC2
@@ -339,7 +339,7 @@ void __init at91_timer_init(void)
 	at91_sys_write(AT91_ST_IDR, AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS);
 	(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_AT91SAM9263) || defined(CONFIG_ARCH_AT91SAM9RL) || defined(CONFIG_ARCH_AT91SAM9G20) 
 	at91_sys_write(AT91_PIT_MR, 0);
 
 	/* Clear any pending interrupts */
@@ -399,7 +399,7 @@ void __init at91_timer_init(void)
 #ifdef CONFIG_ARCH_AT91RM9200
 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_AT91SAM9263) || defined(CONFIG_ARCH_AT91SAM9RL)|| defined(CONFIG_ARCH_AT91SAM9RL) || defined(CONFIG_ARCH_AT91SAM9G20) 
 struct sys_timer at91sam926x_timer = {
 #elif defined(CONFIG_ARCH_AT91X40)
 struct sys_timer at91x40_timer = {
diff -urp a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h
--- a/arch/arm/mach-at91/include/mach/hardware.h	2009-06-03 15:23:30.0 +0200
+++ b/arch/arm/mach-at91/include/mach/hardware.h	2009-06-03 15:24:59.0 +0200
@@ -64,7 +64,7 @@
 #ifdef CONFIG_IPIPE
 #if defined(CONFIG_ARCH_AT91RM9200)
 #define AT91_BASE_TCB0 AT91RM9200_BASE_TCB0
-#elif defined(CONFIG_ARCH_AT91SAM9260)
+#elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20) 
 #define AT91_BASE_TCB0 AT91SAM9260_BASE_TCB0
 #elif defined(CONFIG_ARCH_AT91SAM9261)
 #define AT91_BASE_TCB0 AT91SAM9261_BASE_TCB0
diff -urp a/arch/arm/mach-at91/include/mach/irqs.h b/arch/arm/mach-at91/include/mach/irqs.h
--- a/arch/arm/mach-at91/include/mach/irqs.h	2009-06-03 15:23:30.0 +0200
+++ b/arch/arm/mach-at91/include/mach/irqs.h	2009-06-03 15:24:59.0 +0200
@@ -52,7 +52,7 @@ extern unsigned __ipipe_at91_gpio_banks;
 #define __ipipe_mach_irq_mux_p(irq)	\
 	((unsigned) (irq - AT91RM9200_ID_PIOA)  __ipipe_at91_gpio_banks)
 
-#elif defined(CONFIG_ARCH_AT91SAM9260)
+#elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20) 
 #define __ipipe_mach_irq_mux_p(irq)	\
 	((unsigned) (irq - AT91SAM9260_ID_PIOA)  __ipipe_at91_gpio_banks)
 
diff -urp a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
--- a/arch/arm/mach-at91/Makefile	2009-06-03 15:23:30.0 +0200
+++ b/arch/arm/mach-at91/Makefile	2009-06-03 15:24:59.0 +0200
@@ -82,6 +82,7 @@