Release 4.11 drivers/net/wireless/intersil/orinoco/airport.c
/* airport.c
*
* A driver for "Hermes" chipset based Apple Airport wireless
* card.
*
* Copyright notice & release notes in file main.c
*
* Note specific to airport stub:
*
* 0.05 : first version of the new split driver
* 0.06 : fix possible hang on powerup, add sleep support
*/
#define DRIVER_NAME "airport"
#define PFX DRIVER_NAME ": "
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/pmac_feature.h>
#include "orinoco.h"
#define AIRPORT_IO_LEN (0x1000)
/* one page */
struct airport {
struct macio_dev *mdev;
void __iomem *vaddr;
unsigned int irq;
int irq_requested;
int ndev_registered;
};
static int
airport_suspend(struct macio_dev *mdev, pm_message_t state)
{
struct orinoco_private *priv = dev_get_drvdata(&mdev->ofdev.dev);
struct net_device *dev = priv->ndev;
struct airport *card = priv->card;
unsigned long flags;
int err;
printk(KERN_DEBUG "%s: Airport entering sleep mode\n", dev->name);
err = orinoco_lock(priv, &flags);
if (err) {
printk(KERN_ERR "%s: hw_unavailable on PBOOK_SLEEP_NOW\n",
dev->name);
return 0;
}
orinoco_down(priv);
orinoco_unlock(priv, &flags);
disable_irq(card->irq);
pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
macio_get_of_node(mdev), 0, 0);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David Gibson | 51 | 39.23% | 2 | 22.22% |
Linus Torvalds | 35 | 26.92% | 1 | 11.11% |
Benjamin Herrenschmidt | 20 | 15.38% | 1 | 11.11% |
David Kilroy | 19 | 14.62% | 3 | 33.33% |
Jeff Garzik | 4 | 3.08% | 1 | 11.11% |
Pavel Machek | 1 | 0.77% | 1 | 11.11% |
Total | 130 | 100.00% | 9 | 100.00% |
static int
airport_resume(struct macio_dev *mdev)
{
struct orinoco_private *priv = dev_get_drvdata(&mdev->ofdev.dev);
struct net_device *dev = priv->ndev;
struct airport *card = priv->card;
unsigned long flags;
int err;
printk(KERN_DEBUG "%s: Airport waking up\n", dev->name);
pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
macio_get_of_node(mdev), 0, 1);
msleep(200);
enable_irq(card->irq);
priv->hw.ops->lock_irqsave(&priv->lock, &flags);
err = orinoco_up(priv);
priv->hw.ops->unlock_irqrestore(&priv->lock, &flags);
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David Kilroy | 36 | 27.48% | 4 | 40.00% |
Benjamin Herrenschmidt | 34 | 25.95% | 1 | 10.00% |
Linus Torvalds | 28 | 21.37% | 1 | 10.00% |
David Gibson | 27 | 20.61% | 2 | 20.00% |
Jeff Garzik | 4 | 3.05% | 1 | 10.00% |
Nishanth Aravamudan | 2 | 1.53% | 1 | 10.00% |
Total | 131 | 100.00% | 10 | 100.00% |
static int
airport_detach(struct macio_dev *mdev)
{
struct orinoco_private *priv = dev_get_drvdata(&mdev->ofdev.dev);
struct airport *card = priv->card;
if (card->ndev_registered)
orinoco_if_del(priv);
card->ndev_registered = 0;
if (card->irq_requested)
free_irq(card->irq, priv);
card->irq_requested = 0;
if (card->vaddr)
iounmap(card->vaddr);
card->vaddr = NULL;
macio_release_resource(mdev, 0);
pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
macio_get_of_node(mdev), 0, 0);
ssleep(1);
macio_set_drvdata(mdev, NULL);
free_orinocodev(priv);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Benjamin Herrenschmidt | 84 | 63.16% | 1 | 9.09% |
Linus Torvalds | 20 | 15.04% | 1 | 9.09% |
David Gibson | 11 | 8.27% | 3 | 27.27% |
Jeff Garzik | 8 | 6.02% | 1 | 9.09% |
David Kilroy | 7 | 5.26% | 3 | 27.27% |
Nishanth Aravamudan | 2 | 1.50% | 1 | 9.09% |
Al Viro | 1 | 0.75% | 1 | 9.09% |
Total | 133 | 100.00% | 11 | 100.00% |
static int airport_hard_reset(struct orinoco_private *priv)
{
/* It would be nice to power cycle the Airport for a real hard
* reset, but for some reason although it appears to
* re-initialize properly, it falls in a screaming heap
* shortly afterwards. */
#if 0
struct airport *card = priv->card;
/* Vitally important. If we don't do this it seems we get an
* interrupt somewhere during the power cycle, since
* hw_unavailable is already set it doesn't get ACKed, we get
* into an interrupt loop and the PMU decides to turn us
* off. */
disable_irq(card->irq);
pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
macio_get_of_node(card->mdev), 0, 0);
ssleep(1);
pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
macio_get_of_node(card->mdev), 0, 1);
ssleep(1);
enable_irq(card->irq);
ssleep(1);
#endif
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Benjamin Herrenschmidt | 20 | 86.96% | 1 | 33.33% |
David Kilroy | 2 | 8.70% | 1 | 33.33% |
Michael Opdenacker | 1 | 4.35% | 1 | 33.33% |
Total | 23 | 100.00% | 3 | 100.00% |
static int
airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
{
struct orinoco_private *priv;
struct airport *card;
unsigned long phys_addr;
struct hermes *hw;
if (macio_resource_count(mdev) < 1 || macio_irq_count(mdev) < 1) {
printk(KERN_ERR PFX "Wrong interrupt/addresses in OF tree\n");
return -ENODEV;
}
/* Allocate space for private device-specific data */
priv = alloc_orinocodev(sizeof(*card), &mdev->ofdev.dev,
airport_hard_reset, NULL);
if (!priv) {
printk(KERN_ERR PFX "Cannot allocate network device\n");
return -ENODEV;
}
card = priv->card;
hw = &priv->hw;
card->mdev = mdev;
if (macio_request_resource(mdev, 0, DRIVER_NAME)) {
printk(KERN_ERR PFX "can't request IO resource !\n");
free_orinocodev(priv);
return -EBUSY;
}
macio_set_drvdata(mdev, priv);
/* Setup interrupts & base address */
card->irq = macio_irq(mdev, 0);
phys_addr = macio_resource_start(mdev, 0); /* Physical address */
printk(KERN_DEBUG PFX "Physical address %lx\n", phys_addr);
card->vaddr = ioremap(phys_addr, AIRPORT_IO_LEN);
if (!card->vaddr) {
printk(KERN_ERR PFX "ioremap() failed\n");
goto failed;
}
hermes_struct_init(hw, card->vaddr, HERMES_16BIT_REGSPACING);
/* Power up card */
pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
macio_get_of_node(mdev), 0, 1);
ssleep(1);
/* Reset it before we get the interrupt */
hw->ops->init(hw);
if (request_irq(card->irq, orinoco_interrupt, 0, DRIVER_NAME, priv)) {
printk(KERN_ERR PFX "Couldn't get IRQ %d\n", card->irq);
goto failed;
}
card->irq_requested = 1;
/* Initialise the main driver */
if (orinoco_init(priv) != 0) {
printk(KERN_ERR PFX "orinoco_init() failed\n");
goto failed;
}
/* Register an interface with the stack */
if (orinoco_if_add(priv, phys_addr, card->irq, NULL) != 0) {
printk(KERN_ERR PFX "orinoco_if_add() failed\n");
goto failed;
}
card->ndev_registered = 1;
return 0;
failed:
airport_detach(mdev);
return -ENODEV;
} Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds | 114 | 31.32% | 2 | 10.53% |
Benjamin Herrenschmidt | 87 | 23.90% | 1 | 5.26% |
David Gibson | 70 | 19.23% | 5 | 26.32% |
David Kilroy | 59 | 16.21% | 7 | 36.84% |
Jeff Garzik | 29 | 7.97% | 1 | 5.26% |
Nishanth Aravamudan | 2 | 0.55% | 1 | 5.26% |
Pavel Roskin | 2 | 0.55% | 1 | 5.26% |
Jeff Mahoney | 1 | 0.27% | 1 | 5.26% |
Total | 364 | 100.00% | 19 | 100.00% |
/* airport_attach */
static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
" (Benjamin Herrenschmidt <benh@kernel.crashing.org>)";
MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
MODULE_DESCRIPTION("Driver for the Apple Airport wireless card.");
MODULE_LICENSE("Dual MPL/GPL");
static const struct of_device_id airport_match[] = {
{
.name = "radio",
},
{},
};
MODULE_DEVICE_TABLE(of, airport_match);
static struct macio_driver airport_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = airport_match,
},
.probe = airport_attach,
.remove = airport_detach,
.suspend = airport_suspend,
.resume = airport_resume,
};
static int __init
init_airport(void)
{
printk(KERN_DEBUG "%s\n", version);
return macio_register_driver(&airport_driver);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds | 20 | 83.33% | 2 | 66.67% |
Benjamin Herrenschmidt | 4 | 16.67% | 1 | 33.33% |
Total | 24 | 100.00% | 3 | 100.00% |
static void __exit
exit_airport(void)
{
macio_unregister_driver(&airport_driver);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds | 11 | 73.33% | 1 | 33.33% |
Benjamin Herrenschmidt | 3 | 20.00% | 1 | 33.33% |
Pavel Roskin | 1 | 6.67% | 1 | 33.33% |
Total | 15 | 100.00% | 3 | 100.00% |
module_init(init_airport);
module_exit(exit_airport);
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Benjamin Herrenschmidt | 313 | 31.74% | 2 | 6.25% |
Linus Torvalds | 265 | 26.88% | 3 | 9.38% |
David Gibson | 208 | 21.10% | 6 | 18.75% |
David Kilroy | 128 | 12.98% | 10 | 31.25% |
Jeff Garzik | 47 | 4.77% | 1 | 3.12% |
Jeff Mahoney | 10 | 1.01% | 1 | 3.12% |
Nishanth Aravamudan | 6 | 0.61% | 1 | 3.12% |
Pavel Roskin | 4 | 0.41% | 3 | 9.38% |
Al Viro | 2 | 0.20% | 2 | 6.25% |
Pavel Machek | 1 | 0.10% | 1 | 3.12% |
Fabian Frederick | 1 | 0.10% | 1 | 3.12% |
Michael Opdenacker | 1 | 0.10% | 1 | 3.12% |
Total | 986 | 100.00% | 32 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.