diff options
Diffstat (limited to 'drivers/ata/pata_via.c')
| -rw-r--r-- | drivers/ata/pata_via.c | 59 |
1 files changed, 11 insertions, 48 deletions
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 57d951b11f2d..8fdb2ce73210 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
| @@ -324,62 +324,26 @@ static void via_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | /** | 326 | /** |
| 327 | * via_ata_sff_tf_load - send taskfile registers to host controller | 327 | * via_tf_load - send taskfile registers to host controller |
| 328 | * @ap: Port to which output is sent | 328 | * @ap: Port to which output is sent |
| 329 | * @tf: ATA taskfile register set | 329 | * @tf: ATA taskfile register set |
| 330 | * | 330 | * |
| 331 | * Outputs ATA taskfile to standard ATA host controller. | 331 | * Outputs ATA taskfile to standard ATA host controller. |
| 332 | * | 332 | * |
| 333 | * Note: This is to fix the internal bug of via chipsets, which | 333 | * Note: This is to fix the internal bug of via chipsets, which |
| 334 | * will reset the device register after changing the IEN bit on | 334 | * will reset the device register after changing the IEN bit on |
| 335 | * ctl register | 335 | * ctl register |
| 336 | */ | 336 | */ |
| 337 | static void via_ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | 337 | static void via_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) |
| 338 | { | 338 | { |
| 339 | struct ata_ioports *ioaddr = &ap->ioaddr; | 339 | struct ata_taskfile tmp_tf; |
| 340 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; | ||
| 341 | |||
| 342 | if (tf->ctl != ap->last_ctl) { | ||
| 343 | iowrite8(tf->ctl, ioaddr->ctl_addr); | ||
| 344 | iowrite8(tf->device, ioaddr->device_addr); | ||
| 345 | ap->last_ctl = tf->ctl; | ||
| 346 | ata_wait_idle(ap); | ||
| 347 | } | ||
| 348 | |||
| 349 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { | ||
| 350 | iowrite8(tf->hob_feature, ioaddr->feature_addr); | ||
| 351 | iowrite8(tf->hob_nsect, ioaddr->nsect_addr); | ||
| 352 | iowrite8(tf->hob_lbal, ioaddr->lbal_addr); | ||
| 353 | iowrite8(tf->hob_lbam, ioaddr->lbam_addr); | ||
| 354 | iowrite8(tf->hob_lbah, ioaddr->lbah_addr); | ||
| 355 | VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n", | ||
| 356 | tf->hob_feature, | ||
| 357 | tf->hob_nsect, | ||
| 358 | tf->hob_lbal, | ||
| 359 | tf->hob_lbam, | ||
| 360 | tf->hob_lbah); | ||
| 361 | } | ||
| 362 | 340 | ||
| 363 | if (is_addr) { | 341 | if (ap->ctl != ap->last_ctl && !(tf->flags & ATA_TFLAG_DEVICE)) { |
| 364 | iowrite8(tf->feature, ioaddr->feature_addr); | 342 | tmp_tf = *tf; |
| 365 | iowrite8(tf->nsect, ioaddr->nsect_addr); | 343 | tmp_tf.flags |= ATA_TFLAG_DEVICE; |
| 366 | iowrite8(tf->lbal, ioaddr->lbal_addr); | 344 | tf = &tmp_tf; |
| 367 | iowrite8(tf->lbam, ioaddr->lbam_addr); | ||
| 368 | iowrite8(tf->lbah, ioaddr->lbah_addr); | ||
| 369 | VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", | ||
| 370 | tf->feature, | ||
| 371 | tf->nsect, | ||
| 372 | tf->lbal, | ||
| 373 | tf->lbam, | ||
| 374 | tf->lbah); | ||
| 375 | } | 345 | } |
| 376 | 346 | ata_sff_tf_load(ap, tf); | |
| 377 | if (tf->flags & ATA_TFLAG_DEVICE) { | ||
| 378 | iowrite8(tf->device, ioaddr->device_addr); | ||
| 379 | VPRINTK("device 0x%X\n", tf->device); | ||
| 380 | } | ||
| 381 | |||
| 382 | ata_wait_idle(ap); | ||
| 383 | } | 347 | } |
| 384 | 348 | ||
| 385 | static struct scsi_host_template via_sht = { | 349 | static struct scsi_host_template via_sht = { |
| @@ -392,13 +356,12 @@ static struct ata_port_operations via_port_ops = { | |||
| 392 | .set_piomode = via_set_piomode, | 356 | .set_piomode = via_set_piomode, |
| 393 | .set_dmamode = via_set_dmamode, | 357 | .set_dmamode = via_set_dmamode, |
| 394 | .prereset = via_pre_reset, | 358 | .prereset = via_pre_reset, |
| 395 | .sff_tf_load = via_ata_tf_load, | 359 | .sff_tf_load = via_tf_load, |
| 396 | }; | 360 | }; |
| 397 | 361 | ||
| 398 | static struct ata_port_operations via_port_ops_noirq = { | 362 | static struct ata_port_operations via_port_ops_noirq = { |
| 399 | .inherits = &via_port_ops, | 363 | .inherits = &via_port_ops, |
| 400 | .sff_data_xfer = ata_sff_data_xfer_noirq, | 364 | .sff_data_xfer = ata_sff_data_xfer_noirq, |
| 401 | .sff_tf_load = via_ata_tf_load, | ||
| 402 | }; | 365 | }; |
| 403 | 366 | ||
| 404 | /** | 367 | /** |
