Skip to contentSkip to conversation

Add support for Eukrea CPUIMX35

PATCH In review Eric Bénard 2 participants 3 messages Jun 10, 2010

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

PATCH 1/1 Add support for Eukrea CPUIMX35

From: Eric Benard <[email protected]>

this modules is based on Freescale's i.MX357 CPU, with 128MB of mDDR, 256 MB NAND, and ethernet PHY.

---
 arch/arm/Makefile                           |    1 +
 arch/arm/configs/eukrea_cpuimx35_defconfig  |  254 ++++++++++++++++++++
 arch/arm/mach-imx/Kconfig                   |   11 +
 board/eukrea_cpuimx35/Makefile              |   25 ++
 board/eukrea_cpuimx35/config.h              |   23 ++
 board/eukrea_cpuimx35/env/bin/_update       |   36 +++
 board/eukrea_cpuimx35/env/bin/boot          |   52 ++++
 board/eukrea_cpuimx35/env/bin/hush_hack     |    1 +
 board/eukrea_cpuimx35/env/bin/init          |   41 ++++
 board/eukrea_cpuimx35/env/bin/update_kernel |    8 +
 board/eukrea_cpuimx35/env/bin/update_root   |    8 +
 board/eukrea_cpuimx35/env/config            |   27 ++
 board/eukrea_cpuimx35/eukrea_cpuimx35.c     |  343 +++++++++++++++++++++++++++
 board/eukrea_cpuimx35/eukrea_cpuimx35.dox   |    4 +
 board/eukrea_cpuimx35/flash_header.c        |   60 +++++
 board/eukrea_cpuimx35/lowlevel.c            |  218 +++++++++++++++++
 16 files changed, 1112 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/configs/eukrea_cpuimx35_defconfig
 create mode 100644 board/eukrea_cpuimx35/Makefile
 create mode 100644 board/eukrea_cpuimx35/config.h
 create mode 100644 board/eukrea_cpuimx35/env/bin/_update
 create mode 100644 board/eukrea_cpuimx35/env/bin/boot
 create mode 100644 board/eukrea_cpuimx35/env/bin/hush_hack
 create mode 100644 board/eukrea_cpuimx35/env/bin/init
 create mode 100644 board/eukrea_cpuimx35/env/bin/update_kernel
 create mode 100644 board/eukrea_cpuimx35/env/bin/update_root
 create mode 100644 board/eukrea_cpuimx35/env/config
 create mode 100644 board/eukrea_cpuimx35/eukrea_cpuimx35.c
 create mode 100644 board/eukrea_cpuimx35/eukrea_cpuimx35.dox
 create mode 100644 board/eukrea_cpuimx35/flash_header.c
 create mode 100644 board/eukrea_cpuimx35/lowlevel.c
arch/arm/Makefile +1 -0
index 0bdce21..85ff9c8 100644
@@ -63,6 +63,7 @@ board-$(CONFIG_MACH_EDB9315)			:= edb93xx
 board-$(CONFIG_MACH_EDB9315A)			:= edb93xx
 board-$(CONFIG_MACH_EUKREA_CPUIMX25)		:= eukrea_cpuimx25
 board-$(CONFIG_MACH_EUKREA_CPUIMX27)		:= eukrea_cpuimx27
+board-$(CONFIG_MACH_EUKREA_CPUIMX35)		:= eukrea_cpuimx35
 board-$(CONFIG_MACH_FREESCALE_MX25_3STACK)	:= freescale-mx25-3-stack
 board-$(CONFIG_MACH_FREESCALE_MX35_3STACK)	:= freescale-mx35-3-stack
 board-$(CONFIG_MACH_IMX21ADS)			:= imx21ads
arch/arm/configs/eukrea_cpuimx35_defconfig new file +254 -0

254 lines not on this page · raw message

arch/arm/mach-imx/Kconfig +11 -0
index 419daab..afd8cae 100644
@@ -4,6 +4,7 @@ config ARCH_TEXT_BASE
 	hex
 	default 0x83f00000 if MACH_EUKREA_CPUIMX25
 	default 0xa0000000 if MACH_EUKREA_CPUIMX27
+	default 0x87f00000 if MACH_EUKREA_CPUIMX35
 	default 0x08f00000 if MACH_MX1ADS
 	default 0xc0000000 if MACH_IMX21ADS
 	default 0xa0000000 if MACH_IMX27ADS
@@ -19,6 +20,7 @@ config ARCH_TEXT_BASE
 config BOARDINFO
 	default "Eukrea CPUIMX25" if MACH_EUKREA_CPUIMX25
 	default "Eukrea CPUIMX27" if MACH_EUKREA_CPUIMX27
+	default "Eukrea CPUIMX35" if MACH_EUKREA_CPUIMX35
 	default "Freescale i.MX21 ADS" if MACH_IMX21ADS
 	default "Freescale i.MX27 ADS" if MACH_IMX27ADS
 	default "Freescale MX35 3Stack" if MACH_FREESCALE_MX35_3STACK
@@ -223,6 +225,15 @@ choice
 
 	prompt "i.MX35 Board Type"
 
+config MACH_EUKREA_CPUIMX35
+	bool "EUKREA CPUIMX35"
+	select HAVE_MMU
+	select MACH_HAS_LOWLEVEL_INIT
+	select ARCH_HAS_L2X0
+	help
+	  Say Y here if you are using Eukrea's CPUIMX35 equipped
+	  with a Freescale i.MX35 Processor
+
 config MACH_FREESCALE_MX35_3STACK
 	bool "Freescale MX35 3stack"
 	select HAS_CFI
