diff options
author | Tejun Heo <htejun@gmail.com> | 2008-04-07 09:47:18 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-04-17 15:44:22 -0400 |
commit | 203c75b8245c5386044721d9c5eda5c6b71b3d14 (patch) | |
tree | 5a8c446c483a77dc86aca145b0b38c4a2b410dfa /drivers/ata | |
parent | 0aa1113d544226bc2c4a20d6ac1d71170512a361 (diff) |
libata: separate out ata_std_postreset() from ata_sff_postreset()
Separate out generic ATA portion from ata_sff_postreset() into
ata_std_postreset() and implement ata_sff_postreset() using the std
version.
ata_base_port_ops now has ata_std_postreset() for its postreset and
ata_sff_port_ops overrides it to ata_sff_postreset().
This change affects pdc_adma, ahci, sata_fsl and sata_sil24. pdc_adma
now specifies postreset to ata_sff_postreset() explicitly. sata_fsl
and sata_sil24 now use ata_std_postreset() which makes no difference
to them. ahci now calls ata_std_postreset() from its own postreset
method, which causes no behavior difference.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/ahci.c | 2 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 24 | ||||
-rw-r--r-- | drivers/ata/libata-sff.c | 36 |
3 files changed, 41 insertions, 21 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index c5e4501daa74..939dc1d4e50d 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1444,7 +1444,7 @@ static void ahci_postreset(struct ata_link *link, unsigned int *class) | |||
1444 | void __iomem *port_mmio = ahci_port_base(ap); | 1444 | void __iomem *port_mmio = ahci_port_base(ap); |
1445 | u32 new_tmp, tmp; | 1445 | u32 new_tmp, tmp; |
1446 | 1446 | ||
1447 | ata_sff_postreset(link, class); | 1447 | ata_std_postreset(link, class); |
1448 | 1448 | ||
1449 | /* Make sure port's ATAPI bit is set appropriately */ | 1449 | /* Make sure port's ATAPI bit is set appropriately */ |
1450 | new_tmp = tmp = readl(port_mmio + PORT_CMD); | 1450 | new_tmp = tmp = readl(port_mmio + PORT_CMD); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 5f771bb44332..eaead76c9443 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -76,7 +76,7 @@ const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 }; | |||
76 | const struct ata_port_operations ata_base_port_ops = { | 76 | const struct ata_port_operations ata_base_port_ops = { |
77 | .prereset = ata_std_prereset, | 77 | .prereset = ata_std_prereset, |
78 | .hardreset = sata_sff_hardreset, | 78 | .hardreset = sata_sff_hardreset, |
79 | .postreset = ata_sff_postreset, | 79 | .postreset = ata_std_postreset, |
80 | .error_handler = ata_std_error_handler, | 80 | .error_handler = ata_std_error_handler, |
81 | }; | 81 | }; |
82 | 82 | ||
@@ -3516,7 +3516,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, | |||
3516 | } | 3516 | } |
3517 | 3517 | ||
3518 | /** | 3518 | /** |
3519 | * ata_sff_postreset - standard postreset callback | 3519 | * ata_std_postreset - standard postreset callback |
3520 | * @link: the target ata_link | 3520 | * @link: the target ata_link |
3521 | * @classes: classes of attached devices | 3521 | * @classes: classes of attached devices |
3522 | * | 3522 | * |
@@ -3527,9 +3527,8 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, | |||
3527 | * LOCKING: | 3527 | * LOCKING: |
3528 | * Kernel thread context (may sleep) | 3528 | * Kernel thread context (may sleep) |
3529 | */ | 3529 | */ |
3530 | void ata_sff_postreset(struct ata_link *link, unsigned int *classes) | 3530 | void ata_std_postreset(struct ata_link *link, unsigned int *classes) |
3531 | { | 3531 | { |
3532 | struct ata_port *ap = link->ap; | ||
3533 | u32 serror; | 3532 | u32 serror; |
3534 | 3533 | ||
3535 | DPRINTK("ENTER\n"); | 3534 | DPRINTK("ENTER\n"); |
@@ -3542,22 +3541,6 @@ void ata_sff_postreset(struct ata_link *link, unsigned int *classes) | |||
3542 | sata_scr_write(link, SCR_ERROR, serror); | 3541 | sata_scr_write(link, SCR_ERROR, serror); |
3543 | link->eh_info.serror = 0; | 3542 | link->eh_info.serror = 0; |
3544 | 3543 | ||
3545 | /* is double-select really necessary? */ | ||
3546 | if (classes[0] != ATA_DEV_NONE) | ||
3547 | ap->ops->sff_dev_select(ap, 1); | ||
3548 | if (classes[1] != ATA_DEV_NONE) | ||
3549 | ap->ops->sff_dev_select(ap, 0); | ||
3550 | |||
3551 | /* bail out if no device is present */ | ||
3552 | if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) { | ||
3553 | DPRINTK("EXIT, no device\n"); | ||
3554 | return; | ||
3555 | } | ||
3556 | |||
3557 | /* set up device control */ | ||
3558 | if (ap->ioaddr.ctl_addr) | ||
3559 | iowrite8(ap->ctl, ap->ioaddr.ctl_addr); | ||
3560 | |||
3561 | DPRINTK("EXIT\n"); | 3544 | DPRINTK("EXIT\n"); |
3562 | } | 3545 | } |
3563 | 3546 | ||
@@ -6096,6 +6079,7 @@ EXPORT_SYMBOL_GPL(sata_link_debounce); | |||
6096 | EXPORT_SYMBOL_GPL(sata_link_resume); | 6079 | EXPORT_SYMBOL_GPL(sata_link_resume); |
6097 | EXPORT_SYMBOL_GPL(ata_std_prereset); | 6080 | EXPORT_SYMBOL_GPL(ata_std_prereset); |
6098 | EXPORT_SYMBOL_GPL(sata_link_hardreset); | 6081 | EXPORT_SYMBOL_GPL(sata_link_hardreset); |
6082 | EXPORT_SYMBOL_GPL(ata_std_postreset); | ||
6099 | EXPORT_SYMBOL_GPL(ata_dev_classify); | 6083 | EXPORT_SYMBOL_GPL(ata_dev_classify); |
6100 | EXPORT_SYMBOL_GPL(ata_dev_pair); | 6084 | EXPORT_SYMBOL_GPL(ata_dev_pair); |
6101 | EXPORT_SYMBOL_GPL(ata_port_disable); | 6085 | EXPORT_SYMBOL_GPL(ata_port_disable); |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 9234bc047956..e530baccc9cb 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -49,6 +49,7 @@ const struct ata_port_operations ata_sff_port_ops = { | |||
49 | .thaw = ata_sff_thaw, | 49 | .thaw = ata_sff_thaw, |
50 | .prereset = ata_sff_prereset, | 50 | .prereset = ata_sff_prereset, |
51 | .softreset = ata_sff_softreset, | 51 | .softreset = ata_sff_softreset, |
52 | .postreset = ata_sff_postreset, | ||
52 | .error_handler = ata_sff_error_handler, | 53 | .error_handler = ata_sff_error_handler, |
53 | .post_internal_cmd = ata_sff_post_internal_cmd, | 54 | .post_internal_cmd = ata_sff_post_internal_cmd, |
54 | 55 | ||
@@ -2032,6 +2033,41 @@ int sata_sff_hardreset(struct ata_link *link, unsigned int *class, | |||
2032 | } | 2033 | } |
2033 | 2034 | ||
2034 | /** | 2035 | /** |
2036 | * ata_sff_postreset - SFF postreset callback | ||
2037 | * @link: the target SFF ata_link | ||
2038 | * @classes: classes of attached devices | ||
2039 | * | ||
2040 | * This function is invoked after a successful reset. It first | ||
2041 | * calls ata_std_postreset() and performs SFF specific postreset | ||
2042 | * processing. | ||
2043 | * | ||
2044 | * LOCKING: | ||
2045 | * Kernel thread context (may sleep) | ||
2046 | */ | ||
2047 | void ata_sff_postreset(struct ata_link *link, unsigned int *classes) | ||
2048 | { | ||
2049 | struct ata_port *ap = link->ap; | ||
2050 | |||
2051 | ata_std_postreset(link, classes); | ||
2052 | |||
2053 | /* is double-select really necessary? */ | ||
2054 | if (classes[0] != ATA_DEV_NONE) | ||
2055 | ap->ops->sff_dev_select(ap, 1); | ||
2056 | if (classes[1] != ATA_DEV_NONE) | ||
2057 | ap->ops->sff_dev_select(ap, 0); | ||
2058 | |||
2059 | /* bail out if no device is present */ | ||
2060 | if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) { | ||
2061 | DPRINTK("EXIT, no device\n"); | ||
2062 | return; | ||
2063 | } | ||
2064 | |||
2065 | /* set up device control */ | ||
2066 | if (ap->ioaddr.ctl_addr) | ||
2067 | iowrite8(ap->ctl, ap->ioaddr.ctl_addr); | ||
2068 | } | ||
2069 | |||
2070 | /** | ||
2035 | * ata_sff_error_handler - Stock error handler for BMDMA controller | 2071 | * ata_sff_error_handler - Stock error handler for BMDMA controller |
2036 | * @ap: port to handle error for | 2072 | * @ap: port to handle error for |
2037 | * | 2073 | * |