Re: [PATCH] sdhci: allow for eMMC 74 clock generation by controller

2010-10-07 Thread Chris Ball
Hi Philip,

On Thu, Sep 23, 2010 at 08:24:32AM -0700, Philip Rakity wrote:
> From: Philip Rakity 
> Date: Thu, 23 Sep 2010 08:15:03 -0700
> Subject: [PATCH] sdhci: allow for initial eMMC 74 clock generation by 
> controller
> 
> resend of patch to fit into 80 char line lengths:
> 
> snippet of code for how adaption layer should handle the call.
> 
> 
> /*
>  * eMMC spec calls for the host to send 74 clocks to the card
>  * during initialization, right after voltage stabilization.
>  * create the clocks manually right here.
>  */
> void generate_init_clocks_A0(struct sdhci_host *host, u8 power_mode)
> {
>   struct sdhci_mmc_slot *slot = sdhci_priv(host);
> 
>   DBG ("%s: ENTER %s: slot->power_mode = %d, ios->power_mode = %d\n",
>   __func__, 
>   mmc_hostname(host->mmc),
>   slot->power_mode, 
>   power_mode);
> 
>   if (slot->power_mode == MMC_POWER_UP 
>   && power_mode == MMC_POWER_ON) {
>   
>   /* controller specific code here */
>   /* slot->power_mode holds previous power setting */
>   }
>   slot->power_mode = power_mode;
> }
> 
> 
> Signed-off-by: Philip Rakity 
> ---
>  drivers/mmc/host/sdhci.c |3 +++
>  drivers/mmc/host/sdhci.h |2 ++
>  2 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 6b8ca32..ba8f9a0 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1169,6 +1169,9 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct 
> mmc_ios *ios)
>   else
>   sdhci_set_power(host, ios->vdd);
>  
> + if (host->ops->platform_send_init_74_clocks)
> + host->ops->platform_send_init_74_clocks(host, ios->power_mode);
> +
>   ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
>  
>   if (ios->bus_width == MMC_BUS_WIDTH_8)
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 290b5a8..d73685a 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -325,6 +325,8 @@ struct sdhci_ops {
>   unsigned int(*get_max_clock)(struct sdhci_host *host);
>   unsigned int(*get_min_clock)(struct sdhci_host *host);
>   unsigned int(*get_timeout_clock)(struct sdhci_host *host);
> + void (*platform_send_init_74_clocks)(struct sdhci_host *host,
> + u8 power_mode);
>  };
>  
>  #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
> -- 

Thanks, applied to mmc-next.

-- 
Chris Ball  
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] sdhci: allow for eMMC 74 clock generation by controller

2010-09-23 Thread Philip Rakity

Re did patch to fit into 80 char line length rule

=

>From 1ba80b60d0ca3ba3114e2aa25f1afdb8a6af3842 Mon Sep 17 00:00:00 2001
From: Philip Rakity 
Date: Thu, 23 Sep 2010 08:15:03 -0700
Subject: [PATCH] sdhci: allow for initial eMMC 74 clock generation by controller

resend of patch to fit into 80 char line lengths:

snippet of code for how adaption layer should handle the call.


/*
 * eMMC spec calls for the host to send 74 clocks to the card
 * during initialization, right after voltage stabilization.
 * create the clocks manually right here.
 */
void generate_init_clocks_A0(struct sdhci_host *host, u8 power_mode)
{
struct sdhci_mmc_slot *slot = sdhci_priv(host);

DBG ("%s: ENTER %s: slot->power_mode = %d, ios->power_mode = %d\n",
__func__, 
mmc_hostname(host->mmc),
slot->power_mode, 
power_mode);

if (slot->power_mode == MMC_POWER_UP 
&& power_mode == MMC_POWER_ON) {

/* controller specific code here */
/* slot->power_mode holds previous power setting */
}
slot->power_mode = power_mode;
}


Signed-off-by: Philip Rakity 
---
 drivers/mmc/host/sdhci.c |3 +++
 drivers/mmc/host/sdhci.h |2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 6b8ca32..ba8f9a0 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1169,6 +1169,9 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct 
mmc_ios *ios)
else
sdhci_set_power(host, ios->vdd);
 
+   if (host->ops->platform_send_init_74_clocks)
+   host->ops->platform_send_init_74_clocks(host, ios->power_mode);
+
ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
 
