Re: [PATCH 1/1]sdhci-pxa: add MMC_CAP_NONREMOVABLE for on-chip device

2010-10-28 Thread zhangfei gao
Thanks for your suggestion, here is updated version.

From 470140b629e3f044a0951368db8e3dc98ebd8ab3 Mon Sep 17 00:00:00 2001
From: Zhangfei Gao zhangfei@marvell.com
Date: Thu, 28 Oct 2010 10:44:15 -0400
Subject: [PATCH] sdhci-pxa: add MMC_CAP_NONREMOVABLE for on-chip device

To share SDHCI_QUIRK_BROKEN_CARD_DETECTION for on-chip device,
MMC_CAP_NONREMOVABLE also needed, otherwise polling mode used by
default

Signed-off-by: Zhangfei Gao zhangfei@marvell.com
CC: Philip Rakity prak...@marvell.com
---
 arch/arm/plat-pxa/include/plat/sdhci.h |2 ++
 drivers/mmc/host/sdhci-pxa.c   |6 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-pxa/include/plat/sdhci.h
b/arch/arm/plat-pxa/include/plat/sdhci.h
index e49c5b6..fc5ceab 100644
--- a/arch/arm/plat-pxa/include/plat/sdhci.h
+++ b/arch/arm/plat-pxa/include/plat/sdhci.h
@@ -16,6 +16,8 @@
 /* pxa specific flag */
 /* Require clock free running */
 #define PXA_FLAG_DISABLE_CLOCK_GATING (10)
+/* card alwayes wired to host, like on-chip emmc */
+#define PXA_FLAG_CARD_PERMANENT(11)

 /*
  * struct pxa_sdhci_platdata() - Platform device data for PXA SDHCI
diff --git a/drivers/mmc/host/sdhci-pxa.c b/drivers/mmc/host/sdhci-pxa.c
index fc406ac..8455c46 100644
--- a/drivers/mmc/host/sdhci-pxa.c
+++ b/drivers/mmc/host/sdhci-pxa.c
@@ -138,6 +138,12 @@ static int __devinit sdhci_pxa_probe(struct
platform_device *pdev)
host-irq = irq;
host-quirks = SDHCI_QUIRK_BROKEN_ADMA | SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;

+   if (pxa-pdata-flags  PXA_FLAG_CARD_PERMANENT) {
+   /* on-chip device */
+   host-quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
+   host-mmc-caps |= MMC_CAP_NONREMOVABLE;
+   }
+
if (pdata-quirks)
host-quirks |= pdata-quirks;

-- 
1.7.0.4
From 470140b629e3f044a0951368db8e3dc98ebd8ab3 Mon Sep 17 00:00:00 2001
From: Zhangfei Gao zhangfei@marvell.com
Date: Thu, 28 Oct 2010 10:44:15 -0400
Subject: [PATCH] sdhci-pxa: add MMC_CAP_NONREMOVABLE for on-chip device

To share SDHCI_QUIRK_BROKEN_CARD_DETECTION for on-chip device, MMC_CAP_NONREMOVABLE also needed, otherwise polling mode used by default

Signed-off-by: Zhangfei Gao zhangfei@marvell.com
CC: Philip Rakity prak...@marvell.com
---
 arch/arm/plat-pxa/include/plat/sdhci.h |2 ++
 drivers/mmc/host/sdhci-pxa.c   |6 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-pxa/include/plat/sdhci.h b/arch/arm/plat-pxa/include/plat/sdhci.h
index e49c5b6..fc5ceab 100644
--- a/arch/arm/plat-pxa/include/plat/sdhci.h
+++ b/arch/arm/plat-pxa/include/plat/sdhci.h
@@ -16,6 +16,8 @@
 /* pxa specific flag */
 /* Require clock free running */
 #define PXA_FLAG_DISABLE_CLOCK_GATING (10)
+/* card alwayes wired to host, like on-chip emmc */
+#define PXA_FLAG_CARD_PERMANENT	(11)
 
 /*
  * struct pxa_sdhci_platdata() - Platform device data for PXA SDHCI
diff --git a/drivers/mmc/host/sdhci-pxa.c b/drivers/mmc/host/sdhci-pxa.c
index fc406ac..8455c46 100644
--- a/drivers/mmc/host/sdhci-pxa.c
+++ b/drivers/mmc/host/sdhci-pxa.c
@@ -138,6 +138,12 @@ static int __devinit sdhci_pxa_probe(struct platform_device *pdev)
 	host-irq = irq;
 	host-quirks = SDHCI_QUIRK_BROKEN_ADMA | SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
 
+	if (pxa-pdata-flags  PXA_FLAG_CARD_PERMANENT) {
+		/* on-chip device */
+		host-quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
+		host-mmc-caps |= MMC_CAP_NONREMOVABLE;
+	}
+
 	if (pdata-quirks)
 		host-quirks |= pdata-quirks;
 
