aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/pci/cs5520.c14
-rw-r--r--drivers/ide/setup-pci.c35
-rw-r--r--include/linux/ide.h5
3 files changed, 20 insertions, 34 deletions
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index 17d35ca61351..4fb43206621a 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -106,18 +106,6 @@ static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed)
106} 106}
107 107
108/* 108/*
109 * We provide a callback for our nonstandard DMA location
110 */
111
112static void __devinit cs5520_init_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif)
113{
114 unsigned long bmide = pci_resource_start(dev, 2); /* Not the usual 4 */
115 if(hwif->mate && hwif->mate->dma_base) /* Second channel at primary + 8 */
116 bmide += 8;
117 ide_setup_dma(hwif, bmide, 8);
118}
119
120/*
121 * We wrap the DMA activate to set the vdma flag. This is needed 109 * We wrap the DMA activate to set the vdma flag. This is needed
122 * so that the IDE DMA layer issues PIO not DMA commands over the 110 * so that the IDE DMA layer issues PIO not DMA commands over the
123 * DMA channel 111 * DMA channel
@@ -150,9 +138,9 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
150#define DECLARE_CS_DEV(name_str) \ 138#define DECLARE_CS_DEV(name_str) \
151 { \ 139 { \
152 .name = name_str, \ 140 .name = name_str, \
153 .init_setup_dma = cs5520_init_setup_dma, \
154 .init_hwif = init_hwif_cs5520, \ 141 .init_hwif = init_hwif_cs5520, \
155 .host_flags = IDE_HFLAG_ISA_PORTS | \ 142 .host_flags = IDE_HFLAG_ISA_PORTS | \
143 IDE_HFLAG_CS5520 | \
156 IDE_HFLAG_VDMA | \ 144 IDE_HFLAG_VDMA | \
157 IDE_HFLAG_NO_ATAPI_DMA | \ 145 IDE_HFLAG_NO_ATAPI_DMA | \
158 IDE_HFLAG_BOOTABLE, \ 146 IDE_HFLAG_BOOTABLE, \
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 26061fe1b712..479add4af499 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -147,6 +147,7 @@ static int ide_setup_pci_baseregs (struct pci_dev *dev, const char *name)
147#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 147#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
148/** 148/**
149 * ide_get_or_set_dma_base - setup BMIBA 149 * ide_get_or_set_dma_base - setup BMIBA
150 * @d: IDE pci device data
150 * @hwif: Interface 151 * @hwif: Interface
151 * 152 *
152 * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space. 153 * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space.
@@ -154,7 +155,7 @@ static int ide_setup_pci_baseregs (struct pci_dev *dev, const char *name)
154 * and enforce IDE simplex rules. 155 * and enforce IDE simplex rules.
155 */ 156 */
156 157
157static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif) 158static unsigned long ide_get_or_set_dma_base(ide_pci_device_t *d, ide_hwif_t *hwif)
158{ 159{
159 unsigned long dma_base = 0; 160 unsigned long dma_base = 0;
160 struct pci_dev *dev = hwif->pci_dev; 161 struct pci_dev *dev = hwif->pci_dev;
@@ -165,14 +166,15 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
165 if (hwif->mate && hwif->mate->dma_base) { 166 if (hwif->mate && hwif->mate->dma_base) {
166 dma_base = hwif->mate->dma_base - (hwif->channel ? 0 : 8); 167 dma_base = hwif->mate->dma_base - (hwif->channel ? 0 : 8);
167 } else { 168 } else {
168 dma_base = pci_resource_start(dev, 4); 169 u8 baridx = (d->host_flags & IDE_HFLAG_CS5520) ? 2 : 4;
169 if (!dma_base) { 170
170 printk(KERN_ERR "%s: dma_base is invalid\n", 171 dma_base = pci_resource_start(dev, baridx);
171 hwif->cds->name); 172
172 } 173 if (dma_base == 0)
174 printk(KERN_ERR "%s: DMA base is invalid\n", d->name);
173 } 175 }
174 176
175 if (dma_base) { 177 if ((d->host_flags & IDE_HFLAG_CS5520) == 0 && dma_base) {
176 u8 simplex_stat = 0; 178 u8 simplex_stat = 0;
177 dma_base += hwif->channel ? 8 : 0; 179 dma_base += hwif->channel ? 8 : 0;
178 180
@@ -188,8 +190,8 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
188 simplex_stat = hwif->INB(dma_base + 2); 190 simplex_stat = hwif->INB(dma_base + 2);
189 if (simplex_stat & 0x80) { 191 if (simplex_stat & 0x80) {
190 printk(KERN_INFO "%s: simplex device: " 192 printk(KERN_INFO "%s: simplex device: "
191 "DMA forced\n", 193 "DMA forced\n",
192 hwif->cds->name); 194 d->name);
193 } 195 }
194 break; 196 break;
195 default: 197 default:
@@ -212,8 +214,8 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
212 */ 214 */
213 if (hwif->mate && hwif->mate->dma_base) { 215 if (hwif->mate && hwif->mate->dma_base) {
214 printk(KERN_INFO "%s: simplex device: " 216 printk(KERN_INFO "%s: simplex device: "
215 "DMA disabled\n", 217 "DMA disabled\n",
216 hwif->cds->name); 218 d->name);
217 dma_base = 0; 219 dma_base = 0;
218 } 220 }
219 } 221 }
@@ -434,7 +436,7 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi
434 if ((d->host_flags & IDE_HFLAG_NO_AUTODMA) == 0 || 436 if ((d->host_flags & IDE_HFLAG_NO_AUTODMA) == 0 ||
435 ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && 437 ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE &&
436 (dev->class & 0x80))) { 438 (dev->class & 0x80))) {
437 unsigned long dma_base = ide_get_or_set_dma_base(hwif); 439 unsigned long dma_base = ide_get_or_set_dma_base(d, hwif);
438 if (dma_base && !(pcicmd & PCI_COMMAND_MASTER)) { 440 if (dma_base && !(pcicmd & PCI_COMMAND_MASTER)) {
439 /* 441 /*
440 * Set up BM-DMA capability 442 * Set up BM-DMA capability
@@ -559,14 +561,9 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
559 if (d->init_iops) 561 if (d->init_iops)
560 d->init_iops(hwif); 562 d->init_iops(hwif);
561 563
562 if (d->host_flags & IDE_HFLAG_NO_DMA) 564 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0)
563 goto bypass_legacy_dma;
564
565 if(d->init_setup_dma)
566 d->init_setup_dma(dev, d, hwif);
567 else
568 ide_hwif_setup_dma(dev, d, hwif); 565 ide_hwif_setup_dma(dev, d, hwif);
569bypass_legacy_dma: 566
570 hwif->host_flags = d->host_flags; 567 hwif->host_flags = d->host_flags;
571 hwif->pio_mask = d->pio_mask; 568 hwif->pio_mask = d->pio_mask;
572 569
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 6f375e044c3e..b721f0b379f6 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1252,6 +1252,8 @@ enum {
1252 IDE_HFLAG_NO_DMA = (1 << 14), 1252 IDE_HFLAG_NO_DMA = (1 << 14),
1253 /* check if host is PCI IDE device before allowing DMA */ 1253 /* check if host is PCI IDE device before allowing DMA */
1254 IDE_HFLAG_NO_AUTODMA = (1 << 15), 1254 IDE_HFLAG_NO_AUTODMA = (1 << 15),
1255 /* host is CS5510/CS5520 */
1256 IDE_HFLAG_CS5520 = (1 << 16),
1255}; 1257};
1256 1258
1257#ifdef CONFIG_BLK_DEV_OFFBOARD 1259#ifdef CONFIG_BLK_DEV_OFFBOARD
@@ -1263,7 +1265,6 @@ enum {
1263typedef struct ide_pci_device_s { 1265typedef struct ide_pci_device_s {
1264 char *name; 1266 char *name;
1265 int (*init_setup)(struct pci_dev *, struct ide_pci_device_s *); 1267 int (*init_setup)(struct pci_dev *, struct ide_pci_device_s *);
1266 void (*init_setup_dma)(struct pci_dev *, struct ide_pci_device_s *, ide_hwif_t *);
1267 unsigned int (*init_chipset)(struct pci_dev *, const char *); 1268 unsigned int (*init_chipset)(struct pci_dev *, const char *);
1268 void (*init_iops)(ide_hwif_t *); 1269 void (*init_iops)(ide_hwif_t *);
1269 void (*init_hwif)(ide_hwif_t *); 1270 void (*init_hwif)(ide_hwif_t *);
@@ -1272,7 +1273,7 @@ typedef struct ide_pci_device_s {
1272 ide_pci_enablebit_t enablebits[2]; 1273 ide_pci_enablebit_t enablebits[2];
1273 unsigned int extra; 1274 unsigned int extra;
1274 struct ide_pci_device_s *next; 1275 struct ide_pci_device_s *next;
1275 u16 host_flags; 1276 u32 host_flags;
1276 u8 pio_mask; 1277 u8 pio_mask;
1277 u8 udma_mask; 1278 u8 udma_mask;
1278} ide_pci_device_t; 1279} ide_pci_device_t;