aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_pdc202xx_old.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_pdc202xx_old.c')
-rw-r--r--drivers/ata/pata_pdc202xx_old.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index ad691b9e7743..6dd63413a523 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -170,17 +170,17 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
170 struct ata_taskfile *tf = &qc->tf; 170 struct ata_taskfile *tf = &qc->tf;
171 int sel66 = ap->port_no ? 0x08: 0x02; 171 int sel66 = ap->port_no ? 0x08: 0x02;
172 172
173 unsigned long master = ap->host->ports[0]->ioaddr.bmdma_addr; 173 void __iomem *master = ap->host->ports[0]->ioaddr.bmdma_addr;
174 unsigned long clock = master + 0x11; 174 void __iomem *clock = master + 0x11;
175 unsigned long atapi_reg = master + 0x20 + (4 * ap->port_no); 175 void __iomem *atapi_reg = master + 0x20 + (4 * ap->port_no);
176 176
177 u32 len; 177 u32 len;
178 178
179 /* Check we keep host level locking here */ 179 /* Check we keep host level locking here */
180 if (adev->dma_mode >= XFER_UDMA_2) 180 if (adev->dma_mode >= XFER_UDMA_2)
181 outb(inb(clock) | sel66, clock); 181 iowrite8(ioread8(clock) | sel66, clock);
182 else 182 else
183 outb(inb(clock) & ~sel66, clock); 183 iowrite8(ioread8(clock) & ~sel66, clock);
184 184
185 /* The DMA clocks may have been trashed by a reset. FIXME: make conditional 185 /* The DMA clocks may have been trashed by a reset. FIXME: make conditional
186 and move to qc_issue ? */ 186 and move to qc_issue ? */
@@ -189,17 +189,14 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
189 /* Cases the state machine will not complete correctly without help */ 189 /* Cases the state machine will not complete correctly without help */
190 if ((tf->flags & ATA_TFLAG_LBA48) || tf->protocol == ATA_PROT_ATAPI_DMA) 190 if ((tf->flags & ATA_TFLAG_LBA48) || tf->protocol == ATA_PROT_ATAPI_DMA)
191 { 191 {
192 if (tf->flags & ATA_TFLAG_LBA48) 192 len = qc->nbytes;
193 len = qc->nsect * 512;
194 else
195 len = qc->nbytes;
196 193
197 if (tf->flags & ATA_TFLAG_WRITE) 194 if (tf->flags & ATA_TFLAG_WRITE)
198 len |= 0x06000000; 195 len |= 0x06000000;
199 else 196 else
200 len |= 0x05000000; 197 len |= 0x05000000;
201 198
202 outl(len, atapi_reg); 199 iowrite32(len, atapi_reg);
203 } 200 }
204 201
205 /* Activate DMA */ 202 /* Activate DMA */
@@ -222,19 +219,19 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
222 219
223 int sel66 = ap->port_no ? 0x08: 0x02; 220 int sel66 = ap->port_no ? 0x08: 0x02;
224 /* The clock bits are in the same register for both channels */ 221 /* The clock bits are in the same register for both channels */
225 unsigned long master = ap->host->ports[0]->ioaddr.bmdma_addr; 222 void __iomem *master = ap->host->ports[0]->ioaddr.bmdma_addr;
226 unsigned long clock = master + 0x11; 223 void __iomem *clock = master + 0x11;
227 unsigned long atapi_reg = master + 0x20 + (4 * ap->port_no); 224 void __iomem *atapi_reg = master + 0x20 + (4 * ap->port_no);
228 225
229 /* Cases the state machine will not complete correctly */ 226 /* Cases the state machine will not complete correctly */
230 if (tf->protocol == ATA_PROT_ATAPI_DMA || ( tf->flags & ATA_TFLAG_LBA48)) { 227 if (tf->protocol == ATA_PROT_ATAPI_DMA || ( tf->flags & ATA_TFLAG_LBA48)) {
231 outl(0, atapi_reg); 228 iowrite32(0, atapi_reg);
232 outb(inb(clock) & ~sel66, clock); 229 iowrite8(ioread8(clock) & ~sel66, clock);
233 } 230 }
234 /* Check we keep host level locking here */ 231 /* Check we keep host level locking here */
235 /* Flip back to 33Mhz for PIO */ 232 /* Flip back to 33Mhz for PIO */
236 if (adev->dma_mode >= XFER_UDMA_2) 233 if (adev->dma_mode >= XFER_UDMA_2)
237 outb(inb(clock) & ~sel66, clock); 234 iowrite8(ioread8(clock) & ~sel66, clock);
238 235
239 ata_bmdma_stop(qc); 236 ata_bmdma_stop(qc);
240} 237}
@@ -297,14 +294,14 @@ static struct ata_port_operations pdc2024x_port_ops = {
297 294
298 .qc_prep = ata_qc_prep, 295 .qc_prep = ata_qc_prep,
299 .qc_issue = ata_qc_issue_prot, 296 .qc_issue = ata_qc_issue_prot,
300 .data_xfer = ata_pio_data_xfer, 297 .data_xfer = ata_data_xfer,
301 298
302 .irq_handler = ata_interrupt, 299 .irq_handler = ata_interrupt,
303 .irq_clear = ata_bmdma_irq_clear, 300 .irq_clear = ata_bmdma_irq_clear,
301 .irq_on = ata_irq_on,
302 .irq_ack = ata_irq_ack,
304 303
305 .port_start = ata_port_start, 304 .port_start = ata_port_start,
306 .port_stop = ata_port_stop,
307 .host_stop = ata_host_stop
308}; 305};
309 306
310static struct ata_port_operations pdc2026x_port_ops = { 307static struct ata_port_operations pdc2026x_port_ops = {
@@ -331,14 +328,14 @@ static struct ata_port_operations pdc2026x_port_ops = {
331 328
332 .qc_prep = ata_qc_prep, 329 .qc_prep = ata_qc_prep,
333 .qc_issue = ata_qc_issue_prot, 330 .qc_issue = ata_qc_issue_prot,
334 .data_xfer = ata_pio_data_xfer, 331 .data_xfer = ata_data_xfer,
335 332
336 .irq_handler = ata_interrupt, 333 .irq_handler = ata_interrupt,
337 .irq_clear = ata_bmdma_irq_clear, 334 .irq_clear = ata_bmdma_irq_clear,
335 .irq_on = ata_irq_on,
336 .irq_ack = ata_irq_ack,
338 337
339 .port_start = ata_port_start, 338 .port_start = ata_port_start,
340 .port_stop = ata_port_stop,
341 .host_stop = ata_host_stop
342}; 339};
343 340
344static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) 341static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)