aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_cs5520.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_cs5520.c')
-rw-r--r--drivers/ata/pata_cs5520.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index e2459088cdcd..33f7f0843f4f 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -158,7 +158,6 @@ static struct scsi_host_template cs5520_sht = {
158}; 158};
159 159
160static struct ata_port_operations cs5520_port_ops = { 160static struct ata_port_operations cs5520_port_ops = {
161 .port_disable = ata_port_disable,
162 .set_piomode = cs5520_set_piomode, 161 .set_piomode = cs5520_set_piomode,
163 .set_dmamode = cs5520_set_dmamode, 162 .set_dmamode = cs5520_set_dmamode,
164 163
@@ -184,13 +183,14 @@ static struct ata_port_operations cs5520_port_ops = {
184 183
185 .irq_clear = ata_bmdma_irq_clear, 184 .irq_clear = ata_bmdma_irq_clear,
186 .irq_on = ata_irq_on, 185 .irq_on = ata_irq_on,
187 .irq_ack = ata_irq_ack,
188 186
189 .port_start = ata_port_start, 187 .port_start = ata_sff_port_start,
190}; 188};
191 189
192static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id) 190static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
193{ 191{
192 static const unsigned int cmd_port[] = { 0x1F0, 0x170 };
193 static const unsigned int ctl_port[] = { 0x3F6, 0x376 };
194 struct ata_port_info pi = { 194 struct ata_port_info pi = {
195 .flags = ATA_FLAG_SLAVE_POSS, 195 .flags = ATA_FLAG_SLAVE_POSS,
196 .pio_mask = 0x1f, 196 .pio_mask = 0x1f,
@@ -244,10 +244,10 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
244 } 244 }
245 245
246 /* Map IO ports and initialize host accordingly */ 246 /* Map IO ports and initialize host accordingly */
247 iomap[0] = devm_ioport_map(&pdev->dev, 0x1F0, 8); 247 iomap[0] = devm_ioport_map(&pdev->dev, cmd_port[0], 8);
248 iomap[1] = devm_ioport_map(&pdev->dev, 0x3F6, 1); 248 iomap[1] = devm_ioport_map(&pdev->dev, ctl_port[0], 1);
249 iomap[2] = devm_ioport_map(&pdev->dev, 0x170, 8); 249 iomap[2] = devm_ioport_map(&pdev->dev, cmd_port[1], 8);
250 iomap[3] = devm_ioport_map(&pdev->dev, 0x376, 1); 250 iomap[3] = devm_ioport_map(&pdev->dev, ctl_port[1], 1);
251 iomap[4] = pcim_iomap(pdev, 2, 0); 251 iomap[4] = pcim_iomap(pdev, 2, 0);
252 252
253 if (!iomap[0] || !iomap[1] || !iomap[2] || !iomap[3] || !iomap[4]) 253 if (!iomap[0] || !iomap[1] || !iomap[2] || !iomap[3] || !iomap[4])
@@ -260,6 +260,10 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
260 ioaddr->bmdma_addr = iomap[4]; 260 ioaddr->bmdma_addr = iomap[4];
261 ata_std_ports(ioaddr); 261 ata_std_ports(ioaddr);
262 262
263 ata_port_desc(host->ports[0],
264 "cmd 0x%x ctl 0x%x", cmd_port[0], ctl_port[0]);
265 ata_port_pbar_desc(host->ports[0], 4, 0, "bmdma");
266
263 ioaddr = &host->ports[1]->ioaddr; 267 ioaddr = &host->ports[1]->ioaddr;
264 ioaddr->cmd_addr = iomap[2]; 268 ioaddr->cmd_addr = iomap[2];
265 ioaddr->ctl_addr = iomap[3]; 269 ioaddr->ctl_addr = iomap[3];
@@ -267,6 +271,10 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
267 ioaddr->bmdma_addr = iomap[4] + 8; 271 ioaddr->bmdma_addr = iomap[4] + 8;
268 ata_std_ports(ioaddr); 272 ata_std_ports(ioaddr);
269 273
274 ata_port_desc(host->ports[1],
275 "cmd 0x%x ctl 0x%x", cmd_port[1], ctl_port[1]);
276 ata_port_pbar_desc(host->ports[1], 4, 8, "bmdma");
277
270 /* activate the host */ 278 /* activate the host */
271 pci_set_master(pdev); 279 pci_set_master(pdev);
272 rc = ata_host_start(host); 280 rc = ata_host_start(host);
@@ -285,33 +293,12 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
285 if (rc) 293 if (rc)
286 return rc; 294 return rc;
287 295
288 if (i == 0) 296 ata_port_desc(ap, "irq %d", irq[i]);
289 host->irq = irq[0];
290 else
291 host->irq2 = irq[1];
292 } 297 }
293 298
294 return ata_host_register(host, &cs5520_sht); 299 return ata_host_register(host, &cs5520_sht);
295} 300}
296 301
297/**
298 * cs5520_remove_one - device unload
299 * @pdev: PCI device being removed
300 *
301 * Handle an unplug/unload event for a PCI device. Unload the
302 * PCI driver but do not use the default handler as we manage
303 * resources ourself and *MUST NOT* disable the device as it has
304 * other functions.
305 */
306
307static void __devexit cs5520_remove_one(struct pci_dev *pdev)
308{
309 struct device *dev = pci_dev_to_dev(pdev);
310 struct ata_host *host = dev_get_drvdata(dev);
311
312 ata_host_detach(host);
313}
314
315#ifdef CONFIG_PM 302#ifdef CONFIG_PM
316/** 303/**
317 * cs5520_reinit_one - device resume 304 * cs5520_reinit_one - device resume
@@ -368,7 +355,7 @@ static struct pci_driver cs5520_pci_driver = {
368 .name = DRV_NAME, 355 .name = DRV_NAME,
369 .id_table = pata_cs5520, 356 .id_table = pata_cs5520,
370 .probe = cs5520_init_one, 357 .probe = cs5520_init_one,
371 .remove = cs5520_remove_one, 358 .remove = ata_pci_remove_one,
372#ifdef CONFIG_PM 359#ifdef CONFIG_PM
373 .suspend = cs5520_pci_device_suspend, 360 .suspend = cs5520_pci_device_suspend,
374 .resume = cs5520_reinit_one, 361 .resume = cs5520_reinit_one,