giovedì 9 aprile 2009

Very Early Support!

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!

1 commento:

  1. Thank you Joannah for your reading :)
    There will be soon some news!

    Alberto!

    RispondiElimina