Skip to contentSkip to conversation

powerpc/esdhc: disable CMD23 for some Freescale SoCs

PATCH In review [email protected] 3 participants 6 messages Oct 25, 2012 – Oct 26, 2012

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

PATCH v6 1/1 powerpc/esdhc: disable CMD23 for some Freescale SoCs

From: Jerry Huang <[email protected]>

CMD23 causes lots of errors in kernel on some freescale SoCs (P1020, P1021, P1022, P1024, P1025 and P4080) when MMC card used, which is because these controllers does not support CMD23, even on the SoCs which declares CMD23 is supported. Therefore, we'll not use CMD23.

---
changes for v6:
-add the callback to this check
changes for v5:
- change the error to warning information
changes for v4:
- change to detect the IP version
- don't use callback function
changes for v3:
- move the limitation detect function to eSDHC file
- add the callback funtion to do this limitation detect
changes for v2:
- discard the property mode and add the processor detection

 drivers/mmc/host/sdhci-of-esdhc.c |   11 +++++++++++
 drivers/mmc/host/sdhci-pltfm.c    |    4 ++++
 drivers/mmc/host/sdhci.c          |    3 +++
 drivers/mmc/host/sdhci.h          |    1 +
 include/linux/mmc/sdhci.h         |    1 +
 5 files changed, 20 insertions(+)
drivers/mmc/host/sdhci-of-esdhc.c +11 -0
index ae5fcbf..c03f899 100644
@@ -169,6 +169,16 @@ static void esdhc_of_resume(struct sdhci_host *host)
 }
 #endif
 
+static void esdhc_of_platform_caps(struct sdhci_host *host)
+{
+	u32 vvn;
+
+	vvn = in_be32(host->ioaddr + SDHCI_SLOT_INT_STATUS);
+	vvn = (vvn & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT;
+	if (vvn == VENDOR_V_22)
+		host->quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23;
+}
+
 static struct sdhci_ops sdhci_esdhc_ops = {
 	.read_l = esdhc_readl,
 	.read_w = esdhc_readw,
@@ -184,6 +194,7 @@ static struct sdhci_ops sdhci_esdhc_ops = {
 	.platform_suspend = esdhc_of_suspend,
 	.platform_resume = esdhc_of_resume,
 #endif
+	.platform_caps = esdhc_of_platform_caps,
 };
 
 static struct sdhci_pltfm_data sdhci_esdhc_pdata = {
drivers/mmc/host/sdhci-pltfm.c +4 -0
index 65551a9..848cf62 100644
@@ -150,6 +150,10 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
 		goto err_remap;
 	}
 
+	/* Check the platform capability */
+	if (host->ops && host->ops->platform_caps)
+		host->ops->platform_caps(host);
+
 	platform_set_drvdata(pdev, host);
 
 	return host;
drivers/mmc/host/sdhci.c +3 -0
index 0e15c79..b0b7cad 100644
@@ -2837,6 +2837,9 @@ int sdhci_add_host(struct sdhci_host *host)
 	if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
 		mmc->caps |= MMC_CAP_4_BIT_DATA;
 
+	if (host->quirks2 & SDHCI_QUIRK2_HOST_NO_CMD23)
+		mmc->caps &= ~MMC_CAP_CMD23;
+
 	if (caps[0] & SDHCI_CAN_DO_HISPD)
 		mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
 
drivers/mmc/host/sdhci.h +1 -0
index 97653ea..98f6d4d 100644
@@ -278,6 +278,7 @@ struct sdhci_ops {
 	void	(*hw_reset)(struct sdhci_host *host);
 	void	(*platform_suspend)(struct sdhci_host *host);
 	void	(*platform_resume)(struct sdhci_host *host);
+	void	(*platform_caps)(struct sdhci_host *host);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
include/linux/mmc/sdhci.h +1 -0
index fa8529a..1edcb4d 100644
@@ -91,6 +91,7 @@ struct sdhci_host {
 	unsigned int quirks2;	/* More deviations from spec. */
 
 #define SDHCI_QUIRK2_HOST_OFF_CARD_ON			(1<<0)
+#define SDHCI_QUIRK2_HOST_NO_CMD23			(1<<1)
 
 	int irq;		/* Device IRQ */
 	void __iomem *ioaddr;	/* Mapped address */
Signature · 1 line
1.7.9.5
Acked-by on v6 1/1
#1 lore raw
Quoted 8 lines · On Thu, Oct 25, 2012 at 01:47:19PM +0800, [email protected] wrote:

From: Jerry Huang <[email protected]>

CMD23 causes lots of errors in kernel on some freescale SoCs (P1020, P1021, P1022, P1024, P1025 and P4080) when MMC card used, which is because these controllers does not support CMD23, even on the SoCs which declares CMD23 is supported. Therefore, we'll not use CMD23.

Quoted 4 lines

---

Looks perfect, thanks a lot!

#2 lore raw

Thank you very much, Anton.

Best Regards
Jerry Huang

Quoted 26 lines

-----Original Message-----
From: Anton Vorontsov [mailto:[email protected]]
Sent: Thursday, October 25, 2012 4:01 PM
To: Huang Changming-R66093
Cc: [email protected]; Huang Changming-R66093; Xie Shaohui-B21989; Chris Ball
Subject: Re: [PATCH v6] powerpc/esdhc: disable CMD23 for some Freescale SoCs

Quoted 8 lines · On Thu, Oct 25, 2012 at 01:47:19PM +0800, [email protected] wrote:

From: Jerry Huang <[email protected]>

CMD23 causes lots of errors in kernel on some freescale SoCs (P1020, P1021, P1022, P1024, P1025 and P4080) when MMC card used, which is because these controllers does not support CMD23, even on the SoCs which declares CMD23 is supported.
Therefore, we'll not use CMD23.

Quoted 4 lines

---

Looks perfect, thanks a lot!

#3 lore raw
In reply to Anton Vorontsov

Hi,

Quoted 9 lines · Anton Vorontsov
Quoted 8 lines · On Thu, Oct 25, 2012 at 01:47:19PM +0800, [email protected] wrote:

From: Jerry Huang <[email protected]>

CMD23 causes lots of errors in kernel on some freescale SoCs (P1020, P1021, P1022, P1024, P1025 and P4080) when MMC card used, which is because these controllers does not support CMD23, even on the SoCs which declares CMD23 is supported. Therefore, we'll not use CMD23.

Quoted 8 lines
Quoted 4 lines

---

Looks perfect, thanks a lot!

Thanks, pushed to mmc-next for 3.7.

- Chris.

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

Hi,

Quoted 17 lines · Chris Ball

Hi,

Quoted 14 lines · Anton Vorontsov
Quoted 12 lines · On Thu, Oct 25, 2012 at 01:47:19PM +0800, [email protected] wrote:

From: Jerry Huang <[email protected]>

CMD23 causes lots of errors in kernel on some freescale SoCs (P1020, P1021, P1022, P1024, P1025 and P4080) when MMC card used, which is because these controllers does not support CMD23, even on the SoCs which declares CMD23 is supported. Therefore, we'll not use CMD23.

---

Quoted 7 lines
Quoted 3 lines

Looks perfect, thanks a lot!

Thanks, pushed to mmc-next for 3.7.

- Chris.

In the version I merged, I've changed the callback name from platform_caps() to platform_init() (as Anton had suggested) so that it has a chance of being useful to other platforms too.

Thanks,

- Chris.

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

No problem, thanks a lot, Chris.

Best Regards
Jerry Huang

Quoted 47 lines

-----Original Message-----
From: Chris Ball [mailto:[email protected]]
Sent: Thursday, October 25, 2012 8:53 PM
To: Anton Vorontsov
Cc: Huang Changming-R66093; [email protected]; Huang Changming- R66093; Xie Shaohui-B21989
Subject: Re: [PATCH v6] powerpc/esdhc: disable CMD23 for some Freescale SoCs

Hi,

Quoted 17 lines · Chris Ball

Hi,

Quoted 14 lines · Anton Vorontsov
Quoted 12 lines · On Thu, Oct 25, 2012 at 01:47:19PM +0800, [email protected] wrote:

From: Jerry Huang <[email protected]>

CMD23 causes lots of errors in kernel on some freescale SoCs (P1020, P1021, P1022, P1024, P1025 and P4080) when MMC card used, which is because these controllers does not support CMD23, even on the SoCs which declares CMD23 is supported.
Therefore, we'll not use CMD23.

---

Quoted 7 lines
Quoted 3 lines

Looks perfect, thanks a lot!

Thanks, pushed to mmc-next for 3.7.

- Chris.

In the version I merged, I've changed the callback name from platform_caps() to platform_init() (as Anton had suggested) so that it has a chance of being useful to other platforms too.

Thanks,

- Chris.
--
Chris Ball <[email protected]> <http://printf.net/>
One Laptop Per Child