]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ata/sata_via.c
fec_mpc52xx: write in C...
[linux-2.6-omap-h63xx.git] / drivers / ata / sata_via.c
index 57fd30de8f0dda9c811a8fd377bc1eb40f4434f2..3ef072ff319d28b8514e9ade2fde843d1a23ad2f 100644 (file)
@@ -3,7 +3,7 @@
  *
  *  Maintained by:  Jeff Garzik <jgarzik@pobox.com>
  *                Please ALWAYS copy linux-ide@vger.kernel.org
                 on emails.
*                on emails.
  *
  *  Copyright 2003-2004 Red Hat, Inc.  All rights reserved.
  *  Copyright 2003-2004 Jeff Garzik
@@ -57,7 +57,6 @@ enum {
        SATA_CHAN_ENAB          = 0x40, /* SATA channel enable */
        SATA_INT_GATE           = 0x41, /* SATA interrupt gating */
        SATA_NATIVE_MODE        = 0x42, /* Native mode enable */
-       SATA_PATA_SHARING       = 0x49, /* PATA/SATA sharing func ctrl */
        PATA_UDMA_TIMING        = 0xB3, /* PATA timing for DMA/ cable detect */
        PATA_PIO_TIMING         = 0xAB, /* PATA timing register */
 
@@ -68,10 +67,9 @@ enum {
        NATIVE_MODE_ALL         = (1 << 7) | (1 << 6) | (1 << 5) | (1 << 4),
 
        SATA_EXT_PHY            = (1 << 6), /* 0==use PATA, 1==ext phy */
-       SATA_2DEV               = (1 << 5), /* SATA is master/slave */
 };
 
-static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
+static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
 static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
 static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
 static void svia_noop_freeze(struct ata_port *ap);
@@ -122,8 +120,6 @@ static struct scsi_host_template svia_sht = {
 };
 
 static const struct ata_port_operations vt6420_sata_ops = {
-       .port_disable           = ata_port_disable,
-
        .tf_load                = ata_tf_load,
        .tf_read                = ata_tf_read,
        .check_status           = ata_check_status,
@@ -146,14 +142,11 @@ static const struct ata_port_operations vt6420_sata_ops = {
 
        .irq_clear              = ata_bmdma_irq_clear,
        .irq_on                 = ata_irq_on,
-       .irq_ack                = ata_irq_ack,
 
        .port_start             = ata_port_start,
 };
 
 static const struct ata_port_operations vt6421_pata_ops = {
-       .port_disable           = ata_port_disable,
-
        .set_piomode            = vt6421_set_pio_mode,
        .set_dmamode            = vt6421_set_dma_mode,
 
@@ -180,14 +173,11 @@ static const struct ata_port_operations vt6421_pata_ops = {
 
        .irq_clear              = ata_bmdma_irq_clear,
        .irq_on                 = ata_irq_on,
-       .irq_ack                = ata_irq_ack,
 
        .port_start             = ata_port_start,
 };
 
 static const struct ata_port_operations vt6421_sata_ops = {
-       .port_disable           = ata_port_disable,
-
        .tf_load                = ata_tf_load,
        .tf_read                = ata_tf_read,
        .check_status           = ata_check_status,
@@ -211,7 +201,6 @@ static const struct ata_port_operations vt6421_sata_ops = {
 
        .irq_clear              = ata_bmdma_irq_clear,
        .irq_on                 = ata_irq_on,
-       .irq_ack                = ata_irq_ack,
 
        .scr_read               = svia_scr_read,
        .scr_write              = svia_scr_write,
@@ -276,7 +265,7 @@ static void svia_noop_freeze(struct ata_port *ap)
 
 /**
  *     vt6420_prereset - prereset for vt6420
- *     @ap: target ATA port
+ *     @link: target ATA link
  *     @deadline: deadline jiffies for the operation
  *
  *     SCR registers on vt6420 are pieces of shit and may hang the
@@ -294,9 +283,10 @@ static void svia_noop_freeze(struct ata_port *ap)
  *     RETURNS:
  *     0 on success, -errno otherwise.
  */
-static int vt6420_prereset(struct ata_port *ap, unsigned long deadline)
+static int vt6420_prereset(struct ata_link *link, unsigned long deadline)
 {
-       struct ata_eh_context *ehc = &ap->eh_context;
+       struct ata_port *ap = link->ap;
+       struct ata_eh_context *ehc = &ap->link.eh_context;
        unsigned long timeout = jiffies + (HZ * 5);
        u32 sstatus, scontrol;
        int online;
@@ -382,12 +372,12 @@ static const unsigned int vt6421_bar_sizes[] = {
        16, 16, 16, 16, 32, 128
 };
 
-static void __iomem * svia_scr_addr(void __iomem *addr, unsigned int port)
+static void __iomem *svia_scr_addr(void __iomem *addr, unsigned int port)
 {
        return addr + (port * 128);
 }
 
-static void __iomem * vt6421_scr_addr(void __iomem *addr, unsigned int port)
+static void __iomem *vt6421_scr_addr(void __iomem *addr, unsigned int port)
 {
        return addr + (port * 64);
 }
@@ -407,6 +397,9 @@ static void vt6421_init_addrs(struct ata_port *ap)
        ioaddr->scr_addr = vt6421_scr_addr(iomap[5], ap->port_no);
 
        ata_std_ports(ioaddr);
+
+       ata_port_pbar_desc(ap, ap->port_no, -1, "port");
+       ata_port_pbar_desc(ap, 4, ap->port_no * 8, "bmdma");
 }
 
 static int vt6420_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
@@ -479,7 +472,7 @@ static void svia_configure(struct pci_dev *pdev)
        if ((tmp8 & ALL_PORTS) != ALL_PORTS) {
                dev_printk(KERN_DEBUG, &pdev->dev,
                           "enabling SATA channels (0x%x)\n",
-                          (int) tmp8);
+                          (int) tmp8);
                tmp8 |= ALL_PORTS;
                pci_write_config_byte(pdev, SATA_CHAN_ENAB, tmp8);
        }
@@ -489,7 +482,7 @@ static void svia_configure(struct pci_dev *pdev)
        if ((tmp8 & ALL_PORTS) != ALL_PORTS) {
                dev_printk(KERN_DEBUG, &pdev->dev,
                           "enabling SATA channel interrupts (0x%x)\n",
-                          (int) tmp8);
+                          (int) tmp8);
                tmp8 |= ALL_PORTS;
                pci_write_config_byte(pdev, SATA_INT_GATE, tmp8);
        }
@@ -499,21 +492,20 @@ static void svia_configure(struct pci_dev *pdev)
        if ((tmp8 & NATIVE_MODE_ALL) != NATIVE_MODE_ALL) {
                dev_printk(KERN_DEBUG, &pdev->dev,
                           "enabling SATA channel native mode (0x%x)\n",
-                          (int) tmp8);
+                          (int) tmp8);
                tmp8 |= NATIVE_MODE_ALL;
                pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8);
        }
 }
 
