public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] eSDHC: Add ADMA mode support for eSDHC
@ 2012-03-08  3:25 r66093
  2012-08-06  2:26 ` Huang Changming-R66093
  0 siblings, 1 reply; 5+ messages in thread
From: r66093 @ 2012-03-08  3:25 UTC (permalink / raw)
  To: linux-mmc; +Cc: Jerry Huang, Pan Jiafei, Jason Jin, Chris Ball, Anton Vorontsov

From: Jerry Huang <Chang-Ming.Huang@freescale.com>

The register of eSDHC Host Controller Capabilities is not compatible with
standard SDHC register, and eSDHC cannot support End Attribute in NOP ADMA
descriptor. With this patch eSDHC can works in ADMA mode
and performance can be improved.

Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
Signed-off-by: Pan Jiafei <Jiafei.Pan@freescale.com>
Signed-off-by: Jason Jin <Jason.jin@freescale.com>
CC: Chris Ball <cjb@laptop.org>
CC: Anton Vorontsov <cbouatmailru@gmail.com>
---
 drivers/mmc/host/sdhci-of-esdhc.c |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index f8eb1fb..ae5fcbf 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -21,6 +21,32 @@
 #include "sdhci-pltfm.h"
 #include "sdhci-esdhc.h"
 
+#define VENDOR_V_22	0x12
+static u32 esdhc_readl(struct sdhci_host *host, int reg)
+{
+	u32 ret;
+
+	ret = in_be32(host->ioaddr + reg);
+	/*
+	 * The bit of ADMA flag in eSDHC is not compatible with standard
+	 * SDHC register, so set fake flag SDHCI_CAN_DO_ADMA2 when ADMA is
+	 * supported by eSDHC.
+	 * And for many FSL eSDHC controller, the reset value of field
+	 * SDHCI_CAN_DO_ADMA1 is one, but some of them can't support ADMA,
+	 * only these vendor version is greater than 2.2/0x12 support ADMA.
+	 * For FSL eSDHC, must aligned 4-byte, so use 0xFC to read the
+	 * the verdor version number, oxFE is SDHCI_HOST_VERSION.
+	 */
+	if ((reg == SDHCI_CAPABILITIES) && (ret & SDHCI_CAN_DO_ADMA1)) {
+		u32 tmp = in_be32(host->ioaddr + SDHCI_SLOT_INT_STATUS);
+		tmp = (tmp & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT;
+		if (tmp > VENDOR_V_22)
+			ret |= SDHCI_CAN_DO_ADMA2;
+	}
+
+	return ret;
+}
+
 static u16 esdhc_readw(struct sdhci_host *host, int reg)
 {
 	u16 ret;
@@ -144,7 +170,7 @@ static void esdhc_of_resume(struct sdhci_host *host)
 #endif
 
 static struct sdhci_ops sdhci_esdhc_ops = {
-	.read_l = sdhci_be32bs_readl,
+	.read_l = esdhc_readl,
 	.read_w = esdhc_readw,
 	.read_b = esdhc_readb,
 	.write_l = sdhci_be32bs_writel,
@@ -161,9 +187,13 @@ static struct sdhci_ops sdhci_esdhc_ops = {
 };
 
 static struct sdhci_pltfm_data sdhci_esdhc_pdata = {
-	/* card detection could be handled via GPIO */
+	/*
+	 * card detection could be handled via GPIO
+	 * eSDHC cannot support End Attribute in NOP ADMA descriptor
+	 */
 	.quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_BROKEN_CARD_DETECTION
-		| SDHCI_QUIRK_NO_CARD_NO_RESET,
+		| SDHCI_QUIRK_NO_CARD_NO_RESET
+		| SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
 	.ops = &sdhci_esdhc_ops,
 };
 
-- 
1.7.5.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH] eSDHC: Add ADMA mode support for eSDHC
  2012-03-08  3:25 [PATCH] eSDHC: Add ADMA mode support for eSDHC r66093
@ 2012-08-06  2:26 ` Huang Changming-R66093
  2012-08-06  2:42   ` Anton Vorontsov
  2012-08-06  3:07   ` Chris Ball
  0 siblings, 2 replies; 5+ messages in thread
