aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-07-31 05:02:35 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-08-22 02:19:54 -0400
commitff04715bd5171d6d5c4ddff40c7bdc8d2dc90f7d (patch)
treec6c6407f2a1d42dea3c8235531f02c3492962d2f /drivers/ata
parentd127ea7b8643a93d14d1f3c542974407f14d3663 (diff)
pata_via: clean up recent tf_load changes
Commit bfce5e0179ad059035df28558724ff60af708e09 implemented custom tf_load for pata_via. This patch cleans it up a bit. * Instead of duplicating whole body, copy tf and set ATA_TFLAG_DEVICE when necessary. * Rename via_ata_tf_load() to via_tf_load(). * No need to set .tf_load in via_port_ops_noirq as it inherits from via_port_ops. * Clean up indentation. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Joseph Chan <JosephChan@via.com.tw> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/pata_via.c59
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 */
337static void via_ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) 337static 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
385static struct scsi_host_template via_sht = { 349static 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
398static struct ata_port_operations via_port_ops_noirq = { 362static 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/**