mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* phyCORE-imx27 updates
@ 2014-06-12  6:53 Sascha Hauer
  2014-06-12  6:53 ` [PATCH 1/5] ARM: uncompress.c: copy executable to SDRAM if necessary Sascha Hauer
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Sascha Hauer @ 2014-06-12  6:53 UTC (permalink / raw)
  To: barebox

Based on Alexanders switch to devicetree this series:

- Switches to multi image support and the generic imx_defconfig
- Adds barebox_update handlers for NOR/NAND Flash

Sascha

----------------------------------------------------------------
Sascha Hauer (5):
      ARM: uncompress.c: copy executable to SDRAM if necessary
      ARM: Phytec-phyCORE-imx27: Register board env during runtime
      ARM: i.MX bbu: Add update handler for external NOR boot
      ARM: Phytec-phyCORE-imx27: Register NOR/NAND update handlers
      ARM: Phytec-phyCORE-imx27: Switch to multiimage support

 arch/arm/boards/phytec-phycore-imx27/Makefile      |  1 +
 .../{env => defaultenv-pcm038}/boot/nand-ubi       |  0
 .../{env => defaultenv-pcm038}/boot/nor            |  0
 arch/arm/boards/phytec-phycore-imx27/lowlevel.c    | 24 +++++--
 arch/arm/boards/phytec-phycore-imx27/pcm038.c      | 13 +++-
 arch/arm/configs/imx_defconfig                     | 72 ++++++++++---------
 arch/arm/configs/phytec-phycore-imx27_defconfig    | 83 ----------------------
 arch/arm/cpu/uncompress.c                          | 27 +++++--
 arch/arm/dts/Makefile                              |  1 +
 arch/arm/mach-imx/Kconfig                          | 17 ++---
 arch/arm/mach-imx/imx-bbu-internal.c               | 46 +++++++++++-
 arch/arm/mach-imx/include/mach/bbu.h               |  9 +++
 images/Makefile.imx                                |  4 ++
 13 files changed, 156 insertions(+), 141 deletions(-)
 rename arch/arm/boards/phytec-phycore-imx27/{env => defaultenv-pcm038}/boot/nand-ubi (100%)
 rename arch/arm/boards/phytec-phycore-imx27/{env => defaultenv-pcm038}/boot/nor (100%)
 delete mode 100644 arch/arm/configs/phytec-phycore-imx27_defconfig

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] ARM: uncompress.c: copy executable to SDRAM if necessary
  2014-06-12  6:53 phyCORE-imx27 updates Sascha Hauer
@ 2014-06-12  6:53 ` Sascha Hauer
  2014-06-12  6:53 ` [PATCH 2/5] ARM: Phytec-phyCORE-imx27: Register board env during runtime Sascha Hauer
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2014-06-12  6:53 UTC (permalink / raw)
  To: barebox

We used to relocate the executable to the current address. This does
not work when the executable runs from a readonly location like for
example NOR Flash. Test if we run from inside the available memory and
if we do, relocate to the current address as before. Otherwise copy
the executable to the start of memory and relocate to that address.
While at it add some comments to the code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/uncompress.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index 74a4286..d64706d 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -47,15 +47,27 @@ static void __noreturn noinline uncompress_start_payload(unsigned long membase,
 	void __noreturn (*barebox)(unsigned long, unsigned long, void *);
 	uint32_t endmem = membase + memsize;
 	unsigned long barebox_base;
-	uint32_t *ptr;
+	uint32_t *image_end;
 	void *pg_start;
+	unsigned long pc = get_pc();
 
 	arm_early_mmu_cache_invalidate();
 
 	endmem -= STACK_SIZE; /* stack */
 
-	if (IS_ENABLED(CONFIG_PBL_RELOCATABLE))
-		relocate_to_current_adr();
+	image_end = (void *)ld_var(__image_end) - get_runtime_offset();
+
+	if (IS_ENABLED(CONFIG_PBL_RELOCATABLE)) {
+		/*
+		 * If we run from inside the memory just relocate the binary
+		 * to the current address. Otherwise it may be a readonly location.
+		 * Copy and relocate to the start of the memory in this case.
+		 */
+		if (pc > membase && pc < membase + memsize)
+			relocate_to_current_adr();
+		else
+			relocate_to_adr(membase);
+	}
 
 	if (IS_ENABLED(CONFIG_RELOCATABLE))
 		barebox_base = arm_barebox_image_place(membase + memsize);
@@ -74,9 +86,12 @@ static void __noreturn noinline uncompress_start_payload(unsigned long membase,
 	free_mem_ptr = endmem;
 	free_mem_end_ptr = free_mem_ptr + SZ_128K;
 
-	ptr = (void *)__image_end;
-	pg_start = ptr + 1;
-	pg_len = *(ptr);
+	/*
+	 * image_end is the first location after the executable. It contains
+	 * the size of the appended compressed binary followed by the binary.
+	 */
+	pg_start = image_end + 1;
+	pg_len = *(image_end);
 
 	pbl_barebox_uncompress((void*)barebox_base, pg_start, pg_len);
 
-- 
2.0.0.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/5] ARM: Phytec-phyCORE-imx27: Register board env during runtime
  2014-06-12  6:53 phyCORE-imx27 updates Sascha Hauer
  2014-06-12  6:53 ` [PATCH 1/5] ARM: uncompress.c: copy executable to SDRAM if necessary Sascha Hauer
