Skip to contentSkip to conversation

Add Eukrea CPUIMX27 support

PATCH New Eric Benard 3 participants 9 messages Jul 15, 2009 – Aug 3, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 Add Eukrea CPUIMX27 support

CPUIMX27 is built around Freescale's i.MX27 and has up to 64MB of NOR Flash, up to 512MB of NAND Flash and up to 256MB of mDDR, it includes an ethernet PHY in MII mode, an I2C RTC and a ST16554 QuadUART on nCS3.

---
 arch/arm/Kconfig                            |   11 ++
 arch/arm/Makefile                           |    1 +
 arch/arm/configs/eukrea_cpuimx27_defconfig  |  222 +++++++++++++++++++++++++++
 board/eukrea_cpuimx27/Makefile              |    3 +
 board/eukrea_cpuimx27/config.h              |   24 +++
 board/eukrea_cpuimx27/env/bin/_update       |   36 +++++
 board/eukrea_cpuimx27/env/bin/boot          |   47 ++++++
 board/eukrea_cpuimx27/env/bin/hush_hack     |    1 +
 board/eukrea_cpuimx27/env/bin/init          |   37 +++++
 board/eukrea_cpuimx27/env/bin/update_kernel |   15 ++
 board/eukrea_cpuimx27/env/bin/update_root   |   16 ++
 board/eukrea_cpuimx27/env/config            |   31 ++++
 board/eukrea_cpuimx27/eukrea_cpuimx27.c     |  191 +++++++++++++++++++++++
 board/eukrea_cpuimx27/eukrea_cpuimx27.dox   |   10 ++
 board/eukrea_cpuimx27/lowlevel_init.S       |  130 ++++++++++++++++
 15 files changed, 775 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/configs/eukrea_cpuimx27_defconfig
 create mode 100644 board/eukrea_cpuimx27/Makefile
 create mode 100644 board/eukrea_cpuimx27/config.h
 create mode 100644 board/eukrea_cpuimx27/env/bin/_update
 create mode 100644 board/eukrea_cpuimx27/env/bin/boot
 create mode 100644 board/eukrea_cpuimx27/env/bin/hush_hack
 create mode 100644 board/eukrea_cpuimx27/env/bin/init
 create mode 100644 board/eukrea_cpuimx27/env/bin/update_kernel
 create mode 100644 board/eukrea_cpuimx27/env/bin/update_root
 create mode 100644 board/eukrea_cpuimx27/env/config
 create mode 100644 board/eukrea_cpuimx27/eukrea_cpuimx27.c
 create mode 100644 board/eukrea_cpuimx27/eukrea_cpuimx27.dox
 create mode 100644 board/eukrea_cpuimx27/lowlevel_init.S
arch/arm/Kconfig +11 -0
index fa003b5..291b8f4 100644
@@ -19,6 +19,7 @@ config ARCH_TEXT_BASE
 	default 0xa7f00000 if MACH_PCA100
 	default 0x33fc0000 if MACH_A9M2440
 	default 0x23f00000 if MACH_MMCCPU
+	default 0xa0000000 if MACH_EUKREA_CPUIMX27
 
 config BOARDINFO
 	default "Synertronixx scb9328" if MACH_SCB9328
@@ -35,6 +36,7 @@ config BOARDINFO
 	default "Digi A9M2410" if MACH_A9M2410
 	default "Phytec phyCard-i.MX27" if MACH_PCA100
 	default "Bucyrus MMC-CPU" if MACH_MMCCPU
+	default "Eukrea CPUIMX27" if MACH_EUKREA_CPUIMX27
 
 config BOARD_LINKER_SCRIPT
 	bool
@@ -232,6 +234,15 @@ config MACH_MMCCPU
 	help
 	  Say y here if you are using the Bucyrus MMC-CPU
 
+config MACH_EUKREA_CPUIMX27
+	bool "EUKREA CPUIMX27"
+	select HAS_CFI
+	select ARCH_IMX27
+	select MACH_HAS_LOWLEVEL_INIT
+	help
+	  Say Y here if you are using Eukrea's CPUIMX27 equipped
+	  with a Freescale i.MX27 Processor
+
 endchoice
 
 source arch/arm/mach-imx/Kconfig
