[kernel/f14/master] ricoh e822 sdhci support

Kyle McMartin kyle at fedoraproject.org
Tue Oct 19 02:25:18 UTC 2010


commit f1b58c7ca878eb3cfc1e8c4edb9e62144b520088
Author: Kyle McMartin <kyle at mcmartin.ca>
Date:   Mon Oct 18 22:24:45 2010 -0400

    ricoh e822 sdhci support

 kernel.spec                                        |   15 ++-
 mmc-add-ricoh-e822-pci-id.patch                    |   46 ++++++
 ...make-sdhci-work-with-ricoh-mmc-controller.patch |  150 ++++++++++++++++++++
 sdhci-8-bit-data-transfer-width-support.patch      |   57 ++++++++
 4 files changed, 267 insertions(+), 1 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index 50f5ac9..8a9df5e 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -765,6 +765,10 @@ Patch13637: dmar-disable-when-ricoh-multifunction.patch
 
 Patch13638: ima-allow-it-to-be-completely-disabled-and-default-off.patch
 
+Patch13640: sdhci-8-bit-data-transfer-width-support.patch
+Patch13641: mmc-make-sdhci-work-with-ricoh-mmc-controller.patch
+Patch13642: mmc-add-ricoh-e822-pci-id.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1427,6 +1431,11 @@ ApplyPatch dmar-disable-when-ricoh-multifunction.patch
 
 ApplyPatch ima-allow-it-to-be-completely-disabled-and-default-off.patch
 
+# rhbz#596475
+ApplyPatch sdhci-8-bit-data-transfer-width-support.patch
+ApplyPatch mmc-make-sdhci-work-with-ricoh-mmc-controller.patch
+ApplyPatch mmc-add-ricoh-e822-pci-id.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2013,6 +2022,10 @@ fi
 # and build.
 
 %changelog