@ 2014-06-12  6:53 ` Sascha Hauer
  2014-06-12  6:53 ` [PATCH 3/5] ARM: i.MX bbu: Add update handler for external NOR boot Sascha Hauer
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2014-06-12  6:53 UTC (permalink / raw)
  To: barebox

Register the board specific environment during runtime using
defaultenv_append_directory() to make it available for multi
image support.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/phytec-phycore-imx27/Makefile                  |  1 +
 .../phytec-phycore-imx27/defaultenv-pcm038/boot/nand-ubi       | 10 ++++++++++
 .../arm/boards/phytec-phycore-imx27/defaultenv-pcm038/boot/nor |  9 +++++++++
 arch/arm/boards/phytec-phycore-imx27/env/boot/nand-ubi         | 10 ----------
 arch/arm/boards/phytec-phycore-imx27/env/boot/nor              |  9 ---------
 arch/arm/boards/phytec-phycore-imx27/pcm038.c                  |  3 +++
 arch/arm/configs/phytec-phycore-imx27_defconfig                |  2 +-
 7 files changed, 24 insertions(+), 20 deletions(-)
 create mode 100644 arch/arm/boards/phytec-phycore-imx27/defaultenv-pcm038/boot/nand-ubi
 create mode 100644 arch/arm/boards/phytec-phycore-imx27/defaultenv-pcm038/boot/nor
 delete mode 100644 arch/arm/boards/phytec-phycore-imx27/env/boot/nand-ubi
 delete mode 100644 arch/arm/boards/phytec-phycore-imx27/env/boot/nor

diff --git a/arch/arm/boards/phytec-phycore-imx27/Makefile b/arch/arm/boards/phytec-phycore-imx27/Makefile
index eb82f0d..4723c77 100644
--- a/arch/arm/boards/phytec-phycore-imx27/Makefile
+++ b/arch/arm/boards/phytec-phycore-imx27/Makefile
@@ -1,2 +1,3 @@
 obj-y	+= pcm038.o pcm970.o
 lwl-y	+= lowlevel.o
+bbenv-y += defaultenv-pcm038
diff --git a/arch/arm/boards/phytec-phycore-imx27/defaultenv-pcm038/boot/nand-ubi b/arch/arm/boards/phytec-phycore-imx27/defaultenv-pcm038/boot/nand-ubi
new file mode 100644
index 0000000..67b0cb4
--- /dev/null
+++ b/arch/arm/boards/phytec-phycore-imx27/defaultenv-pcm038/boot/nand-ubi
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ "$1" = menu ]; then
+	boot-menu-add-entry "$0" "nand (UBI)"
+	exit
+fi
+
+global.bootm.image="/dev/nand0.kernel.bb"
+#global.bootm.oftree="/env/oftree"
+global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs"
diff --git a/arch/arm/boards/phytec-phycore-imx27/defaultenv-pcm038/boot/nor b/arch/arm/boards/phytec-phycore-imx27/defaultenv-pcm038/boot/nor
new file mode 100644
index 0000000..0d10584
--- /dev/null
+++ b/arch/arm/boards/phytec-phycore-imx27/defaultenv-pcm038/boot/nor
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ "$1" = menu ]; then
+	boot-menu-add-entry "$0" "nor"
+	exit
+fi
+
+global.bootm.image="/dev/nor0.kernel"
+global.linux.bootargs.dyn.root="root=/dev/mtdblock3 ro"
diff --git a/arch/arm/boards/phytec-phycore-imx27/env/boot/nand-ubi b/arch/arm/boards/phytec-phycore-imx27/env/boot/nand-ubi
deleted file mode 100644
index 67b0cb4..0000000
--- a/arch/arm/boards/phytec-phycore-imx27/env/boot/nand-ubi
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-if [ "$1" = menu ]; then
-	boot-menu-add-entry "$0" "nand (UBI)"
-	exit
-fi
-
-global.bootm.image="/dev/nand0.kernel.bb"
-#global.bootm.oftree="/env/oftree"
-global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs"
diff --git a/arch/arm/boards/phytec-phycore-imx27/env/boot/nor b/arch/arm/boards/phytec-phycore-imx27/env/boot/nor
deleted file mode 100644
index 0d10584..0000000
--- a/arch/arm/boards/phytec-phycore-imx27/env/boot/nor
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-if [ "$1" = menu ]; then
-	boot-menu-add-entry "$0" "nor"
-	exit
-fi
-
-global.bootm.image="/dev/nor0.kernel"
-global.linux.bootargs.dyn.root="root=/dev/mtdblock3 ro"
diff --git a/arch/arm/boards/phytec-phycore-imx27/pcm038.c b/arch/arm/boards/phytec-phycore-imx27/pcm038.c
index 07982fa..294f4ec 100644
--- a/arch/arm/boards/phytec-phycore-imx27/pcm038.c
+++ b/arch/arm/boards/phytec-phycore-imx27/pcm038.c
@@ -21,6 +21,7 @@
 #include <io.h>
 #include <notifier.h>
 #include <sizes.h>
+#include <envfs.h>
 #include <mach/devices-imx27.h>
 #include <mach/imx-pll.h>
 #include <mach/imx27-regs.h>
@@ -174,6 +175,8 @@ static int pcm038_init(void)
 	/* Clock gating enable */
 	writel(0x00050f08, MX27_SYSCTRL_BASE_ADDR + MX27_GPCR);
 
+	defaultenv_append_directory(defaultenv_pcm038);
+
 	return 0;
 }
 device_initcall(pcm038_init);
diff --git a/arch/arm/configs/phytec-phycore-imx27_defconfig b/arch/arm/configs/phytec-phycore-imx27_defconfig
index 277d21c..b3cd0bc 100644
--- a/arch/arm/configs/phytec-phycore-imx27_defconfig
+++ b/arch/arm/configs/phytec-phycore-imx27_defconfig
@@ -17,7 +17,7 @@ CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_MENU=y
 CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/phytec-phycore-imx27/env"
+CONFIG_DEFAULT_ENVIRONMENT_PATH=""
 CONFIG_LONGHELP=y
 CONFIG_CMD_IOMEM=y
 CONFIG_CMD_MEMINFO=y
-- 
2.0.0.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/5] ARM: i.MX bbu: Add update handler for external NOR boot
  2014-06-12  6:53 phyCORE-imx27 updates Sascha Hauer
  2014-06-12  6:53 ` [PATCH 1/5] ARM: uncompress.c: copy executable to SDRAM if necessary Sascha Hauer
  2014-06-12  6:53 ` [PATCH 2/5] ARM: Phytec-phyCORE-imx27: Register board env during runtime Sascha Hauer
