linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: mx5/mx51_babbage: Move GPIO initialization for USB PHY Reset line to commom place
@ 2011-04-28  0:44 Fabio Estevam
  2011-04-28  0:44 ` [PATCH 2/2] ARM: mx5/mx51_babbage: Use gpio_request_one when possible Fabio Estevam
  2011-04-28  7:51 ` [PATCH 1/2] ARM: mx5/mx51_babbage: Move GPIO initialization for USB PHY Reset line to commom place Uwe Kleine-König
  0 siblings, 2 replies; 5+ messages in thread
From: Fabio Estevam @ 2011-04-28  0:44 UTC (permalink / raw)
  To: linux-arm-kernel

The USB PHY Reset GPIO can be configured in the same place as the other GPIOs.

While at it rename the pin as BABBAGE_USB_PHY_RESET to make clearer its purpose.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/mach-mx5/board-mx51_babbage.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index c7b3fab..7b919bc 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -36,7 +36,7 @@
 
 #define BABBAGE_USB_HUB_RESET	IMX_GPIO_NR(1, 7)
 #define BABBAGE_USBH1_STP	IMX_GPIO_NR(1, 27)
-#define BABBAGE_PHY_RESET	IMX_GPIO_NR(2, 5)
+#define BABBAGE_USB_PHY_RESET	IMX_GPIO_NR(2, 5)
 #define BABBAGE_FEC_PHY_RESET	IMX_GPIO_NR(2, 14)
 #define BABBAGE_POWER_KEY	IMX_GPIO_NR(2, 21)
 #define BABBAGE_ECSPI1_CS0	IMX_GPIO_NR(4, 24)
@@ -110,6 +110,9 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {
 	/* USB HUB reset line*/
 	MX51_PAD_GPIO1_7__GPIO1_7,
 
+	/* USB PHY reset line */
+	MX51_PAD_EIM_D21__GPIO2_5,
+
 	/* FEC */
 	MX51_PAD_EIM_EB2__FEC_MDIO,
 	MX51_PAD_EIM_EB3__FEC_RDATA1,
@@ -172,7 +175,6 @@ static struct imxi2c_platform_data babbage_hsi2c_data = {
 static int gpio_usbh1_active(void)
 {
 	iomux_v3_cfg_t usbh1stp_gpio = MX51_PAD_USBH1_STP__GPIO1_27;
-	iomux_v3_cfg_t phyreset_gpio = MX51_PAD_EIM_D21__GPIO2_5;
 	int ret;
 
 	/* Set USBH1_STP to GPIO and toggle it */
@@ -189,14 +191,13 @@ static int gpio_usbh1_active(void)
 	gpio_free(BABBAGE_USBH1_STP);
 
 	/* De-assert USB PHY RESETB */
-	mxc_iomux_v3_setup_pad(phyreset_gpio);
-	ret = gpio_request(BABBAGE_PHY_RESET, "phy_reset");
+	ret = gpio_request(BABBAGE_USB_PHY_RESET, "phy_reset");
 
 	if (ret) {
 		pr_debug("failed to get MX51_PAD_EIM_D21__GPIO_2_5: %d\n", ret);
 		return ret;
 	}
-	gpio_direction_output(BABBAGE_PHY_RESET, 1);
+	gpio_direction_output(BABBAGE_USB_PHY_RESET, 1);
 	return 0;
 }
 
-- 
1.6.0.4

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

* [PATCH 2/2] ARM: mx5/mx51_babbage: Use gpio_request_one when possible
  2011-04-28  0:44 [PATCH 1/2] ARM: mx5/mx51_babbage: Move GPIO initialization for USB PHY Reset line to commom place Fabio Estevam
@ 2011-04-28  0:44 ` Fabio Estevam
  2011-04-28  7:55   ` Uwe Kleine-König
  2011-04-28  7:51 ` [PATCH 1/2] ARM: mx5/mx51_babbage: Move GPIO initialization for USB PHY Reset line to commom place Uwe Kleine-König
  1 sibling, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2011-04-28  0:44 UTC (permalink / raw)
  To: linux-arm-kernel

Instead of using gpio_request followed by gpio_direction_output use gpio_request_one.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/mach-mx5/board-mx51_babbage.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index 7b919bc..00203fb 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -179,25 +179,25 @@ static int gpio_usbh1_active(void)
 
 	/* Set USBH1_STP to GPIO and toggle it */
 	mxc_iomux_v3_setup_pad(usbh1stp_gpio);
-	ret = gpio_request(BABBAGE_USBH1_STP, "usbh1_stp");
+	ret = gpio_request_one(BABBAGE_USBH1_STP,
+					GPIOF_OUT_INIT_LOW, "usbh1_stp");
 
 	if (ret) {
 		pr_debug("failed to get MX51_PAD_USBH1_STP__GPIO_1_27: %d\n", ret);
 		return ret;
 	}
-	gpio_direction_output(BABBAGE_USBH1_STP, 0);
 	gpio_set_value(BABBAGE_USBH1_STP, 1);
 	msleep(100);
 	gpio_free(BABBAGE_USBH1_STP);
 
 	/* De-assert USB PHY RESETB */
-	ret = gpio_request(BABBAGE_USB_PHY_RESET, "phy_reset");
+	ret = gpio_request_one(BABBAGE_USB_PHY_RESET,
+					GPIOF_OUT_INIT_HIGH, "phy_reset");
 
 	if (ret) {
 		pr_debug("failed to get MX51_PAD_EIM_D21__GPIO_2_5: %d\n", ret);
 		return ret;
 	}
-	gpio_direction_output(BABBAGE_USB_PHY_RESET, 1);
 	return 0;
 }
 
-- 
1.6.0.4

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

* [PATCH 1/2] ARM: mx5/mx51_babbage: Move GPIO initialization for USB PHY Reset line to commom place
  2011-04-28  0:44 [PATCH 1/2] ARM: mx5/mx51_babbage: Move GPIO initialization for USB PHY Reset line to commom place Fabio Estevam
  2011-04-28  0:44 ` [PATCH 2/2] ARM: mx5/mx51_babbage: Use gpio_request_one when possible Fabio Estevam
@ 2011-04-28  7:51 ` Uwe Kleine-König
  1 sibling, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2011-04-28  7:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Fabio,

On Wed, Apr 27, 2011 at 09:44:31PM -0300, Fabio Estevam wrote:
> The USB PHY Reset GPIO can be configured in the same place as the other GPIOs.
> 
> While at it rename the pin as BABBAGE_USB_PHY_RESET to make clearer its purpose.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  arch/arm/mach-mx5/board-mx51_babbage.c |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
> index c7b3fab..7b919bc 100644
> --- a/arch/arm/mach-mx5/board-mx51_babbage.c
> +++ b/arch/arm/mach-mx5/board-mx51_babbage.c
> @@ -36,7 +36,7 @@
>  
>  #define BABBAGE_USB_HUB_RESET	IMX_GPIO_NR(1, 7)
>  #define BABBAGE_USBH1_STP	IMX_GPIO_NR(1, 27)
> -#define BABBAGE_PHY_RESET	IMX_GPIO_NR(2, 5)
> +#define BABBAGE_USB_PHY_RESET	IMX_GPIO_NR(2, 5)
>  #define BABBAGE_FEC_PHY_RESET	IMX_GPIO_NR(2, 14)
>  #define BABBAGE_POWER_KEY	IMX_GPIO_NR(2, 21)
>  #define BABBAGE_ECSPI1_CS0	IMX_GPIO_NR(4, 24)
> @@ -110,6 +110,9 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {
>  	/* USB HUB reset line*/
>  	MX51_PAD_GPIO1_7__GPIO1_7,
>  
> +	/* USB PHY reset line */
> +	MX51_PAD_EIM_D21__GPIO2_5,
> +
>  	/* FEC */
>  	MX51_PAD_EIM_EB2__FEC_MDIO,
>  	MX51_PAD_EIM_EB3__FEC_RDATA1,
> @@ -172,7 +175,6 @@ static struct imxi2c_platform_data babbage_hsi2c_data = {
>  static int gpio_usbh1_active(void)
>  {
>  	iomux_v3_cfg_t usbh1stp_gpio = MX51_PAD_USBH1_STP__GPIO1_27;
> -	iomux_v3_cfg_t phyreset_gpio = MX51_PAD_EIM_D21__GPIO2_5;
>  	int ret;
>  
>  	/* Set USBH1_STP to GPIO and toggle it */
> @@ -189,14 +191,13 @@ static int gpio_usbh1_active(void)
>  	gpio_free(BABBAGE_USBH1_STP);
>  
>  	/* De-assert USB PHY RESETB */
> -	mxc_iomux_v3_setup_pad(phyreset_gpio);
> -	ret = gpio_request(BABBAGE_PHY_RESET, "phy_reset");
> +	ret = gpio_request(BABBAGE_USB_PHY_RESET, "phy_reset");
>  
>  	if (ret) {
>  		pr_debug("failed to get MX51_PAD_EIM_D21__GPIO_2_5: %d\n", ret);
>  		return ret;
>  	}
> -	gpio_direction_output(BABBAGE_PHY_RESET, 1);
> +	gpio_direction_output(BABBAGE_USB_PHY_RESET, 1);
>  	return 0;
>  }
this looks like a candidate for gpio_request_one, doesn't it?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* [PATCH 2/2] ARM: mx5/mx51_babbage: Use gpio_request_one when possible
  2011-04-28  0:44 ` [PATCH 2/2] ARM: mx5/mx51_babbage: Use gpio_request_one when possible Fabio Estevam
@ 2011-04-28  7:55   ` Uwe Kleine-König
  2011-04-28 16:03     ` Fabio Estevam
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2011-04-28  7:55 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

ah, this patch makes my review comment to your patch 1 nil.

On Wed, Apr 27, 2011 at 09:44:32PM -0300, Fabio Estevam wrote:
> Instead of using gpio_request followed by gpio_direction_output use gpio_request_one.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  arch/arm/mach-mx5/board-mx51_babbage.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
> index 7b919bc..00203fb 100644
> --- a/arch/arm/mach-mx5/board-mx51_babbage.c
> +++ b/arch/arm/mach-mx5/board-mx51_babbage.c
> @@ -179,25 +179,25 @@ static int gpio_usbh1_active(void)
>  
>  	/* Set USBH1_STP to GPIO and toggle it */
>  	mxc_iomux_v3_setup_pad(usbh1stp_gpio);
This cannot go into the global list of pins to mux?

> -	ret = gpio_request(BABBAGE_USBH1_STP, "usbh1_stp");
> +	ret = gpio_request_one(BABBAGE_USBH1_STP,
> +					GPIOF_OUT_INIT_LOW, "usbh1_stp");
>  
>  	if (ret) {
>  		pr_debug("failed to get MX51_PAD_USBH1_STP__GPIO_1_27: %d\n", ret);
>  		return ret;
>  	}
> -	gpio_direction_output(BABBAGE_USBH1_STP, 0);
>  	gpio_set_value(BABBAGE_USBH1_STP, 1);
>  	msleep(100);
Why is the sleep between set_value(1) and free? I would have expected it
between request_one(INIT_LOW) and set_value(1)?

>  	gpio_free(BABBAGE_USBH1_STP);
>  
>  	/* De-assert USB PHY RESETB */
> -	ret = gpio_request(BABBAGE_USB_PHY_RESET, "phy_reset");
> +	ret = gpio_request_one(BABBAGE_USB_PHY_RESET,
> +					GPIOF_OUT_INIT_HIGH, "phy_reset");
>  
>  	if (ret) {
>  		pr_debug("failed to get MX51_PAD_EIM_D21__GPIO_2_5: %d\n", ret);
>  		return ret;
>  	}
> -	gpio_direction_output(BABBAGE_USB_PHY_RESET, 1);
>  	return 0;
>  }
>  
> -- 
> 1.6.0.4
> 
> 

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* [PATCH 2/2] ARM: mx5/mx51_babbage: Use gpio_request_one when possible
  2011-04-28  7:55   ` Uwe Kleine-König
@ 2011-04-28 16:03     ` Fabio Estevam
  0 siblings, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2011-04-28 16:03 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Uwe,

On 4/28/2011 4:55 AM, Uwe Kleine-K?nig wrote:
...
  
>>  	/* Set USBH1_STP to GPIO and toggle it */
>>  	mxc_iomux_v3_setup_pad(usbh1stp_gpio);
> This cannot go into the global list of pins to mux?

This pin alternates its mode(GPIO and USB STP), so I think we can leave it defined here.
> 
>> -	ret = gpio_request(BABBAGE_USBH1_STP, "usbh1_stp");
>> +	ret = gpio_request_one(BABBAGE_USBH1_STP,
>> +					GPIOF_OUT_INIT_LOW, "usbh1_stp");
>>  
>>  	if (ret) {
>>  		pr_debug("failed to get MX51_PAD_USBH1_STP__GPIO_1_27: %d\n", ret);
>>  		return ret;
>>  	}
>> -	gpio_direction_output(BABBAGE_USBH1_STP, 0);
>>  	gpio_set_value(BABBAGE_USBH1_STP, 1);
>>  	msleep(100);
> Why is the sleep between set_value(1) and free? I would have expected it
> between request_one(INIT_LOW) and set_value(1)?

Agreed. I haven?t changed the logic on this patch. Will send a third patch for fixing this.

Thanks,

Fabio Estevam

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

end of thread, other threads:[~2011-04-28 16:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-28  0:44 [PATCH 1/2] ARM: mx5/mx51_babbage: Move GPIO initialization for USB PHY Reset line to commom place Fabio Estevam
2011-04-28  0:44 ` [PATCH 2/2] ARM: mx5/mx51_babbage: Use gpio_request_one when possible Fabio Estevam
2011-04-28  7:55   ` Uwe Kleine-König
2011-04-28 16:03     ` Fabio Estevam
2011-04-28  7:51 ` [PATCH 1/2] ARM: mx5/mx51_babbage: Move GPIO initialization for USB PHY Reset line to commom place Uwe Kleine-König

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