hsmmc gpio updates
Subsystems (5)
PATCH 1/1 hsmmc gpio updates
From: David Brownell <[email protected]>
Rework card detect GPIO handling in the twl4030 MMC glue: drive it *only* from the hsmmc_info passed; remove most of remaining "we know we're always a twl4030 GPIO" logic.
Add write-protect switch detection support to that glue. Stub in a not-present WP GPIO into most boards. (Beagle's is real.)
Teach the hsmmc driver how to use the card detect and writeprotect methods, and move some data structure init earlier so that when IRQs come in, more of the data used by their handlers is initialized.
Verified on Beagle (WP, card detect events) and Overo (boots, both card and wlan are seen). Beagle behaves fully, and is the model to follow for the common case where the TWL4030 gpio-0 card detect magic is used.
Most hsmmc boards need to list what GPIOs they use with MMC...
Note that supporting card detect and writeprotect GPIOs on a second MMC slot, or using the MMC3 controller, requires some interface updates that aren't part of this patch.
--- arch/arm/mach-omap2/board-2430sdp.c | 1 arch/arm/mach-omap2/board-3430sdp.c | 2 arch/arm/mach-omap2/board-ldp.c | 1 arch/arm/mach-omap2/board-omap2evm.c | 1 arch/arm/mach-omap2/board-omap3beagle.c | 26 ++--- arch/arm/mach-omap2/board-omap3evm.c | 1 arch/arm/mach-omap2/board-omap3pandora.c | 1 arch/arm/mach-omap2/board-overo.c | 2 arch/arm/mach-omap2/mmc-twl4030.c | 133 ++++++++++++++--------------- arch/arm/mach-omap2/mmc-twl4030.h | 1 drivers/mmc/host/omap_hsmmc.c | 51 ++++++++--- 11 files changed, 127 insertions(+), 93 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -0
@@ -395,6 +395,7 @@ static struct twl4030_hsmmc_info mmc[] _ .mmc = 1, .wires = 4, .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-3430sdp.c +2 -0
@@ -450,11 +450,13 @@ static struct twl4030_hsmmc_info mmc[] _ .mmc = 1, .wires = 8, .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, }, { .mmc = 2, .wires = 8, .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-ldp.c +1 -0
@@ -346,6 +346,7 @@ static struct twl4030_hsmmc_info mmc[] _ .mmc = 1, .wires = 4, .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap2evm.c +1 -0
@@ -345,6 +345,7 @@ static struct twl4030_hsmmc_info mmc[] _ .mmc = 1, .wires = 4, .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap3beagle.c +12 -14
@@ -116,6 +116,15 @@ static struct twl4030_usb_data beagle_us .usb_mode = T2_USB_MODE_ULPI, }; +static struct twl4030_hsmmc_info mmc[]__initdata = { + { + .mmc =1 , + .wires =8 , + .gpio_wp =29 , + }, + {}/* Terminator */ +}; +static struct gpio_led gpio_leds[];#include <linux/interrupt.h>
@@ -135,6 +144,9 @@ static int beagle_twl_gpio_setup(structint status;/* gpio + 0 is "mmc0_cd" (input/IRQ) */ +omap_cfg_reg (AH8_34XX_GPIO29 ); + mmc[0 ].gpio_cd = gpio +0 ; +hsmmc_init (mmc);/* REVISIT: need ehci-omap hooks for external VBUS * power switch and overcurrent detect
@@ -319,15 +331,6 @@ static void __init omap3beagle_flash_ini } } -static struct twl4030_hsmmc_info mmc[]__initdata = { - { - .mmc =1 , - .wires =8 , - .gpio_cd =TWL4030_GPIO_IRQ_NO (0 ), - }, - {}/* Terminator */ -}; -static void __init omap3_beagle_init (void ) {omap3_beagle_i2c_init ();
@@ -344,11 +347,6 @@ static void __init omap3_beagle_init(voi#endif omap_serial_init (); -omap_cfg_reg (AH8_34XX_GPIO29 ); -gpio_request (29 ,"mmc0_wp" ); -gpio_direction_input (29 ); -hsmmc_init (mmc); -omap_cfg_reg (J25_34XX_GPIO170 );gpio_request (170 ,"DVI_nPD" );/* REVISIT leave DVI powered down until it's needed ... */
arch/arm/mach-omap2/board-omap3evm.c +1 -0
@@ -240,6 +240,7 @@ static struct twl4030_hsmmc_info mmc[] _ .mmc = 1, .wires = 4, .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap3pandora.c +1 -0
@@ -208,6 +208,7 @@ static struct twl4030_hsmmc_info mmc[] _ .mmc = 1, .wires = 4, .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-overo.c +2 -0
@@ -213,11 +213,13 @@ static struct twl4030_hsmmc_info mmc[] _ .mmc = 1, .wires = 4, .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, }, { .mmc = 2, .wires = 4, .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, }, {}/* Terminator */ };
arch/arm/mach-omap2/mmc-twl4030.c +67 -66
216 lines not on this page · raw message
arch/arm/mach-omap2/mmc-twl4030.h +1 -0
@@ -10,6 +10,7 @@ struct twl4030_hsmmc_info {u8 mmc;/* controller 1/2/3 */ u8 wires;/* 1/4/8 wires */ int gpio_cd;/* or -EINVAL */ +int gpio_wp;/* or -EINVAL */ }; #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
drivers/mmc/host/omap_hsmmc.c +38 -13
88 lines not on this page · raw message
Quoted 9 lines · David Brownell
From: David Brownell <[email protected]>
Rework card detect GPIO handling in the twl4030 MMC glue: drive it *only* from the
hsmmc_infopassed; remove most of remaining "we know we're always a twl4030 GPIO" logic.Add write-protect switch detection support to that glue. Stub in a not-present WP GPIO into most boards. (Beagle's is real.)
Quoted 8 lines
Teach the hsmmc driver how to use the card detect and writeprotect methods, and move some data structure init earlier so that when IRQs come in, more of the data used by their handlers is initialized.
Verified on Beagle (WP, card detect events) and Overo (boots, both card and wlan are seen). Beagle behaves fully, and is the model to follow for the common case where the TWL4030 gpio-0 card detect magic is used.
Nice work! Overo uses TWL4030 gpio-0 for card detect (just like Beagle) and GPIO-54 for WP.
Would you like me to prepare a patch to add on top of yours or would you prefer to add it to yours (if you have a revision planned)?
Steve
Quoted 5 lines · Steve Sakoman
Nice work! Overo uses TWL4030 gpio-0 for card detect (just like Beagle) and GPIO-54 for WP.
Would you like me to prepare a patch to add on top of yours or would you prefer to add it to yours (if you have a revision planned)?
Patch on top of this, please; I have no revision planned. Don't forget to set up the mmc_cd bitmask too!
How can WP work for a Micro-SD card though? I don't see a switch on any of mine...
- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · David Brownell
Quoted 5 lines · Steve Sakoman
Nice work! Overo uses TWL4030 gpio-0 for card detect (just like Beagle) and GPIO-54 for WP.
Would you like me to prepare a patch to add on top of yours or would you prefer to add it to yours (if you have a revision planned)?
Patch on top of this, please; I have no revision planned. Don't forget to set up the
mmc_cdbitmask too!
OK, will do.
Quoted 2 lines
How can WP work for a Micro-SD card though? I don't see a switch on any of mine...
Darn good question! I never have either. But from looking at the schematic there appears to be a pin for it on the microSD socket and Gordon has it connected to GPIO-54. I'll have to ask him about that . . .
Steve
Tony Lindgren
maintainerQuoted 14 lines · Steve Sakoman
Quoted 13 lines · David Brownell
From: David Brownell <[email protected]>
Rework card detect GPIO handling in the twl4030 MMC glue: drive it *only* from the
hsmmc_infopassed; remove most of remaining "we know we're always a twl4030 GPIO" logic.Add write-protect switch detection support to that glue. Stub in a not-present WP GPIO into most boards. (Beagle's is real.)
Teach the hsmmc driver how to use the card detect and writeprotect methods, and move some data structure init earlier so that when IRQs come in, more of the data used by their handlers is initialized.
Quoted 7 lines
Quoted 4 lines
Verified on Beagle (WP, card detect events) and Overo (boots, both card and wlan are seen). Beagle behaves fully, and is the model to follow for the common case where the TWL4030 gpio-0 card detect magic is used.
Nice work! Overo uses TWL4030 gpio-0 for card detect (just like Beagle) and GPIO-54 for WP.
Yeah, looks good! Pushing.
Tony