mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Trent Piepho <tpiepho@kymetacorp.com>
To: barebox <barebox@lists.infradead.org>
Subject: [PATCH] socfpga: Allow setting partition xloader boots from for mmc
Date: Thu, 10 Dec 2015 21:51:39 +0000	[thread overview]
Message-ID: <1449784305.26955.83.camel@rtred1test09.kymeta.local> (raw)

The xloader boots the 2nd stage barebox from socfpga_barebox_part when
using NOR.  But when using MMC it boots from a hardcoded "disk0.1".
Add the mmc device name to the partition description and use it for
mmc booting.

Add an extern declaration of socfpga_barebox_part to the socfpga
header so that a board can change it to use a different partition.

Initialize socfpga_barebox_part to the default value instead of NULL to
avoid the NULL check later.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
---
 arch/arm/mach-socfpga/include/mach/generic.h | 4 ++++
 arch/arm/mach-socfpga/xload.c                | 8 +++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-socfpga/include/mach/generic.h b/arch/arm/mach-socfpga/include/mach/generic.h
index 1f4247f..2a7e0ea 100644
--- a/arch/arm/mach-socfpga/include/mach/generic.h
+++ b/arch/arm/mach-socfpga/include/mach/generic.h
@@ -18,6 +18,10 @@ static inline void __udelay(unsigned us)
 struct socfpga_barebox_part {
 	unsigned int nor_offset;
 	unsigned int nor_size;
+	const char *mmc_disk;
 };
 
+/* Partition/device for xloader to load main bootloader from */
+extern const struct socfpga_barebox_part *barebox_part;
+
 #endif /* __MACH_SOCFPGA_GENERIC_H */
diff --git a/arch/arm/mach-socfpga/xload.c b/arch/arm/mach-socfpga/xload.c
index cf05ff3..fd0d777 100644
--- a/arch/arm/mach-socfpga/xload.c
+++ b/arch/arm/mach-socfpga/xload.c
@@ -20,12 +20,13 @@
 #include <mach/system-manager.h>
 #include <mach/socfpga-regs.h>
 
-struct socfpga_barebox_part *barebox_part;
 
 static struct socfpga_barebox_part default_part = {
 	.nor_offset = SZ_256K,
 	.nor_size = SZ_1M,
+	.mmc_disk = "disk0.1",
 };
+const struct socfpga_barebox_part *barebox_part = &default_part;
 
 enum socfpga_clks {
 	timer, mmc, qspi_clk, uart, clk_max
@@ -110,13 +111,10 @@ static __noreturn int socfpga_xload(void)
 	enum bootsource bootsource = bootsource_get();
 	void *buf;
 
-	if (!barebox_part)
-		barebox_part = &default_part;
-
 	switch (bootsource) {
 	case BOOTSOURCE_MMC:
 		socfpga_mmc_init();
-		buf = bootstrap_read_disk("disk0.1", "fat");
+		buf = bootstrap_read_disk(barebox_part->mmc_disk, "fat");
 		break;
 	case BOOTSOURCE_SPI:
 		socfpga_qspi_init();
-- 
1.8.3.1


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

             reply	other threads:[~2015-12-10 21:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 21:51 Trent Piepho [this message]
2015-12-11  9:41 ` Sascha Hauer
2015-12-11 19:22   ` Trent Piepho
2015-12-14 10:33 ` 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=1449784305.26955.83.camel@rtred1test09.kymeta.local \
    --to=tpiepho@kymetacorp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox