diff options
Diffstat (limited to 'drivers/ata/pdc_adma.c')
| -rw-r--r-- | drivers/ata/pdc_adma.c | 80 |
1 files changed, 14 insertions, 66 deletions
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c index 8e1b7e9c0ae4..be53545c9f64 100644 --- a/drivers/ata/pdc_adma.c +++ b/drivers/ata/pdc_adma.c | |||
| @@ -131,56 +131,33 @@ struct adma_port_priv { | |||
| 131 | static int adma_ata_init_one(struct pci_dev *pdev, | 131 | static int adma_ata_init_one(struct pci_dev *pdev, |
| 132 | const struct pci_device_id *ent); | 132 | const struct pci_device_id *ent); |
| 133 | static int adma_port_start(struct ata_port *ap); | 133 | static int adma_port_start(struct ata_port *ap); |
| 134 | static void adma_host_stop(struct ata_host *host); | ||
| 135 | static void adma_port_stop(struct ata_port *ap); | 134 | static void adma_port_stop(struct ata_port *ap); |
| 136 | static void adma_qc_prep(struct ata_queued_cmd *qc); | 135 | static void adma_qc_prep(struct ata_queued_cmd *qc); |
| 137 | static unsigned int adma_qc_issue(struct ata_queued_cmd *qc); | 136 | static unsigned int adma_qc_issue(struct ata_queued_cmd *qc); |
| 138 | static int adma_check_atapi_dma(struct ata_queued_cmd *qc); | 137 | static int adma_check_atapi_dma(struct ata_queued_cmd *qc); |
| 139 | static void adma_bmdma_stop(struct ata_queued_cmd *qc); | ||
| 140 | static u8 adma_bmdma_status(struct ata_port *ap); | ||
| 141 | static void adma_irq_clear(struct ata_port *ap); | ||
| 142 | static void adma_freeze(struct ata_port *ap); | 138 | static void adma_freeze(struct ata_port *ap); |
| 143 | static void adma_thaw(struct ata_port *ap); | 139 | static void adma_thaw(struct ata_port *ap); |
| 144 | static void adma_error_handler(struct ata_port *ap); | 140 | static int adma_prereset(struct ata_link *link, unsigned long deadline); |
| 145 | 141 | ||
| 146 | static struct scsi_host_template adma_ata_sht = { | 142 | static struct scsi_host_template adma_ata_sht = { |
| 147 | .module = THIS_MODULE, | 143 | ATA_BASE_SHT(DRV_NAME), |
| 148 | .name = DRV_NAME, | ||
| 149 | .ioctl = ata_scsi_ioctl, | ||
| 150 | .queuecommand = ata_scsi_queuecmd, | ||
| 151 | .slave_configure = ata_scsi_slave_config, | ||
| 152 | .slave_destroy = ata_scsi_slave_destroy, | ||
| 153 | .bios_param = ata_std_bios_param, | ||
| 154 | .proc_name = DRV_NAME, | ||
| 155 | .can_queue = ATA_DEF_QUEUE, | ||
| 156 | .this_id = ATA_SHT_THIS_ID, | ||
| 157 | .sg_tablesize = LIBATA_MAX_PRD, | 144 | .sg_tablesize = LIBATA_MAX_PRD, |
| 158 | .dma_boundary = ADMA_DMA_BOUNDARY, | 145 | .dma_boundary = ADMA_DMA_BOUNDARY, |
| 159 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | ||
| 160 | .use_clustering = ENABLE_CLUSTERING, | ||
| 161 | .emulated = ATA_SHT_EMULATED, | ||
| 162 | }; | 146 | }; |
| 163 | 147 | ||
| 164 | static const struct ata_port_operations adma_ata_ops = { | 148 | static struct ata_port_operations adma_ata_ops = { |
| 165 | .tf_load = ata_tf_load, | 149 | .inherits = &ata_sff_port_ops, |
| 166 | .tf_read = ata_tf_read, | 150 | |
| 167 | .exec_command = ata_exec_command, | ||
| 168 | .check_status = ata_check_status, | ||
| 169 | .dev_select = ata_std_dev_select, | ||
| 170 | .check_atapi_dma = adma_check_atapi_dma, | 151 | .check_atapi_dma = adma_check_atapi_dma, |
| 171 | .data_xfer = ata_data_xfer, | ||
| 172 | .qc_prep = adma_qc_prep, | 152 | .qc_prep = adma_qc_prep, |
| 173 | .qc_issue = adma_qc_issue, | 153 | .qc_issue = adma_qc_issue, |
| 154 | |||
| 174 | .freeze = adma_freeze, | 155 | .freeze = adma_freeze, |
| 175 | .thaw = adma_thaw, | 156 | .thaw = adma_thaw, |
| 176 | .error_handler = adma_error_handler, | 157 | .prereset = adma_prereset, |
| 177 | .irq_clear = adma_irq_clear, | 158 | |
| 178 | .irq_on = ata_irq_on, | ||
| 179 | .port_start = adma_port_start, | 159 | .port_start = adma_port_start, |
| 180 | .port_stop = adma_port_stop, | 160 | .port_stop = adma_port_stop, |
| 181 | .host_stop = adma_host_stop, | ||
| 182 | .bmdma_stop = adma_bmdma_stop, | ||
| 183 | .bmdma_status = adma_bmdma_status, | ||
| 184 | }; | 161 | }; |
| 185 | 162 | ||
| 186 | static struct ata_port_info adma_port_info[] = { | 163 | static struct ata_port_info adma_port_info[] = { |
| @@ -213,21 +190,6 @@ static int adma_check_atapi_dma(struct ata_queued_cmd *qc) | |||
| 213 | return 1; /* ATAPI DMA not yet supported */ | 190 | return 1; /* ATAPI DMA not yet supported */ |
| 214 | } | 191 | } |
| 215 | 192 | ||
| 216 | static void adma_bmdma_stop(struct ata_queued_cmd *qc) | ||
| 217 | { | ||
| 218 | /* nothing */ | ||
| 219 | } | ||
| 220 | |||
| 221 | static u8 adma_bmdma_status(struct ata_port *ap) | ||
| 222 | { | ||
| 223 | return 0; | ||
| 224 | } | ||
| 225 | |||
| 226 | static void adma_irq_clear(struct ata_port *ap) | ||
| 227 | { | ||
| 228 | /* nothing */ | ||
| 229 | } | ||
| 230 | |||
| 231 | static void adma_reset_engine(struct ata_port *ap) | 193 | static void adma_reset_engine(struct ata_port *ap) |
| 232 | { | 194 | { |
| 233 | void __iomem *chan = ADMA_PORT_REGS(ap); | 195 | void __iomem *chan = ADMA_PORT_REGS(ap); |
| @@ -246,7 +208,7 @@ static void adma_reinit_engine(struct ata_port *ap) | |||
| 246 | 208 | ||
| 247 | /* mask/clear ATA interrupts */ | 209 | /* mask/clear ATA interrupts */ |
| 248 | writeb(ATA_NIEN, ap->ioaddr.ctl_addr); | 210 | writeb(ATA_NIEN, ap->ioaddr.ctl_addr); |
| 249 | ata_check_status(ap); | 211 | ata_sff_check_status(ap); |
| 250 | 212 | ||
| 251 | /* reset the ADMA engine */ | 213 | /* reset the ADMA engine */ |
| 252 | adma_reset_engine(ap); | 214 | adma_reset_engine(ap); |
| @@ -281,7 +243,7 @@ static void adma_freeze(struct ata_port *ap) | |||
| 281 | 243 | ||
| 282 | /* mask/clear ATA interrupts */ | 244 | /* mask/clear ATA interrupts */ |
| 283 | writeb(ATA_NIEN, ap->ioaddr.ctl_addr); | 245 | writeb(ATA_NIEN, ap->ioaddr.ctl_addr); |
| 284 | ata_check_status(ap); | 246 | ata_sff_check_status(ap); |
| 285 | 247 | ||
| 286 | /* reset ADMA to idle state */ | 248 | /* reset ADMA to idle state */ |
| 287 | writew(aPIOMD4 | aNIEN | aRSTADM, chan + ADMA_CONTROL); | 249 | writew(aPIOMD4 | aNIEN | aRSTADM, chan + ADMA_CONTROL); |
| @@ -304,13 +266,7 @@ static int adma_prereset(struct ata_link *link, unsigned long deadline) | |||
| 304 | pp->state = adma_state_mmio; | 266 | pp->state = adma_state_mmio; |
| 305 | adma_reinit_engine(ap); | 267 | adma_reinit_engine(ap); |
| 306 | 268 | ||
| 307 | return ata_std_prereset(link, deadline); | 269 | return ata_sff_prereset(link, deadline); |
| 308 | } | ||
| 309 | |||
| 310 | static void adma_error_handler(struct ata_port *ap) | ||
| 311 | { | ||
| 312 | ata_do_eh(ap, adma_prereset, ata_std_softreset, NULL, | ||
| 313 | ata_std_postreset); | ||
| 314 | } | 270 | } |
| 315 | 271 | ||
| 316 | static int adma_fill_sg(struct ata_queued_cmd *qc) | 272 | static int adma_fill_sg(struct ata_queued_cmd *qc) |
| @@ -366,7 +322,7 @@ static void adma_qc_prep(struct ata_queued_cmd *qc) | |||
| 366 | 322 | ||
| 367 | adma_enter_reg_mode(qc->ap); | 323 | adma_enter_reg_mode(qc->ap); |
| 368 | if (qc->tf.protocol != ATA_PROT_DMA) { | 324 | if (qc->tf.protocol != ATA_PROT_DMA) { |
| 369 | ata_qc_prep(qc); | 325 | ata_sff_qc_prep(qc); |
| 370 | return; | 326 | return; |
| 371 | } | 327 | } |
| 372 | 328 | ||
| @@ -465,7 +421,7 @@ static unsigned int adma_qc_issue(struct ata_queued_cmd *qc) | |||
| 465 | } | 421 | } |
| 466 | 422 | ||
| 467 | pp->state = adma_state_mmio; | 423 | pp->state = adma_state_mmio; |
| 468 | return ata_qc_issue_prot(qc); | 424 | return ata_sff_qc_issue(qc); |
| 469 | } | 425 | } |
| 470 | 426 | ||
| 471 | static inline unsigned int adma_intr_pkt(struct ata_host *host) | 427 | static inline unsigned int adma_intr_pkt(struct ata_host *host) |
| @@ -536,7 +492,7 @@ static inline unsigned int adma_intr_mmio(struct ata_host *host) | |||
| 536 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { | 492 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { |
| 537 | 493 | ||
| 538 | /* check main status, clearing INTRQ */ | 494 | /* check main status, clearing INTRQ */ |
| 539 | u8 status = ata_check_status(ap); | 495 | u8 status = ata_sff_check_status(ap); |
| 540 | if ((status & ATA_BUSY)) | 496 | if ((status & ATA_BUSY)) |
| 541 | continue; | 497 | continue; |
| 542 | DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", | 498 | DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", |
| @@ -633,14 +589,6 @@ static void adma_port_stop(struct ata_port *ap) | |||
| 633 | adma_reset_engine(ap); | 589 | adma_reset_engine(ap); |
| 634 | } | 590 | } |
| 635 | 591 | ||
| 636 | static void adma_host_stop(struct ata_host *host) | ||
| 637 | { | ||
| 638 | unsigned int port_no; | ||
| 639 | |||
| 640 | for (port_no = 0; port_no < ADMA_PORTS; ++port_no) | ||
| 641 | adma_reset_engine(host->ports[port_no]); | ||
| 642 | } | ||
| 643 | |||
| 644 | static void adma_host_init(struct ata_host *host, unsigned int chip_id) | 592 | static void adma_host_init(struct ata_host *host, unsigned int chip_id) |
| 645 | { | 593 | { |
| 646 | unsigned int port_no; | 594 | unsigned int port_no; |