board/eukrea_cpuimx35/Makefile new file +25 -0
new file mode 100644
index 0000000..32ffe42
@@ -0,0 +1,25 @@
+#
+# (C) Copyright 2007 Juergen Beisert <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+
+obj-y					+= lowlevel.o
+obj-y					+= eukrea_cpuimx35.o
+obj-$(CONFIG_ARCH_IMX_INTERNAL_BOOT)	+= flash_header.o
board/eukrea_cpuimx35/config.h new file +23 -0
new file mode 100644
index 0000000..bfd3b39
@@ -0,0 +1,23 @@
+/*
+ * 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
+
+#define CONFIG_MX35_HCLK_FREQ        24000000
+
+#endif	/* __CONFIG_H */
board/eukrea_cpuimx35/env/bin/_update new file +36 -0
new file mode 100644
index 0000000..014bce3
@@ -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_cpuimx35/env/bin/boot new file +52 -0

52 lines not on this page · raw message

board/eukrea_cpuimx35/env/bin/hush_hack new file +1 -0
new file mode 100644
index 0000000..5fffa92
@@ -0,0 +1 @@
+nand -a /dev/nand0.*
board/eukrea_cpuimx35/env/bin/init new file +41 -0

41 lines not on this page · raw message

board/eukrea_cpuimx35/env/bin/update_kernel new file +8 -0
new file mode 100644
index 0000000..c2d2cc3
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. /env/config
+
+image=$uimage
+part=/dev/nand0.kernel.bb
+
+. /env/bin/_update $1
board/eukrea_cpuimx35/env/bin/update_root new file +8 -0
new file mode 100644
index 0000000..dd89a5a
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. /env/config
+
+image=$rootfs
+part=/dev/nand0.root.bb
+
+. /env/bin/_update $1
board/eukrea_cpuimx35/env/config new file +27 -0
new file mode 100644
index 0000000..df2079f
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# can be either 'net' or 'nand''
+kernel=nand
+root=ubifs
+
+basedir=cpuimx35
+uimage=$basedir/uImage
+rootfs=$basedir/rootfs
+
+autoboot_timeout=1
+
+nfsroot=""
+bootargs="console=ttymxc0,115200"
+
+nand_parts="256k(barebox)ro,128k(bareboxenv),2176k(kernel),-(root)"
+rootpartnum_nand=3
+ubiroot="eukrea-cpuimx35-rootfs"
+
+# use 'dhcp' to do dhcp in barebox and in kernel
+ip=off
+
+# 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=a.b.c.d
board/eukrea_cpuimx35/eukrea_cpuimx35.c new file +343 -0

343 lines not on this page · raw message

board/eukrea_cpuimx35/eukrea_cpuimx35.dox new file +4 -0
new file mode 100644
index 0000000..cbdf69d
@@ -0,0 +1,4 @@
+/** @page eukrea_cpuimx35 Eukrea's CPUIMX35
+
+
+*/
board/eukrea_cpuimx35/flash_header.c new file +60 -0

60 lines not on this page · raw message

board/eukrea_cpuimx35/lowlevel.c new file +218 -0

218 lines not on this page · raw message

Signature · 7 lines
1.6.3.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#1 lore raw

Hi Eric,

Quoted 18 lines · Eric Bénard
board/eukrea_cpuimx35/eukrea_cpuimx35.c new file +18 -0
+
+#define MPCTL_PARAM_399     (IMX_PLL_PD(0) | IMX_PLL_MFD(15) | IMX_PLL_MFI(8) | IMX_PLL_MFN(5))
+#define MPCTL_PARAM_532     ((1 << 31) | IMX_PLL_PD(0) | IMX_PLL_MFD(11) | IMX_PLL_MFI(11) | IMX_PLL_MFN(1))
+
+static int do_cpufreq(struct command *cmdtp, int argc, char *argv[])
+{
+	unsigned long freq;
+
+	if (argc != 2)
+		return COMMAND_ERROR_USAGE;
+
+	freq = simple_strtoul(argv[1], NULL, 0);
+
+	switch (freq) {
+	case 399:
+		writel(MPCTL_PARAM_399, IMX_CCM_BASE + CCM_MPCTL);
+		break;
+	case 532:

board/eukrea_cpuimx35/eukrea_cpuimx35.c line 332

Quoted 10 lines
board/eukrea_cpuimx35/eukrea_cpuimx35.c new file +10 -0
+		writel(MPCTL_PARAM_532, IMX_CCM_BASE + CCM_MPCTL);
+		break;
+	default:
+		return COMMAND_ERROR_USAGE;
+	}
+
+	printf("Switched CPU frequency to %dMHz\n", freq);
+
+	return 0;
+}

I originally added this to the phyCORE i.MX35 board because we had problems running it at 532 MHz. If you do not have it you probably don't need it. Though I can keep it if you wish.

Sascha

Signature · 9 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 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

Hi Sascha,

Quoted 4 lines · Sascha Hauer

I originally added this to the phyCORE i.MX35 board because we had problems running it at 532 MHz. If you do not have it you probably don't need it. Though I can keep it if you wish.

in fact this may be interesting for configurations where the CPU speed can be 400MHz to reduce power consumption. In that case, barebox could start at 400MHz and /env/bin/init would set the speed depending on /env/config variable. So you can keep it for now.

Thanks,
Eric

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox