All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Fritz <chf.fritz@googlemail.com>
To: barebox@lists.infradead.org
Subject: [PATCH] [RFC] omap: xload - try to get partition from dts
Date: Mon, 12 May 2014 16:57:01 +0200	[thread overview]
Message-ID: <1399906621.4918.3.camel@mars> (raw)

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(-)

diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
index a309450..c360568 100644
--- a/arch/arm/mach-omap/xload.c
+++ b/arch/arm/mach-omap/xload.c
@@ -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;
-- 
1.7.10.4




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

             reply	other threads:[~2014-05-12 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-12 14:57 Christoph Fritz [this message]
2014-05-12 15:21 ` [PATCH] [RFC] omap: xload - try to get partition from dts Christoph Fritz
2014-05-13  8:21 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399906621.4918.3.camel@mars \
    --to=chf.fritz@googlemail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.