aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_hpt3x2n.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2010-12-25 14:44:01 -0500
committerJeff Garzik <jgarzik@redhat.com>2011-01-07 22:33:10 -0500
commit8e834c2e6d51e053c6bd23fec1d95529f618f760 (patch)
tree8d4441b90f880c2d7cd4d5ef1799bfb9fa50ba16 /drivers/ata/pata_hpt3x2n.c
parentb27dcfb0670ea7352a67137f4ff7947c2a9f6892 (diff)
pata_hpt{37x|3x2n}: SATA mode filtering
The Marvell bridge chips used on HighPoint SATA cards do not seem to support the UltraDMA modes 1, 2, and 3 as well as any MWDMA modes; these cards are based on HPT372/372A/372N/374 chips (judging from the vendor drivers), so the Linux drivers need to have a mode_filter() method for these chips... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/pata_hpt3x2n.c')
-rw-r--r--drivers/ata/pata_hpt3x2n.c61
1 files changed, 49 insertions, 12 deletions
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index 32f3463216b8..97c6ded047b8 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -8,7 +8,7 @@
8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
9 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 9 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
10 * Portions Copyright (C) 2003 Red Hat Inc 10 * Portions Copyright (C) 2003 Red Hat Inc
11 * Portions Copyright (C) 2005-2009 MontaVista Software, Inc. 11 * Portions Copyright (C) 2005-2010 MontaVista Software, Inc.
12 * 12 *
13 * 13 *
14 * TODO 14 * TODO
@@ -25,7 +25,7 @@
25#include <linux/libata.h> 25#include <linux/libata.h>
26 26
27#define DRV_NAME "pata_hpt3x2n" 27#define DRV_NAME "pata_hpt3x2n"
28#define DRV_VERSION "0.3.10" 28#define DRV_VERSION "0.3.11"
29 29
30enum { 30enum {
31 HPT_PCI_FAST = (1 << 31), 31 HPT_PCI_FAST = (1 << 31),
@@ -113,6 +113,22 @@ static u32 hpt3x2n_find_mode(struct ata_port *ap, int speed)
113} 113}
114 114
115/** 115/**
116 * hpt372n_filter - mode selection filter
117 * @adev: ATA device
118 * @mask: mode mask
119 *
120 * The Marvell bridge chips used on the HighPoint SATA cards do not seem
121 * to support the UltraDMA modes 1, 2, and 3 as well as any MWDMA modes...
122 */
123static unsigned long hpt372n_filter(struct ata_device *adev, unsigned long mask)
124{
125 if (ata_id_is_sata(adev->id))
126 mask &= ~((0xE << ATA_SHIFT_UDMA) | ATA_MASK_MWDMA);
127
128 return mask;
129}
130
131/**
116 * hpt3x2n_cable_detect - Detect the cable type 132 * hpt3x2n_cable_detect - Detect the cable type
117 * @ap: ATA port to detect on 133 * @ap: ATA port to detect on
118 * 134 *
@@ -328,10 +344,10 @@ static struct scsi_host_template hpt3x2n_sht = {
328}; 344};
329 345
330/* 346/*
331 * Configuration for HPT3x2n. 347 * Configuration for HPT302N/371N.
332 */ 348 */
333 349
334static struct ata_port_operations hpt3x2n_port_ops = { 350static struct ata_port_operations hpt3xxn_port_ops = {
335 .inherits = &ata_bmdma_port_ops, 351 .inherits = &ata_bmdma_port_ops,
336 352
337 .bmdma_stop = hpt3x2n_bmdma_stop, 353 .bmdma_stop = hpt3x2n_bmdma_stop,
@@ -345,6 +361,15 @@ static struct ata_port_operations hpt3x2n_port_ops = {
345 .prereset = hpt3x2n_pre_reset, 361 .prereset = hpt3x2n_pre_reset,
346}; 362};
347 363
364/*
365 * Configuration for HPT372N. Same as 302N/371N but we have a mode filter.
366 */
367
368static struct ata_port_operations hpt372n_port_ops = {
369 .inherits = &hpt3xxn_port_ops,
370 .mode_filter = &hpt372n_filter,
371};
372
348/** 373/**
349 * hpt3xn_calibrate_dpll - Calibrate the DPLL loop 374 * hpt3xn_calibrate_dpll - Calibrate the DPLL loop
350 * @dev: PCI device 375 * @dev: PCI device
@@ -437,15 +462,23 @@ static int hpt3x2n_pci_clock(struct pci_dev *pdev)
437 462
438static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) 463static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
439{ 464{
440 /* HPT372N and friends - UDMA133 */ 465 /* HPT372N - UDMA133 */
441 static const struct ata_port_info info = { 466 static const struct ata_port_info info_hpt372n = {
442 .flags = ATA_FLAG_SLAVE_POSS, 467 .flags = ATA_FLAG_SLAVE_POSS,
443 .pio_mask = ATA_PIO4, 468 .pio_mask = ATA_PIO4,
444 .mwdma_mask = ATA_MWDMA2, 469 .mwdma_mask = ATA_MWDMA2,
445 .udma_mask = ATA_UDMA6, 470 .udma_mask = ATA_UDMA6,
446 .port_ops = &hpt3x2n_port_ops 471 .port_ops = &hpt372n_port_ops
447 }; 472 };
448 const struct ata_port_info *ppi[] = { &info, NULL }; 473 /* HPT302N and HPT371N - UDMA133 */
474 static const struct ata_port_info info_hpt3xxn = {
475 .flags = ATA_FLAG_SLAVE_POSS,
476 .pio_mask = ATA_PIO4,
477 .mwdma_mask = ATA_MWDMA2,
478 .udma_mask = ATA_UDMA6,
479 .port_ops = &hpt3xxn_port_ops
480 };
481 const struct ata_port_info *ppi[] = { &info_hpt3xxn, NULL };
449 u8 rev = dev->revision; 482 u8 rev = dev->revision;
450 u8 irqmask; 483 u8 irqmask;
451 unsigned int pci_mhz; 484 unsigned int pci_mhz;
@@ -461,24 +494,28 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
461 494
462 switch(dev->device) { 495 switch(dev->device) {
463 case PCI_DEVICE_ID_TTI_HPT366: 496 case PCI_DEVICE_ID_TTI_HPT366:
497 /* 372N if rev >= 6 */
464 if (rev < 6) 498 if (rev < 6)
465 return -ENODEV; 499 return -ENODEV;
466 break; 500 goto hpt372n;
467 case PCI_DEVICE_ID_TTI_HPT371: 501 case PCI_DEVICE_ID_TTI_HPT371:
502 /* 371N if rev >= 2 */
468 if (rev < 2) 503 if (rev < 2)
469 return -ENODEV; 504 return -ENODEV;
470 /* 371N if rev > 1 */
471 break; 505 break;
472 case PCI_DEVICE_ID_TTI_HPT372: 506 case PCI_DEVICE_ID_TTI_HPT372:
473 /* 372N if rev >= 2*/ 507 /* 372N if rev >= 2 */
474 if (rev < 2) 508 if (rev < 2)
475 return -ENODEV; 509 return -ENODEV;
476 break; 510 goto hpt372n;
477 case PCI_DEVICE_ID_TTI_HPT302: 511 case PCI_DEVICE_ID_TTI_HPT302:
512 /* 302N if rev >= 2 */
478 if (rev < 2) 513 if (rev < 2)
479 return -ENODEV; 514 return -ENODEV;
480 break; 515 break;
481 case PCI_DEVICE_ID_TTI_HPT372N: 516 case PCI_DEVICE_ID_TTI_HPT372N:
517hpt372n:
518 ppi[0] = &info_hpt372n;
482 break; 519 break;
483 default: 520 default:
484 printk(KERN_ERR "pata_hpt3x2n: PCI table is bogus please report (%d).\n", dev->device); 521 printk(KERN_ERR "pata_hpt3x2n: PCI table is bogus please report (%d).\n", dev->device);