aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_isapnp.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-04-17 10:44:08 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-28 14:16:06 -0400
commit5d728824efeda61d304153bfcf1378a3c18b7d70 (patch)
tree8a3d4ba0c1c650da5c161f11155e7c19f0fe78aa /drivers/ata/pata_isapnp.c
parent4447d35156169cf136e829eb6b5cac2d6370f2d9 (diff)
libata: convert the remaining PATA drivers to new init model
Convert pdc_adma, pata_cs5520, pata_isapnp, pata_ixp4xx_cf, pata_legacy, pata_mpc52xx, pata_mpiix, pata_pcmcia, pata_pdc2027x, pata_platform, pata_qdi, pata_scc and pata_winbond to new init model. * init_one()'s now follow more consistent init order * cs5520 now registers one host with two ports, not two hosts. If any of the two ports are disabled, it's made dummy as other drivers do. Tested pdc_adma and pata_legacy. Both are as broken as before. The rest are compile tested only. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_isapnp.c')
-rw-r--r--drivers/ata/pata_isapnp.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index 2580ab3146b..d042efdfbac 100644
--- a/drivers/ata/pata_isapnp.c
+++ b/drivers/ata/pata_isapnp.c
@@ -56,7 +56,6 @@ static struct ata_port_operations isapnp_port_ops = {
56 56
57 .data_xfer = ata_data_xfer, 57 .data_xfer = ata_data_xfer,
58 58
59 .irq_handler = ata_interrupt,
60 .irq_clear = ata_bmdma_irq_clear, 59 .irq_clear = ata_bmdma_irq_clear,
61 .irq_on = ata_irq_on, 60 .irq_on = ata_irq_on,
62 .irq_ack = ata_irq_ack, 61 .irq_ack = ata_irq_ack,
@@ -75,8 +74,10 @@ static struct ata_port_operations isapnp_port_ops = {
75 74
76static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev_id) 75static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev_id)
77{ 76{
78 struct ata_probe_ent ae; 77 struct ata_host *host;
78 struct ata_port *ap;
79 void __iomem *cmd_addr, *ctl_addr; 79 void __iomem *cmd_addr, *ctl_addr;
80 int rc;
80 81
81 if (pnp_port_valid(idev, 0) == 0) 82 if (pnp_port_valid(idev, 0) == 0)
82 return -ENODEV; 83 return -ENODEV;
@@ -85,34 +86,36 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
85 if (pnp_irq_valid(idev, 0) == 0) 86 if (pnp_irq_valid(idev, 0) == 0)
86 return -ENODEV; 87 return -ENODEV;
87 88
89 /* allocate host */
90 host = ata_host_alloc(&idev->dev, 1);
91 if (!host)
92 return -ENOMEM;
93
94 /* acquire resources and fill host */
88 cmd_addr = devm_ioport_map(&idev->dev, pnp_port_start(idev, 0), 8); 95 cmd_addr = devm_ioport_map(&idev->dev, pnp_port_start(idev, 0), 8);
89 if (!cmd_addr) 96 if (!cmd_addr)
90 return -ENOMEM; 97 return -ENOMEM;
91 98
92 memset(&ae, 0, sizeof(struct ata_probe_ent)); 99 ap = host->ports[0];
93 INIT_LIST_HEAD(&ae.node); 100
94 ae.dev = &idev->dev; 101 ap->ops = &isapnp_port_ops;
95 ae.port_ops = &isapnp_port_ops; 102 ap->pio_mask = 1;
96 ae.sht = &isapnp_sht; 103 ap->flags |= ATA_FLAG_SLAVE_POSS;
97 ae.n_ports = 1; 104
98 ae.pio_mask = 1; /* ISA so PIO 0 cycles */ 105 ap->ioaddr.cmd_addr = cmd_addr;
99 ae.irq = pnp_irq(idev, 0);
100 ae.irq_flags = 0;
101 ae.port_flags = ATA_FLAG_SLAVE_POSS;
102 ae.port[0].cmd_addr = cmd_addr;
103 106
104 if (pnp_port_valid(idev, 1) == 0) { 107 if (pnp_port_valid(idev, 1) == 0) {
105 ctl_addr = devm_ioport_map(&idev->dev, 108 ctl_addr = devm_ioport_map(&idev->dev,
106 pnp_port_start(idev, 1), 1); 109 pnp_port_start(idev, 1), 1);
107 ae.port[0].altstatus_addr = ctl_addr; 110 ap->ioaddr.altstatus_addr = ctl_addr;
108 ae.port[0].ctl_addr = ctl_addr; 111 ap->ioaddr.ctl_addr = ctl_addr;
109 ae.port_flags |= ATA_FLAG_SRST;
110 } 112 }
111 ata_std_ports(&ae.port[0]);
112 113
113 if (ata_device_add(&ae) == 0) 114 ata_std_ports(&ap->ioaddr);
114 return -ENODEV; 115
115 return 0; 116 /* activate */
117 return ata_host_activate(host, pnp_irq(idev, 0), ata_interrupt, 0,
118 &isapnp_sht);
116} 119}
117 120
118/** 121/**