diff options
Diffstat (limited to 'drivers/ata/libata-sff.c')
-rw-r--r-- | drivers/ata/libata-sff.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index b31389605bee..31b495fcd969 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -446,6 +446,27 @@ int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline) | |||
446 | EXPORT_SYMBOL_GPL(ata_sff_wait_ready); | 446 | EXPORT_SYMBOL_GPL(ata_sff_wait_ready); |
447 | 447 | ||
448 | /** | 448 | /** |
449 | * ata_sff_set_devctl - Write device control reg | ||
450 | * @ap: port where the device is | ||
451 | * @ctl: value to write | ||
452 | * | ||
453 | * Writes ATA taskfile device control register. | ||
454 | * | ||
455 | * Note: may NOT be used as the sff_set_devctl() entry in | ||
456 | * ata_port_operations. | ||
457 | * | ||
458 | * LOCKING: | ||
459 | * Inherited from caller. | ||
460 | */ | ||
461 | static void ata_sff_set_devctl(struct ata_port *ap, u8 ctl) | ||
462 | { | ||
463 | if (ap->ops->sff_set_devctl) | ||
464 | ap->ops->sff_set_devctl(ap, ctl); | ||
465 | else | ||
466 | iowrite8(ctl, ap->ioaddr.ctl_addr); | ||
467 | } | ||
468 | |||
469 | /** | ||
449 | * ata_sff_dev_select - Select device 0/1 on ATA bus | 470 | * ata_sff_dev_select - Select device 0/1 on ATA bus |
450 | * @ap: ATA channel to manipulate | 471 | * @ap: ATA channel to manipulate |
451 | * @device: ATA device (numbered from zero) to select | 472 | * @device: ATA device (numbered from zero) to select |
@@ -1895,13 +1916,11 @@ EXPORT_SYMBOL_GPL(ata_sff_lost_interrupt); | |||
1895 | */ | 1916 | */ |
1896 | void ata_sff_freeze(struct ata_port *ap) | 1917 | void ata_sff_freeze(struct ata_port *ap) |
1897 | { | 1918 | { |
1898 | struct ata_ioports *ioaddr = &ap->ioaddr; | ||
1899 | |||
1900 | ap->ctl |= ATA_NIEN; | 1919 | ap->ctl |= ATA_NIEN; |
1901 | ap->last_ctl = ap->ctl; | 1920 | ap->last_ctl = ap->ctl; |
1902 | 1921 | ||
1903 | if (ioaddr->ctl_addr) | 1922 | if (ap->ops->sff_set_devctl || ap->ioaddr.ctl_addr) |
1904 | iowrite8(ap->ctl, ioaddr->ctl_addr); | 1923 | ata_sff_set_devctl(ap, ap->ctl); |
1905 | 1924 | ||
1906 | /* Under certain circumstances, some controllers raise IRQ on | 1925 | /* Under certain circumstances, some controllers raise IRQ on |
1907 | * ATA_NIEN manipulation. Also, many controllers fail to mask | 1926 | * ATA_NIEN manipulation. Also, many controllers fail to mask |
@@ -2301,8 +2320,8 @@ void ata_sff_postreset(struct ata_link *link, unsigned int *classes) | |||
2301 | } | 2320 | } |
2302 | 2321 | ||
2303 | /* set up device control */ | 2322 | /* set up device control */ |
2304 | if (ap->ioaddr.ctl_addr) { | 2323 | if (ap->ops->sff_set_devctl || ap->ioaddr.ctl_addr) { |
2305 | iowrite8(ap->ctl, ap->ioaddr.ctl_addr); | 2324 | ata_sff_set_devctl(ap, ap->ctl); |
2306 | ap->last_ctl = ap->ctl; | 2325 | ap->last_ctl = ap->ctl; |
2307 | } | 2326 | } |
2308 | } | 2327 | } |