diff mbox

Devicetree: Initialization order of mmc block devices?

Message ID 50094168.2090900@de.bosch.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dirk Behme July 20, 2012, 11:30 a.m. UTC
On 19.07.2012 22:45, Jassi Brar wrote:
> On 18 July 2012 19:41, Knut Wohlrab <knut.wohlrab@de.bosch.com> wrote:
>> On 07/18/2012 03:47 PM, Jassi Brar wrote:
>>> On 18 July 2012 15:19, Knut Wohlrab <knut.wohlrab@de.bosch.com> wrote:
>>>
>>>> If a SD card is inserted at boot time, its "mmcblk0", the embedded
>>>> MMC (eMMC) device "mmcblk1".  This makes it difficult to give the kernel
>>>> the
>>>> correct device for the eMMC root file system ("root=/dev/mmcblk?p1 ...").
>>>>
>>> How about  root=UUID=<eMMC-partition>  ?
>> Because we are talking about an embedded device, it is very difficult to get
>> a UUID of a eMMC partition into kernel command line with U-Boot. Handling of
>> UUID is also a big effort at board manufacturing.
>>
> I don't realize how bad is it if a common UUID is used on each cloned
> eMMC(non-removable) of every instance of a device. But of course only
> you know what's best for your product.
> 
>> This problem can occur on many devices with embedded MMC and removable SD,
>> e.g. smart phones. So I think we should find an solution to define MMC scan
>> order or device number/name in a device tree.
>>
> I assume your issue is that due to async nature of mmc scanning, the
> eMMC is detected later than external card, despite being the probe for
> eMMC's slot initiated first ?
> If so, we can do by simply associating 'N' of 'mmcblkN' with the slot
> index i.e, mmc_host.index (instead of mmc_blk_data.name_idx). Which is
> always in the order of probe calling. And we don't need to modify, or
> expect more of, DT for that.

Do you mean something like

         set_capacity(md->disk, size);

?

A first quick test looks promising. We will go on testing this.

> Though I suspect there must be some
> serious reason why it's not already done that way.

Anybody with an idea? Any serious reason?

Many thanks and best regards

Dirk

Comments

Jassi Brar July 20, 2012, 11:56 a.m. UTC | #1
On 20 July 2012 17:00, Dirk Behme <dirk.behme@de.bosch.com> wrote:
> On 19.07.2012 22:45, Jassi Brar wrote:

>>> This problem can occur on many devices with embedded MMC and removable
>>> SD,
>>> e.g. smart phones. So I think we should find an solution to define MMC
>>> scan
>>> order or device number/name in a device tree.
>>>
>> I assume your issue is that due to async nature of mmc scanning, the
>> eMMC is detected later than external card, despite being the probe for
>> eMMC's slot initiated first ?
>> If so, we can do by simply associating 'N' of 'mmcblkN' with the slot
>> index i.e, mmc_host.index (instead of mmc_blk_data.name_idx). Which is
>> always in the order of probe calling. And we don't need to modify, or
>> expect more of, DT for that.
>
>
> Do you mean something like
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -1536,7 +1536,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct
> mmc_card *card,
>          */
>
>         snprintf(md->disk->disk_name, sizeof(md->disk->disk_name),
> -                "mmcblk%d%s", md->name_idx, subname ? subname : "");
> +                "mmcblk%d%s", card->host->index, subname ? subname : "");
>
>         blk_queue_logical_block_size(md->queue.queue, 512);
>         set_capacity(md->disk, size);
>
> ?
>
Exactly!
It seems too trivial and default for the author to have missed it, so
I suspect I am overlooking something yet again. I would dig email
archives to know more about that naming convention before dare submit
a patch :)
diff mbox

Patch

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1536,7 +1536,7 @@  static struct mmc_blk_data 
*mmc_blk_alloc_req(struct mmc_card *card,
          */

         snprintf(md->disk->disk_name, sizeof(md->disk->disk_name),
-                "mmcblk%d%s", md->name_idx, subname ? subname : "");
+                "mmcblk%d%s", card->host->index, subname ? subname : "");

         blk_queue_logical_block_size(md->queue.queue, 512);