@ 2014-06-12  6:53 ` Sascha Hauer
  2014-06-12  6:53 ` [PATCH 4/5] ARM: Phytec-phyCORE-imx27: Register NOR/NAND update handlers Sascha Hauer
  2014-06-12  6:53 ` [PATCH 5/5] ARM: Phytec-phyCORE-imx27: Switch to multiimage support Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2014-06-12  6:53 UTC (permalink / raw)
  To: barebox

External NOR boot only requires copying the image to NOR Flash.
This also adds (un)protecting the flash which is required for
NOR Flash.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/imx-bbu-internal.c | 46 +++++++++++++++++++++++++++++++++++-
 arch/arm/mach-imx/include/mach/bbu.h |  9 +++++++
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index c7cd5b8..125415e 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -59,7 +59,16 @@ static int imx_bbu_write_device(struct imx_internal_bbu_handler *imx_handler,
 		return fd;
 
 	if (imx_handler->flags & IMX_INTERNAL_FLAG_ERASE) {
-		debug("%s: eraseing %s from 0 to 0x%08x\n", __func__,
+		debug("%s: unprotecting %s from 0 to 0x%08x\n", __func__,
+				data->devicefile, image_len);
+		ret = protect(fd, image_len, 0, 0);
+		if (ret && ret != -ENOSYS) {
+			printf("unprotecting %s failed with %s\n", data->devicefile,
+					strerror(-ret));
+			goto err_close;
+		}
+
+		debug("%s: erasing %s from 0 to 0x%08x\n", __func__,
 				data->devicefile, image_len);
 		ret = erase(fd, image_len, 0);
 		if (ret) {
@@ -92,6 +101,16 @@ static int imx_bbu_write_device(struct imx_internal_bbu_handler *imx_handler,
 	if (ret < 0)
 		goto err_close;
 
+	if (imx_handler->flags & IMX_INTERNAL_FLAG_ERASE) {
+		debug("%s: protecting %s from 0 to 0x%08x\n", __func__,
+				data->devicefile, image_len);
+		ret = protect(fd, image_len, 0, 1);
+		if (ret && ret != -ENOSYS) {
+			printf("protecting %s failed with %s\n", data->devicefile,
+					strerror(-ret));
+		}
+	}
+
 	ret = 0;
 
 err_close:
@@ -351,6 +370,19 @@ static int imx_bbu_internal_v2_update(struct bbu_handler *handler, struct bbu_da
 	return ret;
 }
 
+static int imx_bbu_external_update(struct bbu_handler *handler, struct bbu_data *data)
+{
+	struct imx_internal_bbu_handler *imx_handler =
+		container_of(handler, struct imx_internal_bbu_handler, handler);
+	int ret;
+
+	ret = imx_bbu_check_prereq(data);
+	if (ret)
+		return ret;
+
+	return imx_bbu_write_device(imx_handler, data, data->image, data->len);
+}
+
 static struct imx_internal_bbu_handler *__init_handler(const char *name, char *devicefile,
 		unsigned long flags)
 {
@@ -484,3 +516,15 @@ int imx6_bbu_internal_spi_i2c_register_handler(const char *name, char *devicefil
 
 	return __register_handler(imx_handler);
 }
+
+int imx_bbu_external_nor_register_handler(const char *name, char *devicefile,
+		unsigned long flags)
+{
+	struct imx_internal_bbu_handler *imx_handler;
+
+	imx_handler = __init_handler(name, devicefile, flags);
+	imx_handler->flags = IMX_INTERNAL_FLAG_ERASE;
+	imx_handler->handler.handler = imx_bbu_external_update;
+
+	return __register_handler(imx_handler);
+}
diff --git a/arch/arm/mach-imx/include/mach/bbu.h b/arch/arm/mach-imx/include/mach/bbu.h
index bf6c7dc..74c334a 100644
--- a/arch/arm/mach-imx/include/mach/bbu.h
+++ b/arch/arm/mach-imx/include/mach/bbu.h
@@ -29,6 +29,9 @@ int imx6_bbu_internal_spi_i2c_register_handler(const char *name, char *devicefil
 
 int imx6_bbu_nand_register_handler(const char *name, unsigned long flags);
 
+int imx_bbu_external_nor_register_handler(const char *name, char *devicefile,
+		unsigned long flags);
+
 #else
 
 static inline int imx51_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
@@ -71,6 +74,12 @@ static inline int imx6_bbu_nand_register_handler(const char *name, unsigned long
 {
 	return -ENOSYS;
 }
+
+static inline int imx_bbu_external_nor_register_handler(const char *name, char *devicefile,
+		unsigned long flags)
+{
+	return -ENOSYS;
+}
 #endif
 
 #if defined(CONFIG_BAREBOX_UPDATE_IMX_EXTERNAL_NAND)
-- 
2.0.0.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/5] ARM: Phytec-phyCORE-imx27: Register NOR/NAND update handlers
  2014-06-12  6:53 phyCORE-imx27 updates Sascha Hauer
                   ` (2 preceding siblings ...)
  2014-06-12  6:53 ` [PATCH 3/5] ARM: i.MX bbu: Add update handler for external NOR boot Sascha Hauer
@ 2014-06-12  6:53 ` Sascha Hauer
  2014-06-12  6:53 ` [PATCH 5/5] ARM: Phytec-phyCORE-imx27: Switch to multiimage support Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2014-06-12  6:53 UTC (permalink / raw)
  To: barebox

To make barebox_update work on the board.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/phytec-phycore-imx27/pcm038.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/phytec-phycore-imx27/pcm038.c b/arch/arm/boards/phytec-phycore-imx27/pcm038.c
index 294f4ec..a4305f6 100644
--- a/arch/arm/boards/phytec-phycore-imx27/pcm038.c
+++ b/arch/arm/boards/phytec-phycore-imx27/pcm038.c
@@ -28,6 +28,7 @@
 #include <mach/imxfb.h>
 #include <mach/iomux-mx27.h>
 #include <mfd/mc13xxx.h>
+#include <mach/bbu.h>
 
 #include "pll.h"
 
@@ -105,7 +106,7 @@ static int pcm038_init(void)
 {
 	struct mc13xxx *mc13xxx = mc13xxx_get();
 	char *envdev;
-	uint32_t i;
+	uint32_t i, bbu_nand_flags = 0, bbu_nor_flags = 0;
 
 	if (!of_machine_is_compatible("phytec,imx27-pcm038"))
 		return 0;
@@ -123,10 +124,12 @@ static int pcm038_init(void)
 	switch (bootsource_get()) {
 	case BOOTSOURCE_NAND:
 		of_device_enable_path("/chosen/environment-nand");
+		bbu_nand_flags |= BBU_HANDLER_FLAG_DEFAULT;
 		envdev = "NAND";
 		break;
 	default:
 		of_device_enable_path("/chosen/environment-nor");
+		bbu_nor_flags |= BBU_HANDLER_FLAG_DEFAULT;
 		envdev = "NOR";
 		break;
 	}
@@ -175,6 +178,11 @@ static int pcm038_init(void)
 	/* Clock gating enable */
 	writel(0x00050f08, MX27_SYSCTRL_BASE_ADDR + MX27_GPCR);
 
+	imx_bbu_external_nand_register_handler("nand", "/dev/nand0.boot",
+			bbu_nand_flags);
+	imx_bbu_external_nor_register_handler("nor", "/dev/nor0.boot",
+			bbu_nor_flags);
+
 	defaultenv_append_directory(defaultenv_pcm038);
 
 	return 0;
-- 
2.0.0.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 5/5] ARM: Phytec-phyCORE-imx27: Switch to multiimage support
  2014-06-12  6:53 phyCORE-imx27 updates Sascha Hauer
                   ` (3 preceding siblings ...)
  2014-06-12  6:53 ` [PATCH 4/5] ARM: Phytec-phyCORE-imx27: Register NOR/NAND update handlers Sascha Hauer
@ 2014-06-12  6:53 ` Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2014-06-12  6:53 UTC (permalink / raw)
  To: barebox

