* [PATCH] mmc: core: Add power off notify feature(eMMC 4.5)
@ 2011-09-02 7:25 Girish K S
2011-09-02 8:18 ` Kyungmin Park
0 siblings, 1 reply; 3+ messages in thread
From: Girish K S @ 2011-09-02 7:25 UTC (permalink / raw)
To: linux-mmc; +Cc: cjb, kgene.kim, patches, linux-samsung-soc, 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).
This patch should be applied after Seungwon Jeon's
patch for cmd6 timeout.
Signed-off-by: Girish K S <girish.shivananjappa@linaro.org>
---
drivers/mmc/core/mmc.c | 19 +++++++++++++++++--
include/linux/mmc/card.h | 1 +
include/linux/mmc/host.h | 1 +
include/linux/mmc/mmc.h | 8 +++++++-
4 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 68eb368..2f06b37 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -410,10 +410,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];
-
+ card->ext_csd.power_off_longtime = 10 *
+ ext_csd[EXT_CSD_POWER_OFF_LONG_TIME];
+ }
out:
return err;
}
@@ -710,6 +712,19 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
}
/*
+ * If the host supports the power_off_notify capability then
+ * set the notification byte in the ext_csd register of device
+ */
+ if (host->caps & MMC_CAP_POWER_OFF_NOTIFY) {
+ err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
+ EXT_CSD_POWER_OFF_NOTIFICATION,
+ EXT_CSD_POWER_ON,
+ card->ext_csd.generic_cmd6_time);
+ if (err && err != -EBADMSG)
+ goto free_card;
+ }
+
+ /*
* Activate high speed (if supported)
*/
if ((card->ext_csd.hs_max_dtr != 0) &&
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index e992fe3..2bf2843 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -53,6 +53,7 @@ struct mmc_ext_csd {
unsigned int part_time; /* Units: ms */
unsigned int sa_timeout; /* Units: 100ns */
unsigned int generic_cmd6_time; /* Units: ms */
+ unsigned int power_off_longtime; /* Units: ms */
unsigned int hs_max_dtr;
unsigned int sectors;
unsigned int card_type;
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 1d09562..21c85e1 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -229,6 +229,7 @@ struct mmc_host {
#define MMC_CAP_MAX_CURRENT_600 (1 << 28) /* Host max current limit is 600mA */
#define MMC_CAP_MAX_CURRENT_800 (1 << 29) /* Host max current limit is 800mA */
#define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */
+#define MMC_CAP_POWER_OFF_NOTIFY (1 << 31)/*NOtify poweroff supported */
mmc_pm_flag_t pm_caps; /* supported pm features */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index e869f00..8e86d77 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -269,7 +269,7 @@ struct _mmc_csd {
/*
* EXT_CSD fields
*/
-
+#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */
#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
#define EXT_CSD_WR_REL_PARAM 166 /* RO */
@@ -293,6 +293,7 @@ struct _mmc_csd {
#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */
#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */
#define EXT_CSD_TRIM_MULT 232 /* RO */
+#define EXT_CSD_POWER_OFF_LONG_TIME 247 /*RO*/
#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */
/*
@@ -329,6 +330,11 @@ struct _mmc_csd {
#define EXT_CSD_SEC_BD_BLK_EN BIT(2)
#define EXT_CSD_SEC_GB_CL_EN BIT(4)
+#define EXT_CSD_NO_POWER_NOTIFICATION 0
+#define EXT_CSD_POWER_ON 1
+#define EXT_CSD_POWER_OFF_SHORT 2
+#define EXT_CSD_POWER_OFF_LONG 3
+
/*
* MMC_SWITCH access modes
*/
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: core: Add power off notify feature(eMMC 4.5)
2011-09-02 7:25 [PATCH] mmc: core: Add power off notify feature(eMMC 4.5) Girish K S
@ 2011-09-02 8:18 ` Kyungmin Park
2011-09-02 9:08 ` Girish K S
0 siblings, 1 reply; 3+ messages in thread
From: Kyungmin Park @ 2011-09-02 8:18 UTC (permalink / raw)
To: Girish K S, 정재훈, Seungwon Jeon
Cc: linux-mmc, cjb, kgene.kim, patches, linux-samsung-soc
Hi,
Good job on eMMC v4.5. but this patch is incomplete for power off
notification feature.
Now you just enable the Power off notification, and don't handle the
reaming one.
As you read the spec, it takes more time the sleep & wake-up and next
booting time if no proper power off notification
Please also consider it.
Thank you,
Kyungmin Park
On Fri, Sep 2, 2011 at 4:25 PM, Girish K S
<girish.shivananjappa@linaro.org> 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).
> This patch should be applied after Seungwon Jeon's
> patch for cmd6 timeout.
>
> Signed-off-by: Girish K S <girish.shivananjappa@linaro.org>
> ---
> drivers/mmc/core/mmc.c | 19 +++++++++++++++++--
> include/linux/mmc/card.h | 1 +
> include/linux/mmc/host.h | 1 +
> include/linux/mmc/mmc.h | 8 +++++++-
> 4 files changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 68eb368..2f06b37 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -410,10 +410,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];
> -
> + card->ext_csd.power_off_longtime = 10 *
> + ext_csd[EXT_CSD_POWER_OFF_LONG_TIME];
> + }
> out:
> return err;
> }
> @@ -710,6 +712,19 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
> }
>
> /*
> + * If the host supports the power_off_notify capability then
> + * set the notification byte in the ext_csd register of device
> + */
> + if (host->caps & MMC_CAP_POWER_OFF_NOTIFY) {
> + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> + EXT_CSD_POWER_OFF_NOTIFICATION,
> + EXT_CSD_POWER_ON,
> + card->ext_csd.generic_cmd6_time);
> + if (err && err != -EBADMSG)
> + goto free_card;
> + }
> +
> + /*
> * Activate high speed (if supported)
> */
> if ((card->ext_csd.hs_max_dtr != 0) &&
> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
> index e992fe3..2bf2843 100644
> --- a/include/linux/mmc/card.h
> +++ b/include/linux/mmc/card.h
> @@ -53,6 +53,7 @@ struct mmc_ext_csd {
> unsigned int part_time; /* Units: ms */
> unsigned int sa_timeout; /* Units: 100ns */
> unsigned int generic_cmd6_time; /* Units: ms */
> + unsigned int power_off_longtime; /* Units: ms */
> unsigned int hs_max_dtr;
> unsigned int sectors;
> unsigned int card_type;
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 1d09562..21c85e1 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -229,6 +229,7 @@ struct mmc_host {
> #define MMC_CAP_MAX_CURRENT_600 (1 << 28) /* Host max current limit is 600mA */
> #define MMC_CAP_MAX_CURRENT_800 (1 << 29) /* Host max current limit is 800mA */
> #define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */
> +#define MMC_CAP_POWER_OFF_NOTIFY (1 << 31)/*NOtify poweroff supported */
>
> mmc_pm_flag_t pm_caps; /* supported pm features */
>
> diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
> index e869f00..8e86d77 100644
> --- a/include/linux/mmc/mmc.h
> +++ b/include/linux/mmc/mmc.h
> @@ -269,7 +269,7 @@ struct _mmc_csd {
> /*
> * EXT_CSD fields
> */
> -
> +#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */
> #define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
> #define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
> #define EXT_CSD_WR_REL_PARAM 166 /* RO */
> @@ -293,6 +293,7 @@ struct _mmc_csd {
> #define EXT_CSD_SEC_ERASE_MULT 230 /* RO */
> #define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */
> #define EXT_CSD_TRIM_MULT 232 /* RO */
> +#define EXT_CSD_POWER_OFF_LONG_TIME 247 /*RO*/
> #define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */
>
> /*
> @@ -329,6 +330,11 @@ struct _mmc_csd {
> #define EXT_CSD_SEC_BD_BLK_EN BIT(2)
> #define EXT_CSD_SEC_GB_CL_EN BIT(4)
>
> +#define EXT_CSD_NO_POWER_NOTIFICATION 0
> +#define EXT_CSD_POWER_ON 1
> +#define EXT_CSD_POWER_OFF_SHORT 2
> +#define EXT_CSD_POWER_OFF_LONG 3
> +
> /*
> * MMC_SWITCH access modes
> */
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 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] 3+ messages in thread
* Re: [PATCH] mmc: core: Add power off notify feature(eMMC 4.5)
2011-09-02 8:18 ` Kyungmin Park
@ 2011-09-02 9:08 ` Girish K S
0 siblings, 0 replies; 3+ messages in thread
From: Girish K S @ 2011-09-02 9:08 UTC (permalink / raw)
To: Kyungmin Park
Cc: 정재훈,
Seungwon Jeon, linux-mmc, cjb, kgene.kim, patches,
linux-samsung-soc
dear mr park,
I will consider it and update the poweroff handling.
thanks a lot
girish
On 2 September 2011 13:48, Kyungmin Park <kmpark@infradead.org> wrote:
> Hi,
>
> Good job on eMMC v4.5. but this patch is incomplete for power off
> notification feature.
> Now you just enable the Power off notification, and don't handle the
> reaming one.
> As you read the spec, it takes more time the sleep & wake-up and next
> booting time if no proper power off notification
>
> Please also consider it.
>
> Thank you,
> Kyungmin Park
>
> On Fri, Sep 2, 2011 at 4:25 PM, Girish K S
> <girish.shivananjappa@linaro.org> 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).
>> This patch should be applied after Seungwon Jeon's
>> patch for cmd6 timeout.
>>
>> Signed-off-by: Girish K S <girish.shivananjappa@linaro.org>
>> ---
>> drivers/mmc/core/mmc.c | 19 +++++++++++++++++--
>> include/linux/mmc/card.h | 1 +
>> include/linux/mmc/host.h | 1 +
>> include/linux/mmc/mmc.h | 8 +++++++-
>> 4 files changed, 26 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
>> index 68eb368..2f06b37 100644
>> --- a/drivers/mmc/core/mmc.c
>> +++ b/drivers/mmc/core/mmc.c
>> @@ -410,10 +410,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];
>> -
>> + card->ext_csd.power_off_longtime = 10 *
>> + ext_csd[EXT_CSD_POWER_OFF_LONG_TIME];
>> + }
>> out:
>> return err;
>> }
>> @@ -710,6 +712,19 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
>> }
>>
>> /*
>> + * If the host supports the power_off_notify capability then
>> + * set the notification byte in the ext_csd register of device
>> + */
>> + if (host->caps & MMC_CAP_POWER_OFF_NOTIFY) {
>> + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>> + EXT_CSD_POWER_OFF_NOTIFICATION,
>> + EXT_CSD_POWER_ON,
>> + card->ext_csd.generic_cmd6_time);
>> + if (err && err != -EBADMSG)
>> + goto free_card;
>> + }
>> +
>> + /*
>> * Activate high speed (if supported)
>> */
>> if ((card->ext_csd.hs_max_dtr != 0) &&
>> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
>> index e992fe3..2bf2843 100644
>> --- a/include/linux/mmc/card.h
>> +++ b/include/linux/mmc/card.h
>> @@ -53,6 +53,7 @@ struct mmc_ext_csd {
>> unsigned int part_time; /* Units: ms */
>> unsigned int sa_timeout; /* Units: 100ns */
>> unsigned int generic_cmd6_time; /* Units: ms */
>> + unsigned int power_off_longtime; /* Units: ms */
>> unsigned int hs_max_dtr;
>> unsigned int sectors;
>> unsigned int card_type;
>> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
>> index 1d09562..21c85e1 100644
>> --- a/include/linux/mmc/host.h
>> +++ b/include/linux/mmc/host.h
>> @@ -229,6 +229,7 @@ struct mmc_host {
>> #define MMC_CAP_MAX_CURRENT_600 (1 << 28) /* Host max current limit is 600mA */
>> #define MMC_CAP_MAX_CURRENT_800 (1 << 29) /* Host max current limit is 800mA */
>> #define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */
>> +#define MMC_CAP_POWER_OFF_NOTIFY (1 << 31)/*NOtify poweroff supported */
>>
>> mmc_pm_flag_t pm_caps; /* supported pm features */
>>
>> diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
>> index e869f00..8e86d77 100644
>> --- a/include/linux/mmc/mmc.h
>> +++ b/include/linux/mmc/mmc.h
>> @@ -269,7 +269,7 @@ struct _mmc_csd {
>> /*
>> * EXT_CSD fields
>> */
>> -
>> +#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */
>> #define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
>> #define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
>> #define EXT_CSD_WR_REL_PARAM 166 /* RO */
>> @@ -293,6 +293,7 @@ struct _mmc_csd {
>> #define EXT_CSD_SEC_ERASE_MULT 230 /* RO */
>> #define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */
>> #define EXT_CSD_TRIM_MULT 232 /* RO */
>> +#define EXT_CSD_POWER_OFF_LONG_TIME 247 /*RO*/
>> #define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */
>>
>> /*
>> @@ -329,6 +330,11 @@ struct _mmc_csd {
>> #define EXT_CSD_SEC_BD_BLK_EN BIT(2)
>> #define EXT_CSD_SEC_GB_CL_EN BIT(4)
>>
>> +#define EXT_CSD_NO_POWER_NOTIFICATION 0
>> +#define EXT_CSD_POWER_ON 1
>> +#define EXT_CSD_POWER_OFF_SHORT 2
>> +#define EXT_CSD_POWER_OFF_LONG 3
>> +
>> /*
>> * MMC_SWITCH access modes
>> */
>> --
>> 1.7.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 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] 3+ messages in thread
end of thread, other threads:[~2011-09-02 9:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-02 7:25 [PATCH] mmc: core: Add power off notify feature(eMMC 4.5) Girish K S
2011-09-02 8:18 ` Kyungmin Park
2011-09-02 9:08 ` Girish K S
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.