Skip to contentSkip to conversation

mmc: mxs-mmc: add cd-inverted and non-removeable

PATCH New Marc Kleine-Budde 3 participants 7 messages Mar 25, 2013 – Apr 4, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover mmc: mxs-mmc: add cd-inverted and non-removeable

Hello,

this patch add support for the cd-inverted and non-removeable 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.

regards,
Marc Kleine-Budde

#1 lore raw

PATCH 1/2 mmc: mxs-mmc: add cd-inverted property

The card-detect GPIO is inverted on some boards. Handle such case.

---
 drivers/mmc/host/mxs-mmc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mmc/host/mxs-mmc.c +4 -1
index 4efe302..0cdf1f6 100644
@@ -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;
Signature · 1 line
1.8.2.rc2
#2 lore raw

PATCH 2/2 mmc: mxs-mmc: add non-removeable property

In reply to Marc Kleine-Budde

Some boards have non removeable cards like eMMC. Handle such case.

---
 drivers/mmc/host/mxs-mmc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/mmc/host/mxs-mmc.c +7 -3
index 0cdf1f6..b85f383 100644
@@ -73,6 +73,7 @@ struct mxs_mmc_host {
 	int				wp_gpio;
 	bool				wp_inverted;
 	bool				cd_inverted;
+	bool				non_removeable;
 };
 
 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_removeable ||
+		!(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_removeable = of_property_read_bool(np, "non-removable");
+	if (host->non_removeable)
+		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;
 
Signature · 1 line
1.8.2.rc2
#3 lore raw

PATCH 2/2 mmc: mxs-mmc: add non-removeable property

Hi,

drivers/mmc/host/mxs-mmc.c static int mxs_mmc_probe(struct platform_device *pdev) · line 694

Quoted 3 lines · Marc Kleine-Budde
drivers/mmc/host/mxs-mmc.c +3 -0
+	host->non_removeable = of_property_read_bool(np, "non-removable");
+	if (host->non_removeable)
+		mmc->caps |= MMC_CAP_NONREMOVABLE;

The correct spelling is "non_removable", as used in the DT property.

Thanks,

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#4 lore raw

PATCH 2/2 mmc: mxs-mmc: add non-removeable property

Quoted 10 lines · Chris Ball

Hi,

drivers/mmc/host/mxs-mmc.c static int mxs_mmc_probe(struct platform_device *pdev) · line 694

Quoted 3 lines · Marc Kleine-Budde
drivers/mmc/host/mxs-mmc.c +3 -0
+	host->non_removeable = of_property_read_bool(np, "non-removable");
+	if (host->non_removeable)
+		mmc->caps |= MMC_CAP_NONREMOVABLE;

The correct spelling is "non_removable", as used in the DT property.

Thanks,

Will fix.

Marc

Signature · 12 lines
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   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130404/0d412978/attachment.sig>
#5 lore raw

cover mmc: mxs-mmc: add cd-inverted and non-removeable

In reply to Marc Kleine-Budde
Quoted 7 lines · Marc Kleine-Budde

Hello,

this patch add support for the cd-inverted and non-removeable 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.

For both,

#6 lore raw

cover mmc: mxs-mmc: add cd-inverted and non-removeable

In reply to Marc Kleine-Budde
Quoted 7 lines · Marc Kleine-Budde

Hello,

this patch add support for the cd-inverted and non-removeable 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.

ping

Signature · 12 lines
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   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130403/5c9ccc69/attachment.sig>