aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_bf54x.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2010-05-07 14:47:50 -0400
committerJeff Garzik <jgarzik@redhat.com>2010-05-14 17:35:52 -0400
commit41dec29bcb05eb8ec396f70ce791c6e3e4ce4712 (patch)
treee76f63519031769e848dcc6eba63c9207cf4d84e /drivers/ata/pata_bf54x.c
parent55787183ade44c4f826f581a068f52a1a80c6a2e (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_bf54x.c')
-rw-r--r--drivers/ata/pata_bf54x.c40
1 files changed, 13 insertions, 27 deletions
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
829static 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
1249static 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,