-- 
1.7.0.4



Re: [PATCH 1/1]sdhci-pxa: add MMC_CAP_NONREMOVABLE for on-chip device

2010-10-28 Thread Philip Rakity

ACK:

Philip

On Oct 27, 2010, at 11:00 PM, zhangfei gao wrote:

 Thanks for your suggestion, here is updated version.
 
 From 470140b629e3f044a0951368db8e3dc98ebd8ab3 Mon Sep 17 00:00:00 2001
 From: Zhangfei Gao zhangfei@marvell.com
 Date: Thu, 28 Oct 2010 10:44:15 -0400
 Subject: [PATCH] sdhci-pxa: add MMC_CAP_NONREMOVABLE for on-chip device
 
To share SDHCI_QUIRK_BROKEN_CARD_DETECTION for on-chip device,
 MMC_CAP_NONREMOVABLE also needed, otherwise polling mode used by
 default
 
 Signed-off-by: Zhangfei Gao zhangfei@marvell.com
 CC: Philip Rakity prak...@marvell.com
 ---
 arch/arm/plat-pxa/include/plat/sdhci.h |2 ++
 drivers/mmc/host/sdhci-pxa.c   |6 ++
 2 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/arch/arm/plat-pxa/include/plat/sdhci.h
 b/arch/arm/plat-pxa/include/plat/sdhci.h
 index e49c5b6..fc5ceab 100644
 --- a/arch/arm/plat-pxa/include/plat/sdhci.h
 +++ b/arch/arm/plat-pxa/include/plat/sdhci.h
 @@ -16,6 +16,8 @@
 /* pxa specific flag */
 /* Require clock free running */
 #define PXA_FLAG_DISABLE_CLOCK_GATING (10)
 +/* card alwayes wired to host, like on-chip emmc */
 +#define PXA_FLAG_CARD_PERMANENT  (11)
 
 /*
  * struct pxa_sdhci_platdata() - Platform device data for PXA SDHCI
 diff --git a/drivers/mmc/host/sdhci-pxa.c b/drivers/mmc/host/sdhci-pxa.c
 index fc406ac..8455c46 100644
 --- a/drivers/mmc/host/sdhci-pxa.c
 +++ b/drivers/mmc/host/sdhci-pxa.c
 @@ -138,6 +138,12 @@ static int __devinit sdhci_pxa_probe(struct
 platform_device *pdev)
   host-irq = irq;
   host-quirks = SDHCI_QUIRK_BROKEN_ADMA | SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
 
 + if (pxa-pdata-flags  PXA_FLAG_CARD_PERMANENT) {
 + /* on-chip device */
 + host-quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 + host-mmc-caps |= MMC_CAP_NONREMOVABLE;
 + }
 +
   if (pdata-quirks)
   host-quirks |= pdata-quirks;
 
 -- 
 1.7.0.4
 0001-sdhci-pxa-add-MMC_CAP_NONREMOVABLE-for-on-chip-devic.patch

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/2] [ARM] Dove: rename SDCHI devices to sdhci-dove

