diff options
Diffstat (limited to 'drivers/ata/pata_cs5530.c')
-rw-r--r-- | drivers/ata/pata_cs5530.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c index b1ca207e3545..3d7b7d87ec6f 100644 --- a/drivers/ata/pata_cs5530.c +++ b/drivers/ata/pata_cs5530.c | |||
@@ -37,6 +37,13 @@ | |||
37 | #define DRV_NAME "pata_cs5530" | 37 | #define DRV_NAME "pata_cs5530" |
38 | #define DRV_VERSION "0.7.1" | 38 | #define DRV_VERSION "0.7.1" |
39 | 39 | ||
40 | static void __iomem *cs5530_port_base(struct ata_port *ap) | ||
41 | { | ||
42 | unsigned long bmdma = (unsigned long)ap->ioaddr.bmdma_addr; | ||
43 | |||
44 | return (void __iomem *)((bmdma & ~0x0F) + 0x20 + 0x10 * ap->port_no); | ||
45 | } | ||
46 | |||
40 | /** | 47 | /** |
41 | * cs5530_set_piomode - PIO setup | 48 | * cs5530_set_piomode - PIO setup |
42 | * @ap: ATA interface | 49 | * @ap: ATA interface |
@@ -52,19 +59,19 @@ static void cs5530_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
52 | {0x00009172, 0x00012171, 0x00020080, 0x00032010, 0x00040010}, | 59 | {0x00009172, 0x00012171, 0x00020080, 0x00032010, 0x00040010}, |
53 | {0xd1329172, 0x71212171, 0x30200080, 0x20102010, 0x00100010} | 60 | {0xd1329172, 0x71212171, 0x30200080, 0x20102010, 0x00100010} |
54 | }; | 61 | }; |
55 | unsigned long base = ( ap->ioaddr.bmdma_addr & ~0x0F) + 0x20 + 0x10 * ap->port_no; | 62 | void __iomem *base = cs5530_port_base(ap); |
56 | u32 tuning; | 63 | u32 tuning; |
57 | int format; | 64 | int format; |
58 | 65 | ||
59 | /* Find out which table to use */ | 66 | /* Find out which table to use */ |
60 | tuning = inl(base + 0x04); | 67 | tuning = ioread32(base + 0x04); |
61 | format = (tuning & 0x80000000UL) ? 1 : 0; | 68 | format = (tuning & 0x80000000UL) ? 1 : 0; |
62 | 69 | ||
63 | /* Now load the right timing register */ | 70 | /* Now load the right timing register */ |
64 | if (adev->devno) | 71 | if (adev->devno) |
65 | base += 0x08; | 72 | base += 0x08; |
66 | 73 | ||
67 | outl(cs5530_pio_timings[format][adev->pio_mode - XFER_PIO_0], base); | 74 | iowrite32(cs5530_pio_timings[format][adev->pio_mode - XFER_PIO_0], base); |
68 | } | 75 | } |
69 | 76 | ||
70 | /** | 77 | /** |
@@ -79,12 +86,12 @@ static void cs5530_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
79 | 86 | ||
80 | static void cs5530_set_dmamode(struct ata_port *ap, struct ata_device *adev) | 87 | static void cs5530_set_dmamode(struct ata_port *ap, struct ata_device *adev) |
81 | { | 88 | { |
82 | unsigned long base = ( ap->ioaddr.bmdma_addr & ~0x0F) + 0x20 + 0x10 * ap->port_no; | 89 | void __iomem *base = cs5530_port_base(ap); |
83 | u32 tuning, timing = 0; | 90 | u32 tuning, timing = 0; |
84 | u8 reg; | 91 | u8 reg; |
85 | 92 | ||
86 | /* Find out which table to use */ | 93 | /* Find out which table to use */ |
87 | tuning = inl(base + 0x04); | 94 | tuning = ioread32(base + 0x04); |
88 | 95 | ||
89 | switch(adev->dma_mode) { | 96 | switch(adev->dma_mode) { |
90 | case XFER_UDMA_0: | 97 | case XFER_UDMA_0: |
@@ -105,20 +112,20 @@ static void cs5530_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
105 | /* Merge in the PIO format bit */ | 112 | /* Merge in the PIO format bit */ |
106 | timing |= (tuning & 0x80000000UL); | 113 | timing |= (tuning & 0x80000000UL); |
107 | if (adev->devno == 0) /* Master */ | 114 | if (adev->devno == 0) /* Master */ |
108 | outl(timing, base + 0x04); | 115 | iowrite32(timing, base + 0x04); |
109 | else { | 116 | else { |
110 | if (timing & 0x00100000) | 117 | if (timing & 0x00100000) |
111 | tuning |= 0x00100000; /* UDMA for both */ | 118 | tuning |= 0x00100000; /* UDMA for both */ |
112 | else | 119 | else |
113 | tuning &= ~0x00100000; /* MWDMA for both */ | 120 | tuning &= ~0x00100000; /* MWDMA for both */ |
114 | outl(tuning, base + 0x04); | 121 | iowrite32(tuning, base + 0x04); |
115 | outl(timing, base + 0x0C); | 122 | iowrite32(timing, base + 0x0C); |
116 | } | 123 | } |
117 | 124 | ||
118 | /* Set the DMA capable bit in the BMDMA area */ | 125 | /* Set the DMA capable bit in the BMDMA area */ |
119 | reg = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | 126 | reg = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); |
120 | reg |= (1 << (5 + adev->devno)); | 127 | reg |= (1 << (5 + adev->devno)); |
121 | outb(reg, ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | 128 | iowrite8(reg, ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); |
122 | 129 | ||
123 | /* Remember the last DMA setup we did */ | 130 | /* Remember the last DMA setup we did */ |
124 | 131 | ||
@@ -210,14 +217,14 @@ static struct ata_port_operations cs5530_port_ops = { | |||
210 | .qc_prep = ata_qc_prep, | 217 | .qc_prep = ata_qc_prep, |
211 | .qc_issue = cs5530_qc_issue_prot, | 218 | .qc_issue = cs5530_qc_issue_prot, |
212 | 219 | ||
213 | .data_xfer = ata_pio_data_xfer, | 220 | .data_xfer = ata_data_xfer, |
214 | 221 | ||
215 | .irq_handler = ata_interrupt, | 222 | .irq_handler = ata_interrupt, |
216 | .irq_clear = ata_bmdma_irq_clear, | 223 | .irq_clear = ata_bmdma_irq_clear, |
224 | .irq_on = ata_irq_on, | ||
225 | .irq_ack = ata_irq_ack, | ||
217 | 226 | ||
218 | .port_start = ata_port_start, | 227 | .port_start = ata_port_start, |
219 | .port_stop = ata_port_stop, | ||
220 | .host_stop = ata_host_stop | ||
221 | }; | 228 | }; |
222 | 229 | ||
223 | static struct dmi_system_id palmax_dmi_table[] = { | 230 | static struct dmi_system_id palmax_dmi_table[] = { |
@@ -247,7 +254,7 @@ static int cs5530_is_palmax(void) | |||
247 | * Perform the chip initialisation work that is shared between both | 254 | * Perform the chip initialisation work that is shared between both |
248 | * setup and resume paths | 255 | * setup and resume paths |
249 | */ | 256 | */ |
250 | 257 | ||
251 | static int cs5530_init_chip(void) | 258 | static int cs5530_init_chip(void) |
252 | { | 259 | { |
253 | struct pci_dev *master_0 = NULL, *cs5530_0 = NULL, *dev = NULL; | 260 | struct pci_dev *master_0 = NULL, *cs5530_0 = NULL, *dev = NULL; |
@@ -357,11 +364,11 @@ static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
357 | .port_ops = &cs5530_port_ops | 364 | .port_ops = &cs5530_port_ops |
358 | }; | 365 | }; |
359 | static struct ata_port_info *port_info[2] = { &info, &info }; | 366 | static struct ata_port_info *port_info[2] = { &info, &info }; |
360 | 367 | ||
361 | /* Chip initialisation */ | 368 | /* Chip initialisation */ |
362 | if (cs5530_init_chip()) | 369 | if (cs5530_init_chip()) |
363 | return -ENODEV; | 370 | return -ENODEV; |
364 | 371 | ||
365 | if (cs5530_is_palmax()) | 372 | if (cs5530_is_palmax()) |
366 | port_info[1] = &info_palmax_secondary; | 373 | port_info[1] = &info_palmax_secondary; |
367 | 374 | ||
@@ -376,7 +383,7 @@ static int cs5530_reinit_one(struct pci_dev *pdev) | |||
376 | BUG(); | 383 | BUG(); |
377 | return ata_pci_device_resume(pdev); | 384 | return ata_pci_device_resume(pdev); |
378 | } | 385 | } |
379 | 386 | ||
380 | static const struct pci_device_id cs5530[] = { | 387 | static const struct pci_device_id cs5530[] = { |
381 | { PCI_VDEVICE(CYRIX, PCI_DEVICE_ID_CYRIX_5530_IDE), }, | 388 | { PCI_VDEVICE(CYRIX, PCI_DEVICE_ID_CYRIX_5530_IDE), }, |
382 | 389 | ||