Tested on the phyCORE-imx27 to boot on NOR and NAND using the
registered update handlers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/phytec-phycore-imx27/lowlevel.c | 24 ++++---
 arch/arm/configs/imx_defconfig                  | 72 ++++++++++-----------
 arch/arm/configs/phytec-phycore-imx27_defconfig | 83 -------------------------
 arch/arm/dts/Makefile                           |  1 +
 arch/arm/mach-imx/Kconfig                       | 17 ++---
 images/Makefile.imx                             |  4 ++
 6 files changed, 68 insertions(+), 133 deletions(-)
 delete mode 100644 arch/arm/configs/phytec-phycore-imx27_defconfig

diff --git a/arch/arm/boards/phytec-phycore-imx27/lowlevel.c b/arch/arm/boards/phytec-phycore-imx27/lowlevel.c
index 16b916b..b9b2ab5 100644
--- a/arch/arm/boards/phytec-phycore-imx27/lowlevel.c
+++ b/arch/arm/boards/phytec-phycore-imx27/lowlevel.c
@@ -33,7 +33,7 @@
 
 #define ESDCTL0_VAL (ESDCTL0_SDE | ESDCTL0_ROW13 | ESDCTL0_COL10)
 
-void __bare_init __naked barebox_arm_reset_vector(void)
+static void __bare_init __naked noinline phytec_phycorce_imx27_common_init(void *fdt)
 {
 	uint32_t r;
 	int i;
@@ -93,12 +93,22 @@ void __bare_init __naked barebox_arm_reset_vector(void)
 			ESDCTL0_BL | ESDCTL0_SMODE_NORMAL,
 			MX27_ESDCTL_BASE_ADDR + IMX_ESDCTL0);
 
-	if (IS_ENABLED(CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND)) {
-		/* setup a stack to be able to call mx27_barebox_boot_nand_external() */
-		arm_setup_stack(MX27_IRAM_BASE_ADDR + MX27_IRAM_SIZE - 8);
+	if (IS_ENABLED(CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND))
+		imx27_barebox_boot_nand_external(fdt);
 
-		imx27_barebox_boot_nand_external(0);
-	}
 out:
-	imx27_barebox_entry(NULL);
+	imx27_barebox_entry(fdt);
+}
+
+extern char __dtb_imx27_phytec_phycore_rdk_start[];
+
+ENTRY_FUNCTION(start_phytec_phycore_imx27, r0, r1, r2)
+{
+	void *fdt;
+
+	arm_setup_stack(MX27_IRAM_BASE_ADDR + MX27_IRAM_SIZE - 12);
+
+	fdt = __dtb_imx27_phytec_phycore_rdk_start - get_runtime_offset();
+
+	phytec_phycorce_imx27_common_init(fdt);
 }