2010-10-28 Thread Mike Rapoport
Signed-off-by: Mike Rapoport m...@compulab.co.il
CC: Saeed Bishara sa...@marvell.com
---
 arch/arm/mach-dove/common.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index f7a1258..fe627ab 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -770,7 +770,7 @@ static struct resource dove_sdio0_resources[] = {
 };
 
 static struct platform_device dove_sdio0 = {
-   .name   = sdhci-mv,
+   .name   = sdhci-dove,
.id = 0,
.dev= {
.dma_mask   = sdio_dmamask,
@@ -798,7 +798,7 @@ static struct resource dove_sdio1_resources[] = {
 };
 
 static struct platform_device dove_sdio1 = {
-   .name   = sdhci-mv,
+   .name   = sdhci-dove,
.id = 1,
.dev= {
.dma_mask   = sdio_dmamask,
-- 
1.7.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/2] MMC: add support for the Marvell Dove SDHCI controller

2010-10-28 Thread Mike Rapoport
Implement an sdhci-pltfm driver for the controller found on Marvell
Dove SoC

Signed-off-by: Mike Rapoport m...@compulab.co.il
CC: Saeed Bishara sa...@marvell.com
---
 drivers/mmc/host/Kconfig   |   13 +++
 drivers/mmc/host/Makefile  |1 +
 drivers/mmc/host/sdhci-dove.c  |   70 
 drivers/mmc/host/sdhci-pltfm.c |3 ++
 drivers/mmc/host/sdhci-pltfm.h |1 +
 5 files changed, 88 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mmc/host/sdhci-dove.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 68d1279..4958839 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -130,6 +130,19 @@ config MMC_SDHCI_CNS3XXX
 
  If unsure, say N.
 
+config MMC_SDHCI_DOVE
+   bool SDHCI support on Marvell's Dove SoC
+   depends on ARCH_DOVE
+   depends on MMC_SDHCI_PLTFM
+   select MMC_SDHCI_IO_ACCESSORS
+   help
+ This selects the Secure Digital Host Controller Interface in
+ Marvell's Dove SoC.
+
+ If you have a controller with this interface, say Y or M here.
+
+ If unsure, say N.
+
 config MMC_SDHCI_S3C
tristate SDHCI support on Samsung S3C SoC
depends on MMC_SDHCI  PLAT_SAMSUNG
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 840bcb5..9e1c418 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_MMC_JZ4740)  += jz4740_mmc.o
 obj-$(CONFIG_MMC_SDHCI_PLTFM)  += sdhci-platform.o
 sdhci-platform-y   := sdhci-pltfm.o
 sdhci-platform-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o
+sdhci-platform-$(CONFIG_MMC_SDHCI_DOVE)+= sdhci-dove.o
 
 obj-$(CONFIG_MMC_SDHCI_OF) += sdhci-of.o
 sdhci-of-y := sdhci-of-core.o
diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
new file mode 100644
index 000..561167c
--- /dev/null
+++ b/drivers/mmc/host/sdhci-dove.c
@@ -0,0 +1,70 @@
+/*
+ * sdhci-dove.c Support for SDHCI on Marvell's Dove SoC
+ *
+ * Author: Saeed Bishara sa...@marvell.com
+ *Mike Rapoport m...@compulab.co.il
+ * Based on  sdhci-cns3xxx.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include linux/io.h
+#include linux/mmc/host.h
+
+#include sdhci.h
+#include sdhci-pltfm.h
+
+static u16 sdhci_dove_readw(struct sdhci_host *host, int reg)
+{
+   u16 ret;
+
+   switch (reg) {
+   case SDHCI_HOST_VERSION:
+   case SDHCI_SLOT_INT_STATUS:
+   /* those registers don't exist */
+   return 0;
+   default:
+   ret = readw(host-ioaddr + reg);
+   }
+   return ret;
+}
+
+static u32 sdhci_dove_readl(struct sdhci_host *host, int reg)
+{
+   u32 ret;
+
+   switch (reg) {
+   case SDHCI_CAPABILITIES:
+   ret = readl(host-ioaddr + reg);
+   /* Mask the support for 3.0V */
+   ret = ~SDHCI_CAN_VDD_300;
+   break;
+   default:
+   ret = readl(host-ioaddr + reg);
+   }
+   return ret;
+}
+
+static struct sdhci_ops sdhci_dove_ops = {
+   .read_w = sdhci_dove_readw,
+   .read_l = sdhci_dove_readl,
+};
+
+struct sdhci_pltfm_data sdhci_dove_pdata = {
+   .ops= sdhci_dove_ops,
+   .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
+ SDHCI_QUIRK_NO_BUSY_IRQ |
+ SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
+ SDHCI_QUIRK_FORCE_DMA,
+};
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index e045e3c..28d818e 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -161,6 +161,9 @@ static const struct platform_device_id sdhci_pltfm_ids[] = {
 #ifdef CONFIG_MMC_SDHCI_CNS3XXX
{ sdhci-cns3xxx, (kernel_ulong_t)sdhci_cns3xxx_pdata },
 #endif
+#ifdef CONFIG_MMC_SDHCI_DOVE
+   { sdhci-dove, (kernel_ulong_t)sdhci_dove_pdata },
+#endif
{ },
 };
 MODULE_DEVICE_TABLE(platform, sdhci_pltfm_ids);
diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index 900f329..718d837 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -14,5 +14,6 @@
 #include linux/sdhci-pltfm.h
 
 extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata;
+extern struct sdhci_pltfm_data 

RE: [PATCH v3 2/2] [ARM] Dove: rename SDCHI devices to sdhci-dove

2010-10-28 Thread Saeed Bishara
 

-Original Message-
From: Mike Rapoport [mailto:m...@compulab.co.il] 
Sent: Thursday, October 28, 2010 2:25 PM
To: linux-mmc@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org; Chris Ball; Saeed 
Bishara; Mike Rapoport
Subject: [PATCH v3 2/2] [ARM] Dove: rename SDCHI devices to 
sdhci-dove

Signed-off-by: Mike Rapoport m...@compulab.co.il
CC: Saeed Bishara sa...@marvell.com
---
 arch/arm/mach-dove/common.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index f7a1258..fe627ab 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -770,7 +770,7 @@ static struct resource dove_sdio0_resources[] = {
 };
 
 static struct platform_device dove_sdio0 = {
-  .name   = sdhci-mv,
+  .name   = sdhci-dove,
   .id = 0,
   .dev= {
   .dma_mask   = sdio_dmamask,
@@ -798,7 +798,7 @@ static struct resource dove_sdio1_resources[] = {
 };
 
 static struct platform_device dove_sdio1 = {
-  .name   = sdhci-mv,
+  .name   = sdhci-dove,
   .id = 1,
   .dev= {
   .dma_mask   = sdio_dmamask,
-- 
1.7.3.1


Looks fine to me--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v3 1/2] MMC: add support for the Marvell Dove SDHCI controller

2010-10-28 Thread Saeed Bishara
 

-Original Message-
From: Mike Rapoport [mailto:m...@compulab.co.il] 
Sent: Thursday, October 28, 2010 2:25 PM
To: linux-mmc@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org; Chris Ball; Saeed 
Bishara; Mike Rapoport
Subject: [PATCH v3 1/2] MMC: add support for the Marvell Dove 
SDHCI controller

Implement an sdhci-pltfm driver for the controller found on Marvell
Dove SoC

Signed-off-by: Mike Rapoport m...@compulab.co.il
CC: Saeed Bishara sa...@marvell.com
---
 drivers/mmc/host/Kconfig   |   13 +++
 drivers/mmc/host/Makefile  |1 +
 drivers/mmc/host/sdhci-dove.c  |   70 

 drivers/mmc/host/sdhci-pltfm.c |3 ++
 drivers/mmc/host/sdhci-pltfm.h |1 +
 5 files changed, 88 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mmc/host/sdhci-dove.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 68d1279..4958839 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -130,6 +130,19 @@ config MMC_SDHCI_CNS3XXX
 
 If unsure, say N.
 
+config MMC_SDHCI_DOVE
+  bool SDHCI support on Marvell's Dove SoC
+  depends on ARCH_DOVE
+  depends on MMC_SDHCI_PLTFM
+  select MMC_SDHCI_IO_ACCESSORS
+  help
+This selects the Secure Digital Host Controller Interface in
+Marvell's Dove SoC.
+
+If you have a controller with this interface, say Y or M here.
+
+If unsure, say N.
+
 config MMC_SDHCI_S3C
   tristate SDHCI support on Samsung S3C SoC
   depends on MMC_SDHCI  PLAT_SAMSUNG
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 840bcb5..9e1c418 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
 obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-platform.o
 sdhci-platform-y  := sdhci-pltfm.o
 sdhci-platform-$(CONFIG_MMC_SDHCI_CNS3XXX)+= sdhci-cns3xxx.o
+sdhci-platform-$(CONFIG_MMC_SDHCI_DOVE)   += sdhci-dove.o
 
 obj-$(CONFIG_MMC_SDHCI_OF)+= sdhci-of.o
 sdhci-of-y:= sdhci-of-core.o
diff --git a/drivers/mmc/host/sdhci-dove.c 
b/drivers/mmc/host/sdhci-dove.c
new file mode 100644
index 000..561167c
--- /dev/null
+++ b/drivers/mmc/host/sdhci-dove.c
@@ -0,0 +1,70 @@
+/*
+ * sdhci-dove.c Support for SDHCI on Marvell's Dove SoC
+ *
+ * Author: Saeed Bishara sa...@marvell.com
+ *   Mike Rapoport m...@compulab.co.il
+ * Based on  sdhci-cns3xxx.c
+ *
+ * This program is free software; you can redistribute it 
and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include linux/io.h
+#include linux/mmc/host.h
+
+#include sdhci.h
+#include sdhci-pltfm.h
+
+static u16 sdhci_dove_readw(struct sdhci_host *host, int reg)
+{
+  u16 ret;
+
+  switch (reg) {
+  case SDHCI_HOST_VERSION:
+  case SDHCI_SLOT_INT_STATUS:
+  /* those registers don't exist */
+  return 0;
+  default:
+  ret = readw(host-ioaddr + reg);
+  }
+  return ret;
+}
+
+static u32 sdhci_dove_readl(struct sdhci_host *host, int reg)
+{
+  u32 ret;
+
+  switch (reg) {
+  case SDHCI_CAPABILITIES:
+  ret = readl(host-ioaddr + reg);
+  /* Mask the support for 3.0V */
+  ret = ~SDHCI_CAN_VDD_300;
+  break;
+  default:
+  ret = readl(host-ioaddr + reg);
+  }
+  return ret;
+}
+
+static struct sdhci_ops sdhci_dove_ops = {
+  .read_w = sdhci_dove_readw,
+  .read_l = sdhci_dove_readl,
+};
+
+struct sdhci_pltfm_data sdhci_dove_pdata = {
+  .ops= sdhci_dove_ops,
+  .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
+SDHCI_QUIRK_NO_BUSY_IRQ |
+SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
+SDHCI_QUIRK_FORCE_DMA,
+};
diff --git a/drivers/mmc/host/sdhci-pltfm.c 
b/drivers/mmc/host/sdhci-pltfm.c
index e045e3c..28d818e 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -161,6 +161,9 @@ static const struct platform_device_id 
sdhci_pltfm_ids[] = {
 #ifdef CONFIG_MMC_SDHCI_CNS3XXX
   { sdhci-cns3xxx, (kernel_ulong_t)sdhci_cns3xxx_pdata },
 #endif
+#ifdef CONFIG_MMC_SDHCI_DOVE
+  { sdhci-dove, (kernel_ulong_t)sdhci_dove_pdata },
+#endif
   { },
 };
 MODULE_DEVICE_TABLE(platform, sdhci_pltfm_ids);
diff --git a/drivers/mmc/host/sdhci-pltfm.h 

Re: SDIO runtime crash on resume

2010-10-28 Thread Ohad Ben-Cohen
Hi Daniel,

On Wed, Oct 27, 2010 at 10:37 PM, Ohad Ben-Cohen o...@wizery.com wrote:
...
 can you please tell me if you can reproduce this with mmc-next ?

 Can you please also send full logs (from boot to crash preferably) + .config ?

Please 'echo 8  /proc/sys/kernel/printk' before generating the logs.

Some additional questions (some of them will be answered by the
logs+config you will send, but in case you're not in front of the
setup you can just answer those directly):

- What is your mmc host ? sdhci-pci presumably ? I might be able to
get such hardware.. But not before next week (LPC).. Hey any chance
you or Chris plan to attend LPC with this setup ? I'm going to be
there and if I had your setup with a reproducible bug that would make
this very easy to fix...

- During boot, was you card identified and added (i assume yes) ?

- After boot, was your card powered down (i assume yes) ?
  check this out by:
  mount -t debugfs none /sys/kernel/debug
  cat /sys/kernel/debug/mmc1/ios

- Just for general knowledge - as soon as you load your driver
(libertas, right ?) - was your card powered up and correctly
configured (sdio clock/voltage/bus width. again check with
/sys/kernel/debug/mmc2/ios) ?

 mmc1: error -110 during resume (card was removed?)

I assume there are no failures before it ? the system was correctly suspended ?

Anyway this timeout (-110) shouldn't happen. The device might still be
powered off for some reason. I guess the timeout is coming from
mmc_sdio_init_card(). I just wonder whether it's coming already from
mmc_send_io_op_cond(), or whether it's a side effect of 9b966aae64 and
thus it's coming from a later stage of mmc_sdio_init_card. If you can
please put some pr_info(%s %d: ret %d\n, __func__, __LINE__, ret)
lines throughout that function that could be great.

 mmc1: card 0001 removed

care to put a dump_stack() in the beginning of mmc_remove_card() ?

 IP: [b05e9d95] __pm_runtime_idle+0x15/0x53

That can be all sort of badness.

I'll wait for the logs+more info (+chance to have this setup in LPC ;)
and we'll continue from there.

Thanks,
Ohad.
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 2/2] [ARM] Dove: rename SDCHI devices to sdhci-dove

2010-10-28 Thread saeed bishara
Subject: [PATCH v3 2/2] [ARM] Dove: rename SDCHI devices to
 please fix the typo in the subject SDHCI instead of SDCHI
saeed
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: b43 sdio: WARNING: at drivers/mmc/core/core.c:237 mmc_wait_for_cmd

2010-10-28 Thread Larry Finger
On 10/28/2010 09:28 AM, Arnd Hannemann wrote:
 Hi,
\ [ 1364.620044] b43-phy1 debug: Removing Interface type 2
 [ 1364.621812] b43-phy1 debug: Wireless interface stopped
 [ 1372.440297] b43-sdio: before ssb_bus_unregister, claimed is 0
 [ 1372.440345] b43-sdio: before sdio_disable_func, claimed is 0
 [ 1372.440351] [ cut here ]
 [ 1372.440367] WARNING: at drivers/mmc/core/core.c:237 
 mmc_wait_for_cmd+0x88/0x90()

Please try the patch below. It claims the device before the sdio_disable_func(()
call and releases it afterwords.

Larry


Index: wireless-testing/drivers/net/wireless/b43/sdio.c
===
--- wireless-testing.orig/drivers/net/wireless/b43/sdio.c
+++ wireless-testing/drivers/net/wireless/b43/sdio.c
@@ -175,7 +175,9 @@ static void b43_sdio_remove(struct sdio_
struct b43_sdio *sdio = sdio_get_drvdata(func);

ssb_bus_unregister(sdio-ssb);
+   sdio_claim_host(func);
sdio_disable_func(func);
+   sdio_release_host(func);
kfree(sdio);
sdio_set_drvdata(func, NULL);
 }
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: SDIO runtime crash on resume

2010-10-28 Thread Chris Ball
Hi Ohad,

On Thu, Oct 28, 2010 at 04:39:34PM +0200, Ohad Ben-Cohen wrote:
 - What is your mmc host ? sdhci-pci presumably ? I might be able to
 get such hardware.. But not before next week (LPC).. Hey any chance
 you or Chris plan to attend LPC with this setup ? I'm going to be
 there and if I had your setup with a reproducible bug that would make
 this very easy to fix...

I'll just give you an XO-1.5 at LPC -- that way you can work on it
either during the conference or afterwards.  We should still get a
.config from Daniel, though, and steps to reproduce.

Thanks!  Look forward to meeting you there,

- Chris.
-- 
Chris Ball   c...@laptop.org   http://printf.net/
One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: b43 sdio: WARNING: at drivers/mmc/core/core.c:237 mmc_wait_for_cmd

2010-10-28 Thread Arnd Hannemann
Hi,

Am 28.10.2010 16:49, schrieb Larry Finger:
 On 10/28/2010 09:28 AM, Arnd Hannemann wrote:
 Hi,
 \ [ 1364.620044] b43-phy1 debug: Removing Interface type 2
 [ 1364.621812] b43-phy1 debug: Wireless interface stopped
 [ 1372.440297] b43-sdio: before ssb_bus_unregister, claimed is 0
 [ 1372.440345] b43-sdio: before sdio_disable_func, claimed is 0
 [ 1372.440351] [ cut here ]
 [ 1372.440367] WARNING: at drivers/mmc/core/core.c:237 
 mmc_wait_for_cmd+0x88/0x90()
 
 Please try the patch below. It claims the device before the 
 sdio_disable_func(()
 call and releases it afterwords.
 
 
 Index: wireless-testing/drivers/net/wireless/b43/sdio.c
 ===
 --- wireless-testing.orig/drivers/net/wireless/b43/sdio.c
 +++ wireless-testing/drivers/net/wireless/b43/sdio.c
 @@ -175,7 +175,9 @@ static void b43_sdio_remove(struct sdio_
   struct b43_sdio *sdio = sdio_get_drvdata(func);
 
   ssb_bus_unregister(sdio-ssb);
 + sdio_claim_host(func);
   sdio_disable_func(func);
 + sdio_release_host(func);
   kfree(sdio);
   sdio_set_drvdata(func, NULL);
  }
 

Thanks, that fixes the warning.

Regards
Arnd
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: SDIO runtime crash on resume

2010-10-28 Thread Ohad Ben-Cohen
Hi Chris,

On Thu, Oct 28, 2010 at 4:55 PM, Chris Ball c...@laptop.org wrote:
 I'll just give you an XO-1.5 at LPC -- that way you can work on it
 either during the conference or afterwards.  We should still get a
 .config from Daniel, though, and steps to reproduce.

That would be really good, thanks a lot !

 Thanks!  Look forward to meeting you there,

I look forward to meeting you too, thanks again !
Ohad.
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] MMC: Proposals on reworking clock and power management

2010-10-28 Thread Kishore Kadiyala
Nicolas,

snip 

    2.a) Card sleep, Power cutoff to the card:
      This should be handled in the core where based on block layer
      activity, calling corresponding API's from bus layer:
      mmc_power_save_host/ mmc_power_restore_host

 Same issue here.  Card power is for the core to decide, but the
 controller driver may perform opportunistic power down of the controller
 itself when it is possible and the core does not need to know about it.

I think card power decision is taken care in the core as per below patch :
https://patchwork.kernel.org/patch/226631/

And regarding opportunistic power down of the controller can be done by
adapting driver to PM-Runtime

snip

Regards,
Kishore
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] MMC: Proposals on reworking clock and power management

2010-10-28 Thread Nicolas Pitre
On Thu, 28 Oct 2010, Ohad Ben-Cohen wrote:

 On Thu, Oct 28, 2010 at 5:39 PM, Kishore Kadiyala
 kishorek.kadiy...@gmail.com wrote:
  Wouldn't adapting the host driver just to PM-Runtime will answer the
  above issues?
 
 It's not enough.
 
 When the card is runtime suspended, sure, the host controller will
 immediately get idle notification by runtime PM core.
 
 But you may still want to gate the clock to the host controller on bus
 inactivity, even if the card is not runtime suspended. The decision to
 do this should come from the mmc core.

This is not clear that this is something that the core can effectively 
help with.  Opportunistic power saving at the host controller level is 
pretty much hardware dependent and may wildly vary in capabilities... 
and bugs.  So in this later case I think the driver for the host 
controller is the best place to just set up a timer and gate the clock 
after a certain period of inactivity for example.


Nicolas
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] MMC: Proposals on reworking clock and power management

2010-10-28 Thread Kishore Kadiyala
On Thu, Oct 28, 2010 at 9:43 PM, Nicolas Pitre n...@fluxnic.net wrote:
 On Thu, 28 Oct 2010, Ohad Ben-Cohen wrote:

 On Thu, Oct 28, 2010 at 5:39 PM, Kishore Kadiyala
 kishorek.kadiy...@gmail.com wrote:
  Wouldn't adapting the host driver just to PM-Runtime will answer the
  above issues?

 It's not enough.

 When the card is runtime suspended, sure, the host controller will
 immediately get idle notification by runtime PM core.

 But you may still want to gate the clock to the host controller on bus
 inactivity, even if the card is not runtime suspended. The decision to
 do this should come from the mmc core.

 This is not clear that this is something that the core can effectively
 help with.  Opportunistic power saving at the host controller level is
 pretty much hardware dependent and may wildly vary in capabilities...
 and bugs.  So in this later case I think the driver for the host
 controller is the best place to just set up a timer and gate the clock
 after a certain period of inactivity for example.

Agree,
So briefly, calling pm_runtime_put_sync using a activity based timer
in the host Controller
driver will gate the clock to the controller .
On idle notification to PM runtime core, which will trigger a call to
the runtime_suspend hook in bus.c
[https://patchwork.kernel.org/patch/226671/ ] which will perform
powering off the Card

Regards,
Kishore
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 0/2] add support for the Marvell Dove SDHCI controller

2010-10-28 Thread Mike Rapoport
These patches add support for the Marvell Dove SDHCI controller.

v4 changes:
* fix spelling in the commit message

v3 changes:
* finally remove unneeded includes from the driver

v2 changes:
* rename drivers/mmc/host/sdhci-mv.c to drivers/mmc/host/sdhci-dove.c and
update Kconfig and Makefile respectively
* add dependancy on ARCH_DOVE
* remove unneeded includes from the driver


Mike Rapoport (2):
  MMC: add support for the Marvell Dove SDHCI controller
  [ARM] Dove: rename SDHCI devices to sdhci-dove

 arch/arm/mach-dove/common.c|4 +-
 drivers/mmc/host/Kconfig   |   13 +++
 drivers/mmc/host/Makefile  |1 +
 drivers/mmc/host/sdhci-dove.c  |   70 
 drivers/mmc/host/sdhci-pltfm.c |3 ++
 drivers/mmc/host/sdhci-pltfm.h |1 +
 6 files changed, 90 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mmc/host/sdhci-dove.c

-- 
1.7.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 2/2] [ARM] Dove: rename SDHCI devices to sdhci-dove

2010-10-28 Thread Mike Rapoport
Signed-off-by: Mike Rapoport m...@compulab.co.il
CC: Saeed Bishara sa...@marvell.com
---
 arch/arm/mach-dove/common.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index f7a1258..fe627ab 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -770,7 +770,7 @@ static struct resource dove_sdio0_resources[] = {
 };
 
 static struct platform_device dove_sdio0 = {
-   .name   = sdhci-mv,
+   .name   = sdhci-dove,
.id = 0,
.dev= {
.dma_mask   = sdio_dmamask,
@@ -798,7 +798,7 @@ static struct resource dove_sdio1_resources[] = {
 };
 
 static struct platform_device dove_sdio1 = {
-   .name   = sdhci-mv,
+   .name   = sdhci-dove,
.id = 1,
.dev= {
.dma_mask   = sdio_dmamask,
-- 
1.7.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/2] MMC: add support for the Marvell Dove SDHCI controller

2010-10-28 Thread Mike Rapoport
Implement an sdhci-pltfm driver for the controller found on Marvell
Dove SoC

Signed-off-by: Mike Rapoport m...@compulab.co.il
CC: Saeed Bishara sa...@marvell.com
---
 drivers/mmc/host/Kconfig   |   13 +++
 drivers/mmc/host/Makefile  |1 +
 drivers/mmc/host/sdhci-dove.c  |   70 
 drivers/mmc/host/sdhci-pltfm.c |3 ++
 drivers/mmc/host/sdhci-pltfm.h |1 +
 5 files changed, 88 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mmc/host/sdhci-dove.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 68d1279..4958839 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -130,6 +130,19 @@ config MMC_SDHCI_CNS3XXX
 
  If unsure, say N.
 
+config MMC_SDHCI_DOVE
+   bool SDHCI support on Marvell's Dove SoC
+   depends on ARCH_DOVE
+   depends on MMC_SDHCI_PLTFM
+   select MMC_SDHCI_IO_ACCESSORS
+   help
+ This selects the Secure Digital Host Controller Interface in
+ Marvell's Dove SoC.
+
+ If you have a controller with this interface, say Y or M here.
+
+ If unsure, say N.
+
 config MMC_SDHCI_S3C
tristate SDHCI support on Samsung S3C SoC
depends on MMC_SDHCI  PLAT_SAMSUNG
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 840bcb5..9e1c418 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_MMC_JZ4740)  += jz4740_mmc.o
 obj-$(CONFIG_MMC_SDHCI_PLTFM)  += sdhci-platform.o
 sdhci-platform-y   := sdhci-pltfm.o
 sdhci-platform-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o
+sdhci-platform-$(CONFIG_MMC_SDHCI_DOVE)+= sdhci-dove.o
 
 obj-$(CONFIG_MMC_SDHCI_OF) += sdhci-of.o
 sdhci-of-y := sdhci-of-core.o
diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
new file mode 100644
index 000..561167c
--- /dev/null
+++ b/drivers/mmc/host/sdhci-dove.c
@@ -0,0 +1,70 @@
+/*
+ * sdhci-dove.c Support for SDHCI on Marvell's Dove SoC
+ *
+ * Author: Saeed Bishara sa...@marvell.com
+ *Mike Rapoport m...@compulab.co.il
+ * Based on  sdhci-cns3xxx.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include linux/io.h
+#include linux/mmc/host.h
+
+#include sdhci.h
+#include sdhci-pltfm.h
+
+static u16 sdhci_dove_readw(struct sdhci_host *host, int reg)
+{
+   u16 ret;
+
+   switch (reg) {
+   case SDHCI_HOST_VERSION:
+   case SDHCI_SLOT_INT_STATUS:
+   /* those registers don't exist */
+   return 0;
+   default:
+   ret = readw(host-ioaddr + reg);
+   }
+   return ret;
+}
+
+static u32 sdhci_dove_readl(struct sdhci_host *host, int reg)
+{
+   u32 ret;
+
+   switch (reg) {
+   case SDHCI_CAPABILITIES:
+   ret = readl(host-ioaddr + reg);
+   /* Mask the support for 3.0V */
+   ret = ~SDHCI_CAN_VDD_300;
+   break;
+   default:
+   ret = readl(host-ioaddr + reg);
+   }
+   return ret;
+}
+
+static struct sdhci_ops sdhci_dove_ops = {
+   .read_w = sdhci_dove_readw,
+   .read_l = sdhci_dove_readl,
+};
+
+struct sdhci_pltfm_data sdhci_dove_pdata = {
+   .ops= sdhci_dove_ops,
+   .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
+ SDHCI_QUIRK_NO_BUSY_IRQ |
+ SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
+ SDHCI_QUIRK_FORCE_DMA,
+};
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index e045e3c..28d818e 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -161,6 +161,9 @@ static const struct platform_device_id sdhci_pltfm_ids[] = {
 #ifdef CONFIG_MMC_SDHCI_CNS3XXX
{ sdhci-cns3xxx, (kernel_ulong_t)sdhci_cns3xxx_pdata },
 #endif
+#ifdef CONFIG_MMC_SDHCI_DOVE
+   { sdhci-dove, (kernel_ulong_t)sdhci_dove_pdata },
+#endif
{ },
 };
 MODULE_DEVICE_TABLE(platform, sdhci_pltfm_ids);
diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index 900f329..718d837 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -14,5 +14,6 @@
 #include linux/sdhci-pltfm.h
 
 extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata;
+extern struct sdhci_pltfm_data 

Re: [RFC] MMC: Proposals on reworking clock and power management

2010-10-28 Thread Ohad Ben-Cohen
On Thu, Oct 28, 2010 at 6:40 PM, Kishore Kadiyala
kishorek.kadiy...@gmail.com wrote:
 On Thu, Oct 28, 2010 at 9:43 PM, Nicolas Pitre n...@fluxnic.net wrote:
 This is not clear that this is something that the core can effectively
 help with.  Opportunistic power saving at the host controller level is
 pretty much hardware dependent and may wildly vary in capabilities...
 and bugs.  So in this later case I think the driver for the host
 controller is the best place to just set up a timer and gate the clock
 after a certain period of inactivity for example.

makes sense, thanks.

 Agree,
 So briefly, calling pm_runtime_put_sync using a activity based timer
 in the host Controller
 driver will gate the clock to the controller .

Just make sure you call pm_suspend_ignore_children(), because you want
to be able to gate that clock even when the card is still active

 On idle notification to PM runtime core, which will trigger a call to
 the runtime_suspend hook in bus.c
 [https://patchwork.kernel.org/patch/226671/ ] which will perform
 powering off the Card

Kishore, I'm not sure what you meant in the last sentence ?
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 0/2] add support for the Marvell Dove SDHCI controller

2010-10-28 Thread Wolfram Sang
On Thu, Oct 28, 2010 at 09:23:51PM +0200, Mike Rapoport wrote:
 These patches add support for the Marvell Dove SDHCI controller.

Yay! This approach looks much better IMHO. So, for the series:

Acked-by: Wolfram Sang w.s...@pengutronix.de

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


signature.asc
Description: Digital signature