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:03 -0400 |
commit | 9a829ccfc833269bdb85751f5048288ab93678ac (patch) | |
tree | 89732ae0da2ce1b1076d6ce8e80ac6aad8d9deb0 /drivers/ata/sata_uli.c | |
parent | eca25dca17630ae354f4b1df559ed90578b794fe (diff) |
libata: convert ata_pci_init_native_mode() users to new init model
Convert drivers which use ata_pci_init_native_mode() to new init
model. ata_pci_init_native_host() is used instead. sata_nv, sata_uli
and sata_sis are in this category.
Tested on nVidia Corporation CK804 Serial ATA Controller [10de:0054]
in both BMDMA and ADMA mode.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_uli.c')
-rw-r--r-- | drivers/ata/sata_uli.c | 65 |
1 files changed, 24 insertions, 41 deletions
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c index d659ace80f4f..f74e383de083 100644 --- a/drivers/ata/sata_uli.c +++ b/drivers/ata/sata_uli.c | |||
@@ -115,7 +115,6 @@ static const struct ata_port_operations uli_ops = { | |||
115 | .error_handler = ata_bmdma_error_handler, | 115 | .error_handler = ata_bmdma_error_handler, |
116 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 116 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
117 | 117 | ||
118 | .irq_handler = ata_interrupt, | ||
119 | .irq_clear = ata_bmdma_irq_clear, | 118 | .irq_clear = ata_bmdma_irq_clear, |
120 | .irq_on = ata_irq_on, | 119 | .irq_on = ata_irq_on, |
121 | .irq_ack = ata_irq_ack, | 120 | .irq_ack = ata_irq_ack, |
@@ -127,7 +126,6 @@ static const struct ata_port_operations uli_ops = { | |||
127 | }; | 126 | }; |
128 | 127 | ||
129 | static struct ata_port_info uli_port_info = { | 128 | static struct ata_port_info uli_port_info = { |
130 | .sht = &uli_sht, | ||
131 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 129 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
132 | ATA_FLAG_IGN_SIMPLEX, | 130 | ATA_FLAG_IGN_SIMPLEX, |
133 | .pio_mask = 0x1f, /* pio0-4 */ | 131 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -185,12 +183,13 @@ static void uli_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | |||
185 | static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 183 | static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
186 | { | 184 | { |
187 | static int printed_version; | 185 | static int printed_version; |
188 | struct ata_probe_ent *probe_ent; | 186 | const struct ata_port_info *ppi[] = { &uli_port_info, NULL }; |
189 | struct ata_port_info *ppi[2]; | ||
190 | int rc; | ||
191 | unsigned int board_idx = (unsigned int) ent->driver_data; | 187 | unsigned int board_idx = (unsigned int) ent->driver_data; |
188 | struct ata_host *host; | ||
192 | struct uli_priv *hpriv; | 189 | struct uli_priv *hpriv; |
193 | void __iomem * const *iomap; | 190 | void __iomem * const *iomap; |
191 | struct ata_ioports *ioaddr; | ||
192 | int n_ports, rc; | ||
194 | 193 | ||
195 | if (!printed_version++) | 194 | if (!printed_version++) |
196 | dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); | 195 | dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); |
@@ -199,54 +198,42 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
199 | if (rc) | 198 | if (rc) |
200 | return rc; | 199 | return rc; |
201 | 200 | ||
202 | rc = pci_request_regions(pdev, DRV_NAME); | 201 | n_ports = 2; |
203 | if (rc) { | 202 | if (board_idx == uli_5287) |
204 | pcim_pin_device(pdev); | 203 | n_ports = 4; |
205 | return rc; | 204 | rc = ata_pci_prepare_native_host(pdev, ppi, n_ports, &host); |
206 | } | ||
207 | |||
208 | rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); | ||
209 | if (rc) | ||
210 | return rc; | ||
211 | rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK); | ||
212 | if (rc) | 205 | if (rc) |
213 | return rc; | 206 | return rc; |
214 | 207 | ||
215 | ppi[0] = ppi[1] = &uli_port_info; | ||
216 | probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); | ||
217 | if (!probe_ent) | ||
218 | return -ENOMEM; | ||
219 | |||
220 | hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); | 208 | hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); |
221 | if (!hpriv) | 209 | if (!hpriv) |
222 | return -ENOMEM; | 210 | return -ENOMEM; |
211 | host->private_data = hpriv; | ||
223 | 212 | ||
224 | probe_ent->private_data = hpriv; | 213 | iomap = host->iomap; |
225 | |||
226 | iomap = pcim_iomap_table(pdev); | ||
227 | 214 | ||
228 | switch (board_idx) { | 215 | switch (board_idx) { |
229 | case uli_5287: | 216 | case uli_5287: |
230 | hpriv->scr_cfg_addr[0] = ULI5287_BASE; | 217 | hpriv->scr_cfg_addr[0] = ULI5287_BASE; |
231 | hpriv->scr_cfg_addr[1] = ULI5287_BASE + ULI5287_OFFS; | 218 | hpriv->scr_cfg_addr[1] = ULI5287_BASE + ULI5287_OFFS; |
232 | probe_ent->n_ports = 4; | ||
233 | 219 | ||
234 | probe_ent->port[2].cmd_addr = iomap[0] + 8; | 220 | ioaddr = &host->ports[2]->ioaddr; |
235 | probe_ent->port[2].altstatus_addr = | 221 | ioaddr->cmd_addr = iomap[0] + 8; |
236 | probe_ent->port[2].ctl_addr = (void __iomem *) | 222 | ioaddr->altstatus_addr = |
223 | ioaddr->ctl_addr = (void __iomem *) | ||
237 | ((unsigned long)iomap[1] | ATA_PCI_CTL_OFS) + 4; | 224 | ((unsigned long)iomap[1] | ATA_PCI_CTL_OFS) + 4; |
238 | probe_ent->port[2].bmdma_addr = iomap[4] + 16; | 225 | ioaddr->bmdma_addr = iomap[4] + 16; |
239 | hpriv->scr_cfg_addr[2] = ULI5287_BASE + ULI5287_OFFS*4; | 226 | hpriv->scr_cfg_addr[2] = ULI5287_BASE + ULI5287_OFFS*4; |
227 | ata_std_ports(ioaddr); | ||
240 | 228 | ||
241 | probe_ent->port[3].cmd_addr = iomap[2] + 8; | 229 | ioaddr = &host->ports[3]->ioaddr; |
242 | probe_ent->port[3].altstatus_addr = | 230 | ioaddr->cmd_addr = iomap[2] + 8; |
243 | probe_ent->port[3].ctl_addr = (void __iomem *) | 231 | ioaddr->altstatus_addr = |
232 | ioaddr->ctl_addr = (void __iomem *) | ||
244 | ((unsigned long)iomap[3] | ATA_PCI_CTL_OFS) + 4; | 233 | ((unsigned long)iomap[3] | ATA_PCI_CTL_OFS) + 4; |
245 | probe_ent->port[3].bmdma_addr = iomap[4] + 24; | 234 | ioaddr->bmdma_addr = iomap[4] + 24; |
246 | hpriv->scr_cfg_addr[3] = ULI5287_BASE + ULI5287_OFFS*5; | 235 | hpriv->scr_cfg_addr[3] = ULI5287_BASE + ULI5287_OFFS*5; |
247 | 236 | ata_std_ports(ioaddr); | |
248 | ata_std_ports(&probe_ent->port[2]); | ||
249 | ata_std_ports(&probe_ent->port[3]); | ||
250 | break; | 237 | break; |
251 | 238 | ||
252 | case uli_5289: | 239 | case uli_5289: |
@@ -266,12 +253,8 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
266 | 253 | ||
267 | pci_set_master(pdev); | 254 | pci_set_master(pdev); |
268 | pci_intx(pdev, 1); | 255 | pci_intx(pdev, 1); |
269 | 256 | return ata_host_activate(host, pdev->irq, ata_interrupt, IRQF_SHARED, | |
270 | if (!ata_device_add(probe_ent)) | 257 | &uli_sht); |
271 | return -ENODEV; | ||
272 | |||
273 | devm_kfree(&pdev->dev, probe_ent); | ||
274 | return 0; | ||
275 | } | 258 | } |
276 | 259 | ||
277 | static int __init uli_init(void) | 260 | static int __init uli_init(void) |