mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/7] ARM: i.MX6: esdctl: Fix memsize calculation for 4GiB/cs
@ 2016-04-01 12:10 Sascha Hauer
  2016-04-01 12:10 ` [PATCH 2/7] ARM: i.MX6: esdctl: Fix CS0_end " Sascha Hauer
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Sascha Hauer @ 2016-04-01 12:10 UTC (permalink / raw)
  To: Barebox List

On i.MX6 a single chipselect can have 4GiB, which overflows a 32bit
type, so imx6_mmdc_sdram_size() must return a u64 to support this case.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/esdctl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index e633b62..66ba51c 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -171,11 +171,11 @@ static inline unsigned long imx_v4_sdram_size(void __iomem *esdctlbase, int cs)
  * MMDC - found on i.MX6
  */
 
-static inline unsigned long imx6_mmdc_sdram_size(void __iomem *mmdcbase, int cs)
+static inline u64 imx6_mmdc_sdram_size(void __iomem *mmdcbase, int cs)
 {
 	u32 ctlval = readl(mmdcbase + MDCTL);
 	u32 mdmisc = readl(mmdcbase + MDMISC);
-	unsigned long size;
+	u64 size;
 	int rows, cols, width = 2, banks = 8;
 
 	if (cs == 0 && !(ctlval & MMDCx_MDCTL_SDE0))
@@ -201,7 +201,7 @@ static inline unsigned long imx6_mmdc_sdram_size(void __iomem *mmdcbase, int cs)
 	if (mdmisc & MMDCx_MDMISC_DDR_4_BANKS)
 		banks = 4;
 
-	size = (1 << cols) * (1 << rows) * banks * width;
+	size = (u64)(1 << cols) * (1 << rows) * banks * width;
 
 	return size;
 }
-- 
2.7.0


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

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

* [PATCH 2/7] ARM: i.MX6: esdctl: Fix CS0_end for 4GiB/cs
  2016-04-01 12:10 [PATCH 1/7] ARM: i.MX6: esdctl: Fix memsize calculation for 4GiB/cs Sascha Hauer
@ 2016-04-01 12:10 ` Sascha Hauer
  2016-04-01 12:10 ` [PATCH 3/7] ARM: i.MX: remove unused imx-flash-header.h Sascha Hauer
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2016-04-01 12:10 UTC (permalink / raw)
  To: Barebox List

On i.MX6 a single chipselect can have 4GiB. In this case the calculation
for CS0_end overflows the 7 bit field. Clamp it to 127, the maximum
supported value.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/imx6-mmdc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/imx6-mmdc.c b/arch/arm/mach-imx/imx6-mmdc.c
index 146df57..8f661e3 100644
--- a/arch/arm/mach-imx/imx6-mmdc.c
+++ b/arch/arm/mach-imx/imx6-mmdc.c
@@ -1199,7 +1199,7 @@ void mx6_dram_cfg(const struct mx6_ddr_sysinfo *sysinfo,
 	twtr = ROUND(max(4 * clkper, 7500) / clkper, 1) - 1;
 	trcd = trp;
 	trtp = twtr;
-	cs0_end = 4 * sysinfo->cs_density - 1 + 8;
+	cs0_end = min(4 * sysinfo->cs_density - 1 + 8, 127);
 
 	debug("density:%d Gb (%d Gb per chip)\n",
 	      sysinfo->cs_density, ddr3_cfg->density);
-- 
2.7.0


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

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

* [PATCH 3/7] ARM: i.MX: remove unused imx-flash-header.h
  2016-04-01 12:10 [PATCH 1/7] ARM: i.MX6: esdctl: Fix memsize calculation for 4GiB/cs Sascha Hauer
  2016-04-01 12:10 ` [PATCH 2/7] ARM: i.MX6: esdctl: Fix CS0_end " Sascha Hauer
@ 2016-04-01 12:10 ` Sascha Hauer
  2016-04-01 12:10 ` [PATCH 4/7] ARM: i.MX: xload-esdhc: Add GPL header Sascha Hauer
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2016-04-01 12:10 UTC (permalink / raw)
  To: Barebox List

