aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_serverworks.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_serverworks.c')
-rw-r--r--drivers/ata/pata_serverworks.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index 3ec30036c978..af456113c55d 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -6,7 +6,7 @@
6 * based upon 6 * based upon
7 * 7 *
8 * serverworks.c 8 * serverworks.c
9 * 9 *
10 * Copyright (C) 1998-2000 Michel Aubry 10 * Copyright (C) 1998-2000 Michel Aubry
11 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz 11 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz
12 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> 12 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
@@ -62,12 +62,12 @@ static const char *csb_bad_ata100[] = {
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 hide the 40/80 pin select for their interfaces in the top two
65 * bits of the subsystem ID. 65 * bits of the subsystem ID.
66 */ 66 */
67 67
68static int dell_cable(struct ata_port *ap) { 68static int dell_cable(struct ata_port *ap) {
69 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 69 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
70 70
71 if (pdev->subsystem_device & (1 << (ap->port_no + 14))) 71 if (pdev->subsystem_device & (1 << (ap->port_no + 14)))
72 return ATA_CBL_PATA80; 72 return ATA_CBL_PATA80;
73 return ATA_CBL_PATA40; 73 return ATA_CBL_PATA40;
@@ -81,10 +81,10 @@ static int dell_cable(struct ata_port *ap) {
81 * subsystem ID the same as dell. We could use one function but we may 81 * subsystem ID the same as dell. We could use one function but we may
82 * need to extend the Dell one in future 82 * need to extend the Dell one in future
83 */ 83 */
84 84
85static int sun_cable(struct ata_port *ap) { 85static int sun_cable(struct ata_port *ap) {
86 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 86 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
87 87
88 if (pdev->subsystem_device & (1 << (ap->port_no + 14))) 88 if (pdev->subsystem_device & (1 << (ap->port_no + 14)))
89 return ATA_CBL_PATA80; 89 return ATA_CBL_PATA80;
90 return ATA_CBL_PATA40; 90 return ATA_CBL_PATA40;
@@ -123,7 +123,7 @@ struct sv_cable_table {
123 * Note that we don't copy the old serverworks code because the old 123 * Note that we don't copy the old serverworks code because the old
124 * code contains obvious mistakes 124 * code contains obvious mistakes
125 */ 125 */
126 126
127static struct sv_cable_table cable_detect[] = { 127static struct sv_cable_table cable_detect[] = {
128 { PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_VENDOR_ID_DELL, dell_cable }, 128 { PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_VENDOR_ID_DELL, dell_cable },
129 { PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_VENDOR_ID_DELL, dell_cable }, 129 { PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_VENDOR_ID_DELL, dell_cable },
@@ -140,16 +140,16 @@ static struct sv_cable_table cable_detect[] = {
140 * serverworks_pre_reset - cable detection 140 * serverworks_pre_reset - cable detection
141 * @ap: ATA port 141 * @ap: ATA port
142 * 142 *
143 * Perform cable detection according to the device and subvendor 143 * Perform cable detection according to the device and subvendor
144 * identifications 144 * identifications
145 */ 145 */
146 146
147static int serverworks_pre_reset(struct ata_port *ap) { 147static int serverworks_pre_reset(struct ata_port *ap) {
148 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 148 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
149 struct sv_cable_table *cb = cable_detect; 149 struct sv_cable_table *cb = cable_detect;
150 150
151 while(cb->device) { 151 while(cb->device) {
152 if (cb->device == pdev->device && 152 if (cb->device == pdev->device &&
153 (cb->subvendor == pdev->subsystem_vendor || 153 (cb->subvendor == pdev->subsystem_vendor ||
154 cb->subvendor == PCI_ANY_ID)) { 154 cb->subvendor == PCI_ANY_ID)) {
155 ap->cbl = cb->cable_detect(ap); 155 ap->cbl = cb->cable_detect(ap);
@@ -174,7 +174,7 @@ static void serverworks_error_handler(struct ata_port *ap)
174 * Returns true if the device being checked is known to be a CSB 174 * Returns true if the device being checked is known to be a CSB
175 * series device. 175 * series device.
176 */ 176 */
177 177
178static u8 serverworks_is_csb(struct pci_dev *pdev) 178static u8 serverworks_is_csb(struct pci_dev *pdev)
179{ 179{
180 switch (pdev->device) { 180 switch (pdev->device) {
@@ -198,7 +198,7 @@ static u8 serverworks_is_csb(struct pci_dev *pdev)
198 * specific rules. OSB4 requires no UDMA for disks due to a FIFO 198 * specific rules. OSB4 requires no UDMA for disks due to a FIFO
199 * bug we hit. 199 * bug we hit.
200 */ 200 */
201 201
202static unsigned long serverworks_osb4_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long mask) 202static unsigned long serverworks_osb4_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long mask)
203{ 203{
204 if (adev->class == ATA_DEV_ATA) 204 if (adev->class == ATA_DEV_ATA)
@@ -221,14 +221,14 @@ static unsigned long serverworks_csb_filter(const struct ata_port *ap, struct at
221 char model_num[40]; 221 char model_num[40];
222 int len, i; 222 int len, i;
223 223
224 /* Disk, UDMA */ 224 /* Disk, UDMA */
225 if (adev->class != ATA_DEV_ATA) 225 if (adev->class != ATA_DEV_ATA)
226 return ata_pci_default_filter(ap, adev, mask); 226 return ata_pci_default_filter(ap, adev, mask);
227 227
228 /* Actually do need to check */ 228 /* Actually do need to check */
229 ata_id_string(adev->id, model_num, ATA_ID_PROD_OFS, sizeof(model_num)); 229 ata_id_string(adev->id, model_num, ATA_ID_PROD_OFS, sizeof(model_num));
230 /* Precuationary - why not do this in the libata core ?? */ 230 /* Precuationary - why not do this in the libata core ?? */
231 231
232 len = strlen(model_num); 232 len = strlen(model_num);
233 while ((len > 0) && (model_num[len - 1] == ' ')) { 233 while ((len > 0) && (model_num[len - 1] == ' ')) {
234 len--; 234 len--;
@@ -261,7 +261,7 @@ static void serverworks_set_piomode(struct ata_port *ap, struct ata_device *adev
261 int pio = adev->pio_mode - XFER_PIO_0; 261 int pio = adev->pio_mode - XFER_PIO_0;
262 262
263 pci_write_config_byte(pdev, 0x40 + offset, pio_mode[pio]); 263 pci_write_config_byte(pdev, 0x40 + offset, pio_mode[pio]);
264 264
265 /* The OSB4 just requires the timing but the CSB series want the 265 /* The OSB4 just requires the timing but the CSB series want the
266 mode number as well */ 266 mode number as well */
267 if (serverworks_is_csb(pdev)) { 267 if (serverworks_is_csb(pdev)) {
@@ -303,7 +303,7 @@ static void serverworks_set_dmamode(struct ata_port *ap, struct ata_device *adev
303 303
304 ultra_cfg |= (1 << devbits); 304 ultra_cfg |= (1 << devbits);
305 } else { 305 } else {
306 pci_write_config_byte(pdev, 0x44 + offset, 306 pci_write_config_byte(pdev, 0x44 + offset,
307 dma_mode[adev->dma_mode - XFER_MW_DMA_0]); 307 dma_mode[adev->dma_mode - XFER_MW_DMA_0]);
308 ultra_cfg &= ~(1 << devbits); 308 ultra_cfg &= ~(1 << devbits);
309 } 309 }
@@ -333,7 +333,7 @@ static struct ata_port_operations serverworks_osb4_port_ops = {
333 .set_piomode = serverworks_set_piomode, 333 .set_piomode = serverworks_set_piomode,
334 .set_dmamode = serverworks_set_dmamode, 334 .set_dmamode = serverworks_set_dmamode,
335 .mode_filter = serverworks_osb4_filter, 335 .mode_filter = serverworks_osb4_filter,
336 336
337 .tf_load = ata_tf_load, 337 .tf_load = ata_tf_load,
338 .tf_read = ata_tf_read, 338 .tf_read = ata_tf_read,
339 .check_status = ata_check_status, 339 .check_status = ata_check_status,
@@ -354,19 +354,19 @@ static struct ata_port_operations serverworks_osb4_port_ops = {
354 .qc_issue = ata_qc_issue_prot, 354 .qc_issue = ata_qc_issue_prot,
355 .eng_timeout = ata_eng_timeout, 355 .eng_timeout = ata_eng_timeout,
356 .data_xfer = ata_pio_data_xfer, 356 .data_xfer = ata_pio_data_xfer,
357 357
358 .irq_handler = ata_interrupt, 358 .irq_handler = ata_interrupt,
359 .port_start = ata_port_start, 359 .port_start = ata_port_start,
360 .port_stop = ata_port_stop, 360 .port_stop = ata_port_stop,
361 .host_stop = ata_host_stop 361 .host_stop = ata_host_stop
362}; 362};
363 363
364static struct ata_port_operations serverworks_csb_port_ops = { 364static struct ata_port_operations serverworks_csb_port_ops = {
365 .port_disable = ata_port_disable, 365 .port_disable = ata_port_disable,
366 .set_piomode = serverworks_set_piomode, 366 .set_piomode = serverworks_set_piomode,
367 .set_dmamode = serverworks_set_dmamode, 367 .set_dmamode = serverworks_set_dmamode,
368 .mode_filter = serverworks_csb_filter, 368 .mode_filter = serverworks_csb_filter,
369 369
370 .tf_load = ata_tf_load, 370 .tf_load = ata_tf_load,
371 .tf_read = ata_tf_read, 371 .tf_read = ata_tf_read,
372 .check_status = ata_check_status, 372 .check_status = ata_check_status,
@@ -387,12 +387,12 @@ static struct ata_port_operations serverworks_csb_port_ops = {
387 .qc_issue = ata_qc_issue_prot, 387 .qc_issue = ata_qc_issue_prot,
388 .eng_timeout = ata_eng_timeout, 388 .eng_timeout = ata_eng_timeout,
389 .data_xfer = ata_pio_data_xfer, 389 .data_xfer = ata_pio_data_xfer,
390 390
391 .irq_handler = ata_interrupt, 391 .irq_handler = ata_interrupt,
392 .port_start = ata_port_start, 392 .port_start = ata_port_start,
393 .port_stop = ata_port_stop, 393 .port_stop = ata_port_stop,
394 .host_stop = ata_host_stop 394 .host_stop = ata_host_stop
395}; 395};
396 396
397static int serverworks_fixup_osb4(struct pci_dev *pdev) 397static int serverworks_fixup_osb4(struct pci_dev *pdev)
398{ 398{
@@ -417,7 +417,7 @@ static int serverworks_fixup_csb(struct pci_dev *pdev)
417{ 417{
418 u8 rev; 418 u8 rev;
419 u8 btr; 419 u8 btr;
420 420
421 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); 421 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
422 422
423 /* Third Channel Test */ 423 /* Third Channel Test */
@@ -463,7 +463,7 @@ static int serverworks_fixup_csb(struct pci_dev *pdev)
463 else 463 else
464 btr |= (rev >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2; 464 btr |= (rev >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2;
465 pci_write_config_byte(pdev, 0x5A, btr); 465 pci_write_config_byte(pdev, 0x5A, btr);
466 466
467 return btr; 467 return btr;
468} 468}
469 469
@@ -514,7 +514,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id
514 }; 514 };
515 static struct ata_port_info *port_info[2]; 515 static struct ata_port_info *port_info[2];
516 struct ata_port_info *devinfo = &info[id->driver_data]; 516 struct ata_port_info *devinfo = &info[id->driver_data];
517 517
518 /* Force master latency timer to 64 PCI clocks */ 518 /* Force master latency timer to 64 PCI clocks */
519 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40); 519 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40);
520 520
@@ -528,12 +528,12 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id
528 else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) || 528 else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) ||
529 (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) || 529 (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
530 (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) { 530 (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) {
531 531
532 /* If the returned btr is the newer revision then 532 /* If the returned btr is the newer revision then
533 select the right info block */ 533 select the right info block */
534 if (serverworks_fixup_csb(pdev) == 3) 534 if (serverworks_fixup_csb(pdev) == 3)
535 devinfo = &info[3]; 535 devinfo = &info[3];
536 536
537 /* Is this the 3rd channel CSB6 IDE ? */ 537 /* Is this the 3rd channel CSB6 IDE ? */
538 if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) 538 if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)
539 ports = 1; 539 ports = 1;
@@ -541,10 +541,10 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id
541 /* setup HT1000E */ 541 /* setup HT1000E */
542 else if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) 542 else if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE)
543 serverworks_fixup_ht1000(pdev); 543 serverworks_fixup_ht1000(pdev);
544 544
545 if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) 545 if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE)
546 ata_pci_clear_simplex(pdev); 546 ata_pci_clear_simplex(pdev);
547 547
548 port_info[0] = port_info[1] = devinfo; 548 port_info[0] = port_info[1] = devinfo;
549 return ata_pci_init_one(pdev, port_info, ports); 549 return ata_pci_init_one(pdev, port_info, ports);
550} 550}