diff --git a/arch/arm/configs/imx_defconfig b/arch/arm/configs/imx_defconfig
index bf57390..8751ccc 100644
--- a/arch/arm/configs/imx_defconfig
+++ b/arch/arm/configs/imx_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARCH_IMX=y
 CONFIG_IMX_MULTI_BOARDS=y
 CONFIG_MACH_TX25=y
 CONFIG_MACH_PCA100=y
+CONFIG_MACH_PCM038=y
 CONFIG_IMX_IIM=y
 CONFIG_IMX_IIM_FUSE_BLOW=y
 CONFIG_AEABI=y
@@ -14,7 +15,6 @@ CONFIG_MALLOC_TLSF=y
 CONFIG_KALLSYMS=y
 CONFIG_RELOCATABLE=y
 CONFIG_PANIC_HANG=y
-CONFIG_LONGHELP=y
 CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
@@ -23,55 +23,56 @@ CONFIG_BLSPEC=y
 CONFIG_CONSOLE_ACTIVATE_NONE=y
 CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
 CONFIG_RESET_SOURCE=y
-CONFIG_CMD_EDIT=y
-CONFIG_CMD_SLEEP=y
-CONFIG_CMD_MSLEEP=y
-CONFIG_CMD_SAVEENV=y
-CONFIG_CMD_LOADENV=y
-CONFIG_CMD_EXPORT=y
-CONFIG_CMD_PRINTENV=y
-CONFIG_CMD_READLINE=y
-CONFIG_CMD_READF=y
-CONFIG_CMD_LET=y
-CONFIG_CMD_MENU=y
-CONFIG_CMD_MENUTREE=y
-CONFIG_CMD_TIME=y
-CONFIG_CMD_LN=y
-CONFIG_CMD_TFTP=y
-CONFIG_CMD_FILETYPE=y
-CONFIG_CMD_ECHO_E=y
-CONFIG_CMD_MEMINFO=y
+CONFIG_LONGHELP=y
 CONFIG_CMD_IOMEM=y
-CONFIG_CMD_MM=y
-CONFIG_CMD_CRC=y
-CONFIG_CMD_CRC_CMP=y
-CONFIG_CMD_MD5SUM=y
-CONFIG_CMD_FLASH=y
-CONFIG_CMD_UBIFORMAT=y
+CONFIG_CMD_MEMINFO=y
 CONFIG_CMD_BOOTM_SHOW_TYPE=y
 CONFIG_CMD_BOOTM_VERBOSE=y
 CONFIG_CMD_BOOTM_INITRD=y
 CONFIG_CMD_BOOTM_OFTREE=y
-CONFIG_CMD_UIMAGE=y
 # CONFIG_CMD_BOOTU is not set
-CONFIG_CMD_RESET=y
 CONFIG_CMD_GO=y
-CONFIG_CMD_OFTREE=y
-CONFIG_CMD_OF_PROPERTY=y
-CONFIG_CMD_OF_NODE=y
-CONFIG_CMD_BAREBOX_UPDATE=y
-CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_RESET=y
+CONFIG_CMD_UIMAGE=y
 CONFIG_CMD_PARTITION=y
+CONFIG_CMD_UBIFORMAT=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_LOADENV=y
+CONFIG_CMD_PRINTENV=y
 CONFIG_CMD_MAGICVAR=y
 CONFIG_CMD_MAGICVAR_HELP=y
-CONFIG_CMD_GPIO=y
+CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_FILETYPE=y
+CONFIG_CMD_LN=y
+CONFIG_CMD_MD5SUM=y
 CONFIG_CMD_UNCOMPRESS=y
+CONFIG_CMD_LET=y
+CONFIG_CMD_MSLEEP=y
+CONFIG_CMD_READF=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_DHCP=y
 CONFIG_CMD_MIITOOL=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_TFTP=y
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_MENU=y
+CONFIG_CMD_MENUTREE=y
+CONFIG_CMD_READLINE=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_CRC=y
+CONFIG_CMD_CRC_CMP=y
+CONFIG_CMD_MM=y
 CONFIG_CMD_CLK=y
 CONFIG_CMD_DETECT=y
+CONFIG_CMD_FLASH=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_BAREBOX_UPDATE=y
+CONFIG_CMD_OF_NODE=y
+CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OFTREE=y
+CONFIG_CMD_TIME=y
 CONFIG_NET=y
