Subject: [PATCH] mmc: mxs-mmc: Add broken-cd devicetree property

In case of broken card detect support, assume the card is non-removable

Signed-off-by: Alexandre Pereira da Silva <[email protected]>
---

This patch depends on Marc Kleine-Budde series adding support for non-removable.

drivers/mmc/host/mxs-mmc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index c231881..8418928 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -689,7 +689,8 @@ static int mxs_mmc_probe(struct platform_device *pdev)
mmc->caps |= MMC_CAP_4_BIT_DATA;
else if (bus_width == 8)
mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
- host->non_removable = of_property_read_bool(np, "non-removable");
+ host->non_removable = of_property_read_bool(np, "non-removable") |
+ of_property_read_bool(np, "broken-cd");
if (host->non_removable)
mmc->caps |= MMC_CAP_NONREMOVABLE;
host->wp_gpio = of_get_named_gpio_flags(np, "wp-gpios", 0, &flags);
--
1.7.10


2013-04-06 13:58:51

by Marc Kleine-Budde

[permalink] [raw]
Subject: Re: [PATCH] mmc: mxs-mmc: Add broken-cd devicetree property

On 04/06/2013 03:43 PM, Alexandre Pereira da Silva wrote:
> In case of broken card detect support, assume the card is non-removable

According to the documentation broken card detect is something different
than non-removable:

> - broken-cd: There is no card detection available; polling must be used.
> - non-removable: non-removable slot (like eMMC); assume always present.

But mxs-mmc set MMC_CAP_NEEDS_POLL unconditionally.

http://lxr.free-electrons.com/source/drivers/mmc/host/mxs-mmc.c#L682

Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |


Attachments:
signature.asc (263.00 B)
OpenPGP digital signature
Subject: Re: [PATCH] mmc: mxs-mmc: Add broken-cd devicetree property

On Sat, Apr 6, 2013 at 10:58 AM, Marc Kleine-Budde <[email protected]> wrote:
> According to the documentation broken card detect is something different
> than non-removable:
>
> > - broken-cd: There is no card detection available; polling must be used.
> > - non-removable: non-removable slot (like eMMC); assume always present.
>
> But mxs-mmc set MMC_CAP_NEEDS_POLL unconditionally.

I will work on a better way to fix this.

2013-04-06 15:07:01

by Marek Vasut

[permalink] [raw]
Subject: Re: [PATCH] mmc: mxs-mmc: Add broken-cd devicetree property

Dear Alexandre Pereira da Silva,

> On Sat, Apr 6, 2013 at 10:58 AM, Marc Kleine-Budde <[email protected]> wrote:
> > According to the documentation broken card detect is something different
> >
> > than non-removable:
> > > - broken-cd: There is no card detection available; polling must be
> > > used. - non-removable: non-removable slot (like eMMC); assume always
> > > present.
> >
> > But mxs-mmc set MMC_CAP_NEEDS_POLL unconditionally.
>
> I will work on a better way to fix this.

NEEDS_POLL looks nice and seems to fit this case.

Best regards,
Marek Vasut