[patch] sdhci: remove SDHCI_QUIRK_FORCE_1_BIT_DATA

zhangfei gao
2010-11-09T11:37:59Z

[-- Attachment #1: Type: text/plain, Size: 3066 bytes --]

Hi, Xiaobo & Anton

Here is patch to remove SDHCI_QUIRK_FORCE_1_BIT_DATA, which only used
in drivers/mmc/host/sdhci-of-core.c.
The reason is quirk is too valuable resource, the type is u32, while
the highest is (1<<29) now.

1. MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA is opened by default in sdhci.c
2. platform driver could close such flag after sdhci_add_host.

We have verified on our platform, would you mind check whether it
impact your driver behavior.

>From a5460d2fe6294287c4e86cedde5ac0f47b6b0368 Mon Sep 17 00:00:00 2001
From: Zhangfei Gao <zhangfei.gao@marvell.com>
Date: Tue, 9 Nov 2010 07:17:32 -0500
Subject: [PATCH] sdhci: remove SDHCI_QUIRK_FORCE_1_BIT_DATA

SDHCI_QUIRK_FORCE_1_BIT_DATA only used for modify caps, which could
be updated after sdhci_add_host

Signed-off-by: Zhangfei Gao <zhangfei.gao@marvell.com>
---
drivers/mmc/host/sdhci-of-core.c | 7 +++----
drivers/mmc/host/sdhci.c | 3 +--
include/linux/mmc/sdhci.h | 2 --
3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
index c51b711..620d5bf 100644
--- a/drivers/mmc/host/sdhci-of-core.c
+++ b/drivers/mmc/host/sdhci-of-core.c
@@ -157,10 +157,6 @@ static int __devinit sdhci_of_probe(struct
platform_device *ofdev,
if (of_get_property(np, "sdhci,auto-cmd12", NULL))
host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;

-
- if (of_get_property(np, "sdhci,1-bit-only", NULL))
- host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA;
-
if (sdhci_of_wp_inverted(np))
host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT;

@@ -172,6 +168,9 @@ static int __devinit sdhci_of_probe(struct
platform_device *ofdev,
if (ret)
goto err_add_host;

+ if (of_get_property(np, "sdhci,1-bit-only", NULL))
+ host->mmc->caps &= ~(MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA);
+
return 0;

err_add_host:
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 154cbf8..8114bd3 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1858,8 +1858,7 @@ int sdhci_add_host(struct sdhci_host *host)
mmc->f_max = host->max_clk;
mmc->caps |= MMC_CAP_SDIO_IRQ;

- if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
- mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
+ mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;

if (caps & SDHCI_CAN_DO_HISPD)
mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 1fdc673..ede02a4 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -67,8 +67,6 @@ struct sdhci_host {
#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20)
/* Controller cannot do multi-block transfers */
#define SDHCI_QUIRK_NO_MULTIBLOCK (1<<21)
-/* Controller can only handle 1-bit data transfers */
-#define SDHCI_QUIRK_FORCE_1_BIT_DATA (1<<22)
/* Controller needs 10ms delay between applying power and clock */
#define SDHCI_QUIRK_DELAY_AFTER_POWER (1<<23)
/* Controller uses SDCLK instead of TMCLK for data timeouts */
--
1.7.0.4

[-- Attachment #2: 0001-sdhci-remove-SDHCI_QUIRK_FORCE_1_BIT_DATA.patch --]
[-- Type: text/x-patch, Size: 2611 bytes --]

From a5460d2fe6294287c4e86cedde5ac0f47b6b0368 Mon Sep 17 00:00:00 2001
From: Zhangfei Gao <zhangfei.gao@marvell.com>
Date: Tue, 9 Nov 2010 07:17:32 -0500
Subject: [PATCH] sdhci: remove SDHCI_QUIRK_FORCE_1_BIT_DATA

SDHCI_QUIRK_FORCE_1_BIT_DATA only used for modify caps, which could be updated after sdhci_add_host

Signed-off-by: Zhangfei Gao <zhangfei.gao@marvell.com>
---
drivers/mmc/host/sdhci-of-core.c | 7 +++----
drivers/mmc/host/sdhci.c | 3 +--
include/linux/mmc/sdhci.h | 2 --
3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
index c51b711..620d5bf 100644
--- a/drivers/mmc/host/sdhci-of-core.c
+++ b/drivers/mmc/host/sdhci-of-core.c
@@ -157,10 +157,6 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev,
if (of_get_property(np, "sdhci,auto-cmd12", NULL))
host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;

-
- if (of_get_property(np, "sdhci,1-bit-only", NULL))
- host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA;
-
if (sdhci_of_wp_inverted(np))
host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT;

@@ -172,6 +168,9 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev,
if (ret)
goto err_add_host;

+ if (of_get_property(np, "sdhci,1-bit-only", NULL))
+ host->mmc->caps &= ~(MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA);
+
return 0;

err_add_host:
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 154cbf8..8114bd3 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1858,8 +1858,7 @@ int sdhci_add_host(struct sdhci_host *host)
mmc->f_max = host->max_clk;
mmc->caps |= MMC_CAP_SDIO_IRQ;

- if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
- mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
+ mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;

if (caps & SDHCI_CAN_DO_HISPD)
mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 1fdc673..ede02a4 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -67,8 +67,6 @@ struct sdhci_host {
#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20)
/* Controller cannot do multi-block transfers */
#define SDHCI_QUIRK_NO_MULTIBLOCK (1<<21)
-/* Controller can only handle 1-bit data transfers */
-#define SDHCI_QUIRK_FORCE_1_BIT_DATA (1<<22)
/* Controller needs 10ms delay between applying power and clock */
#define SDHCI_QUIRK_DELAY_AFTER_POWER (1<<23)
/* Controller uses SDCLK instead of TMCLK for data timeouts */
--
1.7.0.4