if (ios->bus_width == MMC_BUS_WIDTH_8)
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 290b5a8..d73685a 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -325,6 +325,8 @@ struct sdhci_ops {
unsigned int(*get_max_clock)(struct sdhci_host *host);
unsigned int(*get_min_clock)(struct sdhci_host *host);
unsigned int(*get_timeout_clock)(struct sdhci_host *host);
+   void (*platform_send_init_74_clocks)(struct sdhci_host *host,
+   u8 power_mode);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
-- 
1.6.0.4


=

On Sep 20, 2010, at 10:43 PM, Philip Rakity wrote:

> 
> Wolfram,
> 
> I generated the patch for eMMC 74 clocks.  I do not know if you want to 
> incorporate into your submission or let it stand on its own.
> 
> regards,
> 
> Philip
> 
> 
> 
> From: Philip Rakity 
> Subject: [PATCH] sdhci: allow for eMMC 74 clock generation by controller
> Signed-off-by: Philip Rakity 
> 
> Patch is below and sample usage in sdhci-.c adaption code is below.
> 
> /*
> * eMMC spec calls for the host to send 74 clocks to the card
> * during initialization, right after voltage stabilization.
> * create the clocks manually right here.
> */
> void generate_init_clocks_A0(struct sdhci_host *host, u8 power_mode)
> {
>   struct sdhci_mmc_slot *slot = sdhci_priv(host);
> 
>   DBG ("%s: ENTER %s: slot->power_mode = %d, ios->power_mode = %d\n",
>   __func__, 
>   mmc_hostname(host->mmc),
>   slot->power_mode, 
>   power_mode);
> 
>   if (slot->power_mode == MMC_POWER_UP 
>   && power_mode == MMC_POWER_ON) {
>   
>   /* controller specific code here */
>   /* slot->power_mode holds previous power setting */
> 
>   }
>   slot->power_mode = power_mode;
> }
> 
> 
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 401527d..6aadd0f 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1168,6 +1168,9 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct 
> mmc_ios *ios)
>   else
>   sdhci_set_power(host, ios->vdd);
> 
> + if (host->ops->platform_generate_initial_74_clocks)
> + host->ops->platform_generate_initial_74_clocks(host, 
> ios->power_mode);
> +
>   ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
> 
>   if (ios->bus_width == MMC_BUS_WIDTH_8)
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index d316bc7..70c5806 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -323,6 +323,8 @@ struct sdhci_ops {
>   unsigned int(*get_max_clock)(struct sdhci_host *host);
>   unsigned int(*get_min_clock)(struct sdhci_host *host);
>   unsigned in

Re: [PATCH] sdhci: allow for eMMC 74 clock generation by controller

2010-09-22 Thread Wolfram Sang
Hi,

>Patch attached.  We are in a chicken and egg situation.   The controller
>needs data to cause the clock to start and the first command sent by the
>mmc layer is CMD0 -- mmc_go_idle().  This is sent without the  eMMC chip
>seeing the 74 clocks but since there are NOW clocks the chip see's this.
> It is not able to parse the command and we are struck.

Okay, and some host->ops->generate_initial_74_clocks() could help you
out, it seems. If it is a controller specific issue, the approach seems
in general sensible to me, unless I am missing some details.

Regards,

   Wolfram

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |


signature.asc
Description: Digital signature


Re: [PATCH] sdhci: allow for eMMC 74 clock generation by controller

2010-09-22 Thread Adrian Hunter

On 21/09/10 18:06, Philip Rakity wrote:


Our hardware needs to be programmed to handle this case.  The host-ops option 
is only needed from h/w that does not handle this.

If you can suggest a way to do this in the mmc layer I would welcome 
implementing it.


No, I misunderstood sorry :(.  The 74-clocks requirement is standard and
drivers handle it via set_ios.



I looked and the solution requires a call into the driver from the mmc layer 
after the all setting POWER_ON call.  This was more intrusive than doing it in 
the driver but if you think this makes sense I can do a patch for that.

eg

/*
  * Apply power to the MMC stack.  This is a two-stage process.
  * First, we enable power to the card without the clock running.
  * We then wait a bit for the power to stabilise.  Finally,
  * enable the bus drivers and clock to the card.
  *
  * We must _NOT_ enable the clock prior to power stablising.
  *
  * If a host does all the power sequencing itself, ignore the
  * initial MMC_POWER_UP stage.
  */
static void mmc_power_up(struct mmc_host *host)
{
int bit = fls(host->ocr_avail) - 1;

host->ios.vdd = bit;
if (mmc_host_is_spi(host)) {
host->ios.chip_select = MMC_CS_HIGH;
host->ios.bus_mode = MMC_BUSMODE_PUSHPULL;
} else {
host->ios.chip_select = MMC_CS_DONTCARE;
host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
}
host->ios.power_mode = MMC_POWER_UP;
host->ios.bus_width = MMC_BUS_WIDTH_1;
host->ios.timing = MMC_TIMING_LEGACY;
mmc_set_ios(host);

/*  CALL INTO DRIVER HERE TO SEND 74 CLOCKS */<==
Philip


On Sep 20, 2010, at 11:04 PM, Adrian Hunter wrote:


On 21/09/10 08:43, ext Philip Rakity wrote:


Wolfram,

I generated the patch for eMMC 74 clocks.  I do not know if you want to 
incorporate into your submission or let it stand on its own.


Wouldn't it be better to fix it in MMC core rather than duplicate it in every 
driver?



regards,

Philip



From: Philip Rakity
Subject: [PATCH] sdhci: allow for eMMC 74 clock generation by controller
Signed-off-by: Philip Rakity

Patch is below and sample usage in sdhci-.c adaption code is below.

/*
  * eMMC spec calls for the host to send 74 clocks to the card
  * during initialization, right after voltage stabilization.
  * create the clocks manually right here.
  */
void generate_init_clocks_A0(struct sdhci_host *host, u8 power_mode)
{
struct sdhci_mmc_slot *slot = sdhci_priv(host);

DBG ("%s: ENTER %s: slot->power_mode = %d, ios->power_mode = %d\n",
__func__,
mmc_hostname(host->mmc),
slot->power_mode,
power_mode);

if (slot->power_mode == MMC_POWER_UP
&&   power_mode == MMC_POWER_ON) {

/* controller specific code here */
/* slot->power_mode holds previous power setting */

}
slot->power_mode = power_mode;
}



diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 401527d..6aadd0f 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1168,6 +1168,9 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct 
mmc_ios *ios)
else
sdhci_set_power(host, ios->vdd);

+   if (host->ops->platform_generate_initial_74_clocks)
+   host->ops->platform_generate_initial_74_clocks(host, 
ios->power_mode);
+
ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);

if (ios->bus_width == MMC_BUS_WIDTH_8)
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index d316bc7..70c5806 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -323,6 +323,8 @@ struct sdhci_ops {
unsigned int(*get_max_clock)(struct sdhci_host *host);
unsigned int(*get_min_clock)(struct sdhci_host *host);
unsigned int(*get_timeout_clock)(struct sdhci_host *host);
+   void(*platform_generate_initial_74_clocks)(struct 
sdhci_host *host,
+   u8 power_mode);
  };

  #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html








--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] sdhci: allow for eMMC 74 clock generation by controller

2010-09-21 Thread Wolfram Sang
On Tue, Sep 21, 2010 at 08:06:20AM -0700, Philip Rakity wrote:
> 
> Our hardware needs to be programmed to handle this case.  The host-ops option 
> is only needed from h/w that does not handle this.
> 
> If you can suggest a way to do this in the mmc layer I would welcome 
> implementing it.  
> 
> I looked and the solution requires a call into the driver from the mmc layer 
> after the all setting POWER_ON call.  This was more intrusive than doing it 
> in the driver but if you think this makes sense I can do a patch for that.  

Do you have a draft patch for this intrusive way (can be quick'n'dirty)? It is
usually easier to think about such issues if there is some code...

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |


signature.asc
Description: Digital signature


Re: [PATCH] sdhci: allow for eMMC 74 clock generation by controller

2010-09-21 Thread Philip Rakity

Our hardware needs to be programmed to handle this case.  The host-ops option 
is only needed from h/w that does not handle this.

If you can suggest a way to do this in the mmc layer I would welcome 
implementing it.  

I looked and the solution requires a call into the driver from the mmc layer 
after the all setting POWER_ON call.  This was more intrusive than doing it in 
the driver but if you think this makes sense I can do a patch for that.  

eg

/*
 * Apply power to the MMC stack.  This is a two-stage process.
 * First, we enable power to the card without the clock running.
 * We then wait a bit for the power to stabilise.  Finally,
 * enable the bus drivers and clock to the card.
 *
 * We must _NOT_ enable the clock prior to power stablising.
 *
 * If a host does all the power sequencing itself, ignore the
 * initial MMC_POWER_UP stage.
 */