-CONFIG_CMD_DHCP=y
-CONFIG_CMD_PING=y
 CONFIG_NET_NETCONSOLE=y
 CONFIG_OFDEVICE=y
 CONFIG_OF_BAREBOX_DRIVERS=y
@@ -96,6 +97,7 @@ CONFIG_USB_EHCI=y
 CONFIG_USB_ULPI=y
 CONFIG_MCI=y
 CONFIG_MCI_IMX=y
+CONFIG_MFD_MC13XXX=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
 CONFIG_LED_GPIO_OF=y
diff --git a/arch/arm/configs/phytec-phycore-imx27_defconfig b/arch/arm/configs/phytec-phycore-imx27_defconfig
deleted file mode 100644
index b3cd0bc..0000000
--- a/arch/arm/configs/phytec-phycore-imx27_defconfig
+++ /dev/null
@@ -1,83 +0,0 @@
-CONFIG_BUILTIN_DTB=y
-CONFIG_BUILTIN_DTB_NAME="imx27-phytec-phycore-rdk"
-CONFIG_ARCH_IMX=y
-CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND=y
-CONFIG_MACH_PCM038=y
-CONFIG_IMX_IIM=y
-CONFIG_AEABI=y
-CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
-CONFIG_ARM_UNWIND=y
-CONFIG_MMU=y
-CONFIG_TEXT_BASE=0xa7f00000
-CONFIG_MALLOC_SIZE=0x1000000
-CONFIG_MALLOC_TLSF=y
-CONFIG_KALLSYMS=y
-CONFIG_HUSH_FANCY_PROMPT=y
-CONFIG_CMDLINE_EDITING=y
-CONFIG_AUTO_COMPLETE=y
-CONFIG_MENU=y
-CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH=""
-CONFIG_LONGHELP=y
-CONFIG_CMD_IOMEM=y
-CONFIG_CMD_MEMINFO=y
-CONFIG_CMD_BOOTM_SHOW_TYPE=y
-CONFIG_CMD_BOOTM_VERBOSE=y
-CONFIG_CMD_BOOTM_INITRD=y
-CONFIG_CMD_BOOTM_OFTREE=y
-CONFIG_CMD_BOOTM_OFTREE_UIMAGE=y
-# CONFIG_CMD_BOOTU is not set
-CONFIG_CMD_GO=y
-CONFIG_CMD_RESET=y
-CONFIG_CMD_UIMAGE=y
-CONFIG_CMD_PARTITION=y
-CONFIG_CMD_EXPORT=y
-CONFIG_CMD_PRINTENV=y
-CONFIG_CMD_MAGICVAR=y
-CONFIG_CMD_MAGICVAR_HELP=y
-CONFIG_CMD_SAVEENV=y
-CONFIG_CMD_UNCOMPRESS=y
-CONFIG_CMD_SLEEP=y
-CONFIG_CMD_DHCP=y
-CONFIG_CMD_PING=y
-CONFIG_CMD_ECHO_E=y
-CONFIG_CMD_EDIT=y
-CONFIG_CMD_MENU=y
-CONFIG_CMD_MENU_MANAGEMENT=y
-CONFIG_CMD_SPLASH=y
-CONFIG_CMD_READLINE=y
-CONFIG_CMD_TIMEOUT=y
-CONFIG_CMD_FLASH=y
-CONFIG_CMD_GPIO=y
-CONFIG_CMD_OFTREE=y
-CONFIG_CMD_TIME=y
-CONFIG_NET=y
-CONFIG_NET_NETCONSOLE=y
-CONFIG_NET_RESOLV=y
-CONFIG_OFDEVICE=y
-CONFIG_OF_BAREBOX_DRIVERS=y
-CONFIG_DRIVER_NET_FEC_IMX=y
-CONFIG_NET_USB=y
-CONFIG_NET_USB_ASIX=y
-CONFIG_DRIVER_SPI_IMX=y
-CONFIG_MTD=y
-CONFIG_DRIVER_CFI=y
-CONFIG_CFI_BUFFER_WRITE=y
-CONFIG_NAND=y
-# CONFIG_NAND_ECC_SOFT is not set
-# CONFIG_NAND_ECC_HW_SYNDROME is not set
-CONFIG_NAND_IMX=y
-CONFIG_USB=y
-CONFIG_USB_IMX_CHIPIDEA=y
-CONFIG_USB_EHCI=y
-CONFIG_USB_ULPI=y
-CONFIG_USB_STORAGE=y
-CONFIG_VIDEO=y
-CONFIG_DRIVER_VIDEO_IMX=y
-CONFIG_IMXFB_DRIVER_VIDEO_IMX_OVERLAY=y
-CONFIG_MFD_MC13XXX=y
-CONFIG_IMX_WEIM=y
-CONFIG_FS_TFTP=y
-CONFIG_FS_NFS=y
-CONFIG_ZLIB=y
-CONFIG_LZO_DECOMPRESS=y
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 39fbda2..6bbb4dc 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -60,6 +60,7 @@ pbl-$(CONFIG_MACH_REALQ7) += imx6q-dmo-edmqmx6.dtb.o
 pbl-$(CONFIG_MACH_SOLIDRUN_CUBOX) += dove-cubox-bb.dtb.o
 pbl-$(CONFIG_MACH_GK802) += imx6q-gk802.dtb.o
 pbl-$(CONFIG_MACH_PCA100) += imx27-phytec-phycard-s-rdk-bb.dtb.o
