Commit 3dd09e50 authored by Linus Torvalds's avatar Linus Torvalds

Import 2.3.24pre2

parent 15305d2e
...@@ -5670,7 +5670,7 @@ CONFIG_EQUALIZER ...@@ -5670,7 +5670,7 @@ CONFIG_EQUALIZER
module, say M here and read Documentation/modules.txt. If unsure, module, say M here and read Documentation/modules.txt. If unsure,
say N. say N.
Ethertap network tap Ethertap network tap (EXPERIMENTAL)
CONFIG_ETHERTAP CONFIG_ETHERTAP
If you say Y here (and have said Y to "Kernel/User network link If you say Y here (and have said Y to "Kernel/User network link
driver", above) and create a character special file /dev/tap0 with driver", above) and create a character special file /dev/tap0 with
...@@ -6185,7 +6185,7 @@ CONFIG_WANPIPE_PPP ...@@ -6185,7 +6185,7 @@ CONFIG_WANPIPE_PPP
you say N, the PPP support will not be included in the driver (saves you say N, the PPP support will not be included in the driver (saves
about 16 KB of kernel memory). about 16 KB of kernel memory).
Cyclom 2X(tm) multiprotocol cards Cyclom 2X(tm) multiprotocol cards (EXPERIMENTAL)
CONFIG_CYCLADES_SYNC CONFIG_CYCLADES_SYNC
Cyclom 2X from Cyclades Corporation (http://www.cyclades.com and Cyclom 2X from Cyclades Corporation (http://www.cyclades.com and
http://www.cyclades.com.br ) is an intelligent multiprotocol WAN http://www.cyclades.com.br ) is an intelligent multiprotocol WAN
...@@ -6378,7 +6378,7 @@ CONFIG_NET_VENDOR_RACAL ...@@ -6378,7 +6378,7 @@ CONFIG_NET_VENDOR_RACAL
the questions about NI cards. If you say Y, you will be asked for the questions about NI cards. If you say Y, you will be asked for
your specific card in the following questions. your specific card in the following questions.
NI5010 support NI5010 support (EXPERIMENTAL)
CONFIG_NI5010 CONFIG_NI5010
If you have a network (Ethernet) card of this type, say Y and read If you have a network (Ethernet) card of this type, say Y and read
the Ethernet-HOWTO, available from the Ethernet-HOWTO, available from
...@@ -6983,7 +6983,7 @@ CONFIG_AC3200 ...@@ -6983,7 +6983,7 @@ CONFIG_AC3200
module, say M here and read Documentation/modules.txt as well as module, say M here and read Documentation/modules.txt as well as
Documentation/networking/net-modules.txt. Documentation/networking/net-modules.txt.
Mylex EISA LNE390A/LNE390B support Mylex EISA LNE390A/LNE390B support (EXPERIMENTAL)
CONFIG_LNE390 CONFIG_LNE390
If you have a network (Ethernet) card of this type, say Y and read If you have a network (Ethernet) card of this type, say Y and read
the Ethernet-HOWTO, available from the Ethernet-HOWTO, available from
...@@ -6995,7 +6995,7 @@ CONFIG_LNE390 ...@@ -6995,7 +6995,7 @@ CONFIG_LNE390
module, say M here and read Documentation/modules.txt as well as module, say M here and read Documentation/modules.txt as well as
Documentation/networking/net-modules.txt. Documentation/networking/net-modules.txt.
Novell/Eagle/Microdyne NE3210 EISA support Novell/Eagle/Microdyne NE3210 EISA support (EXPERIMENTAL)
CONFIG_NE3210 CONFIG_NE3210
If you have a network (Ethernet) card of this type, say Y and read If you have a network (Ethernet) card of this type, say Y and read
the Ethernet-HOWTO, available from the Ethernet-HOWTO, available from
...@@ -7080,7 +7080,7 @@ CONFIG_EEXPRESS_PRO100 ...@@ -7080,7 +7080,7 @@ CONFIG_EEXPRESS_PRO100
module, say M here and read Documentation/modules.txt as well as module, say M here and read Documentation/modules.txt as well as
Documentation/networking/net-modules.txt. Documentation/networking/net-modules.txt.
ICL EtherTeam 16i/32 support ICL EtherTeam 16i/32 support (EXPERIMENTAL)
CONFIG_ETH16I CONFIG_ETH16I
If you have a network (Ethernet) card of this type, say Y and read If you have a network (Ethernet) card of this type, say Y and read
the Ethernet-HOWTO, available from the Ethernet-HOWTO, available from
...@@ -7122,7 +7122,7 @@ CONFIG_VIA_RHINE ...@@ -7122,7 +7122,7 @@ CONFIG_VIA_RHINE
a module, say M here and read Documentation/modules.txt as well as a module, say M here and read Documentation/modules.txt as well as
Documentation/networking/net-modules.txt. Documentation/networking/net-modules.txt.
Racal-Interlan EISA ES3210 support Racal-Interlan EISA ES3210 support (EXPERIMENTAL)
CONFIG_ES3210 CONFIG_ES3210
If you have a network (Ethernet) card of this type, say Y and read If you have a network (Ethernet) card of this type, say Y and read
the Ethernet-HOWTO, available from the Ethernet-HOWTO, available from
...@@ -7151,7 +7151,7 @@ CONFIG_SGISEEQ ...@@ -7151,7 +7151,7 @@ CONFIG_SGISEEQ
Say Y here if you have an Seeq based Ethernet network card. This is Say Y here if you have an Seeq based Ethernet network card. This is
used in many Silicon Graphics machines. used in many Silicon Graphics machines.
Zenith Z-Note support Zenith Z-Note support (EXPERIMENTAL)
CONFIG_ZNET CONFIG_ZNET
The Zenith Z-Note notebook computer has a built-in network The Zenith Z-Note notebook computer has a built-in network
(Ethernet) card, and this is the Linux driver for it. Note that the (Ethernet) card, and this is the Linux driver for it. Note that the
...@@ -7650,7 +7650,7 @@ CONFIG_QUOTA ...@@ -7650,7 +7650,7 @@ CONFIG_QUOTA
http://metalab.unc.edu/mdw/linux.html#howto . Probably the quota http://metalab.unc.edu/mdw/linux.html#howto . Probably the quota
support is only useful for multi user systems. If unsure, say N. support is only useful for multi user systems. If unsure, say N.
Support for USB (EXPERIMENTAL!) Support for USB (EXPERIMENTAL)
CONFIG_USB CONFIG_USB
Universal Serial Bus (USB) is a specification for a serial bus Universal Serial Bus (USB) is a specification for a serial bus
system which offers higher speeds and more features than the system which offers higher speeds and more features than the
...@@ -7802,6 +7802,16 @@ CONFIG_USB_ACM ...@@ -7802,6 +7802,16 @@ CONFIG_USB_ACM
The module will be called acm.o. If you want to compile it as a The module will be called acm.o. If you want to compile it as a
module, say M here and read Documentation/modules.txt. module, say M here and read Documentation/modules.txt.
USB Belkin and Peracom serial support
CONFIG_USB_SERIAL
Say Y here if you want to connect a Belkin, Peracom, or eTek
single port USB to serial converter.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called usb-serial.o. If you want to compile it
as a module, say M here and read Documentation/modules.txt.
USB Printer support USB Printer support
CONFIG_USB_PRINTER CONFIG_USB_PRINTER
Say Y here if you want to connect a printer to your computer's USB Say Y here if you want to connect a printer to your computer's USB
...@@ -8203,7 +8213,7 @@ CONFIG_NFSD_SUN ...@@ -8203,7 +8213,7 @@ CONFIG_NFSD_SUN
directories that are mount points on the local filesystem (this is directories that are mount points on the local filesystem (this is
how nfsd behaves on Sun systems), say Y here. If unsure, say N. how nfsd behaves on Sun systems), say Y here. If unsure, say N.
OS/2 HPFS filesystem support (read only) OS/2 HPFS filesystem support
CONFIG_HPFS_FS CONFIG_HPFS_FS
OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS
is the filesystem used for organizing files on OS/2 hard disk is the filesystem used for organizing files on OS/2 hard disk
...@@ -8230,7 +8240,7 @@ CONFIG_NTFS_FS ...@@ -8230,7 +8240,7 @@ CONFIG_NTFS_FS
The module will be called ntfs.o. If you want to compile it as a The module will be called ntfs.o. If you want to compile it as a
module, say M here and read Documentation/modules.txt. module, say M here and read Documentation/modules.txt.
NTFS read-write support (EXPERIMENTAL) NTFS write support (DANGEROUS)
CONFIG_NTFS_RW CONFIG_NTFS_RW
If you say Y here, you will (hopefully) be able to write to NTFS If you say Y here, you will (hopefully) be able to write to NTFS
file systems as well as read from them. The read-write support file systems as well as read from them. The read-write support
...@@ -8265,7 +8275,7 @@ CONFIG_SYSV_FS ...@@ -8265,7 +8275,7 @@ CONFIG_SYSV_FS
tar" or preferably "info tar"). Note also that this option has tar" or preferably "info tar"). Note also that this option has
nothing whatsoever to do with the option "System V IPC". Read about nothing whatsoever to do with the option "System V IPC". Read about
the System V filesystem in Documentation/filesystems/sysv-fs.txt. the System V filesystem in Documentation/filesystems/sysv-fs.txt.
Saying Y here will enlarge your kernel by about 34 KB. Saying Y here will enlarge your kernel by about 27 kB.
If you want to compile this as a module ( = code which can be If you want to compile this as a module ( = code which can be
inserted in and removed from the running kernel whenever you want), inserted in and removed from the running kernel whenever you want),
...@@ -8322,7 +8332,7 @@ CONFIG_ROMFS_FS ...@@ -8322,7 +8332,7 @@ CONFIG_ROMFS_FS
If you don't know whether you need it, then you don't need it: If you don't know whether you need it, then you don't need it:
answer N. answer N.
QNX filesystem support (EXPERIMENTAL) QNX filesystem support (read only) (EXPERIMENTAL)
CONFIG_QNX4FS_FS CONFIG_QNX4FS_FS
This is the filesystem used by the operating system QNX 4. Say Y if This is the filesystem used by the operating system QNX 4. Say Y if
you intend to mount QNX hard disks or floppies. Unless you say Y to you intend to mount QNX hard disks or floppies. Unless you say Y to
...@@ -8336,7 +8346,7 @@ CONFIG_QNX4FS_FS ...@@ -8336,7 +8346,7 @@ CONFIG_QNX4FS_FS
If unsure, say N. If unsure, say N.
QNXFS read-write support (FOR TESTING ONLY) QNXFS write support (DANGEROUS)
CONFIG_QNX4FS_RW CONFIG_QNX4FS_RW
Say Y if you want to test write support for QNX filesystems. Say Y if you want to test write support for QNX filesystems.
...@@ -9289,7 +9299,7 @@ CONFIG_ESPSERIAL ...@@ -9289,7 +9299,7 @@ CONFIG_ESPSERIAL
and read Documentation/modules.txt. The module will be called esp.o. and read Documentation/modules.txt. The module will be called esp.o.
If unsure, say N. If unsure, say N.
Multi-Tech multiport card support Multi-Tech multiport card support (EXPERIMENTAL)
CONFIG_ISI CONFIG_ISI
This is a driver for the Multi-Tech cards which provide several This is a driver for the Multi-Tech cards which provide several
serial ports. The driver is experimental and can currently only be serial ports. The driver is experimental and can currently only be
...@@ -9459,9 +9469,9 @@ CONFIG_82C710_MOUSE ...@@ -9459,9 +9469,9 @@ CONFIG_82C710_MOUSE
PC110 digitizer pad support PC110 digitizer pad support
CONFIG_PC110_PAD CONFIG_PC110_PAD
This drives the digitizer pad on the IBM PC110 palmtop (see This drives the digitizer pad on the IBM PC110 palmtop. It can turn
http://toy.cabi.net ). It can turn the digitizer pad into a PS/2 the digitizer pad into a PS/2 mouse emulation with tap gestures or
mouse emulation with tap gestures or into an absolute pad. into an absolute pad.
If you want to compile this as a module ( = code which can be If you want to compile this as a module ( = code which can be
inserted in and removed from the running kernel whenever you want), inserted in and removed from the running kernel whenever you want),
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
* Cleaned up cache-detection code * Cleaned up cache-detection code
* Dave Jones <dave@powertweak.com>, October 1999 * Dave Jones <dave@powertweak.com>, October 1999
* *
* Added proper L2 cache detection for Coppermine
* Dragan Stancevic <visitor@valinux.com>, October 1999
*/ */
/* /*
...@@ -1237,6 +1239,7 @@ void __init identify_cpu(struct cpuinfo_x86 *c) ...@@ -1237,6 +1239,7 @@ void __init identify_cpu(struct cpuinfo_x86 *c)
break; break;
case 0x42: case 0x42:
case 0x82: /*Detect 256-Kbyte cache on Coppermine*/
c->x86_cache_size = 256; c->x86_cache_size = 256;
break; break;
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/blkpg.h> #include <linux/blkpg.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/hdreg.h> #include <linux/hdreg.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -703,6 +704,26 @@ static ulong remap_pci_mem(ulong base, ulong size) ...@@ -703,6 +704,26 @@ static ulong remap_pci_mem(ulong base, ulong size)
return (ulong) (page_remapped ? (page_remapped + page_offs) : 0UL); return (ulong) (page_remapped ? (page_remapped + page_offs) : 0UL);
} }
#ifndef MODULE
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
/*
* Config string is a comma seperated set of i/o addresses of EISA cards.
*/
static int cpqarray_setup(char *str)
{
int i, ints[9];
(void)get_options(str, ARRAY_SIZE(ints), ints);
for(i=0; i<ints[0] && i<8; i++)
eisa[i] = ints[i+1];
return 1;
}
__setup("smart2=", cpqarray_setup);
#else
/* /*
* Copy the contents of the ints[] array passed to us by init. * Copy the contents of the ints[] array passed to us by init.
*/ */
...@@ -712,6 +733,8 @@ void cpqarray_setup(char *str, int *ints) ...@@ -712,6 +733,8 @@ void cpqarray_setup(char *str, int *ints)
for(i=0; i<ints[0] && i<8; i++) for(i=0; i<ints[0] && i<8; i++)
eisa[i] = ints[i+1]; eisa[i] = ints[i+1];
} }
#endif
#endif
/* /*
* Find an EISA controller's signature. Set up an hba if we find it. * Find an EISA controller's signature. Set up an hba if we find it.
......
...@@ -286,15 +286,39 @@ void set_device_ro(kdev_t dev,int flag) ...@@ -286,15 +286,39 @@ void set_device_ro(kdev_t dev,int flag)
else ro_bits[major][minor >> 5] &= ~(1 << (minor & 31)); else ro_bits[major][minor >> 5] &= ~(1 << (minor & 31));
} }
static inline void drive_stat_acct(int cmd, unsigned long nr_sectors, static inline void drive_stat_acct(struct request *req,
short disk_index) unsigned long nr_sectors, int new_io)
{ {
kstat.dk_drive[disk_index]++; int major = MAJOR(req->rq_dev);
if (cmd == READ) { int minor = MINOR(req->rq_dev);
kstat.dk_drive_rio[disk_index]++; unsigned int disk_index;
switch (major) {
case DAC960_MAJOR+0:
disk_index = (minor & 0x00f8) >> 3;
break;
case SCSI_DISK0_MAJOR:
disk_index = (minor & 0x00f0) >> 4;
break;
case IDE0_MAJOR: /* same as HD_MAJOR */
case XT_DISK_MAJOR:
disk_index = (minor & 0x0040) >> 6;
break;
case IDE1_MAJOR:
disk_index = ((minor & 0x0040) >> 6) + 2;
break;
default:
return;
}
if (disk_index >= DK_NDRIVE)
return;
kstat.dk_drive[disk_index] += new_io;
if (req->cmd == READ) {
kstat.dk_drive_rio[disk_index] += new_io;
kstat.dk_drive_rblk[disk_index] += nr_sectors; kstat.dk_drive_rblk[disk_index] += nr_sectors;
} else if (cmd == WRITE) { } else if (req->cmd == WRITE) {
kstat.dk_drive_wio[disk_index]++; kstat.dk_drive_wio[disk_index] += new_io;
kstat.dk_drive_wblk[disk_index] += nr_sectors; kstat.dk_drive_wblk[disk_index] += nr_sectors;
} else } else
printk(KERN_ERR "drive_stat_acct: cmd not R/W?\n"); printk(KERN_ERR "drive_stat_acct: cmd not R/W?\n");
...@@ -313,35 +337,11 @@ static inline void drive_stat_acct(int cmd, unsigned long nr_sectors, ...@@ -313,35 +337,11 @@ static inline void drive_stat_acct(int cmd, unsigned long nr_sectors,
void add_request(struct blk_dev_struct * dev, struct request * req) void add_request(struct blk_dev_struct * dev, struct request * req)
{ {
int major = MAJOR(req->rq_dev); int major = MAJOR(req->rq_dev);
int minor = MINOR(req->rq_dev);
struct request * tmp, **current_request; struct request * tmp, **current_request;
short disk_index;
unsigned long flags; unsigned long flags;
int queue_new_request = 0; int queue_new_request = 0;
switch (major) { drive_stat_acct(req, req->nr_sectors, 1);
case DAC960_MAJOR+0:
disk_index = (minor & 0x00f8) >> 3;
if (disk_index < 4)
drive_stat_acct(req->cmd, req->nr_sectors, disk_index);
break;
case SCSI_DISK0_MAJOR:
disk_index = (minor & 0x00f0) >> 4;
if (disk_index < 4)
drive_stat_acct(req->cmd, req->nr_sectors, disk_index);
break;
case IDE0_MAJOR: /* same as HD_MAJOR */
case XT_DISK_MAJOR:
disk_index = (minor & 0x0040) >> 6;
drive_stat_acct(req->cmd, req->nr_sectors, disk_index);
break;
case IDE1_MAJOR:
disk_index = ((minor & 0x0040) >> 6) + 2;
drive_stat_acct(req->cmd, req->nr_sectors, disk_index);
default:
break;
}
req->next = NULL; req->next = NULL;
/* /*
...@@ -575,6 +575,7 @@ void make_request(int major,int rw, struct buffer_head * bh) ...@@ -575,6 +575,7 @@ void make_request(int major,int rw, struct buffer_head * bh)
req->bhtail->b_reqnext = bh; req->bhtail->b_reqnext = bh;
req->bhtail = bh; req->bhtail = bh;
req->nr_sectors += count; req->nr_sectors += count;
drive_stat_acct(req, count, 0);
/* Can we now merge this req with the next? */ /* Can we now merge this req with the next? */
attempt_merge(req, max_sectors); attempt_merge(req, max_sectors);
/* or to the beginning? */ /* or to the beginning? */
...@@ -585,6 +586,7 @@ void make_request(int major,int rw, struct buffer_head * bh) ...@@ -585,6 +586,7 @@ void make_request(int major,int rw, struct buffer_head * bh)
req->current_nr_sectors = count; req->current_nr_sectors = count;
req->sector = sector; req->sector = sector;
req->nr_sectors += count; req->nr_sectors += count;
drive_stat_acct(req, count, 0);
} else } else
continue; continue;
......
...@@ -703,7 +703,7 @@ static int i2ob_release(struct inode *inode, struct file *file) ...@@ -703,7 +703,7 @@ static int i2ob_release(struct inode *inode, struct file *file)
msg[2] = i2ob_context|0x80000000; msg[2] = i2ob_context|0x80000000;
msg[3] = (u32)query_done; msg[3] = (u32)query_done;
msg[4] = 60<<16; msg[4] = 60<<16;
i2o_post_wait(dev->controller, dev->tid, msg, 20, query_done,2); i2o_post_wait(dev->controller, msg, 20, 2);
/* /*
* Unlock the media * Unlock the media
*/ */
...@@ -712,7 +712,7 @@ static int i2ob_release(struct inode *inode, struct file *file) ...@@ -712,7 +712,7 @@ static int i2ob_release(struct inode *inode, struct file *file)
msg[2] = i2ob_context|0x80000000; msg[2] = i2ob_context|0x80000000;
msg[3] = (u32)query_done; msg[3] = (u32)query_done;
msg[4] = -1; msg[4] = -1;
i2o_post_wait(dev->controller, dev->tid, msg, 20, query_done,2); i2o_post_wait(dev->controller, msg, 20, 2);
/* /*
* Now unclaim the device. * Now unclaim the device.
...@@ -766,7 +766,7 @@ static int i2ob_open(struct inode *inode, struct file *file) ...@@ -766,7 +766,7 @@ static int i2ob_open(struct inode *inode, struct file *file)
msg[3] = (u32)query_done; msg[3] = (u32)query_done;
msg[4] = -1; msg[4] = -1;
msg[5] = 0; msg[5] = 0;
i2o_post_wait(dev->controller, dev->tid, msg, 24, query_done,2); i2o_post_wait(dev->controller, msg, 24, 2);
/* /*
* Lock the media * Lock the media
*/ */
...@@ -775,7 +775,7 @@ static int i2ob_open(struct inode *inode, struct file *file) ...@@ -775,7 +775,7 @@ static int i2ob_open(struct inode *inode, struct file *file)
msg[2] = i2ob_context|0x80000000; msg[2] = i2ob_context|0x80000000;
msg[3] = (u32)query_done; msg[3] = (u32)query_done;
msg[4] = -1; msg[4] = -1;
i2o_post_wait(dev->controller, dev->tid, msg, 20, query_done,2); i2o_post_wait(dev->controller, msg, 20, 2);
} }
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
return 0; return 0;
...@@ -788,8 +788,8 @@ static int i2ob_open(struct inode *inode, struct file *file) ...@@ -788,8 +788,8 @@ static int i2ob_open(struct inode *inode, struct file *file)
static int i2ob_query_device(struct i2ob_device *dev, int table, static int i2ob_query_device(struct i2ob_device *dev, int table,
int field, void *buf, int buflen) int field, void *buf, int buflen)
{ {
return i2o_query_scalar(dev->controller, dev->tid, i2ob_context, return i2o_query_scalar(dev->controller, dev->tid,
table, field, buf, buflen, &dev->done_flag); table, field, buf, buflen);
} }
...@@ -891,7 +891,10 @@ static void i2ob_probe(void) ...@@ -891,7 +891,10 @@ static void i2ob_probe(void)
for(d=c->devices;d!=NULL;d=d->next) for(d=c->devices;d!=NULL;d=d->next)
{ {
if(d->class!=I2O_CLASS_RANDOM_BLOCK_STORAGE) if(d->lct_data->class_id!=I2O_CLASS_RANDOM_BLOCK_STORAGE)
continue;
if(d->lct_data->user_tid != 0xFFF)
continue; continue;
if(unit<MAX_I2OB<<4) if(unit<MAX_I2OB<<4)
...@@ -903,7 +906,7 @@ static void i2ob_probe(void) ...@@ -903,7 +906,7 @@ static void i2ob_probe(void)
struct i2ob_device *dev=&i2ob_dev[unit]; struct i2ob_device *dev=&i2ob_dev[unit];
dev->i2odev = d; dev->i2odev = d;
dev->controller = c; dev->controller = c;
dev->tid = d->id; dev->tid = d->lct_data->tid;
/* /*
* Insure the device can be claimed * Insure the device can be claimed
...@@ -930,9 +933,10 @@ static void i2ob_probe(void) ...@@ -930,9 +933,10 @@ static void i2ob_probe(void)
else else
{ {
if(!warned++) if(!warned++)
printk("i2o_block: too many controllers, registering only %d.\n", unit>>4); printk("i2o_block: too many device, registering only %d.\n", unit>>4);
} }
} }
i2o_unlock_controller(c);
} }
i2ob_devices = unit; i2ob_devices = unit;
} }
...@@ -981,7 +985,7 @@ static int i2ob_reboot_event(struct notifier_block *n, unsigned long code, void ...@@ -981,7 +985,7 @@ static int i2ob_reboot_event(struct notifier_block *n, unsigned long code, void
msg[2] = i2ob_context|0x80000000; msg[2] = i2ob_context|0x80000000;
msg[3] = (u32)query_done; msg[3] = (u32)query_done;
msg[4] = 60<<16; msg[4] = 60<<16;
i2o_post_wait(dev->controller, dev->tid, msg, 20, query_done,2); i2o_post_wait(dev->controller, msg, 20, 2);
/* /*
* Unlock the media * Unlock the media
*/ */
...@@ -990,7 +994,7 @@ static int i2ob_reboot_event(struct notifier_block *n, unsigned long code, void ...@@ -990,7 +994,7 @@ static int i2ob_reboot_event(struct notifier_block *n, unsigned long code, void
msg[2] = i2ob_context|0x80000000; msg[2] = i2ob_context|0x80000000;
msg[3] = (u32)query_done; msg[3] = (u32)query_done;
msg[4] = -1; msg[4] = -1;
i2o_post_wait(dev->controller, dev->tid, msg, 20, query_done,2); i2o_post_wait(dev->controller, msg, 20, 2);
} }
} }
return NOTIFY_DONE; return NOTIFY_DONE;
...@@ -1058,7 +1062,7 @@ int i2o_block_init(void) ...@@ -1058,7 +1062,7 @@ int i2o_block_init(void)
{ {
int i; int i;
printk(KERN_INFO "I2O block device OSM v0.07. (C) 1999 Red Hat Software.\n"); printk(KERN_INFO "I2O Block Storage OSM v0.07. (C) 1999 Red Hat Software.\n");
/* /*
* Register the block device interfaces * Register the block device interfaces
......
...@@ -317,14 +317,14 @@ static int ioctl_parms(unsigned long arg, unsigned int type) ...@@ -317,14 +317,14 @@ static int ioctl_parms(unsigned long arg, unsigned int type)
return -ENOMEM; return -ENOMEM;
} }
len = i2o_issue_params(i2o_cmd, c, kcmd.tid, cfg_handler.context, len = i2o_issue_params(i2o_cmd, c, kcmd.tid,
ops, kcmd.oplen, res, 65536, &i2o_cfg_token); ops, kcmd.oplen, res, 65536);
i2o_unlock_controller(c); i2o_unlock_controller(c);
kfree(ops); kfree(ops);
if (len < 0) { if (len) {
kfree(res); kfree(res);
return len; /* -DetailedStatus */ return len; /* -DetailedStatus || -ETIMEDOUT */
} }
put_user(len, kcmd.reslen); put_user(len, kcmd.reslen);
...@@ -413,8 +413,8 @@ int ioctl_html(unsigned long arg) ...@@ -413,8 +413,8 @@ int ioctl_html(unsigned long arg)
msg[8] = virt_to_phys(query); msg[8] = virt_to_phys(query);
} }
token = i2o_post_wait(c, cmd->tid, msg, 9*4, &i2o_cfg_token, 10); token = i2o_post_wait(c, msg, 9*4, 10);
if(token != I2O_POST_WAIT_OK) if(token)
{ {
i2o_unlock_controller(c); i2o_unlock_controller(c);
kfree(res); kfree(res);
...@@ -531,8 +531,8 @@ int ioctl_swdl(unsigned long arg) ...@@ -531,8 +531,8 @@ int ioctl_swdl(unsigned long arg)
// Yes...that's one minute, but the spec states that // Yes...that's one minute, but the spec states that
// transfers take a long time, and I've seen just how // transfers take a long time, and I've seen just how
// long they can take. // long they can take.
token = i2o_post_wait(c, ADAPTER_TID, msg, sizeof(msg), &i2o_cfg_token,60); token = i2o_post_wait(c, msg, sizeof(msg), 60);
if (token != I2O_POST_WAIT_OK ) // Something very wrong if (token) // Something very wrong
{ {
i2o_unlock_controller(c); i2o_unlock_controller(c);
printk("Timeout downloading software"); printk("Timeout downloading software");
...@@ -547,8 +547,8 @@ int ioctl_swdl(unsigned long arg) ...@@ -547,8 +547,8 @@ int ioctl_swdl(unsigned long arg)
msg[4] |= (u32)maxfrag; msg[4] |= (u32)maxfrag;
msg[7] = (0xD0000000 | diff); msg[7] = (0xD0000000 | diff);
__copy_from_user(buffer, kxfer.buf, 8192); __copy_from_user(buffer, kxfer.buf, 8192);
token = i2o_post_wait(c, ADAPTER_TID, msg, sizeof(msg), &i2o_cfg_token,60); token = i2o_post_wait(c, msg, sizeof(msg), 60);
if( token != I2O_POST_WAIT_OK ) // Something very wrong if(token) // Something very wrong
{ {
i2o_unlock_controller(c); i2o_unlock_controller(c);
printk("Timeout downloading software"); printk("Timeout downloading software");
...@@ -588,10 +588,10 @@ int ioctl_validate(unsigned long arg) ...@@ -588,10 +588,10 @@ int ioctl_validate(unsigned long arg)
msg[2] = (u32)i2o_cfg_context; msg[2] = (u32)i2o_cfg_context;
msg[3] = 0; msg[3] = 0;
token = i2o_post_wait(c, ADAPTER_TID, msg, sizeof(msg),&i2o_cfg_token, 10); token = i2o_post_wait(c, msg, sizeof(msg), 10);
i2o_unlock_controller(c); i2o_unlock_controller(c);
if (token != I2O_POST_WAIT_OK) if (token)
{ {
printk("Can't validate configuration, ErrorStatus = %d\n", printk("Can't validate configuration, ErrorStatus = %d\n",
token); token);
......
This diff is collapsed.
This diff is collapsed.
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#include <linux/malloc.h> #include <linux/malloc.h>
#include <asm/io.h> #include <asm/io.h>
#ifdef CONFIG_MTRR
#include <asm/mtrr.h>
#endif // CONFIG_MTRR
#ifdef MODULE #ifdef MODULE
/* /*
* Core function table * Core function table
...@@ -46,6 +50,11 @@ static void i2o_pci_dispose(struct i2o_controller *c) ...@@ -46,6 +50,11 @@ static void i2o_pci_dispose(struct i2o_controller *c)
if(c->bus.pci.irq > 0) if(c->bus.pci.irq > 0)
free_irq(c->bus.pci.irq, c); free_irq(c->bus.pci.irq, c);
iounmap(((u8 *)c->post_port)-0x40); iounmap(((u8 *)c->post_port)-0x40);
#ifdef CONFIG_MTRR
if(c->bus.pci.mtrr_reg > 0)
mtrr_del(c->bus.pci.mtrr_reg, 0, 0);
#endif
} }
/* /*
...@@ -65,6 +74,19 @@ static int i2o_pci_unbind(struct i2o_controller *c, struct i2o_device *dev) ...@@ -65,6 +74,19 @@ static int i2o_pci_unbind(struct i2o_controller *c, struct i2o_device *dev)
return 0; return 0;
} }
/*
* Bus specific enable/disable functions
*/
static void i2o_pci_enable(struct i2o_controller *c)
{
I2O_IRQ_WRITE32(c, 0);
}
static void i2o_pci_disable(struct i2o_controller *c)
{
I2O_IRQ_WRITE32(c, 0xFFFFFFFF);
}
/* /*
* Bus specific interrupt handler * Bus specific interrupt handler
*/ */
...@@ -81,8 +103,9 @@ static void i2o_pci_interrupt(int irq, void *dev_id, struct pt_regs *r) ...@@ -81,8 +103,9 @@ static void i2o_pci_interrupt(int irq, void *dev_id, struct pt_regs *r)
/* /*
* Install a PCI (or in theory AGP) i2o controller * Install a PCI (or in theory AGP) i2o controller
*
* TODO: Add support for polled controllers
*/ */
int __init i2o_pci_install(struct pci_dev *dev) int __init i2o_pci_install(struct pci_dev *dev)
{ {
struct i2o_controller *c=kmalloc(sizeof(struct i2o_controller), struct i2o_controller *c=kmalloc(sizeof(struct i2o_controller),
...@@ -141,9 +164,19 @@ int __init i2o_pci_install(struct pci_dev *dev) ...@@ -141,9 +164,19 @@ int __init i2o_pci_install(struct pci_dev *dev)
c->bind = i2o_pci_bind; c->bind = i2o_pci_bind;
c->unbind = i2o_pci_unbind; c->unbind = i2o_pci_unbind;
c->bus_enable = i2o_pci_enable;
c->bus_disable = i2o_pci_disable;
c->type = I2O_TYPE_PCI; c->type = I2O_TYPE_PCI;
/*
* Enable Write Combining MTRR for IOP's memory region
*/
#ifdef CONFIG_MTRR
c->bus.pci.mtrr_reg =
mtrr_add(c->mem_phys, size, MTRR_TYPE_WRCOMB, 1);
#endif
I2O_IRQ_WRITE32(c,0xFFFFFFFF); I2O_IRQ_WRITE32(c,0xFFFFFFFF);
#ifdef MODULE #ifdef MODULE
...@@ -180,6 +213,9 @@ int __init i2o_pci_install(struct pci_dev *dev) ...@@ -180,6 +213,9 @@ int __init i2o_pci_install(struct pci_dev *dev)
return -EBUSY; return -EBUSY;
} }
} }
printk(KERN_INFO "Installed iop%d at IRQ%d\n", c->unit, dev->irq);
I2O_IRQ_WRITE32(c,0x0);
return 0; return 0;
} }
...@@ -211,55 +247,20 @@ int __init i2o_pci_scan(void) ...@@ -211,55 +247,20 @@ int __init i2o_pci_scan(void)
return count?count:-ENODEV; return count?count:-ENODEV;
} }
static void i2o_pci_unload(void) #ifdef I2O_HOTPLUG_SUPPORT
{ /*
int i=0; * Activate a newly found PCI I2O controller
struct i2o_controller *c; * Not used now, but will be needed in future for
* hot plug PCI support
for(i = 0; i < MAX_I2O_CONTROLLERS; i++) */
{ static void i2o_pci_activate(i2o_controller * c)
#ifdef MODULE
c=core->find(i);
#else
c=i2o_find_controller(i);
#endif /* MODULE */
if(c==NULL)
continue;
#ifdef MODULE
core->unlock(c);
#else
i2o_unlock_controller(c);
#endif /* MODULE */
if(c->type == I2O_TYPE_PCI)
#ifdef MODULE
core->delete(c);
#else
i2o_delete_controller(c);
#endif /* MODULE */
}
}
static void i2o_pci_activate(void)
{ {
int i=0; int i=0;
struct i2o_controller *c; struct i2o_controller *c;
for(i = 0; i < MAX_I2O_CONTROLLERS; i++)
{
#ifdef MODULE
c=core->find(i);
#else
c=i2o_find_controller(i);
#endif /* MODULE */
if(c==NULL)
continue;
if(c->type == I2O_TYPE_PCI) if(c->type == I2O_TYPE_PCI)
{ {
I2O_IRQ_WRITE32(c,0);
#ifdef MODULE #ifdef MODULE
if(core->activate(c)) if(core->activate(c))
#else #else
...@@ -276,37 +277,24 @@ static void i2o_pci_activate(void) ...@@ -276,37 +277,24 @@ static void i2o_pci_activate(void)
#endif #endif
continue; continue;
} }
I2O_IRQ_WRITE32(c,0);
}
#ifdef MODULE
core->unlock(c);
#else
i2o_unlock_controller(c);
#endif
} }
} }
#endif // I2O_HOTPLUG_SUPPORT
#ifdef MODULE #ifdef MODULE
int i2o_pci_core_attach(struct i2o_core_func_table *table) int i2o_pci_core_attach(struct i2o_core_func_table *table)
{ {
int i;
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
core = table; core = table;
if((i = i2o_pci_scan())<0) return i2o_pci_scan();
return -ENODEV;
i2o_pci_activate();
return i;
} }
void i2o_pci_core_detach(void) void i2o_pci_core_detach(void)
{ {
i2o_pci_unload(); core = NULL;
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
} }
...@@ -315,15 +303,7 @@ int init_module(void) ...@@ -315,15 +303,7 @@ int init_module(void)
{ {
printk(KERN_INFO "Linux I2O PCI support (c) 1999 Red Hat Software.\n"); printk(KERN_INFO "Linux I2O PCI support (c) 1999 Red Hat Software.\n");
/* core = NULL;
* Let the core call the scan function for module dependency
* reasons. See include/linux/i2o.h for the reason why this
* is done.
*
* if(i2o_pci_scan()<0)
* return -ENODEV;
* i2o_pci_activate();
*/
return 0; return 0;
...@@ -343,9 +323,6 @@ MODULE_DESCRIPTION("I2O PCI Interface"); ...@@ -343,9 +323,6 @@ MODULE_DESCRIPTION("I2O PCI Interface");
void __init i2o_pci_init(void) void __init i2o_pci_init(void)
{ {
printk(KERN_INFO "Linux I2O PCI support (c) 1999 Red Hat Software.\n"); printk(KERN_INFO "Linux I2O PCI support (c) 1999 Red Hat Software.\n");
if(i2o_pci_scan()>=0) i2o_pci_scan();
{
i2o_pci_activate();
}
} }
#endif #endif
This diff is collapsed.
...@@ -301,14 +301,12 @@ static int i2o_find_lun(struct i2o_controller *c, struct i2o_device *d, int *tar ...@@ -301,14 +301,12 @@ static int i2o_find_lun(struct i2o_controller *c, struct i2o_device *d, int *tar
{ {
u8 reply[8]; u8 reply[8];
if(i2o_query_scalar(c, d->id, scsi_context|0x40000000, if(i2o_query_scalar(c, d->lct_data->tid, 0, 3, reply, 4))
0, 3, reply, 4, &lun_done)<0)
return -1; return -1;
*target=reply[0]; *target=reply[0];
if(i2o_query_scalar(c, d->id, scsi_context|0x40000000, if(i2o_query_scalar(c, d->lct_data->tid, 0, 4, reply, 8))
0, 4, reply, 8, &lun_done)<0)
return -1; return -1;
*lun=reply[1]; *lun=reply[1];
...@@ -325,7 +323,7 @@ void i2o_scsi_init(struct i2o_controller *c, struct i2o_device *d, struct Scsi_H ...@@ -325,7 +323,7 @@ void i2o_scsi_init(struct i2o_controller *c, struct i2o_device *d, struct Scsi_H
int target; int target;
h->controller=c; h->controller=c;
h->bus_task=d->id; h->bus_task=d->lct_data->tid;
for(target=0;target<16;target++) for(target=0;target<16;target++)
for(lun=0;lun<8;lun++) for(lun=0;lun<8;lun++)
...@@ -334,34 +332,33 @@ void i2o_scsi_init(struct i2o_controller *c, struct i2o_device *d, struct Scsi_H ...@@ -334,34 +332,33 @@ void i2o_scsi_init(struct i2o_controller *c, struct i2o_device *d, struct Scsi_H
for(unit=c->devices;unit!=NULL;unit=unit->next) for(unit=c->devices;unit!=NULL;unit=unit->next)
{ {
dprintk(("Class %03X, parent %d, want %d.\n", dprintk(("Class %03X, parent %d, want %d.\n",
unit->class, unit->parent, d->id)); unit->lct_data->class_id, unit->lct_data->parent, d->lct_data->tid));
/* Only look at scsi and fc devices */ /* Only look at scsi and fc devices */
if ( (unit->class != I2O_CLASS_SCSI_PERIPHERAL) if ( (unit->lct_data->class_id != I2O_CLASS_SCSI_PERIPHERAL)
&& (unit->class != I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL) && (unit->lct_data->class_id != I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL)
) )
continue; continue;
/* On our bus ? */ /* On our bus ? */
dprintk(("Found a disk.\n")); dprintk(("Found a disk.\n"));
if ( (unit->parent == d->id) if ((unit->lct_data->parent_tid == d->lct_data->tid)
|| (unit->parent == d->parent) || (unit->lct_data->parent_tid == d->lct_data->parent_tid)
) )
{ {
u16 limit; u16 limit;
dprintk(("Its ours.\n")); dprintk(("Its ours.\n"));
if(i2o_find_lun(c, unit, &target, &lun)==-1) if(i2o_find_lun(c, unit, &target, &lun)==-1)
{ {
printk(KERN_ERR "i2o_scsi: Unable to get lun for tid %d.\n", d->id); printk(KERN_ERR "i2o_scsi: Unable to get lun for tid %d.\n", d->lct_data->tid);
continue; continue;
} }
dprintk(("Found disk %d %d.\n", target, lun)); dprintk(("Found disk %d %d.\n", target, lun));
h->task[target][lun]=unit->id; h->task[target][lun]=unit->lct_data->tid;
h->tagclock[target][lun]=jiffies; h->tagclock[target][lun]=jiffies;
/* Get the max fragments/request */ /* Get the max fragments/request */
i2o_query_scalar(c, d->id, scsi_context|0x40000000, i2o_query_scalar(c, d->lct_data->tid, 0xF103, 3, &limit, 2);
0xF103, 3, &limit, 2, &lun_done);
/* sanity */ /* sanity */
if ( limit == 0 ) if ( limit == 0 )
...@@ -435,8 +432,8 @@ int i2o_scsi_detect(Scsi_Host_Template * tpnt) ...@@ -435,8 +432,8 @@ int i2o_scsi_detect(Scsi_Host_Template * tpnt)
/* /*
* bus_adapter, SCSI (obsolete), or FibreChannel busses only * bus_adapter, SCSI (obsolete), or FibreChannel busses only
*/ */
if( (d->class!=I2O_CLASS_BUS_ADAPTER_PORT) // bus_adapter if( (d->lct_data->class_id!=I2O_CLASS_BUS_ADAPTER_PORT) // bus_adapter
&& (d->class!=I2O_CLASS_FIBRE_CHANNEL_PORT) // FC_PORT && (d->lct_data->class_id!=I2O_CLASS_FIBRE_CHANNEL_PORT) // FC_PORT
) )
continue; continue;
......
This diff is collapsed.
This diff is collapsed.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Status: Experimental. * Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no> * Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Wed Oct 21 20:02:35 1998 * Created at: Wed Oct 21 20:02:35 1998
* Modified at: Sat Jun 26 16:57:57 1999 * Modified at: Mon Oct 18 23:37:06 1999
* Modified by: Dag Brattli <dagb@cs.uit.no> * Modified by: Dag Brattli <dagb@cs.uit.no>
* *
* Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
...@@ -32,33 +32,31 @@ ...@@ -32,33 +32,31 @@
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h> #include <net/irda/irmod.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <net/irda/dongle.h>
static void actisys_reset(struct irda_device *dev); static int actisys_change_speed(struct irda_task *task);
static void actisys_open(struct irda_device *idev, int type); static int actisys_reset(struct irda_task *task);
static void actisys_close(struct irda_device *dev); static void actisys_open(dongle_t *self, struct qos_info *qos);
static void actisys_change_speed( struct irda_device *dev, __u32 speed); static void actisys_close(dongle_t *self);
static void actisys_init_qos(struct irda_device *idev, struct qos_info *qos);
/* These are the baudrates supported */ /* These are the baudrates supported */
static __u32 baud_rates[] = { 9600, 19200, 57600, 115200, 38400}; static __u32 baud_rates[] = { 9600, 19200, 57600, 115200, 38400 };
static struct dongle dongle = { static struct dongle_reg dongle = {
ACTISYS_DONGLE, Q_NULL,
IRDA_ACTISYS_DONGLE,
actisys_open, actisys_open,
actisys_close, actisys_close,
actisys_reset, actisys_reset,
actisys_change_speed, actisys_change_speed,
actisys_init_qos,
}; };
static struct dongle dongle_plus = { static struct dongle_reg dongle_plus = {
ACTISYS_PLUS_DONGLE, Q_NULL,
IRDA_ACTISYS_PLUS_DONGLE,
actisys_open, actisys_open,
actisys_close, actisys_close,
actisys_reset, actisys_reset,
actisys_change_speed, actisys_change_speed,
actisys_init_qos,
}; };
int __init actisys_init(void) int __init actisys_init(void)
...@@ -82,20 +80,23 @@ void actisys_cleanup(void) ...@@ -82,20 +80,23 @@ void actisys_cleanup(void)
irda_device_unregister_dongle(&dongle_plus); irda_device_unregister_dongle(&dongle_plus);
} }
static void actisys_open(struct irda_device *idev, int type) static void actisys_open(dongle_t *self, struct qos_info *qos)
{ {
strcat(idev->description, " <-> actisys"); qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
idev->io.dongle_id = type; /* Remove support for 38400 if this is not a 220L+ dongle */
idev->flags |= IFF_DONGLE; if (self->issue->type == IRDA_ACTISYS_DONGLE)
qos->baud_rate.bits &= ~IR_38400;
qos->min_turn_time.bits &= 0x40; /* Needs 0.01 ms */
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
} }
static void actisys_close(struct irda_device *idev) static void actisys_close(dongle_t *self)
{ {
/* Power off dongle */ /* Power off dongle */
irda_device_set_dtr_rts(idev, FALSE, FALSE); self->set_dtr_rts(self->dev, FALSE, FALSE);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
} }
...@@ -107,52 +108,84 @@ static void actisys_close(struct irda_device *idev) ...@@ -107,52 +108,84 @@ static void actisys_close(struct irda_device *idev)
* To cycle through the available baud rates, pulse RTS low for a few * To cycle through the available baud rates, pulse RTS low for a few
* ms. * ms.
*/ */
static void actisys_change_speed(struct irda_device *idev, __u32 speed) static int actisys_change_speed(struct irda_task *task)
{ {
__u32 current_baudrate; dongle_t *self = (dongle_t *) task->instance;
__u32 speed = (__u32) task->param;
__u32 current_speed;
int index = 0; int index = 0;
int ret = 0;
DEBUG(4, __FUNCTION__ "()\n"); IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(idev != NULL, return;); current_speed = self->speed;
ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;);
current_baudrate = idev->qos.baud_rate.value;
/* Find the correct baudrate index for the currently used baudrate */ /* Find the correct baudrate index for the currently used baudrate */
while (current_baudrate != baud_rates[index]) while (current_speed != baud_rates[index])
index++; index++;
DEBUG( 4, __FUNCTION__ "(), index=%d\n", index); IRDA_DEBUG(4, __FUNCTION__ "(), index=%d\n", index);
switch (task->state) {
case IRDA_TASK_INIT:
/* Lock dongle */
if (irda_lock((void *) &self->busy) == FALSE) {
IRDA_DEBUG(0, __FUNCTION__ "(), busy!\n");
ret = MSECS_TO_JIFFIES(100);
break;
}
/* Cycle through avaiable baudrates until we reach the correct one */ IRDA_DEBUG(4, __FUNCTION__ "(), current baudrate = %d\n",
while (current_baudrate != speed) {
DEBUG(4, __FUNCTION__ "(), current baudrate = %d\n",
baud_rates[index]); baud_rates[index]);
/* Set DTR, clear RTS */ /* Set DTR, clear RTS */
irda_device_set_dtr_rts(idev, TRUE, FALSE); self->set_dtr_rts(self->dev, TRUE, FALSE);
/* Wait at a few ms */ irda_task_next_state(task, IRDA_TASK_WAIT1);
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(MSECS_TO_JIFFIES(20));
/* Wait at a few ms */
ret = MSECS_TO_JIFFIES(20);
break;
case IRDA_TASK_WAIT1:
/* Set DTR, Set RTS */ /* Set DTR, Set RTS */
irda_device_set_dtr_rts(idev, TRUE, TRUE); self->set_dtr_rts(self->dev, TRUE, TRUE);
/* Wait at a few ms again */ irda_task_next_state(task, IRDA_TASK_WAIT2);
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(MSECS_TO_JIFFIES(20));
/* Wait at a few ms again */
ret = MSECS_TO_JIFFIES(20);
break;
case IRDA_TASK_WAIT2:
/* Go to next baudrate */ /* Go to next baudrate */
if (idev->io.dongle_id == ACTISYS_DONGLE) if (self->issue->type == IRDA_ACTISYS_DONGLE)
index = (index+1) % 4; /* IR-220L */ index = (index+1) % 4; /* IR-220L */
else else
index = (index+1) % 5; /* IR-220L+ */ index = (index+1) % 5; /* IR-220L+ */
current_baudrate = baud_rates[index]; current_speed = baud_rates[index];
/* Check if we need to go some more rounds */
if (current_speed != speed)
irda_task_next_state(task, IRDA_TASK_INIT);
else {
irda_task_next_state(task, IRDA_TASK_DONE);
self->busy = 0;
} }
DEBUG(4, __FUNCTION__ "(), current baudrate = %d\n", baud_rates[index]); break;
default:
ERROR(__FUNCTION__ "(), unknown state %d\n", task->state);
irda_task_next_state(task, IRDA_TASK_DONE);
self->busy = 0;
ret = -1;
break;
}
self->speed = speed;
IRDA_DEBUG(4, __FUNCTION__ "(), current baudrate = %d\n",
baud_rates[index]);
return ret;
} }
/* /*
...@@ -162,45 +195,42 @@ static void actisys_change_speed(struct irda_device *idev, __u32 speed) ...@@ -162,45 +195,42 @@ static void actisys_change_speed(struct irda_device *idev, __u32 speed)
* called with a process context! * called with a process context!
* *
* 1. Clear DTR for a few ms. * 1. Clear DTR for a few ms.
*
*/ */
static void actisys_reset(struct irda_device *idev) static int actisys_reset(struct irda_task *task)
{ {
ASSERT(idev != NULL, return;); dongle_t *self = (dongle_t *) task->instance;
ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;); int ret = 0;
ASSERT(task != NULL, return -1;);
switch (task->state) {
case IRDA_TASK_INIT:
/* Clear DTR */ /* Clear DTR */
irda_device_set_dtr_rts(idev, FALSE, TRUE); self->set_dtr_rts(self->dev, FALSE, TRUE);
/* Sleep 10-20 ms*/ irda_task_next_state(task, IRDA_TASK_WAIT);
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(MSECS_TO_JIFFIES(20));
/* Sleep 10-20 ms*/
ret = MSECS_TO_JIFFIES(20);
break;
case IRDA_TASK_WAIT:
/* Go back to normal mode */ /* Go back to normal mode */
irda_device_set_dtr_rts(idev, TRUE, TRUE); self->set_dtr_rts(self->dev, TRUE, TRUE);
idev->qos.baud_rate.value = 9600; irda_task_next_state(task, IRDA_TASK_DONE);
}
/* self->speed = 9600;
* Function actisys_init_qos (qos) break;
* default:
* Initialize QoS capabilities ERROR(__FUNCTION__ "(), unknown state %d\n", task->state);
* irda_task_next_state(task, IRDA_TASK_DONE);
*/ ret = -1;
static void actisys_init_qos(struct irda_device *idev, struct qos_info *qos) break;
{ }
qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; return ret;
/* Remove support for 38400 if this is not a 220L+ dongle */
if (idev->io.dongle_id == ACTISYS_DONGLE)
qos->baud_rate.bits &= ~IR_38400;
qos->min_turn_time.bits &= 0x40; /* Needs 0.01 ms */
} }
#ifdef MODULE #ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("ACTiSYS IR-220L and IR-220L+ dongle driver"); MODULE_DESCRIPTION("ACTiSYS IR-220L and IR-220L+ dongle driver");
...@@ -225,5 +255,4 @@ void cleanup_module(void) ...@@ -225,5 +255,4 @@ void cleanup_module(void)
{ {
actisys_cleanup(); actisys_cleanup();
} }
#endif /* MODULE */
#endif
...@@ -56,7 +56,7 @@ int __init airport_init(void) ...@@ -56,7 +56,7 @@ int __init airport_init(void)
{ {
int ret; int ret;
DEBUG(2, __FUNCTION__ "()\n"); IRDA_DEBUG(2, __FUNCTION__ "()\n");
ret = irda_device_register_dongle(&dongle); ret = irda_device_register_dongle(&dongle);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -65,17 +65,17 @@ int __init airport_init(void) ...@@ -65,17 +65,17 @@ int __init airport_init(void)
void airport_cleanup(void) void airport_cleanup(void)
{ {
DEBUG(2, __FUNCTION__ "()\n"); IRDA_DEBUG(2, __FUNCTION__ "()\n");
irda_device_unregister_dongle(&dongle); irda_device_unregister_dongle(&dongle);
} }
static void airport_open(struct irda_device *idev, int type) static void airport_open(struct irda_device *idev, int type)
{ {
DEBUG(2, __FUNCTION__ "(,%d)\n", type); IRDA_DEBUG(2, __FUNCTION__ "(,%d)\n", type);
if (strlen(idev->description) < sizeof(idev->description) - 13) if (strlen(idev->description) < sizeof(idev->description) - 13)
strcat(idev->description, " <-> airport"); strcat(idev->description, " <-> airport");
else else
DEBUG(0, __FUNCTION__ " description too long: %s\n", IRDA_DEBUG(0, __FUNCTION__ " description too long: %s\n",
idev->description); idev->description);
idev->io.dongle_id = type; idev->io.dongle_id = type;
...@@ -86,7 +86,7 @@ static void airport_open(struct irda_device *idev, int type) ...@@ -86,7 +86,7 @@ static void airport_open(struct irda_device *idev, int type)
static void airport_close(struct irda_device *idev) static void airport_close(struct irda_device *idev)
{ {
DEBUG(2, __FUNCTION__ "()\n"); IRDA_DEBUG(2, __FUNCTION__ "()\n");
/* Power off dongle */ /* Power off dongle */
irda_device_set_dtr_rts(idev, FALSE, FALSE); irda_device_set_dtr_rts(idev, FALSE, FALSE);
...@@ -95,13 +95,13 @@ static void airport_close(struct irda_device *idev) ...@@ -95,13 +95,13 @@ static void airport_close(struct irda_device *idev)
static void airport_set_command_mode(struct irda_device *idev) static void airport_set_command_mode(struct irda_device *idev)
{ {
DEBUG(2, __FUNCTION__ "()\n"); IRDA_DEBUG(2, __FUNCTION__ "()\n");
irda_device_set_dtr_rts(idev, FALSE, TRUE); irda_device_set_dtr_rts(idev, FALSE, TRUE);
} }
static void airport_set_normal_mode(struct irda_device *idev) static void airport_set_normal_mode(struct irda_device *idev)
{ {
DEBUG(2, __FUNCTION__ "()\n"); IRDA_DEBUG(2, __FUNCTION__ "()\n");
irda_device_set_dtr_rts(idev, TRUE, TRUE); irda_device_set_dtr_rts(idev, TRUE, TRUE);
} }
...@@ -109,7 +109,7 @@ static void airport_set_normal_mode(struct irda_device *idev) ...@@ -109,7 +109,7 @@ static void airport_set_normal_mode(struct irda_device *idev)
void airport_write_char(struct irda_device *idev, unsigned char c) void airport_write_char(struct irda_device *idev, unsigned char c)
{ {
int actual; int actual;
DEBUG(2, __FUNCTION__ "(,0x%x)\n", c & 0xff); IRDA_DEBUG(2, __FUNCTION__ "(,0x%x)\n", c & 0xff);
actual = idev->raw_write(idev, &c, 1); actual = idev->raw_write(idev, &c, 1);
ASSERT(actual == 1, return;); ASSERT(actual == 1, return;);
} }
...@@ -120,22 +120,22 @@ static int airport_waitfor_char(struct irda_device *idev, unsigned char c) ...@@ -120,22 +120,22 @@ static int airport_waitfor_char(struct irda_device *idev, unsigned char c)
{ {
int i, found = FALSE; int i, found = FALSE;
int before; int before;
DEBUG(2, __FUNCTION__ "(,0x%x)\n", c); IRDA_DEBUG(2, __FUNCTION__ "(,0x%x)\n", c);
/* Sleep approx. 10 ms */ /* Sleep approx. 10 ms */
before = jiffies; before = jiffies;
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule_timeout(MSECS_TO_JIFFIES(20)); schedule_timeout(MSECS_TO_JIFFIES(20));
DEBUG(4, __FUNCTION__ " waited %ldms\n", IRDA_DEBUG(4, __FUNCTION__ " waited %ldms\n",
JIFFIES_TO_MSECS(jiffies - before)); JIFFIES_TO_MSECS(jiffies - before));
for ( i = 0 ; !found && i < idev->rx_buff.len ; i++ ) { for ( i = 0 ; !found && i < idev->rx_buff.len ; i++ ) {
/* DEBUG(6, __FUNCTION__ " 0x02x\n", idev->rx_buff.data[i]); */ /* IRDA_DEBUG(6, __FUNCTION__ " 0x02x\n", idev->rx_buff.data[i]); */
found = c == idev->rx_buff.data[i]; found = c == idev->rx_buff.data[i];
} }
idev->rx_buff.len = 0; idev->rx_buff.len = 0;
DEBUG(2, __FUNCTION__ " returns %s\n", (found ? "true" : "false")); IRDA_DEBUG(2, __FUNCTION__ " returns %s\n", (found ? "true" : "false"));
return found; return found;
} }
...@@ -144,7 +144,7 @@ static int airport_check_command_mode(struct irda_device *idev) ...@@ -144,7 +144,7 @@ static int airport_check_command_mode(struct irda_device *idev)
int i; int i;
int found = FALSE; int found = FALSE;
DEBUG(2, __FUNCTION__ "()\n"); IRDA_DEBUG(2, __FUNCTION__ "()\n");
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule_timeout(MSECS_TO_JIFFIES(20)); schedule_timeout(MSECS_TO_JIFFIES(20));
airport_set_command_mode(idev); airport_set_command_mode(idev);
...@@ -160,9 +160,9 @@ static int airport_check_command_mode(struct irda_device *idev) ...@@ -160,9 +160,9 @@ static int airport_check_command_mode(struct irda_device *idev)
} }
if (found) { if (found) {
DEBUG(2, __FUNCTION__ " OK. (%d)\n", i); IRDA_DEBUG(2, __FUNCTION__ " OK. (%d)\n", i);
} else { } else {
DEBUG(0, __FUNCTION__ " FAILED!\n"); IRDA_DEBUG(0, __FUNCTION__ " FAILED!\n");
} }
return found; return found;
} }
...@@ -173,7 +173,7 @@ static int airport_write_register(struct irda_device *idev, unsigned char reg) ...@@ -173,7 +173,7 @@ static int airport_write_register(struct irda_device *idev, unsigned char reg)
int ok = FALSE; int ok = FALSE;
int i; int i;
DEBUG(4, __FUNCTION__ "(,0x%x)\n", reg); IRDA_DEBUG(4, __FUNCTION__ "(,0x%x)\n", reg);
airport_check_command_mode(idev); airport_check_command_mode(idev);
for ( i = 0 ; i < 6 ; i++ ) { for ( i = 0 ; i < 6 ; i++ ) {
...@@ -191,9 +191,9 @@ static int airport_write_register(struct irda_device *idev, unsigned char reg) ...@@ -191,9 +191,9 @@ static int airport_write_register(struct irda_device *idev, unsigned char reg)
airport_set_normal_mode(idev); airport_set_normal_mode(idev);
if (ok) { if (ok) {
DEBUG(4, __FUNCTION__ "(,0x%x) returns OK\n", reg); IRDA_DEBUG(4, __FUNCTION__ "(,0x%x) returns OK\n", reg);
} else { } else {
DEBUG(0, __FUNCTION__ "(,0x%x) returns False!\n", reg); IRDA_DEBUG(0, __FUNCTION__ "(,0x%x) returns False!\n", reg);
} }
return ok; return ok;
} }
...@@ -209,7 +209,7 @@ static void airport_change_speed(struct irda_device *idev, __u32 speed) ...@@ -209,7 +209,7 @@ static void airport_change_speed(struct irda_device *idev, __u32 speed)
__u32 current_baudrate; __u32 current_baudrate;
int baudcode; int baudcode;
DEBUG(4, __FUNCTION__ "(,%d)\n", speed); IRDA_DEBUG(4, __FUNCTION__ "(,%d)\n", speed);
ASSERT(idev != NULL, return;); ASSERT(idev != NULL, return;);
ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;); ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;);
...@@ -224,16 +224,16 @@ static void airport_change_speed(struct irda_device *idev, __u32 speed) ...@@ -224,16 +224,16 @@ static void airport_change_speed(struct irda_device *idev, __u32 speed)
case 57600: baudcode = 0x60; break; case 57600: baudcode = 0x60; break;
case 115200: baudcode = 0x70; break; case 115200: baudcode = 0x70; break;
default: default:
DEBUG(0, __FUNCTION__ " bad baud rate: %d\n", speed); IRDA_DEBUG(0, __FUNCTION__ " bad baud rate: %d\n", speed);
return; return;
} }
current_baudrate = idev->qos.baud_rate.value; current_baudrate = idev->qos.baud_rate.value;
DEBUG(4, __FUNCTION__ " current baudrate: %d\n", current_baudrate); IRDA_DEBUG(4, __FUNCTION__ " current baudrate: %d\n", current_baudrate);
/* The dongle falls back to 9600 baud */ /* The dongle falls back to 9600 baud */
if (current_baudrate != 9600) { if (current_baudrate != 9600) {
DEBUG(4, __FUNCTION__ " resetting speed to 9600 baud\n"); IRDA_DEBUG(4, __FUNCTION__ " resetting speed to 9600 baud\n");
ASSERT(idev->change_speed , return;); ASSERT(idev->change_speed , return;);
idev->change_speed(idev, 9600); idev->change_speed(idev, 9600);
idev->qos.baud_rate.value = 9600; idev->qos.baud_rate.value = 9600;
...@@ -247,11 +247,11 @@ static void airport_change_speed(struct irda_device *idev, __u32 speed) ...@@ -247,11 +247,11 @@ static void airport_change_speed(struct irda_device *idev, __u32 speed)
if (airport_write_register(idev, baudcode|0x01)) { if (airport_write_register(idev, baudcode|0x01)) {
/* ok */ /* ok */
} else { } else {
DEBUG(0, __FUNCTION__ IRDA_DEBUG(0, __FUNCTION__
" Cannot set new speed in second register\n"); " Cannot set new speed in second register\n");
} }
} else { } else {
DEBUG(0, __FUNCTION__ IRDA_DEBUG(0, __FUNCTION__
" Cannot set new speed in first register\n"); " Cannot set new speed in first register\n");
} }
...@@ -260,7 +260,7 @@ static void airport_change_speed(struct irda_device *idev, __u32 speed) ...@@ -260,7 +260,7 @@ static void airport_change_speed(struct irda_device *idev, __u32 speed)
/* How do I signal an error in these functions? */ /* How do I signal an error in these functions? */
DEBUG(4, __FUNCTION__ " returning\n"); IRDA_DEBUG(4, __FUNCTION__ " returning\n");
} }
...@@ -275,7 +275,7 @@ static void airport_reset(struct irda_device *idev) ...@@ -275,7 +275,7 @@ static void airport_reset(struct irda_device *idev)
{ {
int ok; int ok;
DEBUG(2, __FUNCTION__ "()\n"); IRDA_DEBUG(2, __FUNCTION__ "()\n");
ASSERT(idev != NULL, return;); ASSERT(idev != NULL, return;);
ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;); ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;);
ASSERT(idev->set_raw_mode /* The airport needs this */, return;); ASSERT(idev->set_raw_mode /* The airport needs this */, return;);
...@@ -286,10 +286,10 @@ static void airport_reset(struct irda_device *idev) ...@@ -286,10 +286,10 @@ static void airport_reset(struct irda_device *idev)
airport_set_normal_mode(idev); airport_set_normal_mode(idev);
/* Sleep 2000 ms */ /* Sleep 2000 ms */
DEBUG(2, __FUNCTION__ " waiting for powerup\n"); IRDA_DEBUG(2, __FUNCTION__ " waiting for powerup\n");
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule_timeout(MSECS_TO_JIFFIES(2000)); schedule_timeout(MSECS_TO_JIFFIES(2000));
DEBUG(2, __FUNCTION__ " finished waiting for powerup\n"); IRDA_DEBUG(2, __FUNCTION__ " finished waiting for powerup\n");
/* set dongle speed to 9600 */ /* set dongle speed to 9600 */
ok = TRUE; ok = TRUE;
...@@ -322,12 +322,12 @@ static void airport_reset(struct irda_device *idev) ...@@ -322,12 +322,12 @@ static void airport_reset(struct irda_device *idev)
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule_timeout(MSECS_TO_JIFFIES(20)); schedule_timeout(MSECS_TO_JIFFIES(20));
DEBUG(4, __FUNCTION__ " waited 20ms\n"); IRDA_DEBUG(4, __FUNCTION__ " waited 20ms\n");
idev->qos.baud_rate.value = 9600; idev->qos.baud_rate.value = 9600;
if (!ok) if (!ok)
MESSAGE(__FUNCTION__ "() failed.\n"); MESSAGE(__FUNCTION__ "() failed.\n");
DEBUG(2, __FUNCTION__ " returning.\n"); IRDA_DEBUG(2, __FUNCTION__ " returning.\n");
} }
/* /*
......
/********************************************************************* /*********************************************************************
* *
* Filename: esi.c * Filename: esi.c
* Version: 1.4 * Version: 1.5
* Description: Driver for the Extended Systems JetEye PC dongle * Description: Driver for the Extended Systems JetEye PC dongle
* Status: Experimental. * Status: Experimental.
* Author: Thomas Davis, <ratbert@radiks.net> * Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sat Feb 21 18:54:38 1998 * Created at: Sat Feb 21 18:54:38 1998
* Modified at: Sat Jun 26 16:50:17 1999 * Modified at: Mon Oct 18 12:35:43 1999
* Modified by: Dag Brattli <dagb@cs.uit.no> * Modified by: Dag Brattli <dagb@cs.uit.no>
* Sources: esi.c
* *
* Copyright (c) 1998-1999, Dag Brattli, <dagb@cs.uit.no> * Copyright (c) 1999 Dag Brattli, <dagb@cs.uit.no>,
* Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, * Copyright (c) 1998 Thomas Davis, <ratbert@radiks.net>,
* All Rights Reserved. * All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -19,8 +18,15 @@ ...@@ -19,8 +18,15 @@
* published by the Free Software Foundation; either version 2 of * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version. * the License, or (at your option) any later version.
* *
* I, Thomas Davis, provide no warranty for any of this software. * This program is distributed in the hope that it will be useful,
* This material is provided "AS-IS" and at no charge. * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
* *
********************************************************************/ ********************************************************************/
...@@ -34,22 +40,19 @@ ...@@ -34,22 +40,19 @@
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h> #include <net/irda/irmod.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <net/irda/irtty.h>
#include <net/irda/dongle.h>
static void esi_open(struct irda_device *idev, int type); static void esi_open(dongle_t *self, struct qos_info *qos);
static void esi_close(struct irda_device *driver); static void esi_close(dongle_t *self);
static void esi_change_speed(struct irda_device *idev, __u32 speed); static int esi_change_speed(struct irda_task *task);
static void esi_reset(struct irda_device *idev); static int esi_reset(struct irda_task *task);
static void esi_qos_init(struct irda_device *idev, struct qos_info *qos);
static struct dongle dongle = { static struct dongle_reg dongle = {
ESI_DONGLE, Q_NULL,
IRDA_ESI_DONGLE,
esi_open, esi_open,
esi_close, esi_close,
esi_reset, esi_reset,
esi_change_speed, esi_change_speed,
esi_qos_init,
}; };
int __init esi_init(void) int __init esi_init(void)
...@@ -62,36 +65,39 @@ void esi_cleanup(void) ...@@ -62,36 +65,39 @@ void esi_cleanup(void)
irda_device_unregister_dongle(&dongle); irda_device_unregister_dongle(&dongle);
} }
static void esi_open(struct irda_device *idev, int type) static void esi_open(dongle_t *self, struct qos_info *qos)
{ {
strcat(idev->description, " <-> esi"); qos->baud_rate.bits &= IR_9600|IR_19200|IR_115200;
qos->min_turn_time.bits &= 0x01; /* Needs at least 10 ms */
idev->io.dongle_id = type;
idev->flags |= IFF_DONGLE;
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
} }
static void esi_close(struct irda_device *idev) static void esi_close(dongle_t *dongle)
{ {
/* Power off dongle */ /* Power off dongle */
irda_device_set_dtr_rts(idev, FALSE, FALSE); dongle->set_dtr_rts(dongle->dev, FALSE, FALSE);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
} }
/* /*
* Function esi_change_speed (idev, speed) * Function esi_change_speed (task)
* *
* Set the speed for the Extended Systems JetEye PC ESI-9680 type dongle * Set the speed for the Extended Systems JetEye PC ESI-9680 type dongle
* *
*/ */
static void esi_change_speed(struct irda_device *idev, __u32 speed) static int esi_change_speed(struct irda_task *task)
{ {
dongle_t *self = (dongle_t *) task->instance;
__u32 speed = (__u32) task->param;
int dtr, rts; int dtr, rts;
ASSERT(idev != NULL, return;); /* Lock dongle */
ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;); if (irda_lock((void *) &self->busy) == FALSE) {
IRDA_DEBUG(0, __FUNCTION__ "(), busy!\n");
return MSECS_TO_JIFFIES(100);
}
switch (speed) { switch (speed) {
case 19200: case 19200:
...@@ -109,28 +115,34 @@ static void esi_change_speed(struct irda_device *idev, __u32 speed) ...@@ -109,28 +115,34 @@ static void esi_change_speed(struct irda_device *idev, __u32 speed)
} }
/* Change speed of dongle */ /* Change speed of dongle */
irda_device_set_dtr_rts(idev, dtr, rts); self->set_dtr_rts(self->dev, dtr, rts);
} self->speed = speed;
static void esi_reset( struct irda_device *idev) irda_task_next_state(task, IRDA_TASK_DONE);
{
/* Empty */ /* Unlock */
self->busy = 0;
return 0;
} }
/* /*
* Function esi_qos_init (qos) * Function esi_reset (task)
* *
* Init QoS capabilities for the dongle * Reset dongle;
* *
*/ */
static void esi_qos_init(struct irda_device *idev, struct qos_info *qos) static int esi_reset(struct irda_task *task)
{ {
qos->baud_rate.bits &= IR_9600|IR_19200|IR_115200; dongle_t *self = (dongle_t *) task->instance;
qos->min_turn_time.bits &= 0x01; /* Needs at least 10 ms */
self->set_dtr_rts(self->dev, FALSE, FALSE);
irda_task_next_state(task, IRDA_TASK_DONE);
return 0;
} }
#ifdef MODULE #ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Extended Systems JetEye PC dongle driver"); MODULE_DESCRIPTION("Extended Systems JetEye PC dongle driver");
...@@ -155,6 +167,5 @@ void cleanup_module(void) ...@@ -155,6 +167,5 @@ void cleanup_module(void)
{ {
esi_cleanup(); esi_cleanup();
} }
#endif /* MODULE */
#endif
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Status: Experimental. * Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no> * Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sat Feb 6 21:02:33 1999 * Created at: Sat Feb 6 21:02:33 1999
* Modified at: Sun Jul 18 12:09:26 1999 * Modified at: Mon Oct 18 22:15:20 1999
* Modified by: Dag Brattli <dagb@cs.uit.no> * Modified by: Dag Brattli <dagb@cs.uit.no>
* *
* Copyright (c) 1999 Dag Brattli, All Rights Reserved. * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
...@@ -32,13 +32,11 @@ ...@@ -32,13 +32,11 @@
#include <net/irda/irmod.h> #include <net/irda/irmod.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <net/irda/irtty.h> #include <net/irda/irtty.h>
#include <net/irda/dongle.h>
static void girbil_reset(struct irda_device *dev); static int girbil_reset(struct irda_task *task);
static void girbil_open(struct irda_device *dev, int type); static void girbil_open(dongle_t *self, struct qos_info *qos);
static void girbil_close(struct irda_device *dev); static void girbil_close(dongle_t *self);
static void girbil_change_speed(struct irda_device *dev, __u32 speed); static int girbil_change_speed(struct irda_task *task);
static void girbil_init_qos(struct irda_device *idev, struct qos_info *qos);
/* Control register 1 */ /* Control register 1 */
#define GIRBIL_TXEN 0x01 /* Enable transmitter */ #define GIRBIL_TXEN 0x01 /* Enable transmitter */
...@@ -67,13 +65,13 @@ static void girbil_init_qos(struct irda_device *idev, struct qos_info *qos); ...@@ -67,13 +65,13 @@ static void girbil_init_qos(struct irda_device *idev, struct qos_info *qos);
/* Control register 2 (0x5) */ /* Control register 2 (0x5) */
#define GIRBIL_LOAD 0x51 /* Load the new baud rate value */ #define GIRBIL_LOAD 0x51 /* Load the new baud rate value */
static struct dongle dongle = { static struct dongle_reg dongle = {
GIRBIL_DONGLE, Q_NULL,
IRDA_GIRBIL_DONGLE,
girbil_open, girbil_open,
girbil_close, girbil_close,
girbil_reset, girbil_reset,
girbil_change_speed, girbil_change_speed,
girbil_init_qos,
}; };
int __init girbil_init(void) int __init girbil_init(void)
...@@ -86,20 +84,18 @@ void girbil_cleanup(void) ...@@ -86,20 +84,18 @@ void girbil_cleanup(void)
irda_device_unregister_dongle(&dongle); irda_device_unregister_dongle(&dongle);
} }
static void girbil_open(struct irda_device *idev, int type) static void girbil_open(dongle_t *self, struct qos_info *qos)
{ {
strcat(idev->description, " <-> girbil"); qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
qos->min_turn_time.bits &= 0x03;
idev->io.dongle_id = type;
idev->flags |= IFF_DONGLE;
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
} }
static void girbil_close(struct irda_device *idev) static void girbil_close(dongle_t *self)
{ {
/* Power off dongle */ /* Power off dongle */
irda_device_set_dtr_rts(idev, FALSE, FALSE); self->set_dtr_rts(self->dev, FALSE, FALSE);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
} }
...@@ -111,12 +107,40 @@ static void girbil_close(struct irda_device *idev) ...@@ -111,12 +107,40 @@ static void girbil_close(struct irda_device *idev)
* function must be called with a process context! * function must be called with a process context!
* *
*/ */
static void girbil_change_speed(struct irda_device *idev, __u32 speed) static int girbil_change_speed(struct irda_task *task)
{ {
dongle_t *self = (dongle_t *) task->instance;
__u32 speed = (__u32) task->param;
__u8 control[2]; __u8 control[2];
int ret = 0;
switch (task->state) {
case IRDA_TASK_INIT:
/* Lock dongle */
if (irda_lock((void *) &self->busy) == FALSE) {
IRDA_DEBUG(0, __FUNCTION__ "(), busy!\n");
return MSECS_TO_JIFFIES(100);
}
/* Need to reset the dongle and go to 9600 bps before
programming */
if (irda_task_execute(self, girbil_reset, NULL, task,
(void *) speed))
{
/* Dongle need more time to reset */
irda_task_next_state(task, IRDA_TASK_CHILD_WAIT);
ASSERT(idev != NULL, return;); /* Give reset 1 sec to finish */
ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;); ret = MSECS_TO_JIFFIES(1000);
}
break;
case IRDA_TASK_CHILD_WAIT:
WARNING(__FUNCTION__ "(), resetting dongle timed out!\n");
ret = -1;
break;
case IRDA_TASK_CHILD_DONE:
/* Set DTR and Clear RTS to enter command mode */
self->set_dtr_rts(self->dev, FALSE, TRUE);
switch (speed) { switch (speed) {
case 9600: case 9600:
...@@ -138,20 +162,25 @@ static void girbil_change_speed(struct irda_device *idev, __u32 speed) ...@@ -138,20 +162,25 @@ static void girbil_change_speed(struct irda_device *idev, __u32 speed)
} }
control[1] = GIRBIL_LOAD; control[1] = GIRBIL_LOAD;
/* Need to reset the dongle and go to 9600 bps before programming */
girbil_reset(idev);
/* Set DTR and Clear RTS to enter command mode */
irda_device_set_dtr_rts(idev, FALSE, TRUE);
/* Write control bytes */ /* Write control bytes */
irda_device_raw_write(idev, control, 2); self->write(self->dev, control, 2);
irda_task_next_state(task, IRDA_TASK_WAIT);
current->state = TASK_INTERRUPTIBLE; ret = MSECS_TO_JIFFIES(100);
schedule_timeout(MSECS_TO_JIFFIES(100)); break;
case IRDA_TASK_WAIT:
/* Go back to normal mode */ /* Go back to normal mode */
irda_device_set_dtr_rts(idev, TRUE, TRUE); self->set_dtr_rts(self->dev, TRUE, TRUE);
irda_task_next_state(task, IRDA_TASK_DONE);
self->busy = 0;
break;
default:
ERROR(__FUNCTION__ "(), unknown state %d\n", task->state);
irda_task_next_state(task, IRDA_TASK_DONE);
self->busy = 0;
ret = -1;
break;
}
return ret;
} }
/* /*
...@@ -164,54 +193,47 @@ static void girbil_change_speed(struct irda_device *idev, __u32 speed) ...@@ -164,54 +193,47 @@ static void girbil_change_speed(struct irda_device *idev, __u32 speed)
* 0. set RTS, and wait at least 5 ms * 0. set RTS, and wait at least 5 ms
* 1. clear RTS * 1. clear RTS
*/ */
void girbil_reset(struct irda_device *idev) static int girbil_reset(struct irda_task *task)
{ {
dongle_t *self = (dongle_t *) task->instance;
__u8 control = GIRBIL_TXEN | GIRBIL_RXEN; __u8 control = GIRBIL_TXEN | GIRBIL_RXEN;
int ret = 0;
ASSERT(idev != NULL, return;); switch (task->state) {
ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;); case IRDA_TASK_INIT:
/* Make sure the IrDA chip also goes to defalt speed */
if (idev->change_speed)
idev->change_speed(idev, 9600);
/* Reset dongle */ /* Reset dongle */
irda_device_set_dtr_rts(idev, TRUE, FALSE); self->set_dtr_rts(self->dev, TRUE, FALSE);
irda_task_next_state(task, IRDA_TASK_WAIT1);
/* Sleep at least 5 ms */ /* Sleep at least 5 ms */
current->state = TASK_INTERRUPTIBLE; ret = MSECS_TO_JIFFIES(10);
schedule_timeout(MSECS_TO_JIFFIES(10)); break;
case IRDA_TASK_WAIT1:
/* Set DTR and clear RTS to enter command mode */ /* Set DTR and clear RTS to enter command mode */
irda_device_set_dtr_rts(idev, FALSE, TRUE); self->set_dtr_rts(self->dev, FALSE, TRUE);
irda_task_next_state(task, IRDA_TASK_WAIT2);
current->state = TASK_INTERRUPTIBLE; ret = MSECS_TO_JIFFIES(10);
schedule_timeout(MSECS_TO_JIFFIES(10)); break;
case IRDA_TASK_WAIT2:
/* Write control byte */ /* Write control byte */
irda_device_raw_write(idev, &control, 1); self->write(self->dev, &control, 1);
irda_task_next_state(task, IRDA_TASK_WAIT3);
current->state = TASK_INTERRUPTIBLE; ret = MSECS_TO_JIFFIES(20);
schedule_timeout(MSECS_TO_JIFFIES(20)); break;
case IRDA_TASK_WAIT3:
/* Go back to normal mode */ /* Go back to normal mode */
irda_device_set_dtr_rts(idev, TRUE, TRUE); self->set_dtr_rts(self->dev, TRUE, TRUE);
} irda_task_next_state(task, IRDA_TASK_DONE);
break;
/* default:
* Function girbil_init_qos (qos) ERROR(__FUNCTION__ "(), unknown state %d\n", task->state);
* irda_task_next_state(task, IRDA_TASK_DONE);
* Initialize QoS capabilities ret = -1;
* break;
*/ }
static void girbil_init_qos(struct irda_device *idev, struct qos_info *qos) return ret;
{
qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
qos->min_turn_time.bits &= 0x03;
} }
#ifdef MODULE #ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Greenwich GIrBIL dongle driver"); MODULE_DESCRIPTION("Greenwich GIrBIL dongle driver");
...@@ -236,5 +258,4 @@ void cleanup_module(void) ...@@ -236,5 +258,4 @@ void cleanup_module(void)
{ {
girbil_cleanup(); girbil_cleanup();
} }
#endif /* MODULE */ #endif /* MODULE */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -60,7 +60,18 @@ typedef struct ray_dev_t { ...@@ -60,7 +60,18 @@ typedef struct ray_dev_t {
UCHAR ASIC_version; UCHAR ASIC_version;
UCHAR assoc_id[2]; UCHAR assoc_id[2];
UCHAR tib_length; UCHAR tib_length;
UCHAR last_rsl;
int beacon_rxed;
struct beacon_rx last_bcn; struct beacon_rx last_bcn;
#ifdef WIRELESS_EXT
iw_stats wstats; /* Wireless specific stats */
#endif
#ifdef WIRELESS_SPY
int spy_number; /* Number of addresses to spy */
mac_addr spy_address[IW_MAX_SPY + 1]; /* The addresses to spy */
iw_qual spy_stat[IW_MAX_SPY + 1]; /* Statistics gathered */
#endif /* WIRELESS_SPY */
} ray_dev_t; } ray_dev_t;
/*****************************************************************************/ /*****************************************************************************/
......
...@@ -19,6 +19,7 @@ EXPORT_SYMBOL(pci_write_config_word); ...@@ -19,6 +19,7 @@ EXPORT_SYMBOL(pci_write_config_word);
EXPORT_SYMBOL(pci_write_config_dword); EXPORT_SYMBOL(pci_write_config_dword);
EXPORT_SYMBOL(pci_devices); EXPORT_SYMBOL(pci_devices);
EXPORT_SYMBOL(pci_root); EXPORT_SYMBOL(pci_root);
EXPORT_SYMBOL(pci_enable_device);
EXPORT_SYMBOL(pci_find_class); EXPORT_SYMBOL(pci_find_class);
EXPORT_SYMBOL(pci_find_device); EXPORT_SYMBOL(pci_find_device);
EXPORT_SYMBOL(pci_find_slot); EXPORT_SYMBOL(pci_find_slot);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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