linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ARM: mx28evk: Simplify GPIO requests for mx28evk_fec_reset
@ 2011-11-09 20:36 Fabio Estevam
  2011-11-09 21:46 ` Wolfram Sang
  0 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2011-11-09 20:36 UTC (permalink / raw)
  To: linux-arm-kernel

From: Fabio Estevam <fabio.estevam@freescale.com>

Simplify GPIO requests inside mx28evk_fec_reset by using gpio_request_array.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:

- Make mx28evk_fec_gpios const
 arch/arm/mach-mxs/mach-mx28evk.c |   29 ++++++++---------------------
 1 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index ac2316d..c565c33 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -219,6 +219,11 @@ static const struct gpio_led_platform_data mx28evk_led_data __initconst = {
 	.num_leds = ARRAY_SIZE(mx28evk_leds),
 };
 
+static const struct gpio mx28evk_fec_gpios[] __initconst = {
+	{ MX28EVK_FEC_PHY_POWER, GPIOF_OUT_INIT_LOW, "fec-power" },
+	{ MX28EVK_FEC_PHY_RESET, GPIOF_OUT_INIT_LOW, "fec-enable" },
+};
+
 /* fec */
 static void __init mx28evk_fec_reset(void)
 {
@@ -231,28 +236,10 @@ static void __init mx28evk_fec_reset(void)
 		clk_enable(clk);
 
 	/* Power up fec phy */
-	ret = gpio_request(MX28EVK_FEC_PHY_POWER, "fec-phy-power");
-	if (ret) {
-		pr_err("Failed to request gpio fec-phy-%s: %d\n", "power", ret);
-		return;
-	}
-
-	ret = gpio_direction_output(MX28EVK_FEC_PHY_POWER, 0);
-	if (ret) {
-		pr_err("Failed to drive gpio fec-phy-%s: %d\n", "power", ret);
-		return;
-	}
-
-	/* Reset fec phy */
-	ret = gpio_request(MX28EVK_FEC_PHY_RESET, "fec-phy-reset");
-	if (ret) {
-		pr_err("Failed to request gpio fec-phy-%s: %d\n", "reset", ret);
-		return;
-	}
-
-	gpio_direction_output(MX28EVK_FEC_PHY_RESET, 0);
+	ret = gpio_request_array(mx28evk_fec_gpios,
+				ARRAY_SIZE(mx28evk_fec_gpios));
 	if (ret) {
-		pr_err("Failed to drive gpio fec-phy-%s: %d\n", "reset", ret);
+		pr_err("Failed to request FEC gpios: %d\n", ret);
 		return;
 	}
 
-- 
1.7.1

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

end of thread, other threads:[~2011-11-11 20:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-09 20:36 [PATCH v2] ARM: mx28evk: Simplify GPIO requests for mx28evk_fec_reset Fabio Estevam
2011-11-09 21:46 ` Wolfram Sang
2011-11-10  6:54   ` Uwe Kleine-König
2011-11-10  7:54   ` Sascha Hauer
2011-11-11 20:48     ` Fabio Estevam

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