Skip to contentSkip to conversation

Boot XIP kernel for IMX

PATCH In review Darius 3 participants 3 messages Feb 28, 2008 – Apr 22, 2008

Subsystems (3)
lore
Share & tools
lore

Darius

author
#0 lore raw

PATCH 1/1 Boot XIP kernel for IMX

Adds possibility to boot XIP kernel from flash for IMX.
I have tested it with M9328MXLADS V2.0 board.
It does NOT support write to flash, it only does support booting xip kernel. Somebody can continue and make feature to have rw rootfs in the flash with XIP kernel together:)

arch/arm/Kconfig +1 -0
diff -uprN -X linux-2.6.24.3-vanilla//Documentation/dontdiff linux-2.6.24.3-vanilla/arch/arm/Kconfig linux-2.6.24.3/arch/arm/Kconfig
@@ -244,6 +244,7 @@ config ARCH_IMX
 	select GENERIC_GPIO
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
+	select ARCH_MTD_XIP
 	help
 	  Support for Motorola's i.MX family of processors (MX1, MXL).
include/asm-arm/arch-imx/imx-regs.h +4 -0
diff -uprN -X linux-2.6.24.3-vanilla//Documentation/dontdiff linux-2.6.24.3-vanilla/include/asm-arm/arch-imx/imx-regs.h linux-2.6.24.3/include/asm-arm/arch-imx/imx-regs.h
@@ -348,6 +348,10 @@
 #define IMX_INTENABLEH     __REG(IMX_AITC_BASE+0x10)
 #define IMX_INTENABLEL     __REG(IMX_AITC_BASE+0x14)
 
+#define IMX_NIPNDH	__REG(IMX_AITC_BASE+0x58) 		/* Normal Interrupt Pending Register High */
+#define IMX_NIPNDL 	__REG(IMX_AITC_BASE+0x5C)		/* Normal Interrupt Pending Register Low  */
+
+
 /*
  *  General purpose timers
  */
include/asm-arm/arch-imx/mtd-xip.h +37 -0
diff -uprN -X linux-2.6.24.3-vanilla//Documentation/dontdiff linux-2.6.24.3-vanilla/include/asm-arm/arch-imx/mtd-xip.h linux-2.6.24.3/include/asm-arm/arch-imx/mtd-xip.h
@@ -0,0 +1,37 @@
+/*
+ * MTD primitives for XIP support. Architecture specific functions
+ *
+ * Do not include this file directly. It's included from linux/mtd/xip.h
+ * 
+ * Author:	
+ * Created:	Nov 2, 2004
+ * Copyright:	(C) 2004 MontaVista Software, Inc.
+ *
+ * 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.
+ *
+ * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
+ */
+
+#ifndef __ARCH_IMX_MTD_XIP_H__
+#define __ARCH_IMX_MTD_XIP_H__
+
+#include <asm/arch/imx-regs.h>
+
+#define xip_irqpending()        (( IMX_INTENABLEH  & IMX_NIPNDH ) || ( IMX_INTENABLEL & IMX_NIPNDL ))
+#define xip_currtime()          (IMX_TCN(1))
+#define xip_elapsed_since(x)    (signed)((IMX_TCN(1) - (x)) / 4)
+
+/*
+#define xip_irqpending()        ( IMX_NIPNDH || IMX_NIPNDL )
+#define xip_currtime()          (IMX_TCN(IMX_TIM1_BASE))
+#define xip_elapsed_since(x)    (signed)((IMX_TCN(IMX_TIM1_BASE) -(x)) * 31)
+*/
+
+//#define xip_cpu_idle()  asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1))
+
+#warning IMX_MTD_XIP enabled!
+
+#endif /* __ARCH_IMX_MTD_XIP_H__ */
+
#1 lore raw

include/asm-arm/arch-imx/mtd-xip.h line 32

Quoted 8 lines · Darius
include/asm-arm/arch-imx/mtd-xip.h +8 -0
+
+/*
+#define xip_irqpending()        ( IMX_NIPNDH || IMX_NIPNDL )
+#define xip_currtime()          (IMX_TCN(IMX_TIM1_BASE))
+#define xip_elapsed_since(x)    (signed)((IMX_TCN(IMX_TIM1_BASE) -(x)) * 31)
+*/
+
+//#define xip_cpu_idle()  asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1))

Is there a reason to leave these bits in the patch?

Jörn

Signature · 3 lines
When people work hard for you for a pat on the back, you've got
to give them that pat.
-- Robert Heinlein
#2 lore raw
In reply to Darius
Quoted 6 lines · Darius

Adds possibility to boot XIP kernel from flash for IMX.
I have tested it with M9328MXLADS V2.0 board.
It does NOT support write to flash, it only does support booting xip kernel. Somebody can continue and make feature to have rw rootfs in the
flash with XIP kernel together:)

Why doesn't write support work? If probes work, shouldn't writes?

This is an ARM architecture change and should probably go via rmk.

Quoted 65 lines

diff -uprN -X linux-2.6.24.3-vanilla//Documentation/dontdiff linux-2.6.24.3-vanilla/arch/arm/Kconfig linux-2.6.24.3/arch/arm/Kconfig

arch/arm/Kconfig +1 -0
@@ -244,6 +244,7 @@ config ARCH_IMX
 	select GENERIC_GPIO
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
+	select ARCH_MTD_XIP
 	help
 	  Support for Motorola's i.MX family of processors (MX1, MXL).

diff -uprN -X linux-2.6.24.3-vanilla//Documentation/dontdiff linux-2.6.24.3-vanilla/include/asm-arm/arch-imx/imx-regs.h linux-2.6.24.3/include/asm-arm/arch-imx/imx-regs.h

include/asm-arm/arch-imx/imx-regs.h +4 -0
@@ -348,6 +348,10 @@
 #define IMX_INTENABLEH     __REG(IMX_AITC_BASE+0x10)
 #define IMX_INTENABLEL     __REG(IMX_AITC_BASE+0x14)
 
+#define IMX_NIPNDH	__REG(IMX_AITC_BASE+0x58) 		/* Normal Interrupt Pending Register High */
+#define IMX_NIPNDL 	__REG(IMX_AITC_BASE+0x5C)		/* Normal Interrupt Pending Register Low  */
+
+
 /*
  *  General purpose timers
  */

diff -uprN -X linux-2.6.24.3-vanilla//Documentation/dontdiff linux-2.6.24.3-vanilla/include/asm-arm/arch-imx/mtd-xip.h linux-2.6.24.3/include/asm-arm/arch-imx/mtd-xip.h

include/asm-arm/arch-imx/mtd-xip.h +37 -0
@@ -0,0 +1,37 @@
+/*
+ * MTD primitives for XIP support. Architecture specific functions
+ *
+ * Do not include this file directly. It's included from linux/mtd/xip.h
+ * 
+ * Author:	
+ * Created:	Nov 2, 2004
+ * Copyright:	(C) 2004 MontaVista Software, Inc.
+ *
+ * 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.
+ *
+ * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
+ */
+
+#ifndef __ARCH_IMX_MTD_XIP_H__
+#define __ARCH_IMX_MTD_XIP_H__
+
+#include <asm/arch/imx-regs.h>
+
+#define xip_irqpending()        (( IMX_INTENABLEH  & IMX_NIPNDH ) || ( IMX_INTENABLEL & IMX_NIPNDL ))
+#define xip_currtime()          (IMX_TCN(1))
+#define xip_elapsed_since(x)    (signed)((IMX_TCN(1) - (x)) / 4)
+
+/*
+#define xip_irqpending()        ( IMX_NIPNDH || IMX_NIPNDL )
+#define xip_currtime()          (IMX_TCN(IMX_TIM1_BASE))
+#define xip_elapsed_since(x)    (signed)((IMX_TCN(IMX_TIM1_BASE) -(x)) * 31)
+*/
+
+//#define xip_cpu_idle()  asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1))
+
+#warning IMX_MTD_XIP enabled!
+
+#endif /* __ARCH_IMX_MTD_XIP_H__ */
+
Signature · 1 line
dwmw2