static void mmc_power_up(struct mmc_host *host)
{
int bit = fls(host->ocr_avail) - 1;

host->ios.vdd = bit;
if (mmc_host_is_spi(host)) {
host->ios.chip_select = MMC_CS_HIGH;
host->ios.bus_mode = MMC_BUSMODE_PUSHPULL;
} else {
host->ios.chip_select = MMC_CS_DONTCARE;
host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
}
host->ios.power_mode = MMC_POWER_UP;
host->ios.bus_width = MMC_BUS_WIDTH_1;
host->ios.timing = MMC_TIMING_LEGACY;
mmc_set_ios(host);

/*  CALL INTO DRIVER HERE TO SEND 74 CLOCKS */   <==
Philip


On Sep 20, 2010, at 11:04 PM, Adrian Hunter wrote:

> On 21/09/10 08:43, ext Philip Rakity wrote:
>> 
>> Wolfram,
>> 
>> I generated the patch for eMMC 74 clocks.  I do not know if you want to 
>> incorporate into your submission or let it stand on its own.
> 
> Wouldn't it be better to fix it in MMC core rather than duplicate it in every 
> driver?
> 
>> 
>> regards,
>> 
>> Philip
>> 
>> 
>> 
>> From: Philip Rakity
>> Subject: [PATCH] sdhci: allow for eMMC 74 clock generation by controller
>> Signed-off-by: Philip Rakity
>> 
>> Patch is below and sample usage in sdhci-.c adaption code is below.
>> 
>> /*
>>  * eMMC spec calls for the host to send 74 clocks to the card
>>  * during initialization, right after voltage stabilization.
>>  * create the clocks manually right here.
>>  */
>> void generate_init_clocks_A0(struct sdhci_host *host, u8 power_mode)
>> {
>>  struct sdhci_mmc_slot *slot = sdhci_priv(host);
>> 
>>  DBG ("%s: ENTER %s: slot->power_mode = %d, ios->power_mode = %d\n",
>>  __func__,
>>  mmc_hostname(host->mmc),
>>  slot->power_mode,
>>  power_mode);
>> 
>>  if (slot->power_mode == MMC_POWER_UP
>>  &&  power_mode == MMC_POWER_ON) {
>>  
>>  /* controller specific code here */
>>  /* slot->power_mode holds previous power setting */
>> 
>>  }
>>  slot->power_mode = power_mode;
>> }
>> 
>> 
>> 
>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>> index 401527d..6aadd0f 100644
>> --- a/drivers/mmc/host/sdhci.c
>> +++ b/drivers/mmc/host/sdhci.c
>> @@ -1168,6 +1168,9 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct 
>> mmc_ios *ios)
>>  else
>>  sdhci_set_power(host, ios->vdd);
>> 
>> +if (host->ops->platform_generate_initial_74_clocks)
>> +host->ops->platform_generate_initial_74_clocks(host, 
>> ios->power_mode);
>> +
>>  ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
>> 
>>  if (ios->bus_width == MMC_BUS_WIDTH_8)
>> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
>> index d316bc7..70c5806 100644
>> --- a/drivers/mmc/host/sdhci.h
>> +++ b/drivers/mmc/host/sdhci.h
>> @@ -323,6 +323,8 @@ struct sdhci_ops {
>>  unsigned int(*get_max_clock)(struct sdhci_host *host);
>>  unsigned int(*get_min_clock)(struct sdhci_host *host);
>>  unsigned int(*get_timeout_clock)(struct sdhci_host *host);
>> +void(*platform_generate_initial_74_clocks)(struct 
>> sdhci_host *host,
>> +u8 power_mode);
>>  };
>> 
>>  #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] sdhci: allow for eMMC 74 clock generation by controller

2010-09-20 Thread Wolfram Sang
Hi Philip,

> I generated the patch for eMMC 74 clocks.  I do not know if you want
> to incorporate into your submission or let it stand on its own.

I won't pick it up as I am missing the technical details for this issue.
I only jumped in because adding quirk bits should be handled very
carefully at the moment IMHO.

Regards,

   Wolfram

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |


signature.asc
Description: Digital signature


Re: [PATCH] sdhci: allow for eMMC 74 clock generation by controller

2010-09-20 Thread Adrian Hunter

On 21/09/10 08:43, ext Philip Rakity wrote:


Wolfram,

I generated the patch for eMMC 74 clocks.  I do not know if you want to 
incorporate into your submission or let it stand on its own.


Wouldn't it be better to fix it in MMC core rather than duplicate it in every 
driver?



regards,

Philip



From: Philip Rakity
Subject: [PATCH] sdhci: allow for eMMC 74 clock generation by controller
Signed-off-by: Philip Rakity

Patch is below and sample usage in sdhci-.c adaption code is below.

/*
  * eMMC spec calls for the host to send 74 clocks to the card
  * during initialization, right after voltage stabilization.
  * create the clocks manually right here.
  */
void generate_init_clocks_A0(struct sdhci_host *host, u8 power_mode)
{
struct sdhci_mmc_slot *slot = sdhci_priv(host);

DBG ("%s: ENTER %s: slot->power_mode = %d, ios->power_mode = %d\n",
__func__,
mmc_hostname(host->mmc),
slot->power_mode,
power_mode);

if (slot->power_mode == MMC_POWER_UP
&&  power_mode == MMC_POWER_ON) {

/* controller specific code here */
/* slot->power_mode holds previous power setting */

}
slot->power_mode = power_mode;
}



diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 401527d..6aadd0f 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1168,6 +1168,9 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct 
mmc_ios *ios)
else
sdhci_set_power(host, ios->vdd);

+   if (host->ops->platform_generate_initial_74_clocks)
+   host->ops->platform_generate_initial_74_clocks(host, 
ios->power_mode);
+
ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);

if (ios->bus_width == MMC_BUS_WIDTH_8)
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index d316bc7..70c5806 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -323,6 +323,8 @@ struct sdhci_ops {
unsigned int(*get_max_clock)(struct sdhci_host *host);
unsigned int(*get_min_clock)(struct sdhci_host *host);
unsigned int(*get_timeout_clock)(struct sdhci_host *host);
+   void(*platform_generate_initial_74_clocks)(struct 
sdhci_host *host,
+   u8 power_mode);
  };

  #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] sdhci: allow for eMMC 74 clock generation by controller

2010-09-20 Thread Philip Rakity

Wolfram,

I generated the patch for eMMC 74 clocks.  I do not know if you want to 
incorporate into your submission or let it stand on its own.

regards,

Philip



From: Philip Rakity 
Subject: [PATCH] sdhci: allow for eMMC 74 clock generation by controller
Signed-off-by: Philip Rakity 

Patch is below and sample usage in sdhci-.c adaption code is below.

/*
 * eMMC spec calls for the host to send 74 clocks to the card
 * during initialization, right after voltage stabilization.
 * create the clocks manually right here.
 */
void generate_init_clocks_A0(struct sdhci_host *host, u8 power_mode)
{
struct sdhci_mmc_slot *slot = sdhci_priv(host);

DBG ("%s: ENTER %s: slot->power_mode = %d, ios->power_mode = %d\n",
__func__, 
mmc_hostname(host->mmc),
slot->power_mode, 
power_mode);

if (slot->power_mode == MMC_POWER_UP 
&& power_mode == MMC_POWER_ON) {

/* controller specific code here */
/* slot->power_mode holds previous power setting */

}
slot->power_mode = power_mode;
}



diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 401527d..6aadd0f 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1168,6 +1168,9 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct 
mmc_ios *ios)
else
sdhci_set_power(host, ios->vdd);
 
+   if (host->ops->platform_generate_initial_74_clocks)
+   host->ops->platform_generate_initial_74_clocks(host, 
ios->power_mode);
+
ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
 
if (ios->bus_width == MMC_BUS_WIDTH_8)
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index d316bc7..70c5806 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -323,6 +323,8 @@ struct sdhci_ops {
unsigned int(*get_max_clock)(struct sdhci_host *host);
unsigned int(*get_min_clock)(struct sdhci_host *host);
unsigned int(*get_timeout_clock)(struct sdhci_host *host);
+   void(*platform_generate_initial_74_clocks)(struct 
sdhci_host *host,
+   u8 power_mode);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html