Alberto Embedded & Open experience

Notes on my experience on Open Source Embedded Systems

Archive for April 2009

Early Armadillo 500 support (the last?)

leave a comment »

Ok, after reviewing mechanism this is the patch that give early support to the Atmark Armadillo 500 dev board.
The patch apply to the latests kernel source obtained by

git pull

 

in the root local git repository.

0001-Initial-support-for-Atmark-Armadillo-500-developing.patch

Written by Alberto!

17/04/2009 at 3:47 pm

Posted in Armadillo

Tagged with , ,

Author and name on Git configuration

leave a comment »

From: http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html

$ git config --global user.name "Alberto Panizzo" $ git config --global user.email maramaopercheseimorto@gmail.com

Written by Alberto!

15/04/2009 at 4:11 pm

Posted in Git

Tagged with , ,

Early Armadillo 500 support

leave a comment »

Ok! Now I am ready to post the first official Early Atmark Armadillo 500 developing board support patch!

This patch add the Armadillo 500 initial support. Enabling the mxc uart console via make gconfig (by default using make armadillo500_defconfig) we can see the console output through Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(1,0).

To see debug strings on the console you have to apply the patch “Clock ipg_clk/ipg_per_clk synchronization” due to resolve clock the synchronization issue.

Patches attached because of changes made by this blog to the code style. (Indentation, …)

0001-Initial-support-for-Atmark-Armadillo-500-developing.patch
0002-Add-armadillo500_defconfig-file-in-the-tree.patch
0003-Clock-ipg_clk-ipg_per_clk-synchronization.patch

Written by Alberto!

15/04/2009 at 3:46 pm

Clock syncronization issue!

leave a comment »

Time spent to analyse the imx console driver to found where is the bug that produce scrambling chars on the serial debug and the problem was not there!

The problem is ipg_clk/ipg_per_clk synchronization!
ipg_per_clk clock signal has two possible clock source decided by bit 24 (PERCS) of CCMR register.
On my armadillo 500 board the clock source was set to usb_pll instead of ipg_clk resulting on not synchronized clocks signals on the UART device! producing wired characters on the output.

This patch correct the issue, for me and also for all iMX31 boards (if misconfigured)

diff –git a/arch/arm/mach-mx3/clock.c b/arch/arm/mach-mx3/clock.c
index ca46f48..f1a581d 100644
— a/arch/arm/mach-mx3/clock.c
+++ b/arch/arm/mach-mx3/clock.c
@@ -581,6 +581,11 @@ int __init mx31_clocks_init(unsigned long fref)
MX32, but still required to be set */
MXC_CCM_CGR2);

+ /* Ensure ipg_per_clk clock is generated by ipg_clk and not by
+ usb_pll (CCMR:24 = 1) to do not turn off UART after disabling
+ usb_pll and mantain ipg_clk and ipg_per_clk syncronization */
+ __raw_writel(__raw_readl(MXC_CCM_CCMR) | (1 << 24), MXC_CCM_CCMR);
+
usb_pll_disable(&usb_pll_clk);

pr_info(“Clock input source is %ld\n”, clk_get_rate(&ckih_clk));

Written by Alberto!

15/04/2009 at 2:48 pm

Posted in Armadillo

Tagged with , , , ,

Very Early Support!

with 2 comments

Ook some time working and first code work fine.
This is the first debugging patch to the kernel vanilla 2.6.29 and the result is very early debug strings from /arch/arm/boot/compressed/head.S and /arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S printed on the serial port. And an Alive message that state all is gone ok before call start_kernel().
Ehm..! no debug output is shown after start_kernel call..
Next is porting ttymcx console driver to support printk() message printing.

The patch:

diff –git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index b371fba..5d08227 100644
— a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -17,6 +17,9 @@
* 100% relocatable. Any attempt to do so will result in a crash.
* Please select one of the following when turning on debugging.
*/
+
+#define DEBUG 1
+
#ifdef DEBUG

#if defined(CONFIG_DEBUG_ICEDCC)
diff –git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
index 991952c..5d43cfa 100644
— a/arch/arm/kernel/head-common.S
+++ b/arch/arm/kernel/head-common.S
@@ -50,7 +50,9 @@ __mmap_switched:
1: cmp r6, r7
strcc fp, [r6],#4
bcc 1b

+
+ bl __alive
+
ldmia r3, {r4, r5, r6, r7, sp}
str r9, [r4] @ Save processor ID
str r1, [r5] @ Save machine type
@@ -69,6 +71,16 @@ ENDPROC(__mmap_switched)
* and hope for the best (useful if bootloader fails to pass a proper
* machine ID for example).
*/
+__alive:
+ mov r10,r0
+ adr r0, str_a
+ bl printascii
+ mov r0,r10
+ mov pc, lr
+str_a: .asciz “\n Alive!\n”
+ .align
+ENDPROC(__alive)
+
__error_p:
#ifdef CONFIG_DEBUG_LL
adr r0, str_p1
diff –git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index d623558..4ac4337 100644
— a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -64,4 +64,12 @@ config MACH_QONG
Include support for Dave/DENX QongEVB-LITE platform. This includes
specific configurations for the board and its peripherals.

+config MACH_ARMADILLO500
+ bool “Support Atmark Armadillo-500 Development Base Board”
+ select ARCH_MX31
+ default n
+ help
+ Include support for Atmark Armadillo-500 platform. This includes
+ specific configurations for the board and its peripherals.
+
endif
diff –git a/arch/arm/mach-mx3/Makefile b/arch/arm/mach-mx3/Makefile
index 272c8a9..4659598 100644
— a/arch/arm/mach-mx3/Makefile
+++ b/arch/arm/mach-mx3/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_MACH_MX31_3DS) += mx31pdk.o
obj-$(CONFIG_MACH_MX31MOBOARD) += mx31moboard.o mx31moboard-devboard.o \
mx31moboard-marxbot.o
obj-$(CONFIG_MACH_QONG) += qong.o
+obj-$(CONFIG_MACH_ARMADILLO500) += armadillo5x0.o
diff –git a/arch/arm/mach-mx3/armadillo5x0.c b/arch/arm/mach-mx3/armadillo5x0.c
new file mode 100644
index 0000000..ae4e35e
— /dev/null
+++ b/arch/arm/mach-mx3/armadillo5x0.c
@@ -0,0 +1,117 @@
+/*
+ * armadillo500.c
+ *
+ * Copyright 2009 Alberto Panizzo
+ * updates in http://alberdroid.blogspot.com/
+ *
+ * Based on Atmark Techno, Inc. armadillo 500 BSP 2008 All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include
+#include
+#include
+
+/* Define Machine specific Memory regions */
+#include
+/* All machine types definitions */
+#include
+/* Machine descriptor definition */
+#include
+/* Time keepeing definitions */
+#include
+/* Memory mapping functions */
+#include
+/* Define map_desc */
+#include
+
+/* Platform functions */
+#include
+#include
+
+
+
+static void __init armadillo5x0_init(void)
+{
+}
+
+/*!
+ * This structure defines static mappings for the i.MX31ADS board.
+ */
+static struct map_desc armadillo5x0_io_desc[] __initdata = {
+ /*{//Internal RAM
+ .virtual = MX31_IRAM_BASE_ADDR_VIRT,
+ .pfn = __phys_to_pfn(IRAM_BASE_ADDR),
+ .length = IRAM_SIZE,
+ .type = MT_NONSHARED_DEVICE},
+ },*//* {//ROM PATCH
+ .virtual = ROMP_BASE_ADDR_VIRT,
+ .pfn = __phys_to_pfn(ROMP_BASE_ADDR),
+ .length = ROMP_SIZE,
+ .type = MT_DEVICE_NONSHARED
+ },*/ {//Shared Perpheral Bus Arbiter
+ .virtual = SPBA0_BASE_ADDR_VIRT,
+ .pfn = __phys_to_pfn(SPBA0_BASE_ADDR),
+ .length = SPBA0_SIZE,
+ .type = MT_DEVICE_NONSHARED
+ }, {//NOR Flash memory (32 M)
+ .virtual = CS0_BASE_ADDR_VIRT,
+ .pfn = __phys_to_pfn(CS0_BASE_ADDR),
+ .length = CS0_SIZE,
+ .type = MT_DEVICE
+ }, {//Extended Bus Region
+ .virtual = CS4_BASE_ADDR_VIRT,
+ .pfn = __phys_to_pfn(CS4_BASE_ADDR),
+ .length = CS4_SIZE,
+ .type = MT_DEVICE
+ },
+};
+
+/*!
+ * Set up static virtual mappings.
+ */
+static void __init armadillo5x0_map_io(void)
+{
+ /*
+ * Maps:
+ * – NAND, SDRAM, WEIM, M3IF, EMI controllers
+ * – AVIC (Vectored Interrupt controller)
+ * – AIPS1 and AIPS2
+ **/
+ mxc_map_io();
+ iotable_init(armadillo5x0_io_desc, ARRAY_SIZE(armadillo5x0_io_desc));
+}
+
+static void __init armadillo5x0_timer_init(void)
+{
+ mx31_clocks_init(26000000);
+}
+
+static struct sys_timer armadillo5x0_timer = {
+ .init = armadillo5x0_timer_init,
+};
+
+MACHINE_START(ARMADILLO5X0, “Armadillo-500”)
+ /* Maintainer: Atmark Techno, Inc. */
+ .phys_io = AIPS1_BASE_ADDR,
+ .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
+ .boot_params = PHYS_OFFSET + 0x00000100,
+ //.map_io = armadillo5x0_map_io,
+ //.init_irq = mxc_init_irq,
+ //.timer = &armadillo5x0_timer,
+ //.init_machine = armadillo5x0_init,
+MACHINE_END
diff –git a/arch/arm/plat-mxc/include/mach/board-armadillo5x0.h b/arch/arm/plat-mxc/include/mach/board-armadillo5x0.h
new file mode 100644
index 0000000..b16897b
— /dev/null
+++ b/arch/arm/plat-mxc/include/mach/board-armadillo5x0.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005-2007 Alberto Panizzo .
+ * All Rights Reserved.
+ */
+
+/*
+ * 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.
+ */
+
+#ifndef __ASM_ARCH_MXC_BOARD_ARMADILLO5X0_H__
+#define __ASM_ARCH_MXC_BOARD_ARMADILLO5X0_H__
+
+#include
+
+/*
+ * Other memory mapping regions
+ */
+
+#define CS0_BASE_ADDR_VIRT 0xE0000000
+#define CS0_SIZE SZ_128M
+
+/* mandatory for CONFIG_LL_DEBUG */
+
+#define MXC_LL_UART_PADDR UART1_BASE_ADDR
+#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
+
+#endif
diff –git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S
index 4f77314..d3440ab 100644
— a/arch/arm/plat-mxc/include/mach/debug-macro.S
+++ b/arch/arm/plat-mxc/include/mach/debug-macro.S
@@ -34,6 +34,9 @@
#ifdef CONFIG_MACH_QONG
#include
#endif
+#ifdef CONFIG_MACH_ARMADILLO500
+#include
+#endif
.macro addruart,rx
mrc p15, 0, \rx, c1, c0
tst \rx, #1 @ MMU enabled?

Compiling:

apply the patch…
$ export ARCH=arm
$ export CROSS_COMPILE=/media/dati/android/cupcake/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-
$ make allnoconfig
$ make gconfig
->System Type>ARMSystemType>Freescale MXC/iMX based=y
->Freescale MXC Implementation > Support Atmark Armadillo-500 Development Board=y
$ make
-> download to the board and boot!

Written by Alberto!

09/04/2009 at 9:25 am

iMX Linux Boot Process description online

with one comment

Within my links on right side now there is the pdf document that describe the entire Linux boot process adapted for arm i.MX31: after the bootloader work through the execution of /sbin/init!

Taste it! Bye!

Written by Alberto!

03/04/2009 at 9:09 pm

Posted in linux-arm

Tagged with , , , ,

Very deep focus on ARM Boot process

leave a comment »

Here Peter Pearse make a very deep and up-to-date focus analysis of SMP ARM Boot process:
http://www.linux-arm.org/LinuxBootLoader/SMPBoot
Thanks a lot to him 🙂

With little adjusting Voilà! the single core ARM Boot process!
The context where I have to work and without I will not understand nothing :p

Written by Alberto!

02/04/2009 at 3:04 pm

Posted in linux-arm

Tagged with , ,