Commit e669e817 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (60 commits)
  ide: small whitespace fixes
  ide: ide-cd_ioctl.c fix sparse integer as NULL pointer warnings
  ide: ide-cd.c fix sparse endianness warnings
  ide-cd: convert to using the new atapi_flags
  ide: remove unused PC_FLAG_DRQ_INTERRUPT
  ide-scsi: convert to using the new atapi_flags
  ide-tape: convert to using the new atapi_flags
  ide-floppy: convert to using the new atapi_flags (take 2)
  ide: add per-device flags
  ide: use rq->cmd instead of pc->c in atapi common code
  ide-scsi: pass packet command in rq->cmd
  ide-tape: pass packet command in rq->cmd
  ide-tape: make room for packet command ids in rq->cmd
  ide-floppy: pass packet command in rq->cmd
  ide: remove pc->callback member from ide_atapi_pc
  ide-scsi: use drive->pc_callback instead of pc->callback
  ide-tape: use drive->pc_callback instead of pc->callback
  ide-floppy: use drive->pc_callback instead of pc->callback
  ide: push pc callback pointer into the ide_drive_t structure
  drivers/ide/ide-tape.c: remove double kfree
  ...
parents 876a4256 fc410698
...@@ -510,6 +510,7 @@ config BLK_DEV_TRIFLEX ...@@ -510,6 +510,7 @@ config BLK_DEV_TRIFLEX
config BLK_DEV_CY82C693 config BLK_DEV_CY82C693
tristate "CY82C693 chipset support" tristate "CY82C693 chipset support"
depends on ALPHA
select IDE_TIMINGS select IDE_TIMINGS
select BLK_DEV_IDEDMA_PCI select BLK_DEV_IDEDMA_PCI
help help
...@@ -548,6 +549,7 @@ config BLK_DEV_CS5535 ...@@ -548,6 +549,7 @@ config BLK_DEV_CS5535
config BLK_DEV_HPT34X config BLK_DEV_HPT34X
tristate "HPT34X chipset support" tristate "HPT34X chipset support"
depends on BROKEN
select BLK_DEV_IDEDMA_PCI select BLK_DEV_IDEDMA_PCI
help help
This driver adds up to 4 more EIDE devices sharing a single This driver adds up to 4 more EIDE devices sharing a single
......
...@@ -72,7 +72,7 @@ struct icside_state { ...@@ -72,7 +72,7 @@ struct icside_state {
void __iomem *ioc_base; void __iomem *ioc_base;
unsigned int sel; unsigned int sel;
unsigned int type; unsigned int type;
ide_hwif_t *hwif[2]; struct ide_host *host;
}; };
#define ICS_TYPE_A3IN 0 #define ICS_TYPE_A3IN 0
...@@ -375,12 +375,14 @@ static int icside_dma_test_irq(ide_drive_t *drive) ...@@ -375,12 +375,14 @@ static int icside_dma_test_irq(ide_drive_t *drive)
static void icside_dma_timeout(ide_drive_t *drive) static void icside_dma_timeout(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif;
printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name); printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name);
if (icside_dma_test_irq(drive)) if (icside_dma_test_irq(drive))
return; return;
ide_dump_status(drive, "DMA timeout", ide_read_status(drive)); ide_dump_status(drive, "DMA timeout", hwif->tp_ops->read_status(hwif));
icside_dma_end(drive); icside_dma_end(drive);
} }
...@@ -440,10 +442,10 @@ static void icside_setup_ports(hw_regs_t *hw, void __iomem *base, ...@@ -440,10 +442,10 @@ static void icside_setup_ports(hw_regs_t *hw, void __iomem *base,
static int __init static int __init
icside_register_v5(struct icside_state *state, struct expansion_card *ec) icside_register_v5(struct icside_state *state, struct expansion_card *ec)
{ {
ide_hwif_t *hwif;
void __iomem *base; void __iomem *base;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; struct ide_host *host;
hw_regs_t hw; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
int ret;
base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
if (!base) if (!base)
...@@ -463,22 +465,23 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) ...@@ -463,22 +465,23 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec); icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec);
hwif = ide_find_port(); host = ide_host_alloc(NULL, hws);
if (!hwif) if (host == NULL)
return -ENODEV; return -ENODEV;
ide_init_port_hw(hwif, &hw); state->host = host;
default_hwif_mmiops(hwif);
state->hwif[0] = hwif;
ecard_set_drvdata(ec, state); ecard_set_drvdata(ec, state);
idx[0] = hwif->index; ret = ide_host_register(host, NULL, hws);
if (ret)
ide_device_add(idx, NULL); goto err_free;
return 0; return 0;
err_free:
ide_host_free(host);
ecard_set_drvdata(ec, NULL);
return ret;
} }
static const struct ide_port_info icside_v6_port_info __initdata = { static const struct ide_port_info icside_v6_port_info __initdata = {
...@@ -493,13 +496,12 @@ static const struct ide_port_info icside_v6_port_info __initdata = { ...@@ -493,13 +496,12 @@ static const struct ide_port_info icside_v6_port_info __initdata = {
static int __init static int __init
icside_register_v6(struct icside_state *state, struct expansion_card *ec) icside_register_v6(struct icside_state *state, struct expansion_card *ec)
{ {
ide_hwif_t *hwif, *mate;
void __iomem *ioc_base, *easi_base; void __iomem *ioc_base, *easi_base;
struct ide_host *host;
unsigned int sel = 0; unsigned int sel = 0;
int ret; int ret;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; hw_regs_t hw[2], *hws[] = { &hw[0], NULL, NULL, NULL };
struct ide_port_info d = icside_v6_port_info; struct ide_port_info d = icside_v6_port_info;
hw_regs_t hw[2];
ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
if (!ioc_base) { if (!ioc_base) {
...@@ -538,28 +540,11 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) ...@@ -538,28 +540,11 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
icside_setup_ports(&hw[0], easi_base, &icside_cardinfo_v6_1, ec); icside_setup_ports(&hw[0], easi_base, &icside_cardinfo_v6_1, ec);
icside_setup_ports(&hw[1], easi_base, &icside_cardinfo_v6_2, ec); icside_setup_ports(&hw[1], easi_base, &icside_cardinfo_v6_2, ec);
/* host = ide_host_alloc(&d, hws);
* Find and register the interfaces. if (host == NULL)
*/
hwif = ide_find_port();
if (hwif == NULL)
return -ENODEV; return -ENODEV;
ide_init_port_hw(hwif, &hw[0]); state->host = host;
default_hwif_mmiops(hwif);
idx[0] = hwif->index;
mate = ide_find_port();
if (mate) {
ide_init_port_hw(mate, &hw[1]);
default_hwif_mmiops(mate);
idx[1] = mate->index;
}
state->hwif[0] = hwif;
state->hwif[1] = mate;
ecard_set_drvdata(ec, state); ecard_set_drvdata(ec, state);
...@@ -569,11 +554,17 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) ...@@ -569,11 +554,17 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
d.dma_ops = NULL; d.dma_ops = NULL;
} }
ide_device_add(idx, &d); ret = ide_host_register(host, NULL, hws);
if (ret)
goto err_free;
return 0; return 0;
err_free:
out: ide_host_free(host);
if (d.dma_ops)
free_dma(ec->dma);
ecard_set_drvdata(ec, NULL);
out:
return ret; return ret;
} }
......
...@@ -28,10 +28,8 @@ ...@@ -28,10 +28,8 @@
static int __init ide_arm_init(void) static int __init ide_arm_init(void)
{ {
ide_hwif_t *hwif;
hw_regs_t hw;
unsigned long base = IDE_ARM_IO, ctl = IDE_ARM_IO + 0x206; unsigned long base = IDE_ARM_IO, ctl = IDE_ARM_IO + 0x206;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
if (!request_region(base, 8, DRV_NAME)) { if (!request_region(base, 8, DRV_NAME)) {
printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
...@@ -51,15 +49,7 @@ static int __init ide_arm_init(void) ...@@ -51,15 +49,7 @@ static int __init ide_arm_init(void)
hw.irq = IDE_ARM_IRQ; hw.irq = IDE_ARM_IRQ;
hw.chipset = ide_generic; hw.chipset = ide_generic;
hwif = ide_find_port(); return ide_host_add(NULL, hws, NULL);
if (hwif) {
ide_init_port_hw(hwif, &hw);
idx[0] = hwif->index;
ide_device_add(idx, NULL);
}
return 0;
} }
module_init(ide_arm_init); module_init(ide_arm_init);
......
...@@ -316,15 +316,14 @@ static u8 __devinit palm_bk3710_cable_detect(ide_hwif_t *hwif) ...@@ -316,15 +316,14 @@ static u8 __devinit palm_bk3710_cable_detect(ide_hwif_t *hwif)
static int __devinit palm_bk3710_init_dma(ide_hwif_t *hwif, static int __devinit palm_bk3710_init_dma(ide_hwif_t *hwif,
const struct ide_port_info *d) const struct ide_port_info *d)
{ {
unsigned long base =
hwif->io_ports.data_addr - IDE_PALM_ATA_PRI_REG_OFFSET;
printk(KERN_INFO " %s: MMIO-DMA\n", hwif->name); printk(KERN_INFO " %s: MMIO-DMA\n", hwif->name);
if (ide_allocate_dma_engine(hwif)) if (ide_allocate_dma_engine(hwif))
return -1; return -1;
ide_setup_dma(hwif, base); hwif->dma_base = hwif->io_ports.data_addr - IDE_PALM_ATA_PRI_REG_OFFSET;
hwif->dma_ops = &sff_dma_ops;
return 0; return 0;
} }
...@@ -348,11 +347,10 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev) ...@@ -348,11 +347,10 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
{ {
struct clk *clk; struct clk *clk;
struct resource *mem, *irq; struct resource *mem, *irq;
ide_hwif_t *hwif; struct ide_host *host;
unsigned long base, rate; unsigned long base, rate;
int i; int i, rc;
hw_regs_t hw; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
clk = clk_get(NULL, "IDECLK"); clk = clk_get(NULL, "IDECLK");
if (IS_ERR(clk)) if (IS_ERR(clk))
...@@ -394,24 +392,14 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev) ...@@ -394,24 +392,14 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
hw.irq = irq->start; hw.irq = irq->start;
hw.chipset = ide_palm3710; hw.chipset = ide_palm3710;
hwif = ide_find_port(); rc = ide_host_add(&palm_bk3710_port_info, hws, NULL);
if (hwif == NULL) if (rc)
goto out; goto out;
i = hwif->index;
ide_init_port_hw(hwif, &hw);
default_hwif_mmiops(hwif);
idx[0] = i;
ide_device_add(idx, &palm_bk3710_port_info);
return 0; return 0;
out: out:
printk(KERN_WARNING "Palm Chip BK3710 IDE Register Fail\n"); printk(KERN_WARNING "Palm Chip BK3710 IDE Register Fail\n");
return -ENODEV; return rc;
} }
/* work with hotplug and coldplug */ /* work with hotplug and coldplug */
......
...@@ -32,11 +32,10 @@ static void rapide_setup_ports(hw_regs_t *hw, void __iomem *base, ...@@ -32,11 +32,10 @@ static void rapide_setup_ports(hw_regs_t *hw, void __iomem *base,
static int __devinit static int __devinit
rapide_probe(struct expansion_card *ec, const struct ecard_id *id) rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
{ {
ide_hwif_t *hwif;
void __iomem *base; void __iomem *base;
struct ide_host *host;
int ret; int ret;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
hw_regs_t hw;
ret = ecard_request_resources(ec); ret = ecard_request_resources(ec);
if (ret) if (ret)
...@@ -53,20 +52,11 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -53,20 +52,11 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
hw.chipset = ide_generic; hw.chipset = ide_generic;
hw.dev = &ec->dev; hw.dev = &ec->dev;
hwif = ide_find_port(); ret = ide_host_add(&rapide_port_info, hws, &host);
if (hwif == NULL) { if (ret)
ret = -ENOENT;
goto release; goto release;
}
ide_init_port_hw(hwif, &hw);
default_hwif_mmiops(hwif);
idx[0] = hwif->index;
ide_device_add(idx, &rapide_port_info);
ecard_set_drvdata(ec, hwif); ecard_set_drvdata(ec, host);
goto out; goto out;
release: release:
...@@ -77,11 +67,11 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -77,11 +67,11 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
static void __devexit rapide_remove(struct expansion_card *ec) static void __devexit rapide_remove(struct expansion_card *ec)
{ {
ide_hwif_t *hwif = ecard_get_drvdata(ec); struct ide_host *host = ecard_get_drvdata(ec);
ecard_set_drvdata(ec, NULL); ecard_set_drvdata(ec, NULL);
ide_unregister(hwif); ide_host_remove(host);
ecard_release_resources(ec); ecard_release_resources(ec);
} }
......
...@@ -100,6 +100,8 @@ static void h8300_tf_read(ide_drive_t *drive, ide_task_t *task) ...@@ -100,6 +100,8 @@ static void h8300_tf_read(ide_drive_t *drive, ide_task_t *task)
/* be sure we're looking at the low order bits */ /* be sure we're looking at the low order bits */
outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr);
if (task->tf_flags & IDE_TFLAG_IN_FEATURE)
tf->feature = inb(io_ports->feature_addr);
if (task->tf_flags & IDE_TFLAG_IN_NSECT) if (task->tf_flags & IDE_TFLAG_IN_NSECT)
tf->nsect = inb(io_ports->nsect_addr); tf->nsect = inb(io_ports->nsect_addr);
if (task->tf_flags & IDE_TFLAG_IN_LBAL) if (task->tf_flags & IDE_TFLAG_IN_LBAL)
...@@ -153,6 +155,21 @@ static void h8300_output_data(ide_drive_t *drive, struct request *rq, ...@@ -153,6 +155,21 @@ static void h8300_output_data(ide_drive_t *drive, struct request *rq,
mm_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); mm_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
} }
static const struct ide_tp_ops h8300_tp_ops = {
.exec_command = ide_exec_command,
.read_status = ide_read_status,
.read_altstatus = ide_read_altstatus,
.read_sff_dma_status = ide_read_sff_dma_status,
.set_irq = ide_set_irq,
.tf_load = h8300_tf_load,
.tf_read = h8300_tf_read,
.input_data = h8300_input_data,
.output_data = h8300_output_data,
};
#define H8300_IDE_GAP (2) #define H8300_IDE_GAP (2)
static inline void hw_setup(hw_regs_t *hw) static inline void hw_setup(hw_regs_t *hw)
...@@ -167,27 +184,14 @@ static inline void hw_setup(hw_regs_t *hw) ...@@ -167,27 +184,14 @@ static inline void hw_setup(hw_regs_t *hw)
hw->chipset = ide_generic; hw->chipset = ide_generic;
} }
static inline void hwif_setup(ide_hwif_t *hwif)
{
default_hwif_iops(hwif);
hwif->tf_load = h8300_tf_load;
hwif->tf_read = h8300_tf_read;
hwif->input_data = h8300_input_data;
hwif->output_data = h8300_output_data;
}
static const struct ide_port_info h8300_port_info = { static const struct ide_port_info h8300_port_info = {
.tp_ops = &h8300_tp_ops,
.host_flags = IDE_HFLAG_NO_IO_32BIT | IDE_HFLAG_NO_DMA, .host_flags = IDE_HFLAG_NO_IO_32BIT | IDE_HFLAG_NO_DMA,
}; };
static int __init h8300_ide_init(void) static int __init h8300_ide_init(void)
{ {
hw_regs_t hw; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
ide_hwif_t *hwif;
int index;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
printk(KERN_INFO DRV_NAME ": H8/300 generic IDE interface\n"); printk(KERN_INFO DRV_NAME ": H8/300 generic IDE interface\n");
...@@ -200,19 +204,7 @@ static int __init h8300_ide_init(void) ...@@ -200,19 +204,7 @@ static int __init h8300_ide_init(void)
hw_setup(&hw); hw_setup(&hw);
hwif = ide_find_port_slot(&h8300_port_info); return ide_host_add(&h8300_port_info, hws, NULL);
if (hwif == NULL)
return -ENOENT;
index = hwif->index;
ide_init_port_hw(hwif, &hw);
hwif_setup(hwif);
idx[0] = index;
ide_device_add(idx, &h8300_port_info);
return 0;
out_busy: out_busy:
printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n"); printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n");
......
...@@ -22,6 +22,8 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -22,6 +22,8 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int)) void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int))
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct request *rq = hwif->hwgroup->rq;
const struct ide_tp_ops *tp_ops = hwif->tp_ops;
xfer_func_t *xferfunc; xfer_func_t *xferfunc;
unsigned int temp; unsigned int temp;
u16 bcount; u16 bcount;
...@@ -30,12 +32,12 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -30,12 +32,12 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
debug_log("Enter %s - interrupt handler\n", __func__); debug_log("Enter %s - interrupt handler\n", __func__);
if (pc->flags & PC_FLAG_TIMEDOUT) { if (pc->flags & PC_FLAG_TIMEDOUT) {
pc->callback(drive); drive->pc_callback(drive);
return ide_stopped; return ide_stopped;
} }
/* Clear the interrupt */ /* Clear the interrupt */
stat = ide_read_status(drive); stat = tp_ops->read_status(hwif);
if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
if (hwif->dma_ops->dma_end(drive) || if (hwif->dma_ops->dma_end(drive) ||
...@@ -63,8 +65,9 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -63,8 +65,9 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
local_irq_enable_in_hardirq(); local_irq_enable_in_hardirq();
if (drive->media == ide_tape && !scsi && if (drive->media == ide_tape && !scsi &&
(stat & ERR_STAT) && pc->c[0] == REQUEST_SENSE) (stat & ERR_STAT) && rq->cmd[0] == REQUEST_SENSE)
stat &= ~ERR_STAT; stat &= ~ERR_STAT;
if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) { if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) {
/* Error detected */ /* Error detected */
debug_log("%s: I/O error\n", drive->name); debug_log("%s: I/O error\n", drive->name);
...@@ -75,16 +78,17 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -75,16 +78,17 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
goto cmd_finished; goto cmd_finished;
} }
if (pc->c[0] == REQUEST_SENSE) { if (rq->cmd[0] == REQUEST_SENSE) {
printk(KERN_ERR "%s: I/O error in request sense" printk(KERN_ERR "%s: I/O error in request sense"
" command\n", drive->name); " command\n", drive->name);
return ide_do_reset(drive); return ide_do_reset(drive);
} }
debug_log("[cmd %x]: check condition\n", pc->c[0]); debug_log("[cmd %x]: check condition\n", rq->cmd[0]);
/* Retry operation */ /* Retry operation */
retry_pc(drive); retry_pc(drive);
/* queued, but not started */ /* queued, but not started */
return ide_stopped; return ide_stopped;
} }
...@@ -95,8 +99,10 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -95,8 +99,10 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
dsc_handle(drive); dsc_handle(drive);
return ide_stopped; return ide_stopped;
} }
/* Command finished - Call the callback function */ /* Command finished - Call the callback function */
pc->callback(drive); drive->pc_callback(drive);
return ide_stopped; return ide_stopped;
} }
...@@ -107,16 +113,15 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -107,16 +113,15 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
ide_dma_off(drive); ide_dma_off(drive);
return ide_do_reset(drive); return ide_do_reset(drive);
} }
/* Get the number of bytes to transfer on this interrupt. */
bcount = (hwif->INB(hwif->io_ports.lbah_addr) << 8) |
hwif->INB(hwif->io_ports.lbam_addr);
ireason = hwif->INB(hwif->io_ports.nsect_addr); /* Get the number of bytes to transfer on this interrupt. */
ide_read_bcount_and_ireason(drive, &bcount, &ireason);
if (ireason & CD) { if (ireason & CD) {
printk(KERN_ERR "%s: CoD != 0 in %s\n", drive->name, __func__); printk(KERN_ERR "%s: CoD != 0 in %s\n", drive->name, __func__);
return ide_do_reset(drive); return ide_do_reset(drive);
} }
if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) { if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) {
/* Hopefully, we will never get here */ /* Hopefully, we will never get here */
printk(KERN_ERR "%s: We wanted to %s, but the device wants us " printk(KERN_ERR "%s: We wanted to %s, but the device wants us "
...@@ -125,6 +130,7 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -125,6 +130,7 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
(ireason & IO) ? "Read" : "Write"); (ireason & IO) ? "Read" : "Write");
return ide_do_reset(drive); return ide_do_reset(drive);
} }
if (!(pc->flags & PC_FLAG_WRITING)) { if (!(pc->flags & PC_FLAG_WRITING)) {
/* Reading - Check that we have enough space */ /* Reading - Check that we have enough space */
temp = pc->xferred + bcount; temp = pc->xferred + bcount;
...@@ -142,7 +148,7 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -142,7 +148,7 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
if (pc->sg) if (pc->sg)
io_buffers(drive, pc, temp, 0); io_buffers(drive, pc, temp, 0);
else else
hwif->input_data(drive, NULL, tp_ops->input_data(drive, NULL,
pc->cur_pos, temp); pc->cur_pos, temp);
printk(KERN_ERR "%s: transferred %d of " printk(KERN_ERR "%s: transferred %d of "
"%d bytes\n", "%d bytes\n",
...@@ -159,9 +165,9 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -159,9 +165,9 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
debug_log("The device wants to send us more data than " debug_log("The device wants to send us more data than "
"expected - allowing transfer\n"); "expected - allowing transfer\n");
} }
xferfunc = hwif->input_data; xferfunc = tp_ops->input_data;
} else } else
xferfunc = hwif->output_data; xferfunc = tp_ops->output_data;
if ((drive->media == ide_floppy && !scsi && !pc->buf) || if ((drive->media == ide_floppy && !scsi && !pc->buf) ||
(drive->media == ide_tape && !scsi && pc->bh) || (drive->media == ide_tape && !scsi && pc->bh) ||
...@@ -175,7 +181,7 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -175,7 +181,7 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
pc->cur_pos += bcount; pc->cur_pos += bcount;
debug_log("[cmd %x] transferred %d bytes on that intr.\n", debug_log("[cmd %x] transferred %d bytes on that intr.\n",
pc->c[0], bcount); rq->cmd[0], bcount);
/* And set the interrupt handler again */ /* And set the interrupt handler again */
ide_set_handler(drive, handler, timeout, expiry); ide_set_handler(drive, handler, timeout, expiry);
...@@ -183,16 +189,27 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -183,16 +189,27 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
} }
EXPORT_SYMBOL_GPL(ide_pc_intr); EXPORT_SYMBOL_GPL(ide_pc_intr);
static u8 ide_read_ireason(ide_drive_t *drive)
{
ide_task_t task;
memset(&task, 0, sizeof(task));
task.tf_flags = IDE_TFLAG_IN_NSECT;
drive->hwif->tp_ops->tf_read(drive, &task);
return task.tf.nsect & 3;
}
static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason) static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason)
{ {
ide_hwif_t *hwif = drive->hwif;
int retries = 100; int retries = 100;
while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) { while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) {
printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing " printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing "
"a packet command, retrying\n", drive->name); "a packet command, retrying\n", drive->name);
udelay(100); udelay(100);
ireason = hwif->INB(hwif->io_ports.nsect_addr); ireason = ide_read_ireason(drive);
if (retries == 0) { if (retries == 0) {
printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing " printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing "
"a packet command, ignoring\n", "a packet command, ignoring\n",
...@@ -210,6 +227,7 @@ ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -210,6 +227,7 @@ ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc,
ide_expiry_t *expiry) ide_expiry_t *expiry)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct request *rq = hwif->hwgroup->rq;
ide_startstop_t startstop; ide_startstop_t startstop;
u8 ireason; u8 ireason;
...@@ -219,7 +237,7 @@ ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -219,7 +237,7 @@ ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc,
return startstop; return startstop;
} }
ireason = hwif->INB(hwif->io_ports.nsect_addr); ireason = ide_read_ireason(drive);
if (drive->media == ide_tape && !drive->scsi) if (drive->media == ide_tape && !drive->scsi)
ireason = ide_wait_ireason(drive, ireason); ireason = ide_wait_ireason(drive, ireason);
...@@ -239,8 +257,8 @@ ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -239,8 +257,8 @@ ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc,
} }
/* Send the actual packet */ /* Send the actual packet */
if ((pc->flags & PC_FLAG_ZIP_DRIVE) == 0) if ((drive->atapi_flags & IDE_AFLAG_ZIP_DRIVE) == 0)
hwif->output_data(drive, NULL, pc->c, 12); hwif->tp_ops->output_data(drive, NULL, rq->cmd, 12);
return ide_started; return ide_started;
} }
...@@ -284,7 +302,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -284,7 +302,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_atapi_pc *pc,
bcount, dma); bcount, dma);
/* Issue the packet command */ /* Issue the packet command */
if (pc->flags & PC_FLAG_DRQ_INTERRUPT) { if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {
ide_execute_command(drive, WIN_PACKETCMD, handler, ide_execute_command(drive, WIN_PACKETCMD, handler,
timeout, NULL); timeout, NULL);
return ide_started; return ide_started;
......
This diff is collapsed.
...@@ -27,42 +27,6 @@ ...@@ -27,42 +27,6 @@
#define ATAPI_CAPABILITIES_PAGE_SIZE (8 + 20) #define ATAPI_CAPABILITIES_PAGE_SIZE (8 + 20)
#define ATAPI_CAPABILITIES_PAGE_PAD_SIZE 4 #define ATAPI_CAPABILITIES_PAGE_PAD_SIZE 4
enum {
/* Device sends an interrupt when ready for a packet command. */
IDE_CD_FLAG_DRQ_INTERRUPT = (1 << 0),
/* Drive cannot lock the door. */
IDE_CD_FLAG_NO_DOORLOCK = (1 << 1),
/* Drive cannot eject the disc. */
IDE_CD_FLAG_NO_EJECT = (1 << 2),
/* Drive is a pre ATAPI 1.2 drive. */
IDE_CD_FLAG_PRE_ATAPI12 = (1 << 3),
/* TOC addresses are in BCD. */
IDE_CD_FLAG_TOCADDR_AS_BCD = (1 << 4),
/* TOC track numbers are in BCD. */
IDE_CD_FLAG_TOCTRACKS_AS_BCD = (1 << 5),
/*
* Drive does not provide data in multiples of SECTOR_SIZE
* when more than one interrupt is needed.
*/
IDE_CD_FLAG_LIMIT_NFRAMES = (1 << 6),
/* Seeking in progress. */
IDE_CD_FLAG_SEEKING = (1 << 7),
/* Driver has noticed a media change. */
IDE_CD_FLAG_MEDIA_CHANGED = (1 << 8),
/* Saved TOC information is current. */
IDE_CD_FLAG_TOC_VALID = (1 << 9),
/* We think that the drive door is locked. */
IDE_CD_FLAG_DOOR_LOCKED = (1 << 10),
/* SET_CD_SPEED command is unsupported. */
IDE_CD_FLAG_NO_SPEED_SELECT = (1 << 11),
IDE_CD_FLAG_VERTOS_300_SSD = (1 << 12),
IDE_CD_FLAG_VERTOS_600_ESD = (1 << 13),
IDE_CD_FLAG_SANYO_3CD = (1 << 14),
IDE_CD_FLAG_FULL_CAPS_PAGE = (1 << 15),
IDE_CD_FLAG_PLAY_AUDIO_OK = (1 << 16),
IDE_CD_FLAG_LE_SPEED_FIELDS = (1 << 17),
};
/* Structure of a MSF cdrom address. */ /* Structure of a MSF cdrom address. */
struct atapi_msf { struct atapi_msf {
byte reserved; byte reserved;
...@@ -128,8 +92,6 @@ struct cdrom_info { ...@@ -128,8 +92,6 @@ struct cdrom_info {
unsigned long last_block; unsigned long last_block;
unsigned long start_seek; unsigned long start_seek;
unsigned int cd_flags;
u8 max_speed; /* Max speed of the drive. */ u8 max_speed; /* Max speed of the drive. */
u8 current_speed; /* Current speed of the drive. */ u8 current_speed; /* Current speed of the drive. */
......
...@@ -27,10 +27,9 @@ int ide_cdrom_open_real(struct cdrom_device_info *cdi, int purpose) ...@@ -27,10 +27,9 @@ int ide_cdrom_open_real(struct cdrom_device_info *cdi, int purpose)
void ide_cdrom_release_real(struct cdrom_device_info *cdi) void ide_cdrom_release_real(struct cdrom_device_info *cdi)
{ {
ide_drive_t *drive = cdi->handle; ide_drive_t *drive = cdi->handle;
struct cdrom_info *cd = drive->driver_data;
if (!cdi->use_count) if (!cdi->use_count)
cd->cd_flags &= ~IDE_CD_FLAG_TOC_VALID; drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID;
} }
/* /*
...@@ -83,13 +82,12 @@ int ide_cdrom_check_media_change_real(struct cdrom_device_info *cdi, ...@@ -83,13 +82,12 @@ int ide_cdrom_check_media_change_real(struct cdrom_device_info *cdi,
int slot_nr) int slot_nr)
{ {
ide_drive_t *drive = cdi->handle; ide_drive_t *drive = cdi->handle;
struct cdrom_info *cd = drive->driver_data;
int retval; int retval;
if (slot_nr == CDSL_CURRENT) { if (slot_nr == CDSL_CURRENT) {
(void) cdrom_check_status(drive, NULL); (void) cdrom_check_status(drive, NULL);
retval = (cd->cd_flags & IDE_CD_FLAG_MEDIA_CHANGED) ? 1 : 0; retval = (drive->atapi_flags & IDE_AFLAG_MEDIA_CHANGED) ? 1 : 0;
cd->cd_flags &= ~IDE_CD_FLAG_MEDIA_CHANGED; drive->atapi_flags &= ~IDE_AFLAG_MEDIA_CHANGED;
return retval; return retval;
} else { } else {
return -EINVAL; return -EINVAL;
...@@ -107,11 +105,11 @@ int cdrom_eject(ide_drive_t *drive, int ejectflag, ...@@ -107,11 +105,11 @@ int cdrom_eject(ide_drive_t *drive, int ejectflag,
char loej = 0x02; char loej = 0x02;
unsigned char cmd[BLK_MAX_CDB]; unsigned char cmd[BLK_MAX_CDB];
if ((cd->cd_flags & IDE_CD_FLAG_NO_EJECT) && !ejectflag) if ((drive->atapi_flags & IDE_AFLAG_NO_EJECT) && !ejectflag)
return -EDRIVE_CANT_DO_THIS; return -EDRIVE_CANT_DO_THIS;
/* reload fails on some drives, if the tray is locked */ /* reload fails on some drives, if the tray is locked */
if ((cd->cd_flags & IDE_CD_FLAG_DOOR_LOCKED) && ejectflag) if ((drive->atapi_flags & IDE_AFLAG_DOOR_LOCKED) && ejectflag)
return 0; return 0;
/* only tell drive to close tray if open, if it can do that */ /* only tell drive to close tray if open, if it can do that */
...@@ -123,7 +121,7 @@ int cdrom_eject(ide_drive_t *drive, int ejectflag, ...@@ -123,7 +121,7 @@ int cdrom_eject(ide_drive_t *drive, int ejectflag,
cmd[0] = GPCMD_START_STOP_UNIT; cmd[0] = GPCMD_START_STOP_UNIT;
cmd[4] = loej | (ejectflag != 0); cmd[4] = loej | (ejectflag != 0);
return ide_cd_queue_pc(drive, cmd, 0, NULL, 0, sense, 0, 0); return ide_cd_queue_pc(drive, cmd, 0, NULL, NULL, sense, 0, 0);
} }
/* Lock the door if LOCKFLAG is nonzero; unlock it otherwise. */ /* Lock the door if LOCKFLAG is nonzero; unlock it otherwise. */
...@@ -131,7 +129,6 @@ static ...@@ -131,7 +129,6 @@ static
int ide_cd_lockdoor(ide_drive_t *drive, int lockflag, int ide_cd_lockdoor(ide_drive_t *drive, int lockflag,
struct request_sense *sense) struct request_sense *sense)
{ {
struct cdrom_info *cd = drive->driver_data;
struct request_sense my_sense; struct request_sense my_sense;
int stat; int stat;
...@@ -139,7 +136,7 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag, ...@@ -139,7 +136,7 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag,
sense = &my_sense; sense = &my_sense;
/* If the drive cannot lock the door, just pretend. */ /* If the drive cannot lock the door, just pretend. */
if (cd->cd_flags & IDE_CD_FLAG_NO_DOORLOCK) { if (drive->atapi_flags & IDE_AFLAG_NO_DOORLOCK) {
stat = 0; stat = 0;
} else { } else {
unsigned char cmd[BLK_MAX_CDB]; unsigned char cmd[BLK_MAX_CDB];
...@@ -149,7 +146,7 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag, ...@@ -149,7 +146,7 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag,
cmd[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL; cmd[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL;
cmd[4] = lockflag ? 1 : 0; cmd[4] = lockflag ? 1 : 0;
stat = ide_cd_queue_pc(drive, cmd, 0, NULL, 0, stat = ide_cd_queue_pc(drive, cmd, 0, NULL, NULL,
sense, 0, 0); sense, 0, 0);
} }
...@@ -160,7 +157,7 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag, ...@@ -160,7 +157,7 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag,
(sense->asc == 0x24 || sense->asc == 0x20)) { (sense->asc == 0x24 || sense->asc == 0x20)) {
printk(KERN_ERR "%s: door locking not supported\n", printk(KERN_ERR "%s: door locking not supported\n",
drive->name); drive->name);
cd->cd_flags |= IDE_CD_FLAG_NO_DOORLOCK; drive->atapi_flags |= IDE_AFLAG_NO_DOORLOCK;
stat = 0; stat = 0;
} }
...@@ -170,9 +167,9 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag, ...@@ -170,9 +167,9 @@ int ide_cd_lockdoor(ide_drive_t *drive, int lockflag,
if (stat == 0) { if (stat == 0) {
if (lockflag) if (lockflag)
cd->cd_flags |= IDE_CD_FLAG_DOOR_LOCKED; drive->atapi_flags |= IDE_AFLAG_DOOR_LOCKED;
else else
cd->cd_flags &= ~IDE_CD_FLAG_DOOR_LOCKED; drive->atapi_flags &= ~IDE_AFLAG_DOOR_LOCKED;
} }
return stat; return stat;
...@@ -231,7 +228,7 @@ int ide_cdrom_select_speed(struct cdrom_device_info *cdi, int speed) ...@@ -231,7 +228,7 @@ int ide_cdrom_select_speed(struct cdrom_device_info *cdi, int speed)
cmd[5] = speed & 0xff; cmd[5] = speed & 0xff;
} }
stat = ide_cd_queue_pc(drive, cmd, 0, NULL, 0, &sense, 0, 0); stat = ide_cd_queue_pc(drive, cmd, 0, NULL, NULL, &sense, 0, 0);
if (!ide_cdrom_get_capabilities(drive, buf)) { if (!ide_cdrom_get_capabilities(drive, buf)) {
ide_cdrom_update_speed(drive, buf); ide_cdrom_update_speed(drive, buf);
...@@ -250,7 +247,7 @@ int ide_cdrom_get_last_session(struct cdrom_device_info *cdi, ...@@ -250,7 +247,7 @@ int ide_cdrom_get_last_session(struct cdrom_device_info *cdi,
struct request_sense sense; struct request_sense sense;
int ret; int ret;
if ((info->cd_flags & IDE_CD_FLAG_TOC_VALID) == 0 || !info->toc) { if ((drive->atapi_flags & IDE_AFLAG_TOC_VALID) == 0 || !info->toc) {
ret = ide_cd_read_toc(drive, &sense); ret = ide_cd_read_toc(drive, &sense);
if (ret) if (ret)
return ret; return ret;
...@@ -308,7 +305,7 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi) ...@@ -308,7 +305,7 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi)
* A reset will unlock the door. If it was previously locked, * A reset will unlock the door. If it was previously locked,
* lock it again. * lock it again.
*/ */
if (cd->cd_flags & IDE_CD_FLAG_DOOR_LOCKED) if (drive->atapi_flags & IDE_AFLAG_DOOR_LOCKED)
(void)ide_cd_lockdoor(drive, 1, &sense); (void)ide_cd_lockdoor(drive, 1, &sense);
return ret; return ret;
...@@ -324,7 +321,7 @@ static int ide_cd_get_toc_entry(ide_drive_t *drive, int track, ...@@ -324,7 +321,7 @@ static int ide_cd_get_toc_entry(ide_drive_t *drive, int track,
/* /*
* don't serve cached data, if the toc isn't valid * don't serve cached data, if the toc isn't valid
*/ */
if ((info->cd_flags & IDE_CD_FLAG_TOC_VALID) == 0) if ((drive->atapi_flags & IDE_AFLAG_TOC_VALID) == 0)
return -EINVAL; return -EINVAL;
/* Check validity of requested track number. */ /* Check validity of requested track number. */
...@@ -374,7 +371,7 @@ static int ide_cd_fake_play_trkind(ide_drive_t *drive, void *arg) ...@@ -374,7 +371,7 @@ static int ide_cd_fake_play_trkind(ide_drive_t *drive, void *arg)
lba_to_msf(lba_start, &cmd[3], &cmd[4], &cmd[5]); lba_to_msf(lba_start, &cmd[3], &cmd[4], &cmd[5]);
lba_to_msf(lba_end - 1, &cmd[6], &cmd[7], &cmd[8]); lba_to_msf(lba_end - 1, &cmd[6], &cmd[7], &cmd[8]);
return ide_cd_queue_pc(drive, cmd, 0, NULL, 0, &sense, 0, 0); return ide_cd_queue_pc(drive, cmd, 0, NULL, NULL, &sense, 0, 0);
} }
static int ide_cd_read_tochdr(ide_drive_t *drive, void *arg) static int ide_cd_read_tochdr(ide_drive_t *drive, void *arg)
......
...@@ -158,7 +158,7 @@ static void ide_tf_set_cmd(ide_drive_t *drive, ide_task_t *task, u8 dma) ...@@ -158,7 +158,7 @@ static void ide_tf_set_cmd(ide_drive_t *drive, ide_task_t *task, u8 dma)
write = (task->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0; write = (task->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0;
if (dma) if (dma)
index = drive->vdma ? 4 : 8; index = 8;
else else
index = drive->mult_count ? 0 : 4; index = drive->mult_count ? 0 : 4;
......
...@@ -100,10 +100,11 @@ static const struct drive_list_entry drive_blacklist [] = { ...@@ -100,10 +100,11 @@ static const struct drive_list_entry drive_blacklist [] = {
ide_startstop_t ide_dma_intr (ide_drive_t *drive) ide_startstop_t ide_dma_intr (ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif;
u8 stat = 0, dma_stat = 0; u8 stat = 0, dma_stat = 0;
dma_stat = drive->hwif->dma_ops->dma_end(drive); dma_stat = hwif->dma_ops->dma_end(drive);
stat = ide_read_status(drive); stat = hwif->tp_ops->read_status(hwif);
if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) { if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
if (!dma_stat) { if (!dma_stat) {
...@@ -334,7 +335,7 @@ static int config_drive_for_dma (ide_drive_t *drive) ...@@ -334,7 +335,7 @@ static int config_drive_for_dma (ide_drive_t *drive)
static int dma_timer_expiry (ide_drive_t *drive) static int dma_timer_expiry (ide_drive_t *drive)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
u8 dma_stat = hwif->INB(hwif->dma_status); u8 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif);
printk(KERN_WARNING "%s: dma_timer_expiry: dma status == 0x%02x\n", printk(KERN_WARNING "%s: dma_timer_expiry: dma status == 0x%02x\n",
drive->name, dma_stat); drive->name, dma_stat);
...@@ -369,14 +370,18 @@ void ide_dma_host_set(ide_drive_t *drive, int on) ...@@ -369,14 +370,18 @@ void ide_dma_host_set(ide_drive_t *drive, int on)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
u8 unit = (drive->select.b.unit & 0x01); u8 unit = (drive->select.b.unit & 0x01);
u8 dma_stat = hwif->INB(hwif->dma_status); u8 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif);
if (on) if (on)
dma_stat |= (1 << (5 + unit)); dma_stat |= (1 << (5 + unit));
else else
dma_stat &= ~(1 << (5 + unit)); dma_stat &= ~(1 << (5 + unit));
hwif->OUTB(dma_stat, hwif->dma_status); if (hwif->host_flags & IDE_HFLAG_MMIO)
writeb(dma_stat,
(void __iomem *)(hwif->dma_base + ATA_DMA_STATUS));
else
outb(dma_stat, hwif->dma_base + ATA_DMA_STATUS);
} }
EXPORT_SYMBOL_GPL(ide_dma_host_set); EXPORT_SYMBOL_GPL(ide_dma_host_set);
...@@ -449,6 +454,7 @@ int ide_dma_setup(ide_drive_t *drive) ...@@ -449,6 +454,7 @@ int ide_dma_setup(ide_drive_t *drive)
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct request *rq = HWGROUP(drive)->rq; struct request *rq = HWGROUP(drive)->rq;
unsigned int reading; unsigned int reading;
u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
u8 dma_stat; u8 dma_stat;
if (rq_data_dir(rq)) if (rq_data_dir(rq))
...@@ -470,13 +476,21 @@ int ide_dma_setup(ide_drive_t *drive) ...@@ -470,13 +476,21 @@ int ide_dma_setup(ide_drive_t *drive)
outl(hwif->dmatable_dma, hwif->dma_base + ATA_DMA_TABLE_OFS); outl(hwif->dmatable_dma, hwif->dma_base + ATA_DMA_TABLE_OFS);
/* specify r/w */ /* specify r/w */
hwif->OUTB(reading, hwif->dma_command); if (mmio)
writeb(reading, (void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
else
outb(reading, hwif->dma_base + ATA_DMA_CMD);
/* read dma_status for INTR & ERROR flags */ /* read DMA status for INTR & ERROR flags */
dma_stat = hwif->INB(hwif->dma_status); dma_stat = hwif->tp_ops->read_sff_dma_status(hwif);
/* clear INTR & ERROR flags */ /* clear INTR & ERROR flags */
hwif->OUTB(dma_stat|6, hwif->dma_status); if (mmio)
writeb(dma_stat | 6,
(void __iomem *)(hwif->dma_base + ATA_DMA_STATUS));
else
outb(dma_stat | 6, hwif->dma_base + ATA_DMA_STATUS);
drive->waiting_for_dma = 1; drive->waiting_for_dma = 1;
return 0; return 0;
} }
...@@ -492,16 +506,24 @@ EXPORT_SYMBOL_GPL(ide_dma_exec_cmd); ...@@ -492,16 +506,24 @@ EXPORT_SYMBOL_GPL(ide_dma_exec_cmd);
void ide_dma_start(ide_drive_t *drive) void ide_dma_start(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = drive->hwif;
u8 dma_cmd = hwif->INB(hwif->dma_command); u8 dma_cmd;
/* Note that this is done *after* the cmd has /* Note that this is done *after* the cmd has
* been issued to the drive, as per the BM-IDE spec. * been issued to the drive, as per the BM-IDE spec.
* The Promise Ultra33 doesn't work correctly when * The Promise Ultra33 doesn't work correctly when
* we do this part before issuing the drive cmd. * we do this part before issuing the drive cmd.
*/ */
/* start DMA */ if (hwif->host_flags & IDE_HFLAG_MMIO) {
hwif->OUTB(dma_cmd|1, hwif->dma_command); dma_cmd = readb((void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
/* start DMA */
writeb(dma_cmd | 1,
(void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
} else {
dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
outb(dma_cmd | 1, hwif->dma_base + ATA_DMA_CMD);
}
hwif->dma = 1; hwif->dma = 1;
wmb(); wmb();
} }
...@@ -511,18 +533,33 @@ EXPORT_SYMBOL_GPL(ide_dma_start); ...@@ -511,18 +533,33 @@ EXPORT_SYMBOL_GPL(ide_dma_start);
/* returns 1 on error, 0 otherwise */ /* returns 1 on error, 0 otherwise */
int __ide_dma_end (ide_drive_t *drive) int __ide_dma_end (ide_drive_t *drive)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = drive->hwif;
u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
u8 dma_stat = 0, dma_cmd = 0; u8 dma_stat = 0, dma_cmd = 0;
drive->waiting_for_dma = 0; drive->waiting_for_dma = 0;
/* get dma_command mode */
dma_cmd = hwif->INB(hwif->dma_command); if (mmio) {
/* stop DMA */ /* get DMA command mode */
hwif->OUTB(dma_cmd&~1, hwif->dma_command); dma_cmd = readb((void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
/* stop DMA */
writeb(dma_cmd & ~1,
(void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
} else {
dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
}
/* get DMA status */ /* get DMA status */
dma_stat = hwif->INB(hwif->dma_status); dma_stat = hwif->tp_ops->read_sff_dma_status(hwif);
/* clear the INTR & ERROR bits */
hwif->OUTB(dma_stat|6, hwif->dma_status); if (mmio)
/* clear the INTR & ERROR bits */
writeb(dma_stat | 6,
(void __iomem *)(hwif->dma_base + ATA_DMA_STATUS));
else
outb(dma_stat | 6, hwif->dma_base + ATA_DMA_STATUS);
/* purge DMA mappings */ /* purge DMA mappings */
ide_destroy_dmatable(drive); ide_destroy_dmatable(drive);
/* verify good DMA status */ /* verify good DMA status */
...@@ -537,7 +574,7 @@ EXPORT_SYMBOL(__ide_dma_end); ...@@ -537,7 +574,7 @@ EXPORT_SYMBOL(__ide_dma_end);
int ide_dma_test_irq(ide_drive_t *drive) int ide_dma_test_irq(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
u8 dma_stat = hwif->INB(hwif->dma_status); u8 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif);
/* return 1 if INTR asserted */ /* return 1 if INTR asserted */
if ((dma_stat & 4) == 4) if ((dma_stat & 4) == 4)
...@@ -719,9 +756,8 @@ static int ide_tune_dma(ide_drive_t *drive) ...@@ -719,9 +756,8 @@ static int ide_tune_dma(ide_drive_t *drive)
static int ide_dma_check(ide_drive_t *drive) static int ide_dma_check(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
int vdma = (hwif->host_flags & IDE_HFLAG_VDMA)? 1 : 0;
if (!vdma && ide_tune_dma(drive)) if (ide_tune_dma(drive))
return 0; return 0;
/* TODO: always do PIO fallback */ /* TODO: always do PIO fallback */
...@@ -730,7 +766,7 @@ static int ide_dma_check(ide_drive_t *drive) ...@@ -730,7 +766,7 @@ static int ide_dma_check(ide_drive_t *drive)
ide_set_max_pio(drive); ide_set_max_pio(drive);
return vdma ? 0 : -1; return -1;
} }
int ide_id_dma_bug(ide_drive_t *drive) int ide_id_dma_bug(ide_drive_t *drive)
...@@ -842,7 +878,7 @@ int ide_allocate_dma_engine(ide_hwif_t *hwif) ...@@ -842,7 +878,7 @@ int ide_allocate_dma_engine(ide_hwif_t *hwif)
} }
EXPORT_SYMBOL_GPL(ide_allocate_dma_engine); EXPORT_SYMBOL_GPL(ide_allocate_dma_engine);
static const struct ide_dma_ops sff_dma_ops = { const struct ide_dma_ops sff_dma_ops = {
.dma_host_set = ide_dma_host_set, .dma_host_set = ide_dma_host_set,
.dma_setup = ide_dma_setup, .dma_setup = ide_dma_setup,
.dma_exec_cmd = ide_dma_exec_cmd, .dma_exec_cmd = ide_dma_exec_cmd,
...@@ -852,18 +888,5 @@ static const struct ide_dma_ops sff_dma_ops = { ...@@ -852,18 +888,5 @@ static const struct ide_dma_ops sff_dma_ops = {
.dma_timeout = ide_dma_timeout, .dma_timeout = ide_dma_timeout,
.dma_lost_irq = ide_dma_lost_irq, .dma_lost_irq = ide_dma_lost_irq,
}; };
EXPORT_SYMBOL_GPL(sff_dma_ops);
void ide_setup_dma(ide_hwif_t *hwif, unsigned long base)
{
hwif->dma_base = base;
if (!hwif->dma_command)
hwif->dma_command = hwif->dma_base + 0;
if (!hwif->dma_status)
hwif->dma_status = hwif->dma_base + 2;
hwif->dma_ops = &sff_dma_ops;
}
EXPORT_SYMBOL_GPL(ide_setup_dma);
#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */
This diff is collapsed.
...@@ -28,29 +28,21 @@ MODULE_PARM_DESC(probe_mask, "probe mask for legacy ISA IDE ports"); ...@@ -28,29 +28,21 @@ MODULE_PARM_DESC(probe_mask, "probe mask for legacy ISA IDE ports");
static ssize_t store_add(struct class *cls, const char *buf, size_t n) static ssize_t store_add(struct class *cls, const char *buf, size_t n)
{ {
ide_hwif_t *hwif;
unsigned int base, ctl; unsigned int base, ctl;
int irq; int irq, rc;
hw_regs_t hw; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
u8 idx[] = { 0xff, 0xff, 0xff, 0xff };
if (sscanf(buf, "%x:%x:%d", &base, &ctl, &irq) != 3) if (sscanf(buf, "%x:%x:%d", &base, &ctl, &irq) != 3)
return -EINVAL; return -EINVAL;
hwif = ide_find_port();
if (hwif == NULL)
return -ENOENT;
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
ide_std_init_ports(&hw, base, ctl); ide_std_init_ports(&hw, base, ctl);
hw.irq = irq; hw.irq = irq;
hw.chipset = ide_generic; hw.chipset = ide_generic;
ide_init_port_hw(hwif, &hw); rc = ide_host_add(NULL, hws, NULL);
if (rc)
idx[0] = hwif->index; return rc;
ide_device_add(idx, NULL);
return n; return n;
}; };
...@@ -90,18 +82,18 @@ static int __init ide_generic_sysfs_init(void) ...@@ -90,18 +82,18 @@ static int __init ide_generic_sysfs_init(void)
static int __init ide_generic_init(void) static int __init ide_generic_init(void)
{ {
u8 idx[MAX_HWIFS]; hw_regs_t hw[MAX_HWIFS], *hws[MAX_HWIFS];
int i; struct ide_host *host;
unsigned long io_addr;
int i, rc;
printk(KERN_INFO DRV_NAME ": please use \"probe_mask=0x3f\" module " printk(KERN_INFO DRV_NAME ": please use \"probe_mask=0x3f\" module "
"parameter for probing all legacy ISA IDE ports\n"); "parameter for probing all legacy ISA IDE ports\n");
for (i = 0; i < MAX_HWIFS; i++) { for (i = 0; i < MAX_HWIFS; i++) {
ide_hwif_t *hwif; io_addr = ide_default_io_base(i);
unsigned long io_addr = ide_default_io_base(i);
hw_regs_t hw;
idx[i] = 0xff; hws[i] = NULL;
if ((probe_mask & (1 << i)) && io_addr) { if ((probe_mask & (1 << i)) && io_addr) {
if (!request_region(io_addr, 8, DRV_NAME)) { if (!request_region(io_addr, 8, DRV_NAME)) {
...@@ -119,33 +111,42 @@ static int __init ide_generic_init(void) ...@@ -119,33 +111,42 @@ static int __init ide_generic_init(void)
continue; continue;
} }
/* memset(&hw[i], 0, sizeof(hw[i]));
* Skip probing if the corresponding ide_std_init_ports(&hw[i], io_addr, io_addr + 0x206);
* slot is already occupied. hw[i].irq = ide_default_irq(io_addr);
*/ hw[i].chipset = ide_generic;
hwif = ide_find_port();
if (hwif == NULL || hwif->index != i) {
idx[i] = 0xff;
continue;
}
memset(&hw, 0, sizeof(hw));
ide_std_init_ports(&hw, io_addr, io_addr + 0x206);
hw.irq = ide_default_irq(io_addr);
hw.chipset = ide_generic;
ide_init_port_hw(hwif, &hw);
idx[i] = i; hws[i] = &hw[i];
} }
} }
ide_device_add_all(idx, NULL); host = ide_host_alloc_all(NULL, hws);
if (host == NULL) {
rc = -ENOMEM;
goto err;
}
rc = ide_host_register(host, NULL, hws);
if (rc)
goto err_free;
if (ide_generic_sysfs_init()) if (ide_generic_sysfs_init())
printk(KERN_ERR DRV_NAME ": failed to create ide_generic " printk(KERN_ERR DRV_NAME ": failed to create ide_generic "
"class\n"); "class\n");
return 0; return 0;
err_free:
ide_host_free(host);
err:
for (i = 0; i < MAX_HWIFS; i++) {
if (hws[i] == NULL)
continue;
io_addr = hws[i]->io_ports.data_addr;
release_region(io_addr + 0x206, 1);
release_region(io_addr, 8);
}
return rc;
} }
module_init(ide_generic_init); module_init(ide_generic_init);
......
...@@ -330,7 +330,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) ...@@ -330,7 +330,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
tf->error = err; tf->error = err;
tf->status = stat; tf->status = stat;
drive->hwif->tf_read(drive, task); drive->hwif->tp_ops->tf_read(drive, task);
if (task->tf_flags & IDE_TFLAG_DYN) if (task->tf_flags & IDE_TFLAG_DYN)
kfree(task); kfree(task);
...@@ -381,8 +381,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 ...@@ -381,8 +381,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
if (err == ABRT_ERR) { if (err == ABRT_ERR) {
if (drive->select.b.lba && if (drive->select.b.lba &&
/* some newer drives don't support WIN_SPECIFY */ /* some newer drives don't support WIN_SPECIFY */
hwif->INB(hwif->io_ports.command_addr) == hwif->tp_ops->read_status(hwif) == WIN_SPECIFY)
WIN_SPECIFY)
return ide_stopped; return ide_stopped;
} else if ((err & BAD_CRC) == BAD_CRC) { } else if ((err & BAD_CRC) == BAD_CRC) {
/* UDMA crc error, just retry the operation */ /* UDMA crc error, just retry the operation */
...@@ -408,7 +407,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 ...@@ -408,7 +407,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
return ide_stopped; return ide_stopped;
} }
if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) if (hwif->tp_ops->read_status(hwif) & (BUSY_STAT | DRQ_STAT))
rq->errors |= ERROR_RESET; rq->errors |= ERROR_RESET;
if ((rq->errors & ERROR_RESET) == ERROR_RESET) { if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
...@@ -435,10 +434,9 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u ...@@ -435,10 +434,9 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u
/* add decoding error stuff */ /* add decoding error stuff */
} }
if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) if (hwif->tp_ops->read_status(hwif) & (BUSY_STAT | DRQ_STAT))
/* force an abort */ /* force an abort */
hwif->OUTBSYNC(hwif, WIN_IDLEIMMEDIATE, hwif->tp_ops->exec_command(hwif, WIN_IDLEIMMEDIATE);
hwif->io_ports.command_addr);
if (rq->errors >= ERROR_MAX) { if (rq->errors >= ERROR_MAX) {
ide_kill_rq(drive, rq); ide_kill_rq(drive, rq);
...@@ -712,7 +710,8 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, ...@@ -712,7 +710,8 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
#ifdef DEBUG #ifdef DEBUG
printk("%s: DRIVE_CMD (null)\n", drive->name); printk("%s: DRIVE_CMD (null)\n", drive->name);
#endif #endif
ide_end_drive_cmd(drive, ide_read_status(drive), ide_read_error(drive)); ide_end_drive_cmd(drive, hwif->tp_ops->read_status(hwif),
ide_read_error(drive));
return ide_stopped; return ide_stopped;
} }
...@@ -747,16 +746,17 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq) ...@@ -747,16 +746,17 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
* the bus may be broken enough to walk on our toes at this * the bus may be broken enough to walk on our toes at this
* point. * point.
*/ */
ide_hwif_t *hwif = drive->hwif;
int rc; int rc;
#ifdef DEBUG_PM #ifdef DEBUG_PM
printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name); printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name);
#endif #endif
rc = ide_wait_not_busy(HWIF(drive), 35000); rc = ide_wait_not_busy(hwif, 35000);
if (rc) if (rc)
printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name); printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name);
SELECT_DRIVE(drive); SELECT_DRIVE(drive);
ide_set_irq(drive, 1); hwif->tp_ops->set_irq(hwif, 1);
rc = ide_wait_not_busy(HWIF(drive), 100000); rc = ide_wait_not_busy(hwif, 100000);
if (rc) if (rc)
printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);
} }
...@@ -1042,7 +1042,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) ...@@ -1042,7 +1042,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
* quirk_list may not like intr setups/cleanups * quirk_list may not like intr setups/cleanups
*/ */
if (drive->quirk_list != 1) if (drive->quirk_list != 1)
ide_set_irq(drive, 0); hwif->tp_ops->set_irq(hwif, 0);
} }
hwgroup->hwif = hwif; hwgroup->hwif = hwif;
hwgroup->drive = drive; hwgroup->drive = drive;
...@@ -1142,7 +1142,7 @@ static ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) ...@@ -1142,7 +1142,7 @@ static ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error)
printk(KERN_WARNING "%s: DMA timeout error\n", drive->name); printk(KERN_WARNING "%s: DMA timeout error\n", drive->name);
(void)hwif->dma_ops->dma_end(drive); (void)hwif->dma_ops->dma_end(drive);
ret = ide_error(drive, "dma timeout error", ret = ide_error(drive, "dma timeout error",
ide_read_status(drive)); hwif->tp_ops->read_status(hwif));
} else { } else {
printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name); printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name);
hwif->dma_ops->dma_timeout(drive); hwif->dma_ops->dma_timeout(drive);
...@@ -1267,7 +1267,7 @@ void ide_timer_expiry (unsigned long data) ...@@ -1267,7 +1267,7 @@ void ide_timer_expiry (unsigned long data)
} else } else
startstop = startstop =
ide_error(drive, "irq timeout", ide_error(drive, "irq timeout",
ide_read_status(drive)); hwif->tp_ops->read_status(hwif));
} }
drive->service_time = jiffies - drive->service_start; drive->service_time = jiffies - drive->service_start;
spin_lock_irq(&ide_lock); spin_lock_irq(&ide_lock);
...@@ -1323,7 +1323,8 @@ static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup) ...@@ -1323,7 +1323,8 @@ static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup)
*/ */
do { do {
if (hwif->irq == irq) { if (hwif->irq == irq) {
stat = hwif->INB(hwif->io_ports.status_addr); stat = hwif->tp_ops->read_status(hwif);
if (!OK_STAT(stat, READY_STAT, BAD_STAT)) { if (!OK_STAT(stat, READY_STAT, BAD_STAT)) {
/* Try to not flood the console with msgs */ /* Try to not flood the console with msgs */
static unsigned long last_msgtime, count; static unsigned long last_msgtime, count;
...@@ -1413,7 +1414,7 @@ irqreturn_t ide_intr (int irq, void *dev_id) ...@@ -1413,7 +1414,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
* Whack the status register, just in case * Whack the status register, just in case
* we have a leftover pending IRQ. * we have a leftover pending IRQ.
*/ */
(void) hwif->INB(hwif->io_ports.status_addr); (void)hwif->tp_ops->read_status(hwif);
#endif /* CONFIG_BLK_DEV_IDEPCI */ #endif /* CONFIG_BLK_DEV_IDEPCI */
} }
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
...@@ -1519,6 +1520,7 @@ EXPORT_SYMBOL(ide_do_drive_cmd); ...@@ -1519,6 +1520,7 @@ EXPORT_SYMBOL(ide_do_drive_cmd);
void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma) void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma)
{ {
ide_hwif_t *hwif = drive->hwif;
ide_task_t task; ide_task_t task;
memset(&task, 0, sizeof(task)); memset(&task, 0, sizeof(task));
...@@ -1529,9 +1531,9 @@ void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma) ...@@ -1529,9 +1531,9 @@ void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma)
task.tf.lbah = (bcount >> 8) & 0xff; task.tf.lbah = (bcount >> 8) & 0xff;
ide_tf_dump(drive->name, &task.tf); ide_tf_dump(drive->name, &task.tf);
ide_set_irq(drive, 1); hwif->tp_ops->set_irq(hwif, 1);
SELECT_MASK(drive, 0); SELECT_MASK(drive, 0);
drive->hwif->tf_load(drive, &task); hwif->tp_ops->tf_load(drive, &task);
} }
EXPORT_SYMBOL_GPL(ide_pktcmd_tf_load); EXPORT_SYMBOL_GPL(ide_pktcmd_tf_load);
...@@ -1543,9 +1545,9 @@ void ide_pad_transfer(ide_drive_t *drive, int write, int len) ...@@ -1543,9 +1545,9 @@ void ide_pad_transfer(ide_drive_t *drive, int write, int len)
while (len > 0) { while (len > 0) {
if (write) if (write)
hwif->output_data(drive, NULL, buf, min(4, len)); hwif->tp_ops->output_data(drive, NULL, buf, min(4, len));
else else
hwif->input_data(drive, NULL, buf, min(4, len)); hwif->tp_ops->input_data(drive, NULL, buf, min(4, len));
len -= 4; len -= 4;
} }
} }
......
This diff is collapsed.
...@@ -266,22 +266,11 @@ int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) ...@@ -266,22 +266,11 @@ int ide_set_xfer_rate(ide_drive_t *drive, u8 rate)
rate = ide_rate_filter(drive, rate); rate = ide_rate_filter(drive, rate);
BUG_ON(rate < XFER_PIO_0);
if (rate >= XFER_PIO_0 && rate <= XFER_PIO_5) if (rate >= XFER_PIO_0 && rate <= XFER_PIO_5)
return ide_set_pio_mode(drive, rate); return ide_set_pio_mode(drive, rate);
/*
* TODO: transfer modes 0x00-0x07 passed from the user-space are
* currently handled here which needs fixing (please note that such
* case could happen iff the transfer mode has already been set on
* the device by ide-proc.c::set_xfer_rate()).
*/
if (rate < XFER_PIO_0) {
if (hwif->host_flags & IDE_HFLAG_ABUSE_SET_DMA_MODE)
return ide_set_dma_mode(drive, rate);
else
return ide_config_drive_speed(drive, rate);
}
return ide_set_dma_mode(drive, rate); return ide_set_dma_mode(drive, rate);
} }
...@@ -336,7 +325,7 @@ static void ide_dump_sector(ide_drive_t *drive) ...@@ -336,7 +325,7 @@ static void ide_dump_sector(ide_drive_t *drive)
else else
task.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_DEVICE; task.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_DEVICE;
drive->hwif->tf_read(drive, &task); drive->hwif->tp_ops->tf_read(drive, &task);
if (lba48 || (tf->device & ATA_LBA)) if (lba48 || (tf->device & ATA_LBA))
printk(", LBAsect=%llu", printk(", LBAsect=%llu",
......
...@@ -29,9 +29,10 @@ static struct pnp_device_id idepnp_devices[] = { ...@@ -29,9 +29,10 @@ static struct pnp_device_id idepnp_devices[] = {
static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
{ {
hw_regs_t hw; struct ide_host *host;
ide_hwif_t *hwif;
unsigned long base, ctl; unsigned long base, ctl;
int rc;
hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
printk(KERN_INFO DRV_NAME ": generic PnP IDE interface\n"); printk(KERN_INFO DRV_NAME ": generic PnP IDE interface\n");
...@@ -59,31 +60,25 @@ static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) ...@@ -59,31 +60,25 @@ static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
hw.irq = pnp_irq(dev, 0); hw.irq = pnp_irq(dev, 0);
hw.chipset = ide_generic; hw.chipset = ide_generic;
hwif = ide_find_port(); rc = ide_host_add(NULL, hws, &host);
if (hwif) { if (rc)
u8 index = hwif->index; goto out;
u8 idx[4] = { index, 0xff, 0xff, 0xff };
ide_init_port_hw(hwif, &hw); pnp_set_drvdata(dev, host);
pnp_set_drvdata(dev, hwif);
ide_device_add(idx, NULL);
return 0;
}
return 0;
out:
release_region(ctl, 1); release_region(ctl, 1);
release_region(base, 8); release_region(base, 8);
return -1; return rc;
} }
static void idepnp_remove(struct pnp_dev *dev) static void idepnp_remove(struct pnp_dev *dev)
{ {
ide_hwif_t *hwif = pnp_get_drvdata(dev); struct ide_host *host = pnp_get_drvdata(dev);
ide_unregister(hwif); ide_host_remove(host);
release_region(pnp_port_start(dev, 1), 1); release_region(pnp_port_start(dev, 1), 1);
release_region(pnp_port_start(dev, 0), 8); release_region(pnp_port_start(dev, 0), 8);
......
This diff is collapsed.
...@@ -345,7 +345,7 @@ static int set_xfer_rate (ide_drive_t *drive, int arg) ...@@ -345,7 +345,7 @@ static int set_xfer_rate (ide_drive_t *drive, int arg)
ide_task_t task; ide_task_t task;
int err; int err;
if (arg < 0 || arg > 70) if (arg < XFER_PIO_0 || arg > XFER_UDMA_6)
return -EINVAL; return -EINVAL;
memset(&task, 0, sizeof(task)); memset(&task, 0, sizeof(task));
...@@ -357,7 +357,7 @@ static int set_xfer_rate (ide_drive_t *drive, int arg) ...@@ -357,7 +357,7 @@ static int set_xfer_rate (ide_drive_t *drive, int arg)
err = ide_no_data_taskfile(drive, &task); err = ide_no_data_taskfile(drive, &task);
if (!err && arg) { if (!err) {
ide_set_xfer_rate(drive, (u8) arg); ide_set_xfer_rate(drive, (u8) arg);
ide_driveid_update(drive); ide_driveid_update(drive);
} }
......
This diff is collapsed.
...@@ -64,6 +64,7 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) ...@@ -64,6 +64,7 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
struct ide_taskfile *tf = &task->tf; struct ide_taskfile *tf = &task->tf;
ide_handler_t *handler = NULL; ide_handler_t *handler = NULL;
const struct ide_tp_ops *tp_ops = hwif->tp_ops;
const struct ide_dma_ops *dma_ops = hwif->dma_ops; const struct ide_dma_ops *dma_ops = hwif->dma_ops;
if (task->data_phase == TASKFILE_MULTI_IN || if (task->data_phase == TASKFILE_MULTI_IN ||
...@@ -80,15 +81,15 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) ...@@ -80,15 +81,15 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) { if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) {
ide_tf_dump(drive->name, tf); ide_tf_dump(drive->name, tf);
ide_set_irq(drive, 1); tp_ops->set_irq(hwif, 1);
SELECT_MASK(drive, 0); SELECT_MASK(drive, 0);
hwif->tf_load(drive, task); tp_ops->tf_load(drive, task);
} }
switch (task->data_phase) { switch (task->data_phase) {
case TASKFILE_MULTI_OUT: case TASKFILE_MULTI_OUT:
case TASKFILE_OUT: case TASKFILE_OUT:
hwif->OUTBSYNC(hwif, tf->command, hwif->io_ports.command_addr); tp_ops->exec_command(hwif, tf->command);
ndelay(400); /* FIXME */ ndelay(400); /* FIXME */
return pre_task_out_intr(drive, task->rq); return pre_task_out_intr(drive, task->rq);
case TASKFILE_MULTI_IN: case TASKFILE_MULTI_IN:
...@@ -124,7 +125,8 @@ EXPORT_SYMBOL_GPL(do_rw_taskfile); ...@@ -124,7 +125,8 @@ EXPORT_SYMBOL_GPL(do_rw_taskfile);
*/ */
static ide_startstop_t set_multmode_intr(ide_drive_t *drive) static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
{ {
u8 stat = ide_read_status(drive); ide_hwif_t *hwif = drive->hwif;
u8 stat = hwif->tp_ops->read_status(hwif);
if (OK_STAT(stat, READY_STAT, BAD_STAT)) if (OK_STAT(stat, READY_STAT, BAD_STAT))
drive->mult_count = drive->mult_req; drive->mult_count = drive->mult_req;
...@@ -141,11 +143,16 @@ static ide_startstop_t set_multmode_intr(ide_drive_t *drive) ...@@ -141,11 +143,16 @@ static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
*/ */
static ide_startstop_t set_geometry_intr(ide_drive_t *drive) static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif;
int retries = 5; int retries = 5;
u8 stat; u8 stat;
while (((stat = ide_read_status(drive)) & BUSY_STAT) && retries--) while (1) {
stat = hwif->tp_ops->read_status(hwif);
if ((stat & BUSY_STAT) == 0 || retries-- == 0)
break;
udelay(10); udelay(10);
};
if (OK_STAT(stat, READY_STAT, BAD_STAT)) if (OK_STAT(stat, READY_STAT, BAD_STAT))
return ide_stopped; return ide_stopped;
...@@ -162,7 +169,8 @@ static ide_startstop_t set_geometry_intr(ide_drive_t *drive) ...@@ -162,7 +169,8 @@ static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
*/ */
static ide_startstop_t recal_intr(ide_drive_t *drive) static ide_startstop_t recal_intr(ide_drive_t *drive)
{ {
u8 stat = ide_read_status(drive); ide_hwif_t *hwif = drive->hwif;
u8 stat = hwif->tp_ops->read_status(hwif);
if (!OK_STAT(stat, READY_STAT, BAD_STAT)) if (!OK_STAT(stat, READY_STAT, BAD_STAT))
return ide_error(drive, "recal_intr", stat); return ide_error(drive, "recal_intr", stat);
...@@ -174,11 +182,12 @@ static ide_startstop_t recal_intr(ide_drive_t *drive) ...@@ -174,11 +182,12 @@ static ide_startstop_t recal_intr(ide_drive_t *drive)
*/ */
static ide_startstop_t task_no_data_intr(ide_drive_t *drive) static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
{ {
ide_task_t *args = HWGROUP(drive)->rq->special; ide_hwif_t *hwif = drive->hwif;
ide_task_t *args = hwif->hwgroup->rq->special;
u8 stat; u8 stat;
local_irq_enable_in_hardirq(); local_irq_enable_in_hardirq();
stat = ide_read_status(drive); stat = hwif->tp_ops->read_status(hwif);
if (!OK_STAT(stat, READY_STAT, BAD_STAT)) if (!OK_STAT(stat, READY_STAT, BAD_STAT))
return ide_error(drive, "task_no_data_intr", stat); return ide_error(drive, "task_no_data_intr", stat);
...@@ -192,6 +201,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) ...@@ -192,6 +201,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
static u8 wait_drive_not_busy(ide_drive_t *drive) static u8 wait_drive_not_busy(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif;
int retries; int retries;
u8 stat; u8 stat;
...@@ -200,7 +210,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive) ...@@ -200,7 +210,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
* take up to 6 ms on some ATAPI devices, so we will wait max 10 ms. * take up to 6 ms on some ATAPI devices, so we will wait max 10 ms.
*/ */
for (retries = 0; retries < 1000; retries++) { for (retries = 0; retries < 1000; retries++) {
stat = ide_read_status(drive); stat = hwif->tp_ops->read_status(hwif);
if (stat & BUSY_STAT) if (stat & BUSY_STAT)
udelay(10); udelay(10);
...@@ -255,9 +265,9 @@ static void ide_pio_sector(ide_drive_t *drive, struct request *rq, ...@@ -255,9 +265,9 @@ static void ide_pio_sector(ide_drive_t *drive, struct request *rq,
/* do the actual data transfer */ /* do the actual data transfer */
if (write) if (write)
hwif->output_data(drive, rq, buf, SECTOR_SIZE); hwif->tp_ops->output_data(drive, rq, buf, SECTOR_SIZE);
else else
hwif->input_data(drive, rq, buf, SECTOR_SIZE); hwif->tp_ops->input_data(drive, rq, buf, SECTOR_SIZE);
kunmap_atomic(buf, KM_BIO_SRC_IRQ); kunmap_atomic(buf, KM_BIO_SRC_IRQ);
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
...@@ -383,8 +393,8 @@ static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq ...@@ -383,8 +393,8 @@ static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq
static ide_startstop_t task_in_intr(ide_drive_t *drive) static ide_startstop_t task_in_intr(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct request *rq = HWGROUP(drive)->rq; struct request *rq = hwif->hwgroup->rq;
u8 stat = ide_read_status(drive); u8 stat = hwif->tp_ops->read_status(hwif);
/* Error? */ /* Error? */
if (stat & ERR_STAT) if (stat & ERR_STAT)
...@@ -418,7 +428,7 @@ static ide_startstop_t task_out_intr (ide_drive_t *drive) ...@@ -418,7 +428,7 @@ static ide_startstop_t task_out_intr (ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct request *rq = HWGROUP(drive)->rq; struct request *rq = HWGROUP(drive)->rq;
u8 stat = ide_read_status(drive); u8 stat = hwif->tp_ops->read_status(hwif);
if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
return task_error(drive, rq, __func__, stat); return task_error(drive, rq, __func__, stat);
......
/* /*
* Copyright (C) 1994-1998 Linus Torvalds & authors (see below) * Copyright (C) 1994-1998 Linus Torvalds & authors (see below)
* Copyrifht (C) 2003-2005, 2007 Bartlomiej Zolnierkiewicz * Copyright (C) 2003-2005, 2007 Bartlomiej Zolnierkiewicz
*/ */
/* /*
...@@ -101,8 +101,7 @@ void ide_init_port_data(ide_hwif_t *hwif, unsigned int index) ...@@ -101,8 +101,7 @@ void ide_init_port_data(ide_hwif_t *hwif, unsigned int index)
init_completion(&hwif->gendev_rel_comp); init_completion(&hwif->gendev_rel_comp);
default_hwif_iops(hwif); hwif->tp_ops = &default_tp_ops;
default_hwif_transport(hwif);
ide_port_init_devices_data(hwif); ide_port_init_devices_data(hwif);
} }
...@@ -134,41 +133,6 @@ static void ide_port_init_devices_data(ide_hwif_t *hwif) ...@@ -134,41 +133,6 @@ static void ide_port_init_devices_data(ide_hwif_t *hwif)
} }
} }
void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
{
ide_hwgroup_t *hwgroup = hwif->hwgroup;
spin_lock_irq(&ide_lock);
/*
* Remove us from the hwgroup, and free
* the hwgroup if we were the only member
*/
if (hwif->next == hwif) {
BUG_ON(hwgroup->hwif != hwif);
kfree(hwgroup);
} else {
/* There is another interface in hwgroup.
* Unlink us, and set hwgroup->drive and ->hwif to
* something sane.
*/
ide_hwif_t *g = hwgroup->hwif;
while (g->next != hwif)
g = g->next;
g->next = hwif->next;
if (hwgroup->hwif == hwif) {
/* Chose a random hwif for hwgroup->hwif.
* It's guaranteed that there are no drives
* left in the hwgroup.
*/
BUG_ON(hwgroup->drive != NULL);
hwgroup->hwif = g;
}
BUG_ON(hwgroup->hwif == hwif);
}
spin_unlock_irq(&ide_lock);
}
/* Called with ide_lock held. */ /* Called with ide_lock held. */
static void __ide_port_unregister_devices(ide_hwif_t *hwif) static void __ide_port_unregister_devices(ide_hwif_t *hwif)
{ {
...@@ -269,16 +233,9 @@ void ide_unregister(ide_hwif_t *hwif) ...@@ -269,16 +233,9 @@ void ide_unregister(ide_hwif_t *hwif)
if (hwif->dma_base) if (hwif->dma_base)
ide_release_dma_engine(hwif); ide_release_dma_engine(hwif);
spin_lock_irq(&ide_lock);
/* restore hwif data to pristine status */
ide_init_port_data(hwif, hwif->index);
spin_unlock_irq(&ide_lock);
mutex_unlock(&ide_cfg_mtx); mutex_unlock(&ide_cfg_mtx);
} }
EXPORT_SYMBOL(ide_unregister);
void ide_init_port_hw(ide_hwif_t *hwif, hw_regs_t *hw) void ide_init_port_hw(ide_hwif_t *hwif, hw_regs_t *hw)
{ {
memcpy(&hwif->io_ports, &hw->io_ports, sizeof(hwif->io_ports)); memcpy(&hwif->io_ports, &hw->io_ports, sizeof(hwif->io_ports));
...@@ -287,8 +244,8 @@ void ide_init_port_hw(ide_hwif_t *hwif, hw_regs_t *hw) ...@@ -287,8 +244,8 @@ void ide_init_port_hw(ide_hwif_t *hwif, hw_regs_t *hw)
hwif->dev = hw->dev; hwif->dev = hw->dev;
hwif->gendev.parent = hw->parent ? hw->parent : hw->dev; hwif->gendev.parent = hw->parent ? hw->parent : hw->dev;
hwif->ack_intr = hw->ack_intr; hwif->ack_intr = hw->ack_intr;
hwif->config_data = hw->config;
} }
EXPORT_SYMBOL_GPL(ide_init_port_hw);
/* /*
* Locks for IDE setting functionality * Locks for IDE setting functionality
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#define CATWEASEL_NUM_HWIFS 3 #define CATWEASEL_NUM_HWIFS 3
#define XSURF_NUM_HWIFS 2 #define XSURF_NUM_HWIFS 2
#define MAX_NUM_HWIFS 3
/* /*
* Bases of the IDE interfaces (relative to the board address) * Bases of the IDE interfaces (relative to the board address)
*/ */
...@@ -148,18 +150,14 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base, ...@@ -148,18 +150,14 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base,
static int __init buddha_init(void) static int __init buddha_init(void)
{ {
hw_regs_t hw;
ide_hwif_t *hwif;
int i;
struct zorro_dev *z = NULL; struct zorro_dev *z = NULL;
u_long buddha_board = 0; u_long buddha_board = 0;
BuddhaType type; BuddhaType type;
int buddha_num_hwifs; int buddha_num_hwifs, i;
while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
unsigned long board; unsigned long board;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; hw_regs_t hw[MAX_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL };
if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) { if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) {
buddha_num_hwifs = BUDDHA_NUM_HWIFS; buddha_num_hwifs = BUDDHA_NUM_HWIFS;
...@@ -221,19 +219,13 @@ static int __init buddha_init(void) ...@@ -221,19 +219,13 @@ static int __init buddha_init(void)
ack_intr = xsurf_ack_intr; ack_intr = xsurf_ack_intr;
} }
buddha_setup_ports(&hw, base, ctl, irq_port, ack_intr); buddha_setup_ports(&hw[i], base, ctl, irq_port,
ack_intr);
hwif = ide_find_port(); hws[i] = &hw[i];
if (hwif) {
u8 index = hwif->index;
ide_init_port_hw(hwif, &hw);
idx[i] = index;
}
} }
ide_device_add(idx, NULL); ide_host_add(NULL, hws, NULL);
} }
return 0; return 0;
......
...@@ -66,6 +66,27 @@ static void falconide_output_data(ide_drive_t *drive, struct request *rq, ...@@ -66,6 +66,27 @@ static void falconide_output_data(ide_drive_t *drive, struct request *rq,
outsw_swapw(data_addr, buf, (len + 1) / 2); outsw_swapw(data_addr, buf, (len + 1) / 2);
} }
/* Atari has a byte-swapped IDE interface */
static const struct ide_tp_ops falconide_tp_ops = {
.exec_command = ide_exec_command,
.read_status = ide_read_status,
.read_altstatus = ide_read_altstatus,
.read_sff_dma_status = ide_read_sff_dma_status,
.set_irq = ide_set_irq,
.tf_load = ide_tf_load,
.tf_read = ide_tf_read,
.input_data = falconide_input_data,
.output_data = falconide_output_data,
};
static const struct ide_port_info falconide_port_info = {
.tp_ops = &falconide_tp_ops,
.host_flags = IDE_HFLAG_NO_DMA,
};
static void __init falconide_setup_ports(hw_regs_t *hw) static void __init falconide_setup_ports(hw_regs_t *hw)
{ {
int i; int i;
...@@ -91,11 +112,12 @@ static void __init falconide_setup_ports(hw_regs_t *hw) ...@@ -91,11 +112,12 @@ static void __init falconide_setup_ports(hw_regs_t *hw)
static int __init falconide_init(void) static int __init falconide_init(void)
{ {
hw_regs_t hw; struct ide_host *host;
ide_hwif_t *hwif; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
int rc;
if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE)) if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE))
return 0; return -ENODEV;
printk(KERN_INFO "ide: Falcon IDE controller\n"); printk(KERN_INFO "ide: Falcon IDE controller\n");
...@@ -106,23 +128,25 @@ static int __init falconide_init(void) ...@@ -106,23 +128,25 @@ static int __init falconide_init(void)
falconide_setup_ports(&hw); falconide_setup_ports(&hw);
hwif = ide_find_port(); host = ide_host_alloc(&falconide_port_info, hws);
if (hwif) { if (host == NULL) {
u8 index = hwif->index; rc = -ENOMEM;
u8 idx[4] = { index, 0xff, 0xff, 0xff }; goto err;
}
ide_init_port_hw(hwif, &hw);
/* Atari has a byte-swapped IDE interface */ ide_get_lock(NULL, NULL);
hwif->input_data = falconide_input_data; rc = ide_host_register(host, &falconide_port_info, hws);
hwif->output_data = falconide_output_data; ide_release_lock();
ide_get_lock(NULL, NULL); if (rc)
ide_device_add(idx, NULL); goto err_free;
ide_release_lock();
}
return 0; return 0;
err_free:
ide_host_free(host);
err:
release_mem_region(ATA_HD_BASE, 0x40);
return rc;
} }
module_init(falconide_init); module_init(falconide_init);
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#define GAYLE_BASE_4000 0xdd2020 /* A4000/A4000T */ #define GAYLE_BASE_4000 0xdd2020 /* A4000/A4000T */
#define GAYLE_BASE_1200 0xda0000 /* A1200/A600 and E-Matrix 530 */ #define GAYLE_BASE_1200 0xda0000 /* A1200/A600 and E-Matrix 530 */
#define GAYLE_IDEREG_SIZE 0x2000
/* /*
* Offsets from one of the above bases * Offsets from one of the above bases
*/ */
...@@ -56,13 +58,11 @@ ...@@ -56,13 +58,11 @@
#define GAYLE_NUM_HWIFS 1 #define GAYLE_NUM_HWIFS 1
#define GAYLE_NUM_PROBE_HWIFS GAYLE_NUM_HWIFS #define GAYLE_NUM_PROBE_HWIFS GAYLE_NUM_HWIFS
#define GAYLE_HAS_CONTROL_REG 1 #define GAYLE_HAS_CONTROL_REG 1
#define GAYLE_IDEREG_SIZE 0x2000
#else /* CONFIG_BLK_DEV_IDEDOUBLER */ #else /* CONFIG_BLK_DEV_IDEDOUBLER */
#define GAYLE_NUM_HWIFS 2 #define GAYLE_NUM_HWIFS 2
#define GAYLE_NUM_PROBE_HWIFS (ide_doubler ? GAYLE_NUM_HWIFS : \ #define GAYLE_NUM_PROBE_HWIFS (ide_doubler ? GAYLE_NUM_HWIFS : \
GAYLE_NUM_HWIFS-1) GAYLE_NUM_HWIFS-1)
#define GAYLE_HAS_CONTROL_REG (!ide_doubler) #define GAYLE_HAS_CONTROL_REG (!ide_doubler)
#define GAYLE_IDEREG_SIZE (ide_doubler ? 0x1000 : 0x2000)
static int ide_doubler; static int ide_doubler;
module_param_named(doubler, ide_doubler, bool, 0); module_param_named(doubler, ide_doubler, bool, 0);
...@@ -124,8 +124,11 @@ static void __init gayle_setup_ports(hw_regs_t *hw, unsigned long base, ...@@ -124,8 +124,11 @@ static void __init gayle_setup_ports(hw_regs_t *hw, unsigned long base,
static int __init gayle_init(void) static int __init gayle_init(void)
{ {
unsigned long phys_base, res_start, res_n;
unsigned long base, ctrlport, irqport;
ide_ack_intr_t *ack_intr;
int a4000, i; int a4000, i;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL };
if (!MACH_IS_AMIGA) if (!MACH_IS_AMIGA)
return -ENODEV; return -ENODEV;
...@@ -148,13 +151,6 @@ static int __init gayle_init(void) ...@@ -148,13 +151,6 @@ static int __init gayle_init(void)
#endif #endif
""); "");
for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) {
unsigned long base, ctrlport, irqport;
ide_ack_intr_t *ack_intr;
hw_regs_t hw;
ide_hwif_t *hwif;
unsigned long phys_base, res_start, res_n;
if (a4000) { if (a4000) {
phys_base = GAYLE_BASE_4000; phys_base = GAYLE_BASE_4000;
irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_4000); irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_4000);
...@@ -168,33 +164,22 @@ static int __init gayle_init(void) ...@@ -168,33 +164,22 @@ static int __init gayle_init(void)
* FIXME: we now have selectable modes between mmio v/s iomio * FIXME: we now have selectable modes between mmio v/s iomio
*/ */
phys_base += i*GAYLE_NEXT_PORT;
res_start = ((unsigned long)phys_base) & ~(GAYLE_NEXT_PORT-1); res_start = ((unsigned long)phys_base) & ~(GAYLE_NEXT_PORT-1);
res_n = GAYLE_IDEREG_SIZE; res_n = GAYLE_IDEREG_SIZE;
if (!request_mem_region(res_start, res_n, "IDE")) if (!request_mem_region(res_start, res_n, "IDE"))
continue; return -EBUSY;
base = (unsigned long)ZTWO_VADDR(phys_base); for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) {
base = (unsigned long)ZTWO_VADDR(phys_base + i * GAYLE_NEXT_PORT);
ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0; ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0;
gayle_setup_ports(&hw, base, ctrlport, irqport, ack_intr); gayle_setup_ports(&hw[i], base, ctrlport, irqport, ack_intr);
hwif = ide_find_port();
if (hwif) {
u8 index = hwif->index;
ide_init_port_hw(hwif, &hw); hws[i] = &hw[i];
idx[i] = index;
} else
release_mem_region(res_start, res_n);
} }
ide_device_add(idx, NULL); return ide_host_add(NULL, hws, NULL);
return 0;
} }
module_init(gayle_init); module_init(gayle_init);
......
...@@ -28,10 +28,8 @@ static const struct ide_port_info ide_4drives_port_info = { ...@@ -28,10 +28,8 @@ static const struct ide_port_info ide_4drives_port_info = {
static int __init ide_4drives_init(void) static int __init ide_4drives_init(void)
{ {
ide_hwif_t *hwif, *mate;
unsigned long base = 0x1f0, ctl = 0x3f6; unsigned long base = 0x1f0, ctl = 0x3f6;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; hw_regs_t hw, *hws[] = { &hw, &hw, NULL, NULL };
hw_regs_t hw;
if (probe_4drives == 0) if (probe_4drives == 0)
return -ENODEV; return -ENODEV;
...@@ -55,21 +53,7 @@ static int __init ide_4drives_init(void) ...@@ -55,21 +53,7 @@ static int __init ide_4drives_init(void)
hw.irq = 14; hw.irq = 14;
hw.chipset = ide_4drives; hw.chipset = ide_4drives;
hwif = ide_find_port(); return ide_host_add(&ide_4drives_port_info, hws, NULL);
if (hwif) {
ide_init_port_hw(hwif, &hw);
idx[0] = hwif->index;
}
mate = ide_find_port();
if (mate) {
ide_init_port_hw(mate, &hw);
idx[1] = mate->index;
}
ide_device_add(idx, &ide_4drives_port_info);
return 0;
} }
module_init(ide_4drives_init); module_init(ide_4drives_init);
......
...@@ -74,7 +74,7 @@ INT_MODULE_PARM(pc_debug, 0); ...@@ -74,7 +74,7 @@ INT_MODULE_PARM(pc_debug, 0);
typedef struct ide_info_t { typedef struct ide_info_t {
struct pcmcia_device *p_dev; struct pcmcia_device *p_dev;
ide_hwif_t *hwif; struct ide_host *host;
int ndev; int ndev;
dev_node_t node; dev_node_t node;
} ide_info_t; } ide_info_t;
...@@ -132,7 +132,7 @@ static int ide_probe(struct pcmcia_device *link) ...@@ -132,7 +132,7 @@ static int ide_probe(struct pcmcia_device *link)
static void ide_detach(struct pcmcia_device *link) static void ide_detach(struct pcmcia_device *link)
{ {
ide_info_t *info = link->priv; ide_info_t *info = link->priv;
ide_hwif_t *hwif = info->hwif; ide_hwif_t *hwif = info->host->ports[0];
unsigned long data_addr, ctl_addr; unsigned long data_addr, ctl_addr;
DEBUG(0, "ide_detach(0x%p)\n", link); DEBUG(0, "ide_detach(0x%p)\n", link);
...@@ -157,13 +157,13 @@ static const struct ide_port_info idecs_port_info = { ...@@ -157,13 +157,13 @@ static const struct ide_port_info idecs_port_info = {
.host_flags = IDE_HFLAG_NO_DMA, .host_flags = IDE_HFLAG_NO_DMA,
}; };
static ide_hwif_t *idecs_register(unsigned long io, unsigned long ctl, static struct ide_host *idecs_register(unsigned long io, unsigned long ctl,
unsigned long irq, struct pcmcia_device *handle) unsigned long irq, struct pcmcia_device *handle)
{ {
struct ide_host *host;
ide_hwif_t *hwif; ide_hwif_t *hwif;
hw_regs_t hw; int i, rc;
int i; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
if (!request_region(io, 8, DRV_NAME)) { if (!request_region(io, 8, DRV_NAME)) {
printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
...@@ -184,30 +184,24 @@ static ide_hwif_t *idecs_register(unsigned long io, unsigned long ctl, ...@@ -184,30 +184,24 @@ static ide_hwif_t *idecs_register(unsigned long io, unsigned long ctl,
hw.chipset = ide_pci; hw.chipset = ide_pci;
hw.dev = &handle->dev; hw.dev = &handle->dev;
hwif = ide_find_port(); rc = ide_host_add(&idecs_port_info, hws, &host);
if (hwif == NULL) if (rc)
goto out_release; goto out_release;
i = hwif->index; hwif = host->ports[0];
ide_init_port_hw(hwif, &hw);
idx[0] = i;
ide_device_add(idx, &idecs_port_info);
if (hwif->present) if (hwif->present)
return hwif; return host;
/* retry registration in case device is still spinning up */ /* retry registration in case device is still spinning up */
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
msleep(100); msleep(100);
ide_port_scan(hwif); ide_port_scan(hwif);
if (hwif->present) if (hwif->present)
return hwif; return host;
} }
return hwif; return host;
out_release: out_release:
release_region(ctl, 1); release_region(ctl, 1);
...@@ -239,7 +233,7 @@ static int ide_config(struct pcmcia_device *link) ...@@ -239,7 +233,7 @@ static int ide_config(struct pcmcia_device *link)
cistpl_cftable_entry_t *cfg; cistpl_cftable_entry_t *cfg;
int pass, last_ret = 0, last_fn = 0, is_kme = 0; int pass, last_ret = 0, last_fn = 0, is_kme = 0;
unsigned long io_base, ctl_base; unsigned long io_base, ctl_base;
ide_hwif_t *hwif; struct ide_host *host;
DEBUG(0, "ide_config(0x%p)\n", link); DEBUG(0, "ide_config(0x%p)\n", link);
...@@ -334,21 +328,21 @@ static int ide_config(struct pcmcia_device *link) ...@@ -334,21 +328,21 @@ static int ide_config(struct pcmcia_device *link)
if (is_kme) if (is_kme)
outb(0x81, ctl_base+1); outb(0x81, ctl_base+1);
hwif = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link); host = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link);
if (hwif == NULL && link->io.NumPorts1 == 0x20) { if (host == NULL && link->io.NumPorts1 == 0x20) {
outb(0x02, ctl_base + 0x10); outb(0x02, ctl_base + 0x10);
hwif = idecs_register(io_base + 0x10, ctl_base + 0x10, host = idecs_register(io_base + 0x10, ctl_base + 0x10,
link->irq.AssignedIRQ, link); link->irq.AssignedIRQ, link);
} }
if (hwif == NULL) if (host == NULL)
goto failed; goto failed;
info->ndev = 1; info->ndev = 1;
sprintf(info->node.dev_name, "hd%c", 'a' + hwif->index * 2); sprintf(info->node.dev_name, "hd%c", 'a' + host->ports[0]->index * 2);
info->node.major = hwif->major; info->node.major = host->ports[0]->major;
info->node.minor = 0; info->node.minor = 0;
info->hwif = hwif; info->host = host;
link->dev_node = &info->node; link->dev_node = &info->node;
printk(KERN_INFO "ide-cs: %s: Vpp = %d.%d\n", printk(KERN_INFO "ide-cs: %s: Vpp = %d.%d\n",
info->node.dev_name, link->conf.Vpp / 10, link->conf.Vpp % 10); info->node.dev_name, link->conf.Vpp / 10, link->conf.Vpp % 10);
...@@ -379,15 +373,15 @@ static int ide_config(struct pcmcia_device *link) ...@@ -379,15 +373,15 @@ static int ide_config(struct pcmcia_device *link)
static void ide_release(struct pcmcia_device *link) static void ide_release(struct pcmcia_device *link)
{ {
ide_info_t *info = link->priv; ide_info_t *info = link->priv;
ide_hwif_t *hwif = info->hwif; struct ide_host *host = info->host;
DEBUG(0, "ide_release(0x%p)\n", link); DEBUG(0, "ide_release(0x%p)\n", link);
if (info->ndev) { if (info->ndev)
/* FIXME: if this fails we need to queue the cleanup somehow /* FIXME: if this fails we need to queue the cleanup somehow
-- need to investigate the required PCMCIA magic */ -- need to investigate the required PCMCIA magic */
ide_unregister(hwif); ide_host_remove(host);
}
info->ndev = 0; info->ndev = 0;
pcmcia_disable_device(link); pcmcia_disable_device(link);
......
...@@ -52,12 +52,10 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) ...@@ -52,12 +52,10 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
{ {
struct resource *res_base, *res_alt, *res_irq; struct resource *res_base, *res_alt, *res_irq;
void __iomem *base, *alt_base; void __iomem *base, *alt_base;
ide_hwif_t *hwif;
struct pata_platform_info *pdata; struct pata_platform_info *pdata;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; struct ide_host *host;
int ret = 0; int ret = 0, mmio = 0;
int mmio = 0; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
hw_regs_t hw;
struct ide_port_info d = platform_ide_port_info; struct ide_port_info d = platform_ide_port_info;
pdata = pdev->dev.platform_data; pdata = pdev->dev.platform_data;
...@@ -94,28 +92,18 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) ...@@ -94,28 +92,18 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
res_alt->start, res_alt->end - res_alt->start + 1); res_alt->start, res_alt->end - res_alt->start + 1);
} }
hwif = ide_find_port();
if (!hwif) {
ret = -ENODEV;
goto out;
}
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
plat_ide_setup_ports(&hw, base, alt_base, pdata, res_irq->start); plat_ide_setup_ports(&hw, base, alt_base, pdata, res_irq->start);
hw.dev = &pdev->dev; hw.dev = &pdev->dev;
ide_init_port_hw(hwif, &hw); if (mmio)
if (mmio) {
d.host_flags |= IDE_HFLAG_MMIO; d.host_flags |= IDE_HFLAG_MMIO;
default_hwif_mmiops(hwif);
}
idx[0] = hwif->index; ret = ide_host_add(&d, hws, &host);
if (ret)
ide_device_add(idx, &d); goto out;
platform_set_drvdata(pdev, hwif); platform_set_drvdata(pdev, host);
return 0; return 0;
...@@ -125,9 +113,9 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) ...@@ -125,9 +113,9 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
static int __devexit plat_ide_remove(struct platform_device *pdev) static int __devexit plat_ide_remove(struct platform_device *pdev)
{ {
ide_hwif_t *hwif = pdev->dev.driver_data; struct ide_host *host = pdev->dev.driver_data;
ide_unregister(hwif); ide_host_remove(host);
return 0; return 0;
} }
......
...@@ -91,11 +91,10 @@ static const char *mac_ide_name[] = ...@@ -91,11 +91,10 @@ static const char *mac_ide_name[] =
static int __init macide_init(void) static int __init macide_init(void)
{ {
ide_hwif_t *hwif;
ide_ack_intr_t *ack_intr; ide_ack_intr_t *ack_intr;
unsigned long base; unsigned long base;
int irq; int irq;
hw_regs_t hw; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
if (!MACH_IS_MAC) if (!MACH_IS_MAC)
return -ENODEV; return -ENODEV;
...@@ -125,17 +124,7 @@ static int __init macide_init(void) ...@@ -125,17 +124,7 @@ static int __init macide_init(void)
macide_setup_ports(&hw, base, irq, ack_intr); macide_setup_ports(&hw, base, irq, ack_intr);
hwif = ide_find_port(); return ide_host_add(NULL, hws, NULL);
if (hwif) {
u8 index = hwif->index;
u8 idx[4] = { index, 0xff, 0xff, 0xff };
ide_init_port_hw(hwif, &hw);
ide_device_add(idx, NULL);
}
return 0;
} }
module_init(macide_init); module_init(macide_init);
......
...@@ -96,6 +96,27 @@ static void q40ide_output_data(ide_drive_t *drive, struct request *rq, ...@@ -96,6 +96,27 @@ static void q40ide_output_data(ide_drive_t *drive, struct request *rq,
outsw_swapw(data_addr, buf, (len + 1) / 2); outsw_swapw(data_addr, buf, (len + 1) / 2);
} }
/* Q40 has a byte-swapped IDE interface */
static const struct ide_tp_ops q40ide_tp_ops = {
.exec_command = ide_exec_command,
.read_status = ide_read_status,
.read_altstatus = ide_read_altstatus,
.read_sff_dma_status = ide_read_sff_dma_status,
.set_irq = ide_set_irq,
.tf_load = ide_tf_load,
.tf_read = ide_tf_read,
.input_data = q40ide_input_data,
.output_data = q40ide_output_data,
};
static const struct ide_port_info q40ide_port_info = {
.tp_ops = &q40ide_tp_ops,
.host_flags = IDE_HFLAG_NO_DMA,
};
/* /*
* the static array is needed to have the name reported in /proc/ioports, * the static array is needed to have the name reported in /proc/ioports,
* hwif->name unfortunately isn't available yet * hwif->name unfortunately isn't available yet
...@@ -111,9 +132,7 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={ ...@@ -111,9 +132,7 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={
static int __init q40ide_init(void) static int __init q40ide_init(void)
{ {
int i; int i;
ide_hwif_t *hwif; hw_regs_t hw[Q40IDE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL };
const char *name;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
if (!MACH_IS_Q40) if (!MACH_IS_Q40)
return -ENODEV; return -ENODEV;
...@@ -121,9 +140,8 @@ static int __init q40ide_init(void) ...@@ -121,9 +140,8 @@ static int __init q40ide_init(void)
printk(KERN_INFO "ide: Q40 IDE controller\n"); printk(KERN_INFO "ide: Q40 IDE controller\n");
for (i = 0; i < Q40IDE_NUM_HWIFS; i++) { for (i = 0; i < Q40IDE_NUM_HWIFS; i++) {
hw_regs_t hw; const char *name = q40_ide_names[i];
name = q40_ide_names[i];
if (!request_region(pcide_bases[i], 8, name)) { if (!request_region(pcide_bases[i], 8, name)) {
printk("could not reserve ports %lx-%lx for %s\n", printk("could not reserve ports %lx-%lx for %s\n",
pcide_bases[i],pcide_bases[i]+8,name); pcide_bases[i],pcide_bases[i]+8,name);
...@@ -135,26 +153,13 @@ static int __init q40ide_init(void) ...@@ -135,26 +153,13 @@ static int __init q40ide_init(void)
release_region(pcide_bases[i], 8); release_region(pcide_bases[i], 8);
continue; continue;
} }
q40_ide_setup_ports(&hw, pcide_bases[i], q40_ide_setup_ports(&hw[i], pcide_bases[i], NULL,
NULL,
// m68kide_iops,
q40ide_default_irq(pcide_bases[i])); q40ide_default_irq(pcide_bases[i]));
hwif = ide_find_port(); hws[i] = &hw[i];
if (hwif) {
ide_init_port_hw(hwif, &hw);
/* Q40 has a byte-swapped IDE interface */
hwif->input_data = q40ide_input_data;
hwif->output_data = q40ide_output_data;
idx[i] = hwif->index;
}
} }
ide_device_add(idx, NULL); return ide_host_add(&q40ide_port_info, hws, NULL);
return 0;
} }
module_init(q40ide_init); module_init(q40ide_init);
......
...@@ -519,6 +519,23 @@ static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif) ...@@ -519,6 +519,23 @@ static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif)
*ata_regs = ahwif->regbase + (14 << IDE_REG_SHIFT); *ata_regs = ahwif->regbase + (14 << IDE_REG_SHIFT);
} }
#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA
static const struct ide_tp_ops au1xxx_tp_ops = {
.exec_command = ide_exec_command,
.read_status = ide_read_status,
.read_altstatus = ide_read_altstatus,
.read_sff_dma_status = ide_read_sff_dma_status,
.set_irq = ide_set_irq,
.tf_load = ide_tf_load,
.tf_read = ide_tf_read,
.input_data = au1xxx_input_data,
.output_data = au1xxx_output_data,
};
#endif
static const struct ide_port_ops au1xxx_port_ops = { static const struct ide_port_ops au1xxx_port_ops = {
.set_pio_mode = au1xxx_set_pio_mode, .set_pio_mode = au1xxx_set_pio_mode,
.set_dma_mode = auide_set_dma_mode, .set_dma_mode = auide_set_dma_mode,
...@@ -526,6 +543,9 @@ static const struct ide_port_ops au1xxx_port_ops = { ...@@ -526,6 +543,9 @@ static const struct ide_port_ops au1xxx_port_ops = {
static const struct ide_port_info au1xxx_port_info = { static const struct ide_port_info au1xxx_port_info = {
.init_dma = auide_ddma_init, .init_dma = auide_ddma_init,
#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA
.tp_ops = &au1xxx_tp_ops,
#endif
.port_ops = &au1xxx_port_ops, .port_ops = &au1xxx_port_ops,
#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
.dma_ops = &au1xxx_dma_ops, .dma_ops = &au1xxx_dma_ops,
...@@ -543,11 +563,10 @@ static int au_ide_probe(struct device *dev) ...@@ -543,11 +563,10 @@ static int au_ide_probe(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
_auide_hwif *ahwif = &auide_hwif; _auide_hwif *ahwif = &auide_hwif;
ide_hwif_t *hwif;
struct resource *res; struct resource *res;
struct ide_host *host;
int ret = 0; int ret = 0;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
hw_regs_t hw;
#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
char *mode = "MWDMA2"; char *mode = "MWDMA2";
...@@ -584,36 +603,19 @@ static int au_ide_probe(struct device *dev) ...@@ -584,36 +603,19 @@ static int au_ide_probe(struct device *dev)
goto out; goto out;
} }
hwif = ide_find_port();
if (hwif == NULL) {
ret = -ENOENT;
goto out;
}
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
auide_setup_ports(&hw, ahwif); auide_setup_ports(&hw, ahwif);
hw.irq = ahwif->irq; hw.irq = ahwif->irq;
hw.dev = dev; hw.dev = dev;
hw.chipset = ide_au1xxx; hw.chipset = ide_au1xxx;
ide_init_port_hw(hwif, &hw); ret = ide_host_add(&au1xxx_port_info, hws, &host);
if (ret)
/* If the user has selected DDMA assisted copies, goto out;
then set up a few local I/O function entry points
*/
#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA
hwif->input_data = au1xxx_input_data;
hwif->output_data = au1xxx_output_data;
#endif
auide_hwif.hwif = hwif;
idx[0] = hwif->index;
ide_device_add(idx, &au1xxx_port_info); auide_hwif.hwif = host->ports[0];
dev_set_drvdata(dev, hwif); dev_set_drvdata(dev, host);
printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode ); printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode );
...@@ -625,10 +627,10 @@ static int au_ide_remove(struct device *dev) ...@@ -625,10 +627,10 @@ static int au_ide_remove(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct resource *res; struct resource *res;
ide_hwif_t *hwif = dev_get_drvdata(dev); struct ide_host *host = dev_get_drvdata(dev);
_auide_hwif *ahwif = &auide_hwif; _auide_hwif *ahwif = &auide_hwif;
ide_unregister(hwif); ide_host_remove(host);
iounmap((void *)ahwif->regbase); iounmap((void *)ahwif->regbase);
......
...@@ -72,12 +72,11 @@ static const struct ide_port_info swarm_port_info = { ...@@ -72,12 +72,11 @@ static const struct ide_port_info swarm_port_info = {
*/ */
static int __devinit swarm_ide_probe(struct device *dev) static int __devinit swarm_ide_probe(struct device *dev)
{ {
ide_hwif_t *hwif;
u8 __iomem *base; u8 __iomem *base;
struct ide_host *host;
phys_t offset, size; phys_t offset, size;
hw_regs_t hw; int i, rc;
int i; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
u8 idx[] = { 0xff, 0xff, 0xff, 0xff };
if (!SIBYTE_HAVE_IDE) if (!SIBYTE_HAVE_IDE)
return -ENODEV; return -ENODEV;
...@@ -116,26 +115,17 @@ static int __devinit swarm_ide_probe(struct device *dev) ...@@ -116,26 +115,17 @@ static int __devinit swarm_ide_probe(struct device *dev)
hw.irq = K_INT_GB_IDE; hw.irq = K_INT_GB_IDE;
hw.chipset = ide_generic; hw.chipset = ide_generic;
hwif = ide_find_port_slot(&swarm_port_info); rc = ide_host_add(&swarm_port_info, hws, &host);
if (hwif == NULL) if (rc)
goto err; goto err;
ide_init_port_hw(hwif, &hw); dev_set_drvdata(dev, host);
/* Setup MMIO ops. */
default_hwif_mmiops(hwif);
idx[0] = hwif->index;
ide_device_add(idx, &swarm_port_info);
dev_set_drvdata(dev, hwif);
return 0; return 0;
err: err:
release_resource(&swarm_ide_resource); release_resource(&swarm_ide_resource);
iounmap(base); iounmap(base);
return -ENOMEM; return rc;
} }
static struct device_driver swarm_ide_driver = { static struct device_driver swarm_ide_driver = {
......
...@@ -195,7 +195,6 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { ...@@ -195,7 +195,6 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
.host_flags = IDE_HFLAG_SERIALIZE | .host_flags = IDE_HFLAG_SERIALIZE |
IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_ATAPI_DMA |
IDE_HFLAG_NO_DSC | IDE_HFLAG_NO_DSC |
IDE_HFLAG_ABUSE_SET_DMA_MODE |
IDE_HFLAG_OFF_BOARD, IDE_HFLAG_OFF_BOARD,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
...@@ -205,7 +204,6 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { ...@@ -205,7 +204,6 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
.init_chipset = init_chipset_aec62xx, .init_chipset = init_chipset_aec62xx,
.port_ops = &atp86x_port_ops, .port_ops = &atp86x_port_ops,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_AUTODMA | .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_AUTODMA |
IDE_HFLAG_ABUSE_SET_DMA_MODE |
IDE_HFLAG_OFF_BOARD, IDE_HFLAG_OFF_BOARD,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
...@@ -216,7 +214,6 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { ...@@ -216,7 +214,6 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
.enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
.port_ops = &atp86x_port_ops, .port_ops = &atp86x_port_ops,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA | .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
IDE_HFLAG_ABUSE_SET_DMA_MODE |
IDE_HFLAG_NON_BOOTABLE, IDE_HFLAG_NON_BOOTABLE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
...@@ -226,7 +223,6 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { ...@@ -226,7 +223,6 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
.init_chipset = init_chipset_aec62xx, .init_chipset = init_chipset_aec62xx,
.port_ops = &atp86x_port_ops, .port_ops = &atp86x_port_ops,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA | .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
IDE_HFLAG_ABUSE_SET_DMA_MODE |
IDE_HFLAG_OFF_BOARD, IDE_HFLAG_OFF_BOARD,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
...@@ -237,7 +233,6 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { ...@@ -237,7 +233,6 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
.enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
.port_ops = &atp86x_port_ops, .port_ops = &atp86x_port_ops,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA | .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
IDE_HFLAG_ABUSE_SET_DMA_MODE |
IDE_HFLAG_OFF_BOARD, IDE_HFLAG_OFF_BOARD,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
......
...@@ -471,7 +471,15 @@ static int __devinit init_dma_ali15x3(ide_hwif_t *hwif, ...@@ -471,7 +471,15 @@ static int __devinit init_dma_ali15x3(ide_hwif_t *hwif,
struct pci_dev *dev = to_pci_dev(hwif->dev); struct pci_dev *dev = to_pci_dev(hwif->dev);
unsigned long base = ide_pci_dma_base(hwif, d); unsigned long base = ide_pci_dma_base(hwif, d);
if (base == 0 || ide_pci_set_master(dev, d->name) < 0) if (base == 0)
return -1;
hwif->dma_base = base;
if (ide_pci_check_simplex(hwif, d) < 0)
return -1;
if (ide_pci_set_master(dev, d->name) < 0)
return -1; return -1;
if (!hwif->channel) if (!hwif->channel)
...@@ -483,7 +491,7 @@ static int __devinit init_dma_ali15x3(ide_hwif_t *hwif, ...@@ -483,7 +491,7 @@ static int __devinit init_dma_ali15x3(ide_hwif_t *hwif,
if (ide_allocate_dma_engine(hwif)) if (ide_allocate_dma_engine(hwif))
return -1; return -1;
ide_setup_dma(hwif, base); hwif->dma_ops = &sff_dma_ops;
return 0; return 0;
} }
......
...@@ -218,7 +218,6 @@ static const struct ide_port_ops amd_port_ops = { ...@@ -218,7 +218,6 @@ static const struct ide_port_ops amd_port_ops = {
#define IDE_HFLAGS_AMD \ #define IDE_HFLAGS_AMD \
(IDE_HFLAG_PIO_NO_BLACKLIST | \ (IDE_HFLAG_PIO_NO_BLACKLIST | \
IDE_HFLAG_ABUSE_SET_DMA_MODE | \
IDE_HFLAG_POST_SET_MODE | \ IDE_HFLAG_POST_SET_MODE | \
IDE_HFLAG_IO_32BIT | \ IDE_HFLAG_IO_32BIT | \
IDE_HFLAG_UNMASK_IRQS) IDE_HFLAG_UNMASK_IRQS)
......
...@@ -180,11 +180,6 @@ static u8 recovery_counts[4] = {16, 16, 16, 16}; /* Recovery count (encoded) */ ...@@ -180,11 +180,6 @@ static u8 recovery_counts[4] = {16, 16, 16, 16}; /* Recovery count (encoded) */
static DEFINE_SPINLOCK(cmd640_lock); static DEFINE_SPINLOCK(cmd640_lock);
/*
* These are initialized to point at the devices we control
*/
static ide_hwif_t *cmd_hwif0, *cmd_hwif1;
/* /*
* Interface to access cmd640x registers * Interface to access cmd640x registers
*/ */
...@@ -717,8 +712,7 @@ static int __init cmd640x_init(void) ...@@ -717,8 +712,7 @@ static int __init cmd640x_init(void)
int second_port_cmd640 = 0, rc; int second_port_cmd640 = 0, rc;
const char *bus_type, *port2; const char *bus_type, *port2;
u8 b, cfr; u8 b, cfr;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; hw_regs_t hw[2], *hws[] = { NULL, NULL, NULL, NULL };
hw_regs_t hw[2];
if (cmd640_vlb && probe_for_cmd640_vlb()) { if (cmd640_vlb && probe_for_cmd640_vlb()) {
bus_type = "VLB"; bus_type = "VLB";
...@@ -781,15 +775,10 @@ static int __init cmd640x_init(void) ...@@ -781,15 +775,10 @@ static int __init cmd640x_init(void)
printk(KERN_INFO "cmd640: buggy cmd640%c interface on %s, config=0x%02x" printk(KERN_INFO "cmd640: buggy cmd640%c interface on %s, config=0x%02x"
"\n", 'a' + cmd640_chip_version - 1, bus_type, cfr); "\n", 'a' + cmd640_chip_version - 1, bus_type, cfr);
cmd_hwif0 = ide_find_port();
/* /*
* Initialize data for primary port * Initialize data for primary port
*/ */
if (cmd_hwif0) { hws[0] = &hw[0];
ide_init_port_hw(cmd_hwif0, &hw[0]);
idx[0] = cmd_hwif0->index;
}
/* /*
* Ensure compatibility by always using the slowest timings * Ensure compatibility by always using the slowest timings
...@@ -829,13 +818,9 @@ static int __init cmd640x_init(void) ...@@ -829,13 +818,9 @@ static int __init cmd640x_init(void)
/* /*
* Initialize data for secondary cmd640 port, if enabled * Initialize data for secondary cmd640 port, if enabled
*/ */
if (second_port_cmd640) { if (second_port_cmd640)
cmd_hwif1 = ide_find_port(); hws[1] = &hw[1];
if (cmd_hwif1) {
ide_init_port_hw(cmd_hwif1, &hw[1]);
idx[1] = cmd_hwif1->index;
}
}
printk(KERN_INFO "cmd640: %sserialized, secondary interface %s\n", printk(KERN_INFO "cmd640: %sserialized, secondary interface %s\n",
second_port_cmd640 ? "" : "not ", port2); second_port_cmd640 ? "" : "not ", port2);
...@@ -843,9 +828,7 @@ static int __init cmd640x_init(void) ...@@ -843,9 +828,7 @@ static int __init cmd640x_init(void)
cmd640_dump_regs(); cmd640_dump_regs();
#endif #endif
ide_device_add(idx, &cmd640_port_info); return ide_host_add(&cmd640_port_info, hws, NULL);
return 1;
} }
module_param_named(probe_vlb, cmd640_vlb, bool, 0); module_param_named(probe_vlb, cmd640_vlb, bool, 0);
......
...@@ -262,7 +262,7 @@ static int cmd648_dma_test_irq(ide_drive_t *drive) ...@@ -262,7 +262,7 @@ static int cmd648_dma_test_irq(ide_drive_t *drive)
unsigned long base = hwif->dma_base - (hwif->channel * 8); unsigned long base = hwif->dma_base - (hwif->channel * 8);
u8 irq_mask = hwif->channel ? MRDMODE_INTR_CH1 : u8 irq_mask = hwif->channel ? MRDMODE_INTR_CH1 :
MRDMODE_INTR_CH0; MRDMODE_INTR_CH0;
u8 dma_stat = inb(hwif->dma_status); u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
u8 mrdmode = inb(base + 1); u8 mrdmode = inb(base + 1);
#ifdef DEBUG #ifdef DEBUG
...@@ -286,7 +286,7 @@ static int cmd64x_dma_test_irq(ide_drive_t *drive) ...@@ -286,7 +286,7 @@ static int cmd64x_dma_test_irq(ide_drive_t *drive)
int irq_reg = hwif->channel ? ARTTIM23 : CFR; int irq_reg = hwif->channel ? ARTTIM23 : CFR;
u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 : u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 :
CFR_INTR_CH0; CFR_INTR_CH0;
u8 dma_stat = inb(hwif->dma_status); u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
u8 irq_stat = 0; u8 irq_stat = 0;
(void) pci_read_config_byte(dev, irq_reg, &irq_stat); (void) pci_read_config_byte(dev, irq_reg, &irq_stat);
...@@ -317,13 +317,13 @@ static int cmd646_1_dma_end(ide_drive_t *drive) ...@@ -317,13 +317,13 @@ static int cmd646_1_dma_end(ide_drive_t *drive)
drive->waiting_for_dma = 0; drive->waiting_for_dma = 0;
/* get DMA status */ /* get DMA status */
dma_stat = inb(hwif->dma_status); dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
/* read DMA command state */ /* read DMA command state */
dma_cmd = inb(hwif->dma_command); dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
/* stop DMA */ /* stop DMA */
outb(dma_cmd & ~1, hwif->dma_command); outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
/* clear the INTR & ERROR bits */ /* clear the INTR & ERROR bits */
outb(dma_stat | 6, hwif->dma_status); outb(dma_stat | 6, hwif->dma_base + ATA_DMA_STATUS);
/* and free any DMA resources */ /* and free any DMA resources */
ide_destroy_dmatable(drive); ide_destroy_dmatable(drive);
/* verify good DMA status */ /* verify good DMA status */
......
...@@ -62,8 +62,6 @@ static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio) ...@@ -62,8 +62,6 @@ static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio)
struct pci_dev *pdev = to_pci_dev(hwif->dev); struct pci_dev *pdev = to_pci_dev(hwif->dev);
int controller = drive->dn > 1 ? 1 : 0; int controller = drive->dn > 1 ? 1 : 0;
/* FIXME: if DMA = 1 do we need to set the DMA bit here ? */
/* 8bit CAT/CRT - 8bit command timing for channel */ /* 8bit CAT/CRT - 8bit command timing for channel */
pci_write_config_byte(pdev, 0x62 + controller, pci_write_config_byte(pdev, 0x62 + controller,
(cs5520_pio_clocks[pio].recovery << 4) | (cs5520_pio_clocks[pio].recovery << 4) |
...@@ -89,46 +87,17 @@ static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -89,46 +87,17 @@ static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed)
cs5520_set_pio_mode(drive, 0); cs5520_set_pio_mode(drive, 0);
} }
/*
* We wrap the DMA activate to set the vdma flag. This is needed
* so that the IDE DMA layer issues PIO not DMA commands over the
* DMA channel
*
* ATAPI is harder so disable it for now using IDE_HFLAG_NO_ATAPI_DMA
*/
static void cs5520_dma_host_set(ide_drive_t *drive, int on)
{
drive->vdma = on;
ide_dma_host_set(drive, on);
}
static const struct ide_port_ops cs5520_port_ops = { static const struct ide_port_ops cs5520_port_ops = {
.set_pio_mode = cs5520_set_pio_mode, .set_pio_mode = cs5520_set_pio_mode,
.set_dma_mode = cs5520_set_dma_mode, .set_dma_mode = cs5520_set_dma_mode,
}; };
static const struct ide_dma_ops cs5520_dma_ops = {
.dma_host_set = cs5520_dma_host_set,
.dma_setup = ide_dma_setup,
.dma_exec_cmd = ide_dma_exec_cmd,
.dma_start = ide_dma_start,
.dma_end = __ide_dma_end,
.dma_test_irq = ide_dma_test_irq,
.dma_lost_irq = ide_dma_lost_irq,
.dma_timeout = ide_dma_timeout,
};
/* FIXME: VDMA is disabled because it caused system hangs */
#define DECLARE_CS_DEV(name_str) \ #define DECLARE_CS_DEV(name_str) \
{ \ { \
.name = name_str, \ .name = name_str, \
.port_ops = &cs5520_port_ops, \ .port_ops = &cs5520_port_ops, \
.dma_ops = &cs5520_dma_ops, \
.host_flags = IDE_HFLAG_ISA_PORTS | \ .host_flags = IDE_HFLAG_ISA_PORTS | \
IDE_HFLAG_CS5520 | \ IDE_HFLAG_CS5520, \
IDE_HFLAG_NO_ATAPI_DMA | \
IDE_HFLAG_ABUSE_SET_DMA_MODE, \
.pio_mask = ATA_PIO4, \ .pio_mask = ATA_PIO4, \
} }
...@@ -146,7 +115,7 @@ static const struct ide_port_info cyrix_chipsets[] __devinitdata = { ...@@ -146,7 +115,7 @@ static const struct ide_port_info cyrix_chipsets[] __devinitdata = {
static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
const struct ide_port_info *d = &cyrix_chipsets[id->driver_data]; const struct ide_port_info *d = &cyrix_chipsets[id->driver_data];
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL };
ide_setup_pci_noise(dev, d); ide_setup_pci_noise(dev, d);
...@@ -168,11 +137,9 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic ...@@ -168,11 +137,9 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic
* do all the device setup for us * do all the device setup for us
*/ */
ide_pci_setup_ports(dev, d, 14, &idx[0]); ide_pci_setup_ports(dev, d, 14, &hw[0], &hws[0]);
ide_device_add(idx, d);
return 0; return ide_host_add(d, hws, NULL);
} }
static const struct pci_device_id cs5520_pci_tbl[] = { static const struct pci_device_id cs5520_pci_tbl[] = {
......
...@@ -171,8 +171,7 @@ static const struct ide_port_ops cs5535_port_ops = { ...@@ -171,8 +171,7 @@ static const struct ide_port_ops cs5535_port_ops = {
static const struct ide_port_info cs5535_chipset __devinitdata = { static const struct ide_port_info cs5535_chipset __devinitdata = {
.name = "CS5535", .name = "CS5535",
.port_ops = &cs5535_port_ops, .port_ops = &cs5535_port_ops,
.host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE,
IDE_HFLAG_ABUSE_SET_DMA_MODE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA4, .udma_mask = ATA_UDMA4,
......
...@@ -56,11 +56,10 @@ static const struct ide_port_info delkin_cb_port_info = { ...@@ -56,11 +56,10 @@ static const struct ide_port_info delkin_cb_port_info = {
static int __devinit static int __devinit
delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
{ {
struct ide_host *host;
unsigned long base; unsigned long base;
hw_regs_t hw;
ide_hwif_t *hwif = NULL;
int i, rc; int i, rc;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
rc = pci_enable_device(dev); rc = pci_enable_device(dev);
if (rc) { if (rc) {
...@@ -87,34 +86,26 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) ...@@ -87,34 +86,26 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
hw.dev = &dev->dev; hw.dev = &dev->dev;
hw.chipset = ide_pci; /* this enables IRQ sharing */ hw.chipset = ide_pci; /* this enables IRQ sharing */
hwif = ide_find_port(); rc = ide_host_add(&delkin_cb_port_info, hws, &host);
if (hwif == NULL) if (rc)
goto out_disable; goto out_disable;
i = hwif->index; pci_set_drvdata(dev, host);
ide_init_port_hw(hwif, &hw);
idx[0] = i;
ide_device_add(idx, &delkin_cb_port_info);
pci_set_drvdata(dev, hwif);
return 0; return 0;
out_disable: out_disable:
pci_release_regions(dev); pci_release_regions(dev);
pci_disable_device(dev); pci_disable_device(dev);
return -ENODEV; return rc;
} }
static void static void
delkin_cb_remove (struct pci_dev *dev) delkin_cb_remove (struct pci_dev *dev)
{ {
ide_hwif_t *hwif = pci_get_drvdata(dev); struct ide_host *host = pci_get_drvdata(dev);
ide_unregister(hwif); ide_host_remove(host);
pci_release_regions(dev); pci_release_regions(dev);
pci_disable_device(dev); pci_disable_device(dev);
......
...@@ -123,7 +123,6 @@ static const struct ide_port_ops hpt34x_port_ops = { ...@@ -123,7 +123,6 @@ static const struct ide_port_ops hpt34x_port_ops = {
#define IDE_HFLAGS_HPT34X \ #define IDE_HFLAGS_HPT34X \
(IDE_HFLAG_NO_ATAPI_DMA | \ (IDE_HFLAG_NO_ATAPI_DMA | \
IDE_HFLAG_NO_DSC | \ IDE_HFLAG_NO_DSC | \
IDE_HFLAG_ABUSE_SET_DMA_MODE | \
IDE_HFLAG_NO_AUTODMA) IDE_HFLAG_NO_AUTODMA)
static const struct ide_port_info hpt34x_chipsets[] __devinitdata = { static const struct ide_port_info hpt34x_chipsets[] __devinitdata = {
......
...@@ -801,9 +801,9 @@ static void hpt370_irq_timeout(ide_drive_t *drive) ...@@ -801,9 +801,9 @@ static void hpt370_irq_timeout(ide_drive_t *drive)
printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff); printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff);
/* get DMA command mode */ /* get DMA command mode */
dma_cmd = inb(hwif->dma_command); dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
/* stop DMA */ /* stop DMA */
outb(dma_cmd & ~0x1, hwif->dma_command); outb(dma_cmd & ~0x1, hwif->dma_base + ATA_DMA_CMD);
hpt370_clear_engine(drive); hpt370_clear_engine(drive);
} }
...@@ -818,12 +818,12 @@ static void hpt370_dma_start(ide_drive_t *drive) ...@@ -818,12 +818,12 @@ static void hpt370_dma_start(ide_drive_t *drive)
static int hpt370_dma_end(ide_drive_t *drive) static int hpt370_dma_end(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
u8 dma_stat = inb(hwif->dma_status); u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
if (dma_stat & 0x01) { if (dma_stat & 0x01) {
/* wait a little */ /* wait a little */
udelay(20); udelay(20);
dma_stat = inb(hwif->dma_status); dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
if (dma_stat & 0x01) if (dma_stat & 0x01)
hpt370_irq_timeout(drive); hpt370_irq_timeout(drive);
} }
...@@ -850,7 +850,7 @@ static int hpt374_dma_test_irq(ide_drive_t *drive) ...@@ -850,7 +850,7 @@ static int hpt374_dma_test_irq(ide_drive_t *drive)
return 0; return 0;
} }
dma_stat = inb(hwif->dma_status); dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
/* return 1 if INTR asserted */ /* return 1 if INTR asserted */
if (dma_stat & 4) if (dma_stat & 4)
return 1; return 1;
...@@ -1320,7 +1320,15 @@ static int __devinit init_dma_hpt366(ide_hwif_t *hwif, ...@@ -1320,7 +1320,15 @@ static int __devinit init_dma_hpt366(ide_hwif_t *hwif,
unsigned long flags, base = ide_pci_dma_base(hwif, d); unsigned long flags, base = ide_pci_dma_base(hwif, d);
u8 dma_old, dma_new, masterdma = 0, slavedma = 0; u8 dma_old, dma_new, masterdma = 0, slavedma = 0;
if (base == 0 || ide_pci_set_master(dev, d->name) < 0) if (base == 0)
return -1;
hwif->dma_base = base;
if (ide_pci_check_simplex(hwif, d) < 0)
return -1;
if (ide_pci_set_master(dev, d->name) < 0)
return -1; return -1;
dma_old = inb(base + 2); dma_old = inb(base + 2);
...@@ -1346,7 +1354,7 @@ static int __devinit init_dma_hpt366(ide_hwif_t *hwif, ...@@ -1346,7 +1354,7 @@ static int __devinit init_dma_hpt366(ide_hwif_t *hwif,
if (ide_allocate_dma_engine(hwif)) if (ide_allocate_dma_engine(hwif))
return -1; return -1;
ide_setup_dma(hwif, base); hwif->dma_ops = &sff_dma_ops;
return 0; return 0;
} }
...@@ -1401,7 +1409,6 @@ static int __devinit hpt36x_init(struct pci_dev *dev, struct pci_dev *dev2) ...@@ -1401,7 +1409,6 @@ static int __devinit hpt36x_init(struct pci_dev *dev, struct pci_dev *dev2)
#define IDE_HFLAGS_HPT3XX \ #define IDE_HFLAGS_HPT3XX \
(IDE_HFLAG_NO_ATAPI_DMA | \ (IDE_HFLAG_NO_ATAPI_DMA | \
IDE_HFLAG_ABUSE_SET_DMA_MODE | \
IDE_HFLAG_OFF_BOARD) IDE_HFLAG_OFF_BOARD)
static const struct ide_port_ops hpt3xx_port_ops = { static const struct ide_port_ops hpt3xx_port_ops = {
......
...@@ -28,10 +28,6 @@ ...@@ -28,10 +28,6 @@
*/ */
#include <asm/superio.h> #include <asm/superio.h>
static unsigned long superio_ide_status[2];
static unsigned long superio_ide_select[2];
static unsigned long superio_ide_dma_status[2];
#define SUPERIO_IDE_MAX_RETRIES 25 #define SUPERIO_IDE_MAX_RETRIES 25
/* Because of a defect in Super I/O, all reads of the PCI DMA status /* Because of a defect in Super I/O, all reads of the PCI DMA status
...@@ -40,27 +36,28 @@ static unsigned long superio_ide_dma_status[2]; ...@@ -40,27 +36,28 @@ static unsigned long superio_ide_dma_status[2];
*/ */
static u8 superio_ide_inb (unsigned long port) static u8 superio_ide_inb (unsigned long port)
{ {
if (port == superio_ide_status[0] || u8 tmp;
port == superio_ide_status[1] || int retries = SUPERIO_IDE_MAX_RETRIES;
port == superio_ide_select[0] ||
port == superio_ide_select[1] ||
port == superio_ide_dma_status[0] ||
port == superio_ide_dma_status[1]) {
u8 tmp;
int retries = SUPERIO_IDE_MAX_RETRIES;
/* printk(" [ reading port 0x%x with retry ] ", port); */ /* printk(" [ reading port 0x%x with retry ] ", port); */
do { do {
tmp = inb(port); tmp = inb(port);
if (tmp == 0) if (tmp == 0)
udelay(50); udelay(50);
} while (tmp == 0 && retries-- > 0); } while (tmp == 0 && retries-- > 0);
return tmp; return tmp;
} }
return inb(port); static u8 superio_read_status(ide_hwif_t *hwif)
{
return superio_ide_inb(hwif->io_ports.status_addr);
}
static u8 superio_read_sff_dma_status(ide_hwif_t *hwif)
{
return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS);
} }
static void superio_tf_read(ide_drive_t *drive, ide_task_t *task) static void superio_tf_read(ide_drive_t *drive, ide_task_t *task)
...@@ -78,6 +75,8 @@ static void superio_tf_read(ide_drive_t *drive, ide_task_t *task) ...@@ -78,6 +75,8 @@ static void superio_tf_read(ide_drive_t *drive, ide_task_t *task)
/* be sure we're looking at the low order bits */ /* be sure we're looking at the low order bits */
outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr);
if (task->tf_flags & IDE_TFLAG_IN_FEATURE)
tf->feature = inb(io_ports->feature_addr);
if (task->tf_flags & IDE_TFLAG_IN_NSECT) if (task->tf_flags & IDE_TFLAG_IN_NSECT)
tf->nsect = inb(io_ports->nsect_addr); tf->nsect = inb(io_ports->nsect_addr);
if (task->tf_flags & IDE_TFLAG_IN_LBAL) if (task->tf_flags & IDE_TFLAG_IN_LBAL)
...@@ -105,36 +104,32 @@ static void superio_tf_read(ide_drive_t *drive, ide_task_t *task) ...@@ -105,36 +104,32 @@ static void superio_tf_read(ide_drive_t *drive, ide_task_t *task)
} }
} }
static void __devinit superio_ide_init_iops (struct hwif_s *hwif) static const struct ide_tp_ops superio_tp_ops = {
{ .exec_command = ide_exec_command,
struct pci_dev *pdev = to_pci_dev(hwif->dev); .read_status = superio_read_status,
u32 base, dmabase; .read_altstatus = ide_read_altstatus,
u8 port = hwif->channel, tmp; .read_sff_dma_status = superio_read_sff_dma_status,
base = pci_resource_start(pdev, port * 2) & ~3; .set_irq = ide_set_irq,
dmabase = pci_resource_start(pdev, 4) & ~3;
superio_ide_status[port] = base + 7;
superio_ide_select[port] = base + 6;
superio_ide_dma_status[port] = dmabase + (!port ? 2 : 0xa);
/* Clear error/interrupt, enable dma */
tmp = superio_ide_inb(superio_ide_dma_status[port]);
outb(tmp | 0x66, superio_ide_dma_status[port]);
hwif->tf_read = superio_tf_read; .tf_load = ide_tf_load,
.tf_read = superio_tf_read,
/* We need to override inb to workaround a SuperIO errata */ .input_data = ide_input_data,
hwif->INB = superio_ide_inb; .output_data = ide_output_data,
} };
static void __devinit init_iops_ns87415(ide_hwif_t *hwif) static void __devinit superio_init_iops(struct hwif_s *hwif)
{ {
struct pci_dev *dev = to_pci_dev(hwif->dev); struct pci_dev *pdev = to_pci_dev(hwif->dev);
u32 dma_stat;
u8 port = hwif->channel, tmp;
if (PCI_SLOT(dev->devfn) == 0xE) dma_stat = (pci_resource_start(pdev, 4) & ~3) + (!port ? 2 : 0xa);
/* Built-in - assume it's under superio. */
superio_ide_init_iops(hwif); /* Clear error/interrupt, enable dma */
tmp = superio_ide_inb(dma_stat);
outb(tmp | 0x66, dma_stat);
} }
#endif #endif
...@@ -200,14 +195,14 @@ static int ns87415_dma_end(ide_drive_t *drive) ...@@ -200,14 +195,14 @@ static int ns87415_dma_end(ide_drive_t *drive)
u8 dma_stat = 0, dma_cmd = 0; u8 dma_stat = 0, dma_cmd = 0;
drive->waiting_for_dma = 0; drive->waiting_for_dma = 0;
dma_stat = hwif->INB(hwif->dma_status); dma_stat = hwif->tp_ops->read_sff_dma_status(hwif);
/* get dma command mode */ /* get DMA command mode */
dma_cmd = hwif->INB(hwif->dma_command); dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
/* stop DMA */ /* stop DMA */
outb(dma_cmd & ~1, hwif->dma_command); outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
/* from ERRATA: clear the INTR & ERROR bits */ /* from ERRATA: clear the INTR & ERROR bits */
dma_cmd = hwif->INB(hwif->dma_command); dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
outb(dma_cmd | 6, hwif->dma_command); outb(dma_cmd | 6, hwif->dma_base + ATA_DMA_CMD);
/* and free any DMA resources */ /* and free any DMA resources */
ide_destroy_dmatable(drive); ide_destroy_dmatable(drive);
/* verify good DMA status */ /* verify good DMA status */
...@@ -276,7 +271,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) ...@@ -276,7 +271,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
outb(8, hwif->io_ports.ctl_addr); outb(8, hwif->io_ports.ctl_addr);
do { do {
udelay(50); udelay(50);
stat = hwif->INB(hwif->io_ports.status_addr); stat = hwif->tp_ops->read_status(hwif);
if (stat == 0xff) if (stat == 0xff)
break; break;
} while ((stat & BUSY_STAT) && --timeout); } while ((stat & BUSY_STAT) && --timeout);
...@@ -291,7 +286,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) ...@@ -291,7 +286,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
if (!hwif->dma_base) if (!hwif->dma_base)
return; return;
outb(0x60, hwif->dma_status); outb(0x60, hwif->dma_base + ATA_DMA_STATUS);
} }
static const struct ide_port_ops ns87415_port_ops = { static const struct ide_port_ops ns87415_port_ops = {
...@@ -311,9 +306,6 @@ static const struct ide_dma_ops ns87415_dma_ops = { ...@@ -311,9 +306,6 @@ static const struct ide_dma_ops ns87415_dma_ops = {
static const struct ide_port_info ns87415_chipset __devinitdata = { static const struct ide_port_info ns87415_chipset __devinitdata = {
.name = "NS87415", .name = "NS87415",
#ifdef CONFIG_SUPERIO
.init_iops = init_iops_ns87415,
#endif
.init_hwif = init_hwif_ns87415, .init_hwif = init_hwif_ns87415,
.port_ops = &ns87415_port_ops, .port_ops = &ns87415_port_ops,
.dma_ops = &ns87415_dma_ops, .dma_ops = &ns87415_dma_ops,
...@@ -323,7 +315,16 @@ static const struct ide_port_info ns87415_chipset __devinitdata = { ...@@ -323,7 +315,16 @@ static const struct ide_port_info ns87415_chipset __devinitdata = {
static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
return ide_setup_pci_device(dev, &ns87415_chipset); struct ide_port_info d = ns87415_chipset;
#ifdef CONFIG_SUPERIO
if (PCI_SLOT(dev->devfn) == 0xE) {
/* Built-in - assume it's under superio. */
d.init_iops = superio_init_iops;
d.tp_ops = &superio_tp_ops;
}
#endif
return ide_setup_pci_device(dev, &d);
} }
static const struct pci_device_id ns87415_pci_tbl[] = { static const struct pci_device_id ns87415_pci_tbl[] = {
......
...@@ -206,7 +206,7 @@ static int pdc202xx_dma_test_irq(ide_drive_t *drive) ...@@ -206,7 +206,7 @@ static int pdc202xx_dma_test_irq(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
unsigned long high_16 = hwif->extra_base - 16; unsigned long high_16 = hwif->extra_base - 16;
u8 dma_stat = inb(hwif->dma_status); u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
u8 sc1d = inb(high_16 + 0x001d); u8 sc1d = inb(high_16 + 0x001d);
if (hwif->channel) { if (hwif->channel) {
...@@ -312,7 +312,6 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, ...@@ -312,7 +312,6 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
#define IDE_HFLAGS_PDC202XX \ #define IDE_HFLAGS_PDC202XX \
(IDE_HFLAG_ERROR_STOPS_FIFO | \ (IDE_HFLAG_ERROR_STOPS_FIFO | \
IDE_HFLAG_ABUSE_SET_DMA_MODE | \
IDE_HFLAG_OFF_BOARD) IDE_HFLAG_OFF_BOARD)
static const struct ide_port_ops pdc20246_port_ops = { static const struct ide_port_ops pdc20246_port_ops = {
......
...@@ -227,9 +227,9 @@ static void piix_dma_clear_irq(ide_drive_t *drive) ...@@ -227,9 +227,9 @@ static void piix_dma_clear_irq(ide_drive_t *drive)
u8 dma_stat; u8 dma_stat;
/* clear the INTR & ERROR bits */ /* clear the INTR & ERROR bits */
dma_stat = inb(hwif->dma_status); dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
/* Should we force the bit as well ? */ /* Should we force the bit as well ? */
outb(dma_stat, hwif->dma_status); outb(dma_stat, hwif->dma_base + ATA_DMA_STATUS);
} }
struct ich_laptop { struct ich_laptop {
......
This diff is collapsed.
...@@ -349,9 +349,7 @@ static const struct ide_port_ops svwks_port_ops = { ...@@ -349,9 +349,7 @@ static const struct ide_port_ops svwks_port_ops = {
.cable_detect = svwks_cable_detect, .cable_detect = svwks_cable_detect,
}; };
#define IDE_HFLAGS_SVWKS \ #define IDE_HFLAGS_SVWKS IDE_HFLAG_LEGACY_IRQS
(IDE_HFLAG_LEGACY_IRQS | \
IDE_HFLAG_ABUSE_SET_DMA_MODE)
static const struct ide_port_info serverworks_chipsets[] __devinitdata = { static const struct ide_port_info serverworks_chipsets[] __devinitdata = {
{ /* 0 */ { /* 0 */
......
This diff is collapsed.
...@@ -334,7 +334,7 @@ static int siimage_io_dma_test_irq(ide_drive_t *drive) ...@@ -334,7 +334,7 @@ static int siimage_io_dma_test_irq(ide_drive_t *drive)
unsigned long addr = siimage_selreg(hwif, 1); unsigned long addr = siimage_selreg(hwif, 1);
/* return 1 if INTR asserted */ /* return 1 if INTR asserted */
if (hwif->INB(hwif->dma_status) & 4) if (inb(hwif->dma_base + ATA_DMA_STATUS) & 4)
return 1; return 1;
/* return 1 if Device INTR asserted */ /* return 1 if Device INTR asserted */
...@@ -382,7 +382,7 @@ static int siimage_mmio_dma_test_irq(ide_drive_t *drive) ...@@ -382,7 +382,7 @@ static int siimage_mmio_dma_test_irq(ide_drive_t *drive)
} }
/* return 1 if INTR asserted */ /* return 1 if INTR asserted */
if (readb((void __iomem *)hwif->dma_status) & 0x04) if (readb((void __iomem *)(hwif->dma_base + ATA_DMA_STATUS)) & 4)
return 1; return 1;
/* return 1 if Device INTR asserted */ /* return 1 if Device INTR asserted */
...@@ -601,7 +601,7 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) ...@@ -601,7 +601,7 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
* Fill in the basic hwif bits * Fill in the basic hwif bits
*/ */
hwif->host_flags |= IDE_HFLAG_MMIO; hwif->host_flags |= IDE_HFLAG_MMIO;
default_hwif_mmiops(hwif);
hwif->hwif_data = addr; hwif->hwif_data = addr;
/* /*
......
...@@ -157,9 +157,9 @@ static void sl82c105_dma_lost_irq(ide_drive_t *drive) ...@@ -157,9 +157,9 @@ static void sl82c105_dma_lost_irq(ide_drive_t *drive)
* Was DMA enabled? If so, disable it - we're resetting the * Was DMA enabled? If so, disable it - we're resetting the
* host. The IDE layer will be handling the drive for us. * host. The IDE layer will be handling the drive for us.
*/ */
dma_cmd = inb(hwif->dma_command); dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
if (dma_cmd & 1) { if (dma_cmd & 1) {
outb(dma_cmd & ~1, hwif->dma_command); outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
printk("sl82c105: DMA was enabled\n"); printk("sl82c105: DMA was enabled\n");
} }
......
...@@ -63,7 +63,7 @@ static int tc86c001_timer_expiry(ide_drive_t *drive) ...@@ -63,7 +63,7 @@ static int tc86c001_timer_expiry(ide_drive_t *drive)
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
ide_expiry_t *expiry = ide_get_hwifdata(hwif); ide_expiry_t *expiry = ide_get_hwifdata(hwif);
ide_hwgroup_t *hwgroup = HWGROUP(drive); ide_hwgroup_t *hwgroup = HWGROUP(drive);
u8 dma_stat = inb(hwif->dma_status); u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
/* Restore a higher level driver's expiry handler first. */ /* Restore a higher level driver's expiry handler first. */
hwgroup->expiry = expiry; hwgroup->expiry = expiry;
...@@ -71,21 +71,24 @@ static int tc86c001_timer_expiry(ide_drive_t *drive) ...@@ -71,21 +71,24 @@ static int tc86c001_timer_expiry(ide_drive_t *drive)
if ((dma_stat & 5) == 1) { /* DMA active and no interrupt */ if ((dma_stat & 5) == 1) { /* DMA active and no interrupt */
unsigned long sc_base = hwif->config_data; unsigned long sc_base = hwif->config_data;
unsigned long twcr_port = sc_base + (drive->dn ? 0x06 : 0x04); unsigned long twcr_port = sc_base + (drive->dn ? 0x06 : 0x04);
u8 dma_cmd = inb(hwif->dma_command); u8 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
printk(KERN_WARNING "%s: DMA interrupt possibly stuck, " printk(KERN_WARNING "%s: DMA interrupt possibly stuck, "
"attempting recovery...\n", drive->name); "attempting recovery...\n", drive->name);
/* Stop DMA */ /* Stop DMA */
outb(dma_cmd & ~0x01, hwif->dma_command); outb(dma_cmd & ~0x01, hwif->dma_base + ATA_DMA_CMD);
/* Setup the dummy DMA transfer */ /* Setup the dummy DMA transfer */
outw(0, sc_base + 0x0a); /* Sector Count */ outw(0, sc_base + 0x0a); /* Sector Count */
outw(0, twcr_port); /* Transfer Word Count 1 or 2 */ outw(0, twcr_port); /* Transfer Word Count 1 or 2 */
/* Start the dummy DMA transfer */ /* Start the dummy DMA transfer */
outb(0x00, hwif->dma_command); /* clear R_OR_WCTR for write */
outb(0x01, hwif->dma_command); /* set START_STOPBM */ /* clear R_OR_WCTR for write */
outb(0x00, hwif->dma_base + ATA_DMA_CMD);
/* set START_STOPBM */
outb(0x01, hwif->dma_base + ATA_DMA_CMD);
/* /*
* If an interrupt was pending, it should come thru shortly. * If an interrupt was pending, it should come thru shortly.
...@@ -203,8 +206,7 @@ static const struct ide_port_info tc86c001_chipset __devinitdata = { ...@@ -203,8 +206,7 @@ static const struct ide_port_info tc86c001_chipset __devinitdata = {
.init_hwif = init_hwif_tc86c001, .init_hwif = init_hwif_tc86c001,
.port_ops = &tc86c001_port_ops, .port_ops = &tc86c001_port_ops,
.dma_ops = &tc86c001_dma_ops, .dma_ops = &tc86c001_dma_ops,
.host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_OFF_BOARD | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_OFF_BOARD,
IDE_HFLAG_ABUSE_SET_DMA_MODE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA4, .udma_mask = ATA_UDMA4,
......
...@@ -425,7 +425,6 @@ static const struct ide_port_info via82cxxx_chipset __devinitdata = { ...@@ -425,7 +425,6 @@ static const struct ide_port_info via82cxxx_chipset __devinitdata = {
.enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } }, .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } },
.port_ops = &via_port_ops, .port_ops = &via_port_ops,
.host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST |
IDE_HFLAG_ABUSE_SET_DMA_MODE |
IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_POST_SET_MODE |
IDE_HFLAG_IO_32BIT, IDE_HFLAG_IO_32BIT,
.pio_mask = ATA_PIO5, .pio_mask = ATA_PIO5,
......
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