aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_sil680.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_sil680.c')
-rw-r--r--drivers/ata/pata_sil680.c71
1 files changed, 19 insertions, 52 deletions
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index 7c5b2dd9a1a1..720b8645f58a 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -192,54 +192,14 @@ static void sil680_set_dmamode(struct ata_port *ap, struct ata_device *adev)
192} 192}
193 193
194static struct scsi_host_template sil680_sht = { 194static struct scsi_host_template sil680_sht = {
195 .module = THIS_MODULE, 195 ATA_BMDMA_SHT(DRV_NAME),
196 .name = DRV_NAME,
197 .ioctl = ata_scsi_ioctl,
198 .queuecommand = ata_scsi_queuecmd,
199 .can_queue = ATA_DEF_QUEUE,
200 .this_id = ATA_SHT_THIS_ID,
201 .sg_tablesize = LIBATA_MAX_PRD,
202 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
203 .emulated = ATA_SHT_EMULATED,
204 .use_clustering = ATA_SHT_USE_CLUSTERING,
205 .proc_name = DRV_NAME,
206 .dma_boundary = ATA_DMA_BOUNDARY,
207 .slave_configure = ata_scsi_slave_config,
208 .slave_destroy = ata_scsi_slave_destroy,
209 .bios_param = ata_std_bios_param,
210}; 196};
211 197
212static struct ata_port_operations sil680_port_ops = { 198static struct ata_port_operations sil680_port_ops = {
199 .inherits = &ata_bmdma_port_ops,
200 .cable_detect = sil680_cable_detect,
213 .set_piomode = sil680_set_piomode, 201 .set_piomode = sil680_set_piomode,
214 .set_dmamode = sil680_set_dmamode, 202 .set_dmamode = sil680_set_dmamode,
215 .mode_filter = ata_pci_default_filter,
216 .tf_load = ata_tf_load,
217 .tf_read = ata_tf_read,
218 .check_status = ata_check_status,
219 .exec_command = ata_exec_command,
220 .dev_select = ata_std_dev_select,
221
222 .freeze = ata_bmdma_freeze,
223 .thaw = ata_bmdma_thaw,
224 .error_handler = ata_bmdma_error_handler,
225 .post_internal_cmd = ata_bmdma_post_internal_cmd,
226 .cable_detect = sil680_cable_detect,
227
228 .bmdma_setup = ata_bmdma_setup,
229 .bmdma_start = ata_bmdma_start,
230 .bmdma_stop = ata_bmdma_stop,
231 .bmdma_status = ata_bmdma_status,
232
233 .qc_prep = ata_qc_prep,
234 .qc_issue = ata_qc_issue_prot,
235
236 .data_xfer = ata_data_xfer,
237
238 .irq_handler = ata_interrupt,
239 .irq_clear = ata_bmdma_irq_clear,
240 .irq_on = ata_irq_on,
241
242 .port_start = ata_sff_port_start,
243}; 203};
244 204
245/** 205/**
@@ -322,7 +282,6 @@ static int __devinit sil680_init_one(struct pci_dev *pdev,
322 const struct pci_device_id *id) 282 const struct pci_device_id *id)
323{ 283{
324 static const struct ata_port_info info = { 284 static const struct ata_port_info info = {
325 .sht = &sil680_sht,
326 .flags = ATA_FLAG_SLAVE_POSS, 285 .flags = ATA_FLAG_SLAVE_POSS,
327 .pio_mask = 0x1f, 286 .pio_mask = 0x1f,
328 .mwdma_mask = 0x07, 287 .mwdma_mask = 0x07,
@@ -330,7 +289,6 @@ static int __devinit sil680_init_one(struct pci_dev *pdev,
330 .port_ops = &sil680_port_ops 289 .port_ops = &sil680_port_ops
331 }; 290 };
332 static const struct ata_port_info info_slow = { 291 static const struct ata_port_info info_slow = {
333 .sht = &sil680_sht,
334 .flags = ATA_FLAG_SLAVE_POSS, 292 .flags = ATA_FLAG_SLAVE_POSS,
335 .pio_mask = 0x1f, 293 .pio_mask = 0x1f,
336 .mwdma_mask = 0x07, 294 .mwdma_mask = 0x07,
@@ -346,6 +304,10 @@ static int __devinit sil680_init_one(struct pci_dev *pdev,
346 if (!printed_version++) 304 if (!printed_version++)
347 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 305 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
348 306
307 rc = pcim_enable_device(pdev);
308 if (rc)
309 return rc;
310
349 switch (sil680_init_chip(pdev, &try_mmio)) { 311 switch (sil680_init_chip(pdev, &try_mmio)) {
350 case 0: 312 case 0:
351 ppi[0] = &info_slow; 313 ppi[0] = &info_slow;
@@ -388,28 +350,33 @@ static int __devinit sil680_init_one(struct pci_dev *pdev,
388 host->ports[0]->ioaddr.cmd_addr = mmio_base + 0x80; 350 host->ports[0]->ioaddr.cmd_addr = mmio_base + 0x80;
389 host->ports[0]->ioaddr.ctl_addr = mmio_base + 0x8a; 351 host->ports[0]->ioaddr.ctl_addr = mmio_base + 0x8a;
390 host->ports[0]->ioaddr.altstatus_addr = mmio_base + 0x8a; 352 host->ports[0]->ioaddr.altstatus_addr = mmio_base + 0x8a;
391 ata_std_ports(&host->ports[0]->ioaddr); 353 ata_sff_std_ports(&host->ports[0]->ioaddr);
392 host->ports[1]->ioaddr.bmdma_addr = mmio_base + 0x08; 354 host->ports[1]->ioaddr.bmdma_addr = mmio_base + 0x08;
393 host->ports[1]->ioaddr.cmd_addr = mmio_base + 0xc0; 355 host->ports[1]->ioaddr.cmd_addr = mmio_base + 0xc0;
394 host->ports[1]->ioaddr.ctl_addr = mmio_base + 0xca; 356 host->ports[1]->ioaddr.ctl_addr = mmio_base + 0xca;
395 host->ports[1]->ioaddr.altstatus_addr = mmio_base + 0xca; 357 host->ports[1]->ioaddr.altstatus_addr = mmio_base + 0xca;
396 ata_std_ports(&host->ports[1]->ioaddr); 358 ata_sff_std_ports(&host->ports[1]->ioaddr);
397 359
398 /* Register & activate */ 360 /* Register & activate */
399 return ata_host_activate(host, pdev->irq, ata_interrupt, IRQF_SHARED, 361 return ata_host_activate(host, pdev->irq, ata_sff_interrupt,
400 &sil680_sht); 362 IRQF_SHARED, &sil680_sht);
401 363
402use_ioports: 364use_ioports:
403 return ata_pci_init_one(pdev, ppi); 365 return ata_pci_sff_init_one(pdev, ppi, &sil680_sht, NULL);
404} 366}
405 367
406#ifdef CONFIG_PM 368#ifdef CONFIG_PM
407static int sil680_reinit_one(struct pci_dev *pdev) 369static int sil680_reinit_one(struct pci_dev *pdev)
408{ 370{
409 int try_mmio; 371 struct ata_host *host = dev_get_drvdata(&pdev->dev);
372 int try_mmio, rc;
410 373
374 rc = ata_pci_device_do_resume(pdev);
375 if (rc)
376 return rc;
411 sil680_init_chip(pdev, &try_mmio); 377 sil680_init_chip(pdev, &try_mmio);
412 return ata_pci_device_resume(pdev); 378 ata_host_resume(host);
379 return 0;
413} 380}
414#endif 381#endif
415 382