+* Mon Oct 18 2010 Kyle McMartin <kyle at redhat.com>
+- Add Ricoh e822 support. (rhbz#596475) Thanks to sgruszka@ for
+  sending the patches in.
+
 * Mon Oct 18 2010 Kyle McMartin <kyle at redhat.com> 2.6.35.6-45
 - Print a useful message when disabling IOMMU when a Ricoh cardreader
   is probed.
@@ -2028,7 +2041,7 @@ fi
 - Quirk to disable DMAR with Ricoh card reader/firewire. (rhbz#605888)
 
 * Mon Oct 18 2010 Kyle McMartin <kyle at redhat.com>
-- Two networking fixes (skge, r8169) from sgruska. (rhbz#447489,629158)
+- Two networking fixes (skge, r8169) from sgruszka at . (rhbz#447489,629158)
 
 * Fri Oct 15 2010 Kyle McMartin <kyle at redhat.com>
 - pnpacpi: cope with invalid device IDs. (rhbz#641468)
diff --git a/mmc-add-ricoh-e822-pci-id.patch b/mmc-add-ricoh-e822-pci-id.patch
new file mode 100644
index 0000000..0503db7
--- /dev/null
+++ b/mmc-add-ricoh-e822-pci-id.patch
@@ -0,0 +1,46 @@
+From kernel-bounces at lists.fedoraproject.org Thu Sep  9 09:24:46 2010
+From: Stanislaw Gruszka <sgruszka at redhat.com>
+Subject: [PATCH 3/3] mmc: add ricoh e822 pci id
+Date: Thu,  9 Sep 2010 15:24:12 +0200
+
+From: Pablo Castillo <CyberCastle at gmail.com>
+
+Upstream 568133ebda39f7507759a744fa9cf4d5097bad2f commit.
+
+Signed-off-by: Pablo Castillo <CyberCastle at gmail.com>
+Signed-off-by: Stanislaw Gruszka <sgruszka at redhat.com>
+Tested-by: Gregg Lebovitz <gregg at lebovitz.net>
+Cc: Maxim Levitsky <maximlevitsky at gmail.com>
+Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+ drivers/mmc/host/sdhci-pci.c |    8 ++++++++
+ 1 files changed, 8 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
+index e021431..e8aa99d 100644
+--- a/drivers/mmc/host/sdhci-pci.c
++++ b/drivers/mmc/host/sdhci-pci.c
+@@ -415,6 +415,14 @@ static const struct pci_device_id pci_ids[] __devinitdata = {
+ 	},
+ 
+ 	{
++		.vendor         = PCI_VENDOR_ID_RICOH,
++		.device         = 0xe822,
++		.subvendor      = PCI_ANY_ID,
++		.subdevice      = PCI_ANY_ID,
++		.driver_data    = (kernel_ulong_t)&sdhci_ricoh_mmc,
++	},
++
++	{
+ 		.vendor		= PCI_VENDOR_ID_ENE,
+ 		.device		= PCI_DEVICE_ID_ENE_CB712_SD,
+ 		.subvendor	= PCI_ANY_ID,
+-- 
+1.7.1
+
+_______________________________________________
+kernel mailing list
+kernel at lists.fedoraproject.org
+https://admin.fedoraproject.org/mailman/listinfo/kernel
+
diff --git a/mmc-make-sdhci-work-with-ricoh-mmc-controller.patch b/mmc-make-sdhci-work-with-ricoh-mmc-controller.patch
new file mode 100644
index 0000000..aba08d3
--- /dev/null
+++ b/mmc-make-sdhci-work-with-ricoh-mmc-controller.patch
@@ -0,0 +1,150 @@
+From kernel-bounces at lists.fedoraproject.org Thu Sep  9 09:24:33 2010
+From: Stanislaw Gruszka <sgruszka at redhat.com>
+Subject: [PATCH 2/3] mmc: make sdhci work with ricoh mmc controller
+Date: Thu,  9 Sep 2010 15:24:11 +0200
+
+From: Maxim Levitsky <maximlevitsky at gmail.com>
+
+Upstream ccc92c23240cdf952ef7cc39ba563910dcbc9cbe commit.
+
+The current way of disabling it is not well tested by vendor and has all
+kinds of bugs that show up on resume from ram/disk.  A very good example
+is a dead SDHCI controller.
+
+Old way of disabling is still supported by continuing to use
+CONFIG_MMC_RICOH_MMC.
+
+Based on 'http://list.drzeus.cx/pipermail/sdhci-devel/2007-December/002085.html'
+Therefore most of the credit for this goes to Andrew de Quincey
+
+Signed-off-by: Maxim Levitsky <maximlevitsky at gmail.com>
+Cc: Andrew de Quincey <adq_dvb at lidskialf.net>
+Acked-by: Philip Langdale <philipl at overt.org>
+Cc: "Rafael J. Wysocki" <rjw at sisk.pl>
+Cc: <linux-mmc at vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+ drivers/mmc/host/sdhci-pci.c |   41 +++++++++++++++++++++++++++++++++++++++++
+ drivers/mmc/host/sdhci.c     |    3 ++-
+ drivers/mmc/host/sdhci.h     |    4 ++++
+ 3 files changed, 47 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
+index 65483fd..e021431 100644
+--- a/drivers/mmc/host/sdhci-pci.c
++++ b/drivers/mmc/host/sdhci-pci.c
+@@ -17,6 +17,7 @@
+ #include <linux/pci.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/slab.h>
++#include <linux/device.h>
+ 
+ #include <linux/mmc/host.h>
+ 
+@@ -84,7 +85,30 @@ static int ricoh_probe(struct sdhci_pci_chip *chip)
+ 	if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG ||
+ 	    chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SONY)
+ 		chip->quirks |= SDHCI_QUIRK_NO_CARD_NO_RESET;
++	return 0;
++}
++
++static int ricoh_mmc_probe_slot(struct sdhci_pci_slot *slot)
++{
++	slot->host->caps =
++		((0x21 << SDHCI_TIMEOUT_CLK_SHIFT)
++			& SDHCI_TIMEOUT_CLK_MASK) |
++
++		((0x21 << SDHCI_CLOCK_BASE_SHIFT)
++			& SDHCI_CLOCK_BASE_MASK) |
+ 
++		SDHCI_TIMEOUT_CLK_UNIT |
++		SDHCI_CAN_VDD_330 |
++		SDHCI_CAN_DO_SDMA;
++	return 0;
++}
++
++static int ricoh_mmc_resume(struct sdhci_pci_chip *chip)
++{
++	/* Apply a delay to allow controller to settle */
++	/* Otherwise it becomes confused if card state changed
++		during suspend */
++	msleep(500);
+ 	return 0;
+ }
+ 
+@@ -95,6 +119,15 @@ static const struct sdhci_pci_fixes sdhci_ricoh = {
+ 			  SDHCI_QUIRK_CLOCK_BEFORE_RESET,
+ };
+ 
++static const struct sdhci_pci_fixes sdhci_ricoh_mmc = {
++	.probe_slot	= ricoh_mmc_probe_slot,
++	.resume		= ricoh_mmc_resume,
++	.quirks		= SDHCI_QUIRK_32BIT_DMA_ADDR |
++			  SDHCI_QUIRK_CLOCK_BEFORE_RESET |
++			  SDHCI_QUIRK_NO_CARD_NO_RESET |
++			  SDHCI_QUIRK_MISSING_CAPS
++};
++
+ static const struct sdhci_pci_fixes sdhci_ene_712 = {
+ 	.quirks		= SDHCI_QUIRK_SINGLE_POWER_WRITE |
+ 			  SDHCI_QUIRK_BROKEN_DMA,
+@@ -374,6 +407,14 @@ static const struct pci_device_id pci_ids[] __devinitdata = {
+ 	},
+ 
+ 	{
++		.vendor         = PCI_VENDOR_ID_RICOH,
++		.device         = 0x843,
++		.subvendor      = PCI_ANY_ID,
++		.subdevice      = PCI_ANY_ID,
++		.driver_data    = (kernel_ulong_t)&sdhci_ricoh_mmc,
++	},
++
++	{
+ 		.vendor		= PCI_VENDOR_ID_ENE,
+ 		.device		= PCI_DEVICE_ID_ENE_CB712_SD,
+ 		.subvendor	= PCI_ANY_ID,
+diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
+index 955cad9..8e1dda3 100644
+--- a/drivers/mmc/host/sdhci.c
++++ b/drivers/mmc/host/sdhci.c
+@@ -1692,7 +1692,8 @@ int sdhci_add_host(struct sdhci_host *host)
+ 			host->version);
+ 	}
+ 
+-	caps = sdhci_readl(host, SDHCI_CAPABILITIES);
++	caps = (host->quirks & SDHCI_QUIRK_MISSING_CAPS) ? host->caps :
++		sdhci_readl(host, SDHCI_CAPABILITIES);
+ 
+ 	if (host->quirks & SDHCI_QUIRK_FORCE_DMA)
+ 		host->flags |= SDHCI_USE_SDMA;
+diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
+index eb5efe0..030de49 100644
+--- a/drivers/mmc/host/sdhci.h
++++ b/drivers/mmc/host/sdhci.h
+@@ -241,6 +241,8 @@ struct sdhci_host {
+ #define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN		(1<<25)
+ /* Controller cannot support End Attribute in NOP ADMA descriptor */
+ #define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC		(1<<26)
++/* Controller is missing device caps. Use caps provided by host */
++#define SDHCI_QUIRK_MISSING_CAPS			(1<<27)
+ 
+ 	int			irq;		/* Device IRQ */
+ 	void __iomem *		ioaddr;		/* Mapped address */
+@@ -293,6 +295,8 @@ struct sdhci_host {
+ 
+ 	struct timer_list	timer;		/* Timer for timeouts */
+ 
++	unsigned int		caps;		/* Alternative capabilities */
++
+ 	unsigned long		private[0] ____cacheline_aligned;
+ };
+ 
+-- 
+1.7.1
+
+_______________________________________________
+kernel mailing list
+kernel at lists.fedoraproject.org
+https://admin.fedoraproject.org/mailman/listinfo/kernel
+
diff --git a/sdhci-8-bit-data-transfer-width-support.patch b/sdhci-8-bit-data-transfer-width-support.patch
new file mode 100644
index 0000000..94210a8
--- /dev/null
+++ b/sdhci-8-bit-data-transfer-width-support.patch
@@ -0,0 +1,57 @@
+From kernel-bounces at lists.fedoraproject.org Thu Sep  9 09:23:49 2010
+From: Stanislaw Gruszka <sgruszka at redhat.com>
+Subject: [PATCH 1/3] sdhci: 8-bit data transfer width support
+Date: Thu,  9 Sep 2010 15:24:10 +0200
+
+From: Kyungmin Park <kyungmin.park at samsung.com>
+
+Upstream ae6d6c92212e94b12ab9365c23fb73acc2c3c2e7 commit.
+
+Some host controllers such as s5pc110 support the WIDE8 feature.
+
+Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
+Cc: Grant Likely <grant.likely at secretlab.ca>
+Cc: <linux-mmc at vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+ drivers/mmc/host/sdhci.c |    5 +++++
+ drivers/mmc/host/sdhci.h |    1 +
+ 2 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
+index c6d1bd8..955cad9 100644
+--- a/drivers/mmc/host/sdhci.c
++++ b/drivers/mmc/host/sdhci.c
+@@ -1159,6 +1159,11 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
+ 
+ 	ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
+ 
++	if (ios->bus_width == MMC_BUS_WIDTH_8)
++		ctrl |= SDHCI_CTRL_8BITBUS;
++	else
++		ctrl &= ~SDHCI_CTRL_8BITBUS;
++
+ 	if (ios->bus_width == MMC_BUS_WIDTH_4)
+ 		ctrl |= SDHCI_CTRL_4BITBUS;
+ 	else
+diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
+index c846813..eb5efe0 100644
+--- a/drivers/mmc/host/sdhci.h
++++ b/drivers/mmc/host/sdhci.h
+@@ -72,6 +72,7 @@
+ #define   SDHCI_CTRL_ADMA1	0x08
+ #define   SDHCI_CTRL_ADMA32	0x10
+ #define   SDHCI_CTRL_ADMA64	0x18
++#define  SDHCI_CTRL_8BITBUS	0x20
+ 
+ #define SDHCI_POWER_CONTROL	0x29
+ #define  SDHCI_POWER_ON		0x01
+-- 
+1.7.1
+
+_______________________________________________
+kernel mailing list
+kernel at lists.fedoraproject.org
+https://admin.fedoraproject.org/mailman/listinfo/kernel
+


More information about the scm-commits mailing list