lkml.org 
[lkml]   [2009]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 21/86] pata_cmd64x: add enablebits checking
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] pata_cmd64x: add enablebits checking

There shouldn't be any problems with it as IDE cmd64x host driver
has been supporting enablebits checking for years.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ata/pata_cmd64x.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)

Index: b/drivers/ata/pata_cmd64x.c
===================================================================
--- a/drivers/ata/pata_cmd64x.c
+++ b/drivers/ata/pata_cmd64x.c
@@ -2,6 +2,7 @@
* pata_cmd64x.c - CMD64x PATA for new ATA layer
* (C) 2005 Red Hat Inc
* Alan Cox <alan@lxorguk.ukuu.org.uk>
+ * (C) 2009 Bartlomiej Zolnierkiewicz
*
* Based upon
* linux/drivers/ide/pci/cmd64x.c Version 1.30 Sept 10, 2002
@@ -88,6 +89,40 @@ static int cmd648_cable_detect(struct at
}

/**
+ * cmd64x_prereset - perform reset handling
+ * @link: ATA link
+ * @deadline: deadline jiffies for the operation
+ *
+ * Reset sequence checking enable bits to see which ports are
+ * active.
+ */
+
+static int cmd64x_prereset(struct ata_link *link, unsigned long deadline)
+{
+ static const struct pci_bits cmd64x_enable_bits[] = {
+ { 0x51, 1, 0x04, 0x04 },
+ { 0x51, 1, 0x08, 0x08 }
+ };
+
+ struct ata_port *ap = link->ap;
+ struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+
+ /*
+ * The original PCI0643 and PCI0646 didn't have the primary
+ * channel enable bit, it appeared starting with PCI0646U
+ * (i.e. revision ID 3).
+ */
+ if (pdev->device == PCI_DEVICE_ID_CMD_643 ||
+ (pdev->device == PCI_DEVICE_ID_CMD_646 && pdev->revision < 3))
+ goto out;
+
+ if (!pci_test_config_bits(pdev, &cmd64x_enable_bits[ap->port_no]))
+ return -ENOENT;
+out:
+ return ata_sff_prereset(link, deadline);
+}
+
+/**
* cmd64x_set_piomode - set PIO and MWDMA timing
* @ap: ATA interface
* @adev: ATA device
@@ -278,6 +313,7 @@ static const struct ata_port_operations
static struct ata_port_operations cmd64x_port_ops = {
.inherits = &cmd64x_base_ops,
.cable_detect = ata_cable_40wire,
+ .prereset = cmd64x_prereset,
};

static struct ata_port_operations cmd646r1_port_ops = {

\
 
 \ /
  Last update: 2009-11-25 18:33    [W:3.084 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site