Skip to contentSkip to conversation

mmc: Enable the ADMA on esdhc imx driver

PATCH Superseded Pavel Machek 2 participants 5 messages Jun 16, 2011 – Jun 17, 2011 2 messages not in the archive MMC, SD and SDIO

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v2 1/1 mmc: Enable the ADMA on esdhc imx driver

Hi!

Quoted 9 lines

Eanble the ADMA2 mode on freescale esdhc imx driver, tested on MX51 and MX53.

Only ADMA2 mode is enabled, MX25/35 can't support the ADMA2 mode. So this patch is only used for MX51/53.
The ADMA2 mode supported or not can be distinguished by the Capability Register(offset 0x40) of eSDHC module.
Up to now, only MX51/MX53 set the ADMA2 supported bit(Bit20) in the Capability Register.

I tried it on mx25 (3-stack), and it unfortunately breaks things:

...
mmc0: unrecognised SCR structure version 12
mmc0: error -22 whilst initialising SD card
...

It may be interfering with my changs, but...

Quoted 22 lines
(quoted diff) +15 -0
+/*
+ * There is INT DMA ERR mis-match between eSDHC and STD SDHC SPEC
+ * Bit25 is used in STD SPEC, and is reserved in fsl eSDHC design,
+ * but bit28 is used as the INT DMA ERR in fsl eSDHC design.
+ * Define this macro DMA error INT for fsl eSDHC
+ */
+#define  SDHCI_INT_VENDOR_SPEC_DMA_ERR	0x10000000
+
 #define ESDHC_FLAG_GPIO_FOR_CD_WP	(1 << 0)
 /*
  * The CMDTYPE of the CMD register (offset 0xE) should be set to
@@ -80,6 +88,20 @@ static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
 			val |= SDHCI_CARD_PRESENT;
 	}
 
+	if (unlikely(reg == SDHCI_CAPABILITIES)) {
+		if (val & SDHCI_CAN_DO_ADMA1) {
+			val &= ~SDHCI_CAN_DO_ADMA1;
+			val |= SDHCI_CAN_DO_ADMA2;
+		}
+	}
+

Review static u32 esdhc_readl_le(struct sdhci_host *host, int reg) · line 107

Quoted 10 lines
(quoted diff) +7 -0
+	if (unlikely(reg == SDHCI_INT_STATUS)) {
+		if (val & SDHCI_INT_VENDOR_SPEC_DMA_ERR) {
+			val &= ~SDHCI_INT_VENDOR_SPEC_DMA_ERR;
+			val |= SDHCI_INT_ADMA_ERROR;
+		}
+	}
+
 	return val;
 }
 

Unfortunately register differences are common. Is there better approach than patching it in low level functions like this?

Review static void esdhc_pltfm_exit(struct sdhci_host *host) · line 357

Quoted 9 lines
(quoted diff) +3 -1
@@ -322,9 +351,10 @@ static void esdhc_pltfm_exit(struct sdhci_host *host)
 }
 
 struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {
-	.quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_BROKEN_ADMA
+	.quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_NO_HISPD_BIT
+			| SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC
+			| SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC
 			| SDHCI_QUIRK_BROKEN_CARD_DETECTION,

If I re-add "SDHCI_QUIRK_BROKEN_ADMA", it starts working.

Pavel

#2 lore raw

PATCH v2 1/1 mmc: Enable the ADMA on esdhc imx driver

Quoted 3 lines

Unfortunately register differences are common. Is there better approach than patching it in low level functions like this?

I am all ears for suggestions...

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110616/3fa3eea8/attachment.sig>
#3 lore raw

PATCH v2 1/1 mmc: Enable the ADMA on esdhc imx driver

Quoted 5 lines · Wolfram Sang
Quoted 3 lines

Unfortunately register differences are common. Is there better approach than patching it in low level functions like this?

I am all ears for suggestions...

One way would be to move functions such as

sdhci_activate_led()

to the low level driver, and introduce functions such as write_host_control() -- with no corresponding read_host_control, so that translation is easy to do...
Pavel

#4 lore raw

PATCH v2 1/1 mmc: Enable the ADMA on esdhc imx driver

Quoted 5 lines · Pavel Machek
Quoted 4 lines · Wolfram Sang
Quoted 3 lines

Unfortunately register differences are common. Is there better approach than patching it in low level functions like this?

Quoted 7 lines
Quoted 1 line

I am all ears for suggestions...

One way would be to move functions such as

sdhci_activate_led()

to the low level driver,

There is no "low level driver" if the controller is done right.

Quoted 2 lines

and introduce functions such as write_host_control() -- with no corresponding read_host_control, so that translation is easy to do...

So, a seperate function for every register which differs from the standard? There are a lot of SoCs out there, and even more to come...

Regards,

Wolfram

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110616/09c3d3da/attachment.sig>

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

PATCH v2 1/1 mmc: Enable the ADMA on esdhc imx driver

Hi Richard,

Quoted 2 lines

It's strange that the sd card can't work on MX25 board without ADMA_BROKEN quirks.

BTW how many cards/boards have you tested?

Regards,

Wolfram

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110617/7bafae68/attachment.sig>