All i.MX images are nowadays built with the imx-image tool, so we do not
need the header files and Kconfig options anymore. Remove them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/efika-mx-smartbook/board.c        |   1 -
 arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c |   1 -
 arch/arm/boards/freescale-mx25-3ds/3stack.c       |   1 -
 arch/arm/boards/freescale-mx51-babbage/board.c    |   1 -
 arch/arm/boards/freescale-mx53-qsb/board.c        |   1 -
 arch/arm/boards/karo-tx53/board.c                 |   1 -
 arch/arm/configs/eukrea_cpuimx25_defconfig        |   2 -
 arch/arm/configs/tx51stk5_defconfig               |   2 -
 arch/arm/mach-imx/Kconfig                         |  52 -------
 arch/arm/mach-imx/imx-bbu-internal.c              |   1 -
 arch/arm/mach-imx/include/mach/barebox.lds.h      |  32 ----
 arch/arm/mach-imx/include/mach/imx-flash-header.h | 182 ----------------------
 include/asm-generic/barebox.lds.h                 |   7 +-
 13 files changed, 1 insertion(+), 283 deletions(-)
 delete mode 100644 arch/arm/mach-imx/include/mach/barebox.lds.h
 delete mode 100644 arch/arm/mach-imx/include/mach/imx-flash-header.h

diff --git a/arch/arm/boards/efika-mx-smartbook/board.c b/arch/arm/boards/efika-mx-smartbook/board.c
index f023d70..d1d020e 100644
--- a/arch/arm/boards/efika-mx-smartbook/board.c
+++ b/arch/arm/boards/efika-mx-smartbook/board.c
@@ -32,7 +32,6 @@
 
 #include <asm/armlinux.h>
 
-#include <mach/imx-flash-header.h>
 #include <mach/devices-imx51.h>
 #include <mach/imx51-regs.h>
 #include <mach/iomux-mx51.h>
diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
index 4ab5b95..22bf740 100644
--- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
+++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
@@ -38,7 +38,6 @@
 #include <mach/iim.h>
 #include <fec.h>
 #include <nand.h>
-#include <mach/imx-flash-header.h>
 #include <mach/iomux-mx25.h>
 #include <i2c/i2c.h>
 #include <usb/fsl_usb2.h>
diff --git a/arch/arm/boards/freescale-mx25-3ds/3stack.c b/arch/arm/boards/freescale-mx25-3ds/3stack.c
index f000010..6d0e382 100644
--- a/arch/arm/boards/freescale-mx25-3ds/3stack.c
+++ b/arch/arm/boards/freescale-mx25-3ds/3stack.c
@@ -32,7 +32,6 @@
 #include <mach/imx-nand.h>
 #include <fec.h>
 #include <nand.h>
-#include <mach/imx-flash-header.h>
 #include <mach/iomux-mx25.h>
 #include <mach/generic.h>
 #include <mach/iim.h>
diff --git a/arch/arm/boards/freescale-mx51-babbage/board.c b/arch/arm/boards/freescale-mx51-babbage/board.c
index 6650ff3..c4acb8e 100644
--- a/arch/arm/boards/freescale-mx51-babbage/board.c
+++ b/arch/arm/boards/freescale-mx51-babbage/board.c
@@ -42,7 +42,6 @@
 #include <mach/iomux-mx51.h>
 #include <mach/devices-imx51.h>
 #include <mach/revision.h>
-#include <mach/imx-flash-header.h>
 
 #define MX51_CCM_CACRR 0x10
 
diff --git a/arch/arm/boards/freescale-mx53-qsb/board.c b/arch/arm/boards/freescale-mx53-qsb/board.c
index dd2abb5..f75c9d1 100644
--- a/arch/arm/boards/freescale-mx53-qsb/board.c
+++ b/arch/arm/boards/freescale-mx53-qsb/board.c
@@ -32,7 +32,6 @@
 
 #include <generated/mach-types.h>
 
-#include <mach/imx-flash-header.h>
 #include <mach/imx53-regs.h>
 #include <mach/revision.h>
 #include <mach/generic.h>
diff --git a/arch/arm/boards/karo-tx53/board.c b/arch/arm/boards/karo-tx53/board.c
index b8164ca..9e65a83 100644
--- a/arch/arm/boards/karo-tx53/board.c
+++ b/arch/arm/boards/karo-tx53/board.c
@@ -34,7 +34,6 @@
 #include <mach/imx-nand.h>
 #include <mach/iim.h>
 #include <mach/imx5.h>
-#include <mach/imx-flash-header.h>
 #include <mach/bbu.h>
 
 #include <asm/armlinux.h>
diff --git a/arch/arm/configs/eukrea_cpuimx25_defconfig b/arch/arm/configs/eukrea_cpuimx25_defconfig
index 43580b1..5a508dc 100644
--- a/arch/arm/configs/eukrea_cpuimx25_defconfig
+++ b/arch/arm/configs/eukrea_cpuimx25_defconfig
@@ -1,7 +1,5 @@
 CONFIG_ARCH_IMX=y
 CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
-CONFIG_ARCH_IMX_INTERNAL_BOOT=y
-CONFIG_ARCH_IMX_INTERNAL_BOOT_SERIAL=y
 CONFIG_MACH_EUKREA_CPUIMX25=y
 CONFIG_IMX_IIM=y
 CONFIG_IMX_IIM_FUSE_BLOW=y
diff --git a/arch/arm/configs/tx51stk5_defconfig b/arch/arm/configs/tx51stk5_defconfig
index 1afe378..acde46a 100644
--- a/arch/arm/configs/tx51stk5_defconfig
+++ b/arch/arm/configs/tx51stk5_defconfig
@@ -5,8 +5,6 @@ CONFIG_ARCH_IMX=y
 CONFIG_CPU_32=y
 CONFIG_CPU_V7=y
 CONFIG_CPU_32v7=y
-CONFIG_ARCH_IMX_INTERNAL_BOOT=y
-CONFIG_ARCH_IMX_INTERNAL_BOOT_NAND=y
 CONFIG_ARCH_IMX51=y
 CONFIG_MACH_TX51=y
 CONFIG_IMX_IIM=y
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 33ae145..5b648ac 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -39,27 +39,6 @@ config ARCH_TEXT_BASE
 	default 0x4fc00000 if MACH_VARISCITE_MX6
 	default 0x4fc00000 if MACH_PHYTEC_SOM_IMX6
 
-config ARCH_IMX_INTERNAL_BOOT
-	bool "support internal boot mode"
-	depends on ARCH_IMX25 || ARCH_IMX35 || ARCH_IMX51 || ARCH_IMX53 || ARCH_IMX6
-	depends on !HAVE_PBL_MULTI_IMAGES
-	help
-	  i.MX processors support two different boot modes. With the internal
-	  boot mode the boot medium contains a header describing the image to
-	  load. The header also contains a register/value table which can be
-	  used to setup SDRAM. The internal ROM code then initializes SDRAM
-	  using the register/value table, loads the whole barebox image to
-	  SDRAM and starts it. The internal boot mode is available on newer
-	  i.MX processors (i.MX25, i.MX35, i.MX51, i.MX53 and i.MX6), and
-	  supports booting from NOR, NAND, MMC/SD and serial ROMs.
-	  The external boot mode supports booting only from NAND and NOR. With
-	  NOR flash the image is just started in NOR flash. With NAND flash
-	  the NAND controller loads the first 2kbyte from NAND into the NAND
-	  controllers internal SRAM where it is then started. It's the
-	  responsibility of these 2kbyte to load the rest of the boot image.
-	  The external boot mode is supported on older i.MX processors (i.MX1,
-	  i.MX21, i.MX25, i.MX27, i.MX31, i.MX35).
-
 config ARCH_IMX_IMXIMAGE
 	bool
 	default y
@@ -87,37 +66,6 @@ config ARCH_IMX_UNUSED_IRAM_SIZE
        depends on ARCH_IMX_XLOAD
        default 0x16000 if ARCH_IMX51
 
-choice
-	depends on ARCH_IMX_INTERNAL_BOOT
-	prompt "Internal boot source"
-	default ARCH_IMX_INTERNAL_BOOT_NAND
-	help
-	  Determines the location of the header information for internal boot.
-	  0x100 for OneNAND
-	  0x400 for NAND, SD/MMC or Serial ROM
-	  0x1000 for NOR
-
-config ARCH_IMX_INTERNAL_BOOT_NAND
-	bool "NAND, SD/MMC, Serial ROM"
-
-config ARCH_IMX_INTERNAL_BOOT_NOR
-	bool "NOR"
-
-config ARCH_IMX_INTERNAL_BOOT_ONENAND
-	bool "OneNAND"
-
-config ARCH_IMX_INTERNAL_BOOT_SERIAL
-	bool "Serial (read help)"
-	help
-	  Normally the first instruction of the barebox image contains a jump
-	  to the real start of the image which means that you can start it by
-	  jumping to the load address. With serial boot images this is not
-	  possible because the first instruction is occupied by a magic for the
-	  ROM boot code. You can still start this image as a second stage loader,
-	  but you have to add 0x400 to the entry point.
-
-endchoice
-
 config ARCH_IMX_EXTERNAL_BOOT_NAND
 	bool
 	depends on ARCH_IMX25 || ARCH_IMX27 || ARCH_IMX31 || ARCH_IMX35
diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index 821ce66..51ec8b8 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -30,7 +30,6 @@
 #include <linux/stat.h>
 #include <ioctl.h>
 #include <mach/bbu.h>
-#include <mach/imx-flash-header.h>
 
 #define FLASH_HEADER_OFFSET_MMC		0x400
 
diff --git a/arch/arm/mach-imx/include/mach/barebox.lds.h b/arch/arm/mach-imx/include/mach/barebox.lds.h
deleted file mode 100644
index 2e60282..0000000
--- a/arch/arm/mach-imx/include/mach/barebox.lds.h
+++ /dev/null
@@ -1,32 +0,0 @@
-
-#ifdef CONFIG_ARCH_IMX_INTERNAL_BOOT
-
-#ifdef CONFIG_ARCH_IMX_INTERNAL_BOOT_SERIAL
-#define PRE_IMAGE \
-	.pre_image : {					\
-		KEEP(*(.flash_header_0x0*))		\
-		KEEP(*(.dcd_entry_0x0*))		\
-		KEEP(*(.image_len_0x0*))		\
-		. = 0x400;				\
-	}
-#else
-
-#define PRE_IMAGE \
-	.pre_image : {					\
-		KEEP(*(.flash_header_start*))		\
-		. = 0x100;				\
-		KEEP(*(.flash_header_0x0100*))		\
-		KEEP(*(.dcd_entry_0x0100*))		\
-		KEEP(*(.image_len_0x0100*))		\
-		. = 0x400;				\
-		KEEP(*(.flash_header_0x0400*))		\
-		KEEP(*(.dcd_entry_0x0400*))		\
-		KEEP(*(.image_len_0x0400*))		\
-		. = 0x1000;				\
-		KEEP(*(.flash_header_0x1000*))		\
-		KEEP(*(.dcd_entry_0x1000*))		\
-		KEEP(*(.image_len_0x1000*))		\
-		. = 0x2000;				\
-	}
-#endif
-#endif
diff --git a/arch/arm/mach-imx/include/mach/imx-flash-header.h b/arch/arm/mach-imx/include/mach/imx-flash-header.h
deleted file mode 100644
index 7a8d5cc..0000000
--- a/arch/arm/mach-imx/include/mach/imx-flash-header.h
+++ /dev/null
@@ -1,182 +0,0 @@
-#ifndef __MACH_FLASH_HEADER_H
-#define __MACH_FLASH_HEADER_H
-
-#include <asm/sections.h>
-
-#define __flash_header_start		__section(.flash_header_start)
-
-#if defined(CONFIG_ARCH_IMX_INTERNAL_BOOT_NOR)
-	#define __flash_header_section		__section(.flash_header_0x1000)
-	#define __dcd_entry_section		__section(.dcd_entry_0x1000)
-	#define __image_len_section		__section(.image_len_0x1000)
-	#define FLASH_HEADER_OFFSET 0x1000
-#elif defined(CONFIG_ARCH_IMX_INTERNAL_BOOT_ONENAND)
-	#define __flash_header_section		__section(.flash_header_0x0100)
-	#define __dcd_entry_section		__section(.dcd_entry_0x0100)
-	#define __image_len_section		__section(.image_len_0x0100)
-	#define FLASH_HEADER_OFFSET 0x0100
-#elif defined(CONFIG_ARCH_IMX_INTERNAL_BOOT_SERIAL)
-	#define __flash_header_section		__section(.flash_header_0x0)
-	#define __dcd_entry_section		__section(.dcd_entry_0x0)
-	#define __image_len_section		__section(.image_len_0x0)
-	#define FLASH_HEADER_OFFSET 0x0
-#else
-	#define __flash_header_section		__section(.flash_header_0x0400)
-	#define __dcd_entry_section		__section(.dcd_entry_0x0400)
-	#define __image_len_section		__section(.image_len_0x0400)
-	#define FLASH_HEADER_OFFSET 0x0400
-#endif
-
-#define __flash_header_0x1000	__section(.flash_header_0x1000)
-#define __dcd_entry_0x1000	__section(.dcd_entry_0x1000)
-#define __image_len_0x1000	__section(.image_len_0x1000)
-
-#define __flash_header_0x0100	__section(.flash_header_0x0100)
-#define __dcd_entry_0x0100	__section(.dcd_entry_0x0100)
-#define __image_len_0x0100	__section(.image_len_0x0100)
-
-#define __flash_header_0x0400	__section(.flash_header_0x0400)
-#define __dcd_entry_0x0400	__section(.dcd_entry_0x0400)
-#define __image_len_0x0400	__section(.image_len_0x0400)
-
-#define __flash_header_0x0	__section(.flash_header_0x0)
-#define __dcd_entry_0x0		__section(.dcd_entry_0x0)
-#define __image_len_0x0		__section(.image_len_0x0)
-
-/*
- * NOR is not automatically copied anywhere by the boot ROM
- */
-#if defined (CONFIG_ARCH_IMX_INTERNAL_BOOT_NOR)
-	#define DEST_BASE	IMX_CS0_BASE
-#else
-	#define DEST_BASE	TEXT_BASE
-#endif
-
-#define FLASH_HEADER_BASE	(DEST_BASE + FLASH_HEADER_OFFSET)
-
-struct imx_dcd_entry {
-	unsigned long ptr_type;
-	unsigned long addr;
-	unsigned long val;
-};
-
-struct imx_dcd_v2_entry {
-	__be32 addr;
-	__be32 val;
-};
-
-#define DCD_BARKER	0xb17219e9
-
-struct imx_rsa_public_key {
-	unsigned char	rsa_exponent[4];
-	unsigned char	*rsa_modululs;
-	unsigned short	*exponent_size;
-	unsigned short	modulus_size;
-	unsigned char	init_flag;
-};
-
-#define APP_CODE_BARKER	0x000000b1
-
-struct imx_flash_header {
-	unsigned long			app_code_jump_vector;
-	unsigned long			app_code_barker;
-	unsigned long			app_code_csf;
-	unsigned long			dcd_ptr_ptr;
-	unsigned long			super_root_key;
-	unsigned long			dcd;
-	unsigned long			app_dest;
-	unsigned long			dcd_barker;
-	unsigned long			dcd_block_len;
-};
-
-#define IVT_HEADER_TAG		0xd1
-#define IVT_VERSION		0x40
-
-#define DCD_HEADER_TAG		0xd2
-#define DCD_VERSION		0x40
-
-#define DCD_COMMAND_WRITE_TAG	0xcc
-#define DCD_COMMAND_WRITE_PARAM	0x04
-
-/*
- * At least on i.MX5 the ROM copies only full blocks. Unfortunately
- * it does not round up to the next full block, we have to do it
- * ourselves. Use 4095 which should be enough for the largest NAND
- * pages.
- */
-#define DCD_BAREBOX_SIZE	(barebox_image_size + 4095)
-
-struct imx_ivt_header {
-	uint8_t tag;
-	__be16 length;
-	uint8_t version;
-} __attribute__((packed));
-
-struct imx_dcd_command {
-	uint8_t tag;
-	__be16 length;
-	uint8_t param;
-} __attribute__((packed));
-
-struct imx_dcd {
-	struct imx_ivt_header header;
-#ifndef IMX_INTERNAL_NAND_BBU
-	struct imx_dcd_command command;
-#endif
-};
-
-struct imx_boot_data {
-	uint32_t start;
-	uint32_t size;
-	uint32_t plugin;
-};
-
-struct imx_flash_header_v2 {
-	struct imx_ivt_header header;
-
-	uint32_t entry;
-	uint32_t reserved1;
-	uint32_t dcd_ptr;
-	uint32_t boot_data_ptr;
-	uint32_t self;
-	uint32_t csf;
-	uint32_t reserved2;
-
-	struct imx_boot_data boot_data;
-	struct imx_dcd dcd;
-};
-
-/*
- * A variant of the standard barebox header in the i.MX FCB
- * format. Needed for i.MX53 NAND boot
- */
-static inline void barebox_arm_imx_fcb_head(void)
-{
-	__asm__ __volatile__ (
-		".arm\n"
-		"	b 1f\n"
-		".word 0x20424346\n" /* FCB */
-		".word 0x1\n"
-#ifdef CONFIG_THUMB2_BAREBOX
-		"1:	adr r9, 1f + 1\n"
-		"	bx r9\n"
-		".thumb\n"
-		"1:\n"
-		"bl	barebox_arm_reset_vector\n"
-#else
-		"1:	b barebox_arm_reset_vector\n"
-		".word 0x0\n"
-		".word 0x0\n"
-#endif
-		".word 0x0\n"
-		".word 0x0\n"
-
-		".asciz \"barebox\"\n"
-		".word _text\n"				/* text base. If copied there,
-							 * barebox can skip relocation
-							 */
-		".word _barebox_image_size\n"		/* image size to copy */
-	);
-}
-
-#endif /* __MACH_FLASH_HEADER_H */
diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h
index 772058e..c8a919b 100644
--- a/include/asm-generic/barebox.lds.h
+++ b/include/asm-generic/barebox.lds.h
@@ -6,12 +6,7 @@
 #define STRUCT_ALIGNMENT 32
 #define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT)
 
