Commit 0b682e85 authored by Jean Tourrilhes's avatar Jean Tourrilhes Committed by Linus Torvalds

[PATCH] Donauboe probe fix

ir260_donau_cleanup.diff :
~~~~~~~~~~~~~~~~~~~~~~~~
		<Patch from Christian Gennerat>
	o [CORRECT] Disable chip probing that fail too often
	o [FEATURE] Cleanup STATIC
parent ddb6a1aa
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* FIR Chipset, also supports the DONAUOBOE (type-DO * FIR Chipset, also supports the DONAUOBOE (type-DO
* or d01) FIR chipset which as far as I know is * or d01) FIR chipset which as far as I know is
* register compatible. * register compatible.
* Documentation: http://libxg.free.fr/irda/lib-irda.html
* Status: Experimental. * Status: Experimental.
* Author: James McKenzie <james@fishsoup.dhs.org> * Author: James McKenzie <james@fishsoup.dhs.org>
* Created at: Sat May 8 12:35:27 1999 * Created at: Sat May 8 12:35:27 1999
...@@ -25,6 +26,8 @@ ...@@ -25,6 +26,8 @@
* Modified: 2.16 Sat Jun 22 18:54:29 2002 (fix freeregion, default to verbose) * Modified: 2.16 Sat Jun 22 18:54:29 2002 (fix freeregion, default to verbose)
* Modified: 2.17 Christian Gennerat <christian.gennerat@polytechnique.org> * Modified: 2.17 Christian Gennerat <christian.gennerat@polytechnique.org>
* Modified: 2.17 jeu sep 12 08:50:20 2002 (save_flags();cli(); replaced by spinlocks) * Modified: 2.17 jeu sep 12 08:50:20 2002 (save_flags();cli(); replaced by spinlocks)
* Modified: 2.18 Christian Gennerat <christian.gennerat@polytechnique.org>
* Modified: 2.18 ven jan 10 03:14:16 2003 Change probe default options
* *
* Copyright (c) 1999 James McKenzie, All Rights Reserved. * Copyright (c) 1999 James McKenzie, All Rights Reserved.
* *
...@@ -48,7 +51,7 @@ ...@@ -48,7 +51,7 @@
static char *rcsid = static char *rcsid =
"$Id: donauboe.c V2.17 jeu sep 12 08:50:20 2002 $"; "$Id: donauboe.c V2.18 ven jan 10 03:14:16 2003$";
/* See below for a description of the logic in this driver */ /* See below for a description of the logic in this driver */
...@@ -57,12 +60,14 @@ static char *rcsid = ...@@ -57,12 +60,14 @@ static char *rcsid =
#undef CRC_EXPORTED #undef CRC_EXPORTED
/* User servicable parts */ /* User servicable parts */
/* Enable the code which probes the chip and does a few tests */ /* USE_PROBE Create the code which probes the chip and does a few tests */
/* do_probe module parameter Enable this code */
/* Probe code is very useful for understanding how the hardware works */ /* Probe code is very useful for understanding how the hardware works */
/* Use it with various combinations of TT_LEN, RX_LEN */ /* Use it with various combinations of TT_LEN, RX_LEN */
/* Strongly recomended, disable if the probe fails on your machine */ /* Strongly recomended, disable if the probe fails on your machine */
/* and send me <james@fishsoup.dhs.org> the output of dmesg */ /* and send me <james@fishsoup.dhs.org> the output of dmesg */
#define DO_PROBE 1 #define USE_PROBE 1
#undef USE_PROBE
/* Trace Transmit ring, interrupts, Receive ring or not ? */ /* Trace Transmit ring, interrupts, Receive ring or not ? */
#define PROBE_VERBOSE 1 #define PROBE_VERBOSE 1
...@@ -145,8 +150,6 @@ static char *rcsid = ...@@ -145,8 +150,6 @@ static char *rcsid =
/* No user servicable parts below here */ /* No user servicable parts below here */
#define STATIC static
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -200,7 +203,9 @@ MODULE_DEVICE_TABLE(pci, toshoboe_pci_tbl); ...@@ -200,7 +203,9 @@ MODULE_DEVICE_TABLE(pci, toshoboe_pci_tbl);
static char *driver_name = DRIVER_NAME; static char *driver_name = DRIVER_NAME;
static int max_baud = 4000000; static int max_baud = 4000000;
static int do_probe = DO_PROBE; #ifdef USE_PROBE
static int do_probe = 0;
#endif
/**********************************************************************/ /**********************************************************************/
...@@ -245,7 +250,7 @@ static __u16 const irda_crc16_table[256] = { ...@@ -245,7 +250,7 @@ static __u16 const irda_crc16_table[256] = {
}; };
#endif #endif
STATIC int static int
toshoboe_checkfcs (unsigned char *buf, int len) toshoboe_checkfcs (unsigned char *buf, int len)
{ {
int i; int i;
...@@ -268,7 +273,7 @@ toshoboe_checkfcs (unsigned char *buf, int len) ...@@ -268,7 +273,7 @@ toshoboe_checkfcs (unsigned char *buf, int len)
/* Generic chip handling code */ /* Generic chip handling code */
#ifdef DUMP_PACKETS #ifdef DUMP_PACKETS
static unsigned char dump[50]; static unsigned char dump[50];
STATIC void static void
_dumpbufs (unsigned char *data, int len, char tete) _dumpbufs (unsigned char *data, int len, char tete)
{ {
int i,j; int i,j;
...@@ -282,8 +287,9 @@ for (i=0;i<len;i+=16) { ...@@ -282,8 +287,9 @@ for (i=0;i<len;i+=16) {
} }
#endif #endif
#ifdef USE_PROBE
/* Dump the registers */ /* Dump the registers */
STATIC void static void
toshoboe_dumpregs (struct toshoboe_cb *self) toshoboe_dumpregs (struct toshoboe_cb *self)
{ {
__u32 ringbase; __u32 ringbase;
...@@ -329,9 +335,10 @@ toshoboe_dumpregs (struct toshoboe_cb *self) ...@@ -329,9 +335,10 @@ toshoboe_dumpregs (struct toshoboe_cb *self)
printk ("\n"); printk ("\n");
} }
} }
#endif
/*Don't let the chip look at memory */ /*Don't let the chip look at memory */
STATIC void static void
toshoboe_disablebm (struct toshoboe_cb *self) toshoboe_disablebm (struct toshoboe_cb *self)
{ {
__u8 command; __u8 command;
...@@ -344,7 +351,7 @@ toshoboe_disablebm (struct toshoboe_cb *self) ...@@ -344,7 +351,7 @@ toshoboe_disablebm (struct toshoboe_cb *self)
} }
/* Shutdown the chip and point the taskfile reg somewhere else */ /* Shutdown the chip and point the taskfile reg somewhere else */
STATIC void static void
toshoboe_stopchip (struct toshoboe_cb *self) toshoboe_stopchip (struct toshoboe_cb *self)
{ {
IRDA_DEBUG (4, "%s()\n", __FUNCTION__); IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
...@@ -376,7 +383,7 @@ toshoboe_stopchip (struct toshoboe_cb *self) ...@@ -376,7 +383,7 @@ toshoboe_stopchip (struct toshoboe_cb *self)
} }
/* Transmitter initialization */ /* Transmitter initialization */
STATIC void static void
toshoboe_start_DMA (struct toshoboe_cb *self, int opts) toshoboe_start_DMA (struct toshoboe_cb *self, int opts)
{ {
OUTB (0x0, OBOE_ENABLEH); OUTB (0x0, OBOE_ENABLEH);
...@@ -386,7 +393,7 @@ toshoboe_start_DMA (struct toshoboe_cb *self, int opts) ...@@ -386,7 +393,7 @@ toshoboe_start_DMA (struct toshoboe_cb *self, int opts)
} }
/*Set the baud rate */ /*Set the baud rate */
STATIC void static void
toshoboe_setbaud (struct toshoboe_cb *self) toshoboe_setbaud (struct toshoboe_cb *self)
{ {
__u16 pconfig = 0; __u16 pconfig = 0;
...@@ -521,7 +528,7 @@ toshoboe_setbaud (struct toshoboe_cb *self) ...@@ -521,7 +528,7 @@ toshoboe_setbaud (struct toshoboe_cb *self)
} }
/*Let the chip look at memory */ /*Let the chip look at memory */
STATIC void static void
toshoboe_enablebm (struct toshoboe_cb *self) toshoboe_enablebm (struct toshoboe_cb *self)
{ {
IRDA_DEBUG (4, "%s()\n", __FUNCTION__); IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
...@@ -529,7 +536,7 @@ toshoboe_enablebm (struct toshoboe_cb *self) ...@@ -529,7 +536,7 @@ toshoboe_enablebm (struct toshoboe_cb *self)
} }
/*setup the ring */ /*setup the ring */
STATIC void static void
toshoboe_initring (struct toshoboe_cb *self) toshoboe_initring (struct toshoboe_cb *self)
{ {
int i; int i;
...@@ -552,7 +559,7 @@ toshoboe_initring (struct toshoboe_cb *self) ...@@ -552,7 +559,7 @@ toshoboe_initring (struct toshoboe_cb *self)
} }
} }
STATIC void static void
toshoboe_resetptrs (struct toshoboe_cb *self) toshoboe_resetptrs (struct toshoboe_cb *self)
{ {
/* Can reset pointers by twidling DMA */ /* Can reset pointers by twidling DMA */
...@@ -565,7 +572,7 @@ toshoboe_resetptrs (struct toshoboe_cb *self) ...@@ -565,7 +572,7 @@ toshoboe_resetptrs (struct toshoboe_cb *self)
} }
/* Called in locked state */ /* Called in locked state */
STATIC void static void
toshoboe_initptrs (struct toshoboe_cb *self) toshoboe_initptrs (struct toshoboe_cb *self)
{ {
...@@ -587,7 +594,7 @@ toshoboe_initptrs (struct toshoboe_cb *self) ...@@ -587,7 +594,7 @@ toshoboe_initptrs (struct toshoboe_cb *self)
/* Wake the chip up and get it looking at the rings */ /* Wake the chip up and get it looking at the rings */
/* Called in locked state */ /* Called in locked state */
STATIC void static void
toshoboe_startchip (struct toshoboe_cb *self) toshoboe_startchip (struct toshoboe_cb *self)
{ {
__u32 physaddr; __u32 physaddr;
...@@ -645,12 +652,12 @@ toshoboe_startchip (struct toshoboe_cb *self) ...@@ -645,12 +652,12 @@ toshoboe_startchip (struct toshoboe_cb *self)
toshoboe_initptrs (self); toshoboe_initptrs (self);
} }
STATIC void static void
toshoboe_isntstuck (struct toshoboe_cb *self) toshoboe_isntstuck (struct toshoboe_cb *self)
{ {
} }
STATIC void static void
toshoboe_checkstuck (struct toshoboe_cb *self) toshoboe_checkstuck (struct toshoboe_cb *self)
{ {
unsigned long flags; unsigned long flags;
...@@ -669,7 +676,7 @@ toshoboe_checkstuck (struct toshoboe_cb *self) ...@@ -669,7 +676,7 @@ toshoboe_checkstuck (struct toshoboe_cb *self)
} }
/*Generate packet of about mtt us long */ /*Generate packet of about mtt us long */
STATIC int static int
toshoboe_makemttpacket (struct toshoboe_cb *self, void *buf, int mtt) toshoboe_makemttpacket (struct toshoboe_cb *self, void *buf, int mtt)
{ {
int xbofs; int xbofs;
...@@ -695,10 +702,17 @@ toshoboe_makemttpacket (struct toshoboe_cb *self, void *buf, int mtt) ...@@ -695,10 +702,17 @@ toshoboe_makemttpacket (struct toshoboe_cb *self, void *buf, int mtt)
return xbofs; return xbofs;
} }
static int toshoboe_invalid_dev(int irq)
{
printk (KERN_WARNING DRIVER_NAME ": irq %d for unknown device.\n", irq);
return 1;
}
#ifdef USE_PROBE
/***********************************************************************/ /***********************************************************************/
/* Probe code */ /* Probe code */
STATIC void static void
toshoboe_dumptx (struct toshoboe_cb *self) toshoboe_dumptx (struct toshoboe_cb *self)
{ {
int i; int i;
...@@ -708,7 +722,7 @@ toshoboe_dumptx (struct toshoboe_cb *self) ...@@ -708,7 +722,7 @@ toshoboe_dumptx (struct toshoboe_cb *self)
PROBE_DEBUG(" [%d]\n",self->speed); PROBE_DEBUG(" [%d]\n",self->speed);
} }
STATIC void static void
toshoboe_dumprx (struct toshoboe_cb *self, int score) toshoboe_dumprx (struct toshoboe_cb *self, int score)
{ {
int i; int i;
...@@ -739,13 +753,7 @@ stuff_byte (__u8 byte, __u8 * buf) ...@@ -739,13 +753,7 @@ stuff_byte (__u8 byte, __u8 * buf)
} }
} }
STATIC int toshoboe_invalid_dev(int irq) static irqreturn_t
{
printk (KERN_WARNING DRIVER_NAME ": irq %d for unknown device.\n", irq);
return 1;
}
STATIC irqreturn_t
toshoboe_probeinterrupt (int irq, void *dev_id, struct pt_regs *regs) toshoboe_probeinterrupt (int irq, void *dev_id, struct pt_regs *regs)
{ {
struct toshoboe_cb *self = (struct toshoboe_cb *) dev_id; struct toshoboe_cb *self = (struct toshoboe_cb *) dev_id;
...@@ -794,7 +802,7 @@ toshoboe_probeinterrupt (int irq, void *dev_id, struct pt_regs *regs) ...@@ -794,7 +802,7 @@ toshoboe_probeinterrupt (int irq, void *dev_id, struct pt_regs *regs)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
STATIC int static int
toshoboe_maketestpacket (unsigned char *buf, int badcrc, int fir) toshoboe_maketestpacket (unsigned char *buf, int badcrc, int fir)
{ {
int i; int i;
...@@ -831,7 +839,7 @@ toshoboe_maketestpacket (unsigned char *buf, int badcrc, int fir) ...@@ -831,7 +839,7 @@ toshoboe_maketestpacket (unsigned char *buf, int badcrc, int fir)
return len; return len;
} }
STATIC int static int
toshoboe_probefail (struct toshoboe_cb *self, char *msg) toshoboe_probefail (struct toshoboe_cb *self, char *msg)
{ {
printk (KERN_ERR DRIVER_NAME "probe(%d) failed %s\n",self-> speed, msg); printk (KERN_ERR DRIVER_NAME "probe(%d) failed %s\n",self-> speed, msg);
...@@ -841,7 +849,7 @@ toshoboe_probefail (struct toshoboe_cb *self, char *msg) ...@@ -841,7 +849,7 @@ toshoboe_probefail (struct toshoboe_cb *self, char *msg)
return 0; return 0;
} }
STATIC int static int
toshoboe_numvalidrcvs (struct toshoboe_cb *self) toshoboe_numvalidrcvs (struct toshoboe_cb *self)
{ {
int i, ret = 0; int i, ret = 0;
...@@ -852,7 +860,7 @@ toshoboe_numvalidrcvs (struct toshoboe_cb *self) ...@@ -852,7 +860,7 @@ toshoboe_numvalidrcvs (struct toshoboe_cb *self)
return ret; return ret;
} }
STATIC int static int
toshoboe_numrcvs (struct toshoboe_cb *self) toshoboe_numrcvs (struct toshoboe_cb *self)
{ {
int i, ret = 0; int i, ret = 0;
...@@ -863,7 +871,7 @@ toshoboe_numrcvs (struct toshoboe_cb *self) ...@@ -863,7 +871,7 @@ toshoboe_numrcvs (struct toshoboe_cb *self)
return ret; return ret;
} }
STATIC int static int
toshoboe_probe (struct toshoboe_cb *self) toshoboe_probe (struct toshoboe_cb *self)
{ {
int i, j, n; int i, j, n;
...@@ -1014,12 +1022,13 @@ toshoboe_probe (struct toshoboe_cb *self) ...@@ -1014,12 +1022,13 @@ toshoboe_probe (struct toshoboe_cb *self)
return 1; return 1;
} }
#endif
/******************************************************************/ /******************************************************************/
/* Netdev style code */ /* Netdev style code */
/* Transmit something */ /* Transmit something */
STATIC int static int
toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev) toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev)
{ {
struct toshoboe_cb *self; struct toshoboe_cb *self;
...@@ -1196,7 +1205,7 @@ dumpbufs(skb->data,skb->len,'>'); ...@@ -1196,7 +1205,7 @@ dumpbufs(skb->data,skb->len,'>');
} }
/*interrupt handler */ /*interrupt handler */
STATIC irqreturn_t static irqreturn_t
toshoboe_interrupt (int irq, void *dev_id, struct pt_regs *regs) toshoboe_interrupt (int irq, void *dev_id, struct pt_regs *regs)
{ {
struct toshoboe_cb *self = (struct toshoboe_cb *) dev_id; struct toshoboe_cb *self = (struct toshoboe_cb *) dev_id;
...@@ -1387,7 +1396,7 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<'); ...@@ -1387,7 +1396,7 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
return IRQ_HANDLED; return IRQ_HANDLED;
} }
STATIC int static int
toshoboe_net_init (struct net_device *dev) toshoboe_net_init (struct net_device *dev)
{ {
IRDA_DEBUG (4, "%s()\n", __FUNCTION__); IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
...@@ -1402,7 +1411,7 @@ toshoboe_net_init (struct net_device *dev) ...@@ -1402,7 +1411,7 @@ toshoboe_net_init (struct net_device *dev)
return 0; return 0;
} }
STATIC int static int
toshoboe_net_open (struct net_device *dev) toshoboe_net_open (struct net_device *dev)
{ {
struct toshoboe_cb *self; struct toshoboe_cb *self;
...@@ -1445,7 +1454,7 @@ toshoboe_net_open (struct net_device *dev) ...@@ -1445,7 +1454,7 @@ toshoboe_net_open (struct net_device *dev)
return 0; return 0;
} }
STATIC int static int
toshoboe_net_close (struct net_device *dev) toshoboe_net_close (struct net_device *dev)
{ {
struct toshoboe_cb *self; struct toshoboe_cb *self;
...@@ -1481,7 +1490,7 @@ toshoboe_net_close (struct net_device *dev) ...@@ -1481,7 +1490,7 @@ toshoboe_net_close (struct net_device *dev)
* Process IOCTL commands for this device * Process IOCTL commands for this device
* *
*/ */
STATIC int static int
toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
{ {
struct if_irda_req *irq = (struct if_irda_req *) rq; struct if_irda_req *irq = (struct if_irda_req *) rq;
...@@ -1546,10 +1555,12 @@ MODULE_LICENSE("GPL"); ...@@ -1546,10 +1555,12 @@ MODULE_LICENSE("GPL");
MODULE_PARM (max_baud, "i"); MODULE_PARM (max_baud, "i");
MODULE_PARM_DESC(max_baud, "Maximum baud rate"); MODULE_PARM_DESC(max_baud, "Maximum baud rate");
#ifdef USE_PROBE
MODULE_PARM (do_probe, "i"); MODULE_PARM (do_probe, "i");
MODULE_PARM_DESC(do_probe, "Enable/disable chip probing and self-test"); MODULE_PARM_DESC(do_probe, "Enable/disable chip probing and self-test");
#endif
STATIC void static void
toshoboe_close (struct pci_dev *pci_dev) toshoboe_close (struct pci_dev *pci_dev)
{ {
int i; int i;
...@@ -1588,7 +1599,7 @@ toshoboe_close (struct pci_dev *pci_dev) ...@@ -1588,7 +1599,7 @@ toshoboe_close (struct pci_dev *pci_dev)
return; return;
} }
STATIC int static int
toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid) toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
{ {
struct toshoboe_cb *self; struct toshoboe_cb *self;
...@@ -1711,12 +1722,15 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid) ...@@ -1711,12 +1722,15 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
goto freebufs; goto freebufs;
} }
#ifdef USE_PROBE
if (do_probe) if (do_probe)
if (!toshoboe_probe (self)) if (!toshoboe_probe (self))
{ {
err = -ENODEV; err = -ENODEV;
goto freebufs; goto freebufs;
} }
#endif
if (!(dev = dev_alloc ("irda%d", &err))) if (!(dev = dev_alloc ("irda%d", &err)))
{ {
...@@ -1770,7 +1784,7 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid) ...@@ -1770,7 +1784,7 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
return err; return err;
} }
STATIC int static int
toshoboe_gotosleep (struct pci_dev *pci_dev, u32 crap) toshoboe_gotosleep (struct pci_dev *pci_dev, u32 crap)
{ {
struct toshoboe_cb *self = (struct toshoboe_cb*)pci_get_drvdata(pci_dev); struct toshoboe_cb *self = (struct toshoboe_cb*)pci_get_drvdata(pci_dev);
...@@ -1799,7 +1813,7 @@ toshoboe_gotosleep (struct pci_dev *pci_dev, u32 crap) ...@@ -1799,7 +1813,7 @@ toshoboe_gotosleep (struct pci_dev *pci_dev, u32 crap)
return 0; return 0;
} }
STATIC int static int
toshoboe_wakeup (struct pci_dev *pci_dev) toshoboe_wakeup (struct pci_dev *pci_dev)
{ {
struct toshoboe_cb *self = (struct toshoboe_cb*)pci_get_drvdata(pci_dev); struct toshoboe_cb *self = (struct toshoboe_cb*)pci_get_drvdata(pci_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment