LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Darren Salt <linux@youmustbejoking.demon.co.uk>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Subject: Re: [patch 0/9] 2.6.19-stable review (mmc: Power quirk for ENE controllers)
Date: Tue, 27 Feb 2007 02:47:18 +0000	[thread overview]
Message-ID: <4EBB823D2F%linux@youmustbejoking.demon.co.uk> (raw)
In-Reply-To: <20070227000538.GA6283@kroah.com>

Could you add this patch (which is in 2.6.21-rc1) to the queues for 2.6.19.6
and 2.6.20.2 and, if it's ever to be released, 2.6.18.9? (There's one
trivially-fixable reject against 2.6.18, but it's otherwise fine with all
three.)


mmc: Power quirk for ENE controllers

Support for these devices was broken for 2.6.18-rc1 and later by commit
146ad66eac836c0b976c98f428d73e1f6a75270d, which added voltage level support.

This restores the previous behaviour for these devices by ensuring that when
the voltage is changed, only one write to set the voltage is performed.

It may be that both writes are needed if the voltage is being changed between
two non-zero values or that it's safe to ensure that only one write is done
if the hardware only supports one voltage; I don't know whether either is the
case nor can I test since I have only the one SD reader (1524:0550), and it
supports just the one voltage.

Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
---

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index c2d13d7..175a942 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -37,6 +37,7 @@ static unsigned int debug_quirks = 0;
 #define SDHCI_QUIRK_FORCE_DMA				(1<<1)
 /* Controller doesn't like some resets when there is no card inserted. */
 #define SDHCI_QUIRK_NO_CARD_NO_RESET			(1<<2)
+#define SDHCI_QUIRK_SINGLE_POWER_WRITE			(1<<3)
 
 static const struct pci_device_id pci_ids[] __devinitdata = {
 	{
@@ -65,6 +66,14 @@ static const struct pci_device_id pci_ids[] __devinitdata = {
 		.driver_data	= SDHCI_QUIRK_FORCE_DMA,
 	},
 
+	{
+		.vendor		= PCI_VENDOR_ID_ENE,
+		.device		= PCI_DEVICE_ID_ENE_CB712_SD,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.driver_data	= SDHCI_QUIRK_SINGLE_POWER_WRITE,
+	},
+
 	{	/* Generic SD host controller */
 		PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
 	},
@@ -674,10 +683,17 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned short power)
 	if (host->power == power)
 		return;
 
-	writeb(0, host->ioaddr + SDHCI_POWER_CONTROL);
-
-	if (power == (unsigned short)-1)
+	if (power == (unsigned short)-1) {
+		writeb(0, host->ioaddr + SDHCI_POWER_CONTROL);
 		goto out;
+	}
+
+	/*
+	 * Spec says that we should clear the power reg before setting
+	 * a new value. Some controllers don't seem to like this though.
+	 */
+	if (!(host->chip->quirks & SDHCI_QUIRK_SINGLE_POWER_WRITE))
+		writeb(0, host->ioaddr + SDHCI_POWER_CONTROL);
 
 	pwr = SDHCI_POWER_ON;
 
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 3d1d210..d37f46a 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1971,6 +1971,7 @@
 #define PCI_DEVICE_ID_TOPIC_TP560	0x0000
 
 #define PCI_VENDOR_ID_ENE		0x1524
+#define PCI_DEVICE_ID_ENE_CB712_SD	0x0550
 #define PCI_DEVICE_ID_ENE_1211		0x1211
 #define PCI_DEVICE_ID_ENE_1225		0x1225
 #define PCI_DEVICE_ID_ENE_1410		0x1410

-- 
| Darren Salt    | linux or ds at              | nr. Ashington, | Toon
| RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army
| + Burn less waste. Use less packaging. Waste less.     USE FEWER RESOURCES.

Necessity has no law.

  parent reply	other threads:[~2007-02-27  3:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070226235248.438556696@mini.kroah.org>
2007-02-27  0:05 ` [patch 0/9] 2.6.19-stable review Greg KH
2007-02-27  0:06   ` [patch 1/9] fix umask when noACL kernel meets extN tuned for ACLs Greg KH
2007-02-27  0:28     ` Andreas Gruenbacher
2007-02-27  0:06   ` [patch 2/9] Backport of psmouse suspend/shutdown cleanups Greg KH
2007-02-27  0:06   ` [patch 3/9] fix memory corruption from misinterpreted bad_inode_ops return values (CVE-2006-5753) Greg KH
2007-02-27  0:06   ` [patch 4/9] netpoll: drivers must not enable IRQ unconditionally in their NAPI handler Greg KH
2007-02-27  0:06   ` [patch 5/9] hda-intel - Dont try to probe invalid codecs Greg KH
2007-02-27  0:06   ` [patch 6/9] Fix oops when Windows server sent bad domain name null terminator Greg KH
2007-02-27  0:06   ` [patch 7/9] USB: usbnet driver bugfix Greg KH
2007-02-27  0:06   ` [patch 8/9] hda-codec - Dont return error at initialization of modem codec Greg KH
2007-02-27  0:06   ` [patch 9/9] Missing critical phys_to_virt in lib/swiotlb.c Greg KH
2007-02-27  2:47   ` Darren Salt [this message]
2007-02-27 20:23   ` [patch 0/9] 2.6.19-stable review Michael Krufky
2007-03-03  1:23     ` Greg KH
2007-03-03  1:48       ` Michael Krufky
2007-03-03  7:48         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EBB823D2F%linux@youmustbejoking.demon.co.uk \
    --to=linux@youmustbejoking.demon.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).