mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] mx53-loco: provide the right header for serial downloader
@ 2013-04-10 14:10 Eric Bénard
  2013-04-10 14:10 ` [PATCH 2/2] i.MX53: add serial downloader bootsource Eric Bénard
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Eric Bénard @ 2013-04-10 14:10 UTC (permalink / raw)
  To: barebox

this patch allows barebox to run when loaded on the iMX53QSB
using the serial downloader.

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 arch/arm/boards/freescale-mx53-loco/flash_header.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boards/freescale-mx53-loco/flash_header.c b/arch/arm/boards/freescale-mx53-loco/flash_header.c
index dc1162b..5358f0b 100644
--- a/arch/arm/boards/freescale-mx53-loco/flash_header.c
+++ b/arch/arm/boards/freescale-mx53-loco/flash_header.c
@@ -34,10 +34,17 @@ struct imx_flash_header_v2 __flash_header_section flash_header = {
 	.header.length		= cpu_to_be16(32),
 	.header.version		= IVT_VERSION,
 
+#ifdef CONFIG_ARCH_IMX_INTERNAL_BOOT_SERIAL
+	.entry			= APP_DEST + 0x400,
+	.dcd_ptr		= APP_DEST + offsetof(struct imx_flash_header_v2, dcd),
+	.boot_data_ptr		= APP_DEST + offsetof(struct imx_flash_header_v2, boot_data),
+	.self			= APP_DEST,
+#else
 	.entry			= APP_DEST + 0x1000,
 	.dcd_ptr		= APP_DEST + 0x400 + offsetof(struct imx_flash_header_v2, dcd),
 	.boot_data_ptr		= APP_DEST + 0x400 + offsetof(struct imx_flash_header_v2, boot_data),
 	.self			= APP_DEST + 0x400,
+#endif
 
 	.boot_data.start	= APP_DEST,
 	.boot_data.size		= DCD_BAREBOX_SIZE,
-- 
1.7.11.7


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

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

* [PATCH 2/2] i.MX53: add serial downloader bootsource
  2013-04-10 14:10 [PATCH 1/2] mx53-loco: provide the right header for serial downloader Eric Bénard
@ 2013-04-10 14:10 ` Eric Bénard
  2013-04-10 16:08 ` [PATCH 1/2] mx53-loco: provide the right header for serial downloader Jean-Christophe PLAGNIOL-VILLARD
  2013-04-11  8:02 ` Sascha Hauer
  2 siblings, 0 replies; 5+ messages in thread
From: Eric Bénard @ 2013-04-10 14:10 UTC (permalink / raw)
  To: barebox

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 arch/arm/mach-imx/boot.c | 70 +++++++++++++++++++++++++-----------------------
 1 file changed, 37 insertions(+), 33 deletions(-)

diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index bd0cb84..2e3f7ca 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -172,39 +172,43 @@ void imx53_boot_save_loc(void __iomem *src_base)
 	int instance;
 	uint32_t cfg1 = readl(src_base + IMX53_SRC_SBMR);
 
