All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Intel MID SDHCI support (take two)
@ 2010-09-13 17:38 Alan Cox
  2010-09-13 17:38 ` [PATCH 1/7] sdhci: Rework some of the quirk behaviour Alan Cox
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Alan Cox @ 2010-09-13 17:38 UTC (permalink / raw)
  To: linux-mmc, cjb

Please ignore the original submission I found a nasty bug in it while I
was submitting.

---

Alan Cox (6):
      sdhci: Tidy up sdhci.c
      sdhci_pci: Tidy this as well
      sdhci: Tidy up spaces in sdhci_intel_mid
      mmc: serialization support
      sdhci: Allow the probe handler to override slots
      sdhci: Rework some of the quirk behaviour

Xiaochen Shen (1):
      sdhci: Intel Medfield support


 drivers/mmc/core/core.c            |   30 ++++++
 drivers/mmc/host/Kconfig           |   11 ++
 drivers/mmc/host/Makefile          |    1 
 drivers/mmc/host/sdhci-intel-mid.c |  170 ++++++++++++++++++++++++++++++++++++
 drivers/mmc/host/sdhci-pci.c       |  153 ++++++++++++++++++++++++++++----
 drivers/mmc/host/sdhci.c           |  118 +++++++++++++++++--------
 drivers/mmc/host/sdhci.h           |   21 ++++
 include/linux/mmc/core.h           |    1 
 include/linux/mmc/host.h           |    3 +
 include/linux/pci_ids.h            |    7 +
 10 files changed, 452 insertions(+), 63 deletions(-)
 create mode 100644 drivers/mmc/host/sdhci-intel-mid.c

-- 
	"Standards committees don't like hashing.  It looks complicated and
         insufficiently deterministic on an overhead projector."
			-Vern Schryver


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

* [PATCH 1/7] sdhci: Rework some of the quirk behaviour
  2010-09-13 17:38 [PATCH 0/7] Intel MID SDHCI support (take two) Alan Cox
@ 2010-09-13 17:38 ` Alan Cox
  2010-09-14 14:34   ` Wolfram Sang
  2010-09-13 17:39 ` [PATCH 2/7] sdhci: Allow the probe handler to override slots Alan Cox
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Alan Cox @ 2010-09-13 17:38 UTC (permalink / raw)
  To: linux-mmc, cjb

As the quirks go ever more complex it's getting harder and harder to integrate
new drivers. The Intel MID devices add a whole further collection of new
quirks so instead of quirks start moving some stuff to overridable functions.

We also introduce an sdhci_reset_all helper which is told if the reset is
being done during init (which needs to be avoided by some hw) or on exit
in which case it doesn't.

Arguably the driver wants to be lots of drivers and "libsdhci" but that would
be a massive undertaking.

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/mmc/host/Kconfig           |   11 ++
 drivers/mmc/host/Makefile          |    1 
 drivers/mmc/host/sdhci-intel-mid.c |  163 ++++++++++++++++++++++++++++++++++++
 drivers/mmc/host/sdhci-pci.c       |   56 ++++++++++++
 drivers/mmc/host/sdhci.c           |   61 ++++++++++---
 drivers/mmc/host/sdhci.h           |   20 ++++
 include/linux/pci_ids.h            |    2 
 7 files changed, 296 insertions(+), 18 deletions(-)
 create mode 100644 drivers/mmc/host/sdhci-intel-mid.c


diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index ce099c4..ffa40f1 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -81,6 +81,17 @@ config MMC_RICOH_MMC
 
 	  If unsure, say Y.
 
+config MMC_SDHCI_INTEL_MID
+	tristate "SDHCI support on Intel MID platforms"
+	depends on MMC_SDHCI_PCI
+	help
+	  This includes support for the SDHCI controllers found on Intel
+	  MID platform systems.
+
+	  If you have a controller with this interface, say Y or M here.
+
+	  If unsure, say N.
+
 config MMC_SDHCI_OF
 	tristate "SDHCI support on OpenFirmware platforms"
 	depends on MMC_SDHCI && PPC_OF
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 697bbfe..21c80f0 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_MMC_MXC)		+= mxcmmc.o
 obj-$(CONFIG_MMC_SDHCI)		+= sdhci.o
 obj-$(CONFIG_MMC_SDHCI_MV)	+= sdhci-mv.o
 obj-$(CONFIG_MMC_SDHCI_PCI)	+= sdhci-pci.o
+obj-$(CONFIG_MMC_SDHCI_INTEL_MID)	+= sdhci-intel-mid.o
 obj-$(CONFIG_MMC_SDHCI_S3C)	+= sdhci-s3c.o
 obj-$(CONFIG_MMC_SDHCI_SPEAR)	+= sdhci-spear.o
 obj-$(CONFIG_MMC_WBSD)		+= wbsd.o
diff --git a/drivers/mmc/host/sdhci-intel-mid.c b/drivers/mmc/host/sdhci-intel-mid.c
new file mode 100644
index 0000000..2828831
--- /dev/null
+++ b/drivers/mmc/host/sdhci-intel-mid.c
@@ -0,0 +1,163 @@
+#include <linux/delay.h>
+#include <linux/highmem.h>
+#include <linux/io.h>
+#include <linux/dma-mapping.h>
+#include <linux/slab.h>
+#include <linux/scatterlist.h>
+#include <linux/regulator/consumer.h>
+
+#include <linux/leds.h>
+
+#include <linux/mmc/host.h>
+
+#include "sdhci.h"
+
+/*
+ *	Support code for SDHCI on Intel MID platforms. We have lots
+ * 	of quirks specific to these platforms so wrap them up in one place
+ *	that keeps them out of the main flow. We can't just make it a new
+ *	driver as the shdci core code isn't really a library.
+ */
+ 
+static void sdhci_broken_reset(struct sdhci_host *host, u8 mask)
+{
+	unsigned long timeout;
+	u32 uninitialized_var(ier);
+
+	if (host->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) {
+		if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) &
+			SDHCI_CARD_PRESENT))
+			return;
+	}
+
+	if (host->quirks & SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET)
+		ier = sdhci_readl(host, SDHCI_INT_ENABLE);
+
+	sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET);
+
+	if (mask & SDHCI_RESET_ALL)
+		host->clock = 0;
+
+	/* Wait max 100 ms */
+	timeout = 100;
+
+	/* hw clears the bit when it's done */
+	while (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) {
+		if (timeout == 0) {
+			printk(KERN_ERR "%s: Reset 0x%x never completed.\n",
+				mmc_hostname(host->mmc), (int)mask);
+		}
+		timeout--;
+		mdelay(1);
+	}
+	if (host->quirks & SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET)
+		sdhci_clear_set_irqs(host, SDHCI_INT_ALL_MASK, ier);
+}
+
+static void sdhci_mid_broken_resetall(struct sdhci_host *host, int down)
+{
+	if (down)
+		sdhci_broken_reset(host, SDHCI_RESET_ALL);
+}
+
+static void sdhci_mid_init_no_reset(struct sdhci_host *host, int soft)
+{
+	u32 intmask;
+
+	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
+	sdhci_writel(host,
+		intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE),
+		SDHCI_INT_STATUS);
+
+        /* Ensure any IRQ left over from pre boot time (eg from Kboot) does
+           not turn up and cause chaos */
+	sdhci_writel(host, 0, SDHCI_INT_ENABLE);
+	sdhci_writel(host, 0, SDHCI_SIGNAL_ENABLE);
+
+	sdhci_clear_set_irqs(host, SDHCI_INT_ALL_MASK,
+		SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT |
+		SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_INDEX |
+		SDHCI_INT_END_BIT | SDHCI_INT_CRC | SDHCI_INT_TIMEOUT |
+		SDHCI_INT_DATA_END | SDHCI_INT_RESPONSE);
+
+	if (soft) {
+		/* force clock reconfiguration */
+		host->clock = 0;
+		sdhci_set_ios(host->mmc, &host->mmc->ios);
+	}
+
+	/* disable wakeup signal during initialization */
+	sdhci_writeb(host, 0x0, SDHCI_WAKE_UP_CONTROL);
+}
+
+/*
+ * HW problem exists in LNW A3 so clock register has to be set
+ * for every command if both SDIO0 and SDIO1 are enabled.
+ */
+static void sdhci_clock_reset(struct sdhci_host *host)
+{
+	u16 clk;
+	unsigned long timeout;
+
+	clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
+
+	clk |= SDHCI_CLOCK_CARD_EN;
+	sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
+
+	/* Wait max 10 ms */
+	timeout = 10;
+	while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
+		& SDHCI_CLOCK_INT_STABLE)) {
+		if (timeout == 0) {
+			printk(KERN_ERR "%s: Internal clock never "
+				"stabilised.\n",
+				mmc_hostname(host->mmc));
+			sdhci_dumpregs(host);
+			return;
+		}
+		timeout--;
+		mdelay(1);
+	}
+}
+
+static void sdhci_clockreset_wcmd(struct sdhci_host *host,
+				struct mmc_command *cmd, int flags)
+{
+	sdhci_clock_reset(host);
+ 	sdhci_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags), SDHCI_COMMAND);
+}
+
+static void sdhci_lnw_a3_set_ios(struct sdhci_host *host,
+					struct mmc_ios *ios, u8 ctrl)
+{
+	/*
+	 * For LNW A3, HISPD bit has to be cleared in order to
+	 * enable the 50MHz clock
+	 */
+	if (ios->timing == MMC_TIMING_SD_HS ||
+			ios->timing == MMC_TIMING_MMC_HS)
+		ctrl |= SDHCI_CTRL_HISPD;
+	else
+		ctrl &= ~SDHCI_CTRL_HISPD;
+	sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
+}
+
+/*
+ * HW problem exists in LNW A3 which leads to fake interrupt on SDIO1 if SDIO0
+ * and SDIO1 are both enabled.
+ */
+static void sdhci_lnw_a3_unexpected_cmd(struct sdhci_host *host, u32 intmask)
+{
+}
+
+struct sdhci_ops sdhci_intel_mrst_hc = {
+	.reset = sdhci_broken_reset,
+	.init = sdhci_mid_init_no_reset,
+	.set_ios = sdhci_lnw_a3_set_ios,
+	.reset_all = sdhci_mid_broken_resetall,
+	.write_command = sdhci_clockreset_wcmd,
+	.unexpected_cmd_irq = sdhci_lnw_a3_unexpected_cmd,
+};
+EXPORT_SYMBOL_GPL(sdhci_intel_mrst_hc);
+
+
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index e8aa99d..3e29e94 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -54,6 +54,8 @@ struct sdhci_pci_fixes {
 	int			(*suspend)(struct sdhci_pci_chip*,
 					pm_message_t);
 	int			(*resume)(struct sdhci_pci_chip*);
+
+	struct sdhci_ops	*host_ops;
 };
 
 struct sdhci_pci_slot {
@@ -397,6 +399,35 @@ static const struct sdhci_pci_fixes sdhci_via = {
 	.probe		= via_probe,
 };
 
+#if defined(CONFIG_MMC_SDHCI_INTEL_MID) || defined(CONFIG_MMC_SDHCI_INTEL_MID_MODULE)
+
+/*
+ * ADMA operation is disabled for Moorestown platform due to
+ * hardware bugs.
+ */
+static int mrst_hc0_probe(struct sdhci_pci_chip *chip)
+{
+	/*
+	 * slots number is fixed here for MRST as SDIO3 is never used and has
+	 * hardware bugs.
+	 */
+	chip->num_slots = 1;
+	return 0;
+}
+
+static const struct sdhci_pci_fixes sdhci_intel_mrst_hc0 = {
+	.quirks		= SDHCI_QUIRK_BROKEN_ADMA,
+	.probe		= mrst_hc0_probe,
+	.host_ops	= &sdhci_intel_mrst_hc,
+};
+
+static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1 = {
+	.quirks		= SDHCI_QUIRK_BROKEN_ADMA,
+	.host_ops	= &sdhci_intel_mrst_hc,
+};
+
+#endif
+
 static const struct pci_device_id pci_ids[] __devinitdata = {
 	{
 		.vendor		= PCI_VENDOR_ID_RICOH,
@@ -494,6 +525,23 @@ static const struct pci_device_id pci_ids[] __devinitdata = {
 		.driver_data	= (kernel_ulong_t)&sdhci_via,
 	},
 
+#if defined(CONFIG_MMC_SDHCI_INTEL_MID) || defined(CONFIG_MMC_SDHCI_INTEL_MID_MODULE)
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_MRST_SD0,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.driver_data	= (kernel_ulong_t)&sdhci_intel_mrst_hc0,
+	},
+
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_MRST_SD1,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.driver_data	= (kernel_ulong_t)&sdhci_intel_mrst_hc1,
+	},
+#endif
 	{	/* Generic SD host controller */
 		PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
 	},
@@ -509,7 +557,7 @@ MODULE_DEVICE_TABLE(pci, pci_ids);
  *                                                                           *
 \*****************************************************************************/
 
-static int sdhci_pci_enable_dma(struct sdhci_host *host)
+int sdhci_pci_enable_dma(struct sdhci_host *host)
 {
 	struct sdhci_pci_slot *slot;
 	struct pci_dev *pdev;
@@ -533,6 +581,7 @@ static int sdhci_pci_enable_dma(struct sdhci_host *host)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(sdhci_pci_enable_dma);
 
 static struct sdhci_ops sdhci_pci_ops = {
 	.enable_dma	= sdhci_pci_enable_dma,
@@ -687,7 +736,10 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
 	slot->pci_bar = bar;
 
 	host->hw_name = "PCI";
-	host->ops = &sdhci_pci_ops;
+	if (chip->fixes->host_ops)
+		host->ops = chip->fixes->host_ops;
+	else
+		host->ops = &sdhci_pci_ops;
 	host->quirks = chip->quirks;
 
 	host->irq = pdev->irq;
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index f608626..9d8091a 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -45,7 +45,7 @@ static void sdhci_finish_data(struct sdhci_host *);
 static void sdhci_send_command(struct sdhci_host *, struct mmc_command *);
 static void sdhci_finish_command(struct sdhci_host *);
 
-static void sdhci_dumpregs(struct sdhci_host *host)
+void sdhci_dumpregs(struct sdhci_host *host)
 {
 	printk(KERN_DEBUG DRIVER_NAME ": ============== REGISTER DUMP ==============\n");
 
@@ -87,6 +87,7 @@ static void sdhci_dumpregs(struct sdhci_host *host)
 
 	printk(KERN_DEBUG DRIVER_NAME ": ===========================================\n");
 }
+EXPORT_SYMBOL_GPL(sdhci_dumpregs);
 
 /*****************************************************************************\
  *                                                                           *
@@ -94,7 +95,7 @@ static void sdhci_dumpregs(struct sdhci_host *host)
  *                                                                           *
 \*****************************************************************************/
 
-static void sdhci_clear_set_irqs(struct sdhci_host *host, u32 clear, u32 set)
+void sdhci_clear_set_irqs(struct sdhci_host *host, u32 clear, u32 set)
 {
 	u32 ier;
 
@@ -104,6 +105,7 @@ static void sdhci_clear_set_irqs(struct sdhci_host *host, u32 clear, u32 set)
 	sdhci_writel(host, ier, SDHCI_INT_ENABLE);
 	sdhci_writel(host, ier, SDHCI_SIGNAL_ENABLE);
 }
+EXPORT_SYMBOL_GPL(sdhci_clear_set_irqs);
 
 static void sdhci_unmask_irqs(struct sdhci_host *host, u32 irqs)
 {
@@ -143,6 +145,11 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
 	unsigned long timeout;
 	u32 uninitialized_var(ier);
 
+	if (host->ops->reset) {
+		host->ops->reset(host, mask);
+		return;
+	}
+
 	if (host->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) {
 		if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) &
 			SDHCI_CARD_PRESENT))
@@ -176,14 +183,21 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
 		sdhci_clear_set_irqs(host, SDHCI_INT_ALL_MASK, ier);
 }
 
-static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios);
+/* Down is true if we are shutting down the port */
+static void sdhci_reset_all(struct sdhci_host *host, int down)
+{
+	if (host->ops->reset_all)
+		host->ops->reset_all(host, down);
+	else
+		sdhci_reset(host, SDHCI_RESET_ALL);
+}
 
 static void sdhci_init(struct sdhci_host *host, int soft)
 {
 	if (soft)
 		sdhci_reset(host, SDHCI_RESET_CMD|SDHCI_RESET_DATA);
 	else
-		sdhci_reset(host, SDHCI_RESET_ALL);
+		sdhci_reset_all(host, 0);
 
 	sdhci_clear_set_irqs(host, SDHCI_INT_ALL_MASK,
 		SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT |
@@ -945,7 +959,11 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
 	if (cmd->data)
 		flags |= SDHCI_CMD_DATA;
 
-	sdhci_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags), SDHCI_COMMAND);
+	if (host->ops->write_command)
+		host->ops->write_command(host, cmd, flags);
+	else
+		sdhci_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags),
+						SDHCI_COMMAND);
 }
 
 static void sdhci_finish_command(struct sdhci_host *host)
@@ -1139,7 +1157,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 	spin_unlock_irqrestore(&host->lock, flags);
 }
 
-static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
+void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 {
 	struct sdhci_host *host;
 	unsigned long flags;
@@ -1186,9 +1204,13 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	else
 		ctrl &= ~SDHCI_CTRL_HISPD;
 
-	sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
+	if (host->ops->set_ios)
+		host->ops->set_ios(host, ios, ctrl);
+	else
+		sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
 
-	/*
+	/*	FIXME: This can also be moved to ops->set_ios
+	 *
 	 * Some (ENE) controllers go apeshit on some ios operation,
 	 * signalling timeout and CRC errors even on CMD0. Resetting
 	 * it on each ios seems to solve the problem.
@@ -1200,6 +1222,7 @@ out:
 	mmiowb();
 	spin_unlock_irqrestore(&host->lock, flags);
 }
+EXPORT_SYMBOL_GPL(sdhci_set_ios);
 
 static int sdhci_get_ro(struct mmc_host *mmc)
 {
@@ -1383,10 +1406,13 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
 	BUG_ON(intmask == 0);
 
 	if (!host->cmd) {
-		printk(KERN_ERR "%s: Got command interrupt 0x%08x even "
-			"though no command operation was in progress.\n",
-			mmc_hostname(host->mmc), (unsigned)intmask);
-		sdhci_dumpregs(host);
+		if (host->ops->unexpected_cmd_irq)
+			host->ops->unexpected_cmd_irq(host, intmask);
+		else {
+			printk(KERN_ERR "%s: Got command interrupt 0x%08x even though no command operation was in progress.\n",
+				mmc_hostname(host->mmc), (unsigned)intmask);
+			sdhci_dumpregs(host);
+		}
 		return;
 	}
 
@@ -1703,7 +1729,7 @@ int sdhci_add_host(struct sdhci_host *host)
 	if (debug_quirks)
 		host->quirks = debug_quirks;
 
-	sdhci_reset(host, SDHCI_RESET_ALL);
+	sdhci_reset_all(host, 0);
 
 	host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
 	host->version = (host->version & SDHCI_SPEC_VER_MASK)
@@ -1829,6 +1855,9 @@ int sdhci_add_host(struct sdhci_host *host)
 	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
 		mmc->caps |= MMC_CAP_NEEDS_POLL;
 
+	if (host->ops->set_caps)
+		host->ops->set_caps(host);
+
 	mmc->ocr_avail = 0;
 	if (caps & SDHCI_CAN_VDD_330)
 		mmc->ocr_avail |= MMC_VDD_32_33|MMC_VDD_33_34;
@@ -1881,7 +1910,7 @@ int sdhci_add_host(struct sdhci_host *host)
 	} else {
 		mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >>
 				SDHCI_MAX_BLOCK_SHIFT;
-		if (mmc->max_blk_size >= 3) {
+		if (mmc->max_blk_size > 3) {
 			printk(KERN_WARNING "%s: Invalid maximum block size, "
 				"assuming 512 bytes\n", mmc_hostname(mmc));
 			mmc->max_blk_size = 0;
@@ -1952,7 +1981,7 @@ int sdhci_add_host(struct sdhci_host *host)
 
 #ifdef SDHCI_USE_LEDS_CLASS
 reset:
-	sdhci_reset(host, SDHCI_RESET_ALL);
+	sdhci_reset_all(host, 1);
 	free_irq(host->irq, host);
 #endif
 untasklet:
@@ -1993,7 +2022,7 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
 #endif
 
 	if (!dead)
-		sdhci_reset(host, SDHCI_RESET_ALL);
+		sdhci_reset_all(host, 1);
 
 	free_irq(host->irq, host);
 
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index d316bc7..182fcc3 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -323,6 +323,17 @@ struct sdhci_ops {
 	unsigned int	(*get_max_clock)(struct sdhci_host *host);
 	unsigned int	(*get_min_clock)(struct sdhci_host *host);
 	unsigned int	(*get_timeout_clock)(struct sdhci_host *host);
+
+	/* Interface hooks to allow drivers to override standard behaviour */
+	void	(*reset)(struct sdhci_host *host, u8 mask);
+	void	(*reset_all)(struct sdhci_host *host, int down);
+	void	(*init)(struct sdhci_host *host, int soft);
+	void 	(*write_command)(struct sdhci_host *host,
+				struct mmc_command *cmd, int flags);
+	void	(*set_ios)(struct sdhci_host *host,
+				struct mmc_ios *ios, u8 ctrl);
+	void	(*set_caps)(struct sdhci_host *host);
+	void	(*unexpected_cmd_irq)(struct sdhci_host *host, u32 intmask);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
@@ -427,4 +438,13 @@ extern int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state);
 extern int sdhci_resume_host(struct sdhci_host *host);
 #endif
 
+extern void sdhci_clear_set_irqs(struct sdhci_host *host, u32 clear, u32 set);
+extern int sdhci_pci_enable_dma(struct sdhci_host *host);
+extern void sdhci_dumpregs(struct sdhci_host *host);
+extern void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios);
+
+/* Host function sets from driver support files */
+extern struct sdhci_ops sdhci_intel_mrst_hc;
+
+
 #endif /* __SDHCI_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 9438660..674316e 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2410,6 +2410,8 @@
 #define PCI_DEVICE_ID_INTEL_82375	0x0482
 #define PCI_DEVICE_ID_INTEL_82424	0x0483
 #define PCI_DEVICE_ID_INTEL_82378	0x0484
