aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/pata_hpt366.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index c15c8dc3a6db..25d3cd7e74f1 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -27,7 +27,7 @@
27#include <linux/libata.h> 27#include <linux/libata.h>
28 28
29#define DRV_NAME "pata_hpt366" 29#define DRV_NAME "pata_hpt366"
30#define DRV_VERSION "0.5.1" 30#define DRV_VERSION "0.5.3"
31 31
32struct hpt_clock { 32struct hpt_clock {
33 u8 xfer_speed; 33 u8 xfer_speed;
@@ -339,6 +339,8 @@ static struct scsi_host_template hpt36x_sht = {
339 .slave_configure = ata_scsi_slave_config, 339 .slave_configure = ata_scsi_slave_config,
340 .slave_destroy = ata_scsi_slave_destroy, 340 .slave_destroy = ata_scsi_slave_destroy,
341 .bios_param = ata_std_bios_param, 341 .bios_param = ata_std_bios_param,
342 .resume = ata_scsi_device_resume,
343 .suspend = ata_scsi_device_suspend,
342}; 344};
343 345
344/* 346/*
@@ -381,6 +383,27 @@ static struct ata_port_operations hpt366_port_ops = {
381}; 383};
382 384
383/** 385/**
386 * hpt36x_init_chipset - common chip setup
387 * @dev: PCI device
388 *
389 * Perform the chip setup work that must be done at both init and
390 * resume time
391 */
392
393static void hpt36x_init_chipset(struct pci_dev *dev)
394{
395 u8 drive_fast;
396 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4));
397 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x78);
398 pci_write_config_byte(dev, PCI_MIN_GNT, 0x08);
399 pci_write_config_byte(dev, PCI_MAX_LAT, 0x08);
400
401 pci_read_config_byte(dev, 0x51, &drive_fast);
402 if (drive_fast & 0x80)
403 pci_write_config_byte(dev, 0x51, drive_fast & ~0x80);
404}
405
406/**
384 * hpt36x_init_one - Initialise an HPT366/368 407 * hpt36x_init_one - Initialise an HPT366/368
385 * @dev: PCI device 408 * @dev: PCI device
386 * @id: Entry in match table 409 * @id: Entry in match table
@@ -415,7 +438,6 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
415 438
416 u32 class_rev; 439 u32 class_rev;
417 u32 reg1; 440 u32 reg1;
418 u8 drive_fast;
419 441
420 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); 442 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
421 class_rev &= 0xFF; 443 class_rev &= 0xFF;
@@ -425,14 +447,7 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
425 if (class_rev > 2) 447 if (class_rev > 2)
426 return -ENODEV; 448 return -ENODEV;
427 449
428 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4)); 450 hpt36x_init_chipset(dev);
429 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x78);
430 pci_write_config_byte(dev, PCI_MIN_GNT, 0x08);
431 pci_write_config_byte(dev, PCI_MAX_LAT, 0x08);
432
433 pci_read_config_byte(dev, 0x51, &drive_fast);
434 if (drive_fast & 0x80)
435 pci_write_config_byte(dev, 0x51, drive_fast & ~0x80);
436 451
437 pci_read_config_dword(dev, 0x40, &reg1); 452 pci_read_config_dword(dev, 0x40, &reg1);
438 453
@@ -453,9 +468,15 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
453 return ata_pci_init_one(dev, port_info, 2); 468 return ata_pci_init_one(dev, port_info, 2);
454} 469}
455 470
471static int hpt36x_reinit_one(struct pci_dev *dev)
472{
473 hpt36x_init_chipset(dev);
474 return ata_pci_device_resume(dev);
475}
476
477
456static const struct pci_device_id hpt36x[] = { 478static const struct pci_device_id hpt36x[] = {
457 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT366), }, 479 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT366), },
458
459 { }, 480 { },
460}; 481};
461 482
@@ -463,7 +484,9 @@ static struct pci_driver hpt36x_pci_driver = {
463 .name = DRV_NAME, 484 .name = DRV_NAME,
464 .id_table = hpt36x, 485 .id_table = hpt36x,
465 .probe = hpt36x_init_one, 486 .probe = hpt36x_init_one,
466 .remove = ata_pci_remove_one 487 .remove = ata_pci_remove_one,
488 .suspend = ata_pci_device_suspend,
489 .resume = hpt36x_reinit_one,
467}; 490};
468 491
469static int __init hpt36x_init(void) 492static int __init hpt36x_init(void)
@@ -471,13 +494,11 @@ static int __init hpt36x_init(void)
471 return pci_register_driver(&hpt36x_pci_driver); 494 return pci_register_driver(&hpt36x_pci_driver);
472} 495}
473 496
474
475static void __exit hpt36x_exit(void) 497static void __exit hpt36x_exit(void)
476{ 498{
477 pci_unregister_driver(&hpt36x_pci_driver); 499 pci_unregister_driver(&hpt36x_pci_driver);
478} 500}
479 501
480
481MODULE_AUTHOR("Alan Cox"); 502MODULE_AUTHOR("Alan Cox");
482MODULE_DESCRIPTION("low-level driver for the Highpoint HPT366/368"); 503MODULE_DESCRIPTION("low-level driver for the Highpoint HPT366/368");
483MODULE_LICENSE("GPL"); 504MODULE_LICENSE("GPL");