From: Huang Changming-R66093 @ 2012-08-06  2:26 UTC (permalink / raw)
  To: linux-mmc@vger.kernel.org, Chris Ball, Anton Vorontsov
  Cc: Pan Jiafei-B37022, Jin Zhengxiong-R64188

Hi, Chris and Anton
This patch has been pended five months, and no any feedback, do you have any comment about it?
Or it can be merged into next release?
We need it to enable the ADMA feature for FSL eSDHC controller.

Best Regards
Jerry Huang


> -----Original Message-----
> From: Huang Changming-R66093
> Sent: Thursday, March 08, 2012 11:25 AM
> To: linux-mmc@vger.kernel.org
> Cc: Huang Changming-R66093; Pan Jiafei-B37022; Jin Zhengxiong-R64188;
> Chris Ball; Anton Vorontsov
> Subject: [PATCH] eSDHC: Add ADMA mode support for eSDHC
> 
> From: Jerry Huang <Chang-Ming.Huang@freescale.com>
> 
> The register of eSDHC Host Controller Capabilities is not compatible with
> standard SDHC register, and eSDHC cannot support End Attribute in NOP
> ADMA
> descriptor. With this patch eSDHC can works in ADMA mode
> and performance can be improved.
> 
> Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
> Signed-off-by: Pan Jiafei <Jiafei.Pan@freescale.com>
> Signed-off-by: Jason Jin <Jason.jin@freescale.com>
> CC: Chris Ball <cjb@laptop.org>
> CC: Anton Vorontsov <cbouatmailru@gmail.com>
> ---
>  drivers/mmc/host/sdhci-of-esdhc.c |   36
> +++++++++++++++++++++++++++++++++---
>  1 files changed, 33 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-
> of-esdhc.c
> index f8eb1fb..ae5fcbf 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -21,6 +21,32 @@
>  #include "sdhci-pltfm.h"
>  #include "sdhci-esdhc.h"
> 
> +#define VENDOR_V_22	0x12
> +static u32 esdhc_readl(struct sdhci_host *host, int reg)
> +{
> +	u32 ret;
> +
> +	ret = in_be32(host->ioaddr + reg);
> +	/*
> +	 * The bit of ADMA flag in eSDHC is not compatible with standard
> +	 * SDHC register, so set fake flag SDHCI_CAN_DO_ADMA2 when ADMA is
> +	 * supported by eSDHC.
> +	 * And for many FSL eSDHC controller, the reset value of field
> +	 * SDHCI_CAN_DO_ADMA1 is one, but some of them can't support ADMA,
> +	 * only these vendor version is greater than 2.2/0x12 support ADMA.
> +	 * For FSL eSDHC, must aligned 4-byte, so use 0xFC to read the
> +	 * the verdor version number, oxFE is SDHCI_HOST_VERSION.
> +	 */
> +	if ((reg == SDHCI_CAPABILITIES) && (ret & SDHCI_CAN_DO_ADMA1)) {
> +		u32 tmp = in_be32(host->ioaddr + SDHCI_SLOT_INT_STATUS);
> +		tmp = (tmp & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT;
> +		if (tmp > VENDOR_V_22)
> +			ret |= SDHCI_CAN_DO_ADMA2;
> +	}
> +
> +	return ret;
> +}
> +
>  static u16 esdhc_readw(struct sdhci_host *host, int reg)
>  {
>  	u16 ret;
> @@ -144,7 +170,7 @@ static void esdhc_of_resume(struct sdhci_host *host)
>  #endif
> 
>  static struct sdhci_ops sdhci_esdhc_ops = {
> -	.read_l = sdhci_be32bs_readl,
> +	.read_l = esdhc_readl,
>  	.read_w = esdhc_readw,
>  	.read_b = esdhc_readb,
>  	.write_l = sdhci_be32bs_writel,
> @@ -161,9 +187,13 @@ static struct sdhci_ops sdhci_esdhc_ops = {
>  };
> 
>  static struct sdhci_pltfm_data sdhci_esdhc_pdata = {
> -	/* card detection could be handled via GPIO */
> +	/*
> +	 * card detection could be handled via GPIO
> +	 * eSDHC cannot support End Attribute in NOP ADMA descriptor
> +	 */
>  	.quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_BROKEN_CARD_DETECTION
> -		| SDHCI_QUIRK_NO_CARD_NO_RESET,
> +		| SDHCI_QUIRK_NO_CARD_NO_RESET
> +		| SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
>  	.ops = &sdhci_esdhc_ops,
>  };
> 
> --
> 1.7.5.4



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] eSDHC: Add ADMA mode support for eSDHC
  2012-08-06  2:26 ` Huang Changming-R66093
@ 2012-08-06  2:42   ` Anton Vorontsov
  2012-08-06  3:07   ` Chris Ball
  1 sibling, 0 replies; 5+ messages in thread
From: Anton Vorontsov @ 2012-08-06  2:42 UTC (permalink / raw)
  To: Huang Changming-R66093
  Cc: linux-mmc@vger.kernel.org, Chris Ball, Pan Jiafei-B37022,
	Jin Zhengxiong-R64188

On Mon, Aug 06, 2012 at 02:26:01AM +0000, Huang Changming-R66093 wrote:
> Hi, Chris and Anton
> This patch has been pended five months, and no any feedback, do you have any comment about it?
> Or it can be merged into next release?
> We need it to enable the ADMA feature for FSL eSDHC controller.

It looks OK, thanks!

Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] eSDHC: Add ADMA mode support for eSDHC
  2012-08-06  2:26 ` Huang Changming-R66093
  2012-08-06  2:42   ` Anton Vorontsov
@ 2012-08-06  3:07   ` Chris Ball
  2012-08-06  3:18     ` Huang Changming-R66093
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Ball @ 2012-08-06  3:07 UTC (permalink / raw)
  To: Huang Changming-R66093
  Cc: linux-mmc@vger.kernel.org, Anton Vorontsov, Pan Jiafei-B37022,
	Jin Zhengxiong-R64188

Hi,

On Sun, Aug 05 2012, Huang Changming-R66093 wrote:
> Hi, Chris and Anton
> This patch has been pended five months, and no any feedback, do you
> have any comment about it?
> Or it can be merged into next release?
> We need it to enable the ADMA feature for FSL eSDHC controller.

Thanks; I'm sorry for dropping this.  It's in mmc-next for 3.7 now.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] eSDHC: Add ADMA mode support for eSDHC
  2012-08-06  3:07   ` Chris Ball
@ 2012-08-06  3:18     ` Huang Changming-R66093
  0 siblings, 0 replies; 5+ messages in thread
From: Huang Changming-R66093 @ 2012-08-06  3:18 UTC (permalink / raw)
  To: Chris Ball
  Cc: linux-mmc@vger.kernel.org, Anton Vorontsov, Pan Jiafei-B37022,
	Jin Zhengxiong-R64188

Thanks a lot, Chris and Anton.

Best Regards
Jerry Huang


> -----Original Message-----
> From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc-
> owner@vger.kernel.org] On Behalf Of Chris Ball
> Sent: Monday, August 06, 2012 11:08 AM
> To: Huang Changming-R66093
> Cc: linux-mmc@vger.kernel.org; Anton Vorontsov; Pan Jiafei-B37022; Jin
> Zhengxiong-R64188
> Subject: Re: [PATCH] eSDHC: Add ADMA mode support for eSDHC
> 
> Hi,
> 
> On Sun, Aug 05 2012, Huang Changming-R66093 wrote:
> > Hi, Chris and Anton
> > This patch has been pended five months, and no any feedback, do you
> > have any comment about it?
> > Or it can be merged into next release?
> > We need it to enable the ADMA feature for FSL eSDHC controller.
> 
> Thanks; I'm sorry for dropping this.  It's in mmc-next for 3.7 now.
> 
> - Chris.
> --
> Chris Ball   <cjb@laptop.org>   <http://printf.net/>
> One Laptop Per Child
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-06  3:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-08  3:25 [PATCH] eSDHC: Add ADMA mode support for eSDHC r66093
2012-08-06  2:26 ` Huang Changming-R66093
2012-08-06  2:42   ` Anton Vorontsov
2012-08-06  3:07   ` Chris Ball
2012-08-06  3:18     ` Huang Changming-R66093

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox