sata_mv: support clkdev framework
[safe/jmp/linux-2.6] / drivers / ata / pata_sis.c
index 28abfc2..5c30d56 100644 (file)
@@ -1,8 +1,8 @@
 /*
  *    pata_sis.c - SiS ATA driver
  *
- *     (C) 2005 Red Hat <alan@redhat.com>
- *     (C) 2007 Bartlomiej Zolnierkiewicz
+ *     (C) 2005 Red Hat
+ *     (C) 2007,2009 Bartlomiej Zolnierkiewicz
  *
  *    Based upon linux/drivers/ide/pci/sis5513.c
  * Copyright (C) 1999-2000     Andre Hedrick <andre@linux-ide.org>
@@ -112,7 +112,6 @@ static int sis_133_cable_detect(struct ata_port *ap)
 /**
  *     sis_66_cable_detect     -       check for 40/80 pin
  *     @ap: Port
- *     @deadline: deadline jiffies for the operation
  *
  *     Perform cable detection on the UDMA66, UDMA100 and early UDMA133
  *     SiS IDE controllers.
@@ -156,24 +155,11 @@ static int sis_pre_reset(struct ata_link *link, unsigned long deadline)
        /* Clear the FIFO settings. We can't enable the FIFO until
           we know we are poking at a disk */
        pci_write_config_byte(pdev, 0x4B, 0);
-       return ata_std_prereset(link, deadline);
+       return ata_sff_prereset(link, deadline);
 }
 
 
 /**
- *     sis_error_handler - Probe specified port on PATA host controller
- *     @ap: Port to probe
- *
- *     LOCKING:
- *     None (inherited from caller).
- */
-
-static void sis_error_handler(struct ata_port *ap)
-{
-       ata_bmdma_drive_eh(ap, sis_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
-}
-
-/**
  *     sis_set_fifo    -       Set RWP fifo bits for this device
  *     @ap: Port
  *     @adev: Device
@@ -526,7 +512,7 @@ static struct ata_port_operations sis_133_for_sata_ops = {
 
 static struct ata_port_operations sis_base_ops = {
        .inherits               = &ata_bmdma_port_ops,
-       .error_handler          = sis_error_handler,
+       .prereset               = sis_pre_reset,
 };
 
 static struct ata_port_operations sis_133_ops = {
@@ -566,51 +552,57 @@ static struct ata_port_operations sis_old_ops = {
 
 static const struct ata_port_info sis_info = {
        .flags          = ATA_FLAG_SLAVE_POSS,
-       .pio_mask       = 0x1f, /* pio0-4 */
-       .mwdma_mask     = 0x07,
-       .udma_mask      = 0,
+       .pio_mask       = ATA_PIO4,
+       .mwdma_mask     = ATA_MWDMA2,
+       /* No UDMA */
        .port_ops       = &sis_old_ops,
 };
 static const struct ata_port_info sis_info33 = {
        .flags          = ATA_FLAG_SLAVE_POSS,
-       .pio_mask       = 0x1f, /* pio0-4 */
-       .mwdma_mask     = 0x07,
-       .udma_mask      = ATA_UDMA2,    /* UDMA 33 */
+       .pio_mask       = ATA_PIO4,
+       .mwdma_mask     = ATA_MWDMA2,
+       .udma_mask      = ATA_UDMA2,
        .port_ops       = &sis_old_ops,
 };
 static const struct ata_port_info sis_info66 = {
        .flags          = ATA_FLAG_SLAVE_POSS,
-       .pio_mask       = 0x1f, /* pio0-4 */
-       .udma_mask      = ATA_UDMA4,    /* UDMA 66 */
+       .pio_mask       = ATA_PIO4,
+       /* No MWDMA */
+       .udma_mask      = ATA_UDMA4,
        .port_ops       = &sis_66_ops,
 };
 static const struct ata_port_info sis_info100 = {
        .flags          = ATA_FLAG_SLAVE_POSS,
-       .pio_mask       = 0x1f, /* pio0-4 */
+       .pio_mask       = ATA_PIO4,
+       /* No MWDMA */
        .udma_mask      = ATA_UDMA5,
        .port_ops       = &sis_100_ops,
 };
 static const struct ata_port_info sis_info100_early = {
        .flags          = ATA_FLAG_SLAVE_POSS,
+       .pio_mask       = ATA_PIO4,
+       /* No MWDMA */
        .udma_mask      = ATA_UDMA5,
-       .pio_mask       = 0x1f, /* pio0-4 */
        .port_ops       = &sis_66_ops,
 };
 static const struct ata_port_info sis_info133 = {
        .flags          = ATA_FLAG_SLAVE_POSS,
-       .pio_mask       = 0x1f, /* pio0-4 */
+       .pio_mask       = ATA_PIO4,
+       /* No MWDMA */
        .udma_mask      = ATA_UDMA6,
        .port_ops       = &sis_133_ops,
 };
 const struct ata_port_info sis_info133_for_sata = {
        .flags          = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
-       .pio_mask       = 0x1f, /* pio0-4 */
+       .pio_mask       = ATA_PIO4,
+       /* No MWDMA */
        .udma_mask      = ATA_UDMA6,
        .port_ops       = &sis_133_for_sata_ops,
 };
 static const struct ata_port_info sis_info133_early = {
        .flags          = ATA_FLAG_SLAVE_POSS,
-       .pio_mask       = 0x1f, /* pio0-4 */
+       .pio_mask       = ATA_PIO4,
+       /* No MWDMA */
        .udma_mask      = ATA_UDMA6,
        .port_ops       = &sis_133_early_ops,
 };
@@ -834,8 +826,25 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 
        sis_fixup(pdev, chipset);
 
-       return ata_pci_init_one(pdev, ppi, &sis_sht, chipset);
+       return ata_pci_sff_init_one(pdev, ppi, &sis_sht, chipset);
+}
+
+#ifdef CONFIG_PM
+static int sis_reinit_one(struct pci_dev *pdev)
+{
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       int rc;
+
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
+
+       sis_fixup(pdev, host->private_data);
+
+       ata_host_resume(host);
+       return 0;
 }
+#endif
 
 static const struct pci_device_id sis_pci_tbl[] = {
        { PCI_VDEVICE(SI, 0x5513), },   /* SiS 5513 */
@@ -852,7 +861,7 @@ static struct pci_driver sis_pci_driver = {
        .remove                 = ata_pci_remove_one,
 #ifdef CONFIG_PM
        .suspend                = ata_pci_device_suspend,
-       .resume                 = ata_pci_device_resume,
+       .resume                 = sis_reinit_one,
 #endif
 };