-#if defined CONFIG_ARCH_IMX25 || \
-	defined CONFIG_ARCH_IMX35 || \
-	defined CONFIG_ARCH_IMX51 || \
-	defined CONFIG_ARCH_IMX53 || \
-	defined CONFIG_ARCH_IMX6 || \
-	defined CONFIG_X86 || \
+#if defined CONFIG_X86 || \
 	defined CONFIG_ARCH_EP93XX || \
 	defined CONFIG_ARCH_ZYNQ
 #include <mach/barebox.lds.h>
-- 
2.7.0


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

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

* [PATCH 4/7] ARM: i.MX: xload-esdhc: Add GPL header
  2016-04-01 12:10 [PATCH 1/7] ARM: i.MX6: esdctl: Fix memsize calculation for 4GiB/cs Sascha Hauer
  2016-04-01 12:10 ` [PATCH 2/7] ARM: i.MX6: esdctl: Fix CS0_end " Sascha Hauer
  2016-04-01 12:10 ` [PATCH 3/7] ARM: i.MX: remove unused imx-flash-header.h Sascha Hauer
@ 2016-04-01 12:10 ` Sascha Hauer
  2016-04-01 12:10 ` [PATCH 5/7] ARM: i.MX: xload-esdhc: Fix typo successul -> successful Sascha Hauer
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2016-04-01 12:10 UTC (permalink / raw)
  To: Barebox List

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/xload-esdhc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/mach-imx/xload-esdhc.c b/arch/arm/mach-imx/xload-esdhc.c
index 6479ce0..325e2e8 100644
--- a/arch/arm/mach-imx/xload-esdhc.c
+++ b/arch/arm/mach-imx/xload-esdhc.c
@@ -1,3 +1,14 @@
+/*
+ * 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; version 2.
+ *
+ * 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.
+ */
+
 #define pr_fmt(fmt) "xload-esdhc: " fmt
 
 #include <common.h>