+#define PCI_DEVICE_ID_INTEL_MRST_SD0	0x0807
+#define PCI_DEVICE_ID_INTEL_MRST_SD1	0x0808
 #define PCI_DEVICE_ID_INTEL_I960	0x0960
 #define PCI_DEVICE_ID_INTEL_I960RM	0x0962
 #define PCI_DEVICE_ID_INTEL_8257X_SOL	0x1062


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

* [PATCH 2/7] sdhci: Allow the probe handler to override slots
  2010-09-13 17:38 [PATCH 0/7] Intel MID SDHCI support (take two) Alan Cox
  2010-09-13 17:38 ` [PATCH 1/7] sdhci: Rework some of the quirk behaviour Alan Cox
@ 2010-09-13 17:39 ` Alan Cox
  2010-09-13 17:39 ` [PATCH 3/7] sdhci: Intel Medfield support Alan Cox
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Alan Cox @ 2010-09-13 17:39 UTC (permalink / raw)
  To: linux-mmc, cjb

Currently we write it to the chip data, but if the probe handler overrides
it we ignore the new value and keep using our cached one. Fix this so that
a probe handler can adjust the slot count

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/mmc/host/sdhci-pci.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 3e29e94..9b0a348 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -870,6 +870,8 @@ static int __devinit sdhci_pci_probe(struct pci_dev *pdev,
 			goto free;
 	}
 
+	slots = chip->num_slots;	/* Quirk may have changed this */
+
 	for (i = 0;i < slots;i++) {
 		slot = sdhci_pci_probe_slot(pdev, chip, first_bar + i);
 		if (IS_ERR(slot)) {


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

* [PATCH 3/7] sdhci: Intel Medfield support
  2010-09-13 17:38 [PATCH 0/7] Intel MID SDHCI support (take two) Alan Cox
  2010-09-13 17:38 ` [PATCH 1/7] sdhci: Rework some of the quirk behaviour Alan Cox
  2010-09-13 17:39 ` [PATCH 2/7] sdhci: Allow the probe handler to override slots Alan Cox
@ 2010-09-13 17:39 ` Alan Cox
  2010-09-13 17:39 ` [PATCH 4/7] mmc: serialization support Alan Cox
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Alan Cox @ 2010-09-13 17:39 UTC (permalink / raw)
  To: linux-mmc, cjb

From: Xiaochen Shen <xiaochen.shen@intel.com>

Basic support for the Intel Medfield devices

Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/mmc/host/sdhci-pci.c |   49 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/pci_ids.h      |    5 ++++
 2 files changed, 54 insertions(+), 0 deletions(-)


diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 9b0a348..1324369 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -426,6 +426,15 @@ static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1 = {
 	.host_ops	= &sdhci_intel_mrst_hc,
 };
 
+static const struct sdhci_pci_fixes sdhci_intel_mfd_sd = {
+	.quirks		= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
+};
+
+static const struct sdhci_pci_fixes sdhci_intel_mfd_emmc_sdio = {
+	.quirks		= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
+};
+
+
 #endif
 
 static const struct pci_device_id pci_ids[] __devinitdata = {
@@ -541,6 +550,46 @@ static const struct pci_device_id pci_ids[] __devinitdata = {
 		.subdevice	= PCI_ANY_ID,
 		.driver_data	= (kernel_ulong_t)&sdhci_intel_mrst_hc1,
 	},
+
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_MFD_SD,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.driver_data	= (kernel_ulong_t)&sdhci_intel_mfd_sd,
+	},
+
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_MFD_SDIO1,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.driver_data	= (kernel_ulong_t)&sdhci_intel_mfd_emmc_sdio,
+	},
+
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_MFD_SDIO2,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.driver_data	= (kernel_ulong_t)&sdhci_intel_mfd_emmc_sdio,
+	},
+
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_MFD_EMMC0,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.driver_data	= (kernel_ulong_t)&sdhci_intel_mfd_emmc_sdio,
+	},
+
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_MFD_EMMC1,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.driver_data	= (kernel_ulong_t)&sdhci_intel_mfd_emmc_sdio,
+	},
 #endif
 	{	/* Generic SD host controller */
 		PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 674316e..fd619e8 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2412,6 +2412,11 @@
 #define PCI_DEVICE_ID_INTEL_82378	0x0484
 #define PCI_DEVICE_ID_INTEL_MRST_SD0	0x0807
 #define PCI_DEVICE_ID_INTEL_MRST_SD1	0x0808
+#define PCI_DEVICE_ID_INTEL_MFD_SD	0x0820
+#define PCI_DEVICE_ID_INTEL_MFD_SDIO1	0x0821
+#define PCI_DEVICE_ID_INTEL_MFD_SDIO2	0x0822
+#define PCI_DEVICE_ID_INTEL_MFD_EMMC0	0x0823
+#define PCI_DEVICE_ID_INTEL_MFD_EMMC1	0x0824
 #define PCI_DEVICE_ID_INTEL_I960	0x0960
 #define PCI_DEVICE_ID_INTEL_I960RM	0x0962
 #define PCI_DEVICE_ID_INTEL_8257X_SOL	0x1062


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

* [PATCH 4/7] mmc: serialization support
  2010-09-13 17:38 [PATCH 0/7] Intel MID SDHCI support (take two) Alan Cox
                   ` (2 preceding siblings ...)
  2010-09-13 17:39 ` [PATCH 3/7] sdhci: Intel Medfield support Alan Cox
@ 2010-09-13 17:39 ` Alan Cox
  2010-09-13 17:39 ` [PATCH 5/7] sdhci: Tidy up spaces in sdhci_intel_mid Alan Cox
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Alan Cox @ 2010-09-13 17:39 UTC (permalink / raw)
  To: linux-mmc, cjb

Some hardware has restrictions that require only one command is outstanding
per controller or some other similar restriction.

Provide optional serialization support and enable it for the Intel MID
platform devices with this restriction. Split up from some existing patches
by JiebingLi.

Signed-off-by: JiebingLi <jiebing.li@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/mmc/core/core.c            |   30 ++++++++++++++++++++++++++----
 drivers/mmc/host/sdhci-intel-mid.c |   33 ++++++++++++++++++++-------------
 drivers/mmc/host/sdhci-pci.c       |    2 ++
 drivers/mmc/host/sdhci.c           |   18 ++++++++++++++++++
 drivers/mmc/host/sdhci.h           |    1 +
 include/linux/mmc/core.h           |    1 +
 include/linux/mmc/host.h           |    3 +++
 7 files changed, 71 insertions(+), 17 deletions(-)


diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 5db49b1..b2abb68 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -202,11 +202,14 @@ static void mmc_wait_done(struct mmc_request *mrq)
  *	@host: MMC host to start command
  *	@mrq: MMC request to start
  *
- *	Start a new MMC custom command request for a host, and wait
- *	for the command to complete. Does not attempt to parse the
- *	response.
+ *	Implementation hander for starting a new MMC custom command request
+ *	for a host, and wait for the command to complete. Does not attempt to
+ *	parse the response.
+ *
+ *	We provide this separately and export it so that it can be wrapped
+ *	by callers who need serialization or have other issue constraints
  */
-void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
+void mmc_do_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
 {
 	DECLARE_COMPLETION_ONSTACK(complete);
 
@@ -218,6 +221,25 @@ void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
 	wait_for_completion(&complete);
 }
 
+EXPORT_SYMBOL(mmc_do_wait_for_req);
+
+/**
+ *	mmc_wait_for_req - start a request and wait for completion
+ *	@host: MMC host to start command
+ *	@mrq: MMC request to start
+ *
+ *	Start a new MMC custom command request for a host, and wait
+ *	for the command to complete. Does not attempt to parse the
+ *	response.
+ */
+void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
+{
+	if (host->ops->wait_for_req)
+		host->ops->wait_for_req(host, mrq);
+	else
+		return mmc_do_wait_for_req(host, mrq);
+}
+
 EXPORT_SYMBOL(mmc_wait_for_req);
 
 /**
diff --git a/drivers/mmc/host/sdhci-intel-mid.c b/drivers/mmc/host/sdhci-intel-mid.c
index 2828831..436ee46 100644
--- a/drivers/mmc/host/sdhci-intel-mid.c
+++ b/drivers/mmc/host/sdhci-intel-mid.c
@@ -18,20 +18,27 @@
  *	that keeps them out of the main flow. We can't just make it a new
  *	driver as the shdci core code isn't really a library.
  */
- 
+
+/*
+ *	Support serialization
+ */
+
+static DEFINE_MUTEX(port_mutex);
+
+static void sdhci_intel_wait_req(struct sdhci_host *host,
+                                                struct mmc_request *mrq)
+{
+        mutex_lock(&port_mutex);
+        mmc_do_wait_for_req(host->mmc, mrq);
+        mutex_unlock(&port_mutex);
+}
+
+/*
+ *	Handle the Moorestown reset
+ */ 
 static void sdhci_broken_reset(struct sdhci_host *host, u8 mask)
 {
 	unsigned long timeout;
-	u32 uninitialized_var(ier);
-
-	if (host->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) {
-		if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) &
-			SDHCI_CARD_PRESENT))
-			return;
-	}
-
-	if (host->quirks & SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET)
-		ier = sdhci_readl(host, SDHCI_INT_ENABLE);
 
 	sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET);
 
@@ -46,12 +53,11 @@ static void sdhci_broken_reset(struct sdhci_host *host, u8 mask)
 		if (timeout == 0) {
 			printk(KERN_ERR "%s: Reset 0x%x never completed.\n",
 				mmc_hostname(host->mmc), (int)mask);
+			return;
 		}
 		timeout--;
 		mdelay(1);
 	}
-	if (host->quirks & SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET)
-		sdhci_clear_set_irqs(host, SDHCI_INT_ALL_MASK, ier);
 }
 
 static void sdhci_mid_broken_resetall(struct sdhci_host *host, int down)
@@ -156,6 +162,7 @@ struct sdhci_ops sdhci_intel_mrst_hc = {
 	.set_ios = sdhci_lnw_a3_set_ios,
 	.reset_all = sdhci_mid_broken_resetall,
 	.write_command = sdhci_clockreset_wcmd,
+	.wait_for_req = sdhci_intel_wait_req,
 	.unexpected_cmd_irq = sdhci_lnw_a3_unexpected_cmd,
 };
 EXPORT_SYMBOL_GPL(sdhci_intel_mrst_hc);
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 1324369..bb14047 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -55,6 +55,8 @@ struct sdhci_pci_fixes {
 					pm_message_t);
 	int			(*resume)(struct sdhci_pci_chip*);
 
+	/* Allow the driver to override some operations for particularly
+	   quirky chips */
 	struct sdhci_ops	*host_ops;
 };
 
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9d8091a..9d8047c 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1268,6 +1268,12 @@ out:
 	spin_unlock_irqrestore(&host->lock, flags);
 }
 
+static void sdhci_wait_for_req(struct mmc_host *mmc, struct mmc_request *mrq)
+{
+	struct sdhci_host *host = mmc_priv(mmc);
+	host->ops->wait_for_req(host, mrq);
+}
+
 static const struct mmc_host_ops sdhci_ops = {
 	.request	= sdhci_request,
 	.set_ios	= sdhci_set_ios,
@@ -1275,6 +1281,16 @@ static const struct mmc_host_ops sdhci_ops = {
 	.enable_sdio_irq = sdhci_enable_sdio_irq,
 };
 
+/* Operations struct we use if the controller has an sdhci level
+   ops->wait_for_req */
+static const struct mmc_host_ops sdhci_ops_wait = {
+	.request	= sdhci_request,
+	.set_ios	= sdhci_set_ios,
+	.get_ro		= sdhci_get_ro,
+	.enable_sdio_irq = sdhci_enable_sdio_irq,
+	.wait_for_req	= sdhci_wait_for_req,
+};
+
 /*****************************************************************************\
  *                                                                           *
  * Tasklets                                                                  *
@@ -1839,6 +1855,8 @@ int sdhci_add_host(struct sdhci_host *host)
 	 * Set host parameters.
 	 */
 	mmc->ops = &sdhci_ops;
+	if (host->ops->wait_for_req)
+		mmc->ops = &sdhci_ops_wait;
 	if (host->ops->get_min_clock)
 		mmc->f_min = host->ops->get_min_clock(host);
 	else
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 182fcc3..7c934bd 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -334,6 +334,7 @@ struct sdhci_ops {
 				struct mmc_ios *ios, u8 ctrl);
 	void	(*set_caps)(struct sdhci_host *host);
 	void	(*unexpected_cmd_irq)(struct sdhci_host *host, u32 intmask);
+	void	(*wait_for_req)(struct sdhci_host *host, struct mmc_request *mrq);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 7429033..6eaf5dd 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -132,6 +132,7 @@ struct mmc_host;
 struct mmc_card;
 
 extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
+extern void mmc_do_wait_for_req(struct mmc_host *, struct mmc_request *);
 extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
 extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
 	struct mmc_command *, int);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index ded4017..1b0e162 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -111,6 +111,9 @@ struct mmc_host_ops {
 
 	/* optional callback for HC quirks */
 	void	(*init_card)(struct mmc_host *host, struct mmc_card *card);
+	/* optional callback for serialization */
+	void	(*wait_for_req)(struct mmc_host *host,
+						struct mmc_request *mrq);
 };
 
 struct mmc_card;


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

* [PATCH 5/7] sdhci: Tidy up spaces in sdhci_intel_mid
  2010-09-13 17:38 [PATCH 0/7] Intel MID SDHCI support (take two) Alan Cox
                   ` (3 preceding siblings ...)
  2010-09-13 17:39 ` [PATCH 4/7] mmc: serialization support Alan Cox
@ 2010-09-13 17:39 ` Alan Cox
  2010-09-14 14:21   ` Wolfram Sang
  2010-09-13 17:39 ` [PATCH 6/7] sdhci_pci: Tidy this as well Alan Cox
  2010-09-13 17:39 ` [PATCH 7/7] sdhci: Tidy up sdhci.c Alan Cox
  6 siblings, 1 reply; 17+ messages in thread
From: Alan Cox @ 2010-09-13 17:39 UTC (permalink / raw)
  To: linux-mmc, cjb

Coding style fixes

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/mmc/host/sdhci-intel-mid.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)


diff --git a/drivers/mmc/host/sdhci-intel-mid.c b/drivers/mmc/host/sdhci-intel-mid.c
index 436ee46..5057133 100644
--- a/drivers/mmc/host/sdhci-intel-mid.c
+++ b/drivers/mmc/host/sdhci-intel-mid.c
@@ -14,7 +14,7 @@
 
 /*
  *	Support code for SDHCI on Intel MID platforms. We have lots
- * 	of quirks specific to these platforms so wrap them up in one place
+ *	of quirks specific to these platforms so wrap them up in one place
  *	that keeps them out of the main flow. We can't just make it a new
  *	driver as the shdci core code isn't really a library.
  */
@@ -26,16 +26,16 @@
 static DEFINE_MUTEX(port_mutex);
 
 static void sdhci_intel_wait_req(struct sdhci_host *host,
-                                                struct mmc_request *mrq)
+						struct mmc_request *mrq)
 {
-        mutex_lock(&port_mutex);
-        mmc_do_wait_for_req(host->mmc, mrq);
-        mutex_unlock(&port_mutex);
+	mutex_lock(&port_mutex);
+	mmc_do_wait_for_req(host->mmc, mrq);
+	mutex_unlock(&port_mutex);
 }
 
 /*
  *	Handle the Moorestown reset
- */ 
+ */
 static void sdhci_broken_reset(struct sdhci_host *host, u8 mask)
 {
 	unsigned long timeout;
@@ -75,8 +75,8 @@ static void sdhci_mid_init_no_reset(struct sdhci_host *host, int soft)
 		intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE),
 		SDHCI_INT_STATUS);
 
-        /* Ensure any IRQ left over from pre boot time (eg from Kboot) does
-           not turn up and cause chaos */
+	/* Ensure any IRQ left over from pre boot time (eg from Kboot) does
+	   not turn up and cause chaos */
 	sdhci_writel(host, 0, SDHCI_INT_ENABLE);
 	sdhci_writel(host, 0, SDHCI_SIGNAL_ENABLE);
 
@@ -130,7 +130,7 @@ static void sdhci_clockreset_wcmd(struct sdhci_host *host,
 				struct mmc_command *cmd, int flags)
 {
 	sdhci_clock_reset(host);
- 	sdhci_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags), SDHCI_COMMAND);
+	sdhci_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags), SDHCI_COMMAND);
 }
 
 static void sdhci_lnw_a3_set_ios(struct sdhci_host *host,


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

* [PATCH 6/7] sdhci_pci: Tidy this as well
  2010-09-13 17:38 [PATCH 0/7] Intel MID SDHCI support (take two) Alan Cox
                   ` (4 preceding siblings ...)
  2010-09-13 17:39 ` [PATCH 5/7] sdhci: Tidy up spaces in sdhci_intel_mid Alan Cox
@ 2010-09-13 17:39 ` Alan Cox
  2010-09-13 17:39 ` [PATCH 7/7] sdhci: Tidy up sdhci.c Alan Cox
  6 siblings, 0 replies; 17+ messages in thread
From: Alan Cox @ 2010-09-13 17:39 UTC (permalink / raw)
  To: linux-mmc, cjb

While doing the tidy up of the new stuff might as well tidy the old
---

 drivers/mmc/host/sdhci-pci.c |   48 ++++++++++++++++++++++--------------------
 1 files changed, 25 insertions(+), 23 deletions(-)


diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index bb14047..9692eab 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -21,8 +21,8 @@
 
 #include <linux/mmc/host.h>
 
-#include <asm/scatterlist.h>
-#include <asm/io.h>
+#include <linux/scatterlist.h>
+#include <linux/io.h>
 
 #include "sdhci.h"
 
@@ -46,14 +46,14 @@ struct sdhci_pci_slot;
 struct sdhci_pci_fixes {
 	unsigned int		quirks;
 
-	int			(*probe)(struct sdhci_pci_chip*);
+	int			(*probe)(struct sdhci_pci_chip *);
 
-	int			(*probe_slot)(struct sdhci_pci_slot*);
-	void			(*remove_slot)(struct sdhci_pci_slot*, int);
+	int			(*probe_slot)(struct sdhci_pci_slot *);
+	void			(*remove_slot)(struct sdhci_pci_slot *, int);
 
-	int			(*suspend)(struct sdhci_pci_chip*,
+	int			(*suspend)(struct sdhci_pci_chip *,
 					pm_message_t);
-	int			(*resume)(struct sdhci_pci_chip*);
+	int			(*resume)(struct sdhci_pci_chip *);
 
 	/* Allow the driver to override some operations for particularly
 	   quirky chips */
@@ -287,7 +287,7 @@ static int jmicron_suspend(struct sdhci_pci_chip *chip, pm_message_t state)
 	int i;
 
 	if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC) {
-		for (i = 0;i < chip->num_slots;i++)
+		for (i = 0; i < chip->num_slots; i++)
 			jmicron_enable_mmc(chip->slots[i]->host, 0);
 	}
 
@@ -299,7 +299,7 @@ static int jmicron_resume(struct sdhci_pci_chip *chip)
 	int ret, i;
 
 	if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC) {
-		for (i = 0;i < chip->num_slots;i++)
+		for (i = 0; i < chip->num_slots; i++)
 			jmicron_enable_mmc(chip->slots[i]->host, 1);
 	}
 
@@ -401,7 +401,8 @@ static const struct sdhci_pci_fixes sdhci_via = {
 	.probe		= via_probe,
 };
 
-#if defined(CONFIG_MMC_SDHCI_INTEL_MID) || defined(CONFIG_MMC_SDHCI_INTEL_MID_MODULE)
+#if defined(CONFIG_MMC_SDHCI_INTEL_MID) || \
+		defined(CONFIG_MMC_SDHCI_INTEL_MID_MODULE)
 
 /*
  * ADMA operation is disabled for Moorestown platform due to
@@ -536,7 +537,8 @@ static const struct pci_device_id pci_ids[] __devinitdata = {
 		.driver_data	= (kernel_ulong_t)&sdhci_via,
 	},
 
-#if defined(CONFIG_MMC_SDHCI_INTEL_MID) || defined(CONFIG_MMC_SDHCI_INTEL_MID_MODULE)
+#if defined(CONFIG_MMC_SDHCI_INTEL_MID) || \
+			defined(CONFIG_MMC_SDHCI_INTEL_MID_MODULE)
 	{
 		.vendor		= PCI_VENDOR_ID_INTEL,
 		.device		= PCI_DEVICE_ID_INTEL_MRST_SD0,
@@ -646,7 +648,7 @@ static struct sdhci_ops sdhci_pci_ops = {
 
 #ifdef CONFIG_PM
 
-static int sdhci_pci_suspend (struct pci_dev *pdev, pm_message_t state)
+static int sdhci_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 {
 	struct sdhci_pci_chip *chip;
 	struct sdhci_pci_slot *slot;
@@ -657,7 +659,7 @@ static int sdhci_pci_suspend (struct pci_dev *pdev, pm_message_t state)
 	if (!chip)
 		return 0;
 
-	for (i = 0;i < chip->num_slots;i++) {
+	for (i = 0; i < chip->num_slots; i++) {
 		slot = chip->slots[i];
 		if (!slot)
 			continue;
@@ -665,7 +667,7 @@ static int sdhci_pci_suspend (struct pci_dev *pdev, pm_message_t state)
 		ret = sdhci_suspend_host(slot->host, state);
 
 		if (ret) {
-			for (i--;i >= 0;i--)
+			for (i--; i >= 0; i--)
 				sdhci_resume_host(chip->slots[i]->host);
 			return ret;
 		}
@@ -676,7 +678,7 @@ static int sdhci_pci_suspend (struct pci_dev *pdev, pm_message_t state)
 	if (chip->fixes && chip->fixes->suspend) {
 		ret = chip->fixes->suspend(chip, state);
 		if (ret) {
-			for (i = chip->num_slots - 1;i >= 0;i--)
+			for (i = chip->num_slots - 1; i >= 0; i--)
 				sdhci_resume_host(chip->slots[i]->host);
 			return ret;
 		}
@@ -696,7 +698,7 @@ static int sdhci_pci_suspend (struct pci_dev *pdev, pm_message_t state)
 	return 0;
 }
 
-static int sdhci_pci_resume (struct pci_dev *pdev)
+static int sdhci_pci_resume(struct pci_dev *pdev)
 {
 	struct sdhci_pci_chip *chip;
 	struct sdhci_pci_slot *slot;
@@ -718,7 +720,7 @@ static int sdhci_pci_resume (struct pci_dev *pdev)
 			return ret;
 	}
 
-	for (i = 0;i < chip->num_slots;i++) {
+	for (i = 0; i < chip->num_slots; i++) {
 		slot = chip->slots[i];
 		if (!slot)
 			continue;
@@ -908,7 +910,7 @@ static int __devinit sdhci_pci_probe(struct pci_dev *pdev,
 	}
 
 	chip->pdev = pdev;
-	chip->fixes = (const struct sdhci_pci_fixes*)ent->driver_data;
+	chip->fixes = (const struct sdhci_pci_fixes *)ent->driver_data;
 	if (chip->fixes)
 		chip->quirks = chip->fixes->quirks;
 	chip->num_slots = slots;
@@ -923,10 +925,10 @@ static int __devinit sdhci_pci_probe(struct pci_dev *pdev,
 
 	slots = chip->num_slots;	/* Quirk may have changed this */
 
-	for (i = 0;i < slots;i++) {
+	for (i = 0; i < slots; i++) {
 		slot = sdhci_pci_probe_slot(pdev, chip, first_bar + i);
 		if (IS_ERR(slot)) {
-			for (i--;i >= 0;i--)
+			for (i--; i >= 0; i--)
 				sdhci_pci_remove_slot(chip->slots[i]);
 			ret = PTR_ERR(slot);
 			goto free;
@@ -954,7 +956,7 @@ static void __devexit sdhci_pci_remove(struct pci_dev *pdev)
 	chip = pci_get_drvdata(pdev);
 
 	if (chip) {
-		for (i = 0;i < chip->num_slots; i++)
+		for (i = 0; i < chip->num_slots; i++)
 			sdhci_pci_remove_slot(chip->slots[i]);
 
 		pci_set_drvdata(pdev, NULL);
@@ -965,9 +967,9 @@ static void __devexit sdhci_pci_remove(struct pci_dev *pdev)
 }
 
 static struct pci_driver sdhci_driver = {
-	.name = 	"sdhci-pci",
+	.name =		"sdhci-pci",
 	.id_table =	pci_ids,
-	.probe = 	sdhci_pci_probe,
+	.probe =	sdhci_pci_probe,
 	.remove =	__devexit_p(sdhci_pci_remove),
 	.suspend =	sdhci_pci_suspend,
 	.resume	=	sdhci_pci_resume,


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

* [PATCH 7/7] sdhci: Tidy up sdhci.c
  2010-09-13 17:38 [PATCH 0/7] Intel MID SDHCI support (take two) Alan Cox
                   ` (5 preceding siblings ...)
  2010-09-13 17:39 ` [PATCH 6/7] sdhci_pci: Tidy this as well Alan Cox
@ 2010-09-13 17:39 ` Alan Cox
  6 siblings, 0 replies; 17+ messages in thread
From: Alan Cox @ 2010-09-13 17:39 UTC (permalink / raw)
  To: linux-mmc, cjb

While we are passing through..

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/mmc/host/sdhci.c |   39 +++++++++++++++++++--------------------
 1 files changed, 19 insertions(+), 20 deletions(-)


diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9d8047c..dcafe13 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1,5 +1,6 @@
 /*
- *  linux/drivers/mmc/host/sdhci.c - Secure Digital Host Controller Interface driver
+ *  linux/drivers/mmc/host/sdhci.c - Secure Digital Host Controller Interface
+ *				     driver
  *
  *  Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved.
  *
@@ -30,14 +31,14 @@
 #define DRIVER_NAME "sdhci"
 
 #define DBG(f, x...) \
-	pr_debug(DRIVER_NAME " [%s()]: " f, __func__,## x)
+	pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x)
 
 #if defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \
 	defined(CONFIG_MMC_SDHCI_MODULE))
 #define SDHCI_USE_LEDS_CLASS
 #endif
 
-static unsigned int debug_quirks = 0;
+static unsigned int debug_quirks;
 
 static void sdhci_prepare_data(struct sdhci_host *, struct mmc_data *);
 static void sdhci_finish_data(struct sdhci_host *);
@@ -479,7 +480,8 @@ static int sdhci_adma_table_pre(struct sdhci_host *host,
 		if (offset) {
 			if (data->flags & MMC_DATA_WRITE) {
 				buffer = sdhci_kmap_atomic(sg, &flags);
-				WARN_ON(((long)buffer & PAGE_MASK) > (PAGE_SIZE - 3));
+				WARN_ON(((long)buffer & PAGE_MASK)
+							> (PAGE_SIZE - 3));
 				memcpy(align, buffer, offset);
 				sdhci_kunmap_atomic(buffer, &flags);
 			}
@@ -587,7 +589,8 @@ static void sdhci_adma_table_post(struct sdhci_host *host,
 				size = 4 - (sg_dma_address(sg) & 0x3);
 
 				buffer = sdhci_kmap_atomic(sg, &flags);
-				WARN_ON(((long)buffer & PAGE_MASK) > (PAGE_SIZE - 3));
+				WARN_ON(((long)buffer & PAGE_MASK)
+							> (PAGE_SIZE - 3));
 				memcpy(buffer, align, size);
 				sdhci_kunmap_atomic(buffer, &flags);
 
@@ -975,7 +978,7 @@ static void sdhci_finish_command(struct sdhci_host *host)
 	if (host->cmd->flags & MMC_RSP_PRESENT) {
 		if (host->cmd->flags & MMC_RSP_136) {
 			/* CRC is stripped so we need to do some shifting. */
-			for (i = 0;i < 4;i++) {
+			for (i = 0; i < 4; i++) {
 				host->cmd->resp[i] = sdhci_readl(host,
 					SDHCI_RESPONSE + (3-i)*4) << 8;
 				if (i != 3)
@@ -1019,7 +1022,7 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
 	if (clock == 0)
 		goto out;
 
-	for (div = 1;div < 256;div *= 2) {
+	for (div = 1; div < 256; div *= 2) {
 		if ((host->max_clk / div) <= clock)
 			break;
 	}
@@ -1215,7 +1218,7 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	 * signalling timeout and CRC errors even on CMD0. Resetting
 	 * it on each ios seems to solve the problem.
 	 */
-	if(host->quirks & SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS)
+	if (host->quirks & SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS)
 		sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
 
 out:
@@ -1302,7 +1305,7 @@ static void sdhci_tasklet_card(unsigned long param)
 	struct sdhci_host *host;
 	unsigned long flags;
 
-	host = (struct sdhci_host*)param;
+	host = (struct sdhci_host *)param;
 
 	spin_lock_irqsave(&host->lock, flags);
 
@@ -1332,7 +1335,7 @@ static void sdhci_tasklet_finish(unsigned long param)
 	unsigned long flags;
 	struct mmc_request *mrq;
 
-	host = (struct sdhci_host*)param;
+	host = (struct sdhci_host *)param;
 
 	spin_lock_irqsave(&host->lock, flags);
 
@@ -1385,7 +1388,7 @@ static void sdhci_timeout_timer(unsigned long data)
 	struct sdhci_host *host;
 	unsigned long flags;
 
-	host = (struct sdhci_host*)data;
+	host = (struct sdhci_host *)data;
 
 	spin_lock_irqsave(&host->lock, flags);
 
@@ -1566,7 +1569,7 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
 static irqreturn_t sdhci_irq(int irq, void *dev_id)
 {
 	irqreturn_t result;
-	struct sdhci_host* host = dev_id;
+	struct sdhci_host *host = dev_id;
 	u32 intmask;
 	int cardint = 0;
 
@@ -1667,7 +1670,6 @@ int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state)
 
 	return ret;
 }
-
 EXPORT_SYMBOL_GPL(sdhci_suspend_host);
 
 int sdhci_resume_host(struct sdhci_host *host)
@@ -1699,7 +1701,6 @@ int sdhci_resume_host(struct sdhci_host *host)
 
 	return ret;
 }
-
 EXPORT_SYMBOL_GPL(sdhci_resume_host);
 
 #endif /* CONFIG_PM */
@@ -1727,7 +1728,6 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,
 
 	return host;
 }
-
 EXPORT_SYMBOL_GPL(sdhci_alloc_host);
 
 int sdhci_add_host(struct sdhci_host *host)
@@ -1940,7 +1940,8 @@ int sdhci_add_host(struct sdhci_host *host)
 	/*
 	 * Maximum block count.
 	 */
-	mmc->max_blk_count = (host->quirks & SDHCI_QUIRK_NO_MULTIBLOCK) ? 1 : 65535;
+	mmc->max_blk_count = (host->quirks & SDHCI_QUIRK_NO_MULTIBLOCK)
+								? 1 : 65535;
 
 	/*
 	 * Init tasklets.
@@ -1959,7 +1960,8 @@ int sdhci_add_host(struct sdhci_host *host)
 
 	host->vmmc = regulator_get(mmc_dev(mmc), "vmmc");
 	if (IS_ERR(host->vmmc)) {
-		printk(KERN_INFO "%s: no vmmc regulator found\n", mmc_hostname(mmc));
+		printk(KERN_INFO "%s: no vmmc regulator found\n",
+							mmc_hostname(mmc));
 		host->vmmc = NULL;
 	} else {
 		regulator_enable(host->vmmc);
@@ -2008,7 +2010,6 @@ untasklet:
 
 	return ret;
 }
-
 EXPORT_SYMBOL_GPL(sdhci_add_host);
 
 void sdhci_remove_host(struct sdhci_host *host, int dead)
@@ -2060,14 +2061,12 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
 	host->adma_desc = NULL;
 	host->align_buffer = NULL;
 }
-
 EXPORT_SYMBOL_GPL(sdhci_remove_host);
 
 void sdhci_free_host(struct sdhci_host *host)
 {
 	mmc_free_host(host->mmc);
 }
-
 EXPORT_SYMBOL_GPL(sdhci_free_host);
 
 /*****************************************************************************\


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

* Re: [PATCH 5/7] sdhci: Tidy up spaces in sdhci_intel_mid
  2010-09-14 14:21   ` Wolfram Sang
@ 2010-09-14 13:40     ` Alan Cox
  2010-09-14 14:45       ` Wolfram Sang
  0 siblings, 1 reply; 17+ messages in thread
From: Alan Cox @ 2010-09-14 13:40 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc, cjb

On Tue, 14 Sep 2010 16:21:29 +0200
Wolfram Sang <w.sang@pengutronix.de> wrote:

> On Mon, Sep 13, 2010 at 06:39:41PM +0100, Alan Cox wrote:
> > Coding style fixes
> > 
> > Signed-off-by: Alan Cox <alan@linux.intel.com>
> 
> Shouldn't this be folded into the patch which initially creates
> sdhci-intel-mid.c?

The work was done later and the signoffs are not the same. In the ideal
world - yes of course. I can redo them this way if you want but it'll
probably be about a month.

Alan

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

* Re: [PATCH 1/7] sdhci: Rework some of the quirk behaviour
  2010-09-14 14:34   ` Wolfram Sang
@ 2010-09-14 14:20     ` Alan Cox
  0 siblings, 0 replies; 17+ messages in thread
From: Alan Cox @ 2010-09-14 14:20 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc, cjb

> >  drivers/mmc/host/Kconfig           |   11 ++
> >  drivers/mmc/host/Makefile          |    1 
> >  drivers/mmc/host/sdhci-intel-mid.c |  163
> > ++++++++++++++++++++++++++++++++++++
> 
> Why are those added here and not in patch 3/7?

I thought it would be useful to add the hooks and show how they are
used in one - I can split that easily enough.


> > + * ADMA operation is disabled for Moorestown platform due to
> > + * hardware bugs.
> > + */
> > +static int mrst_hc0_probe(struct sdhci_pci_chip *chip)
> > +{
> > +	/*
> > +	 * slots number is fixed here for MRST as SDIO3 is never
> > used and has
> > +	 * hardware bugs.
> > +	 */
> > +	chip->num_slots = 1;
> > +	return 0;
> > +}
> 
> Why is this function here and not in sdhci-intel-mid.c?

So it follows the pattern of the other drivers, so it doesn't need an
extra exported symbol (at about ten times the size of the function).

We could move probe into host_ops I guess but that means tweaking all
the other drivers which I cannot test.

I guess the other way to do it would be not to have a separate file but
to stick it all in sdhci-pci ?



> >  		mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK)
> > >> SDHCI_MAX_BLOCK_SHIFT;
> > -		if (mmc->max_blk_size >= 3) {
> > +		if (mmc->max_blk_size > 3) {
> 
> Why this change? Not mentioned in the changelog. And wrong according
> to the simplified standard v2. Is it V3 material?

That's got in by mistake. I thought I'd got all the spec related bits
stripped out.

I actually suspect for the more general case of cleaning up some of the
other driver quirks we need a couple more callbacks but its hard to
sure.

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

* Re: [PATCH 5/7] sdhci: Tidy up spaces in sdhci_intel_mid
  2010-09-13 17:39 ` [PATCH 5/7] sdhci: Tidy up spaces in sdhci_intel_mid Alan Cox
@ 2010-09-14 14:21   ` Wolfram Sang
  2010-09-14 13:40     ` Alan Cox
  0 siblings, 1 reply; 17+ messages in thread
From: Wolfram Sang @ 2010-09-14 14:21 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-mmc, cjb

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

On Mon, Sep 13, 2010 at 06:39:41PM +0100, Alan Cox wrote:
> Coding style fixes
> 
> Signed-off-by: Alan Cox <alan@linux.intel.com>

Shouldn't this be folded into the patch which initially creates
sdhci-intel-mid.c?

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH 5/7] sdhci: Tidy up spaces in sdhci_intel_mid
  2010-09-14 14:45       ` Wolfram Sang
@ 2010-09-14 14:21         ` Alan Cox
  2010-09-14 16:57         ` Chris Ball
  1 sibling, 0 replies; 17+ messages in thread
From: Alan Cox @ 2010-09-14 14:21 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc, cjb

On Tue, 14 Sep 2010 16:45:12 +0200
Wolfram Sang <w.sang@pengutronix.de> wrote:

> On Tue, Sep 14, 2010 at 02:40:57PM +0100, Alan Cox wrote:
> > On Tue, 14 Sep 2010 16:21:29 +0200
> > Wolfram Sang <w.sang@pengutronix.de> wrote:
> > 
> > > On Mon, Sep 13, 2010 at 06:39:41PM +0100, Alan Cox wrote:
> > > > Coding style fixes
> > > > 
> > > > Signed-off-by: Alan Cox <alan@linux.intel.com>
> > > 
> > > Shouldn't this be folded into the patch which initially creates
> > > sdhci-intel-mid.c?
> > 
> > The work was done later and the signoffs are not the same. In the
> > ideal world - yes of course. I can redo them this way if you want
> > but it'll probably be about a month.
> 
> I would indeed prefer to first have minimal changes to the
> mmc/sdhci-core and then have the final version of sdhci-intel-mid.c
> put on top of that (also applies to patch 4/7). Less error prone and
> easier to review. Yet, I am not the one who is picking up the patches.
> 
> (BTW can't you just combine SoB if you fold patches?)

Ok will have a look at that next month and will also split the host
ops patches into a patch to add them and a patch to use them.


Alan

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

* Re: [PATCH 1/7] sdhci: Rework some of the quirk behaviour
  2010-09-13 17:38 ` [PATCH 1/7] sdhci: Rework some of the quirk behaviour Alan Cox
@ 2010-09-14 14:34   ` Wolfram Sang
  2010-09-14 14:20     ` Alan Cox
  0 siblings, 1 reply; 17+ messages in thread
From: Wolfram Sang @ 2010-09-14 14:34 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-mmc, cjb

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

On Mon, Sep 13, 2010 at 06:38:48PM +0100, Alan Cox wrote:
> As the quirks go ever more complex it's getting harder and harder to integrate
> new drivers. The Intel MID devices add a whole further collection of new
> quirks so instead of quirks start moving some stuff to overridable functions.
> 
> We also introduce an sdhci_reset_all helper which is told if the reset is
> being done during init (which needs to be avoided by some hw) or on exit
> in which case it doesn't.
> 
> Arguably the driver wants to be lots of drivers and "libsdhci" but that would
> be a massive undertaking.
> 
> Signed-off-by: Alan Cox <alan@linux.intel.com>
> ---
> 
>  drivers/mmc/host/Kconfig           |   11 ++
>  drivers/mmc/host/Makefile          |    1 
>  drivers/mmc/host/sdhci-intel-mid.c |  163 ++++++++++++++++++++++++++++++++++++

Why are those added here and not in patch 3/7?

>  drivers/mmc/host/sdhci-pci.c       |   56 ++++++++++++
>  drivers/mmc/host/sdhci.c           |   61 ++++++++++---
>  drivers/mmc/host/sdhci.h           |   20 ++++
>  include/linux/pci_ids.h            |    2 
>  7 files changed, 296 insertions(+), 18 deletions(-)
>  create mode 100644 drivers/mmc/host/sdhci-intel-mid.c

From having a glimpse, there is MID-specific stuff all over the patch.
This makes finding the actual "quirk rework" harder.

> 
> 
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index ce099c4..ffa40f1 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -81,6 +81,17 @@ config MMC_RICOH_MMC
>  
>  	  If unsure, say Y.
>  
> +config MMC_SDHCI_INTEL_MID
> +	tristate "SDHCI support on Intel MID platforms"
> +	depends on MMC_SDHCI_PCI
> +	help
> +	  This includes support for the SDHCI controllers found on Intel
> +	  MID platform systems.
> +
> +	  If you have a controller with this interface, say Y or M here.
> +
> +	  If unsure, say N.
> +
>  config MMC_SDHCI_OF
>  	tristate "SDHCI support on OpenFirmware platforms"
>  	depends on MMC_SDHCI && PPC_OF
> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> index 697bbfe..21c80f0 100644
> --- a/drivers/mmc/host/Makefile
> +++ b/drivers/mmc/host/Makefile
> @@ -13,6 +13,7 @@ obj-$(CONFIG_MMC_MXC)		+= mxcmmc.o
>  obj-$(CONFIG_MMC_SDHCI)		+= sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_MV)	+= sdhci-mv.o
>  obj-$(CONFIG_MMC_SDHCI_PCI)	+= sdhci-pci.o
> +obj-$(CONFIG_MMC_SDHCI_INTEL_MID)	+= sdhci-intel-mid.o
>  obj-$(CONFIG_MMC_SDHCI_S3C)	+= sdhci-s3c.o
>  obj-$(CONFIG_MMC_SDHCI_SPEAR)	+= sdhci-spear.o
>  obj-$(CONFIG_MMC_WBSD)		+= wbsd.o
> diff --git a/drivers/mmc/host/sdhci-intel-mid.c b/drivers/mmc/host/sdhci-intel-mid.c
> new file mode 100644
> index 0000000..2828831
> --- /dev/null
> +++ b/drivers/mmc/host/sdhci-intel-mid.c
> @@ -0,0 +1,163 @@
> +#include <linux/delay.h>
> +#include <linux/highmem.h>
> +#include <linux/io.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/slab.h>
> +#include <linux/scatterlist.h>
> +#include <linux/regulator/consumer.h>
> +
> +#include <linux/leds.h>
> +
> +#include <linux/mmc/host.h>
> +
> +#include "sdhci.h"
> +
> +/*
> + *	Support code for SDHCI on Intel MID platforms. We have lots
> + * 	of quirks specific to these platforms so wrap them up in one place
> + *	that keeps them out of the main flow. We can't just make it a new
> + *	driver as the shdci core code isn't really a library.
> + */
> + 
> +static void sdhci_broken_reset(struct sdhci_host *host, u8 mask)
> +{
> +	unsigned long timeout;
> +	u32 uninitialized_var(ier);
> +
> +	if (host->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) {
> +		if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) &
> +			SDHCI_CARD_PRESENT))
> +			return;
> +	}
> +
> +	if (host->quirks & SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET)
> +		ier = sdhci_readl(host, SDHCI_INT_ENABLE);
> +
> +	sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET);
> +
> +	if (mask & SDHCI_RESET_ALL)
> +		host->clock = 0;
> +
> +	/* Wait max 100 ms */
> +	timeout = 100;
> +
> +	/* hw clears the bit when it's done */
> +	while (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) {
> +		if (timeout == 0) {
> +			printk(KERN_ERR "%s: Reset 0x%x never completed.\n",
> +				mmc_hostname(host->mmc), (int)mask);
> +		}
> +		timeout--;
> +		mdelay(1);
> +	}
> +	if (host->quirks & SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET)
> +		sdhci_clear_set_irqs(host, SDHCI_INT_ALL_MASK, ier);
> +}
> +
> +static void sdhci_mid_broken_resetall(struct sdhci_host *host, int down)
> +{
> +	if (down)
> +		sdhci_broken_reset(host, SDHCI_RESET_ALL);
> +}
> +
> +static void sdhci_mid_init_no_reset(struct sdhci_host *host, int soft)
> +{
> +	u32 intmask;
> +
> +	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
> +	sdhci_writel(host,
> +		intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE),
> +		SDHCI_INT_STATUS);
> +
> +        /* Ensure any IRQ left over from pre boot time (eg from Kboot) does
> +           not turn up and cause chaos */
> +	sdhci_writel(host, 0, SDHCI_INT_ENABLE);
> +	sdhci_writel(host, 0, SDHCI_SIGNAL_ENABLE);
> +
> +	sdhci_clear_set_irqs(host, SDHCI_INT_ALL_MASK,
> +		SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT |
> +		SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_INDEX |
> +		SDHCI_INT_END_BIT | SDHCI_INT_CRC | SDHCI_INT_TIMEOUT |
> +		SDHCI_INT_DATA_END | SDHCI_INT_RESPONSE);
> +
> +	if (soft) {
> +		/* force clock reconfiguration */
> +		host->clock = 0;
> +		sdhci_set_ios(host->mmc, &host->mmc->ios);
> +	}
> +
> +	/* disable wakeup signal during initialization */
> +	sdhci_writeb(host, 0x0, SDHCI_WAKE_UP_CONTROL);
> +}
> +
> +/*
> + * HW problem exists in LNW A3 so clock register has to be set
> + * for every command if both SDIO0 and SDIO1 are enabled.
> + */
> +static void sdhci_clock_reset(struct sdhci_host *host)
> +{
> +	u16 clk;
> +	unsigned long timeout;
> +
> +	clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
> +
> +	clk |= SDHCI_CLOCK_CARD_EN;
> +	sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
> +
> +	/* Wait max 10 ms */
> +	timeout = 10;
> +	while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
> +		& SDHCI_CLOCK_INT_STABLE)) {
> +		if (timeout == 0) {
> +			printk(KERN_ERR "%s: Internal clock never "
> +				"stabilised.\n",
> +				mmc_hostname(host->mmc));
> +			sdhci_dumpregs(host);
> +			return;
> +		}
> +		timeout--;
> +		mdelay(1);
> +	}
> +}
> +
> +static void sdhci_clockreset_wcmd(struct sdhci_host *host,
> +				struct mmc_command *cmd, int flags)
> +{
> +	sdhci_clock_reset(host);
> + 	sdhci_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags), SDHCI_COMMAND);
> +}
> +
> +static void sdhci_lnw_a3_set_ios(struct sdhci_host *host,
> +					struct mmc_ios *ios, u8 ctrl)
> +{
> +	/*
> +	 * For LNW A3, HISPD bit has to be cleared in order to
> +	 * enable the 50MHz clock
> +	 */
> +	if (ios->timing == MMC_TIMING_SD_HS ||
> +			ios->timing == MMC_TIMING_MMC_HS)
> +		ctrl |= SDHCI_CTRL_HISPD;
> +	else
> +		ctrl &= ~SDHCI_CTRL_HISPD;
> +	sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
> +}
> +
> +/*
> + * HW problem exists in LNW A3 which leads to fake interrupt on SDIO1 if SDIO0
> + * and SDIO1 are both enabled.
> + */
> +static void sdhci_lnw_a3_unexpected_cmd(struct sdhci_host *host, u32 intmask)
> +{
> +}
> +
> +struct sdhci_ops sdhci_intel_mrst_hc = {
> +	.reset = sdhci_broken_reset,
> +	.init = sdhci_mid_init_no_reset,
> +	.set_ios = sdhci_lnw_a3_set_ios,
> +	.reset_all = sdhci_mid_broken_resetall,
> +	.write_command = sdhci_clockreset_wcmd,
> +	.unexpected_cmd_irq = sdhci_lnw_a3_unexpected_cmd,
> +};
> +EXPORT_SYMBOL_GPL(sdhci_intel_mrst_hc);
> +
> +
> diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
> index e8aa99d..3e29e94 100644
> --- a/drivers/mmc/host/sdhci-pci.c
> +++ b/drivers/mmc/host/sdhci-pci.c
> @@ -54,6 +54,8 @@ struct sdhci_pci_fixes {
>  	int			(*suspend)(struct sdhci_pci_chip*,
>  					pm_message_t);
>  	int			(*resume)(struct sdhci_pci_chip*);
> +
> +	struct sdhci_ops	*host_ops;
>  };
>  
>  struct sdhci_pci_slot {
> @@ -397,6 +399,35 @@ static const struct sdhci_pci_fixes sdhci_via = {
>  	.probe		= via_probe,
>  };
>  
> +#if defined(CONFIG_MMC_SDHCI_INTEL_MID) || defined(CONFIG_MMC_SDHCI_INTEL_MID_MODULE)
> +
> +/*
> + * ADMA operation is disabled for Moorestown platform due to
> + * hardware bugs.
> + */
> +static int mrst_hc0_probe(struct sdhci_pci_chip *chip)
> +{
> +	/*
> +	 * slots number is fixed here for MRST as SDIO3 is never used and has
> +	 * hardware bugs.
> +	 */
> +	chip->num_slots = 1;
> +	return 0;
> +}

Why is this function here and not in sdhci-intel-mid.c?

> +
> +static const struct sdhci_pci_fixes sdhci_intel_mrst_hc0 = {
> +	.quirks		= SDHCI_QUIRK_BROKEN_ADMA,
> +	.probe		= mrst_hc0_probe,
> +	.host_ops	= &sdhci_intel_mrst_hc,
> +};
> +
> +static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1 = {
> +	.quirks		= SDHCI_QUIRK_BROKEN_ADMA,
> +	.host_ops	= &sdhci_intel_mrst_hc,
> +};
> +
> +#endif
> +
>  static const struct pci_device_id pci_ids[] __devinitdata = {
>  	{
>  		.vendor		= PCI_VENDOR_ID_RICOH,
> @@ -494,6 +525,23 @@ static const struct pci_device_id pci_ids[] __devinitdata = {
>  		.driver_data	= (kernel_ulong_t)&sdhci_via,
>  	},
>  
> +#if defined(CONFIG_MMC_SDHCI_INTEL_MID) || defined(CONFIG_MMC_SDHCI_INTEL_MID_MODULE)
> +	{
> +		.vendor		= PCI_VENDOR_ID_INTEL,
> +		.device		= PCI_DEVICE_ID_INTEL_MRST_SD0,
> +		.subvendor	= PCI_ANY_ID,
> +		.subdevice	= PCI_ANY_ID,
> +		.driver_data	= (kernel_ulong_t)&sdhci_intel_mrst_hc0,
> +	},
> +
> +	{
> +		.vendor		= PCI_VENDOR_ID_INTEL,
> +		.device		= PCI_DEVICE_ID_INTEL_MRST_SD1,
> +		.subvendor	= PCI_ANY_ID,
> +		.subdevice	= PCI_ANY_ID,
> +		.driver_data	= (kernel_ulong_t)&sdhci_intel_mrst_hc1,
> +	},
> +#endif
>  	{	/* Generic SD host controller */
>  		PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
>  	},
> @@ -509,7 +557,7 @@ MODULE_DEVICE_TABLE(pci, pci_ids);
>   *                                                                           *
>  \*****************************************************************************/
>  
> -static int sdhci_pci_enable_dma(struct sdhci_host *host)
> +int sdhci_pci_enable_dma(struct sdhci_host *host)
>  {
>  	struct sdhci_pci_slot *slot;
>  	struct pci_dev *pdev;
> @@ -533,6 +581,7 @@ static int sdhci_pci_enable_dma(struct sdhci_host *host)
>  
>  	return 0;
>  }
> +EXPORT_SYMBOL_GPL(sdhci_pci_enable_dma);
>  
>  static struct sdhci_ops sdhci_pci_ops = {
>  	.enable_dma	= sdhci_pci_enable_dma,
> @@ -687,7 +736,10 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
>  	slot->pci_bar = bar;
>  
>  	host->hw_name = "PCI";
> -	host->ops = &sdhci_pci_ops;
> +	if (chip->fixes->host_ops)
> +		host->ops = chip->fixes->host_ops;
> +	else
> +		host->ops = &sdhci_pci_ops;
>  	host->quirks = chip->quirks;
>  
>  	host->irq = pdev->irq;
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index f608626..9d8091a 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -45,7 +45,7 @@ static void sdhci_finish_data(struct sdhci_host *);
>  static void sdhci_send_command(struct sdhci_host *, struct mmc_command *);
>  static void sdhci_finish_command(struct sdhci_host *);
>  
> -static void sdhci_dumpregs(struct sdhci_host *host)
> +void sdhci_dumpregs(struct sdhci_host *host)
>  {
>  	printk(KERN_DEBUG DRIVER_NAME ": ============== REGISTER DUMP ==============\n");
>  
> @@ -87,6 +87,7 @@ static void sdhci_dumpregs(struct sdhci_host *host)
>  
>  	printk(KERN_DEBUG DRIVER_NAME ": ===========================================\n");
>  }
> +EXPORT_SYMBOL_GPL(sdhci_dumpregs);
>  
>  /*****************************************************************************\
>   *                                                                           *
> @@ -94,7 +95,7 @@ static void sdhci_dumpregs(struct sdhci_host *host)
>   *                                                                           *
>  \*****************************************************************************/
>  
> -static void sdhci_clear_set_irqs(struct sdhci_host *host, u32 clear, u32 set)
> +void sdhci_clear_set_irqs(struct sdhci_host *host, u32 clear, u32 set)
>  {
>  	u32 ier;
>  
> @@ -104,6 +105,7 @@ static void sdhci_clear_set_irqs(struct sdhci_host *host, u32 clear, u32 set)
>  	sdhci_writel(host, ier, SDHCI_INT_ENABLE);
>  	sdhci_writel(host, ier, SDHCI_SIGNAL_ENABLE);
>  }
> +EXPORT_SYMBOL_GPL(sdhci_clear_set_irqs);
>  
>  static void sdhci_unmask_irqs(struct sdhci_host *host, u32 irqs)
>  {
> @@ -143,6 +145,11 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
>  	unsigned long timeout;
>  	u32 uninitialized_var(ier);
>  
> +	if (host->ops->reset) {
> +		host->ops->reset(host, mask);
> +		return;
> +	}
> +
>  	if (host->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) {
>  		if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) &
>  			SDHCI_CARD_PRESENT))
> @@ -176,14 +183,21 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
>  		sdhci_clear_set_irqs(host, SDHCI_INT_ALL_MASK, ier);
>  }
>  
> -static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios);
> +/* Down is true if we are shutting down the port */
> +static void sdhci_reset_all(struct sdhci_host *host, int down)
> +{
> +	if (host->ops->reset_all)
> +		host->ops->reset_all(host, down);
> +	else
> +		sdhci_reset(host, SDHCI_RESET_ALL);
> +}
>  
>  static void sdhci_init(struct sdhci_host *host, int soft)
>  {
>  	if (soft)
>  		sdhci_reset(host, SDHCI_RESET_CMD|SDHCI_RESET_DATA);
>  	else
> -		sdhci_reset(host, SDHCI_RESET_ALL);
> +		sdhci_reset_all(host, 0);
>  
>  	sdhci_clear_set_irqs(host, SDHCI_INT_ALL_MASK,
>  		SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT |
> @@ -945,7 +959,11 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
>  	if (cmd->data)
>  		flags |= SDHCI_CMD_DATA;
>  
> -	sdhci_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags), SDHCI_COMMAND);
> +	if (host->ops->write_command)
> +		host->ops->write_command(host, cmd, flags);
> +	else
> +		sdhci_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags),
> +						SDHCI_COMMAND);
>  }
>  
>  static void sdhci_finish_command(struct sdhci_host *host)
> @@ -1139,7 +1157,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
>  	spin_unlock_irqrestore(&host->lock, flags);
>  }
>  
> -static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> +void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>  {
>  	struct sdhci_host *host;
>  	unsigned long flags;
> @@ -1186,9 +1204,13 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>  	else
>  		ctrl &= ~SDHCI_CTRL_HISPD;
>  
> -	sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
> +	if (host->ops->set_ios)
> +		host->ops->set_ios(host, ios, ctrl);
> +	else
> +		sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
>  
> -	/*
> +	/*	FIXME: This can also be moved to ops->set_ios
> +	 *
>  	 * Some (ENE) controllers go apeshit on some ios operation,
>  	 * signalling timeout and CRC errors even on CMD0. Resetting
>  	 * it on each ios seems to solve the problem.
> @@ -1200,6 +1222,7 @@ out:
>  	mmiowb();
>  	spin_unlock_irqrestore(&host->lock, flags);
>  }
> +EXPORT_SYMBOL_GPL(sdhci_set_ios);
>  
>  static int sdhci_get_ro(struct mmc_host *mmc)
>  {
> @@ -1383,10 +1406,13 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
>  	BUG_ON(intmask == 0);
>  
>  	if (!host->cmd) {
> -		printk(KERN_ERR "%s: Got command interrupt 0x%08x even "
> -			"though no command operation was in progress.\n",
> -			mmc_hostname(host->mmc), (unsigned)intmask);
> -		sdhci_dumpregs(host);
> +		if (host->ops->unexpected_cmd_irq)
> +			host->ops->unexpected_cmd_irq(host, intmask);
> +		else {
> +			printk(KERN_ERR "%s: Got command interrupt 0x%08x even though no command operation was in progress.\n",
> +				mmc_hostname(host->mmc), (unsigned)intmask);
> +			sdhci_dumpregs(host);
> +		}
>  		return;
>  	}
>  
> @@ -1703,7 +1729,7 @@ int sdhci_add_host(struct sdhci_host *host)
>  	if (debug_quirks)
>  		host->quirks = debug_quirks;
>  
> -	sdhci_reset(host, SDHCI_RESET_ALL);
> +	sdhci_reset_all(host, 0);
>  
>  	host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
>  	host->version = (host->version & SDHCI_SPEC_VER_MASK)
> @@ -1829,6 +1855,9 @@ int sdhci_add_host(struct sdhci_host *host)
>  	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
>  		mmc->caps |= MMC_CAP_NEEDS_POLL;
>  
> +	if (host->ops->set_caps)
> +		host->ops->set_caps(host);
> +
>  	mmc->ocr_avail = 0;
>  	if (caps & SDHCI_CAN_VDD_330)
>  		mmc->ocr_avail |= MMC_VDD_32_33|MMC_VDD_33_34;
> @@ -1881,7 +1910,7 @@ int sdhci_add_host(struct sdhci_host *host)
>  	} else {
>  		mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >>
>  				SDHCI_MAX_BLOCK_SHIFT;
> -		if (mmc->max_blk_size >= 3) {
> +		if (mmc->max_blk_size > 3) {

Why this change? Not mentioned in the changelog. And wrong according to
the simplified standard v2. Is it V3 material?

>  			printk(KERN_WARNING "%s: Invalid maximum block size, "
>  				"assuming 512 bytes\n", mmc_hostname(mmc));
>  			mmc->max_blk_size = 0;
> @@ -1952,7 +1981,7 @@ int sdhci_add_host(struct sdhci_host *host)
>  
>  #ifdef SDHCI_USE_LEDS_CLASS
>  reset:
> -	sdhci_reset(host, SDHCI_RESET_ALL);
> +	sdhci_reset_all(host, 1);
>  	free_irq(host->irq, host);
>  #endif
>  untasklet:
> @@ -1993,7 +2022,7 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
>  #endif
>  
>  	if (!dead)
> -		sdhci_reset(host, SDHCI_RESET_ALL);
> +		sdhci_reset_all(host, 1);
>  
>  	free_irq(host->irq, host);
>  
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index d316bc7..182fcc3 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -323,6 +323,17 @@ struct sdhci_ops {
>  	unsigned int	(*get_max_clock)(struct sdhci_host *host);
>  	unsigned int	(*get_min_clock)(struct sdhci_host *host);
>  	unsigned int	(*get_timeout_clock)(struct sdhci_host *host);
> +
> +	/* Interface hooks to allow drivers to override standard behaviour */
> +	void	(*reset)(struct sdhci_host *host, u8 mask);
> +	void	(*reset_all)(struct sdhci_host *host, int down);
> +	void	(*init)(struct sdhci_host *host, int soft);
> +	void 	(*write_command)(struct sdhci_host *host,
> +				struct mmc_command *cmd, int flags);
> +	void	(*set_ios)(struct sdhci_host *host,
> +				struct mmc_ios *ios, u8 ctrl);
> +	void	(*set_caps)(struct sdhci_host *host);
> +	void	(*unexpected_cmd_irq)(struct sdhci_host *host, u32 intmask);

That looks quite much on a first view. Might need to dig in deeper...

>  };
>  
>  #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
> @@ -427,4 +438,13 @@ extern int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state);
>  extern int sdhci_resume_host(struct sdhci_host *host);
>  #endif
>  
> +extern void sdhci_clear_set_irqs(struct sdhci_host *host, u32 clear, u32 set);
> +extern int sdhci_pci_enable_dma(struct sdhci_host *host);
> +extern void sdhci_dumpregs(struct sdhci_host *host);
> +extern void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios);
> +
> +/* Host function sets from driver support files */
> +extern struct sdhci_ops sdhci_intel_mrst_hc;
> +
> +
>  #endif /* __SDHCI_H */
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index 9438660..674316e 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -2410,6 +2410,8 @@
>  #define PCI_DEVICE_ID_INTEL_82375	0x0482
>  #define PCI_DEVICE_ID_INTEL_82424	0x0483
>  #define PCI_DEVICE_ID_INTEL_82378	0x0484
> +#define PCI_DEVICE_ID_INTEL_MRST_SD0	0x0807
> +#define PCI_DEVICE_ID_INTEL_MRST_SD1	0x0808
>  #define PCI_DEVICE_ID_INTEL_I960	0x0960
>  #define PCI_DEVICE_ID_INTEL_I960RM	0x0962
>  #define PCI_DEVICE_ID_INTEL_8257X_SOL	0x1062
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH 5/7] sdhci: Tidy up spaces in sdhci_intel_mid
  2010-09-14 13:40     ` Alan Cox
@ 2010-09-14 14:45       ` Wolfram Sang
  2010-09-14 14:21         ` Alan Cox
  2010-09-14 16:57         ` Chris Ball
  0 siblings, 2 replies; 17+ messages in thread
From: Wolfram Sang @ 2010-09-14 14:45 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-mmc, cjb

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

On Tue, Sep 14, 2010 at 02:40:57PM +0100, Alan Cox wrote:
> On Tue, 14 Sep 2010 16:21:29 +0200
> Wolfram Sang <w.sang@pengutronix.de> wrote:
> 
> > On Mon, Sep 13, 2010 at 06:39:41PM +0100, Alan Cox wrote:
> > > Coding style fixes
> > > 
> > > Signed-off-by: Alan Cox <alan@linux.intel.com>
> > 
> > Shouldn't this be folded into the patch which initially creates
> > sdhci-intel-mid.c?
> 
> The work was done later and the signoffs are not the same. In the ideal
> world - yes of course. I can redo them this way if you want but it'll
> probably be about a month.

I would indeed prefer to first have minimal changes to the
mmc/sdhci-core and then have the final version of sdhci-intel-mid.c put
on top of that (also applies to patch 4/7). Less error prone and easier
to review. Yet, I am not the one who is picking up the patches.

(BTW can't you just combine SoB if you fold patches?)

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH 5/7] sdhci: Tidy up spaces in sdhci_intel_mid
  2010-09-14 16:57         ` Chris Ball
@ 2010-09-14 16:41           ` Alan Cox
  2010-09-14 20:00             ` Wolfram Sang
  0 siblings, 1 reply; 17+ messages in thread
From: Alan Cox @ 2010-09-14 16:41 UTC (permalink / raw)
  To: Chris Ball; +Cc: Wolfram Sang, linux-mmc

> into 2.6.37, which is worth trying for.  I like Wolfram's suggested 
> patchset format.  Alan, do you feel comfortable re-doing this in time
> for some testing before the merge window opens, or should I help?

Redoing it shouldn't be a problem, getting testing of the MID bits
will slow it down a fair bit. I'm not in a huge rush - I need to get
the SFI device patches merged before an upstream kernel will actually
be useful on a MID device.

> The big question seems to be whether the approach the patchset takes
> -- moving from quirks to hooks, extending sdhci.c without creating a 
> full driver, and the initial choice of overridable hooks -- makes
> sense.  I'd be happy to hear everyone's thoughts on that.

I'd rather see that discussion happen and then redo the MID patches to
match whatever turns out to suit a more generalised set of driver
tidyups this way than push it in ASAP.

That also fits my timetable better as I've got an exam coming up early
October and other stuff to push before I run off and hide revising.

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

* Re: [PATCH 5/7] sdhci: Tidy up spaces in sdhci_intel_mid
  2010-09-14 14:45       ` Wolfram Sang
  2010-09-14 14:21         ` Alan Cox
@ 2010-09-14 16:57         ` Chris Ball
  2010-09-14 16:41           ` Alan Cox
  1 sibling, 1 reply; 17+ messages in thread
From: Chris Ball @ 2010-09-14 16:57 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Alan Cox, linux-mmc

Hi,

On Tue, Sep 14, 2010 at 04:45:12PM +0200, Wolfram Sang wrote:
> I would indeed prefer to first have minimal changes to the
> mmc/sdhci-core and then have the final version of sdhci-intel-mid.c put
> on top of that (also applies to patch 4/7). Less error prone and easier
> to review. Yet, I am not the one who is picking up the patches.
> 
> (BTW can't you just combine SoB if you fold patches?)

I'm willing to help split up/fold patches if it'll help, especially
if it would make a difference to whether or not we get MID support
into 2.6.37, which is worth trying for.  I like Wolfram's suggested 
patchset format.  Alan, do you feel comfortable re-doing this in time
for some testing before the merge window opens, or should I help?

I think we should postpone style cleanups outside of sdhci-intel-mid.c
until .38, when there'll be less of an outstanding patch backlog.

The big question seems to be whether the approach the patchset takes
-- moving from quirks to hooks, extending sdhci.c without creating a 
full driver, and the initial choice of overridable hooks -- makes
sense.  I'd be happy to hear everyone's thoughts on that.

Thanks for the review so far, Wolfram!

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

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

* Re: [PATCH 5/7] sdhci: Tidy up spaces in sdhci_intel_mid
  2010-09-14 16:41           ` Alan Cox
@ 2010-09-14 20:00             ` Wolfram Sang
  0 siblings, 0 replies; 17+ messages in thread
From: Wolfram Sang @ 2010-09-14 20:00 UTC (permalink / raw)
  To: Alan Cox; +Cc: Chris Ball, linux-mmc

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


> > The big question seems to be whether the approach the patchset takes
> > -- moving from quirks to hooks, extending sdhci.c without creating a 
> > full driver, and the initial choice of overridable hooks -- makes
> > sense.  I'd be happy to hear everyone's thoughts on that.
> 
> I'd rather see that discussion happen and then redo the MID patches to
> match whatever turns out to suit a more generalised set of driver
> tidyups this way than push it in ASAP.

+1 The cleanup may force the drivers to adapt, but not the other way around ;)

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

end of thread, other threads:[~2010-09-14 20:00 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-13 17:38 [PATCH 0/7] Intel MID SDHCI support (take two) Alan Cox
2010-09-13 17:38 ` [PATCH 1/7] sdhci: Rework some of the quirk behaviour Alan Cox
2010-09-14 14:34   ` Wolfram Sang
2010-09-14 14:20     ` Alan Cox
2010-09-13 17:39 ` [PATCH 2/7] sdhci: Allow the probe handler to override slots Alan Cox
2010-09-13 17:39 ` [PATCH 3/7] sdhci: Intel Medfield support Alan Cox
2010-09-13 17:39 ` [PATCH 4/7] mmc: serialization support Alan Cox
2010-09-13 17:39 ` [PATCH 5/7] sdhci: Tidy up spaces in sdhci_intel_mid Alan Cox
2010-09-14 14:21   ` Wolfram Sang
2010-09-14 13:40     ` Alan Cox
2010-09-14 14:45       ` Wolfram Sang
2010-09-14 14:21         ` Alan Cox
2010-09-14 16:57         ` Chris Ball
2010-09-14 16:41           ` Alan Cox
2010-09-14 20:00             ` Wolfram Sang
2010-09-13 17:39 ` [PATCH 6/7] sdhci_pci: Tidy this as well Alan Cox
2010-09-13 17:39 ` [PATCH 7/7] sdhci: Tidy up sdhci.c Alan Cox

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.