From: Dirk Behme <dirk.behme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Fabio Estevam <festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Sascha Hauer <kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
Michael Olbrich
<m.olbrich-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Subject: Re: Adding aliases to mmc
Date: Sun, 22 Sep 2013 08:48:43 +0200 [thread overview]
Message-ID: <523E92CB.1080302@gmail.com> (raw)
In-Reply-To: <CAOMZO5AT3bduZ0=EtWHuHVg6tSWrdr_ZjX5PLu815o0qgkeSig-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Hi Fabio,
Am 18.09.2013 02:06, schrieb Fabio Estevam:
> Hi Dirk,
>
> On Tue, Sep 17, 2013 at 3:04 PM, Fabio Estevam <festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> Hi Dirk,
>>
>> I have adapted your patch at:
>> http://lists.infradead.org/pipermail/linux-arm-kernel/2012-July/111022.html
>>
>> and tested it on 3.12-rc1 on a mx6qsabresd board.
>>
>> Do you have plans to submit it? Maybe as a RFC?
>>
>> It solves the mmcblkX order issue on my tests and it would be nice we
>> could have this problem addressed.
>
> I simplied your patch a bit:
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index 1a3163f..94f842b 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -2026,7 +2026,7 @@ static struct mmc_blk_data
> *mmc_blk_alloc_req(struct mmc_card *card,
> struct mmc_blk_data *md;
> int devidx, ret;
>
> - devidx = find_first_zero_bit(dev_use, max_devices);
> + devidx = find_next_zero_bit(dev_use, max_devices, card->host->devidx);
> if (devidx >= max_devices)
> return ERR_PTR(-ENOSPC);
> __set_bit(devidx, dev_use);
> @@ -2044,7 +2044,8 @@ 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);
> + md->name_idx = find_next_zero_bit(name_use, max_devices,
> + card->host->devidx);
> __set_bit(md->name_idx, name_use);
> } else
> md->name_idx = ((struct mmc_blk_data *)
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
> b/drivers/mmc/host/sdhci-esdhc-imx.c
> index abc8cf0..e11a6af 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -524,8 +524,9 @@ static int sdhci_esdhc_imx_probe(struct
> platform_device *pdev)
> struct sdhci_pltfm_host *pltfm_host;
> struct sdhci_host *host;
> struct esdhc_platform_data *boarddata;
> - int err;
> + int err, ret;
> struct pltfm_imx_data *imx_data;
> + struct device_node *np = pdev->dev.of_node;
>
> host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata, 0);
> if (IS_ERR(host))
> @@ -602,6 +603,13 @@ static int sdhci_esdhc_imx_probe(struct
> platform_device *pdev)
> host->mmc->parent->platform_data);
> }
>
> +
> + if (np) {
> + ret = of_alias_get_id(np, "mmcblk");
> + if (ret >= 0)
> + host->mmc->devidx = ret;
> + }
> +
> /* write_protect */
> if (boarddata->wp_type == ESDHC_WP_GPIO) {
> err = mmc_gpio_request_ro(host->mmc, boarddata->wp_gpio);
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 3b0c33a..8209f72 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -362,6 +362,8 @@ struct mmc_host {
>
> unsigned int slotno; /* used for sdio acpi binding */
>
> + /* preferred mmc block device index (mmcblkX) */
> + unsigned int devidx;
> unsigned long private[0] ____cacheline_aligned;
> };
>
> What do you think?
Do you like to send this as a proper patch? Following the recent
discussion it sounds to me that there is really some need for
something like this. Then we could discuss the technical details.
Best regards
Dirk
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-09-22 6:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-17 18:04 Adding aliases to mmc Fabio Estevam
[not found] ` <CAOMZO5CJ36JHJMaiG3QVdtpBoWd_ZyHQuRTrKHz4bLP39gpJtQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-18 0:06 ` Fabio Estevam
[not found] ` <CAOMZO5AT3bduZ0=EtWHuHVg6tSWrdr_ZjX5PLu815o0qgkeSig-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-22 6:48 ` Dirk Behme [this message]
2013-09-22 15:24 ` Fabio Estevam
[not found] ` <CAOMZO5CVTRvC1z_xzco1A9FE+GALEHAZe8WNU20sNy+oZdNe+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-23 2:17 ` Fabio Estevam
2013-09-18 5:47 ` Dirk Behme
2013-09-18 15:17 ` Stephen Warren
[not found] ` <5239C40C.9030503-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-09-18 17:01 ` Dirk Behme
[not found] ` <5239DC65.3080803-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-18 17:13 ` Stephen Warren
[not found] ` <5239DF55.8010308-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-09-19 5:22 ` Dirk Behme
2013-09-20 16:05 ` Stephen Warren
2013-09-20 16:37 ` Dirk Behme
[not found] ` <523C79C4.1070308-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-20 17:03 ` Stephen Warren
2013-09-21 5:23 ` Dirk Behme
2013-09-21 7:42 ` Sascha Hauer
[not found] ` <20130921074238.GI30088-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-09-21 12:30 ` Michael Olbrich
2013-09-21 13:52 ` Sascha Hauer
2013-09-20 6:30 ` Chaiken, Alison
[not found] ` <60BA5429A0E1584BA3633194F6F993B50E7CE937-0dz9ie/QGrnnlEkxMdpx1dQH9K4/4qFeAL8bYrjMMd8@public.gmane.org>
2013-09-20 16:10 ` Stephen Warren
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=523E92CB.1080302@gmail.com \
--to=dirk.behme-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=m.olbrich-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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;
as well as URLs for NNTP newsgroup(s).