* [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted, non-removable and broken-cd
@ 2013-04-10 9:13 Marc Kleine-Budde
2013-04-10 9:13 ` [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted property Marc Kleine-Budde
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-04-10 9:13 UTC (permalink / raw)
To: linux-mmc; +Cc: kernel, cjb
Hello,
this patch add support for the cd-inverted, non-removeable and broken-cd
property (as defined in devicetree/bindings/mmc/mmc.txt) to the mxs-mmc driver.
Tested on a custom imx28 board.
This series applies to Chris Ball's cjb/mmc-next branch.
Changes since v2:
- add Hector Palacios's patch "[PATCH 3/3] mmc: mxs-mmc: add broken-cd property"
Changes since v1:
- add Shawn's Acked-by
- fixed typo in [PATCH 2/2] mmc: mxs-mmc: add non-removeable property
(tnx Chris)
regards,
Marc Kleine-Budde
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted property
2013-04-10 9:13 [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted, non-removable and broken-cd Marc Kleine-Budde
@ 2013-04-10 9:13 ` Marc Kleine-Budde
2013-04-10 9:13 ` [PATCH v3 2/3] mmc: mxs-mmc: add non-removable property Marc Kleine-Budde
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-04-10 9:13 UTC (permalink / raw)
To: linux-mmc; +Cc: kernel, cjb, Marc Kleine-Budde
The card-detect GPIO is inverted on some boards. Handle such case.
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/mmc/host/mxs-mmc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 4efe302..0cdf1f6 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -72,6 +72,7 @@ struct mxs_mmc_host {
int sdio_irq_en;
int wp_gpio;
bool wp_inverted;
+ bool cd_inverted;
};
static int mxs_mmc_get_ro(struct mmc_host *mmc)
@@ -96,7 +97,7 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc)
struct mxs_ssp *ssp = &host->ssp;
return !(readl(ssp->base + HW_SSP_STATUS(ssp)) &
- BM_SSP_STATUS_CARD_DETECT);
+ BM_SSP_STATUS_CARD_DETECT)) ^ host->cd_inverted;
}
static void mxs_mmc_reset(struct mxs_mmc_host *host)
@@ -691,6 +692,8 @@ static int mxs_mmc_probe(struct platform_device *pdev)
if (flags & OF_GPIO_ACTIVE_LOW)
host->wp_inverted = 1;
+ host->cd_inverted = of_property_read_bool(np, "cd-inverted");
+
mmc->f_min = 400000;
mmc->f_max = 288000000;
mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
--
1.8.2.rc2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 2/3] mmc: mxs-mmc: add non-removable property
2013-04-10 9:13 [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted, non-removable and broken-cd Marc Kleine-Budde
2013-04-10 9:13 ` [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted property Marc Kleine-Budde
@ 2013-04-10 9:13 ` Marc Kleine-Budde
2013-04-10 9:13 ` [PATCH v3 3/3] mmc: mxs-mmc: add broken-cd property Marc Kleine-Budde
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-04-10 9:13 UTC (permalink / raw)
To: linux-mmc; +Cc: kernel, cjb, Marc Kleine-Budde
Some boards have non removable cards like eMMC. Handle such case.
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/mmc/host/mxs-mmc.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 0cdf1f6..c231881 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -73,6 +73,7 @@ struct mxs_mmc_host {
int wp_gpio;
bool wp_inverted;
bool cd_inverted;
+ bool non_removable;
};
static int mxs_mmc_get_ro(struct mmc_host *mmc)
@@ -96,8 +97,9 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc)
struct mxs_mmc_host *host = mmc_priv(mmc);
struct mxs_ssp *ssp = &host->ssp;
- return !(readl(ssp->base + HW_SSP_STATUS(ssp)) &
- BM_SSP_STATUS_CARD_DETECT)) ^ host->cd_inverted;
+ return host->non_removable ||
+ !(readl(ssp->base + HW_SSP_STATUS(ssp)) &
+ BM_SSP_STATUS_CARD_DETECT) ^ host->cd_inverted;
}
static void mxs_mmc_reset(struct mxs_mmc_host *host)
@@ -687,8 +689,10 @@ 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");
+ if (host->non_removable)
+ mmc->caps |= MMC_CAP_NONREMOVABLE;
host->wp_gpio = of_get_named_gpio_flags(np, "wp-gpios", 0, &flags);
-
if (flags & OF_GPIO_ACTIVE_LOW)
host->wp_inverted = 1;
--
1.8.2.rc2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 3/3] mmc: mxs-mmc: add broken-cd property
2013-04-10 9:13 [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted, non-removable and broken-cd Marc Kleine-Budde
2013-04-10 9:13 ` [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted property Marc Kleine-Budde
2013-04-10 9:13 ` [PATCH v3 2/3] mmc: mxs-mmc: add non-removable property Marc Kleine-Budde
@ 2013-04-10 9:13 ` Marc Kleine-Budde
2013-04-12 14:12 ` [PATCH v3 0/3] mmc: mxs-mmc: add cd-inverted, non-removable and broken-cd Marc Kleine-Budde
2013-04-12 18:18 ` [PATCH v3 1/3] " Chris Ball
4 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-04-10 9:13 UTC (permalink / raw)
To: linux-mmc; +Cc: kernel, cjb, Hector Palacios, Marc Kleine-Budde
From: Hector Palacios <hector.palacios@digi.com>
According to bindings documentation for mmc, the property 'broken-cd'
can be used to indicate card-detection is not available and polling
must be used instead. This patch retrieves this property
and sets a custom flag. On the get_cd() hook, it returns 1 if
the flag is set, to always assume the card is present.
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/mmc/host/mxs-mmc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index c231881..146a53b 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -73,6 +73,7 @@ struct mxs_mmc_host {
int wp_gpio;
bool wp_inverted;
bool cd_inverted;
+ bool broken_cd;
bool non_removable;
};
@@ -97,7 +98,7 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc)
struct mxs_mmc_host *host = mmc_priv(mmc);
struct mxs_ssp *ssp = &host->ssp;
- return host->non_removable ||
+ return host->non_removable || host->broken_cd ||
!(readl(ssp->base + HW_SSP_STATUS(ssp)) &
BM_SSP_STATUS_CARD_DETECT) ^ host->cd_inverted;
}
@@ -689,6 +690,7 @@ 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->broken_cd = of_property_read_bool(np, "broken-cd");
host->non_removable = of_property_read_bool(np, "non-removable");
if (host->non_removable)
mmc->caps |= MMC_CAP_NONREMOVABLE;
--
1.8.2.rc2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 0/3] mmc: mxs-mmc: add cd-inverted, non-removable and broken-cd
2013-04-10 9:13 [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted, non-removable and broken-cd Marc Kleine-Budde
` (2 preceding siblings ...)
2013-04-10 9:13 ` [PATCH v3 3/3] mmc: mxs-mmc: add broken-cd property Marc Kleine-Budde
@ 2013-04-12 14:12 ` Marc Kleine-Budde
2013-04-12 18:18 ` [PATCH v3 1/3] " Chris Ball
4 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-04-12 14:12 UTC (permalink / raw)
To: linux-mmc; +Cc: kernel, cjb
[-- Attachment #1: Type: text/plain, Size: 857 bytes --]
On 04/10/2013 11:13 AM, Marc Kleine-Budde wrote:
> Hello,
>
> this patch add support for the cd-inverted, non-removeable and broken-cd
> property (as defined in devicetree/bindings/mmc/mmc.txt) to the mxs-mmc driver.
> Tested on a custom imx28 board.
>
> This series applies to Chris Ball's cjb/mmc-next branch.
>
> Changes since v2:
> - add Hector Palacios's patch "[PATCH 3/3] mmc: mxs-mmc: add broken-cd property"
>
> Changes since v1:
> - add Shawn's Acked-by
> - fixed typo in [PATCH 2/2] mmc: mxs-mmc: add non-removeable property
> (tnx Chris)
ping
--
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 |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted, non-removable and broken-cd
2013-04-10 9:13 [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted, non-removable and broken-cd Marc Kleine-Budde
` (3 preceding siblings ...)
2013-04-12 14:12 ` [PATCH v3 0/3] mmc: mxs-mmc: add cd-inverted, non-removable and broken-cd Marc Kleine-Budde
@ 2013-04-12 18:18 ` Chris Ball
4 siblings, 0 replies; 6+ messages in thread
From: Chris Ball @ 2013-04-12 18:18 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: linux-mmc, kernel
Hi,
On Wed, Apr 10 2013, Marc Kleine-Budde wrote:
> Hello,
>
> this patch add support for the cd-inverted, non-removeable and broken-cd
> property (as defined in devicetree/bindings/mmc/mmc.txt) to the mxs-mmc driver.
> Tested on a custom imx28 board.
>
> This series applies to Chris Ball's cjb/mmc-next branch.
>
> Changes since v2:
> - add Hector Palacios's patch "[PATCH 3/3] mmc: mxs-mmc: add broken-cd property"
Thanks, pushed to mmc-next for 3.10.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-04-12 18:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-10 9:13 [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted, non-removable and broken-cd Marc Kleine-Budde
2013-04-10 9:13 ` [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted property Marc Kleine-Budde
2013-04-10 9:13 ` [PATCH v3 2/3] mmc: mxs-mmc: add non-removable property Marc Kleine-Budde
2013-04-10 9:13 ` [PATCH v3 3/3] mmc: mxs-mmc: add broken-cd property Marc Kleine-Budde
2013-04-12 14:12 ` [PATCH v3 0/3] mmc: mxs-mmc: add cd-inverted, non-removable and broken-cd Marc Kleine-Budde
2013-04-12 18:18 ` [PATCH v3 1/3] " Chris Ball
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox