All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sdhci: V3:  Allow CAPS[1] to be set via QUIRK
@ 2012-06-28  4:49 philipspatches
  2012-07-03 23:05 ` Chris Ball
  0 siblings, 1 reply; 2+ messages in thread
From: philipspatches @ 2012-06-28  4:49 UTC (permalink / raw)
  To: cjb, linux-mmc; +Cc: Philip Rakity

From: Philip Rakity <prakity@marvell.com>

currently only the capability_0 register can be set if
SDHCI_QUIRK_MISSING_CAPS is defined.  This is a problem when
the capability_1 register also needs changing.  Use the
SDHCI_QUIRK_MISSING_CAPS to allow both registers to be set.

Redefining caps[1] is useful when the board design does not
support 1.8v vccq so UHS modes are not available.  The code
that calls sdhci_add_host can then detect this condition and
adjust the caps so the UHS mode will not be attempted on UHS
cards

Signed-off-by: Philip Rakity <prakity@marvell.com>
---
 drivers/mmc/host/sdhci.c  |    8 +++++---
 include/linux/mmc/sdhci.h |    3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index ef4231a..f3e7ed7 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2588,7 +2588,7 @@ EXPORT_SYMBOL_GPL(sdhci_alloc_host);
 int sdhci_add_host(struct sdhci_host *host)
 {
 	struct mmc_host *mmc;
-	u32 caps[2];
+	u32 caps[2] = {0, 0};
 	u32 max_current_caps;
 	unsigned int ocr_avail;
 	int ret;
@@ -2618,8 +2618,10 @@ int sdhci_add_host(struct sdhci_host *host)
 	caps[0] = (host->quirks & SDHCI_QUIRK_MISSING_CAPS) ? host->caps :
 		sdhci_readl(host, SDHCI_CAPABILITIES);
 
-	caps[1] = (host->version >= SDHCI_SPEC_300) ?
-		sdhci_readl(host, SDHCI_CAPABILITIES_1) : 0;
+	if (host->version >= SDHCI_SPEC_300)
+		caps[1] = (host->quirks & SDHCI_QUIRK_MISSING_CAPS) ?
+			host->caps1 :
+			sdhci_readl(host, SDHCI_CAPABILITIES_1);
 
 	if (host->quirks & SDHCI_QUIRK_FORCE_DMA)
 		host->flags |= SDHCI_USE_SDMA;
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index e9051e1..d989b51 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -155,7 +155,8 @@ struct sdhci_host {
 
 	struct timer_list timer;	/* Timer for timeouts */
 
-	unsigned int caps;	/* Alternative capabilities */
+	unsigned int caps;	/* Alternative CAPABILITY_0 */
+	unsigned int caps1;	/* Alternative CAPABILITY_1 */
 
 	unsigned int            ocr_avail_sdio;	/* OCR bit masks */
 	unsigned int            ocr_avail_sd;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sdhci: V3:  Allow CAPS[1] to be set via QUIRK
  2012-06-28  4:49 [PATCH] sdhci: V3: Allow CAPS[1] to be set via QUIRK philipspatches
@ 2012-07-03 23:05 ` Chris Ball
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Ball @ 2012-07-03 23:05 UTC (permalink / raw)
  To: philipspatches; +Cc: linux-mmc, Philip Rakity

Hi,

On Thu, Jun 28 2012, philipspatches@gmail.com wrote:
> From: Philip Rakity <prakity@marvell.com>
>
> currently only the capability_0 register can be set if
> SDHCI_QUIRK_MISSING_CAPS is defined.  This is a problem when
> the capability_1 register also needs changing.  Use the
> SDHCI_QUIRK_MISSING_CAPS to allow both registers to be set.
>
> Redefining caps[1] is useful when the board design does not
> support 1.8v vccq so UHS modes are not available.  The code
> that calls sdhci_add_host can then detect this condition and
> adjust the caps so the UHS mode will not be attempted on UHS
> cards
>
> Signed-off-by: Philip Rakity <prakity@marvell.com>

Thanks, pushed to mmc-next for 3.6.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-03 23:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-28  4:49 [PATCH] sdhci: V3: Allow CAPS[1] to be set via QUIRK philipspatches
2012-07-03 23:05 ` Chris Ball

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.