Skip to contentSkip to conversation

OMAP: HSMMC: Fix GPIO muxing

PATCH New Silesh C V 3 participants 4 messages Jun 28, 2011 – Jun 29, 2011

Subsystems (3)
lore
Share & tools
lore

Silesh C V

author
#0 lore raw

PATCH 1/1 OMAP: HSMMC: Fix GPIO muxing

Use generic gpio call to check the validity of the gpio. Note that this includes gpio 0 also which was missing before.

---
 arch/arm/mach-omap2/hsmmc.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/hsmmc.c +3 -4
index 66868c5..a9b45c7 100644
@@ -13,6 +13,7 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/delay.h>
+#include <linux/gpio.h>
 #include <mach/hardware.h>
 #include <plat/mmc.h>
 #include <plat/omap-pm.h>
@@ -213,12 +214,10 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
 static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
 			int controller_nr)
 {
-	if ((mmc_controller->slots[0].switch_pin > 0) && \
-		(mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
+	if (gpio_is_valid(mmc_controller->slots[0].switch_pin))
 		omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
 					OMAP_PIN_INPUT_PULLUP);
-	if ((mmc_controller->slots[0].gpio_wp > 0) && \
-		(mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
+	if (gpio_is_valid(mmc_controller->slots[0].gpio_wp))
 		omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
 					OMAP_PIN_INPUT_PULLUP);
 	if (cpu_is_omap34xx()) {
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 OMAP: HSMMC: Fix GPIO muxing

Quoted 36 lines · Silesh C V

Use generic gpio call to check the validity of the gpio. Note that this includes gpio 0 also which was missing before.

---
?arch/arm/mach-omap2/hsmmc.c | ? ?7 +++----
?1 files changed, 3 insertions(+), 4 deletions(-)

arch/arm/mach-omap2/hsmmc.c +0 -0
index 66868c5..a9b45c7 100644
@@ -13,6 +13,7 @@

?#include <linux/slab.h>
?#include <linux/string.h>
?#include <linux/delay.h>
+#include <linux/gpio.h>
?#include <mach/hardware.h>
?#include <plat/mmc.h>
?#include <plat/omap-pm.h>

arch/arm/mach-omap2/hsmmc.c +2 -5
@@ -213,12 +214,10 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
 ?static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
 ? ? ? ? ? ? ? ? ? ? ? ?int controller_nr)
 ?{
- ? ? ? if ((mmc_controller->slots[0].switch_pin > 0) && \
- ? ? ? ? ? ? ? (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
+ ? ? ? if (gpio_is_valid(mmc_controller->slots[0].switch_pin))
 ? ? ? ? ? ? ? ?omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?OMAP_PIN_INPUT_PULLUP);
- ? ? ? if ((mmc_controller->slots[0].gpio_wp > 0) && \
- ? ? ? ? ? ? ? (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
+ ? ? ? if (gpio_is_valid(mmc_controller->slots[0].gpio_wp))
 ? ? ? ? ? ? ? ?omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?OMAP_PIN_INPUT_PULLUP);
 ? ? ? ?if (cpu_is_omap34xx()) {
--
Quoted 2 lines

1.7.1

Looks good to me.

#2 lore raw

PATCH 1/1 OMAP: HSMMC: Fix GPIO muxing

In reply to Silesh C V

Hi Silesh,

Quoted 25 lines · Silesh C V

Use generic gpio call to check the validity of the gpio. Note that this includes gpio 0 also which was missing before.

---
 arch/arm/mach-omap2/hsmmc.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/hsmmc.c +1 -1
index 66868c5..a9b45c7 100644
@@ -13,6 +13,7 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/delay.h>
+#include <linux/gpio.h>
 #include <mach/hardware.h>
 #include <plat/mmc.h>
 #include <plat/omap-pm.h>
@@ -213,12 +214,10 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
 static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
 			int controller_nr)
 {
-	if ((mmc_controller->slots[0].switch_pin > 0) && \

arch/arm/mach-omap2/hsmmc.c static int nop_mmc_set_power(struct device *dev, int slot, int power_on, · line 223

Quoted 10 lines
arch/arm/mach-omap2/hsmmc.c +2 -3
-		(mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
+	if (gpio_is_valid(mmc_controller->slots[0].switch_pin))
 		omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
 					OMAP_PIN_INPUT_PULLUP);
-	if ((mmc_controller->slots[0].gpio_wp > 0) && \
-		(mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
+	if (gpio_is_valid(mmc_controller->slots[0].gpio_wp))
 		omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
 					OMAP_PIN_INPUT_PULLUP);
 	if (cpu_is_omap34xx()) {

IMHO, you should not separate the patches
(this one and OMAP: 4430SDP: Register the card detect GPIO properly), because the 4430sdp fix should come before or together with this patch, otherwise 4430sdp will be broken, once this patch is applied.

You can either make it a one patch or make it a single properly numbered series.

Signature · 2 lines
Regards,
Igor.
author
#3 lore raw

PATCH 1/1 OMAP: HSMMC: Fix GPIO muxing

Hi Igor,

Quoted 7 lines · Igor Grinberg

Hi Silesh,

IMHO, you should not separate the patches
(this one and OMAP: 4430SDP: Register the card detect GPIO properly), because the 4430sdp fix should come before or together with this patch, otherwise 4430sdp will be broken, once this patch is applied.

4430SDP is already broken because it requests/configures GPIO 0. But as you said if this patch goes before the SDP fix, the driver will do Muxing of the pad (as this pad fixes that for GPIO 0)also. Thanks for the suggestion.

Quoted 3 lines

You can either make it a one patch or make it a single properly numbered series.

I will send it as a series.

Regards,
Silesh