diff options
| author | Martin Dalecki <dalecki@evision-ventures.com> | 2002-06-02 02:41:38 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-06-02 02:41:38 -0700 |
| commit | 8b4e98ea6d0e2cf0be06c1efd68da378e90ace27 (patch) | |
| tree | bfc7d930ebc0cbfdd64e6b7e64c58aba0b7ce06b /drivers/ide/device.c | |
| parent | 78a6728c4db0c6c37feeceb28296c21bd5e5f3d4 (diff) | |
[PATCH] 2.5.19 IDE 78
- Move ide_fixstring() from ide.c to probe.c, since this is the place, where it's
most used.
- Remove GET_STAT() - it's not used any longer.
- Remove last parameter of ide_error. Rename it to ata_error().
- Don't use ide_fixstring in qd65xx.c host chip driver. The model name is
already fixed in probe.c.
- Invent ata_irq_enable() for the handling of the trice nIEN bit of the
control register. Consistently use ch->intrproc method every time we toggle
this bit. This simply wasn't the case before!
- Disable interrupts on a previous channel only when we share them indeed.
- Eliminate simple drive command handling function drive_cmd.
- Simplify the ioctl handler. Move it to ioctl, since that's the only place
where it's actually used.
Diffstat (limited to 'drivers/ide/device.c')
| -rw-r--r-- | drivers/ide/device.c | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/drivers/ide/device.c b/drivers/ide/device.c index f8ca9cee1ef5..9fd239445538 100644 --- a/drivers/ide/device.c +++ b/drivers/ide/device.c @@ -15,6 +15,9 @@ /* * Common low leved device access code. This is the lowest layer of hardware * access. + * + * This is the place where register set access portability will be handled in + * the future. */ #include <linux/module.h> @@ -23,11 +26,9 @@ #include <linux/kernel.h> #include <linux/mm.h> #include <linux/ioport.h> -#include <linux/blkdev.h> #include <linux/errno.h> #include <linux/slab.h> #include <linux/delay.h> -#include <linux/cdrom.h> #include <linux/hdreg.h> #include <linux/ide.h> @@ -92,4 +93,53 @@ int ata_status(struct ata_device *drive, u8 good, u8 bad) EXPORT_SYMBOL(ata_status); +/* + * Handle the nIEN - negated Interrupt ENable of the drive. + * This is controlling whatever the drive will acnowlenge commands + * with interrupts or not. + */ +int ata_irq_enable(struct ata_device *drive, int on) +{ + struct ata_channel *ch = drive->channel; + + if (!ch->io_ports[IDE_CONTROL_OFFSET]) + return 0; + + if (on) + OUT_BYTE(0x00, ch->io_ports[IDE_CONTROL_OFFSET]); + else { + if (!ch->intrproc) + OUT_BYTE(0x02, ch->io_ports[IDE_CONTROL_OFFSET]); + else + ch->intrproc(drive); + } + + return 1; +} + +EXPORT_SYMBOL(ata_irq_enable); + +/* + * Perform a reset operation on the currently selected drive. + */ +void ata_reset(struct ata_channel *ch) +{ + unsigned long timeout = jiffies + WAIT_WORSTCASE; + u8 stat; + + if (!ch->io_ports[IDE_CONTROL_OFFSET]) + return; + + printk("%s: reset\n", ch->name); + OUT_BYTE(0x04, ch->io_ports[IDE_CONTROL_OFFSET]); + udelay(10); + OUT_BYTE(0x00, ch->io_ports[IDE_CONTROL_OFFSET]); + do { + mdelay(50); + stat = IN_BYTE(ch->io_ports[IDE_STATUS_OFFSET]); + } while ((stat & BUSY_STAT) && time_before(jiffies, timeout)); +} + +EXPORT_SYMBOL(ata_reset); + MODULE_LICENSE("GPL"); |