-- 
2.7.0


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

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

* [PATCH 5/7] ARM: i.MX: xload-esdhc: Fix typo successul -> successful
  2016-04-01 12:10 [PATCH 1/7] ARM: i.MX6: esdctl: Fix memsize calculation for 4GiB/cs Sascha Hauer
                   ` (2 preceding siblings ...)
  2016-04-01 12:10 ` [PATCH 4/7] ARM: i.MX: xload-esdhc: Add GPL header Sascha Hauer
@ 2016-04-01 12:10 ` Sascha Hauer
  2016-04-01 12:10 ` [PATCH 6/7] ARM: i.MX: xload-esdhc: Add debug messages Sascha Hauer
  2016-04-01 12:10 ` [PATCH 7/7] ARM: i.MX: xload-esdhc: Find entry in image Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2016-04-01 12:10 UTC (permalink / raw)
  To: Barebox List

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/xload-esdhc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/xload-esdhc.c b/arch/arm/mach-imx/xload-esdhc.c
index 325e2e8..c150adf 100644
--- a/arch/arm/mach-imx/xload-esdhc.c
+++ b/arch/arm/mach-imx/xload-esdhc.c
@@ -251,7 +251,7 @@ int imx6_esdhc_load_image(int instance, void *buf, int len)
  * (This information is used to calculate the length of the image). The
  * image is started afterwards.
  *
- * Return: If successul, this function does not return. A negative error
+ * Return: If successful, this function does not return. A negative error
  * code is returned when this function fails.
  */
 int imx6_esdhc_start_image(int instance)
-- 
2.7.0


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

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

* [PATCH 6/7] ARM: i.MX: xload-esdhc: Add debug messages
  2016-04-01 12:10 [PATCH 1/7] ARM: i.MX6: esdctl: Fix memsize calculation for 4GiB/cs Sascha Hauer
                   ` (3 preceding siblings ...)
  2016-04-01 12:10 ` [PATCH 5/7] ARM: i.MX: xload-esdhc: Fix typo successul -> successful Sascha Hauer
@ 2016-04-01 12:10 ` Sascha Hauer
  2016-04-01 12:10 ` [PATCH 7/7] ARM: i.MX: xload-esdhc: Find entry in image Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2016-04-01 12:10 UTC (permalink / raw)
  To: Barebox List

When imx6_esdhc_start_image fails print an error, otherwise print a
success message.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/xload-esdhc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/xload-esdhc.c b/arch/arm/mach-imx/xload-esdhc.c
index c150adf..0ff58c8 100644
--- a/arch/arm/mach-imx/xload-esdhc.c
+++ b/arch/arm/mach-imx/xload-esdhc.c
@@ -276,8 +276,12 @@ int imx6_esdhc_start_image(int instance)
 	pr_debug("Check ok, loading image\n");
 
 	ret = imx6_esdhc_load_image(instance, buf, len);
-	if (ret)
+	if (ret) {
+		pr_err("Loading image failed with %d\n", ret);
 		return ret;
+	}
+
+	pr_debug("Image loaded successfully\n");
 
 	bb = buf;
 
-- 
2.7.0


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

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

* [PATCH 7/7] ARM: i.MX: xload-esdhc: Find entry in image
  2016-04-01 12:10 [PATCH 1/7] ARM: i.MX6: esdctl: Fix memsize calculation for 4GiB/cs Sascha Hauer
                   ` (4 preceding siblings ...)
  2016-04-01 12:10 ` [PATCH 6/7] ARM: i.MX: xload-esdhc: Add debug messages Sascha Hauer
@ 2016-04-01 12:10 ` Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2016-04-01 12:10 UTC (permalink / raw)
  To: Barebox List

