aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ata_generic.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 20:08:28 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 20:08:28 -0500
commit2ba14a017a4ba8d2266316f481d4ad7400073d18 (patch)
tree6e86dcbbb7898eb747f1198e33961eb68bfcdb4d /drivers/ata/ata_generic.c
parent99f1c97dbdb30e958edfd1ced0ae43df62504e07 (diff)
parenta984f58dd97f22f5113700322fed311a0ee29947 (diff)
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: (67 commits) fix drivers/ata/sata_fsl.c double-decl [libata] Prefer SCSI_SENSE_BUFFERSIZE to sizeof() pata_legacy: Merge winbond support ata_generic: Cenatek support pata_winbond: error return pata_serverworks: Fix cable types and cosmetics pata_mpc52xx: remove un-needed assignment libata: fix off-by-one in error categorization ahci: factor out AHCI enabling and enable AHCI before reading CAP ata_piix: implement SIDPR SCR access ata_piix: convert to prepare - activate initialization libata: factor out ata_pci_activate_sff_host() from ata_pci_one() [libata] Prefer SCSI_SENSE_BUFFERSIZE to sizeof() pata_legacy: resychronize with upstream changes and resubmit [libata] pata_legacy: typo fix [libata] pata_winbond: update for new ->data_xfer hook pata_pcmcia: convert to new data_xfer prototype libata annotations and fixes libata: use dev_driver_string() instead of "libata" in libata-sff.c ata_piix: kill unused constants and flags ...
Diffstat (limited to 'drivers/ata/ata_generic.c')
-rw-r--r--drivers/ata/ata_generic.c51
1 files changed, 36 insertions, 15 deletions
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index 90329982bef7..20534202fc79 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -26,7 +26,7 @@
26#include <linux/libata.h> 26#include <linux/libata.h>
27 27
28#define DRV_NAME "ata_generic" 28#define DRV_NAME "ata_generic"
29#define DRV_VERSION "0.2.13" 29#define DRV_VERSION "0.2.15"
30 30
31/* 31/*
32 * A generic parallel ATA driver using libata 32 * A generic parallel ATA driver using libata
@@ -48,27 +48,47 @@ static int generic_set_mode(struct ata_link *link, struct ata_device **unused)
48 struct ata_port *ap = link->ap; 48 struct ata_port *ap = link->ap;
49 int dma_enabled = 0; 49 int dma_enabled = 0;
50 struct ata_device *dev; 50 struct ata_device *dev;
51 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
51 52
52 /* Bits 5 and 6 indicate if DMA is active on master/slave */ 53 /* Bits 5 and 6 indicate if DMA is active on master/slave */
53 if (ap->ioaddr.bmdma_addr) 54 if (ap->ioaddr.bmdma_addr)
54 dma_enabled = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 55 dma_enabled = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
55 56
57 if (pdev->vendor == PCI_VENDOR_ID_CENATEK)
58 dma_enabled = 0xFF;
59
56 ata_link_for_each_dev(dev, link) { 60 ata_link_for_each_dev(dev, link) {
57 if (ata_dev_enabled(dev)) { 61 if (!ata_dev_enabled(dev))
58 /* We don't really care */ 62 continue;
59 dev->pio_mode = XFER_PIO_0; 63
60 dev->dma_mode = XFER_MW_DMA_0; 64 /* We don't really care */
61 /* We do need the right mode information for DMA or PIO 65 dev->pio_mode = XFER_PIO_0;
62 and this comes from the current configuration flags */ 66 dev->dma_mode = XFER_MW_DMA_0;
63 if (dma_enabled & (1 << (5 + dev->devno))) { 67 /* We do need the right mode information for DMA or PIO
64 ata_id_to_dma_mode(dev, XFER_MW_DMA_0); 68 and this comes from the current configuration flags */
65 dev->flags &= ~ATA_DFLAG_PIO; 69 if (dma_enabled & (1 << (5 + dev->devno))) {
66 } else { 70 unsigned int xfer_mask = ata_id_xfermask(dev->id);
67 ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); 71 const char *name;
68 dev->xfer_mode = XFER_PIO_0; 72
69 dev->xfer_shift = ATA_SHIFT_PIO; 73 if (xfer_mask & (ATA_MASK_MWDMA | ATA_MASK_UDMA))
70 dev->flags |= ATA_DFLAG_PIO; 74 name = ata_mode_string(xfer_mask);
75 else {
76 /* SWDMA perhaps? */
77 name = "DMA";
78 xfer_mask |= ata_xfer_mode2mask(XFER_MW_DMA_0);
71 } 79 }
80
81 ata_dev_printk(dev, KERN_INFO, "configured for %s\n",
82 name);
83
84 dev->xfer_mode = ata_xfer_mask2mode(xfer_mask);
85 dev->xfer_shift = ata_xfer_mode2shift(dev->xfer_mode);
86 dev->flags &= ~ATA_DFLAG_PIO;
87 } else {
88 ata_dev_printk(dev, KERN_INFO, "configured for PIO\n");
89 dev->xfer_mode = XFER_PIO_0;
90 dev->xfer_shift = ATA_SHIFT_PIO;
91 dev->flags |= ATA_DFLAG_PIO;
72 } 92 }
73 } 93 }
74 return 0; 94 return 0;
@@ -185,6 +205,7 @@ static struct pci_device_id ata_generic[] = {
185 { PCI_DEVICE(PCI_VENDOR_ID_HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE), }, 205 { PCI_DEVICE(PCI_VENDOR_ID_HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE), },
186 { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561), }, 206 { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561), },
187 { PCI_DEVICE(PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C558), }, 207 { PCI_DEVICE(PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C558), },
208 { PCI_DEVICE(PCI_VENDOR_ID_CENATEK,PCI_DEVICE_ID_CENATEK_IDE), },
188 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO), }, 209 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO), },
189 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), }, 210 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), },
190 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), }, 211 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), },