aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_mpiix.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_mpiix.c')
-rw-r--r--drivers/ata/pata_mpiix.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c
index 4ea42838297e..d5483087a3fa 100644
--- a/drivers/ata/pata_mpiix.c
+++ b/drivers/ata/pata_mpiix.c
@@ -46,15 +46,16 @@ enum {
46 SECONDARY = (1 << 14) 46 SECONDARY = (1 << 14)
47}; 47};
48 48
49static int mpiix_pre_reset(struct ata_port *ap, unsigned long deadline) 49static int mpiix_pre_reset(struct ata_link *link, unsigned long deadline)
50{ 50{
51 struct ata_port *ap = link->ap;
51 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 52 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
52 static const struct pci_bits mpiix_enable_bits = { 0x6D, 1, 0x80, 0x80 }; 53 static const struct pci_bits mpiix_enable_bits = { 0x6D, 1, 0x80, 0x80 };
53 54
54 if (!pci_test_config_bits(pdev, &mpiix_enable_bits)) 55 if (!pci_test_config_bits(pdev, &mpiix_enable_bits))
55 return -ENOENT; 56 return -ENOENT;
56 57
57 return ata_std_prereset(ap, deadline); 58 return ata_std_prereset(link, deadline);
58} 59}
59 60
60/** 61/**
@@ -168,7 +169,6 @@ static struct scsi_host_template mpiix_sht = {
168}; 169};
169 170
170static struct ata_port_operations mpiix_port_ops = { 171static struct ata_port_operations mpiix_port_ops = {
171 .port_disable = ata_port_disable,
172 .set_piomode = mpiix_set_piomode, 172 .set_piomode = mpiix_set_piomode,
173 173
174 .tf_load = ata_tf_load, 174 .tf_load = ata_tf_load,
@@ -189,9 +189,8 @@ static struct ata_port_operations mpiix_port_ops = {
189 189
190 .irq_clear = ata_bmdma_irq_clear, 190 .irq_clear = ata_bmdma_irq_clear,
191 .irq_on = ata_irq_on, 191 .irq_on = ata_irq_on,
192 .irq_ack = ata_irq_ack,
193 192
194 .port_start = ata_port_start, 193 .port_start = ata_sff_port_start,
195}; 194};
196 195
197static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id) 196static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
@@ -202,7 +201,7 @@ static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
202 struct ata_port *ap; 201 struct ata_port *ap;
203 void __iomem *cmd_addr, *ctl_addr; 202 void __iomem *cmd_addr, *ctl_addr;
204 u16 idetim; 203 u16 idetim;
205 int irq; 204 int cmd, ctl, irq;
206 205
207 if (!printed_version++) 206 if (!printed_version++)
208 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); 207 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
@@ -210,6 +209,7 @@ static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
210 host = ata_host_alloc(&dev->dev, 1); 209 host = ata_host_alloc(&dev->dev, 1);
211 if (!host) 210 if (!host)
212 return -ENOMEM; 211 return -ENOMEM;
212 ap = host->ports[0];
213 213
214 /* MPIIX has many functions which can be turned on or off according 214 /* MPIIX has many functions which can be turned on or off according
215 to other devices present. Make sure IDE is enabled before we try 215 to other devices present. Make sure IDE is enabled before we try
@@ -221,25 +221,28 @@ static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
221 221
222 /* See if it's primary or secondary channel... */ 222 /* See if it's primary or secondary channel... */
223 if (!(idetim & SECONDARY)) { 223 if (!(idetim & SECONDARY)) {
224 cmd = 0x1F0;
225 ctl = 0x3F6;
224 irq = 14; 226 irq = 14;
225 cmd_addr = devm_ioport_map(&dev->dev, 0x1F0, 8);
226 ctl_addr = devm_ioport_map(&dev->dev, 0x3F6, 1);
227 } else { 227 } else {
228 cmd = 0x170;
229 ctl = 0x376;
228 irq = 15; 230 irq = 15;
229 cmd_addr = devm_ioport_map(&dev->dev, 0x170, 8);
230 ctl_addr = devm_ioport_map(&dev->dev, 0x376, 1);
231 } 231 }
232 232
233 cmd_addr = devm_ioport_map(&dev->dev, cmd, 8);
234 ctl_addr = devm_ioport_map(&dev->dev, ctl, 1);
233 if (!cmd_addr || !ctl_addr) 235 if (!cmd_addr || !ctl_addr)
234 return -ENOMEM; 236 return -ENOMEM;
235 237
238 ata_port_desc(ap, "cmd 0x%x ctl 0x%x", cmd, ctl);
239
236 /* We do our own plumbing to avoid leaking special cases for whacko 240 /* We do our own plumbing to avoid leaking special cases for whacko
237 ancient hardware into the core code. There are two issues to 241 ancient hardware into the core code. There are two issues to
238 worry about. #1 The chip is a bridge so if in legacy mode and 242 worry about. #1 The chip is a bridge so if in legacy mode and
239 without BARs set fools the setup. #2 If you pci_disable_device 243 without BARs set fools the setup. #2 If you pci_disable_device
240 the MPIIX your box goes castors up */ 244 the MPIIX your box goes castors up */
241 245
242 ap = host->ports[0];
243 ap->ops = &mpiix_port_ops; 246 ap->ops = &mpiix_port_ops;
244 ap->pio_mask = 0x1F; 247 ap->pio_mask = 0x1F;
245 ap->flags |= ATA_FLAG_SLAVE_POSS; 248 ap->flags |= ATA_FLAG_SLAVE_POSS;