* [PATCH 1/4] mmc: core: add high-capacity erase size capability flag
2012-02-07 12:48 [PATCH 0/4] mmc: add a cap and a quirk Adrian Hunter
@ 2012-02-07 12:48 ` Adrian Hunter
2012-02-08 16:32 ` Ulf Hansson
2012-02-08 22:38 ` Linus Walleij
2012-02-07 12:48 ` [PATCH 2/4] mmc: sdhci-pci: select HC erase size for Medfield eMMC Adrian Hunter
` (3 subsequent siblings)
4 siblings, 2 replies; 11+ messages in thread
From: Adrian Hunter @ 2012-02-07 12:48 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc, Adrian Hunter
Let drivers specify the use of high-capacity erase size.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/core/mmc.c | 3 ++-
include/linux/mmc/host.h | 1 +
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 6b13776..bd2f71f 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -949,7 +949,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
* If enhanced_area_en is TRUE, host needs to enable ERASE_GRP_DEF
* bit. This bit will be lost every time after a reset or power off.
*/
- if (card->ext_csd.enhanced_area_en) {
+ if (card->ext_csd.enhanced_area_en ||
+ (card->ext_csd.rev >= 3 && (host->caps2 & MMC_CAP2_HC_ERASE_SZ))) {
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_ERASE_GROUP_DEF, 1,
card->ext_csd.generic_cmd6_time);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 20d7c82..c7ce9d2 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -258,6 +258,7 @@ struct mmc_host {
#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
MMC_CAP2_HS200_1_2V_SDR)
#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */
+#define MMC_CAP2_HC_ERASE_SZ (1 << 8) /* High-capacity erase size */
mmc_pm_flag_t pm_caps; /* supported pm features */
unsigned int power_notify_type;
--
1.7.6.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 1/4] mmc: core: add high-capacity erase size capability flag
2012-02-07 12:48 ` [PATCH 1/4] mmc: core: add high-capacity erase size capability flag Adrian Hunter
@ 2012-02-08 16:32 ` Ulf Hansson
2012-02-09 7:12 ` Adrian Hunter
2012-02-08 22:38 ` Linus Walleij
1 sibling, 1 reply; 11+ messages in thread
From: Ulf Hansson @ 2012-02-08 16:32 UTC (permalink / raw)
To: Adrian Hunter; +Cc: Chris Ball, linux-mmc@vger.kernel.org
On 02/07/2012 01:48 PM, Adrian Hunter wrote:
> Let drivers specify the use of high-capacity erase size.
>
> Signed-off-by: Adrian Hunter<adrian.hunter@intel.com>
> ---
> drivers/mmc/core/mmc.c | 3 ++-
> include/linux/mmc/host.h | 1 +
> 2 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 6b13776..bd2f71f 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -949,7 +949,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
> * If enhanced_area_en is TRUE, host needs to enable ERASE_GRP_DEF
> * bit. This bit will be lost every time after a reset or power off.
> */
> - if (card->ext_csd.enhanced_area_en) {
> + if (card->ext_csd.enhanced_area_en ||
> + (card->ext_csd.rev>= 3&& (host->caps2& MMC_CAP2_HC_ERASE_SZ))) {
This will default disable this feature. Is that what we want?
Why the need to disable this at all?
> err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> EXT_CSD_ERASE_GROUP_DEF, 1,
> card->ext_csd.generic_cmd6_time);
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 20d7c82..c7ce9d2 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -258,6 +258,7 @@ struct mmc_host {
> #define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
> MMC_CAP2_HS200_1_2V_SDR)
> #define MMC_CAP2_BROKEN_VOLTAGE (1<< 7) /* Use the broken voltage */
> +#define MMC_CAP2_HC_ERASE_SZ (1<< 8) /* High-capacity erase size */
>
> mmc_pm_flag_t pm_caps; /* supported pm features */
> unsigned int power_notify_type;
Br
Ulf Hansson
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 1/4] mmc: core: add high-capacity erase size capability flag
2012-02-08 16:32 ` Ulf Hansson
@ 2012-02-09 7:12 ` Adrian Hunter
0 siblings, 0 replies; 11+ messages in thread
From: Adrian Hunter @ 2012-02-09 7:12 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Chris Ball, linux-mmc@vger.kernel.org
On 08/02/12 18:32, Ulf Hansson wrote:
> On 02/07/2012 01:48 PM, Adrian Hunter wrote:
>> Let drivers specify the use of high-capacity erase size.
>>
>> Signed-off-by: Adrian Hunter<adrian.hunter@intel.com>
>> ---
>> drivers/mmc/core/mmc.c | 3 ++-
>> include/linux/mmc/host.h | 1 +
>> 2 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
>> index 6b13776..bd2f71f 100644
>> --- a/drivers/mmc/core/mmc.c
>> +++ b/drivers/mmc/core/mmc.c
>> @@ -949,7 +949,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
>> * If enhanced_area_en is TRUE, host needs to enable ERASE_GRP_DEF
>> * bit. This bit will be lost every time after a reset or power off.
>> */
>> - if (card->ext_csd.enhanced_area_en) {
>> + if (card->ext_csd.enhanced_area_en ||
>> + (card->ext_csd.rev>= 3&& (host->caps2& MMC_CAP2_HC_ERASE_SZ))) {
>
> This will default disable this feature. Is that what we want?
> Why the need to disable this at all?
It will change the erase group size and the write protect group size.
That will cause breakage for anyone using write protect groups of
a smaller size.
>
>> err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>> EXT_CSD_ERASE_GROUP_DEF, 1,
>> card->ext_csd.generic_cmd6_time);
>> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
>> index 20d7c82..c7ce9d2 100644
>> --- a/include/linux/mmc/host.h
>> +++ b/include/linux/mmc/host.h
>> @@ -258,6 +258,7 @@ struct mmc_host {
>> #define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
>> MMC_CAP2_HS200_1_2V_SDR)
>> #define MMC_CAP2_BROKEN_VOLTAGE (1<< 7) /* Use the broken voltage */
>> +#define MMC_CAP2_HC_ERASE_SZ (1<< 8) /* High-capacity erase size */
>>
>> mmc_pm_flag_t pm_caps; /* supported pm features */
>> unsigned int power_notify_type;
>
> Br
> Ulf Hansson
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/4] mmc: core: add high-capacity erase size capability flag
2012-02-07 12:48 ` [PATCH 1/4] mmc: core: add high-capacity erase size capability flag Adrian Hunter
2012-02-08 16:32 ` Ulf Hansson
@ 2012-02-08 22:38 ` Linus Walleij
2012-02-09 7:02 ` Adrian Hunter
1 sibling, 1 reply; 11+ messages in thread
From: Linus Walleij @ 2012-02-08 22:38 UTC (permalink / raw)
To: Adrian Hunter; +Cc: Chris Ball, linux-mmc
On Tue, Feb 7, 2012 at 1:48 PM, Adrian Hunter <adrian.hunter@intel.com> wrote:
> Let drivers specify the use of high-capacity erase size.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
(...)
> @@ -949,7 +949,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
> * If enhanced_area_en is TRUE, host needs to enable ERASE_GRP_DEF
> * bit. This bit will be lost every time after a reset or power off.
> */
> - if (card->ext_csd.enhanced_area_en) {
> + if (card->ext_csd.enhanced_area_en ||
> + (card->ext_csd.rev >= 3 && (host->caps2 & MMC_CAP2_HC_ERASE_SZ))) {
It looks like there is a bug fix hidden inside this patch, is it not?
The comparison for card->ext_csd.rev >= 3 was not there before,
and looks like it's fixing something and should go into stable even,
is that correct?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 1/4] mmc: core: add high-capacity erase size capability flag
2012-02-08 22:38 ` Linus Walleij
@ 2012-02-09 7:02 ` Adrian Hunter
0 siblings, 0 replies; 11+ messages in thread
From: Adrian Hunter @ 2012-02-09 7:02 UTC (permalink / raw)
To: Linus Walleij; +Cc: Chris Ball, linux-mmc
On 09/02/12 00:38, Linus Walleij wrote:
> On Tue, Feb 7, 2012 at 1:48 PM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>
>> Let drivers specify the use of high-capacity erase size.
>>
>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> (...)
>> @@ -949,7 +949,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
>> * If enhanced_area_en is TRUE, host needs to enable ERASE_GRP_DEF
>> * bit. This bit will be lost every time after a reset or power off.
>> */
>> - if (card->ext_csd.enhanced_area_en) {
>> + if (card->ext_csd.enhanced_area_en ||
>> + (card->ext_csd.rev >= 3 && (host->caps2 & MMC_CAP2_HC_ERASE_SZ))) {
>
> It looks like there is a bug fix hidden inside this patch, is it not?
> The comparison for card->ext_csd.rev >= 3 was not there before,
> and looks like it's fixing something and should go into stable even,
> is that correct?
No because because enhanced areas were added in v4.4 so
"card->ext_csd.enhanced_area_en" implies "card->ext_csd.rev >= 4"
High-capacity erase size was added in v4.3 so "card->ext_csd.rev >= 3"
is parenthesised with "(host->caps2 & MMC_CAP2_HC_ERASE_SZ)"
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/4] mmc: sdhci-pci: select HC erase size for Medfield eMMC
2012-02-07 12:48 [PATCH 0/4] mmc: add a cap and a quirk Adrian Hunter
2012-02-07 12:48 ` [PATCH 1/4] mmc: core: add high-capacity erase size capability flag Adrian Hunter
@ 2012-02-07 12:48 ` Adrian Hunter
2012-02-07 12:48 ` [PATCH 3/4] mmc: sdhci: add quirk for keeping card power during suspend Adrian Hunter
` (2 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Adrian Hunter @ 2012-02-07 12:48 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc, Adrian Hunter
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci-pci.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 6ebdc40..9952535 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -244,7 +244,8 @@ static inline void sdhci_pci_remove_own_cd(struct sdhci_pci_slot *slot)
static int mfd_emmc_probe_slot(struct sdhci_pci_slot *slot)
{
slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE;
- slot->host->mmc->caps2 = MMC_CAP2_BOOTPART_NOACC;
+ slot->host->mmc->caps2 |= MMC_CAP2_BOOTPART_NOACC |
+ MMC_CAP2_HC_ERASE_SZ;
return 0;
}
--
1.7.6.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 3/4] mmc: sdhci: add quirk for keeping card power during suspend
2012-02-07 12:48 [PATCH 0/4] mmc: add a cap and a quirk Adrian Hunter
2012-02-07 12:48 ` [PATCH 1/4] mmc: core: add high-capacity erase size capability flag Adrian Hunter
2012-02-07 12:48 ` [PATCH 2/4] mmc: sdhci-pci: select HC erase size for Medfield eMMC Adrian Hunter
@ 2012-02-07 12:48 ` Adrian Hunter
2012-02-07 12:48 ` [PATCH 4/4] mmc: sdhci-pci: add SDHCI_QUIRK2_HOST_OFF_CARD_ON for Medfield SDIO Adrian Hunter
2012-03-13 6:41 ` [PATCH 0/4] mmc: add a cap and a quirk Adrian Hunter
4 siblings, 0 replies; 11+ messages in thread
From: Adrian Hunter @ 2012-02-07 12:48 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc, Adrian Hunter
Add quirk SDHCI_QUIRK2_HOST_OFF_CARD_ON to cater for the
case when the card keeps power during suspend but the
host controller does not i.e. the card power is not
controlled by the host controller. In that case, the
controller must be fully reset on resume.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci.c | 13 +++++++++++--
include/linux/mmc/sdhci.h | 2 ++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 1f5888b..80cc784 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2426,8 +2426,17 @@ int sdhci_resume_host(struct sdhci_host *host)
if (ret)
return ret;
- sdhci_init(host, (host->mmc->pm_flags & MMC_PM_KEEP_POWER));
- mmiowb();
+ if ((host->mmc->pm_flags & MMC_PM_KEEP_POWER) &&
+ (host->quirks2 & SDHCI_QUIRK2_HOST_OFF_CARD_ON)) {
+ /* Card keeps power but host controller does not */
+ sdhci_init(host, 0);
+ host->pwr = 0;
+ host->clock = 0;
+ sdhci_do_set_ios(host, &host->mmc->ios);
+ } else {
+ sdhci_init(host, (host->mmc->pm_flags & MMC_PM_KEEP_POWER));
+ mmiowb();
+ }
ret = mmc_resume_host(host->mmc);
sdhci_enable_card_detection(host);
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index c750f85..e9051e1 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -90,6 +90,8 @@ struct sdhci_host {
unsigned int quirks2; /* More deviations from spec. */
+#define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1<<0)
+
int irq; /* Device IRQ */
void __iomem *ioaddr; /* Mapped address */
--
1.7.6.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 4/4] mmc: sdhci-pci: add SDHCI_QUIRK2_HOST_OFF_CARD_ON for Medfield SDIO
2012-02-07 12:48 [PATCH 0/4] mmc: add a cap and a quirk Adrian Hunter
` (2 preceding siblings ...)
2012-02-07 12:48 ` [PATCH 3/4] mmc: sdhci: add quirk for keeping card power during suspend Adrian Hunter
@ 2012-02-07 12:48 ` Adrian Hunter
2012-03-13 6:41 ` [PATCH 0/4] mmc: add a cap and a quirk Adrian Hunter
4 siblings, 0 replies; 11+ messages in thread
From: Adrian Hunter @ 2012-02-07 12:48 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc, Adrian Hunter
SDIO is powered separated from the host controller, so the card
can remain on while the host controller is powered off during
suspend.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci-pci.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 9952535..3cb9abf 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -47,6 +47,7 @@ struct sdhci_pci_slot;
struct sdhci_pci_fixes {
unsigned int quirks;
+ unsigned int quirks2;
bool allow_runtime_pm;
int (*probe) (struct sdhci_pci_chip *);
@@ -73,6 +74,7 @@ struct sdhci_pci_chip {
struct pci_dev *pdev;
unsigned int quirks;
+ unsigned int quirks2;
bool allow_runtime_pm;
const struct sdhci_pci_fixes *fixes;
@@ -272,6 +274,7 @@ static const struct sdhci_pci_fixes sdhci_intel_mfd_sd = {
static const struct sdhci_pci_fixes sdhci_intel_mfd_sdio = {
.quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
+ .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON,
.allow_runtime_pm = true,
.probe_slot = mfd_sdio_probe_slot,
};
@@ -1207,6 +1210,7 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
host->hw_name = "PCI";
host->ops = &sdhci_pci_ops;
host->quirks = chip->quirks;
+ host->quirks2 = chip->quirks2;
host->irq = pdev->irq;
@@ -1366,6 +1370,7 @@ static int __devinit sdhci_pci_probe(struct pci_dev *pdev,
chip->fixes = (const struct sdhci_pci_fixes *)ent->driver_data;
if (chip->fixes) {
chip->quirks = chip->fixes->quirks;
+ chip->quirks2 = chip->fixes->quirks2;
chip->allow_runtime_pm = chip->fixes->allow_runtime_pm;
}
chip->num_slots = slots;
--
1.7.6.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 0/4] mmc: add a cap and a quirk
2012-02-07 12:48 [PATCH 0/4] mmc: add a cap and a quirk Adrian Hunter
` (3 preceding siblings ...)
2012-02-07 12:48 ` [PATCH 4/4] mmc: sdhci-pci: add SDHCI_QUIRK2_HOST_OFF_CARD_ON for Medfield SDIO Adrian Hunter
@ 2012-03-13 6:41 ` Adrian Hunter
2012-03-13 9:35 ` Chris Ball
4 siblings, 1 reply; 11+ messages in thread
From: Adrian Hunter @ 2012-03-13 6:41 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc, Ulf Hansson, linus walleij
On 07/02/12 14:48, Adrian Hunter wrote:
> Hi
>
> Here are patches for Medfield to allow the use of high-capacity erase size
> and to allow the SDIO host controller to be off when the card is kept on
> during suspend - replacing the earlier patch "mmc: sdhci: always reset all
> during resume"
>
>
> Adrian Hunter (4):
> mmc: core: add high-capacity erase size capability flag
> mmc: sdhci-pci: select HC erase size for Medfield eMMC
> mmc: sdhci: add quirk for keeping card power during suspend
> mmc: sdhci-pci: add SDHCI_QUIRK2_HOST_OFF_CARD_ON for Medfield SDIO
>
> drivers/mmc/core/mmc.c | 3 ++-
> drivers/mmc/host/sdhci-pci.c | 8 +++++++-
> drivers/mmc/host/sdhci.c | 13 +++++++++++--
> include/linux/mmc/host.h | 1 +
> include/linux/mmc/sdhci.h | 2 ++
> 5 files changed, 23 insertions(+), 4 deletions(-)
Chris can you take these?
MMC_CAP2_HC_ERASE_SZ needs to move to bit9 but otherwise they apply.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 0/4] mmc: add a cap and a quirk
2012-03-13 6:41 ` [PATCH 0/4] mmc: add a cap and a quirk Adrian Hunter
@ 2012-03-13 9:35 ` Chris Ball
0 siblings, 0 replies; 11+ messages in thread
From: Chris Ball @ 2012-03-13 9:35 UTC (permalink / raw)
To: Adrian Hunter; +Cc: linux-mmc, Ulf Hansson, linus walleij
Hi Adrian,
On Tue, Mar 13 2012, Adrian Hunter wrote:
> On 07/02/12 14:48, Adrian Hunter wrote:
>> Hi
>>
>> Here are patches for Medfield to allow the use of high-capacity erase size
>> and to allow the SDIO host controller to be off when the card is kept on
>> during suspend - replacing the earlier patch "mmc: sdhci: always reset all
>> during resume"
>>
>>
>> Adrian Hunter (4):
>> mmc: core: add high-capacity erase size capability flag
>> mmc: sdhci-pci: select HC erase size for Medfield eMMC
>> mmc: sdhci: add quirk for keeping card power during suspend
>> mmc: sdhci-pci: add SDHCI_QUIRK2_HOST_OFF_CARD_ON for Medfield SDIO
>>
>> drivers/mmc/core/mmc.c | 3 ++-
>> drivers/mmc/host/sdhci-pci.c | 8 +++++++-
>> drivers/mmc/host/sdhci.c | 13 +++++++++++--
>> include/linux/mmc/host.h | 1 +
>> include/linux/mmc/sdhci.h | 2 ++
>> 5 files changed, 23 insertions(+), 4 deletions(-)
>
> Chris can you take these?
>
> MMC_CAP2_HC_ERASE_SZ needs to move to bit9 but otherwise they apply.
Thanks for the reminder, moved MMC_CAP2_HC_ERASE_SZ to bit9 and pushed
to mmc-next for 3.4.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 11+ messages in thread