diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2010-05-07 14:47:50 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2010-05-14 17:35:52 -0400 |
commit | 41dec29bcb05eb8ec396f70ce791c6e3e4ce4712 (patch) | |
tree | e76f63519031769e848dcc6eba63c9207cf4d84e /drivers/ata/pata_scc.c | |
parent | 55787183ade44c4f826f581a068f52a1a80c6a2e (diff) |
libata: introduce sff_set_devctl() method
The set of libata's taskfile access methods is clearly incomplete as
it lacks a method to write to the device control register -- which
forces drivers like 'pata_bf54x' and 'pata_scc' to implement more
"high level" (and more weighty) methods like freeze() and postreset().
So, introduce the optional sff_set_devctl() method which the drivers
only have to implement if the standard iowrite8() can't be used (just
like the existing sff_check_altstatus() method) and make use of it
in the freeze() and postreset() method implementations (I could also
have used it in softreset() method but it also reads other taskfile
registers without using tf_read() making that quite pointless);
this makes freeze() method implementations in the 'pata_bf54x' and
'pata_scc' methods virtually identical to ata_sff_freeze(), so we
can get rid of them completely.
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/pata_scc.c')
-rw-r--r-- | drivers/ata/pata_scc.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index 77ff829af176..86b25fef34a9 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -416,6 +416,17 @@ static void scc_dev_select (struct ata_port *ap, unsigned int device) | |||
416 | } | 416 | } |
417 | 417 | ||
418 | /** | 418 | /** |
419 | * scc_set_devctl - Write device control reg | ||
420 | * @ap: port where the device is | ||
421 | * @ctl: value to write | ||
422 | */ | ||
423 | |||
424 | static void scc_set_devctl(struct ata_port *ap, u8 ctl) | ||
425 | { | ||
426 | out_be32(ap->ioaddr.ctl_addr, ctl); | ||
427 | } | ||
428 | |||
429 | /** | ||
419 | * scc_bmdma_setup - Set up PCI IDE BMDMA transaction | 430 | * scc_bmdma_setup - Set up PCI IDE BMDMA transaction |
420 | * @qc: Info associated with this ATA transaction. | 431 | * @qc: Info associated with this ATA transaction. |
421 | * | 432 | * |
@@ -840,31 +851,6 @@ static u8 scc_irq_on (struct ata_port *ap) | |||
840 | } | 851 | } |
841 | 852 | ||
842 | /** | 853 | /** |
843 | * scc_freeze - Freeze BMDMA controller port | ||
844 | * @ap: port to freeze | ||
845 | * | ||
846 | * Note: Original code is ata_sff_freeze(). | ||
847 | */ | ||
848 | |||
849 | static void scc_freeze (struct ata_port *ap) | ||
850 | { | ||
851 | struct ata_ioports *ioaddr = &ap->ioaddr; | ||
852 | |||
853 | ap->ctl |= ATA_NIEN; | ||
854 | ap->last_ctl = ap->ctl; | ||
855 | |||
856 | out_be32(ioaddr->ctl_addr, ap->ctl); | ||
857 | |||
858 | /* Under certain circumstances, some controllers raise IRQ on | ||
859 | * ATA_NIEN manipulation. Also, many controllers fail to mask | ||
860 | * previously pending IRQ on ATA_NIEN assertion. Clear it. | ||
861 | */ | ||
862 | ap->ops->sff_check_status(ap); | ||
863 | |||
864 | ap->ops->sff_irq_clear(ap); | ||
865 | } | ||
866 | |||
867 | /** | ||
868 | * scc_pata_prereset - prepare for reset | 854 | * scc_pata_prereset - prepare for reset |
869 | * @ap: ATA port to be reset | 855 | * @ap: ATA port to be reset |
870 | * @deadline: deadline jiffies for the operation | 856 | * @deadline: deadline jiffies for the operation |
@@ -977,6 +963,7 @@ static struct ata_port_operations scc_pata_ops = { | |||
977 | .sff_check_status = scc_check_status, | 963 | .sff_check_status = scc_check_status, |
978 | .sff_check_altstatus = scc_check_altstatus, | 964 | .sff_check_altstatus = scc_check_altstatus, |
979 | .sff_dev_select = scc_dev_select, | 965 | .sff_dev_select = scc_dev_select, |
966 | .sff_set_devctl = scc_set_devctl, | ||
980 | 967 | ||
981 | .bmdma_setup = scc_bmdma_setup, | 968 | .bmdma_setup = scc_bmdma_setup, |
982 | .bmdma_start = scc_bmdma_start, | 969 | .bmdma_start = scc_bmdma_start, |
@@ -984,7 +971,6 @@ static struct ata_port_operations scc_pata_ops = { | |||
984 | .bmdma_status = scc_bmdma_status, | 971 | .bmdma_status = scc_bmdma_status, |
985 | .sff_data_xfer = scc_data_xfer, | 972 | .sff_data_xfer = scc_data_xfer, |
986 | 973 | ||
987 | .freeze = scc_freeze, | ||
988 | .prereset = scc_pata_prereset, | 974 | .prereset = scc_pata_prereset, |
989 | .softreset = scc_softreset, | 975 | .softreset = scc_softreset, |
990 | .postreset = scc_postreset, | 976 | .postreset = scc_postreset, |