Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193653
b: refs/heads/master
c: 2d5e82b
h: refs/heads/master
i:
  193651: fded3cf
v: v3
  • Loading branch information
Teemu Paasikivi authored and John W. Linville committed Mar 9, 2010
1 parent 13522a8 commit 0eaf8b0
Show file tree
Hide file tree
Showing 4 changed files with 194 additions and 187 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d57b87fde86a641da7782b99bec0a3130ed32f4a
refs/heads/master: 2d5e82b8bcda58ec1e2fae5277a81e5fd067e627
8 changes: 8 additions & 0 deletions trunk/drivers/net/wireless/wl12xx/wl1271_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,12 @@ static inline void wl1271_raw_write32(struct wl1271 *wl, int addr, u32 val)
wl1271_raw_write(wl, addr, &wl->buffer_32,
sizeof(wl->buffer_32), false);
}

/* Functions from wl1271_main.c */

int wl1271_register_hw(struct wl1271 *wl);
int wl1271_init_ieee80211(struct wl1271 *wl);
struct ieee80211_hw *wl1271_alloc_hw(void);
int wl1271_free_hw(struct wl1271 *wl);

#endif
191 changes: 5 additions & 186 deletions trunk/drivers/net/wireless/wl12xx/wl1271_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@
*/

#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/firmware.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <linux/spi/spi.h>
#include <linux/crc32.h>
#include <linux/etherdevice.h>
#include <linux/vmalloc.h>
#include <linux/spi/wl12xx.h>
#include <linux/inetdevice.h>

#include "wl1271.h"
Expand Down Expand Up @@ -484,28 +480,6 @@ static void wl1271_irq_work(struct work_struct *work)
mutex_unlock(&wl->mutex);
}

static irqreturn_t wl1271_irq(int irq, void *cookie)
{
struct wl1271 *wl;
unsigned long flags;

wl1271_debug(DEBUG_IRQ, "IRQ");

wl = cookie;

/* complete the ELP completion */
spin_lock_irqsave(&wl->wl_lock, flags);
if (wl->elp_compl) {
complete(wl->elp_compl);
wl->elp_compl = NULL;
}

ieee80211_queue_work(wl->hw, &wl->irq_work);
spin_unlock_irqrestore(&wl->wl_lock, flags);

return IRQ_HANDLED;
}

static int wl1271_fetch_firmware(struct wl1271 *wl)
{
const struct firmware *fw;
Expand Down Expand Up @@ -1959,7 +1933,7 @@ static const struct ieee80211_ops wl1271_ops = {
CFG80211_TESTMODE_CMD(wl1271_tm_cmd)
};

static int wl1271_register_hw(struct wl1271 *wl)
int wl1271_register_hw(struct wl1271 *wl)
{
int ret;

Expand All @@ -1981,7 +1955,7 @@ static int wl1271_register_hw(struct wl1271 *wl)
return 0;
}

static int wl1271_init_ieee80211(struct wl1271 *wl)
int wl1271_init_ieee80211(struct wl1271 *wl)
{
/* The tx descriptor buffer and the TKIP space. */
wl->hw->extra_tx_headroom = WL1271_TKIP_IV_SPACE +
Expand Down Expand Up @@ -2009,24 +1983,9 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)
return 0;
}

static void wl1271_device_release(struct device *dev)
{

}

static struct platform_device wl1271_device = {
.name = "wl1271",
.id = -1,

/* device model insists to have a release function */
.dev = {
.release = wl1271_device_release,
},
};

#define WL1271_DEFAULT_CHANNEL 0

static struct ieee80211_hw *wl1271_alloc_hw(void)
struct ieee80211_hw *wl1271_alloc_hw(void)
{
struct ieee80211_hw *hw;
struct wl1271 *wl;
Expand Down Expand Up @@ -2073,6 +2032,8 @@ static struct ieee80211_hw *wl1271_alloc_hw(void)
/* Apply default driver configuration. */
wl1271_conf_init(wl);

wl1271_debugfs_init(wl);

return hw;
}

Expand All @@ -2095,145 +2056,3 @@ int wl1271_free_hw(struct wl1271 *wl)

return 0;
}

static int __devinit wl1271_probe(struct spi_device *spi)
{
struct wl12xx_platform_data *pdata;
struct ieee80211_hw *hw;
struct wl1271 *wl;
int ret;

pdata = spi->dev.platform_data;
if (!pdata) {
wl1271_error("no platform data");
return -ENODEV;
}

hw = wl1271_alloc_hw();
if (IS_ERR(hw))
return PTR_ERR(hw);

wl = hw->priv;

dev_set_drvdata(&spi->dev, wl);
wl->spi = spi;

/* This is the only SPI value that we need to set here, the rest
* comes from the board-peripherals file */
spi->bits_per_word = 32;

ret = spi_setup(spi);
if (ret < 0) {
wl1271_error("spi_setup failed");
goto out_free;
}

wl->set_power = pdata->set_power;
if (!wl->set_power) {
wl1271_error("set power function missing in platform data");
ret = -ENODEV;
goto out_free;
}

wl->irq = spi->irq;
if (wl->irq < 0) {
wl1271_error("irq missing in platform data");
ret = -ENODEV;
goto out_free;
}

ret = request_irq(wl->irq, wl1271_irq, 0, DRIVER_NAME, wl);
if (ret < 0) {
wl1271_error("request_irq() failed: %d", ret);
goto out_free;
}

set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING);

disable_irq(wl->irq);

ret = platform_device_register(&wl1271_device);
if (ret) {
wl1271_error("couldn't register platform device");
goto out_irq;
}
dev_set_drvdata(&wl1271_device.dev, wl);

ret = wl1271_init_ieee80211(wl);
if (ret)
goto out_platform;

ret = wl1271_register_hw(wl);
if (ret)
goto out_platform;

wl1271_debugfs_init(wl);

wl1271_notice("initialized");

return 0;

out_platform:
platform_device_unregister(&wl1271_device);

out_irq:
free_irq(wl->irq, wl);

out_free:
ieee80211_free_hw(hw);

return ret;
}

static int __devexit wl1271_remove(struct spi_device *spi)
{
struct wl1271 *wl = dev_get_drvdata(&spi->dev);

platform_device_unregister(&wl1271_device);
free_irq(wl->irq, wl);

wl1271_free_hw(wl);

return 0;
}


static struct spi_driver wl1271_spi_driver = {
.driver = {
.name = "wl1271",
.bus = &spi_bus_type,
.owner = THIS_MODULE,
},

.probe = wl1271_probe,
.remove = __devexit_p(wl1271_remove),
};

static int __init wl1271_init(void)
{
int ret;

ret = spi_register_driver(&wl1271_spi_driver);
if (ret < 0) {
wl1271_error("failed to register spi driver: %d", ret);
goto out;
}

out:
return ret;
}

static void __exit wl1271_exit(void)
{
spi_unregister_driver(&wl1271_spi_driver);

wl1271_notice("unloaded");
}

module_init(wl1271_init);
module_exit(wl1271_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Luciano Coelho <luciano.coelho@nokia.com>");
MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
MODULE_FIRMWARE(WL1271_FW_NAME);
Loading

0 comments on commit 0eaf8b0

Please sign in to comment.