mmci: allow the card detect GPIO value not to be inverted
PATCH 1/1 mmci: allow the card detect GPIO value not to be inverted
On some platforms, the GPIO value from the gpio_cd pin doesn't need to be inverted to get it active high. Add a cd_invert platform data parameter and change existing platforms using GPIO for CD (only Realview) to enable it.
--- arch/arm/mach-realview/core.c | 2 ++ drivers/mmc/host/mmci.c | 5 +++-- include/linux/amba/mmci.h | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-realview/core.c +2 -0
@@ -259,6 +259,7 @@ struct mmci_platform_data realview_mmc0_plat_data = { .status = realview_mmc_status, .gpio_wp = 17, .gpio_cd = 16, + .cd_invert = true, };struct mmci_platform_data realview_mmc1_plat_data = {
@@ -266,6 +267,7 @@ struct mmci_platform_data realview_mmc1_plat_data = { .status = realview_mmc_status, .gpio_wp = 19, .gpio_cd = 18, + .cd_invert = true, };/*
drivers/mmc/host/mmci.c +3 -2
@@ -570,12 +570,13 @@ static int mmci_get_ro(struct mmc_host *mmc)static int mmci_get_cd (struct mmc_host *mmc) {struct mmci_host *host =mmc_priv (mmc); +struct mmci_platform_data *plat = host->plat;unsigned int status;if (host->gpio_cd == -ENOSYS ) - status = host->plat->status (mmc_dev (host->mmc)); + status = plat->status (mmc_dev (host->mmc));else - status = !gpio_get_value (host->gpio_cd); + status = !!gpio_get_value (host->gpio_cd) ^ plat->cd_invert;/* * Use positive logic throughout - status is zero for no card,
include/linux/amba/mmci.h +2 -0
@@ -24,6 +24,7 @@* whether a card is present in the MMC slot or not * @gpio_wp: read this GPIO pin to see if the card is write protected * @gpio_cd: read this GPIO pin to detect card insertion +* @cd_invert: true if the gpio_cd pin value is active low * @capabilities: the capabilities of the block as implemented in * this platform, signify anything MMC_CAP_* from mmc/host.h */
@@ -35,6 +36,7 @@ struct mmci_platform_data {unsigned int (*status)(struct device *);int gpio_wp;int gpio_cd; +bool cd_invert;unsigned long capabilities; };
Signature · 1 line
1.7.2.dirty
Quoted 1 line
From [email protected] Sun Jun 6 12:36:48 2010
From: [email protected] ()
Date: Sun, 06 Jun 2010 16:36:48 -0000
Subject: No subject
Message-ID: <mailman.166.1281687448.27306.linux-arm-kernel@lists.infradead.org>
bootloader issue, isn't it.
I don't know exactly what "internal boot mode" means, but assuming the ROM code doesn't make any output to UART1 at least this clock smells like a bootloader problem. If you're conviced this is a chip problem, did you consider to contact FSL about it?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 1 line
From [email protected] Sun Jun 6 12:36:48 2010
From: [email protected] ()
Date: Sun, 06 Jun 2010 16:36:48 -0000
Subject: No subject
Message-ID: <mailman.178.1281999291.27306.linux-arm-kernel@lists.infradead.org>
#define CHECK(e,l,h) (var->e < l || var->e > h) if (CHECK(right_margin, (5+1), 256) || /* back porch */ CHECK(left_margin, (5+1), 256) || /* front porch */ CHECK(hsync_len, (5+1), 256) || var->xres > 4096 ||
These 4 checks don't match the actual values that can be generated by the CLCD controller. The minimum values for left and right horizontal porch and HSYNC width can go down to 1 clock.
The maximum x resolution for the pl11x devices is 1024 pixels.
I know this function can be overridden for platforms using the clcd driver, but does anyone have any problem making this function match the hardware?
thanks,
Kevin