linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Nikula <jhnikula@gmail.com>
To: linux-omap@vger.kernel.org
Cc: Tony Lindgren <tony@atomide.com>,
	Jarkko Nikula <jhnikula@gmail.com>,
	Kalle Valo <kalle.valo@iki.fi>
Subject: [PATCH] omap: rx51: Move peripheral OMAP gpio setups to rx51_omapgpio_setup function
Date: Fri, 14 May 2010 15:39:38 +0300	[thread overview]
Message-ID: <1273840778-4830-1-git-send-email-jhnikula@gmail.com> (raw)

Idea is to combine peripheral OMAP gpio setups in single function like what
rx51_twlgpio_setup is doing for TWL4030 GPIOs.

Currently this is mostly cleanup for wl1251 gpio setup as not testing the
gpiolib return values and setting the wl1251_pdata statically. The wl1251
driver seems to cope well with uninitialized gpios or with negative irq
number.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Cc: Kalle Valo <kalle.valo@iki.fi>
---
 arch/arm/mach-omap2/board-rx51-peripherals.c |   73 +++++++------------------
 1 files changed, 21 insertions(+), 52 deletions(-)

diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 8179d55..27d2767 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -47,7 +47,14 @@ enum {
 	RX51_SPI_WL1251,
 };
 
-static struct wl12xx_platform_data wl1251_pdata;
+static void rx51_wl1251_set_power(bool enable)
+{
+	gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
+}
+
+static struct wl12xx_platform_data wl1251_pdata = {
+	.set_power = rx51_wl1251_set_power,
+};
 
 static struct omap2_mcspi_device_config wl1251_mcspi_config = {
 	.turbo_mode	= 0,
@@ -454,6 +461,18 @@ static struct regulator_init_data rx51_vio = {
 	.consumer_supplies	= rx51_vio_supplies,
 };
 
+static void __init rx51_omapgpio_setup(void)
+{
+	int irq;
+
+	gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power");
+	gpio_direction_output(RX51_WL1251_POWER_GPIO, 0);
+	gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq");
+	gpio_direction_input(RX51_WL1251_IRQ_GPIO);
+	irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
+	rx51_peripherals_spi_board_info[RX51_SPI_WL1251].irq = irq;
+}
+
 static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
 {
 	/* FIXME this gpio setup is just a placeholder for now */
@@ -783,63 +802,13 @@ static inline void board_smc91x_init(void)
 
 #endif
 
-static void rx51_wl1251_set_power(bool enable)
-{
-	gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
-}
-
-static void __init rx51_init_wl1251(void)
-{
-	int irq, ret;
-
-	ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power");
-	if (ret < 0)
-		goto error;
-
-	ret = gpio_direction_output(RX51_WL1251_POWER_GPIO, 0);
-	if (ret < 0)
-		goto err_power;
-
-	ret = gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq");
-	if (ret < 0)
-		goto err_power;
-
-	ret = gpio_direction_input(RX51_WL1251_IRQ_GPIO);
-	if (ret < 0)
-		goto err_irq;
-
-	irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
-	if (irq < 0)
-		goto err_irq;
-
-	wl1251_pdata.set_power = rx51_wl1251_set_power;
-	rx51_peripherals_spi_board_info[RX51_SPI_WL1251].irq = irq;
-
-	return;
-
-err_irq:
-	gpio_free(RX51_WL1251_IRQ_GPIO);
-
-err_power:
-	gpio_free(RX51_WL1251_POWER_GPIO);
-
-error:
-	printk(KERN_ERR "wl1251 board initialisation failed\n");
-	wl1251_pdata.set_power = NULL;
-
-	/*
-	 * Now rx51_peripherals_spi_board_info[1].irq is zero and
-	 * set_power is null, and wl1251_probe() will fail.
-	 */
-}
-
 void __init rx51_peripherals_init(void)
 {
 	rx51_i2c_init();
 	board_onenand_init();
 	board_smc91x_init();
+	rx51_omapgpio_setup();
 	rx51_add_gpio_keys();
-	rx51_init_wl1251();
 	spi_register_board_info(rx51_peripherals_spi_board_info,
 				ARRAY_SIZE(rx51_peripherals_spi_board_info));
 	omap2_hsmmc_init(mmc);
-- 
1.7.1


             reply	other threads:[~2010-05-14 12:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-14 12:39 Jarkko Nikula [this message]
2010-05-14 15:33 ` [PATCH] omap: rx51: Move peripheral OMAP gpio setups to rx51_omapgpio_setup function Tony Lindgren
2010-05-14 18:04   ` Jarkko Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1273840778-4830-1-git-send-email-jhnikula@gmail.com \
    --to=jhnikula@gmail.com \
    --cc=kalle.valo@iki.fi \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).