[PATCH 06/16] ARM: i.MX23 olinuxino: Check machine type in initcalls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check for the right machine type in initcalls before executing them to
make the board multi image safe.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c | 8 ++++++++
 arch/arm/boards/imx233-olinuxino/lowlevel.c        | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c b/arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c
index c06779ddf6..af548b3c53 100644
--- a/arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c
+++ b/arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c
@@ -26,6 +26,7 @@
 #include <errno.h>
 #include <mci.h>
 #include <asm/armlinux.h>
+#include <asm/barebox-arm.h>
 #include <usb/ehci.h>
 #include <mach/usb.h>
 #include <generated/mach-types.h>
@@ -33,6 +34,7 @@
 #include <mach/clock.h>
 #include <mach/mci.h>
 #include <mach/iomux.h>
+#include <generated/mach-types.h>
 
 static struct mxs_mci_platform_data mci_pdata = {
 	.caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED,
@@ -56,6 +58,9 @@ static struct gpio_led led1 = {
 
 static int imx23_olinuxino_devices_init(void)
 {
+	if (barebox_arm_machine() != MACH_TYPE_IMX233_OLINUXINO)
+		return 0;
+
 	armlinux_set_architecture(MACH_TYPE_IMX233_OLINUXINO);
 	defaultenv_append_directory(defaultenv_imx233_olinuxino);
 
@@ -76,6 +81,9 @@ device_initcall(imx23_olinuxino_devices_init);
 
 static int imx23_olinuxino_console_init(void)
 {
+	if (barebox_arm_machine() != MACH_TYPE_IMX233_OLINUXINO)
+		return 0;
+
 	barebox_set_model("Olimex.ltd imx233-olinuxino");
 	barebox_set_hostname("imx233-olinuxino");
 
diff --git a/arch/arm/boards/imx233-olinuxino/lowlevel.c b/arch/arm/boards/imx233-olinuxino/lowlevel.c
index 07a2a0e293..253cf1257b 100644
--- a/arch/arm/boards/imx233-olinuxino/lowlevel.c
+++ b/arch/arm/boards/imx233-olinuxino/lowlevel.c
@@ -7,10 +7,11 @@
 #include <io.h>
 #include <debug_ll.h>
 #include <mach/iomux.h>
+#include <generated/mach-types.h>
 
 ENTRY_FUNCTION(start_barebox_olinuxino_imx23, r0, r1, r2)
 {
-	barebox_arm_entry(IMX_MEMORY_BASE, SZ_64M, NULL);
+	barebox_arm_entry(IMX_MEMORY_BASE, SZ_64M, (void *)MACH_TYPE_IMX233_OLINUXINO);
 }
 
 static const uint32_t pad_setup[] = {
-- 
2.23.0


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



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux