Re: [PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5

2011-11-09 Thread Girish K S
On 8 November 2011 15:18, Sahitya Tummala  wrote:
> Hi Girish,
>
> On 10/18/2011 10:35 AM, Girish K S wrote:
>>
>> This patch adds the support for power off notify feature, available in
>> eMMC 4.5 devices. If the the host has support for this feature, then the
>> mmc core will notify it to the device by setting the
>> POWER_OFF_NOTIFICATION
>> byte in the extended csd register with a value 1(POWER_ON).
>>
>> For suspend mode short timeout is used, whereas for the normal poweroff
>> long
>> timeout is used.
>>
>> cc: Chris Ball
>> Signed-off-by: Girish K S
>> Signed-off-by: Jaehoon Chung
>> ---
>> Changes in V9:
>>        Removed the macros not related with the PowerOff notify feature.
>>        The previous patch with commit id
>>        bd3151f6c55c553bed2c0df72792841457b75bb5 should be deleted before
>>        applying this patch.
>> Changes in V8:
>>        Updated with review comments of Chris Ball and rebased to
>>        chris-mmc/mmc-next branch.
>> Changes in V7:
>>        Rebased to chris-mmc/mmc-next branch. merged to patches to single
>>        patch.
>> Changes in V6:
>>        Fixes checkpatch errors. The patches are generated after rebasing
>> to
>>         chris's mmc-next branch.
>> Changes in V5:
>>        This patch version fixes the problem with power off notify
>> function,
>>         when called for the first time and card is not yet initialised.
>> Changes in V4:
>>        Updated with review comments of Jeon
>> Changes in V2:
>>        Adds poweroff notification handling in suspend/normal.
>>
>>  drivers/mmc/core/core.c  |   34 ++
>>  drivers/mmc/core/mmc.c   |   23 +--
>>  drivers/mmc/host/sdhci.c |    9 +
>>  include/linux/mmc/card.h |    6 ++
>>  include/linux/mmc/host.h |    5 +
>>  include/linux/mmc/mmc.h  |    6 ++
>>  6 files changed, 81 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>> index 61d7730..b1eca96 100644
>> --- a/drivers/mmc/core/core.c
>> +++ b/drivers/mmc/core/core.c
>> @@ -1212,11 +1212,43 @@ static void mmc_power_up(struct mmc_host *host)
>>
>>  void mmc_power_off(struct mmc_host *host)
>>  {
>> +       struct mmc_card *card;
>> +       unsigned int notify_type;
>> +       unsigned int timeout;
>> +       int err;
>> +
>>        mmc_host_clk_hold(host);
>>
>> +       card = host->card;
>>        host->ios.clock = 0;
>>        host->ios.vdd = 0;
>>
>> +       if (card&&  mmc_card_mmc(card)&&
>> +           card->poweroff_notify_state == MMC_POWERED_ON) {
>> +
>> +               if (host->power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) {
>> +                       notify_type = EXT_CSD_POWER_OFF_SHORT;
>> +                       timeout = card->ext_csd.generic_cmd6_time;
>> +                       card->poweroff_notify_state = MMC_POWEROFF_SHORT;
>> +               } else {
>> +                       notify_type = EXT_CSD_POWER_OFF_LONG;
>> +                       timeout = card->ext_csd.power_off_longtime;
>> +                       card->poweroff_notify_state = MMC_POWEROFF_LONG;
>> +               }
>> +
>> +               err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>> +                                EXT_CSD_POWER_OFF_NOTIFICATION,
>> +                                notify_type, timeout);
>
> During suspend, the device can already be in sleep state (CMD5) before
> mmc_power_off()
> is called from mmc_suspend_host(). As per eMMC specification, when the
> device is in sleep state,
> it can only respond to RESET commands (CMD0 with argument of either
> 0x or
> 0xF0F0F0F0 or H/W reset) and awake command (CMD5).  So, how does this switch
> going
> to happen (CMD6) if it is in sleep state?
> Thanks Sahitya. Will handle the situation of sending the switch command  in 
> mmc_suspend_host function before the device goes to sleep.
> Thanks,
> Sahitya.
>
> --
> Sent by a consultant of the Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
> Forum.
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5

2011-11-08 Thread Sahitya Tummala

Hi Girish,

On 10/18/2011 10:35 AM, Girish K S wrote:

This patch adds the support for power off notify feature, available in
eMMC 4.5 devices. If the the host has support for this feature, then the
mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION
byte in the extended csd register with a value 1(POWER_ON).

For suspend mode short timeout is used, whereas for the normal poweroff long
timeout is used.

cc: Chris Ball
Signed-off-by: Girish K S
Signed-off-by: Jaehoon Chung
---
Changes in V9:
Removed the macros not related with the PowerOff notify feature.
The previous patch with commit id
bd3151f6c55c553bed2c0df72792841457b75bb5 should be deleted before
applying this patch.
Changes in V8:
Updated with review comments of Chris Ball and rebased to
chris-mmc/mmc-next branch.
Changes in V7:
Rebased to chris-mmc/mmc-next branch. merged to patches to single
patch.
Changes in V6:
Fixes checkpatch errors. The patches are generated after rebasing to
 chris's mmc-next branch.
Changes in V5:
This patch version fixes the problem with power off notify function,
 when called for the first time and card is not yet initialised.
Changes in V4:
Updated with review comments of Jeon
Changes in V2:
Adds poweroff notification handling in suspend/normal.

  drivers/mmc/core/core.c  |   34 ++
  drivers/mmc/core/mmc.c   |   23 +--
  drivers/mmc/host/sdhci.c |9 +
  include/linux/mmc/card.h |6 ++
  include/linux/mmc/host.h |5 +
  include/linux/mmc/mmc.h  |6 ++
  6 files changed, 81 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 61d7730..b1eca96 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1212,11 +1212,43 @@ static void mmc_power_up(struct mmc_host *host)

  void mmc_power_off(struct mmc_host *host)
  {
+   struct mmc_card *card;
+   unsigned int notify_type;
+   unsigned int timeout;
+   int err;
+
mmc_host_clk_hold(host);

+   card = host->card;
host->ios.clock = 0;
host->ios.vdd = 0;

+   if (card&&  mmc_card_mmc(card)&&
+   card->poweroff_notify_state == MMC_POWERED_ON) {
+
+   if (host->power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) {
+   notify_type = EXT_CSD_POWER_OFF_SHORT;
+   timeout = card->ext_csd.generic_cmd6_time;
+   card->poweroff_notify_state = MMC_POWEROFF_SHORT;
+   } else {
+   notify_type = EXT_CSD_POWER_OFF_LONG;
+   timeout = card->ext_csd.power_off_longtime;
+   card->poweroff_notify_state = MMC_POWEROFF_LONG;
+   }
+
+   err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
+EXT_CSD_POWER_OFF_NOTIFICATION,
+notify_type, timeout);


During suspend, the device can already be in sleep state (CMD5) before 
mmc_power_off()
is called from mmc_suspend_host(). As per eMMC specification, when the 
device is in sleep state,
it can only respond to RESET commands (CMD0 with argument of either 
0x or
0xF0F0F0F0 or H/W reset) and awake command (CMD5).  So, how does this 
switch going

to happen (CMD6) if it is in sleep state?

Thanks,
Sahitya.

--
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum.

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


Re: [PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5

2011-10-18 Thread Jaehoon Chung
Hi Chris.

Thank you for merged about eMMC4.5 feature.

Best regards,
Jaehoon Chung

On 10/18/2011 09:53 PM, Chris Ball wrote:

> Hi,
> 
> On Tue, Oct 18 2011, Girish K S wrote:
>>>  missing one thing.unsigned intpower_notify_type; in 
>>> include/linux/mmc/host.h
>> is not alligned to the above member, which was done in my latest patch
> 
> Fixed.  Thanks!
> 
> - Chris.


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


Re: [PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5

2011-10-18 Thread Chris Ball
Hi,

On Tue, Oct 18 2011, Girish K S wrote:
>>  missing one thing.unsigned intpower_notify_type; in 
>> include/linux/mmc/host.h
> is not alligned to the above member, which was done in my latest patch

Fixed.  Thanks!

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


Re: [PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5

2011-10-17 Thread Girish K S
On 18 October 2011 11:17, Chris Ball  wrote:
> Hi,
>
> On Tue, Oct 18 2011, Jaehoon Chung wrote:
>> Hi Girish.
>>
>> This patch is merged on mmc-next..did you know that?
>> And if deleted commit id bd3151f6c55c553bed2c0df72792841457b75bb5,
>> I will re-work for eMMC feature4.5.
>> git://git.infradead.org/users/kmpark/linux-2.6-samsung emmc4.5
>>
>> To Chris.
>> If you re-commit this patch, i also change "git pull request".
>> there are duplicated code in Notify patch, so i didn't add to cache patch.
>
> I think I've fixed everything up -- I merged your pull request, included
> Girish's new patch, and moved the #defines for the CACHE_CTRL patch over
> to that patch instead of the power class patch.  Would be great if you
> can double-check that the merge all looks okay to you.
>  missing one thing.unsigned intpower_notify_type; in 
> include/linux/mmc/host.h
is not alligned to the above member, which was done in my latest patch
> Thanks,
>
> - Chris.
> --
> Chris Ball      
> One Laptop Per Child
>
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5

2011-10-17 Thread Girish K S
On 18 October 2011 11:07, Jaehoon Chung  wrote:
> Hi Girish.
>
> I know you're worked based-on latest mmc-next.
> But this patch is already merged on mmc-next...
>
> Merged patch is already included #define MMC_CAP2_CACHE_CTRL and 
> EXT_CSD_FLUSH_CACHE.
>
> So i didn't add them in [mmc: core: Add cache control for eMMC4.5 device] on 
> the below repository
> git://git.infradead.org/users/kmpark/linux-2.6-samsung emmc4.5
>
> What do you want how i do? :)
>
> Best regards,
> Jaehoon Chung
> I feel it is a bad idea to keep cache feature dependency in power class 
> feature (review comment by Jeon). Sorry for bothering you with that change.
>
> On 10/18/2011 02:25 PM, Girish K S wrote:
>
>> On 18 October 2011 10:49, Girish K S  wrote:
>>> On 18 October 2011 10:46, Jaehoon Chung  wrote:
 Hi Girish.

 This patch is merged on mmc-next..did you know that?
 And if deleted commit id bd3151f6c55c553bed2c0df72792841457b75bb5,
 I will re-work for eMMC feature4.5.
 git://git.infradead.org/users/kmpark/linux-2.6-samsung emmc4.5

 To Chris.
 If you re-commit this patch, i also change "git pull request".
 there are duplicated code in Notify patch, so i didn't add to cache patch.
 HI Jaehoon,
>>>  I have already bought it to the notice of Chris. After discussing
>>> with Chris i am resending the complete patch.
 Regards,
 Jaehoon Chung
 Adding to it. In your mail with subject "[GIT PULL v2] Add eMMC4.5 feature 
 for v3.2", for version 2 changes it is mentioned
>> that power notify feature is removed. Thats the reason i rebased my
>> patch to Chris's mmc-next branch and resent.
 On 10/18/2011 02:05 PM, Girish K S wrote:

> This patch adds the support for power off notify feature, available in
> eMMC 4.5 devices. If the the host has support for this feature, then the
> mmc core will notify it to the device by setting the 
> POWER_OFF_NOTIFICATION
> byte in the extended csd register with a value 1(POWER_ON).
>
> For suspend mode short timeout is used, whereas for the normal poweroff 
> long
> timeout is used.
>
> cc: Chris Ball 
> Signed-off-by: Girish K S 
> Signed-off-by: Jaehoon Chung 
> ---
> Changes in V9:
>       Removed the macros not related with the PowerOff notify feature.
>       The previous patch with commit id
>       bd3151f6c55c553bed2c0df72792841457b75bb5 should be deleted before
>       applying this patch.
> Changes in V8:
>       Updated with review comments of Chris Ball and rebased to
>       chris-mmc/mmc-next branch.
> Changes in V7:
>       Rebased to chris-mmc/mmc-next branch. merged to patches to single
>       patch.
> Changes in V6:
>       Fixes checkpatch errors. The patches are generated after rebasing to
>        chris's mmc-next branch.
> Changes in V5:
>       This patch version fixes the problem with power off notify function,
>        when called for the first time and card is not yet initialised.
> Changes in V4:
>       Updated with review comments of Jeon
> Changes in V2:
>       Adds poweroff notification handling in suspend/normal.
>
>  drivers/mmc/core/core.c  |   34 ++
>  drivers/mmc/core/mmc.c   |   23 +--
>  drivers/mmc/host/sdhci.c |    9 +
>  include/linux/mmc/card.h |    6 ++
>  include/linux/mmc/host.h |    5 +
>  include/linux/mmc/mmc.h  |    6 ++
>  6 files changed, 81 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 61d7730..b1eca96 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1212,11 +1212,43 @@ static void mmc_power_up(struct mmc_host *host)
>
>  void mmc_power_off(struct mmc_host *host)
>  {
> +     struct mmc_card *card;
> +     unsigned int notify_type;
> +     unsigned int timeout;
> +     int err;
> +
>       mmc_host_clk_hold(host);
>
> +     card = host->card;
>       host->ios.clock = 0;
>       host->ios.vdd = 0;
>
> +     if (card && mmc_card_mmc(card) &&
> +         card->poweroff_notify_state == MMC_POWERED_ON) {
> +
> +             if (host->power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) {
> +                     notify_type = EXT_CSD_POWER_OFF_SHORT;
> +                     timeout = card->ext_csd.generic_cmd6_time;
> +                     card->poweroff_notify_state = MMC_POWEROFF_SHORT;
> +             } else {
> +                     notify_type = EXT_CSD_POWER_OFF_LONG;
> +                     timeout = card->ext_csd.power_off_longtime;
> +                     card->poweroff_notify_state = MMC_POWEROFF_LONG;
> +             }
> +
> +             err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> +                              

Re: [PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5

2011-10-17 Thread Chris Ball
Hi,

On Tue, Oct 18 2011, Jaehoon Chung wrote:
> Hi Girish.
>
> This patch is merged on mmc-next..did you know that?
> And if deleted commit id bd3151f6c55c553bed2c0df72792841457b75bb5,
> I will re-work for eMMC feature4.5.
> git://git.infradead.org/users/kmpark/linux-2.6-samsung emmc4.5
>
> To Chris.
> If you re-commit this patch, i also change "git pull request".
> there are duplicated code in Notify patch, so i didn't add to cache patch.

I think I've fixed everything up -- I merged your pull request, included
Girish's new patch, and moved the #defines for the CACHE_CTRL patch over
to that patch instead of the power class patch.  Would be great if you
can double-check that the merge all looks okay to you.

Thanks,

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


Re: [PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5

2011-10-17 Thread Jaehoon Chung
Hi Girish.

I know you're worked based-on latest mmc-next.
But this patch is already merged on mmc-next...

Merged patch is already included #define MMC_CAP2_CACHE_CTRL and 
EXT_CSD_FLUSH_CACHE.

So i didn't add them in [mmc: core: Add cache control for eMMC4.5 device] on 
the below repository
git://git.infradead.org/users/kmpark/linux-2.6-samsung emmc4.5

What do you want how i do? :)

Best regards,
Jaehoon Chung


On 10/18/2011 02:25 PM, Girish K S wrote:

> On 18 October 2011 10:49, Girish K S  wrote:
>> On 18 October 2011 10:46, Jaehoon Chung  wrote:
>>> Hi Girish.
>>>
>>> This patch is merged on mmc-next..did you know that?
>>> And if deleted commit id bd3151f6c55c553bed2c0df72792841457b75bb5,
>>> I will re-work for eMMC feature4.5.
>>> git://git.infradead.org/users/kmpark/linux-2.6-samsung emmc4.5
>>>
>>> To Chris.
>>> If you re-commit this patch, i also change "git pull request".
>>> there are duplicated code in Notify patch, so i didn't add to cache patch.
>>> HI Jaehoon,
>>  I have already bought it to the notice of Chris. After discussing
>> with Chris i am resending the complete patch.
>>> Regards,
>>> Jaehoon Chung
>>> Adding to it. In your mail with subject "[GIT PULL v2] Add eMMC4.5 feature 
>>> for v3.2", for version 2 changes it is mentioned
> that power notify feature is removed. Thats the reason i rebased my
> patch to Chris's mmc-next branch and resent.
>>> On 10/18/2011 02:05 PM, Girish K S wrote:
>>>
 This patch adds the support for power off notify feature, available in
 eMMC 4.5 devices. If the the host has support for this feature, then the
 mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION
 byte in the extended csd register with a value 1(POWER_ON).

 For suspend mode short timeout is used, whereas for the normal poweroff 
 long
 timeout is used.

 cc: Chris Ball 
 Signed-off-by: Girish K S 
 Signed-off-by: Jaehoon Chung 
 ---
 Changes in V9:
   Removed the macros not related with the PowerOff notify feature.
   The previous patch with commit id
   bd3151f6c55c553bed2c0df72792841457b75bb5 should be deleted before
   applying this patch.
 Changes in V8:
   Updated with review comments of Chris Ball and rebased to
   chris-mmc/mmc-next branch.
 Changes in V7:
   Rebased to chris-mmc/mmc-next branch. merged to patches to single
   patch.
 Changes in V6:
   Fixes checkpatch errors. The patches are generated after rebasing to
chris's mmc-next branch.
 Changes in V5:
   This patch version fixes the problem with power off notify function,
when called for the first time and card is not yet initialised.
 Changes in V4:
   Updated with review comments of Jeon
 Changes in V2:
   Adds poweroff notification handling in suspend/normal.

  drivers/mmc/core/core.c  |   34 ++
  drivers/mmc/core/mmc.c   |   23 +--
  drivers/mmc/host/sdhci.c |9 +
  include/linux/mmc/card.h |6 ++
  include/linux/mmc/host.h |5 +
  include/linux/mmc/mmc.h  |6 ++
  6 files changed, 81 insertions(+), 2 deletions(-)

 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
 index 61d7730..b1eca96 100644
 --- a/drivers/mmc/core/core.c
 +++ b/drivers/mmc/core/core.c
 @@ -1212,11 +1212,43 @@ static void mmc_power_up(struct mmc_host *host)

  void mmc_power_off(struct mmc_host *host)
  {
 + struct mmc_card *card;
 + unsigned int notify_type;
 + unsigned int timeout;
 + int err;
 +
   mmc_host_clk_hold(host);

 + card = host->card;
   host->ios.clock = 0;
   host->ios.vdd = 0;

 + if (card && mmc_card_mmc(card) &&
 + card->poweroff_notify_state == MMC_POWERED_ON) {
 +
 + if (host->power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) {
 + notify_type = EXT_CSD_POWER_OFF_SHORT;
 + timeout = card->ext_csd.generic_cmd6_time;
 + card->poweroff_notify_state = MMC_POWEROFF_SHORT;
 + } else {
 + notify_type = EXT_CSD_POWER_OFF_LONG;
 + timeout = card->ext_csd.power_off_longtime;
 + card->poweroff_notify_state = MMC_POWEROFF_LONG;
 + }
 +
 + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
 +  EXT_CSD_POWER_OFF_NOTIFICATION,
 +  notify_type, timeout);
 +
 + if (err && err != -EBADMSG)
 + pr_err("Device failed to respond within %d poweroff "
 +"time. Forcefully powering down the device\n",
 + 

Re: [PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5

2011-10-17 Thread Girish K S
On 18 October 2011 10:49, Girish K S  wrote:
> On 18 October 2011 10:46, Jaehoon Chung  wrote:
>> Hi Girish.
>>
>> This patch is merged on mmc-next..did you know that?
>> And if deleted commit id bd3151f6c55c553bed2c0df72792841457b75bb5,
>> I will re-work for eMMC feature4.5.
>> git://git.infradead.org/users/kmpark/linux-2.6-samsung emmc4.5
>>
>> To Chris.
>> If you re-commit this patch, i also change "git pull request".
>> there are duplicated code in Notify patch, so i didn't add to cache patch.
>>HI Jaehoon,
>  I have already bought it to the notice of Chris. After discussing
> with Chris i am resending the complete patch.
>> Regards,
>> Jaehoon Chung
>>Adding to it. In your mail with subject "[GIT PULL v2] Add eMMC4.5 feature 
>>for v3.2", for version 2 changes it is mentioned
that power notify feature is removed. Thats the reason i rebased my
patch to Chris's mmc-next branch and resent.
>> On 10/18/2011 02:05 PM, Girish K S wrote:
>>
>>> This patch adds the support for power off notify feature, available in
>>> eMMC 4.5 devices. If the the host has support for this feature, then the
>>> mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION
>>> byte in the extended csd register with a value 1(POWER_ON).
>>>
>>> For suspend mode short timeout is used, whereas for the normal poweroff long
>>> timeout is used.
>>>
>>> cc: Chris Ball 
>>> Signed-off-by: Girish K S 
>>> Signed-off-by: Jaehoon Chung 
>>> ---
>>> Changes in V9:
>>>       Removed the macros not related with the PowerOff notify feature.
>>>       The previous patch with commit id
>>>       bd3151f6c55c553bed2c0df72792841457b75bb5 should be deleted before
>>>       applying this patch.
>>> Changes in V8:
>>>       Updated with review comments of Chris Ball and rebased to
>>>       chris-mmc/mmc-next branch.
>>> Changes in V7:
>>>       Rebased to chris-mmc/mmc-next branch. merged to patches to single
>>>       patch.
>>> Changes in V6:
>>>       Fixes checkpatch errors. The patches are generated after rebasing to
>>>        chris's mmc-next branch.
>>> Changes in V5:
>>>       This patch version fixes the problem with power off notify function,
>>>        when called for the first time and card is not yet initialised.
>>> Changes in V4:
>>>       Updated with review comments of Jeon
>>> Changes in V2:
>>>       Adds poweroff notification handling in suspend/normal.
>>>
>>>  drivers/mmc/core/core.c  |   34 ++
>>>  drivers/mmc/core/mmc.c   |   23 +--
>>>  drivers/mmc/host/sdhci.c |    9 +
>>>  include/linux/mmc/card.h |    6 ++
>>>  include/linux/mmc/host.h |    5 +
>>>  include/linux/mmc/mmc.h  |    6 ++
>>>  6 files changed, 81 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>>> index 61d7730..b1eca96 100644
>>> --- a/drivers/mmc/core/core.c
>>> +++ b/drivers/mmc/core/core.c
>>> @@ -1212,11 +1212,43 @@ static void mmc_power_up(struct mmc_host *host)
>>>
>>>  void mmc_power_off(struct mmc_host *host)
>>>  {
>>> +     struct mmc_card *card;
>>> +     unsigned int notify_type;
>>> +     unsigned int timeout;
>>> +     int err;
>>> +
>>>       mmc_host_clk_hold(host);
>>>
>>> +     card = host->card;
>>>       host->ios.clock = 0;
>>>       host->ios.vdd = 0;
>>>
>>> +     if (card && mmc_card_mmc(card) &&
>>> +         card->poweroff_notify_state == MMC_POWERED_ON) {
>>> +
>>> +             if (host->power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) {
>>> +                     notify_type = EXT_CSD_POWER_OFF_SHORT;
>>> +                     timeout = card->ext_csd.generic_cmd6_time;
>>> +                     card->poweroff_notify_state = MMC_POWEROFF_SHORT;
>>> +             } else {
>>> +                     notify_type = EXT_CSD_POWER_OFF_LONG;
>>> +                     timeout = card->ext_csd.power_off_longtime;
>>> +                     card->poweroff_notify_state = MMC_POWEROFF_LONG;
>>> +             }
>>> +
>>> +             err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>>> +                              EXT_CSD_POWER_OFF_NOTIFICATION,
>>> +                              notify_type, timeout);
>>> +
>>> +             if (err && err != -EBADMSG)
>>> +                     pr_err("Device failed to respond within %d poweroff "
>>> +                            "time. Forcefully powering down the device\n",
>>> +                            timeout);
>>> +
>>> +             /* Set the card state to no notification after the poweroff */
>>> +             card->poweroff_notify_state = MMC_NO_POWER_NOTIFICATION;
>>> +     }
>>> +
>>>       /*
>>>        * Reset ocr mask to be the highest possible voltage supported for
>>>        * this mmc host. This value will be used at next power up.
>>> @@ -2208,6 +2240,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
>>>
>>>               spin_lock_irqsave(&host->lock, flags);
>>>               host->rescan_disable = 1;
>>> +             host->power_notify_type

Re: [PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5

2011-10-17 Thread Girish K S
On 18 October 2011 10:46, Jaehoon Chung  wrote:
> Hi Girish.
>
> This patch is merged on mmc-next..did you know that?
> And if deleted commit id bd3151f6c55c553bed2c0df72792841457b75bb5,
> I will re-work for eMMC feature4.5.
> git://git.infradead.org/users/kmpark/linux-2.6-samsung emmc4.5
>
> To Chris.
> If you re-commit this patch, i also change "git pull request".
> there are duplicated code in Notify patch, so i didn't add to cache patch.
>HI Jaehoon,
 I have already bought it to the notice of Chris. After discussing
with Chris i am resending the complete patch.
> Regards,
> Jaehoon Chung
>
> On 10/18/2011 02:05 PM, Girish K S wrote:
>
>> This patch adds the support for power off notify feature, available in
>> eMMC 4.5 devices. If the the host has support for this feature, then the
>> mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION
>> byte in the extended csd register with a value 1(POWER_ON).
>>
>> For suspend mode short timeout is used, whereas for the normal poweroff long
>> timeout is used.
>>
>> cc: Chris Ball 
>> Signed-off-by: Girish K S 
>> Signed-off-by: Jaehoon Chung 
>> ---
>> Changes in V9:
>>       Removed the macros not related with the PowerOff notify feature.
>>       The previous patch with commit id
>>       bd3151f6c55c553bed2c0df72792841457b75bb5 should be deleted before
>>       applying this patch.
>> Changes in V8:
>>       Updated with review comments of Chris Ball and rebased to
>>       chris-mmc/mmc-next branch.
>> Changes in V7:
>>       Rebased to chris-mmc/mmc-next branch. merged to patches to single
>>       patch.
>> Changes in V6:
>>       Fixes checkpatch errors. The patches are generated after rebasing to
>>        chris's mmc-next branch.
>> Changes in V5:
>>       This patch version fixes the problem with power off notify function,
>>        when called for the first time and card is not yet initialised.
>> Changes in V4:
>>       Updated with review comments of Jeon
>> Changes in V2:
>>       Adds poweroff notification handling in suspend/normal.
>>
>>  drivers/mmc/core/core.c  |   34 ++
>>  drivers/mmc/core/mmc.c   |   23 +--
>>  drivers/mmc/host/sdhci.c |    9 +
>>  include/linux/mmc/card.h |    6 ++
>>  include/linux/mmc/host.h |    5 +
>>  include/linux/mmc/mmc.h  |    6 ++
>>  6 files changed, 81 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>> index 61d7730..b1eca96 100644
>> --- a/drivers/mmc/core/core.c
>> +++ b/drivers/mmc/core/core.c
>> @@ -1212,11 +1212,43 @@ static void mmc_power_up(struct mmc_host *host)
>>
>>  void mmc_power_off(struct mmc_host *host)
>>  {
>> +     struct mmc_card *card;
>> +     unsigned int notify_type;
>> +     unsigned int timeout;
>> +     int err;
>> +
>>       mmc_host_clk_hold(host);
>>
>> +     card = host->card;
>>       host->ios.clock = 0;
>>       host->ios.vdd = 0;
>>
>> +     if (card && mmc_card_mmc(card) &&
>> +         card->poweroff_notify_state == MMC_POWERED_ON) {
>> +
>> +             if (host->power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) {
>> +                     notify_type = EXT_CSD_POWER_OFF_SHORT;
>> +                     timeout = card->ext_csd.generic_cmd6_time;
>> +                     card->poweroff_notify_state = MMC_POWEROFF_SHORT;
>> +             } else {
>> +                     notify_type = EXT_CSD_POWER_OFF_LONG;
>> +                     timeout = card->ext_csd.power_off_longtime;
>> +                     card->poweroff_notify_state = MMC_POWEROFF_LONG;
>> +             }
>> +
>> +             err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>> +                              EXT_CSD_POWER_OFF_NOTIFICATION,
>> +                              notify_type, timeout);
>> +
>> +             if (err && err != -EBADMSG)
>> +                     pr_err("Device failed to respond within %d poweroff "
>> +                            "time. Forcefully powering down the device\n",
>> +                            timeout);
>> +
>> +             /* Set the card state to no notification after the poweroff */
>> +             card->poweroff_notify_state = MMC_NO_POWER_NOTIFICATION;
>> +     }
>> +
>>       /*
>>        * Reset ocr mask to be the highest possible voltage supported for
>>        * this mmc host. This value will be used at next power up.
>> @@ -2208,6 +2240,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
>>
>>               spin_lock_irqsave(&host->lock, flags);
>>               host->rescan_disable = 1;
>> +             host->power_notify_type = MMC_HOST_PW_NOTIFY_SHORT;
>>               spin_unlock_irqrestore(&host->lock, flags);
>>               cancel_delayed_work_sync(&host->detect);
>>
>> @@ -2231,6 +2264,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
>>
>>               spin_lock_irqsave(&host->lock, flags);
>>               host->rescan_disable = 0;
>> +             host->power_notify_type = MMC_HOST_PW_NOTIFY_LONG;

Re: [PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5

2011-10-17 Thread Jaehoon Chung
Hi Girish.

This patch is merged on mmc-next..did you know that?
And if deleted commit id bd3151f6c55c553bed2c0df72792841457b75bb5,
I will re-work for eMMC feature4.5.
git://git.infradead.org/users/kmpark/linux-2.6-samsung emmc4.5

To Chris.
If you re-commit this patch, i also change "git pull request".
there are duplicated code in Notify patch, so i didn't add to cache patch.

Regards,
Jaehoon Chung

On 10/18/2011 02:05 PM, Girish K S wrote:

> This patch adds the support for power off notify feature, available in
> eMMC 4.5 devices. If the the host has support for this feature, then the
> mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION
> byte in the extended csd register with a value 1(POWER_ON).
> 
> For suspend mode short timeout is used, whereas for the normal poweroff long
> timeout is used.
> 
> cc: Chris Ball 
> Signed-off-by: Girish K S 
> Signed-off-by: Jaehoon Chung 
> ---
> Changes in V9:
>   Removed the macros not related with the PowerOff notify feature.
>   The previous patch with commit id
>   bd3151f6c55c553bed2c0df72792841457b75bb5 should be deleted before
>   applying this patch.
> Changes in V8:
>   Updated with review comments of Chris Ball and rebased to 
>   chris-mmc/mmc-next branch.
> Changes in V7:
>   Rebased to chris-mmc/mmc-next branch. merged to patches to single
>   patch.
> Changes in V6:
>   Fixes checkpatch errors. The patches are generated after rebasing to
>chris's mmc-next branch.
> Changes in V5:
>   This patch version fixes the problem with power off notify function,
>when called for the first time and card is not yet initialised.
> Changes in V4:
>   Updated with review comments of Jeon
> Changes in V2:
>   Adds poweroff notification handling in suspend/normal.
> 
>  drivers/mmc/core/core.c  |   34 ++
>  drivers/mmc/core/mmc.c   |   23 +--
>  drivers/mmc/host/sdhci.c |9 +
>  include/linux/mmc/card.h |6 ++
>  include/linux/mmc/host.h |5 +
>  include/linux/mmc/mmc.h  |6 ++
>  6 files changed, 81 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 61d7730..b1eca96 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1212,11 +1212,43 @@ static void mmc_power_up(struct mmc_host *host)
>  
>  void mmc_power_off(struct mmc_host *host)
>  {
> + struct mmc_card *card;
> + unsigned int notify_type;
> + unsigned int timeout;
> + int err;
> +
>   mmc_host_clk_hold(host);
>  
> + card = host->card;
>   host->ios.clock = 0;
>   host->ios.vdd = 0;
>  
> + if (card && mmc_card_mmc(card) &&
> + card->poweroff_notify_state == MMC_POWERED_ON) {
> +
> + if (host->power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) {
> + notify_type = EXT_CSD_POWER_OFF_SHORT;
> + timeout = card->ext_csd.generic_cmd6_time;
> + card->poweroff_notify_state = MMC_POWEROFF_SHORT;
> + } else {
> + notify_type = EXT_CSD_POWER_OFF_LONG;
> + timeout = card->ext_csd.power_off_longtime;
> + card->poweroff_notify_state = MMC_POWEROFF_LONG;
> + }
> +
> + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> +  EXT_CSD_POWER_OFF_NOTIFICATION,
> +  notify_type, timeout);
> +
> + if (err && err != -EBADMSG)
> + pr_err("Device failed to respond within %d poweroff "
> +"time. Forcefully powering down the device\n",
> +timeout);
> +
> + /* Set the card state to no notification after the poweroff */
> + card->poweroff_notify_state = MMC_NO_POWER_NOTIFICATION;
> + }
> +
>   /*
>* Reset ocr mask to be the highest possible voltage supported for
>* this mmc host. This value will be used at next power up.
> @@ -2208,6 +2240,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
>  
>   spin_lock_irqsave(&host->lock, flags);
>   host->rescan_disable = 1;
> + host->power_notify_type = MMC_HOST_PW_NOTIFY_SHORT;
>   spin_unlock_irqrestore(&host->lock, flags);
>   cancel_delayed_work_sync(&host->detect);
>  
> @@ -2231,6 +2264,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
>  
>   spin_lock_irqsave(&host->lock, flags);
>   host->rescan_disable = 0;
> + host->power_notify_type = MMC_HOST_PW_NOTIFY_LONG;
>   spin_unlock_irqrestore(&host->lock, flags);
>   mmc_detect_change(host, 0);
>  
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 4e869d3..f8ea938 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -458,10 +458,12

[PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5

2011-10-17 Thread Girish K S
This patch adds the support for power off notify feature, available in
eMMC 4.5 devices. If the the host has support for this feature, then the
mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION
byte in the extended csd register with a value 1(POWER_ON).

For suspend mode short timeout is used, whereas for the normal poweroff long
timeout is used.

cc: Chris Ball 
Signed-off-by: Girish K S 
Signed-off-by: Jaehoon Chung 
---
Changes in V9:
Removed the macros not related with the PowerOff notify feature.
The previous patch with commit id
bd3151f6c55c553bed2c0df72792841457b75bb5 should be deleted before
applying this patch.
Changes in V8:
Updated with review comments of Chris Ball and rebased to 
chris-mmc/mmc-next branch.
Changes in V7:
Rebased to chris-mmc/mmc-next branch. merged to patches to single
patch.
Changes in V6:
Fixes checkpatch errors. The patches are generated after rebasing to
 chris's mmc-next branch.
Changes in V5:
This patch version fixes the problem with power off notify function,
 when called for the first time and card is not yet initialised.
Changes in V4:
Updated with review comments of Jeon
Changes in V2:
Adds poweroff notification handling in suspend/normal.

 drivers/mmc/core/core.c  |   34 ++
 drivers/mmc/core/mmc.c   |   23 +--
 drivers/mmc/host/sdhci.c |9 +
 include/linux/mmc/card.h |6 ++
 include/linux/mmc/host.h |5 +
 include/linux/mmc/mmc.h  |6 ++
 6 files changed, 81 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 61d7730..b1eca96 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1212,11 +1212,43 @@ static void mmc_power_up(struct mmc_host *host)
 
 void mmc_power_off(struct mmc_host *host)
 {
+   struct mmc_card *card;
+   unsigned int notify_type;
+   unsigned int timeout;
+   int err;
+
mmc_host_clk_hold(host);
 
+   card = host->card;
host->ios.clock = 0;
host->ios.vdd = 0;
 
+   if (card && mmc_card_mmc(card) &&
+   card->poweroff_notify_state == MMC_POWERED_ON) {
+
+   if (host->power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) {
+   notify_type = EXT_CSD_POWER_OFF_SHORT;
+   timeout = card->ext_csd.generic_cmd6_time;
+   card->poweroff_notify_state = MMC_POWEROFF_SHORT;
+   } else {
+   notify_type = EXT_CSD_POWER_OFF_LONG;
+   timeout = card->ext_csd.power_off_longtime;
+   card->poweroff_notify_state = MMC_POWEROFF_LONG;
+   }
+
+   err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
+EXT_CSD_POWER_OFF_NOTIFICATION,
+notify_type, timeout);
+
+   if (err && err != -EBADMSG)
+   pr_err("Device failed to respond within %d poweroff "
+  "time. Forcefully powering down the device\n",
+  timeout);
+
+   /* Set the card state to no notification after the poweroff */
+   card->poweroff_notify_state = MMC_NO_POWER_NOTIFICATION;
+   }
+
/*
 * Reset ocr mask to be the highest possible voltage supported for
 * this mmc host. This value will be used at next power up.
@@ -2208,6 +2240,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
 
spin_lock_irqsave(&host->lock, flags);
host->rescan_disable = 1;
+   host->power_notify_type = MMC_HOST_PW_NOTIFY_SHORT;
spin_unlock_irqrestore(&host->lock, flags);
cancel_delayed_work_sync(&host->detect);
 
@@ -2231,6 +2264,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
 
spin_lock_irqsave(&host->lock, flags);
host->rescan_disable = 0;
+   host->power_notify_type = MMC_HOST_PW_NOTIFY_LONG;
spin_unlock_irqrestore(&host->lock, flags);
mmc_detect_change(host, 0);
 
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 4e869d3..f8ea938 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -458,10 +458,12 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 
*ext_csd)
else
card->erased_byte = 0x0;
 
-   if (card->ext_csd.rev >= 6)
+   if (card->ext_csd.rev >= 6) {
card->ext_csd.generic_cmd6_time = 10 *
ext_csd[EXT_CSD_GENERIC_CMD6_TIME];
-   else
+   card->ext_csd.power_off_longtime = 10 *
+   ext_csd[EXT_CSD_POWER_OFF_LONG_TIME];
+   } else
card->ext_csd.generic_cmd6_time = 0;
 
 out:
@@ -846,6 +848,23 @@ static int mmc_i