aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_hpt366.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_hpt366.c')
-rw-r--r--drivers/ata/pata_hpt366.c77
1 files changed, 24 insertions, 53 deletions
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index a742efa0da2b..f2b83eabc7c7 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -184,7 +184,7 @@ static unsigned long hpt366_filter(struct ata_device *adev, unsigned long mask)
184 if (hpt_dma_blacklisted(adev, "UDMA4", bad_ata66_4)) 184 if (hpt_dma_blacklisted(adev, "UDMA4", bad_ata66_4))
185 mask &= ~(0xF0 << ATA_SHIFT_UDMA); 185 mask &= ~(0xF0 << ATA_SHIFT_UDMA);
186 } 186 }
187 return ata_pci_default_filter(adev, mask); 187 return ata_bmdma_mode_filter(adev, mask);
188} 188}
189 189
190/** 190/**
@@ -290,21 +290,7 @@ static void hpt366_set_dmamode(struct ata_port *ap, struct ata_device *adev)
290} 290}
291 291
292static struct scsi_host_template hpt36x_sht = { 292static struct scsi_host_template hpt36x_sht = {
293 .module = THIS_MODULE, 293 ATA_BMDMA_SHT(DRV_NAME),
294 .name = DRV_NAME,
295 .ioctl = ata_scsi_ioctl,
296 .queuecommand = ata_scsi_queuecmd,
297 .can_queue = ATA_DEF_QUEUE,
298 .this_id = ATA_SHT_THIS_ID,
299 .sg_tablesize = LIBATA_MAX_PRD,
300 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
301 .emulated = ATA_SHT_EMULATED,
302 .use_clustering = ATA_SHT_USE_CLUSTERING,
303 .proc_name = DRV_NAME,
304 .dma_boundary = ATA_DMA_BOUNDARY,
305 .slave_configure = ata_scsi_slave_config,
306 .slave_destroy = ata_scsi_slave_destroy,
307 .bios_param = ata_std_bios_param,
308}; 294};
309 295
310/* 296/*
@@ -312,37 +298,11 @@ static struct scsi_host_template hpt36x_sht = {
312 */ 298 */
313 299
314static struct ata_port_operations hpt366_port_ops = { 300static struct ata_port_operations hpt366_port_ops = {
301 .inherits = &ata_bmdma_port_ops,
302 .cable_detect = hpt36x_cable_detect,
303 .mode_filter = hpt366_filter,
315 .set_piomode = hpt366_set_piomode, 304 .set_piomode = hpt366_set_piomode,
316 .set_dmamode = hpt366_set_dmamode, 305 .set_dmamode = hpt366_set_dmamode,
317 .mode_filter = hpt366_filter,
318
319 .tf_load = ata_tf_load,
320 .tf_read = ata_tf_read,
321 .check_status = ata_check_status,
322 .exec_command = ata_exec_command,
323 .dev_select = ata_std_dev_select,
324
325 .freeze = ata_bmdma_freeze,
326 .thaw = ata_bmdma_thaw,
327 .error_handler = ata_bmdma_error_handler,
328 .post_internal_cmd = ata_bmdma_post_internal_cmd,
329 .cable_detect = hpt36x_cable_detect,
330
331 .bmdma_setup = ata_bmdma_setup,
332 .bmdma_start = ata_bmdma_start,
333 .bmdma_stop = ata_bmdma_stop,
334 .bmdma_status = ata_bmdma_status,
335
336 .qc_prep = ata_qc_prep,
337 .qc_issue = ata_qc_issue_prot,
338
339 .data_xfer = ata_data_xfer,
340
341 .irq_handler = ata_interrupt,
342 .irq_clear = ata_bmdma_irq_clear,
343 .irq_on = ata_irq_on,
344
345 .port_start = ata_sff_port_start,
346}; 306};
347 307
348/** 308/**
@@ -390,18 +350,22 @@ static void hpt36x_init_chipset(struct pci_dev *dev)
390static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 350static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
391{ 351{
392 static const struct ata_port_info info_hpt366 = { 352 static const struct ata_port_info info_hpt366 = {
393 .sht = &hpt36x_sht,
394 .flags = ATA_FLAG_SLAVE_POSS, 353 .flags = ATA_FLAG_SLAVE_POSS,
395 .pio_mask = 0x1f, 354 .pio_mask = 0x1f,
396 .mwdma_mask = 0x07, 355 .mwdma_mask = 0x07,
397 .udma_mask = ATA_UDMA4, 356 .udma_mask = ATA_UDMA4,
398 .port_ops = &hpt366_port_ops 357 .port_ops = &hpt366_port_ops
399 }; 358 };
400 struct ata_port_info info = info_hpt366; 359 const struct ata_port_info *ppi[] = { &info_hpt366, NULL };
401 const struct ata_port_info *ppi[] = { &info, NULL };
402 360
361 void *hpriv = NULL;
403 u32 class_rev; 362 u32 class_rev;
404 u32 reg1; 363 u32 reg1;
364 int rc;
365
366 rc = pcim_enable_device(dev);
367 if (rc)
368 return rc;
405 369
406 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); 370 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
407 class_rev &= 0xFF; 371 class_rev &= 0xFF;
@@ -419,24 +383,31 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
419 /* info_hpt366 is safe against re-entry so we can scribble on it */ 383 /* info_hpt366 is safe against re-entry so we can scribble on it */
420 switch((reg1 & 0x700) >> 8) { 384 switch((reg1 & 0x700) >> 8) {
421 case 5: 385 case 5:
422 info.private_data = &hpt366_40; 386 hpriv = &hpt366_40;
423 break; 387 break;
424 case 9: 388 case 9:
425 info.private_data = &hpt366_25; 389 hpriv = &hpt366_25;
426 break; 390 break;
427 default: 391 default:
428 info.private_data = &hpt366_33; 392 hpriv = &hpt366_33;
429 break; 393 break;
430 } 394 }
431 /* Now kick off ATA set up */ 395 /* Now kick off ATA set up */
432 return ata_pci_init_one(dev, ppi); 396 return ata_pci_sff_init_one(dev, ppi, &hpt36x_sht, hpriv);
433} 397}
434 398
435#ifdef CONFIG_PM 399#ifdef CONFIG_PM
436static int hpt36x_reinit_one(struct pci_dev *dev) 400static int hpt36x_reinit_one(struct pci_dev *dev)
437{ 401{
402 struct ata_host *host = dev_get_drvdata(&dev->dev);
403 int rc;
404
405 rc = ata_pci_device_do_resume(dev);
406 if (rc)
407 return rc;
438 hpt36x_init_chipset(dev); 408 hpt36x_init_chipset(dev);
439 return ata_pci_device_resume(dev); 409 ata_host_resume(host);
410 return 0;
440} 411}
441#endif 412#endif
442 413