diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/libata-sff.c | 31 | ||||
-rw-r--r-- | drivers/ata/pata_bf54x.c | 40 | ||||
-rw-r--r-- | drivers/ata/pata_scc.c | 38 |
3 files changed, 50 insertions, 59 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 | } |
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c index 02c81f12c702..198307534d90 100644 --- a/drivers/ata/pata_bf54x.c +++ b/drivers/ata/pata_bf54x.c | |||
@@ -821,6 +821,18 @@ static void bfin_dev_select(struct ata_port *ap, unsigned int device) | |||
821 | } | 821 | } |
822 | 822 | ||
823 | /** | 823 | /** |
824 | * bfin_set_devctl - Write device control reg | ||
825 | * @ap: port where the device is | ||
826 | * @ctl: value to write | ||
827 | */ | ||
828 | |||
829 | static u8 bfin_set_devctl(struct ata_port *ap, u8 ctl) | ||
830 | { | ||
831 | void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; | ||
832 | write_atapi_register(base, ATA_REG_CTRL, ctl); | ||
833 | } | ||
834 | |||
835 | /** | ||
824 | * bfin_bmdma_setup - Set up IDE DMA transaction | 836 | * bfin_bmdma_setup - Set up IDE DMA transaction |
825 | * @qc: Info associated with this ATA transaction. | 837 | * @qc: Info associated with this ATA transaction. |
826 | * | 838 | * |
@@ -1240,32 +1252,6 @@ static unsigned char bfin_irq_on(struct ata_port *ap) | |||
1240 | } | 1252 | } |
1241 | 1253 | ||
1242 | /** | 1254 | /** |
1243 | * bfin_freeze - Freeze DMA controller port | ||
1244 | * @ap: port to freeze | ||
1245 | * | ||
1246 | * Note: Original code is ata_sff_freeze(). | ||
1247 | */ | ||
1248 | |||
1249 | static void bfin_freeze(struct ata_port *ap) | ||
1250 | { | ||
1251 | void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; | ||
1252 | |||
1253 | dev_dbg(ap->dev, "in atapi dma freeze\n"); | ||
1254 | ap->ctl |= ATA_NIEN; | ||
1255 | ap->last_ctl = ap->ctl; | ||
1256 | |||
1257 | write_atapi_register(base, ATA_REG_CTRL, ap->ctl); | ||
1258 | |||
1259 | /* Under certain circumstances, some controllers raise IRQ on | ||
1260 | * ATA_NIEN manipulation. Also, many controllers fail to mask | ||
1261 | * previously pending IRQ on ATA_NIEN assertion. Clear it. | ||
1262 | */ | ||
1263 | ap->ops->sff_check_status(ap); | ||
1264 | |||
1265 | bfin_irq_clear(ap); | ||
1266 | } | ||
1267 | |||
1268 | /** | ||
1269 | * bfin_thaw - Thaw DMA controller port | 1255 | * bfin_thaw - Thaw DMA controller port |
1270 | * @ap: port to thaw | 1256 | * @ap: port to thaw |
1271 | * | 1257 | * |
@@ -1476,6 +1462,7 @@ static struct ata_port_operations bfin_pata_ops = { | |||
1476 | .sff_check_status = bfin_check_status, | 1462 | .sff_check_status = bfin_check_status, |
1477 | .sff_check_altstatus = bfin_check_altstatus, | 1463 | .sff_check_altstatus = bfin_check_altstatus, |
1478 | .sff_dev_select = bfin_dev_select, | 1464 | .sff_dev_select = bfin_dev_select, |
1465 | .sff_set_devctl = bfin_set_devctl, | ||
1479 | 1466 | ||
1480 | .bmdma_setup = bfin_bmdma_setup, | 1467 | .bmdma_setup = bfin_bmdma_setup, |
1481 | .bmdma_start = bfin_bmdma_start, | 1468 | .bmdma_start = bfin_bmdma_start, |
@@ -1485,7 +1472,6 @@ static struct ata_port_operations bfin_pata_ops = { | |||
1485 | 1472 | ||
1486 | .qc_prep = ata_noop_qc_prep, | 1473 | .qc_prep = ata_noop_qc_prep, |
1487 | 1474 | ||
1488 | .freeze = bfin_freeze, | ||
1489 | .thaw = bfin_thaw, | 1475 | .thaw = bfin_thaw, |
1490 | .softreset = bfin_softreset, | 1476 | .softreset = bfin_softreset, |
1491 | .postreset = bfin_postreset, | 1477 | .postreset = bfin_postreset, |
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, |