+pbl-$(CONFIG_MACH_PCM038) += imx27-phytec-phycore-rdk.dtb.o
 pbl-$(CONFIG_MACH_TORADEX_COLIBRI_T20) += tegra20-colibri-iris.dtb.o
 pbl-$(CONFIG_MACH_TOSHIBA_AC100) += tegra20-paz00.dtb.o
 pbl-$(CONFIG_MACH_TQMA53) += imx53-mba53.dtb.o
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index b84bf64..e1b4e31 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -193,6 +193,15 @@ config MACH_PCA100
 	  Say Y here if you are using Phytec's phyCard-i.MX27 (pca100) equipped
 	  with a Freescale i.MX27 Processor
 
+config MACH_PCM038
+	bool "phyCORE-i.MX27"
+	select ARCH_IMX27
+	select HAVE_DEFAULT_ENVIRONMENT_NEW
+	select ARCH_IMX_EXTERNAL_BOOT_NAND
+	help
+	  Say Y here if you are using Phytec's phyCORE-i.MX27 (pcm038) equipped
+	  with a Freescale i.MX27 Processor
+
 config MACH_EFIKA_MX_SMARTBOOK
 	bool "Efika MX smartbook"
 	select ARCH_IMX51
@@ -344,14 +353,6 @@ config MACH_IMX27ADS
 	  Say Y here if you are using the Freescale i.MX27ads board equipped
 	  with a Freescale i.MX27 Processor
 
-config MACH_PCM038
-	bool "phyCORE-i.MX27"
-	select ARCH_IMX27
-	select HAVE_DEFAULT_ENVIRONMENT_NEW
-	help
-	  Say Y here if you are using Phytec's phyCORE-i.MX27 (pcm038) equipped
-	  with a Freescale i.MX27 Processor
-
 config MACH_NESO
 	bool "Garz+Fricke Neso"
 	select ARCH_IMX27
diff --git a/images/Makefile.imx b/images/Makefile.imx
index 5085a55..633fdfa 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -23,6 +23,10 @@ pblx-$(CONFIG_MACH_PCA100) += start_phytec_phycard_imx27
 FILE_barebox-phytec-phycard-imx27.img = start_phytec_phycard_imx27.pblx
 image-$(CONFIG_MACH_PCA100) += barebox-phytec-phycard-imx27.img
 
+pblx-$(CONFIG_MACH_PCM038) += start_phytec_phycore_imx27
+FILE_barebox-phytec-phycore-imx27.img = start_phytec_phycore_imx27.pblx
+image-$(CONFIG_MACH_PCM038) += barebox-phytec-phycore-imx27.img
+
 # ----------------------- i.MX51 based boards ---------------------------
 pblx-$(CONFIG_MACH_FREESCALE_MX51_PDK) += start_imx51_babbage
 CFG_start_imx51_babbage.pblx.imximg = $(board)/freescale-mx51-babbage/flash-header-imx51-babbage.imxcfg
-- 
2.0.0.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-12  6:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-12  6:53 phyCORE-imx27 updates Sascha Hauer
2014-06-12  6:53 ` [PATCH 1/5] ARM: uncompress.c: copy executable to SDRAM if necessary Sascha Hauer
2014-06-12  6:53 ` [PATCH 2/5] ARM: Phytec-phyCORE-imx27: Register board env during runtime Sascha Hauer
2014-06-12  6:53 ` [PATCH 3/5] ARM: i.MX bbu: Add update handler for external NOR boot Sascha Hauer
2014-06-12  6:53 ` [PATCH 4/5] ARM: Phytec-phyCORE-imx27: Register NOR/NAND update handlers Sascha Hauer
2014-06-12  6:53 ` [PATCH 5/5] ARM: Phytec-phyCORE-imx27: Switch to multiimage support Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox