Update to orinoco driver (2.4)
Hi Marcelo,
The patch below updates the orinoco driver in 2.4 to 0.13d, the patch is against 2.4.21-rc1. You may want to postpone this update till after 2.4.21, but I'd consider it, since it fixes a fair slew of bugs.
Signature · 4 lines
David Gibson | For every complex problem there is a [email protected] | solution which is simple, neat and | wrong. http://www.ozlabs.org/people/dgibson
Quoted 5 lines · David Gibson
Hi Marcelo,
The patch below updates the orinoco driver in 2.4 to 0.13d, the patch is against 2.4.21-rc1. You may want to postpone this update till after 2.4.21, but I'd consider it, since it fixes a fair slew of bugs.
Duh, sorry. And now with the actual patch:
drivers/net/wireless/airport.c +25 -12
@@ -1,4 +1,4 @@ -/* airport.c 0.13b +/* airport.c 0.13d * * A driver for "Hermes" chipset based Apple Airport wireless * card.
@@ -95,7 +95,7 @@netif_device_detach (dev); - priv->hw_unavailable =1 ; + priv->hw_unavailable++;orinoco_unlock (priv, &flags);
@@ -121,14 +121,15 @@netif_device_attach (dev); -if (priv->open) { + priv->hw_unavailable--; + +if (priv->open && (! priv->hw_unavailable)) { err =__orinoco_up (dev);if (err)printk (KERN_ERR "%s: Error %d restarting card on PBOOK_WAKE\n" , dev->name, err); } - priv->hw_unavailable =0 ;spin_unlock_irqrestore (&priv->lock, flags);
@@ -140,8 +141,21 @@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 net_device *dev = priv->ndev;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 the PMU decides to turn us +* off. */ +disable_irq (dev->irq); +pmac_call_feature (PMAC_FTR_AIRPORT_ENABLE , card->node,0 ,0 ); current->state =TASK_UNINTERRUPTIBLE ;schedule_timeout (HZ );
@@ -149,6 +163,10 @@ current->state =TASK_UNINTERRUPTIBLE ;schedule_timeout (HZ ); +enable_irq (dev->irq); +schedule_timeout (HZ ); +#endif +return 0 ; }
@@ -209,7 +227,7 @@/* Reset it before we get the interrupt */ hermes_init (hw); -if (request_irq (dev->irq, orinoco_interrupt,0 ,"Airport" , (void *)priv)) { +if (request_irq (dev->irq, orinoco_interrupt,0 ,"Airport" , dev)) {printk (KERN_ERR "airport: Couldn't get IRQ %d\n" , dev->irq); goto failed; }
@@ -251,7 +269,7 @@ card->ndev_registered =0 ;if (card->irq_requested) -free_irq (dev->irq, priv); +free_irq (dev->irq, dev); card->irq_requested =0 ;if (card->vaddr)
@@ -269,11 +287,10 @@kfree (dev); }/* airport_detach */ -static char version[]__initdata ="airport.c 0.13b (Benjamin Herrenschmidt <[email protected]>)" ; +static char version[]__initdata ="airport.c 0.13d (Benjamin Herrenschmidt <[email protected]>)" ;MODULE_AUTHOR ("Benjamin Herrenschmidt <[email protected]>" );MODULE_DESCRIPTION ("Driver for the Apple Airport wireless card." );MODULE_LICENSE ("Dual MPL/GPL" ); -EXPORT_NO_SYMBOLS ;static int __init init_airport (void )
@@ -282,15 +299,11 @@printk (KERN_DEBUG "%s\n" , version); -MOD_INC_USE_COUNT ; -/* Lookup card in device tree */ airport_node =find_devices ("radio" );if (airport_node && !strcmp (airport_node->parent->name,"mac-io" )) airport_dev =airport_attach (airport_node); -MOD_DEC_USE_COUNT ; -return airport_dev ?0 : -ENODEV ; }
drivers/net/wireless/hermes.c +5 -0
@@ -544,4 +544,9 @@return 0 ; } +static void __exit exit_hermes(void) +{ +} +module_init (init_hermes); +module_exit (exit_hermes);
drivers/net/wireless/hermes.h +17 -3
@@ -250,7 +250,6 @@u16 scanreason;/* ??? */ struct hermes_scan_apinfo aps[35 ];/* Scan result */ } __attribute__ ((packed)); -#define HERMES_LINKSTATUS_NOT_CONNECTED (0x0000)#define HERMES_LINKSTATUS_CONNECTED (0x0001)#define HERMES_LINKSTATUS_DISCONNECTED (0x0002)
@@ -368,7 +367,7 @@if (hw->io_space) {insw (hw->iobase + off, buf, count); }else { -int i; +unsigned i;u16 *p;/* This needs to *not* byteswap (like insw()) but
@@ -388,7 +387,7 @@if (hw->io_space) {outsw (hw->iobase + off, buf, count); }else { -int i; +unsigned i;const u16 *p;/* This needs to *not* byteswap (like outsw()) but
@@ -401,6 +400,21 @@ } } +static inline void hermes_clear_words (struct hermes *hw,int off,unsigned count) +{ +unsigned i; + + off = off << hw->reg_spacing;; + +if (hw->io_space) { +for (i =0 ; i < count; i++) +outw (0 , hw->iobase + off); + }else { +for (i =0 ; i < count; i++) +writew (0 , hw->iobase + off); + } +} +#define HERMES_READ_RECORD (hw, bap, rid, buf) \ (hermes_read_ltv((hw),(bap),(rid), sizeof(*buf), NULL, (buf)))#define HERMES_WRITE_RECORD (hw, bap, rid, buf) \
drivers/net/wireless/orinoco.c +202 -99
624 lines not on this page · raw message
drivers/net/wireless/orinoco.h +16 -4
@@ -11,9 +11,20 @@#include <linux/spinlock.h> #include <linux/netdevice.h> #include <linux/wireless.h> -#include <linux/tqueue.h> +#include <linux/version.h> #include "hermes.h" +/* Workqueue / task queue backwards compatibility stuff */ + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,5 ,41 ) +#include <linux/workqueue.h> +#else +#include <linux/tqueue.h> +#define work_struct tq_struct +#define INIT_WORK INIT_TQUEUE +#define schedule_work schedule_task +#endif +/* To enable debug messages */ //#define ORINOCO_DEBUG 3
@@ -42,7 +53,7 @@/* Synchronisation stuff */ spinlock_t lock;int hw_unavailable; -struct tq_struct timeout_task; +struct work_struct reset_work;/* driver state */ int open;
@@ -72,6 +83,7 @@int has_sensitivity;int nicbuf_size;u16 channel_mask; +int broken_disableport;/* Configuration paramaters */ u32 iw_mode;
@@ -111,8 +123,8 @@ int (*hard_reset)(struct orinoco_private *));extern int __orinoco_up (struct net_device *dev);extern int __orinoco_down (struct net_device *dev); -int orinoco_reinit_firmware (struct net_device *dev); - +extern int orinoco_stop (struct net_device *dev); +extern int orinoco_reinit_firmware (struct net_device *dev);extern void orinoco_interrupt (int irq,void * dev_id,struct pt_regs *regs);/********************************************************************/
drivers/net/wireless/orinoco_cs.c +23 -52
161 lines not on this page · raw message
drivers/net/wireless/orinoco_pci.c +9 -13
@@ -1,4 +1,4 @@ -/* orinoco_pci.c 0.13b +/* orinoco_pci.c 0.13d * * Driver for Prism II devices that have a direct PCI interface * (i.e., not in a Pcmcia or PLX bridge)
@@ -143,8 +143,6 @@unsigned long timeout;u16 reg; -TRACE_ENTER (priv->ndev->name); -/* Assert the reset until the card notice */ hermes_write_regn (hw,PCI_COR ,HERMES_PCI_COR_MASK );printk (KERN_NOTICE "Reset done" );
@@ -181,8 +179,6 @@ }printk (KERN_NOTICE "pci_cor : reg = 0x%X - %lX - %lX\n" , reg, timeout, jiffies); -TRACE_EXIT (priv->ndev->name); -return 0 ; }
@@ -232,7 +228,7 @@hermes_struct_init (&(priv->hw), dev->base_addr,HERMES_MEM ,HERMES_32BIT_REGSPACING );pci_set_drvdata (pdev, dev); - err =request_irq (pdev->irq, orinoco_interrupt,SA_SHIRQ , dev->name, priv); + err =request_irq (pdev->irq, orinoco_interrupt,SA_SHIRQ , dev->name, dev);if (err) {printk (KERN_ERR "orinoco_pci: Error allocating IRQ %d.\n" , pdev->irq); err = -EBUSY ;
@@ -264,7 +260,7 @@unregister_netdev (dev);if (dev->irq) -free_irq (dev->irq, priv); +free_irq (dev->irq, dev);kfree (dev); }
@@ -286,7 +282,7 @@unregister_netdev (dev);if (dev->irq) -free_irq (dev->irq, priv); +free_irq (dev->irq, dev);if (priv->hw.iobase)iounmap ((unsigned char *) priv->hw.iobase);
@@ -321,7 +317,7 @@netif_device_detach (dev); - priv->hw_unavailable =1 ; + priv->hw_unavailable++;orinoco_unlock (priv, &flags);
@@ -348,15 +344,15 @@netif_device_attach (dev); -if (priv->open) { + priv->hw_unavailable--; + +if (priv->open && (! priv->hw_unavailable)) { err =__orinoco_up (dev);if (err)printk (KERN_ERR "%s: Error %d restarting card on orinoco_pci_resume()\n" , dev->name, err); } - priv->hw_unavailable =0 ; -spin_unlock_irqrestore (&priv->lock, flags);return 0 ;
@@ -378,7 +374,7 @@ .resume = orinoco_pci_resume, }; -static char version[]__initdata ="orinoco_pci.c 0.13b (David Gibson <[email protected]> & Jean Tourrilhes <[email protected]>)" ; +static char version[]__initdata ="orinoco_pci.c 0.13d (David Gibson <[email protected]> & Jean Tourrilhes <[email protected]>)" ;MODULE_AUTHOR ("David Gibson <[email protected]>" );MODULE_DESCRIPTION ("Driver for wireless LAN cards using direct PCI interface" );MODULE_LICENSE ("Dual MPL/GPL" );
drivers/net/wireless/orinoco_plx.c +5 -6
@@ -1,4 +1,4 @@ -/* orinoco_plx.c 0.13b +/* orinoco_plx.c 0.13d * * Driver for Prism II devices which would usually be driven by orinoco_cs, * but are connected to the PCI bus by a PLX9052.
@@ -243,7 +243,7 @@ HERMES_IO, HERMES_16BIT_REGSPACING);pci_set_drvdata (pdev, dev); - err =request_irq (pdev->irq, orinoco_interrupt,SA_SHIRQ , dev->name, priv); + err =request_irq (pdev->irq, orinoco_interrupt,SA_SHIRQ , dev->name, dev);if (err) {printk (KERN_ERR "orinoco_plx: Error allocating IRQ %d.\n" , pdev->irq); err = -EBUSY ;
@@ -266,7 +266,7 @@unregister_netdev (dev);if (dev->irq) -free_irq (dev->irq, priv); +free_irq (dev->irq, dev);kfree (priv); }
@@ -285,7 +285,6 @@ static void __devexit orinoco_plx_remove_one(struct pci_dev *pdev) {struct net_device *dev =pci_get_drvdata (pdev); -struct orinoco_private *priv = dev->priv;if (! dev)BUG ();
@@ -293,7 +292,7 @@unregister_netdev (dev);if (dev->irq) -free_irq (dev->irq, priv); +free_irq (dev->irq, dev);pci_set_drvdata (pdev,NULL );
@@ -334,7 +333,7 @@ .resume = 0, }; -static char version[]__initdata ="orinoco_plx.c 0.13b (Daniel Barlow <[email protected]>, David Gibson <[email protected]>)" ; +static char version[]__initdata ="orinoco_plx.c 0.13d (Daniel Barlow <[email protected]>, David Gibson <[email protected]>)" ;MODULE_AUTHOR ("Daniel Barlow <[email protected]>" );MODULE_DESCRIPTION ("Driver for wireless LAN cards using the PLX9052 PCI bridge" );#ifdef MODULE_LICENSE
drivers/net/wireless/orinoco_tmd.c +240 -0
240 lines not on this page · raw message
Signature · 4 lines
David Gibson | For every complex problem there is a [email protected] | solution which is simple, neat and | wrong. http://www.ozlabs.org/people/dgibson
Quoted 8 lines · David Gibson
Quoted 5 lines · David Gibson
Hi Marcelo,
The patch below updates the orinoco driver in 2.4 to 0.13d, the patch is against 2.4.21-rc1. You may want to postpone this update till after 2.4.21, but I'd consider it, since it fixes a fair slew of bugs.
Duh, sorry. And now with the actual patch:
Shouldn't it also patch Config.in & Makefile to add the orinoco_tmd.c ?
I'm adding this new driver to my pmac bk tree btw.
Ben.
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 8 lines · David Gibson
Quoted 5 lines · David Gibson
Hi Marcelo,
The patch below updates the orinoco driver in 2.4 to 0.13d, the patch is against 2.4.21-rc1. You may want to postpone this update till after 2.4.21, but I'd consider it, since it fixes a fair slew of bugs.
Duh, sorry. And now with the actual patch:
Shouldn't it also patch Config.in &
Makefileto add theorinoco_tmd.c?
Crap, indeed it ought. It's been so long since I added a file, I forgot that bit. I'll fix that up on Monday.
Quoted 1 line
I'm adding this new driver to my pmac bk tree btw.
Ok.
Signature · 4 lines
David Gibson | For every complex problem there is a [email protected] | solution which is simple, neat and | wrong. http://www.ozlabs.org/people/dgibson
Quoted 11 lines · David Gibson
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 8 lines · David Gibson
Quoted 5 lines · David Gibson
Hi Marcelo,
The patch below updates the orinoco driver in 2.4 to 0.13d, the patch is against 2.4.21-rc1. You may want to postpone this update till after 2.4.21, but I'd consider it, since it fixes a fair slew of bugs.
Duh, sorry. And now with the actual patch:
Quoted 8 lines
Quoted 1 line
Shouldn't it also patch Config.in &
Makefileto add theorinoco_tmd.c?Crap, indeed it ought. It's been so long since I added a file, I forgot that bit. I'll fix that up on Monday.
Quoted 1 line
I'm adding this new driver to my pmac bk tree btw.
Ok.
It works perfectly for me, fwiw.
Signature · 1 line
Jens Axboe
drivers/net/wireless/hermes.c line 552
Quoted 6 lines
drivers/net/wireless/hermes.c +5
-0+static void __exit exit_hermes(void) +{ +} +module_init (init_hermes); +module_exit (exit_hermes);
Please don't add exmpty functions without a reak good reason.
Quoted 8 lines · Christoph Hellwig
drivers/net/wireless/hermes.c line 552
Quoted 6 lines
drivers/net/wireless/hermes.c +5
-0+static void __exit exit_hermes(void) +{ +} +module_init (init_hermes); +module_exit (exit_hermes);Please don't add exmpty functions without a reak good reason.
And the real good reason would be that the module can't be unloaded without an exit function.
Signature · 4 lines
David Gibson | For every complex problem there is a [email protected] | solution which is simple, neat and | wrong. http://www.ozlabs.org/people/dgibson
Quoted 10 lines · David Gibson
Quoted 8 lines · Christoph Hellwig
drivers/net/wireless/hermes.c line 552
Quoted 6 lines
drivers/net/wireless/hermes.c +5
-0+static void __exit exit_hermes(void) +{ +} +module_init (init_hermes); +module_exit (exit_hermes);Please don't add exmpty functions without a reak good reason.
Quoted 2 lines
And the real good reason would be that the module can't be unloaded without an exit function.
That braindamage fortunately is not true for 2.4 and still needs fixing for 2.5.
Quoted 11 lines · Christoph Hellwig
Quoted 10 lines · David Gibson
Quoted 8 lines · Christoph Hellwig
drivers/net/wireless/hermes.c line 552
Quoted 6 lines
drivers/net/wireless/hermes.c +5
-0+static void __exit exit_hermes(void) +{ +} +module_init (init_hermes); +module_exit (exit_hermes);Please don't add exmpty functions without a reak good reason.
Quoted 5 lines
Quoted 2 lines
And the real good reason would be that the module can't be unloaded without an exit function.
That braindamage fortunately is not true for 2.4 and still needs fixing for 2.5.
Removing one empty function is insufficient cause for me to maintain separate 2.4 and 2.5 versions. When and if this changes in 2.5, I'll remove the function.
Signature · 4 lines
David Gibson | For every complex problem there is a [email protected] | solution which is simple, neat and | wrong. http://www.ozlabs.org/people/dgibson