Skip to contentSkip to conversation

omap: xload - try to get partition from dts

RFC PATCH In review Christoph Fritz 2 participants 3 messages May 12, 2014 – May 13, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 omap: xload - try to get partition from dts

dev_add_bb_dev("x", "bbx") doesn't work here anymore. Since pcm051 supports dts, nand boot works again with this patch.

Any ideas?

---
 arch/arm/mach-omap/xload.c |   26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)
arch/arm/mach-omap/xload.c +17 -9
index a309450..c360568 100644
@@ -56,18 +56,22 @@ static unsigned int get_image_size(void *head)
 	return ret;
 }
 
-static void *omap_xload_boot_nand(int offset, int part_size)
+static void *omap_xload_boot_nand(unsigned int offset, unsigned int part_size)
 {
 	int ret;
 	int size;
 	void *to, *header;
 	struct cdev *cdev;
+	const char *bbx = "nand0.barebox";
 
-	devfs_add_partition("nand0", offset, part_size,
+	if (!cdev_by_name(bbx)) { /* currently not all support dts */
+		bbx = "bbx";
+		devfs_add_partition("nand0", offset, part_size,
 					DEVFS_PARTITION_FIXED, "x");
-	dev_add_bb_dev("x", "bbx");
+		dev_add_bb_dev("x", bbx);
+	}
 
-	header = read_image_head("bbx");
+	header = read_image_head(bbx);
 	if (header == NULL)
 		return NULL;
 
@@ -79,7 +83,7 @@ static void *omap_xload_boot_nand(int offset, int part_size)
 
 	to = xmalloc(size);
 
-	cdev = cdev_open("bbx", O_RDONLY);
+	cdev = cdev_open(bbx, O_RDONLY);
 	if (!cdev) {
 		printf("failed to open nand\n");
 		return NULL;
@@ -134,11 +138,15 @@ static void *omap_xload_boot_spi(int offset, int part_size)
 	int size;
 	void *to, *header;
 	struct cdev *cdev;
+	onst char *x = "m25p0.barebox";
 
-	devfs_add_partition("m25p0", offset, part_size,
-					DEVFS_PARTITION_FIXED, "x");
+	if (!cdev_by_name(x)) { /* currently not all support dts */
+		x = "x";
+		devfs_add_partition("m25p0", offset, part_size,
+					DEVFS_PARTITION_FIXED, x);
+	}
 
-	header = read_image_head("x");
+	header = read_image_head(x);
 	if (header == NULL)
 		return NULL;
 
@@ -150,7 +158,7 @@ static void *omap_xload_boot_spi(int offset, int part_size)
 
 	to = xmalloc(size);
 
-	cdev = cdev_open("x", O_RDONLY);
+	cdev = cdev_open(x, O_RDONLY);
 	if (!cdev) {
 		printf("failed to open spi flash\n");
 		return NULL;
Signature · 9 lines
1.7.10.4




_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 49 lines · Christoph Fritz

dev_add_bb_dev("x", "bbx") doesn't work here anymore. Since pcm051 supports dts, nand boot works again with this patch.

Any ideas?

---
 arch/arm/mach-omap/xload.c |   26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)
arch/arm/mach-omap/xload.c +9 -5
index a309450..c360568 100644
@@ -56,18 +56,22 @@ static unsigned int get_image_size(void *head)
 	return ret;
 }
 
-static void *omap_xload_boot_nand(int offset, int part_size)
+static void *omap_xload_boot_nand(unsigned int offset, unsigned int part_size)
 {
 	int ret;
 	int size;
 	void *to, *header;
 	struct cdev *cdev;
+	const char *bbx = "nand0.barebox";
 
-	devfs_add_partition("nand0", offset, part_size,
+	if (!cdev_by_name(bbx)) { /* currently not all support dts */
+		bbx = "bbx";
+		devfs_add_partition("nand0", offset, part_size,
 					DEVFS_PARTITION_FIXED, "x");
-	dev_add_bb_dev("x", "bbx");
+		dev_add_bb_dev("x", bbx);
+	}
 
-	header = read_image_head("bbx");
+	header = read_image_head(bbx);
 	if (header == NULL)
 		return NULL;
 
@@ -79,7 +83,7 @@ static void *omap_xload_boot_nand(int offset, int part_size)
 
 	to = xmalloc(size);
 
-	cdev = cdev_open("bbx", O_RDONLY);
+	cdev = cdev_open(bbx, O_RDONLY);
 	if (!cdev) {
 		printf("failed to open nand\n");
 		return NULL;

arch/arm/mach-omap/xload.c static void *omap_xload_boot_spi(int offset, int part_size) · line 141

Quoted 4 lines
arch/arm/mach-omap/xload.c +1 -0
@@ -134,11 +138,15 @@ static void *omap_xload_boot_spi(int offset, int part_size)
 	int size;
 	void *to, *header;
 	struct cdev *cdev;
+	onst char *x = "m25p0.barebox";

typo: const

Quoted 15 lines
arch/arm/mach-omap/xload.c +6 -3
-	devfs_add_partition("m25p0", offset, part_size,
-					DEVFS_PARTITION_FIXED, "x");
+	if (!cdev_by_name(x)) { /* currently not all support dts */
+		x = "x";
+		devfs_add_partition("m25p0", offset, part_size,
+					DEVFS_PARTITION_FIXED, x);
+	}
 
-	header = read_image_head("x");
+	header = read_image_head(x);
 	if (header == NULL)
 		return NULL;
 

arch/arm/mach-omap/xload.c static void *omap_xload_boot_spi(int offset, int part_size) · line 164

Quoted 8 lines
arch/arm/mach-omap/xload.c +1 -1
@@ -150,7 +158,7 @@ static void *omap_xload_boot_spi(int offset, int part_size)
 
 	to = xmalloc(size);
 
-	cdev = cdev_open("x", O_RDONLY);
+	cdev = cdev_open(x, O_RDONLY);
 	if (!cdev) {
 		printf("failed to open spi flash\n");
 		return NULL;

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#2 lore raw
In reply to Christoph Fritz

Hi Christoph,

Quoted 4 lines · Christoph Fritz

dev_add_bb_dev("x", "bbx") doesn't work here anymore. Since pcm051 supports dts, nand boot works again with this patch.

Any ideas?

Could you try "drop CONFIG_PARTITION_NEED_MTD" which I just sent to the list? This should fix this issue.

Sascha

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox