From: lauri.hintsala@bluegiga.com (Lauri Hintsala)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mmc: mxs-mmc: implement broken-cd
Date: Mon, 10 Sep 2012 13:04:00 +0300 [thread overview]
Message-ID: <504DBB10.9030702@bluegiga.com> (raw)
In-Reply-To: <20120910060840.GT26709@S2101-09.ap.freescale.net>
Hi Shawn,
On 09/10/2012 09:08 AM, Shawn Guo wrote:
> On Fri, Sep 07, 2012 at 02:45:17PM +0300, Lauri Hintsala wrote:
>> This feature allows to use SDIO bus without wiring card detect
>> signal.
>
> This looks like a case of "broken-cd" ...
>
>> This is relevant in cases where SDIO device is connected to
>> SDIO bus and there is no way to disconnect device from bus (device
>> is always present).
>>
> ... while this sounds like a case of "non-removable".
Right, I'll remove this comment.
In our case the SDIO device is always physically connected to SDIO bus
but the power of the device can be controller. So in SW point of view
the device can be removed by switching the power off.
>> Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com>
>> ---
>> drivers/mmc/host/mxs-mmc.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
>> index ad3fcea..992760e 100644
>> --- a/drivers/mmc/host/mxs-mmc.c
>> +++ b/drivers/mmc/host/mxs-mmc.c
>> @@ -165,6 +165,7 @@ struct mxs_mmc_host {
>> int sdio_irq_en;
>> int wp_gpio;
>> bool wp_inverted;
>> + bool broken_cd;
>> };
>>
>> static int mxs_mmc_get_ro(struct mmc_host *mmc)
>> @@ -187,6 +188,9 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc)
>> {
>> struct mxs_mmc_host *host = mmc_priv(mmc);
>>
>> + if (host->broken_cd)
>> + return -ENOSYS;
>> +
>
> The .get_cd caller does not check for error. This change makes no
> sense to me.
In our case we don't want to read card detect bit and we have to
continue MMC probing because card detect pin is routed nowhere.
Could it be better to return zero instead of error? ENOSYS is used to
indicate "unreachable card detect" in other drivers (e.g. atmel-mci,
omap_hsmmc) and I followed them.
> Instead, the driver needs to set MMC_CAP_NEEDS_POLL in
> case of "broken-cd".
MMC_CAP_NEEDS_POLL is always set in mxs-mmc.
Best regards,
Lauri
>
> Regards,
> Shawn
>
>> return !(readl(host->base + HW_SSP_STATUS(host)) &
>> BM_SSP_STATUS_CARD_DETECT);
>> }
>> @@ -808,6 +812,9 @@ static int mxs_mmc_probe(struct platform_device *pdev)
>> &flags);
>> if (flags & OF_GPIO_ACTIVE_LOW)
>> host->wp_inverted = 1;
>> +
>> + if (of_get_property(np, "broken-cd", NULL))
>> + host->broken_cd = 1;
>> } else {
>> if (pdata->flags & SLOTF_8_BIT_CAPABLE)
>> mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
>> --
>> 1.7.9.5
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2012-09-10 10:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 11:45 [PATCH] mmc: mxs-mmc: implement broken-cd Lauri Hintsala
2012-09-10 6:08 ` Shawn Guo
2012-09-10 10:04 ` Lauri Hintsala [this message]
2012-09-10 13:50 ` Shawn Guo
2012-09-20 4:45 ` Lauri Hintsala
2012-09-10 14:58 ` Matt Sealey
2012-09-12 14:06 ` Lauri Hintsala
2012-09-17 13:43 ` Lauri Hintsala
2012-09-17 14:01 ` Chris Ball
2012-09-17 14:40 ` Lauri Hintsala
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=504DBB10.9030702@bluegiga.com \
--to=lauri.hintsala@bluegiga.com \
--cc=linux-arm-kernel@lists.infradead.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