aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@web.de>2009-01-16 16:34:15 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 16:00:44 -0500
commita2116993c172bbb0c62f83d25cc3fe5dc7fece0d (patch)
treee2396f6c4fc6e064e4bfc45f14c4a37340d61187
parentc88a768d7ed1bc38eedf18d16419ef2f01cd2d0d (diff)
p54spi: remove arch specific dependencies
On Friday 16 January 2009 20:33:43 Kalle Valo wrote: > N800 and N810 support is not on mainline yet, for stlc45xx I decided > to add module parameters for the gpio numbers. Here's the commit from > stlc45xx repo: > > http://gitorious.org/projects/stlc45xx/repos/mainline/commits/35afc5df0027d02d49e6f5bf986dcc4deb4ee6cf This is the same patch for p54spi. It removes all N800/N810 specific code from p54spi, so the driver can be used on other architectures, or configurations as well. Signed-off-by: Christian Lamparter <chunkeey@web.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/p54/p54spi.c45
-rw-r--r--drivers/net/wireless/p54/p54spi.h2
2 files changed, 28 insertions, 19 deletions
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index b8dede741ef6..7fde243b3d5d 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -39,6 +39,20 @@
39MODULE_FIRMWARE("3826.arm"); 39MODULE_FIRMWARE("3826.arm");
40MODULE_ALIAS("stlc45xx"); 40MODULE_ALIAS("stlc45xx");
41 41
42/*
43 * gpios should be handled in board files and provided via platform data,
44 * but because it's currently impossible for p54spi to have a header file
45 * in include/linux, let's use module paramaters for now
46 */
47
48static int p54spi_gpio_power = 97;
49module_param(p54spi_gpio_power, int, 0444);
50MODULE_PARM_DESC(p54spi_gpio_power, "gpio number for power line");
51
52static int p54spi_gpio_irq = 87;
53module_param(p54spi_gpio_irq, int, 0444);
54MODULE_PARM_DESC(p54spi_gpio_irq, "gpio number for irq line");
55
42static void p54spi_spi_read(struct p54s_priv *priv, u8 address, 56static void p54spi_spi_read(struct p54s_priv *priv, u8 address,
43 void *buf, size_t len) 57 void *buf, size_t len)
44{ 58{
@@ -283,14 +297,14 @@ static int p54spi_upload_firmware(struct ieee80211_hw *dev)
283 297
284static void p54spi_power_off(struct p54s_priv *priv) 298static void p54spi_power_off(struct p54s_priv *priv)
285{ 299{
286 disable_irq(gpio_to_irq(priv->config->irq_gpio)); 300 disable_irq(gpio_to_irq(p54spi_gpio_irq));
287 gpio_set_value(priv->config->power_gpio, 0); 301 gpio_set_value(p54spi_gpio_power, 0);
288} 302}
289 303
290static void p54spi_power_on(struct p54s_priv *priv) 304static void p54spi_power_on(struct p54s_priv *priv)
291{ 305{
292 gpio_set_value(priv->config->power_gpio, 1); 306 gpio_set_value(p54spi_gpio_power, 1);
293 enable_irq(gpio_to_irq(priv->config->irq_gpio)); 307 enable_irq(gpio_to_irq(p54spi_gpio_irq));
294 308
295 /* 309 /*
296 * need to wait a while before device can be accessed, the lenght 310 * need to wait a while before device can be accessed, the lenght
@@ -626,9 +640,6 @@ static int __devinit p54spi_probe(struct spi_device *spi)
626 dev_set_drvdata(&spi->dev, priv); 640 dev_set_drvdata(&spi->dev, priv);
627 priv->spi = spi; 641 priv->spi = spi;
628 642
629 priv->config = omap_get_config(OMAP_TAG_WLAN_CX3110X,
630 struct omap_wlan_cx3110x_config);
631
632 spi->bits_per_word = 16; 643 spi->bits_per_word = 16;
633 spi->max_speed_hz = 24000000; 644 spi->max_speed_hz = 24000000;
634 645
@@ -638,22 +649,22 @@ static int __devinit p54spi_probe(struct spi_device *spi)
638 goto err_free_common; 649 goto err_free_common;
639 } 650 }
640 651
641 ret = gpio_request(priv->config->power_gpio, "p54spi power"); 652 ret = gpio_request(p54spi_gpio_power, "p54spi power");
642 if (ret < 0) { 653 if (ret < 0) {
643 dev_err(&priv->spi->dev, "power GPIO request failed: %d", ret); 654 dev_err(&priv->spi->dev, "power GPIO request failed: %d", ret);
644 goto err_free_common; 655 goto err_free_common;
645 } 656 }
646 657
647 ret = gpio_request(priv->config->irq_gpio, "p54spi irq"); 658 ret = gpio_request(p54spi_gpio_irq, "p54spi irq");
648 if (ret < 0) { 659 if (ret < 0) {
649 dev_err(&priv->spi->dev, "irq GPIO request failed: %d", ret); 660 dev_err(&priv->spi->dev, "irq GPIO request failed: %d", ret);
650 goto err_free_common; 661 goto err_free_common;
651 } 662 }
652 663
653 gpio_direction_output(priv->config->power_gpio, 0); 664 gpio_direction_output(p54spi_gpio_power, 0);
654 gpio_direction_input(priv->config->irq_gpio); 665 gpio_direction_input(p54spi_gpio_irq);
655 666
656 ret = request_irq(OMAP_GPIO_IRQ(priv->config->irq_gpio), 667 ret = request_irq(gpio_to_irq(p54spi_gpio_irq),
657 p54spi_interrupt, IRQF_DISABLED, "p54spi", 668 p54spi_interrupt, IRQF_DISABLED, "p54spi",
658 priv->spi); 669 priv->spi);
659 if (ret < 0) { 670 if (ret < 0) {
@@ -661,10 +672,10 @@ static int __devinit p54spi_probe(struct spi_device *spi)
661 goto err_free_common; 672 goto err_free_common;
662 } 673 }
663 674
664 set_irq_type(gpio_to_irq(priv->config->irq_gpio), 675 set_irq_type(gpio_to_irq(p54spi_gpio_irq),
665 IRQ_TYPE_EDGE_RISING); 676 IRQ_TYPE_EDGE_RISING);
666 677
667 disable_irq(gpio_to_irq(priv->config->irq_gpio)); 678 disable_irq(gpio_to_irq(p54spi_gpio_irq));
668 679
669 INIT_WORK(&priv->work, p54spi_work); 680 INIT_WORK(&priv->work, p54spi_work);
670 init_completion(&priv->fw_comp); 681 init_completion(&priv->fw_comp);
@@ -705,10 +716,10 @@ static int __devexit p54spi_remove(struct spi_device *spi)
705 716
706 ieee80211_unregister_hw(priv->hw); 717 ieee80211_unregister_hw(priv->hw);
707 718
708 free_irq(gpio_to_irq(priv->config->irq_gpio), spi); 719 free_irq(gpio_to_irq(p54spi_gpio_irq), spi);
709 720
710 gpio_free(priv->config->power_gpio); 721 gpio_free(p54spi_gpio_power);
711 gpio_free(priv->config->irq_gpio); 722 gpio_free(p54spi_gpio_irq);
712 release_firmware(priv->firmware); 723 release_firmware(priv->firmware);
713 724
714 mutex_destroy(&priv->mutex); 725 mutex_destroy(&priv->mutex);
diff --git a/drivers/net/wireless/p54/p54spi.h b/drivers/net/wireless/p54/p54spi.h
index 5013ebc8712e..7fbe8d8fc67c 100644
--- a/drivers/net/wireless/p54/p54spi.h
+++ b/drivers/net/wireless/p54/p54spi.h
@@ -25,7 +25,6 @@
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/list.h> 26#include <linux/list.h>
27#include <net/mac80211.h> 27#include <net/mac80211.h>
28#include <mach/board.h>
29 28
30#include "p54.h" 29#include "p54.h"
31 30
@@ -108,7 +107,6 @@ struct p54s_priv {
108 struct p54_common common; 107 struct p54_common common;
109 struct ieee80211_hw *hw; 108 struct ieee80211_hw *hw;
110 struct spi_device *spi; 109 struct spi_device *spi;
111 const struct omap_wlan_cx3110x_config *config;
112 110
113 struct work_struct work; 111 struct work_struct work;
114 112