Skip to contentSkip to conversation

ARM: RealView SD/MMC Card detection and write-protect using GPIOLIB

PATCH New Colin Tuckley 2 participants 3 messages Jan 25, 2010 – Jan 26, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: RealView SD/MMC Card detection and write-protect using GPIOLIB

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.

---
 arch/arm/Kconfig              |    3 ++-
 arch/arm/mach-realview/core.c |   20 --------------------
 2 files changed, 2 insertions(+), 21 deletions(-)
arch/arm/Kconfig +2 -1
index 233a222..7303f62 100644
@@ -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.
 
arch/arm/mach-realview/core.c +0 -20
index 27e2338..81cf0aa 100644
@@ -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,
 };
#1 lore raw

PATCH 1/1 ARM: RealView SD/MMC Card detection and write-protect using GPIOLIB

Quoted 4 lines · Colin Tuckley

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.)

#2 lore raw

PATCH 1/1 ARM: RealView SD/MMC Card detection and write-protect using GPIOLIB

Quoted 10 lines

-----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

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