* [PATCH] socfpga: Allow setting partition xloader boots from for mmc
@ 2015-12-10 21:51 Trent Piepho
2015-12-11 9:41 ` Sascha Hauer
2015-12-14 10:33 ` Sascha Hauer
0 siblings, 2 replies; 4+ messages in thread
From: Trent Piepho @ 2015-12-10 21:51 UTC (permalink / raw)
To: barebox
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] socfpga: Allow setting partition xloader boots from for mmc
2015-12-10 21:51 [PATCH] socfpga: Allow setting partition xloader boots from for mmc Trent Piepho
@ 2015-12-11 9:41 ` Sascha Hauer
2015-12-11 19:22 ` Trent Piepho
2015-12-14 10:33 ` Sascha Hauer
1 sibling, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2015-12-11 9:41 UTC (permalink / raw)
To: Trent Piepho; +Cc: barebox
On Thu, Dec 10, 2015 at 09:51:39PM +0000, Trent Piepho wrote:
> 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.
What is the device string in your case? Is the device another one or is
the partition another one? I'm asking because I rather have the code
pushed into the "do the right thing" direction than in the "configure it
correctly" direction.
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] 4+ messages in thread
* Re: [PATCH] socfpga: Allow setting partition xloader boots from for mmc
2015-12-11 9:41 ` Sascha Hauer
@ 2015-12-11 19:22 ` Trent Piepho
0 siblings, 0 replies; 4+ messages in thread
From: Trent Piepho @ 2015-12-11 19:22 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On Fri, 2015-12-11 at 10:41 +0100, Sascha Hauer wrote:
> On Thu, Dec 10, 2015 at 09:51:39PM +0000, Trent Piepho wrote:
> > 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.
>
> What is the device string in your case? Is the device another one or is
> the partition another one? I'm asking because I rather have the code
> pushed into the "do the right thing" direction than in the "configure it
> correctly" direction.
On my device there are multiple partitions and I select which one to use
based on data from an eeprom. It's disk0.boot0, disk0.boot1, etc.
The socfpga code was copied from omap. On omap the partition description
has both nand and nor. socfpga doesn't have nand, but it does have mmc,
so it makes sense it should have both nor and mmc.
There is a board, phytec-som-am335x, that changes the default OMAP part
to something else. See commit ed1618261b10888dba13bf97d3d316351b65eab5.
I want to do the same thing on by board, except:
SocFPGA should have mmc+nor instead of phytec's nand+nor. Which is this
patch.
I want to select a different partition based on an eeprom, which is in
board specific code. And doesn't have to modify the arch code.
Since SocFPGA has just one mmc controller, there is only disk0. So one
could hard-code "disk0." and append the partition to it. But it
increases code complexity and size in the preloader to do that. I don't
see what the point would be. "disk0.1" actually exists as a device
while "1" doesn't, so it seems more natural to use the former.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] socfpga: Allow setting partition xloader boots from for mmc
2015-12-10 21:51 [PATCH] socfpga: Allow setting partition xloader boots from for mmc Trent Piepho
2015-12-11 9:41 ` Sascha Hauer
@ 2015-12-14 10:33 ` Sascha Hauer
1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-12-14 10:33 UTC (permalink / raw)
To: Trent Piepho; +Cc: barebox
On Thu, Dec 10, 2015 at 09:51:39PM +0000, Trent Piepho wrote:
> 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(-)
I read this patch again and now I understood it correctly. Looks good,
applied, thanks
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] 4+ messages in thread
end of thread, other threads:[~2015-12-14 10:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-10 21:51 [PATCH] socfpga: Allow setting partition xloader boots from for mmc Trent Piepho
2015-12-11 9:41 ` Sascha Hauer
2015-12-11 19:22 ` Trent Piepho
2015-12-14 10:33 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox