All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: Shawn Lin <shawn.lin@rock-chips.com>,
	Jisheng Zhang <jszhang@marvell.com>,
	Ulf Hansson <ulf.hansson@linaro.org>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: [RFC PATCH] mmc: block: Support the fixed index for mmcblk with aliases nodes
Date: Mon, 04 Apr 2016 11:08:47 +0900	[thread overview]
Message-ID: <5701CCAF.4090102@samsung.com> (raw)
In-Reply-To: <56FB1AA2.8050005@rock-chips.com>

Hi All,

Are there any other opinion for this RFC patch?

Best Regards,
Jaehoon Chung

On 03/30/2016 09:15 AM, Shawn Lin wrote:
> 在 2016/3/29 18:49, Jisheng Zhang 写道:
>> Hi Jaehoon,
>>
>> On Tue, 29 Mar 2016 19:43:34 +0900 Jaehoon Chung wrote:
>>
>>> This patch is just RFC. I want to know opinions.
>>>
>>> Now, index of mmcblk is allocated in accordance with probing time.
>>> If want to use the mmcblk1 for some device, it can use alias.
>>>
>>> aliases {
>>>     mmc0 = &mmc0;    /* mmcblk0 for eMMC */
>>>     mmc1 = &mmc2;    /* mmcblk1 for SD */
>>>     mmc2 = &mmc1;    /* mmcblk2 for SDIO*/
>>> };
>>
>> I like this feature and we do need it. In the past, we have to put emmc dt node
>> before the sd node, but on our platform, the register base of sdhc host for emmc
>> is higher than the one for sd, putting emmc dt node before sd looks a bit
>> strange, but we have no better solutions.
>>
> 
> :) That is also what I suffered currently. I have to prepare two
> seperate firmware with two diff fstab files to assign the mount point
> since sometime I need to boot from sd, but sometimes from emmc....
> With this patch, I only need to dtc a new dtb... quite simple.
> 
>> Thanks,
>> Jisheng
>>
>>>
>>> If there are no corresponding values, it might be allocated with
>>> existing scheme.
>>>
>>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>>> ---
>>>   Documentation/devicetree/bindings/mmc/mmc.txt | 11 +++++++++++
>>>   drivers/mmc/card/block.c                      | 17 ++++++++++++++++-
>>>   2 files changed, 27 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/mmc/mmc.txt b/Documentation/devicetree/bindings/mmc/mmc.txt
>>> index ed23b9b..e37ea29 100644
>>> --- a/Documentation/devicetree/bindings/mmc/mmc.txt
>>> +++ b/Documentation/devicetree/bindings/mmc/mmc.txt
>>> @@ -71,6 +71,10 @@ Optional SDIO properties:
>>>   - wakeup-source: Enables wake up of host system on SDIO IRQ assertion
>>>            (Legacy property supported: "enable-sdio-wakeup")
>>>
>>> +Aliases (Optional):
>>> +- If you want to use the fixed index for block device like mmcblkX, should be
>>> +represented in the aliases node using following format "mmc(X)".
>>> +(X is an unique number for the alias.)
>>>
>>>   MMC power sequences:
>>>   --------------------
>>> @@ -145,3 +149,10 @@ mmc3: mmc@01c12000 {
>>>           interrupt-names = "host-wake";
>>>       };
>>>   };
>>> +
>>> +Example with aliases nodes:
>>> +
>>> +aliases {
>>> +    mmc0 = &mmc0;    /* Fixed to mmcblk0 for &mmc0 */
>>> +    mmc1 = &mmc2;    /* Fixed to mmcblk1 for &mmc2 */
>>> +};
>>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>>> index 3bdbe50..6a40de5 100644
>>> --- a/drivers/mmc/card/block.c
>>> +++ b/drivers/mmc/card/block.c
>>> @@ -35,6 +35,7 @@
>>>   #include <linux/capability.h>
>>>   #include <linux/compat.h>
>>>   #include <linux/pm_runtime.h>
>>> +#include <linux/of.h>
>>>
>>>   #include <linux/mmc/ioctl.h>
>>>   #include <linux/mmc/card.h>
>>> @@ -2190,6 +2191,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
>>>   {
>>>       struct mmc_blk_data *md;
>>>       int devidx, ret;
>>> +    int idx = 0;
>>>
>>>       devidx = find_first_zero_bit(dev_use, max_devices);
>>>       if (devidx >= max_devices)
>>> @@ -2209,7 +2211,20 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
>>>        * index anymore so we keep track of a name index.
>>>        */
>>>       if (!subname) {
>>> -        md->name_idx = find_first_zero_bit(name_use, max_devices);
>>> +        if (card->dev.parent->parent->of_node)
>>> +            idx = of_alias_get_id(card->dev.parent->parent->of_node,
>>> +                    "mmc");
>>> +
>>> +        if (idx < 0)
>>> +            md->name_idx = find_first_zero_bit(name_use,
>>> +                    max_devices);
>>> +        else {
>>> +            if (test_bit(idx, name_use))
>>> +                md->name_idx = find_first_zero_bit(name_use,
>>> +                        max_devices);
>>> +            else
>>> +                md->name_idx = (unsigned int)idx;
>>> +        }
>>>           __set_bit(md->name_idx, name_use);
>>>       } else
>>>           md->name_idx = ((struct mmc_blk_data *)
>>
>>
>>
>>
> 
> 


  reply	other threads:[~2016-04-04  2:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29 10:43 [RFC PATCH] mmc: block: Support the fixed index for mmcblk with aliases nodes Jaehoon Chung
2016-03-29 10:49 ` Jisheng Zhang
2016-03-30  0:15   ` Shawn Lin
2016-04-04  2:08     ` Jaehoon Chung [this message]
2016-04-04 12:14       ` Ulf Hansson
2016-04-06  2:00         ` Jaehoon Chung
2016-04-28 23:07           ` Doug Anderson
     [not found] <CGME20170210113539epcas1p4ef88bafa36c5da229dc81a02c3924fa2@epcas1p4.samsung.com>
2017-02-10 11:35 ` Tomas Melin
2017-02-13  0:34   ` Jaehoon Chung
2017-02-15 12:50     ` Tomas Melin

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=5701CCAF.4090102@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=adrian.hunter@intel.com \
    --cc=jszhang@marvell.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=ulf.hansson@linaro.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.