arch/arm/Makefile +1 -0
index aba6166..1513168 100644
@@ -25,6 +25,7 @@ board-$(CONFIG_MACH_A9M2410)       := a9m2410
 board-$(CONFIG_MACH_PCA100)        := phycard-i.MX27
 board-$(CONFIG_MACH_MMCCPU)        := mmccpu
 board-$(CONFIG_MACH_A9M2440)       := a9m2440
+board-$(CONFIG_MACH_EUKREA_CPUIMX27) := eukrea_cpuimx27
 
 # FIXME "cpu-y" never used on ARM!
 cpu-$(CONFIG_ARM920T)              := arm920t
arch/arm/configs/eukrea_cpuimx27_defconfig new file +222 -0

222 lines not on this page · raw message

board/eukrea_cpuimx27/Makefile new file +3 -0
new file mode 100644
index 0000000..5d958fa
@@ -0,0 +1,3 @@
+
+obj-y += lowlevel_init.o
+obj-y += eukrea_cpuimx27.o
board/eukrea_cpuimx27/config.h new file +24 -0
new file mode 100644
index 0000000..b3eed0b
@@ -0,0 +1,24 @@
+/**
+ * @file
+ * @brief Global defintions for the ARM i.MX27 based pcm038
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#endif	/* __CONFIG_H */
board/eukrea_cpuimx27/env/bin/_update new file +36 -0
new file mode 100644
index 0000000..fb7cbe8
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+if [ -z "$part" -o -z "$image" ]; then
+	echo "define \$part and \$image"
+	exit 1
+fi
+
+if [ \! -e "$part" ]; then
+	echo "Partition $part does not exist"
+	exit 1
+fi
+
+if [ $# = 1 ]; then
+	image=$1
+fi
+
+if [ x$ip = xdhcp ]; then
+	dhcp
+fi
+
+ping $eth0.serverip
+if [ $? -ne 0 ] ; then
+	echo "update aborted"
+	exit 1
+fi
+
+unprotect $part
+
+echo
+echo "erasing partition $part"
+erase $part
+
+echo
+echo "flashing $image to $part"
+echo
+tftp $image $part
board/eukrea_cpuimx27/env/bin/boot new file +47 -0

47 lines not on this page · raw message

board/eukrea_cpuimx27/env/bin/hush_hack new file +1 -0
new file mode 100644
index 0000000..5fffa92
@@ -0,0 +1 @@
+nand -a /dev/nand0.*
board/eukrea_cpuimx27/env/bin/init new file +37 -0
new file mode 100644
index 0000000..3bfd194
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+PATH=/env/bin
+export PATH
+
+. /env/config
+if [ -e /dev/nor0 ]; then
+	addpart /dev/nor0 $nor_parts
+fi
+
+if [ -e /dev/nand0 ]; then
+	addpart /dev/nand0 $nand_parts
+
+	# Uh, oh, hush first expands wildcards and then starts executing
+	# commands. What a bug!
+	source /env/bin/hush_hack 
+fi
+
+if [ -z $eth0.ethaddr ]; then
+	while [ -z $eth0.ethaddr ]; do
+		readline "no MAC address set for eth0. please enter the one found on your board: " eth0.ethaddr
+	done
+	echo -a /env/config "eth0.ethaddr=$eth0.ethaddr"
+fi
+
+echo
+echo -n "Hit any key to stop autoboot: "
+timeout -a $autoboot_timeout
+if [ $? != 0 ]; then
+	echo
+	echo "type update_kernel nand|nor [<imagename>] to update kernel into flash"
+	echo "type update_root nand|nor [<imagename>] to update rootfs into flash"
+	echo
+	exit
+fi
+
+boot
board/eukrea_cpuimx27/env/bin/update_kernel new file +15 -0
new file mode 100644
index 0000000..05c822d
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+. /env/config
+
+image=$uimage
+if [ x$1 = xnand ]; then
+	part=/dev/nand0.kernel.bb
+elif [ x$1 = xnor ]; then
+	part=/dev/nor0.kernel
+else
+	echo "usage: $0 nor|nand [imagename]"
+	exit 1
+fi
+
+. /env/bin/_update $2
board/eukrea_cpuimx27/env/bin/update_root new file +16 -0
new file mode 100644
index 0000000..eaf36eb
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. /env/config
+
+image=$uimage
+if [ x$1 = xnand ]; then
+	part=/dev/nand0.root.bb
+elif [ x$1 = xnor ]; then
+	part=/dev/nor0.root
+else
+	echo "usage: $0 nor|nand [imagename]"
+	exit 1
+fi
+
+. /env/bin/_update $2
+
board/eukrea_cpuimx27/env/config new file +31 -0
new file mode 100644
index 0000000..2547fb1
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# can be either 'net', 'nor' or 'nand''
+kernel=nor
+root=nor
+
+uimage=cpuimx27/uImage
+jffs2=cpuimx27/rootfs.jffs2
+
+autoboot_timeout=3
+
+# TFP410-SVGA TFP410-VGA CMO-QVGA Optrex-WVGA Sharp-QVGA-EK
+video="CMO-QVGA"
+bootargs="console=ttymxc0,115200 fec_mac=$eth0.ethaddr rtc-pcf8563.probe=0,0x51 video=mxcfb:$video"
+
+nor_parts="256k(uboot)ro,128k(ubootenv),1792k(kernel),-(root)"
+rootpart_nor="/dev/mtdblock3"
+
+nand_parts="-(nand)"
+rootpart_nand=""
+
+nfsroot=""
+
+# use 'dhcp' to do dhcp in uboot and in kernel
+ip=dhcp
+
+# or set your networking parameters here
+#eth0.ipaddr=a.b.c.d
+#eth0.netmask=a.b.c.d
+#eth0.gateway=a.b.c.d
+eth0.serverip=192.168.1.15
board/eukrea_cpuimx27/eukrea_cpuimx27.c new file +191 -0

191 lines not on this page · raw message

board/eukrea_cpuimx27/eukrea_cpuimx27.dox new file +10 -0
new file mode 100644
index 0000000..ad184ea
@@ -0,0 +1,10 @@
+/** @page eukrea_cpuimx27 Eukrea's CPUIMX27
+
+This CPU card is based on a Freescale i.MX27 CPU. The card is shipped with:
+
+- up to 64MiB NOR type Flash Memory
+- up to 256MiB synchronous dynamic RAM
+- up to 512MiB NAND type Flash Memory
+- MII 10/100 ethernet PHY
+
+*/
board/eukrea_cpuimx27/lowlevel_init.S new file +130 -0

130 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#1 lore raw

PATCH v2 2/3 Fix 2k page size NAND for iMX27

---
 drivers/nand/nand_imx.c             |   20 +++++++++++++++++---
 include/asm-arm/arch-imx/imx-nand.h |    3 ++-
 2 files changed, 19 insertions(+), 4 deletions(-)
drivers/nand/nand_imx.c +17 -3
index cbff7ce..ecfb649 100644
@@ -874,7 +874,7 @@ static void imx_nand_command(struct mtd_info *mtd, unsigned command,
 
 		if (host->pagesize_2k) {
 			send_addr(host, (page_addr >> 8) & 0xFF);
-			if (mtd->size >= 0x40000000) {
+			if (mtd->size >= 0x10000000) {
 				send_addr(host, (page_addr >> 16) & 0xff);
 			}
 		} else {
@@ -961,6 +961,15 @@ static void imx_low_erase(struct mtd_info *mtd)
  *
  * @return  The function always returns 0.
  */
+static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
+
+static struct nand_bbt_descr smallpage_memorybased = {
+	.options = NAND_BBT_SCAN2NDPAGE,
+	.offs = 5,
+	.len = 1,
+	.pattern = scan_ff_pattern
+};
+
 static int __init imxnd_probe(struct device_d *dev)
 {
 	struct nand_chip *this;
@@ -969,7 +978,7 @@ static int __init imxnd_probe(struct device_d *dev)
 	struct imx_nand_host *host;
 	u16 tmp;
 	int err = 0;
-#ifdef CONFIG_ARCH_MX27
+#ifdef CONFIG_ARCH_IMX27
 	PCCR1 |= PCCR1_NFC_BAUDEN;
 #endif
 	/* Allocate memory for MTD device structure and private data */
@@ -1050,7 +1059,12 @@ static int __init imxnd_probe(struct device_d *dev)
 		this->ecc.layout = &nand_hw_eccoob_16;
 	}
 
-	host->pagesize_2k = 0;
+	if (pdata->is2k) {
+		host->pagesize_2k = 1;
+		NFMS |= (1 << NFMS_BIT);
+		this->badblock_pattern = &smallpage_memorybased;
+	} else 
+		host->pagesize_2k = 0;
 
 	/* Scan to find existence of the device */
 	if (nand_scan(mtd, 1)) {
include/asm-arm/arch-imx/imx-nand.h +2 -1
index 5ebe0be..500bb1a 100644
@@ -8,6 +8,7 @@ void imx_nand_load_image(void *dest, int size, int pagesize, int blocksize);
 struct imx_nand_platform_data {
 	int width;
 	int hw_ecc;
-};
+	int is2k;
+	};
 #endif /* __ASM_ARCH_NAND_H */
 
Signature · 1 line
1.6.0.4
#2 lore raw

PATCH v2 3/3 Add NAND to EUKREA CPUIMX27 defconfig

---
 arch/arm/configs/eukrea_cpuimx27_defconfig |   10 ++++++++--
 board/eukrea_cpuimx27/eukrea_cpuimx27.c    |    1 +
 2 files changed, 9 insertions(+), 2 deletions(-)
arch/arm/configs/eukrea_cpuimx27_defconfig +8 -2
index 6402278..465db18 100644
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # U-Boot version: 2.0.0-rc9
-# Wed Jul 15 16:05:10 2009
+# Wed Jul 15 16:06:14 2009
 #
 CONFIG_ARCH_TEXT_BASE=0xa0000000
 CONFIG_BOARDINFO="Eukrea CPUIMX27"
@@ -151,6 +151,7 @@ CONFIG_CMD_MTEST=y
 # flash                         
 #
 CONFIG_CMD_FLASH=y
+CONFIG_CMD_NAND=y
 
 #
 # booting                       
@@ -209,7 +210,12 @@ CONFIG_DRIVER_CFI=y
 # CONFIG_DRIVER_CFI_NEW is not set
 CONFIG_DRIVER_CFI_OLD=y
 CONFIG_CFI_BUFFER_WRITE=y
-# CONFIG_NAND is not set
+CONFIG_NAND=y
+CONFIG_NAND_IMX=y
+# CONFIG_NAND_IMX_BOOT is not set
+# CONFIG_MTD_NAND_VERIFY_WRITE is not set
+# CONFIG_MTD_NAND_ECC_SMC is not set
+CONFIG_MTD_NAND_IDS=y
 # CONFIG_USB is not set
 
 #
board/eukrea_cpuimx27/eukrea_cpuimx27.c +1 -0
index 49c2f73..c87805f 100644
@@ -75,6 +75,7 @@ static struct device_d fec_dev = {
 struct imx_nand_platform_data nand_info = {
 	.width = 1,
 	.hw_ecc = 1,
+	.is2k = 1,
 };
 
 static struct device_d nand_dev = {
Signature · 1 line
1.6.0.4
#3 lore raw

PATCH v2 2/3 Fix 2k page size NAND for iMX27

In reply to Eric Benard
Quoted 13 lines · Eric Benard

static int __init imxnd_probe(struct device_d *dev) {

drivers/nand/nand_imx.c +1 -1
 	struct nand_chip *this;
@@ -969,7 +978,7 @@ static int __init imxnd_probe(struct device_d *dev)
 	struct imx_nand_host *host;
 	u16 tmp;
 	int err = 0;
-#ifdef CONFIG_ARCH_MX27
+#ifdef CONFIG_ARCH_IMX27
 	PCCR1 |= PCCR1_NFC_BAUDEN;
 #endif
 	/* Allocate memory for MTD device structure and private data */

drivers/nand/nand_imx.c static int __init imxnd_probe(struct device_d *dev) · line 1065

Quoted 8 lines
drivers/nand/nand_imx.c +4 -1
@@ -1050,7 +1059,12 @@ static int __init imxnd_probe(struct device_d *dev)
 		this->ecc.layout = &nand_hw_eccoob_16;
 	}
 
-	host->pagesize_2k = 0;
+	if (pdata->is2k) {
+		host->pagesize_2k = 1;
+		NFMS |= (1 << NFMS_BIT);
+		this->badblock_pattern = &smallpage_memorybased;

Why are you using the small-page badblock pattern with large pages?

drivers/nand/nand_imx.c static int __init imxnd_probe(struct device_d *dev) · line 1067

Quoted 2 lines
drivers/nand/nand_imx.c +2 -0
+	} else 
+		host->pagesize_2k = 0;

If you use braces on one side of if/else, use them on the other.

include/asm-arm/arch-imx/imx-nand.h void imx_nand_load_image(void *dest, int size, int pagesize, int blocksize); · line 12

Quoted 11 lines
include/asm-arm/arch-imx/imx-nand.h +2 -1
index 5ebe0be..500bb1a 100644
@@ -8,6 +8,7 @@ void imx_nand_load_image(void *dest, int size, int pagesize, int blocksize);
 struct imx_nand_platform_data {
 	int width;
 	int hw_ecc;
-};
+	int is2k;
+	};

That last brace should not be indented.

-Scott

#4 lore raw

PATCH v2 2/3 Fix 2k page size NAND for iMX27

Scott Wood a ?crit :

Quoted 8 lines · Eric Benard

drivers/nand/nand_imx.c static int __init imxnd_probe(struct device_d *dev) · line 1065

Quoted 4 lines
drivers/nand/nand_imx.c +4 -0
+	if (pdata->is2k) {
+		host->pagesize_2k = 1;
+		NFMS |= (1 << NFMS_BIT);
+		this->badblock_pattern = &smallpage_memorybased;

Why are you using the small-page badblock pattern with large pages?

that's what Freescale is doing in its Linux BSP and it doesn't work without, at least on my board (8 bits width NAND):

	if (!this->badblock_pattern) {
		if (mtd->writesize == NAND_PAGESIZE_2KB)
			this->badblock_pattern = &smallpage_memorybased;
		else
			this->badblock_pattern = (mtd->writesize > 512) ?
			    &largepage_memorybased : &smallpage_memorybased;
	}

Eric

#5 lore raw

PATCH v2 2/3 Fix 2k page size NAND for iMX27

In reply to Eric Benard
Quoted 5 lines · Eric Benard
---
 drivers/nand/nand_imx.c             |   20 +++++++++++++++++---
 include/asm-arm/arch-imx/imx-nand.h |    3 ++-
 2 files changed, 19 insertions(+), 4 deletions(-)

What tree is this against? There is no "drivers/nand" in current u-boot, it is in drivers/mtd/nand. And there is no nand_imx.c.

-Scott

#6 lore raw

PATCH v2 2/3 Fix 2k page size NAND for iMX27

Scott Wood a ?crit :

Quoted 10 lines · Eric Benard
Quoted 5 lines
---
 drivers/nand/nand_imx.c             |   20 +++++++++++++++++---
 include/asm-arm/arch-imx/imx-nand.h |    3 ++-
 2 files changed, 19 insertions(+), 4 deletions(-)

What tree is this against? There is no "drivers/nand" in current u-boot, it is in drivers/mtd/nand. And there is no nand_imx.c.

sorry this was for u-boot v2.
Eric

#7 lore raw

PATCH v2 2/3 Fix 2k page size NAND for iMX27

Quoted 8 lines · Eric B?nard

Scott Wood a ?crit :

Quoted 7 lines · Eric Benard
Quoted 5 lines

---
drivers/nand/nand_imx.c | 20 +++++++++++++++++---
include/asm-arm/arch-imx/imx-nand.h | 3 ++-

2 files changed, 19 insertions(+), 4 deletions(-)
Quoted 4 lines
Quoted 3 lines

What tree is this against? There is no "drivers/nand" in current u-boot, it is in drivers/mtd/nand. And there is no nand_imx.c.

sorry this was for u-boot v2.

Ah. I interpreted the v2 as "this is the second version of this patch".

Can we come up with a less ambiguous way to mark u-boot v2 patches?

-Scott

maintainer
#8 lore raw

PATCH v2 1/3 Add Eukrea CPUIMX27 support

In reply to Eric Benard

Hi Eric,

Quoted 4 lines · Eric Benard

CPUIMX27 is built around Freescale's i.MX27 and has up to 64MB of NOR Flash, up to 512MB of NAND Flash and up to 256MB of mDDR, it includes an ethernet PHY in MII mode, an I2C RTC and a ST16554 QuadUART on nCS3.

Looks good. Applied, thanks.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |