diff options
author | Tejun Heo <htejun@gmail.com> | 2007-04-17 10:44:08 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 14:16:06 -0400 |
commit | 5d728824efeda61d304153bfcf1378a3c18b7d70 (patch) | |
tree | 8a3d4ba0c1c650da5c161f11155e7c19f0fe78aa /drivers/ata/pata_ixp4xx_cf.c | |
parent | 4447d35156169cf136e829eb6b5cac2d6370f2d9 (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_ixp4xx_cf.c')
-rw-r--r-- | drivers/ata/pata_ixp4xx_cf.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c index 8257af84ff7c..420c343e5711 100644 --- a/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c | |||
@@ -131,7 +131,6 @@ static struct ata_port_operations ixp4xx_port_ops = { | |||
131 | .data_xfer = ixp4xx_mmio_data_xfer, | 131 | .data_xfer = ixp4xx_mmio_data_xfer, |
132 | .cable_detect = ata_cable_40wire, | 132 | .cable_detect = ata_cable_40wire, |
133 | 133 | ||
134 | .irq_handler = ata_interrupt, | ||
135 | .irq_clear = ixp4xx_irq_clear, | 134 | .irq_clear = ixp4xx_irq_clear, |
136 | .irq_on = ata_irq_on, | 135 | .irq_on = ata_irq_on, |
137 | .irq_ack = ata_irq_ack, | 136 | .irq_ack = ata_irq_ack, |
@@ -174,12 +173,12 @@ static void ixp4xx_setup_port(struct ata_ioports *ioaddr, | |||
174 | 173 | ||
175 | static __devinit int ixp4xx_pata_probe(struct platform_device *pdev) | 174 | static __devinit int ixp4xx_pata_probe(struct platform_device *pdev) |
176 | { | 175 | { |
177 | int ret; | ||
178 | unsigned int irq; | 176 | unsigned int irq; |
179 | struct resource *cs0, *cs1; | 177 | struct resource *cs0, *cs1; |
180 | struct ata_probe_ent ae; | 178 | struct ata_host *host; |
181 | 179 | struct ata_port *ap; | |
182 | struct ixp4xx_pata_data *data = pdev->dev.platform_data; | 180 | struct ixp4xx_pata_data *data = pdev->dev.platform_data; |
181 | int rc; | ||
183 | 182 | ||
184 | cs0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 183 | cs0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
185 | cs1 = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 184 | cs1 = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
@@ -187,6 +186,12 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev) | |||
187 | if (!cs0 || !cs1) | 186 | if (!cs0 || !cs1) |
188 | return -EINVAL; | 187 | return -EINVAL; |
189 | 188 | ||
189 | /* allocate host */ | ||
190 | host = ata_host_alloc(&pdev->dev, 1); | ||
191 | if (!host) | ||
192 | return -ENOMEM; | ||
193 | |||
194 | /* acquire resources and fill host */ | ||
190 | pdev->dev.coherent_dma_mask = DMA_32BIT_MASK; | 195 | pdev->dev.coherent_dma_mask = DMA_32BIT_MASK; |
191 | 196 | ||
192 | data->cs0 = devm_ioremap(&pdev->dev, cs0->start, 0x1000); | 197 | data->cs0 = devm_ioremap(&pdev->dev, cs0->start, 0x1000); |
@@ -200,32 +205,22 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev) | |||
200 | *data->cs0_cfg = data->cs0_bits; | 205 | *data->cs0_cfg = data->cs0_bits; |
201 | *data->cs1_cfg = data->cs1_bits; | 206 | *data->cs1_cfg = data->cs1_bits; |
202 | 207 | ||
203 | memset(&ae, 0, sizeof(struct ata_probe_ent)); | 208 | ap = host->ports[0]; |
204 | INIT_LIST_HEAD(&ae.node); | ||
205 | 209 | ||
206 | ae.dev = &pdev->dev; | 210 | ap->ops = &ixp4xx_port_ops; |
207 | ae.port_ops = &ixp4xx_port_ops; | 211 | ap->pio_mask = 0x1f; /* PIO4 */ |
208 | ae.sht = &ixp4xx_sht; | 212 | ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | ATA_FLAG_NO_ATAPI; |
209 | ae.n_ports = 1; | ||
210 | ae.pio_mask = 0x1f; /* PIO4 */ | ||
211 | ae.irq = irq; | ||
212 | ae.irq_flags = 0; | ||
213 | ae.port_flags = ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | ||
214 | | ATA_FLAG_NO_ATAPI | ATA_FLAG_SRST; | ||
215 | 213 | ||
216 | /* run in polling mode if no irq has been assigned */ | 214 | /* run in polling mode if no irq has been assigned */ |
217 | if (!irq) | 215 | if (!irq) |
218 | ae.port_flags |= ATA_FLAG_PIO_POLLING; | 216 | ap->flags |= ATA_FLAG_PIO_POLLING; |
219 | 217 | ||
220 | ixp4xx_setup_port(&ae.port[0], data); | 218 | ixp4xx_setup_port(&ap->ioaddr, data); |
221 | 219 | ||
222 | dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); | 220 | dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); |
223 | 221 | ||
224 | ret = ata_device_add(&ae); | 222 | /* activate host */ |
225 | if (ret == 0) | 223 | return ata_host_activate(host, irq, ata_interrupt, 0, &ixp4xx_sht); |
226 | return -ENODEV; | ||
227 | |||
228 | return 0; | ||
229 | } | 224 | } |
230 | 225 | ||
231 | static __devexit int ixp4xx_pata_remove(struct platform_device *dev) | 226 | static __devexit int ixp4xx_pata_remove(struct platform_device *dev) |