* [U-Boot] [PATCH] spl: mmc: use block device number, not hard-coded 0
@ 2015-12-05 19:32 Eric Nelson
2015-12-14 1:21 ` [U-Boot] " Tom Rini
2015-12-15 23:28 ` Tom Rini
0 siblings, 2 replies; 4+ messages in thread
From: Eric Nelson @ 2015-12-05 19:32 UTC (permalink / raw)
To: u-boot
In order to support boot from multiple devices through board_boot_order,
it's necessary to use the block number of a device.
The use of a hard-coded 0 for the device number also creates a need
to re-order block devices for use in SPL like this:
http://git.denx.de/?p=u-boot.git;a=blob;f=board/freescale/mx6slevk/mx6slevk.c;hb=HEAD#l195
Signed-off-by: Eric Nelson <eric@nelint.com>
---
common/spl/spl_mmc.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index b3c2c64..cc97e47 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -23,12 +23,13 @@ static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
unsigned long count;
u32 image_size_sectors;
struct image_header *header;
+ int dev_num = mmc->block_dev.dev;
header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
sizeof(struct image_header));
/* read image header to find the image size & load address */
- count = mmc->block_dev.block_read(0, sector, 1, header);
+ count = mmc->block_dev.block_read(dev_num, sector, 1, header);
debug("read sector %lx, count=%lu\n", sector, count);
if (count == 0)
goto end;
@@ -45,7 +46,7 @@ static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
mmc->read_bl_len;
/* Read the header too to avoid extra memcpy */
- count = mmc->block_dev.block_read(0, sector, image_size_sectors,
+ count = mmc->block_dev.block_read(dev_num, sector, image_size_sectors,
(void *)(ulong)spl_image.load_addr);
debug("read %x sectors to %x\n", image_size_sectors,
spl_image.load_addr);
@@ -172,7 +173,8 @@ static int mmc_load_image_raw_os(struct mmc *mmc)
{
unsigned long count;
- count = mmc->block_dev.block_read(0,
+ count = mmc->block_dev.block_read(
+ mmc->block_dev.dev,
CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR,
CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS,
(void *) CONFIG_SYS_SPL_ARGS_ADDR);
--
2.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* [U-Boot] spl: mmc: use block device number, not hard-coded 0
2015-12-05 19:32 [U-Boot] [PATCH] spl: mmc: use block device number, not hard-coded 0 Eric Nelson
@ 2015-12-14 1:21 ` Tom Rini
2015-12-14 2:19 ` Eric Nelson
2015-12-15 23:28 ` Tom Rini
1 sibling, 1 reply; 4+ messages in thread
From: Tom Rini @ 2015-12-14 1:21 UTC (permalink / raw)
To: u-boot
On Sat, Dec 05, 2015 at 12:32:28PM -0700, Eric Nelson wrote:
> In order to support boot from multiple devices through board_boot_order,
> it's necessary to use the block number of a device.
>
> The use of a hard-coded 0 for the device number also creates a need
> to re-order block devices for use in SPL like this:
> http://git.denx.de/?p=u-boot.git;a=blob;f=board/freescale/mx6slevk/mx6slevk.c;hb=HEAD#l195
We also do similar'ish things for TI parts (we only register what we're
booting from). So, before this can be applied don't we also need a
patch for mx6slevk and for TI ones too (but that should be "easier"
since I think it just becomes we always use the normal board_mmc_init) ?
Thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151213/42af5c30/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] spl: mmc: use block device number, not hard-coded 0
2015-12-14 1:21 ` [U-Boot] " Tom Rini
@ 2015-12-14 2:19 ` Eric Nelson
0 siblings, 0 replies; 4+ messages in thread
From: Eric Nelson @ 2015-12-14 2:19 UTC (permalink / raw)
To: u-boot
Hi Tom,
On 12/13/2015 06:21 PM, Tom Rini wrote:
> On Sat, Dec 05, 2015 at 12:32:28PM -0700, Eric Nelson wrote:
>
>> In order to support boot from multiple devices through board_boot_order,
>> it's necessary to use the block number of a device.
>>
>> The use of a hard-coded 0 for the device number also creates a need
>> to re-order block devices for use in SPL like this:
>> http://git.denx.de/?p=u-boot.git;a=blob;f=board/freescale/mx6slevk/mx6slevk.c;hb=HEAD#l195
>
> We also do similar'ish things for TI parts (we only register what we're
> booting from).
>
> So, before this can be applied don't we also need a patch for mx6slevk
> and for TI ones too (but that should be "easier" since I think it
> just becomes we always use the normal board_mmc_init) ?
We don't **need** a patch to support existing use cases because the
patch uses the dev number in the block device directly
(mmc->block_dev.dev).
https://patchwork.ozlabs.org/patch/553026/
I'm not sure about TI boards, but the i.MX6SL EVK code swaps the
non-SPL ordering of mmc devices when compiled for SPL in order
to handle the hard-coded zero:
http://git.denx.de/?p=u-boot.git;a=blob;f=board/freescale/mx6slevk/mx6slevk.c;hb=HEAD#l195
In other words, "mmc 0" becomes "mmc 1" and vice versa.
The trouble with this approach is that you can't allow for multiple
MMC devices through board_boot_order, because the second will be
device number 1.
Regards,
Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] spl: mmc: use block device number, not hard-coded 0
2015-12-05 19:32 [U-Boot] [PATCH] spl: mmc: use block device number, not hard-coded 0 Eric Nelson
2015-12-14 1:21 ` [U-Boot] " Tom Rini
@ 2015-12-15 23:28 ` Tom Rini
1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2015-12-15 23:28 UTC (permalink / raw)
To: u-boot
On Sat, Dec 05, 2015 at 12:32:28PM -0700, Eric Nelson wrote:
> In order to support boot from multiple devices through board_boot_order,
> it's necessary to use the block number of a device.
>
> The use of a hard-coded 0 for the device number also creates a need
> to re-order block devices for use in SPL like this:
> http://git.denx.de/?p=u-boot.git;a=blob;f=board/freescale/mx6slevk/mx6slevk.c;hb=HEAD#l195
>
> Signed-off-by: Eric Nelson <eric@nelint.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151215/ac76ce1e/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-12-15 23:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-05 19:32 [U-Boot] [PATCH] spl: mmc: use block device number, not hard-coded 0 Eric Nelson
2015-12-14 1:21 ` [U-Boot] " Tom Rini
2015-12-14 2:19 ` Eric Nelson
2015-12-15 23:28 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox