linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: RealView SD/MMC Card detection and write-protect using GPIOLIB
@ 2010-01-25 12:58 Colin Tuckley
  2010-01-25 18:04 ` Russell King - ARM Linux
  0 siblings, 1 reply; 4+ messages in thread
From: Colin Tuckley @ 2010-01-25 12:58 UTC (permalink / raw)
  To: linux-arm-kernel

The switch to using GPIOLIB broke the sd/mmc card detection on the
RealView development boards because ARCH_REQUIRE_GPIOLIB
and GPIO_PL061 were not always selected. Forcing the use of gpiolib also
means that the write-protect detection works.

Signed-off-by: Colin Tuckley <colin.tuckley@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm/Kconfig              |    3 ++-
 arch/arm/mach-realview/core.c |   20 --------------------
 2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 233a222..7303f62 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -232,7 +232,8 @@ config ARCH_REALVIEW
 	select ICST307
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
-	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select ARCH_REQUIRE_GPIOLIB
+	select GPIO_PL061
 	help
 	  This enables support for ARM Ltd RealView boards.
 
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 27e2338..81cf0aa 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -238,34 +238,14 @@ static int __init realview_i2c_init(void)
 }
 arch_initcall(realview_i2c_init);
 
-#define REALVIEW_SYSMCI	(__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_MCI_OFFSET)
-
-/*
- * This is only used if GPIOLIB support is disabled
- */
-static unsigned int realview_mmc_status(struct device *dev)
-{
-	struct amba_device *adev = container_of(dev, struct amba_device, dev);
-	u32 mask;
-
-	if (adev->res.start == REALVIEW_MMCI0_BASE)
-		mask = 1;
-	else
-		mask = 2;
-
-	return readl(REALVIEW_SYSMCI) & mask;
-}
-
 struct mmci_platform_data realview_mmc0_plat_data = {
 	.ocr_mask	= MMC_VDD_32_33|MMC_VDD_33_34,
-	.status		= realview_mmc_status,
 	.gpio_wp	= 17,
 	.gpio_cd	= 16,
 };
 
 struct mmci_platform_data realview_mmc1_plat_data = {
 	.ocr_mask	= MMC_VDD_32_33|MMC_VDD_33_34,
-	.status		= realview_mmc_status,
 	.gpio_wp	= 19,
 	.gpio_cd	= 18,
 };

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

* [PATCH] ARM: RealView SD/MMC Card detection and write-protect using GPIOLIB
  2010-01-25 12:58 [PATCH] ARM: RealView SD/MMC Card detection and write-protect using GPIOLIB Colin Tuckley
@ 2010-01-25 18:04 ` Russell King - ARM Linux
  2010-01-26  8:23   ` Colin Tuckley
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King - ARM Linux @ 2010-01-25 18:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 25, 2010 at 12:58:20PM +0000, Colin Tuckley wrote:
> The switch to using GPIOLIB broke the sd/mmc card detection on the
> RealView development boards because ARCH_REQUIRE_GPIOLIB
> and GPIO_PL061 were not always selected. Forcing the use of gpiolib also
> means that the write-protect detection works.

No; if it's broken then it's because something's wrong, and I think there
was a mail about that recently.  I don't particularly like forcing options
on when there's better solutions to the problem (like fixing the cause of
the actual breakage.)

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

* [PATCH] ARM: RealView SD/MMC Card detection and write-protect using GPIOLIB
  2010-01-25 18:04 ` Russell King - ARM Linux
@ 2010-01-26  8:23   ` Colin Tuckley
  0 siblings, 0 replies; 4+ messages in thread
From: Colin Tuckley @ 2010-01-26  8:23 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: Russell King - ARM Linux [mailto:linux at arm.linux.org.uk] 

> No; if it's broken then it's because something's wrong, and I 
> think there
> was a mail about that recently.  I don't particularly like 
> forcing options
> on when there's better solutions to the problem (like fixing 
> the cause of
> the actual breakage.)

Actually, the patch description is slightly wrong/misleading.

The original patch did break the card detection on some boards. Also the
configuration options mentioned do need setting for things to work properly.
I think it's that the PL061 driver didn't get included in the kernel by the
original patch. Maybe it should be added to the realview_default config
files?

The problem here I think is that someone implemented gpiolib for sdcard
detection on mach-realview without doing any testing. When I started working
on a kernel with gpiolib I found the detection broken. After a lot of
experimentation and discussion with Catalin we decided that the patch I
submitted was the best way forward.

If it's not acceptable please suggest something that is.

Colin

-- 
Colin Tuckley - ARM Ltd.
110 Fulbourn Rd
Cambridge, CB1 9NJ
Tel: +44 1223 400536 

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

* [PATCH] ARM: RealView SD/MMC Card detection and write-protect using GPIOLIB
@ 2010-02-16 15:31 Colin Tuckley
  0 siblings, 0 replies; 4+ messages in thread
From: Colin Tuckley @ 2010-02-16 15:31 UTC (permalink / raw)
  To: linux-arm-kernel

The switch to using GPIOLIB broke the sd/mmc card detection on the
RealView development boards if GPIO_PL061 was not selected.
This patch selects GPIO_PL061 if GPIOLIB is selected.
The sense of the return value from mmc_status has also changed
and is corrected.

Signed-off-by: Colin Tuckley <colin.tuckley@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm/Kconfig              |    1 +
 arch/arm/mach-realview/core.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4c33ca8..a3c0baa 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -235,6 +235,7 @@ config ARCH_REALVIEW
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
 	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select GPIO_PL061 if GPIOLIB
 	help
 	  This enables support for ARM Ltd RealView boards.
 
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 27e2338..06bb649 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -253,7 +253,7 @@ static unsigned int realview_mmc_status(struct device *dev)
 	else
 		mask = 2;
 
-	return readl(REALVIEW_SYSMCI) & mask;
+	return !(readl(REALVIEW_SYSMCI) & mask);
 }
 
 struct mmci_platform_data realview_mmc0_plat_data = {

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

end of thread, other threads:[~2010-02-16 15:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-25 12:58 [PATCH] ARM: RealView SD/MMC Card detection and write-protect using GPIOLIB Colin Tuckley
2010-01-25 18:04 ` Russell King - ARM Linux
2010-01-26  8:23   ` Colin Tuckley
  -- strict thread matches above, loose matches on Subject: below --
2010-02-16 15:31 Colin Tuckley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).