diff options
Diffstat (limited to 'drivers/ata/pata_cs5520.c')
-rw-r--r-- | drivers/ata/pata_cs5520.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c index 63bdcbe45583..801a00efa3ee 100644 --- a/drivers/ata/pata_cs5520.c +++ b/drivers/ata/pata_cs5520.c | |||
@@ -99,9 +99,9 @@ static void cs5520_set_timings(struct ata_port *ap, struct ata_device *adev, int | |||
99 | static void cs5520_enable_dma(struct ata_port *ap, struct ata_device *adev) | 99 | static void cs5520_enable_dma(struct ata_port *ap, struct ata_device *adev) |
100 | { | 100 | { |
101 | /* Set the DMA enable/disable flag */ | 101 | /* Set the DMA enable/disable flag */ |
102 | u8 reg = inb(ap->ioaddr.bmdma_addr + 0x02); | 102 | u8 reg = ioread8(ap->ioaddr.bmdma_addr + 0x02); |
103 | reg |= 1<<(adev->devno + 5); | 103 | reg |= 1<<(adev->devno + 5); |
104 | outb(reg, ap->ioaddr.bmdma_addr + 0x02); | 104 | iowrite8(reg, ap->ioaddr.bmdma_addr + 0x02); |
105 | } | 105 | } |
106 | 106 | ||
107 | /** | 107 | /** |
@@ -193,7 +193,7 @@ static struct ata_port_operations cs5520_port_ops = { | |||
193 | .bmdma_status = ata_bmdma_status, | 193 | .bmdma_status = ata_bmdma_status, |
194 | .qc_prep = ata_qc_prep, | 194 | .qc_prep = ata_qc_prep, |
195 | .qc_issue = ata_qc_issue_prot, | 195 | .qc_issue = ata_qc_issue_prot, |
196 | .data_xfer = ata_pio_data_xfer, | 196 | .data_xfer = ata_data_xfer, |
197 | 197 | ||
198 | .irq_handler = ata_interrupt, | 198 | .irq_handler = ata_interrupt, |
199 | .irq_clear = ata_bmdma_irq_clear, | 199 | .irq_clear = ata_bmdma_irq_clear, |
@@ -204,6 +204,7 @@ static struct ata_port_operations cs5520_port_ops = { | |||
204 | static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 204 | static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
205 | { | 205 | { |
206 | u8 pcicfg; | 206 | u8 pcicfg; |
207 | void *iomap[5]; | ||
207 | static struct ata_probe_ent probe[2]; | 208 | static struct ata_probe_ent probe[2]; |
208 | int ports = 0; | 209 | int ports = 0; |
209 | 210 | ||
@@ -234,6 +235,16 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic | |||
234 | return -ENODEV; | 235 | return -ENODEV; |
235 | } | 236 | } |
236 | 237 | ||
238 | /* Map IO ports */ | ||
239 | iomap[0] = devm_ioport_map(&dev->dev, 0x1F0, 8); | ||
240 | iomap[1] = devm_ioport_map(&dev->dev, 0x3F6, 1); | ||
241 | iomap[2] = devm_ioport_map(&dev->dev, 0x170, 8); | ||
242 | iomap[3] = devm_ioport_map(&dev->dev, 0x376, 1); | ||
243 | iomap[4] = pcim_iomap(dev, 2, 0); | ||
244 | |||
245 | if (!iomap[0] || !iomap[1] || !iomap[2] || !iomap[3] || !iomap[4]) | ||
246 | return -ENOMEM; | ||
247 | |||
237 | /* We have to do our own plumbing as the PCI setup for this | 248 | /* We have to do our own plumbing as the PCI setup for this |
238 | chipset is non-standard so we can't punt to the libata code */ | 249 | chipset is non-standard so we can't punt to the libata code */ |
239 | 250 | ||
@@ -247,10 +258,10 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic | |||
247 | probe[0].irq_flags = 0; | 258 | probe[0].irq_flags = 0; |
248 | probe[0].port_flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST; | 259 | probe[0].port_flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST; |
249 | probe[0].n_ports = 1; | 260 | probe[0].n_ports = 1; |
250 | probe[0].port[0].cmd_addr = 0x1F0; | 261 | probe[0].port[0].cmd_addr = iomap[0]; |
251 | probe[0].port[0].ctl_addr = 0x3F6; | 262 | probe[0].port[0].ctl_addr = iomap[1]; |
252 | probe[0].port[0].altstatus_addr = 0x3F6; | 263 | probe[0].port[0].altstatus_addr = iomap[1]; |
253 | probe[0].port[0].bmdma_addr = pci_resource_start(dev, 2); | 264 | probe[0].port[0].bmdma_addr = iomap[4]; |
254 | 265 | ||
255 | /* The secondary lurks at different addresses but is otherwise | 266 | /* The secondary lurks at different addresses but is otherwise |
256 | the same beastie */ | 267 | the same beastie */ |
@@ -258,10 +269,10 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic | |||
258 | probe[1] = probe[0]; | 269 | probe[1] = probe[0]; |
259 | INIT_LIST_HEAD(&probe[1].node); | 270 | INIT_LIST_HEAD(&probe[1].node); |
260 | probe[1].irq = 15; | 271 | probe[1].irq = 15; |
261 | probe[1].port[0].cmd_addr = 0x170; | 272 | probe[1].port[0].cmd_addr = iomap[2]; |
262 | probe[1].port[0].ctl_addr = 0x376; | 273 | probe[1].port[0].ctl_addr = iomap[3]; |
263 | probe[1].port[0].altstatus_addr = 0x376; | 274 | probe[1].port[0].altstatus_addr = iomap[3]; |
264 | probe[1].port[0].bmdma_addr = pci_resource_start(dev, 2) + 8; | 275 | probe[1].port[0].bmdma_addr = iomap[4] + 8; |
265 | 276 | ||
266 | /* Let libata fill in the port details */ | 277 | /* Let libata fill in the port details */ |
267 | ata_std_ports(&probe[0].port[0]); | 278 | ata_std_ports(&probe[0].port[0]); |