All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabrice Gasnier <fabrice.gasnier@domain.hid>
To: xenomai@xenomai.org
Subject: [Xenomai-help] Build and run xenomai 2.5.5.2 - linux-2.6.33 on imx27
Date: Mon, 07 Mar 2011 15:40:41 +0100	[thread overview]
Message-ID: <4D74EE69.5020705@domain.hid> (raw)

Dear all,

I'm currently evaluating xenomai 2.5.5.2 on a i.MX27 platform with 
adeos-ipipe-2.6.33-arm-1.18-01.patch.


I've encountred two issues for the time being  (same with 
adeos-ipipe-2.6.33-arm-1.18-00.patch).

1°/ First one happens when building a 2.6.33.3 kernel (after xenomai 
prepare/configure/compile stage):

CC      arch/arm/plat-mxc/time.o
arch/arm/plat-mxc/time.c: In function 'mxc_timer_init':
arch/arm/plat-mxc/time.c:400: error: 'TIM1_BASE_ADDR' undeclared (first 
use in this function)
arch/arm/plat-mxc/time.c:400: error: (Each undeclared identifier is 
reported only once
arch/arm/plat-mxc/time.c:400: error: for each function it appears in.)
make[1]: *** [arch/arm/plat-mxc/time.o] Erreur 1
make: *** [arch/arm/plat-mxc] Erreur 2


I first tried 2.6.31 kernel that was compiling (patched with 
adeos-ipipe-2.6.31-arm-1.16-02.patch).
Looking for differences lead me to patch my kernel with:

Index: linux-2.6.33.3/arch/arm/plat-mxc/time.c
===================================================================
--- linux-2.6.33.3.orig/arch/arm/plat-mxc/time.c    2011-02-28 
11:44:02.000000000 +0100
+++ linux-2.6.33.3/arch/arm/plat-mxc/time.c    2011-02-28 
11:48:19.000000000 +0100
@@ -395,12 +395,17 @@
      tsc_info.freq = clk_get_rate(timer_clk);
      mxc_min_delay = ((__ipipe_cpu_freq + 500000) / 1000000) ?: 1;

-    if (cpu_is_mx1() || cpu_is_mx2()) {
-#if defined(CONFIG_ARCH_MX1) || defined(CONFIG_ARCH_MX2)
+    if (cpu_is_mx1()) {
+#ifdef CONFIG_ARCH_MX1
          tsc_info.u.counter_paddr = (TIM1_BASE_ADDR + MX1_2_TCN);
          tsc_info.counter_vaddr =
              (unsigned long)(timer_base + MX1_2_TCN);
  #endif
+    } else if (cpu_is_mx2()) {
+#ifdef CONFIG_ARCH_MX2
+        tsc_info.u.counter_paddr = (GPT1_BASE_ADDR + MX1_2_TCN);
+        tsc_info.counter_vaddr = (unsigned long)(timer_base + MX1_2_TCN);
+#endif
      } else if (cpu_is_mx3()) {
  #ifdef CONFIG_ARCH_MX3
          tsc_info.u.counter_paddr = (GPT1_BASE_ADDR + MX3_TCN);


2°/ Second issue comes when trying to launch xeno-test:
[...]
root@domain.hid:~ /usr/xenomai/share/xenomai/testsuite/latency/run -- -sh 
-T 120 -t0
*
*
* Type ^C to stop this application.
*
*
== Sampling period: 1000 us
== Test mode: periodic user-mode task
== All results in microseconds
warming up...
Unhandled fault: external abort on non-linefetch (0x008) at 0x40021010
Bus error
[...]


Looking at that thread:
http://www.mail-archive.com/xenomai@xenomai.org
It appears a similar issue has already been fixed on an i.MX25 by 
clearing supervisor's protection bit.


So, I tried the following, that seem to fix the issue as well:
Index: linux-2.6.33.3/arch/arm/mach-mx2/devices.c
===================================================================
--- linux-2.6.33.3.orig/arch/arm/mach-mx2/devices.c    2011-03-01 
10:51:53.000000000 +0100
+++ linux-2.6.33.3/arch/arm/mach-mx2/devices.c    2011-03-02 
17:44:08.000000000 +0100
@@ -680,3 +680,16 @@
  {
      return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
  }
+
+#ifdef CONFIG_IPIPE
+static int post_cpu_init(void)
+{
+    /* Allow userspace access through the
+     * peripheral access register (PAR).
+     */
+    if (cpu_is_mx27 ())
+        ipipe_mach_allow_uaccess(AIPI_BASE_ADDR, 3);
+    return 0;
+}
+postcore_initcall(post_cpu_init);
+#endif /* CONFIG_IPIPE */
Index: linux-2.6.33.3/arch/arm/plat-mxc/cpu.c
===================================================================
--- linux-2.6.33.3.orig/arch/arm/plat-mxc/cpu.c    2011-03-01 
15:11:57.000000000 +0100
+++ linux-2.6.33.3/arch/arm/plat-mxc/cpu.c    2011-03-02 
09:38:28.000000000 +0100
@@ -1,5 +1,6 @@
  #include <linux/module.h>
  #include <linux/io.h>
+#include <mach/hardware.h>

  unsigned int __mxc_cpu_type;
  EXPORT_SYMBOL(__mxc_cpu_type);
@@ -34,4 +35,16 @@
      aips_reg &= 0x00FFFFFF;
      __raw_writel(aips_reg, aips2 + 0x50);
  }
+
+#if defined(CONFIG_ARCH_MX1) || defined(CONFIG_ARCH_MX2)
+void ipipe_mach_allow_uaccess(unsigned long aipi_base_addr, unsigned 
long bit_num)
+{
+    u32 tmp;
+
+    tmp = __raw_readl(IO_ADDRESS(aipi_base_addr + 0x00000008));
+    __raw_writel(tmp & ~(1 << bit_num), IO_ADDRESS(aipi_base_addr + 
0x00000008));
+
+}
+#endif
+
  #endif /* CONFIG_IPIPE */
Index: linux-2.6.33.3/arch/arm/plat-mxc/include/mach/common.h
===================================================================
--- linux-2.6.33.3.orig/arch/arm/plat-mxc/include/mach/common.h    
2011-03-01 15:14:35.000000000 +0100
+++ linux-2.6.33.3/arch/arm/plat-mxc/include/mach/common.h    2011-03-02 
09:47:34.000000000 +0100
@@ -47,6 +47,9 @@

  #ifdef CONFIG_IPIPE
  void ipipe_mach_allow_hwtimer_uaccess(unsigned long aips1, unsigned 
long aips2);
+#if defined(CONFIG_ARCH_MX1) || defined(CONFIG_ARCH_MX2)
+void ipipe_mach_allow_uaccess(unsigned long aipi_base_addr, unsigned 
long bit_num);
+#endif
  #endif

  #endif



Could someone advise me on the modifications brought here?
Do these modifications look like ok to you?

Thanks in advance,

Fabrice




             reply	other threads:[~2011-03-07 14:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-07 14:40 Fabrice Gasnier [this message]
2011-03-07 14:46 ` [Xenomai-help] Build and run xenomai 2.5.5.2 - linux-2.6.33 on imx27 Gilles Chanteperdrix
2011-03-07 15:40   ` Fabrice Gasnier
2011-03-07 16:09     ` Gilles Chanteperdrix
2011-03-07 21:28 ` Gilles Chanteperdrix
2011-03-08  8:26   ` Fabrice Gasnier
2011-03-08  8:45     ` Gilles Chanteperdrix
2011-03-08  8:51     ` Gilles Chanteperdrix
2011-03-08  9:55   ` Fabrice Gasnier
2011-03-08  9:59     ` Gilles Chanteperdrix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D74EE69.5020705@domain.hid \
    --to=fabrice.gasnier@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.