-static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
+static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
        static int printed_version;
        unsigned int i;
        int rc;
        struct ata_host *host;
        int board_id = (int) ent->driver_data;
-       const int *bar_sizes;
-       u8 tmp8;
+       const unsigned *bar_sizes;
 
        if (!printed_version++)
                dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
@@ -522,19 +514,10 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        if (rc)
                return rc;
 
-       if (board_id == vt6420) {
-               pci_read_config_byte(pdev, SATA_PATA_SHARING, &tmp8);
-               if (tmp8 & SATA_2DEV) {
-                       dev_printk(KERN_ERR, &pdev->dev,
-                                  "SATA master/slave not supported (0x%x)\n",
-                                  (int) tmp8);
-                       return -EIO;
-               }
-
+       if (board_id == vt6420)
                bar_sizes = &svia_bar_sizes[0];
-       } else {
+       else
                bar_sizes = &vt6421_bar_sizes[0];
-       }
 
        for (i = 0; i < ARRAY_SIZE(svia_bar_sizes); i++)
                if ((pci_resource_start(pdev, i) == 0) ||
@@ -542,8 +525,8 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
                        dev_printk(KERN_ERR, &pdev->dev,
                                "invalid PCI BAR %u (sz 0x%llx, val 0x%llx)\n",
                                i,
-                               (unsigned long long)pci_resource_start(pdev, i),
-                               (unsigned long long)pci_resource_len(pdev, i));
+                               (unsigned long long)pci_resource_start(pdev, i),
+                               (unsigned long long)pci_resource_len(pdev, i));
                        return -ENODEV;
                }