The binary image generated by barebox contains an instruction at the
very beginning to jump over the header. However, when the image is
written to a SD card and the first 512 bytes are skipped in order to
preserve the partition table then this jump instruction is lost. Instead
of relying on the jump instruction at the image beginning calculate
the image entry from the i.MX header instead of relying on the beginning
of the image being the entry point.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/xload-esdhc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/xload-esdhc.c b/arch/arm/mach-imx/xload-esdhc.c
index 0ff58c8..e774e4e 100644
--- a/arch/arm/mach-imx/xload-esdhc.c
+++ b/arch/arm/mach-imx/xload-esdhc.c
@@ -260,6 +260,7 @@ int imx6_esdhc_start_image(int instance)
 	u32 *ivt = buf + SZ_1K;
 	int ret, len;
 	void __noreturn (*bb)(void);
+	unsigned int ofs;
 
 	len = imx_image_size();
 	len = ALIGN(len, SECTOR_SIZE);
@@ -283,7 +284,9 @@ int imx6_esdhc_start_image(int instance)
 
 	pr_debug("Image loaded successfully\n");
 
-	bb = buf;
+	ofs = *(ivt + 1) - *(ivt + 8);
+
+	bb = buf + ofs;
 
 	bb();
 }
-- 
2.7.0


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

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

end of thread, other threads:[~2016-04-01 12:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-01 12:10 [PATCH 1/7] ARM: i.MX6: esdctl: Fix memsize calculation for 4GiB/cs Sascha Hauer
2016-04-01 12:10 ` [PATCH 2/7] ARM: i.MX6: esdctl: Fix CS0_end " Sascha Hauer
2016-04-01 12:10 ` [PATCH 3/7] ARM: i.MX: remove unused imx-flash-header.h Sascha Hauer
2016-04-01 12:10 ` [PATCH 4/7] ARM: i.MX: xload-esdhc: Add GPL header Sascha Hauer
2016-04-01 12:10 ` [PATCH 5/7] ARM: i.MX: xload-esdhc: Fix typo successul -> successful Sascha Hauer
2016-04-01 12:10 ` [PATCH 6/7] ARM: i.MX: xload-esdhc: Add debug messages Sascha Hauer
2016-04-01 12:10 ` [PATCH 7/7] ARM: i.MX: xload-esdhc: Find entry in image Sascha Hauer

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