diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2011-10-13 06:32:18 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2011-10-14 13:16:29 -0400 |
commit | e69a70d951787013e5fe65e843edd5711571546c (patch) | |
tree | 3f6b0afda1318022c22baf64fb4aaa75a4e87186 | |
parent | 5860a5545a308850fab11bd8dadd217973d3cc97 (diff) |
pata_serverworks: cleanup cable detection
Merge identical cable routines for Dell and Sun systems into
common oem_cable() one.
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r-- | drivers/ata/pata_serverworks.c | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c index e49365f36dab..27d9802fb974 100644 --- a/drivers/ata/pata_serverworks.c +++ b/drivers/ata/pata_serverworks.c | |||
@@ -58,32 +58,14 @@ static const char *csb_bad_ata100[] = { | |||
58 | }; | 58 | }; |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * dell_cable - Dell serverworks cable detection | 61 | * oem_cable - Dell/Sun serverworks cable detection |
62 | * @ap: ATA port to do cable detect | 62 | * @ap: ATA port to do cable detect |
63 | * | 63 | * |
64 | * Dell hide the 40/80 pin select for their interfaces in the top two | 64 | * Dell PowerEdge and Sun Cobalt 'Alpine' hide the 40/80 pin select |
65 | * bits of the subsystem ID. | 65 | * for their interfaces in the top two bits of the subsystem ID. |
66 | */ | 66 | */ |
67 | 67 | ||
68 | static int dell_cable(struct ata_port *ap) | 68 | static int oem_cable(struct ata_port *ap) |
69 | { | ||
70 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
71 | |||
72 | if (pdev->subsystem_device & (1 << (ap->port_no + 14))) | ||
73 | return ATA_CBL_PATA80; | ||
74 | return ATA_CBL_PATA40; | ||
75 | } | ||
76 | |||
77 | /** | ||
78 | * sun_cable - Sun Cobalt 'Alpine' cable detection | ||
79 | * @ap: ATA port to do cable select | ||
80 | * | ||
81 | * Cobalt CSB5 IDE hides the 40/80pin in the top two bits of the | ||
82 | * subsystem ID the same as dell. We could use one function but we may | ||
83 | * need to extend the Dell one in future | ||
84 | */ | ||
85 | |||
86 | static int sun_cable(struct ata_port *ap) | ||
87 | { | 69 | { |
88 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 70 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
89 | 71 | ||
@@ -98,15 +80,10 @@ struct sv_cable_table { | |||
98 | int (*cable_detect)(struct ata_port *ap); | 80 | int (*cable_detect)(struct ata_port *ap); |
99 | }; | 81 | }; |
100 | 82 | ||
101 | /* | ||
102 | * Note that we don't copy the old serverworks code because the old | ||
103 | * code contains obvious mistakes | ||
104 | */ | ||
105 | |||
106 | static struct sv_cable_table cable_detect[] = { | 83 | static struct sv_cable_table cable_detect[] = { |
107 | { PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_VENDOR_ID_DELL, dell_cable }, | 84 | { PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_VENDOR_ID_DELL, oem_cable }, |
108 | { PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_VENDOR_ID_DELL, dell_cable }, | 85 | { PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_VENDOR_ID_DELL, oem_cable }, |
109 | { PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_VENDOR_ID_SUN, sun_cable }, | 86 | { PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_VENDOR_ID_SUN, oem_cable }, |
110 | { PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, PCI_ANY_ID, ata_cable_40wire }, | 87 | { PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, PCI_ANY_ID, ata_cable_40wire }, |
111 | { PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_ANY_ID, ata_cable_unknown }, | 88 | { PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_ANY_ID, ata_cable_unknown }, |
112 | { PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_ANY_ID, ata_cable_unknown }, | 89 | { PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_ANY_ID, ata_cable_unknown }, |