Re: [PATCH 06/10] omap: add SPI as a boot mode for xload

2012-09-04 Thread Jan Weitzel
Am Montag, den 03.09.2012, 18:24 +0200 schrieb Jean-Christophe
PLAGNIOL-VILLARD:
> On 13:46 Mon 03 Sep , Jan Luebbe wrote:
> > Signed-off-by: Jan Luebbe 
> you need to sync with 
> 
> 257 Aug27 Jan Weitzel [RFC] xload: get barebox size from 
> barebox_arm_head

read_image_head reads the size from partition. Could you try it?.
[PATCH v3] xload: get barebox size from barebox_arm_head

Jan



> Best Regards,
> J.
> 
> ___
> 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


Re: [PATCH 06/10] omap: add SPI as a boot mode for xload

2012-09-03 Thread Jean-Christophe PLAGNIOL-VILLARD
On 13:46 Mon 03 Sep , Jan Luebbe wrote:
> Signed-off-by: Jan Luebbe 
you need to sync with 

257 Aug27 Jan Weitzel [RFC] xload: get barebox size from 
barebox_arm_head

Best Regards,
J.

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


[PATCH 06/10] omap: add SPI as a boot mode for xload

2012-09-03 Thread Jan Luebbe
Signed-off-by: Jan Luebbe 
---
 arch/arm/mach-omap/include/mach/xload.h |1 +
 arch/arm/mach-omap/xload.c  |   27 +++
 2 files changed, 28 insertions(+)

diff --git a/arch/arm/mach-omap/include/mach/xload.h 
b/arch/arm/mach-omap/include/mach/xload.h
index 844b57f..c62912a 100644
--- a/arch/arm/mach-omap/include/mach/xload.h
+++ b/arch/arm/mach-omap/include/mach/xload.h
@@ -8,6 +8,7 @@ enum omap_boot_src {
OMAP_BOOTSRC_UNKNOWN,
OMAP_BOOTSRC_MMC1,
OMAP_BOOTSRC_NAND,
+   OMAP_BOOTSRC_SPI1,
 };
 
 enum omap_boot_src omap3_bootsrc(void);
diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
index 13024ab..1daa827 100644
--- a/arch/arm/mach-omap/xload.c
+++ b/arch/arm/mach-omap/xload.c
@@ -54,6 +54,29 @@ void *omap_xload_boot_mmc(void)
return buf;
 }
 
+void *omap_xload_boot_spi(int offset, int size)
+{
+   int ret;
+   void *to = xmalloc(size);
+   struct cdev *cdev;
+
+   devfs_add_partition("m25p0", offset, size, DEVFS_PARTITION_FIXED, "x");
+
+   cdev = cdev_open("x", O_RDONLY);
+   if (!cdev) {
+   printf("failed to open spi flash\n");
+   return NULL;
+   }
+
+   ret = cdev_read(cdev, to, size, 0, 0);
+   if (ret != size) {
+   printf("failed to read from spi flash\n");
+   return NULL;
+   }
+
+   return to;
+}
+
 enum omap_boot_src omap_bootsrc(void)
 {
 #if defined(CONFIG_ARCH_OMAP3)
@@ -82,6 +105,10 @@ int run_shell(void)
printf("booting from NAND\n");
func = omap_xload_boot_nand(SZ_128K, SZ_256K);
break;
+   case OMAP_BOOTSRC_SPI1:
+   printf("booting from SPI1\n");
+   func = omap_xload_boot_spi(SZ_128K, SZ_512K);
+   break;
}
 
if (!func) {
-- 
1.7.10.4


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