diff options
Diffstat (limited to 'drivers/ata/pata_mpiix.c')
-rw-r--r-- | drivers/ata/pata_mpiix.c | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c index c4a1b10f3bca..9837faf0f620 100644 --- a/drivers/ata/pata_mpiix.c +++ b/drivers/ata/pata_mpiix.c | |||
@@ -188,7 +188,7 @@ static struct ata_port_operations mpiix_port_ops = { | |||
188 | 188 | ||
189 | .qc_prep = ata_qc_prep, | 189 | .qc_prep = ata_qc_prep, |
190 | .qc_issue = mpiix_qc_issue_prot, | 190 | .qc_issue = mpiix_qc_issue_prot, |
191 | .data_xfer = ata_pio_data_xfer, | 191 | .data_xfer = ata_data_xfer, |
192 | 192 | ||
193 | .irq_handler = ata_interrupt, | 193 | .irq_handler = ata_interrupt, |
194 | .irq_clear = ata_bmdma_irq_clear, | 194 | .irq_clear = ata_bmdma_irq_clear, |
@@ -199,10 +199,11 @@ static struct ata_port_operations mpiix_port_ops = { | |||
199 | static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 199 | static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
200 | { | 200 | { |
201 | /* Single threaded by the PCI probe logic */ | 201 | /* Single threaded by the PCI probe logic */ |
202 | static struct ata_probe_ent probe[2]; | 202 | static struct ata_probe_ent probe; |
203 | static int printed_version; | 203 | static int printed_version; |
204 | void __iomem *cmd_addr, *ctl_addr; | ||
204 | u16 idetim; | 205 | u16 idetim; |
205 | int enabled; | 206 | int irq; |
206 | 207 | ||
207 | if (!printed_version++) | 208 | if (!printed_version++) |
208 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); | 209 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); |
@@ -215,43 +216,43 @@ static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
215 | if (!(idetim & ENABLED)) | 216 | if (!(idetim & ENABLED)) |
216 | return -ENODEV; | 217 | return -ENODEV; |
217 | 218 | ||
219 | if (!(idetim & SECONDARY)) { | ||
220 | irq = 14; | ||
221 | cmd_addr = devm_ioport_map(&dev->dev, 0x1F0, 8); | ||
222 | ctl_addr = devm_ioport_map(&dev->dev, 0x3F6, 1); | ||
223 | } else { | ||
224 | irq = 15; | ||
225 | cmd_addr = devm_ioport_map(&dev->dev, 0x170, 8); | ||
226 | ctl_addr = devm_ioport_map(&dev->dev, 0x376, 1); | ||
227 | } | ||
228 | |||
229 | if (!cmd_addr || !ctl_addr) | ||
230 | return -ENOMEM; | ||
231 | |||
218 | /* We do our own plumbing to avoid leaking special cases for whacko | 232 | /* We do our own plumbing to avoid leaking special cases for whacko |
219 | ancient hardware into the core code. There are two issues to | 233 | ancient hardware into the core code. There are two issues to |
220 | worry about. #1 The chip is a bridge so if in legacy mode and | 234 | worry about. #1 The chip is a bridge so if in legacy mode and |
221 | without BARs set fools the setup. #2 If you pci_disable_device | 235 | without BARs set fools the setup. #2 If you pci_disable_device |
222 | the MPIIX your box goes castors up */ | 236 | the MPIIX your box goes castors up */ |
223 | 237 | ||
224 | INIT_LIST_HEAD(&probe[0].node); | 238 | INIT_LIST_HEAD(&probe.node); |
225 | probe[0].dev = pci_dev_to_dev(dev); | 239 | probe.dev = pci_dev_to_dev(dev); |
226 | probe[0].port_ops = &mpiix_port_ops; | 240 | probe.port_ops = &mpiix_port_ops; |
227 | probe[0].sht = &mpiix_sht; | 241 | probe.sht = &mpiix_sht; |
228 | probe[0].pio_mask = 0x1F; | 242 | probe.pio_mask = 0x1F; |
229 | probe[0].irq = 14; | 243 | probe.irq = irq; |
230 | probe[0].irq_flags = SA_SHIRQ; | 244 | probe.irq_flags = SA_SHIRQ; |
231 | probe[0].port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST; | 245 | probe.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST; |
232 | probe[0].n_ports = 1; | 246 | probe.n_ports = 1; |
233 | probe[0].port[0].cmd_addr = 0x1F0; | 247 | probe.port[0].cmd_addr = cmd_addr; |
234 | probe[0].port[0].ctl_addr = 0x3F6; | 248 | probe.port[0].ctl_addr = ctl_addr; |
235 | probe[0].port[0].altstatus_addr = 0x3F6; | 249 | probe.port[0].altstatus_addr = ctl_addr; |
236 | |||
237 | /* The secondary lurks at different addresses but is otherwise | ||
238 | the same beastie */ | ||
239 | |||
240 | INIT_LIST_HEAD(&probe[1].node); | ||
241 | probe[1] = probe[0]; | ||
242 | probe[1].irq = 15; | ||
243 | probe[1].port[0].cmd_addr = 0x170; | ||
244 | probe[1].port[0].ctl_addr = 0x376; | ||
245 | probe[1].port[0].altstatus_addr = 0x376; | ||
246 | 250 | ||
247 | /* Let libata fill in the port details */ | 251 | /* Let libata fill in the port details */ |
248 | ata_std_ports(&probe[0].port[0]); | 252 | ata_std_ports(&probe.port[0]); |
249 | ata_std_ports(&probe[1].port[0]); | ||
250 | 253 | ||
251 | /* Now add the port that is active */ | 254 | /* Now add the port that is active */ |
252 | enabled = (idetim & SECONDARY) ? 1 : 0; | 255 | if (ata_device_add(&probe)) |
253 | |||
254 | if (ata_device_add(&probe[enabled])) | ||
255 | return 0; | 256 | return 0; |
256 | return -ENODEV; | 257 | return -ENODEV; |
257 | } | 258 | } |