diff options
Diffstat (limited to 'drivers/ata/sata_sil.c')
-rw-r--r-- | drivers/ata/sata_sil.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index 8c72e714b456..ea3a0ab7e027 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -59,7 +59,8 @@ enum { | |||
59 | SIL_FLAG_MOD15WRITE = (1 << 30), | 59 | SIL_FLAG_MOD15WRITE = (1 << 30), |
60 | 60 | ||
61 | SIL_DFL_PORT_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 61 | SIL_DFL_PORT_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
62 | ATA_FLAG_MMIO | ATA_FLAG_HRST_TO_RESUME, | 62 | ATA_FLAG_MMIO, |
63 | SIL_DFL_LINK_FLAGS = ATA_LFLAG_HRST_TO_RESUME, | ||
63 | 64 | ||
64 | /* | 65 | /* |
65 | * Controller IDs | 66 | * Controller IDs |
@@ -117,7 +118,7 @@ static int sil_pci_device_resume(struct pci_dev *pdev); | |||
117 | static void sil_dev_config(struct ata_device *dev); | 118 | static void sil_dev_config(struct ata_device *dev); |
118 | static int sil_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); | 119 | static int sil_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); |
119 | static int sil_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); | 120 | static int sil_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); |
120 | static int sil_set_mode (struct ata_port *ap, struct ata_device **r_failed); | 121 | static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed); |
121 | static void sil_freeze(struct ata_port *ap); | 122 | static void sil_freeze(struct ata_port *ap); |
122 | static void sil_thaw(struct ata_port *ap); | 123 | static void sil_thaw(struct ata_port *ap); |
123 | 124 | ||
@@ -185,7 +186,6 @@ static struct scsi_host_template sil_sht = { | |||
185 | }; | 186 | }; |
186 | 187 | ||
187 | static const struct ata_port_operations sil_ops = { | 188 | static const struct ata_port_operations sil_ops = { |
188 | .port_disable = ata_port_disable, | ||
189 | .dev_config = sil_dev_config, | 189 | .dev_config = sil_dev_config, |
190 | .tf_load = ata_tf_load, | 190 | .tf_load = ata_tf_load, |
191 | .tf_read = ata_tf_read, | 191 | .tf_read = ata_tf_read, |
@@ -206,7 +206,6 @@ static const struct ata_port_operations sil_ops = { | |||
206 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 206 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
207 | .irq_clear = ata_bmdma_irq_clear, | 207 | .irq_clear = ata_bmdma_irq_clear, |
208 | .irq_on = ata_irq_on, | 208 | .irq_on = ata_irq_on, |
209 | .irq_ack = ata_irq_ack, | ||
210 | .scr_read = sil_scr_read, | 209 | .scr_read = sil_scr_read, |
211 | .scr_write = sil_scr_write, | 210 | .scr_write = sil_scr_write, |
212 | .port_start = ata_port_start, | 211 | .port_start = ata_port_start, |
@@ -216,6 +215,7 @@ static const struct ata_port_info sil_port_info[] = { | |||
216 | /* sil_3112 */ | 215 | /* sil_3112 */ |
217 | { | 216 | { |
218 | .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE, | 217 | .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE, |
218 | .link_flags = SIL_DFL_LINK_FLAGS, | ||
219 | .pio_mask = 0x1f, /* pio0-4 */ | 219 | .pio_mask = 0x1f, /* pio0-4 */ |
220 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 220 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
221 | .udma_mask = ATA_UDMA5, | 221 | .udma_mask = ATA_UDMA5, |
@@ -225,6 +225,7 @@ static const struct ata_port_info sil_port_info[] = { | |||
225 | { | 225 | { |
226 | .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE | | 226 | .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE | |
227 | SIL_FLAG_NO_SATA_IRQ, | 227 | SIL_FLAG_NO_SATA_IRQ, |
228 | .link_flags = SIL_DFL_LINK_FLAGS, | ||
228 | .pio_mask = 0x1f, /* pio0-4 */ | 229 | .pio_mask = 0x1f, /* pio0-4 */ |
229 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 230 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
230 | .udma_mask = ATA_UDMA5, | 231 | .udma_mask = ATA_UDMA5, |
@@ -233,6 +234,7 @@ static const struct ata_port_info sil_port_info[] = { | |||
233 | /* sil_3512 */ | 234 | /* sil_3512 */ |
234 | { | 235 | { |
235 | .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT, | 236 | .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT, |
237 | .link_flags = SIL_DFL_LINK_FLAGS, | ||
236 | .pio_mask = 0x1f, /* pio0-4 */ | 238 | .pio_mask = 0x1f, /* pio0-4 */ |
237 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 239 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
238 | .udma_mask = ATA_UDMA5, | 240 | .udma_mask = ATA_UDMA5, |
@@ -241,6 +243,7 @@ static const struct ata_port_info sil_port_info[] = { | |||
241 | /* sil_3114 */ | 243 | /* sil_3114 */ |
242 | { | 244 | { |
243 | .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT, | 245 | .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT, |
246 | .link_flags = SIL_DFL_LINK_FLAGS, | ||
244 | .pio_mask = 0x1f, /* pio0-4 */ | 247 | .pio_mask = 0x1f, /* pio0-4 */ |
245 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 248 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
246 | .udma_mask = ATA_UDMA5, | 249 | .udma_mask = ATA_UDMA5, |
@@ -290,35 +293,33 @@ static unsigned char sil_get_device_cache_line(struct pci_dev *pdev) | |||
290 | 293 | ||
291 | /** | 294 | /** |
292 | * sil_set_mode - wrap set_mode functions | 295 | * sil_set_mode - wrap set_mode functions |
293 | * @ap: port to set up | 296 | * @link: link to set up |
294 | * @r_failed: returned device when we fail | 297 | * @r_failed: returned device when we fail |
295 | * | 298 | * |
296 | * Wrap the libata method for device setup as after the setup we need | 299 | * Wrap the libata method for device setup as after the setup we need |
297 | * to inspect the results and do some configuration work | 300 | * to inspect the results and do some configuration work |
298 | */ | 301 | */ |
299 | 302 | ||
300 | static int sil_set_mode (struct ata_port *ap, struct ata_device **r_failed) | 303 | static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed) |
301 | { | 304 | { |
302 | struct ata_host *host = ap->host; | 305 | struct ata_port *ap = link->ap; |
303 | struct ata_device *dev; | 306 | void __iomem *mmio_base = ap->host->iomap[SIL_MMIO_BAR]; |
304 | void __iomem *mmio_base = host->iomap[SIL_MMIO_BAR]; | ||
305 | void __iomem *addr = mmio_base + sil_port[ap->port_no].xfer_mode; | 307 | void __iomem *addr = mmio_base + sil_port[ap->port_no].xfer_mode; |
306 | u32 tmp, dev_mode[2]; | 308 | struct ata_device *dev; |
307 | unsigned int i; | 309 | u32 tmp, dev_mode[2] = { }; |
308 | int rc; | 310 | int rc; |
309 | 311 | ||
310 | rc = ata_do_set_mode(ap, r_failed); | 312 | rc = ata_do_set_mode(link, r_failed); |
311 | if (rc) | 313 | if (rc) |
312 | return rc; | 314 | return rc; |
313 | 315 | ||
314 | for (i = 0; i < 2; i++) { | 316 | ata_link_for_each_dev(dev, link) { |
315 | dev = &ap->device[i]; | ||
316 | if (!ata_dev_enabled(dev)) | 317 | if (!ata_dev_enabled(dev)) |
317 | dev_mode[i] = 0; /* PIO0/1/2 */ | 318 | dev_mode[dev->devno] = 0; /* PIO0/1/2 */ |
318 | else if (dev->flags & ATA_DFLAG_PIO) | 319 | else if (dev->flags & ATA_DFLAG_PIO) |
319 | dev_mode[i] = 1; /* PIO3/4 */ | 320 | dev_mode[dev->devno] = 1; /* PIO3/4 */ |
320 | else | 321 | else |
321 | dev_mode[i] = 3; /* UDMA */ | 322 | dev_mode[dev->devno] = 3; /* UDMA */ |
322 | /* value 2 indicates MDMA */ | 323 | /* value 2 indicates MDMA */ |
323 | } | 324 | } |
324 | 325 | ||
@@ -374,8 +375,8 @@ static int sil_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) | |||
374 | 375 | ||
375 | static void sil_host_intr(struct ata_port *ap, u32 bmdma2) | 376 | static void sil_host_intr(struct ata_port *ap, u32 bmdma2) |
376 | { | 377 | { |
377 | struct ata_eh_info *ehi = &ap->eh_info; | 378 | struct ata_eh_info *ehi = &ap->link.eh_info; |
378 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag); | 379 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag); |
379 | u8 status; | 380 | u8 status; |
380 | 381 | ||
381 | if (unlikely(bmdma2 & SIL_DMA_SATA_IRQ)) { | 382 | if (unlikely(bmdma2 & SIL_DMA_SATA_IRQ)) { |
@@ -394,8 +395,8 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2) | |||
394 | * repeat probing needlessly. | 395 | * repeat probing needlessly. |
395 | */ | 396 | */ |
396 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) { | 397 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) { |
397 | ata_ehi_hotplugged(&ap->eh_info); | 398 | ata_ehi_hotplugged(&ap->link.eh_info); |
398 | ap->eh_info.serror |= serror; | 399 | ap->link.eh_info.serror |= serror; |
399 | } | 400 | } |
400 | 401 | ||
401 | goto freeze; | 402 | goto freeze; |
@@ -562,8 +563,8 @@ static void sil_thaw(struct ata_port *ap) | |||
562 | */ | 563 | */ |
563 | static void sil_dev_config(struct ata_device *dev) | 564 | static void sil_dev_config(struct ata_device *dev) |
564 | { | 565 | { |
565 | struct ata_port *ap = dev->ap; | 566 | struct ata_port *ap = dev->link->ap; |
566 | int print_info = ap->eh_context.i.flags & ATA_EHI_PRINTINFO; | 567 | int print_info = ap->link.eh_context.i.flags & ATA_EHI_PRINTINFO; |
567 | unsigned int n, quirks = 0; | 568 | unsigned int n, quirks = 0; |
568 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; | 569 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; |
569 | 570 | ||
@@ -686,7 +687,8 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
686 | mmio_base = host->iomap[SIL_MMIO_BAR]; | 687 | mmio_base = host->iomap[SIL_MMIO_BAR]; |
687 | 688 | ||
688 | for (i = 0; i < host->n_ports; i++) { | 689 | for (i = 0; i < host->n_ports; i++) { |
689 | struct ata_ioports *ioaddr = &host->ports[i]->ioaddr; | 690 | struct ata_port *ap = host->ports[i]; |
691 | struct ata_ioports *ioaddr = &ap->ioaddr; | ||
690 | 692 | ||
691 | ioaddr->cmd_addr = mmio_base + sil_port[i].tf; | 693 | ioaddr->cmd_addr = mmio_base + sil_port[i].tf; |
692 | ioaddr->altstatus_addr = | 694 | ioaddr->altstatus_addr = |
@@ -694,6 +696,9 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
694 | ioaddr->bmdma_addr = mmio_base + sil_port[i].bmdma; | 696 | ioaddr->bmdma_addr = mmio_base + sil_port[i].bmdma; |
695 | ioaddr->scr_addr = mmio_base + sil_port[i].scr; | 697 | ioaddr->scr_addr = mmio_base + sil_port[i].scr; |
696 | ata_std_ports(ioaddr); | 698 | ata_std_ports(ioaddr); |
699 | |||
700 | ata_port_pbar_desc(ap, SIL_MMIO_BAR, -1, "mmio"); | ||
701 | ata_port_pbar_desc(ap, SIL_MMIO_BAR, sil_port[i].tf, "tf"); | ||
697 | } | 702 | } |
698 | 703 | ||
699 | /* initialize and activate */ | 704 | /* initialize and activate */ |