-	switch ((cfg1 & 0xff) >> 4) {
-	case 2:
-		src = BOOTSOURCE_HD;
-		break;
-	case 3:
-		if (cfg1 & (1 << 3))
-			src = BOOTSOURCE_SPI;
-		else
-			src = BOOTSOURCE_I2C;
-		break;
-	case 4:
-	case 5:
-	case 6:
-	case 7:
-		src = BOOTSOURCE_MMC;
-		break;
-	default:
-		break;
-	}
-
-	if (cfg1 & (1 << 7))
-		src = BOOTSOURCE_NAND;
-
-
-	switch (src) {
-	case BOOTSOURCE_MMC:
-	case BOOTSOURCE_SPI:
-	case BOOTSOURCE_I2C:
-		instance = (cfg1 >> 21) & 0x3;
-		break;
-	default:
-		instance = 0;
-		break;
+	if ((cfg1 & 0x03000000) >> 24 == 0x3)
+		src = BOOTSOURCE_SERIAL;
+	else {
+		switch ((cfg1 & 0xff) >> 4) {
+		case 2:
+			src = BOOTSOURCE_HD;
+			break;
+		case 3:
+			if (cfg1 & (1 << 3))
+				src = BOOTSOURCE_SPI;
+			else
+				src = BOOTSOURCE_I2C;
+			break;
+		case 4:
+		case 5:
+		case 6:
+		case 7:
+			src = BOOTSOURCE_MMC;
+			break;
+		default:
+			break;
+		}
+
+		if (cfg1 & (1 << 7))
+			src = BOOTSOURCE_NAND;
+
+
+		switch (src) {
+		case BOOTSOURCE_MMC:
+		case BOOTSOURCE_SPI:
+		case BOOTSOURCE_I2C:
+			instance = (cfg1 >> 21) & 0x3;
+			break;
+		default:
+			instance = 0;
+			break;
+		}
 	}
 
 	bootsource_set(src);
-- 
1.7.11.7


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

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

* Re: [PATCH 1/2] mx53-loco: provide the right header for serial downloader
  2013-04-10 14:10 [PATCH 1/2] mx53-loco: provide the right header for serial downloader Eric Bénard
  2013-04-10 14:10 ` [PATCH 2/2] i.MX53: add serial downloader bootsource Eric Bénard
@ 2013-04-10 16:08 ` Jean-Christophe PLAGNIOL-VILLARD
  2013-04-11  8:02 ` Sascha Hauer
  2 siblings, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-10 16:08 UTC (permalink / raw)
  To: Eric Bénard; +Cc: barebox

On 16:10 Wed 10 Apr     , Eric Bénard wrote:
> this patch allows barebox to run when loaded on the iMX53QSB
> using the serial downloader.
> 
> Signed-off-by: Eric Bénard <eric@eukrea.com>
> ---
>  arch/arm/boards/freescale-mx53-loco/flash_header.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/arm/boards/freescale-mx53-loco/flash_header.c b/arch/arm/boards/freescale-mx53-loco/flash_header.c
> index dc1162b..5358f0b 100644
> --- a/arch/arm/boards/freescale-mx53-loco/flash_header.c
> +++ b/arch/arm/boards/freescale-mx53-loco/flash_header.c
> @@ -34,10 +34,17 @@ struct imx_flash_header_v2 __flash_header_section flash_header = {
>  	.header.length		= cpu_to_be16(32),
>  	.header.version		= IVT_VERSION,
>  
> +#ifdef CONFIG_ARCH_IMX_INTERNAL_BOOT_SERIAL
> +	.entry			= APP_DEST + 0x400,
> +	.dcd_ptr		= APP_DEST + offsetof(struct imx_flash_header_v2, dcd),
> +	.boot_data_ptr		= APP_DEST + offsetof(struct imx_flash_header_v2, boot_data),
> +	.self			= APP_DEST,
> +#else
>  	.entry			= APP_DEST + 0x1000,
>  	.dcd_ptr		= APP_DEST + 0x400 + offsetof(struct imx_flash_header_v2, dcd),
>  	.boot_data_ptr		= APP_DEST + 0x400 + offsetof(struct imx_flash_header_v2, boot_data),
>  	.self			= APP_DEST + 0x400,
> +#endif
use a define to void duplication
>  
>  	.boot_data.start	= APP_DEST,
>  	.boot_data.size		= DCD_BAREBOX_SIZE,
> -- 
> 1.7.11.7
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

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

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

* Re: [PATCH 1/2] mx53-loco: provide the right header for serial downloader
  2013-04-10 14:10 [PATCH 1/2] mx53-loco: provide the right header for serial downloader Eric Bénard
  2013-04-10 14:10 ` [PATCH 2/2] i.MX53: add serial downloader bootsource Eric Bénard
  2013-04-10 16:08 ` [PATCH 1/2] mx53-loco: provide the right header for serial downloader Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-11  8:02 ` Sascha Hauer
  2013-04-11  8:12   ` Eric Bénard
  2 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2013-04-11  8:02 UTC (permalink / raw)
  To: Eric Bénard; +Cc: barebox

Hi Eric,

On Wed, Apr 10, 2013 at 04:10:57PM +0200, Eric Bénard wrote:
> this patch allows barebox to run when loaded on the iMX53QSB
> using the serial downloader.

What serial downloader do you use? We have a serial downloader here:

git://git.pengutronix.de/git/tools/imx-usb-loader.git

This one works by parsing the flash headers from the images and
executing them manually by doing register writes. It works with
the currently generated images just fine.

I though about integrating this tool into barebox. Part of the reason
for doing this is that this repository also contains a image generation
tool which could replace the compiler/linker mechanism we currently use
to generate i.MX images. Using a dedicated tool for this job seems more
flexible.

> 
> Signed-off-by: Eric Bénard <eric@eukrea.com>
> ---
>  arch/arm/boards/freescale-mx53-loco/flash_header.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/arm/boards/freescale-mx53-loco/flash_header.c b/arch/arm/boards/freescale-mx53-loco/flash_header.c
> index dc1162b..5358f0b 100644
> --- a/arch/arm/boards/freescale-mx53-loco/flash_header.c
> +++ b/arch/arm/boards/freescale-mx53-loco/flash_header.c
> @@ -34,10 +34,17 @@ struct imx_flash_header_v2 __flash_header_section flash_header = {
>  	.header.length		= cpu_to_be16(32),
>  	.header.version		= IVT_VERSION,
>  
> +#ifdef CONFIG_ARCH_IMX_INTERNAL_BOOT_SERIAL
> +	.entry			= APP_DEST + 0x400,
> +	.dcd_ptr		= APP_DEST + offsetof(struct imx_flash_header_v2, dcd),
> +	.boot_data_ptr		= APP_DEST + offsetof(struct imx_flash_header_v2, boot_data),
> +	.self			= APP_DEST,
> +#else
>  	.entry			= APP_DEST + 0x1000,
>  	.dcd_ptr		= APP_DEST + 0x400 + offsetof(struct imx_flash_header_v2, dcd),
>  	.boot_data_ptr		= APP_DEST + 0x400 + offsetof(struct imx_flash_header_v2, boot_data),
>  	.self			= APP_DEST + 0x400,
> +#endif

We already have a FLASH_HEADER_OFFSET define which seems to solve half
of the problem. Extending the ifdefs already present int the header
file should work better.

Sascha

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/2] mx53-loco: provide the right header for serial downloader
  2013-04-11  8:02 ` Sascha Hauer
@ 2013-04-11  8:12   ` Eric Bénard
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Bénard @ 2013-04-11  8:12 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sascha,

Le Thu, 11 Apr 2013 10:02:53 +0200,
Sascha Hauer <s.hauer@pengutronix.de> a écrit :
> On Wed, Apr 10, 2013 at 04:10:57PM +0200, Eric Bénard wrote:
> > this patch allows barebox to run when loaded on the iMX53QSB
> > using the serial downloader.
> 
> What serial downloader do you use? We have a serial downloader here:
> 
> git://git.pengutronix.de/git/tools/imx-usb-loader.git
> 
> This one works by parsing the flash headers from the images and
> executing them manually by doing register writes. It works with
> the currently generated images just fine.
> 
OK I'll give it a try here. I was using a home made tool which works
fine on i.MX25/35/51 and that I just adapted to i.MX53 so the problem
may be in my tool ;-)

Thanks
Eric

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

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-10 14:10 [PATCH 1/2] mx53-loco: provide the right header for serial downloader Eric Bénard
2013-04-10 14:10 ` [PATCH 2/2] i.MX53: add serial downloader bootsource Eric Bénard
2013-04-10 16:08 ` [PATCH 1/2] mx53-loco: provide the right header for serial downloader Jean-Christophe PLAGNIOL-VILLARD
2013-04-11  8:02 ` Sascha Hauer
2013-04-11  8:12   ` Eric Bénard

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