mmc: mxs-mmc: Add wp-inverted property
Subsystems (3)
PATCH 1/1 mmc: mxs-mmc: Add wp-inverted property
The write-protect GPIO is inverted on some boards. Handle such case.
--- Documentation/devicetree/bindings/mmc/mxs-mmc.txt | 1 + drivers/mmc/host/mxs-mmc.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-)
V2: Adjust the subject, Cc linux-mmc
Documentation/devicetree/bindings/mmc/mxs-mmc.txt +1 -0
@@ -13,6 +13,7 @@ Required properties: Optional properties: - wp-gpios: Specify GPIOs for write protection +- wp-inverted: Set if the write protection GPIO is inverted Examples:
drivers/mmc/host/mxs-mmc.c +10 -1
@@ -164,16 +164,23 @@ struct mxs_mmc_host {spinlock_t lock;int sdio_irq_en;int wp_gpio; + int wp_inverted:1; };static int mxs_mmc_get_ro (struct mmc_host *mmc) {struct mxs_mmc_host *host =mmc_priv (mmc); +int ret;if (!gpio_is_valid (host->wp_gpio))return -EINVAL ; -return gpio_get_value (host->wp_gpio); + ret =gpio_get_value (host->wp_gpio); + +if (host->wp_inverted) + ret = !ret; + +return ret; }static int mxs_mmc_get_cd (struct mmc_host *mmc)
@@ -786,6 +793,8 @@ static int mxs_mmc_probe(struct platform_device *pdev)else if (bus_width ==8 ) mmc->caps |=MMC_CAP_4_BIT_DATA |MMC_CAP_8_BIT_DATA ; host->wp_gpio =of_get_named_gpio (np,"wp-gpios" ,0 ); +if (of_find_property (np,"wp-inverted" ,NULL )) + host->wp_inverted =1 ; }else {if (pdata->flags &SLOTF_8_BIT_CAPABLE ) mmc->caps |=MMC_CAP_4_BIT_DATA |MMC_CAP_8_BIT_DATA ;
Signature · 1 line
1.7.10
PATCH 1/1 mmc: mxs-mmc: Add wp-inverted property
Hi Marek,
Quoted 7 lines · Marek Vasut
The write-protect GPIO is inverted on some boards. Handle such case.
Signed-off-by Marek Vasut <[email protected]>Cc Shawn Guo <[email protected]>Cc Fabio Estevam <[email protected]>Cc linux-mmc at vger.kernel.orgCc Chris Ball <[email protected]>
Quoted 6 lines
--- Documentation/devicetree/bindings/mmc/mxs-mmc.txt | 1 + drivers/mmc/host/mxs-mmc.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-)V2: Adjust the subject, Cc linux-mmc
Thanks, looks good. Since this depends on patches that are going via arm-soc, I'm going to wait until that's in Linus master before merging.
- Chris.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
PATCH 1/1 mmc: mxs-mmc: Add wp-inverted property
Dear Chris Ball,
Quoted 12 lines
Hi Marek,
Quoted 9 lines · Marek Vasut
The write-protect GPIO is inverted on some boards. Handle such case.
Signed-off-by Marek Vasut <[email protected]>Cc Shawn Guo <[email protected]>Cc Fabio Estevam <[email protected]>Cc linux-mmc at vger.kernel.orgCc Chris Ball <[email protected]>---
Quoted 8 lines
Quoted 5 lines
Documentation/devicetree/bindings/mmc/mxs-mmc.txt | 1 + drivers/mmc/host/mxs-mmc.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-)V2: Adjust the subject, Cc linux-mmc
Thanks, looks good. Since this depends on patches that are going via arm-soc, I'm going to wait until that's in Linus master before merging.
Roger that, thanks!
Quoted 2 lines
- Chris.
Best regards,
Marek Vasut