aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci.c14
-rw-r--r--drivers/ata/sata_fsl.c60
-rw-r--r--drivers/ata/sata_sil24.c17
3 files changed, 8 insertions, 83 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index ad5b6f384ba1..9642a7103cb6 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -247,7 +247,6 @@ static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc);
247static int ahci_port_start(struct ata_port *ap); 247static int ahci_port_start(struct ata_port *ap);
248static void ahci_port_stop(struct ata_port *ap); 248static void ahci_port_stop(struct ata_port *ap);
249static void ahci_qc_prep(struct ata_queued_cmd *qc); 249static void ahci_qc_prep(struct ata_queued_cmd *qc);
250static u8 ahci_check_status(struct ata_port *ap);
251static void ahci_freeze(struct ata_port *ap); 250static void ahci_freeze(struct ata_port *ap);
252static void ahci_thaw(struct ata_port *ap); 251static void ahci_thaw(struct ata_port *ap);
253static void ahci_pmp_attach(struct ata_port *ap); 252static void ahci_pmp_attach(struct ata_port *ap);
@@ -292,9 +291,6 @@ static struct scsi_host_template ahci_sht = {
292static struct ata_port_operations ahci_ops = { 291static struct ata_port_operations ahci_ops = {
293 .inherits = &sata_pmp_port_ops, 292 .inherits = &sata_pmp_port_ops,
294 293
295 .sff_check_status = ahci_check_status,
296 .sff_check_altstatus = ahci_check_status,
297
298 .qc_defer = sata_pmp_qc_defer_cmd_switch, 294 .qc_defer = sata_pmp_qc_defer_cmd_switch,
299 .qc_prep = ahci_qc_prep, 295 .qc_prep = ahci_qc_prep,
300 .qc_issue = ahci_qc_issue, 296 .qc_issue = ahci_qc_issue,
@@ -1185,11 +1181,12 @@ static int ahci_kick_engine(struct ata_port *ap, int force_restart)
1185{ 1181{
1186 void __iomem *port_mmio = ap->ioaddr.cmd_addr; 1182 void __iomem *port_mmio = ap->ioaddr.cmd_addr;
1187 struct ahci_host_priv *hpriv = ap->host->private_data; 1183 struct ahci_host_priv *hpriv = ap->host->private_data;
1184 u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
1188 u32 tmp; 1185 u32 tmp;
1189 int busy, rc; 1186 int busy, rc;
1190 1187
1191 /* do we need to kick the port? */ 1188 /* do we need to kick the port? */
1192 busy = ahci_check_status(ap) & (ATA_BUSY | ATA_DRQ); 1189 busy = status & (ATA_BUSY | ATA_DRQ);
1193 if (!busy && !force_restart) 1190 if (!busy && !force_restart)
1194 return 0; 1191 return 0;
1195 1192
@@ -1466,13 +1463,6 @@ static int ahci_pmp_softreset(struct ata_link *link, unsigned int *class,
1466 return ahci_do_softreset(link, class, link->pmp, deadline); 1463 return ahci_do_softreset(link, class, link->pmp, deadline);
1467} 1464}
1468 1465
1469static u8 ahci_check_status(struct ata_port *ap)
1470{
1471 void __iomem *mmio = ap->ioaddr.cmd_addr;
1472
1473 return readl(mmio + PORT_TFDATA) & 0xFF;
1474}
1475
1476static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl) 1466static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl)
1477{ 1467{
1478 struct scatterlist *sg; 1468 struct scatterlist *sg;
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index e880b7ec060f..0cb0a57ddb36 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -244,17 +244,6 @@ struct sata_fsl_port_priv {
244 dma_addr_t cmdslot_paddr; 244 dma_addr_t cmdslot_paddr;
245 struct command_desc *cmdentry; 245 struct command_desc *cmdentry;
246 dma_addr_t cmdentry_paddr; 246 dma_addr_t cmdentry_paddr;
247
248 /*
249 * SATA FSL controller has a Status FIS which should contain the
250 * received D2H FIS & taskfile registers. This SFIS is present in
251 * the command descriptor, and to have a ready reference to it,
252 * we are caching it here, quite similar to what is done in H/W on
253 * AHCI compliant devices by copying taskfile fields to a 32-bit
254 * register.
255 */
256
257 struct ata_taskfile tf;
258}; 247};
259 248
260/* 249/*
@@ -569,31 +558,6 @@ static void sata_fsl_thaw(struct ata_port *ap)
569 ioread32(hcr_base + HCONTROL), ioread32(hcr_base + HSTATUS)); 558 ioread32(hcr_base + HCONTROL), ioread32(hcr_base + HSTATUS));
570} 559}
571 560
572/*
573 * NOTE : 1st D2H FIS from device does not update sfis in command descriptor.
574 */
575static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd
576 *qc,
577 struct ata_port *ap)
578{
579 struct sata_fsl_port_priv *pp = ap->private_data;
580 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
581 void __iomem *hcr_base = host_priv->hcr_base;
582 unsigned int tag = sata_fsl_tag(qc->tag, hcr_base);
583 struct command_desc *cd;
584
585 cd = pp->cmdentry + tag;
586
587 ata_tf_from_fis(cd->sfis, &pp->tf);
588}
589
590static u8 sata_fsl_check_status(struct ata_port *ap)
591{
592 struct sata_fsl_port_priv *pp = ap->private_data;
593
594 return pp->tf.command;
595}
596
597static int sata_fsl_port_start(struct ata_port *ap) 561static int sata_fsl_port_start(struct ata_port *ap)
598{ 562{
599 struct device *dev = ap->host->dev; 563 struct device *dev = ap->host->dev;
@@ -1004,10 +968,9 @@ static void sata_fsl_error_intr(struct ata_port *ap)
1004 /* record error info */ 968 /* record error info */
1005 qc = ata_qc_from_tag(ap, link->active_tag); 969 qc = ata_qc_from_tag(ap, link->active_tag);
1006 970
1007 if (qc) { 971 if (qc)
1008 sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap);
1009 qc->err_mask |= err_mask; 972 qc->err_mask |= err_mask;
1010 } else 973 else
1011 ehi->err_mask |= err_mask; 974 ehi->err_mask |= err_mask;
1012 975
1013 ehi->action |= action; 976 ehi->action |= action;
@@ -1020,14 +983,6 @@ static void sata_fsl_error_intr(struct ata_port *ap)
1020 ata_port_abort(ap); 983 ata_port_abort(ap);
1021} 984}
1022 985
1023static void sata_fsl_qc_complete(struct ata_queued_cmd *qc)
1024{
1025 if (qc->flags & ATA_QCFLAG_RESULT_TF) {
1026 DPRINTK("xx_qc_complete called\n");
1027 sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap);
1028 }
1029}
1030
1031static void sata_fsl_host_intr(struct ata_port *ap) 986static void sata_fsl_host_intr(struct ata_port *ap)
1032{ 987{
1033 struct ata_link *link = &ap->link; 988 struct ata_link *link = &ap->link;
@@ -1068,10 +1023,8 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1068 for (i = 0; i < SATA_FSL_QUEUE_DEPTH; i++) { 1023 for (i = 0; i < SATA_FSL_QUEUE_DEPTH; i++) {
1069 if (qc_active & (1 << i)) { 1024 if (qc_active & (1 << i)) {
1070 qc = ata_qc_from_tag(ap, i); 1025 qc = ata_qc_from_tag(ap, i);
1071 if (qc) { 1026 if (qc)
1072 sata_fsl_qc_complete(qc);
1073 ata_qc_complete(qc); 1027 ata_qc_complete(qc);
1074 }
1075 DPRINTK 1028 DPRINTK
1076 ("completing ncq cmd,tag=%d,CC=0x%x,CA=0x%x\n", 1029 ("completing ncq cmd,tag=%d,CC=0x%x,CA=0x%x\n",
1077 i, ioread32(hcr_base + CC), 1030 i, ioread32(hcr_base + CC),
@@ -1087,10 +1040,8 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1087 DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n", 1040 DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n",
1088 link->active_tag, ioread32(hcr_base + CC)); 1041 link->active_tag, ioread32(hcr_base + CC));
1089 1042
1090 if (qc) { 1043 if (qc)
1091 sata_fsl_qc_complete(qc);
1092 ata_qc_complete(qc); 1044 ata_qc_complete(qc);
1093 }
1094 } else { 1045 } else {
1095 /* Spurious Interrupt!! */ 1046 /* Spurious Interrupt!! */
1096 DPRINTK("spurious interrupt!!, CC = 0x%x\n", 1047 DPRINTK("spurious interrupt!!, CC = 0x%x\n",
@@ -1197,9 +1148,6 @@ static struct scsi_host_template sata_fsl_sht = {
1197static const struct ata_port_operations sata_fsl_ops = { 1148static const struct ata_port_operations sata_fsl_ops = {
1198 .inherits = &sata_port_ops, 1149 .inherits = &sata_port_ops,
1199 1150
1200 .sff_check_status = sata_fsl_check_status,
1201 .sff_check_altstatus = sata_fsl_check_status,
1202
1203 .qc_prep = sata_fsl_qc_prep, 1151 .qc_prep = sata_fsl_qc_prep,
1204 .qc_issue = sata_fsl_qc_issue, 1152 .qc_issue = sata_fsl_qc_issue,
1205 .qc_fill_rtf = sata_fsl_qc_fill_rtf, 1153 .qc_fill_rtf = sata_fsl_qc_fill_rtf,
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 51a7c06803df..15a4067149b7 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -336,12 +336,10 @@ static struct sil24_cerr_info {
336struct sil24_port_priv { 336struct sil24_port_priv {
337 union sil24_cmd_block *cmd_block; /* 32 cmd blocks */ 337 union sil24_cmd_block *cmd_block; /* 32 cmd blocks */
338 dma_addr_t cmd_block_dma; /* DMA base addr for them */ 338 dma_addr_t cmd_block_dma; /* DMA base addr for them */
339 struct ata_taskfile tf; /* Cached taskfile registers */
340 int do_port_rst; 339 int do_port_rst;
341}; 340};
342 341
343static void sil24_dev_config(struct ata_device *dev); 342static void sil24_dev_config(struct ata_device *dev);
344static u8 sil24_check_status(struct ata_port *ap);
345static int sil24_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val); 343static int sil24_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val);
346static int sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); 344static int sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val);
347static int sil24_qc_defer(struct ata_queued_cmd *qc); 345static int sil24_qc_defer(struct ata_queued_cmd *qc);
@@ -401,8 +399,6 @@ static struct scsi_host_template sil24_sht = {
401static struct ata_port_operations sil24_ops = { 399static struct ata_port_operations sil24_ops = {
402 .inherits = &sata_pmp_port_ops, 400 .inherits = &sata_pmp_port_ops,
403 401
404 .sff_check_status = sil24_check_status,
405 .sff_check_altstatus = sil24_check_status,
406 .qc_defer = sil24_qc_defer, 402 .qc_defer = sil24_qc_defer,
407 .qc_prep = sil24_qc_prep, 403 .qc_prep = sil24_qc_prep,
408 .qc_issue = sil24_qc_issue, 404 .qc_issue = sil24_qc_issue,
@@ -492,12 +488,6 @@ static void sil24_read_tf(struct ata_port *ap, int tag, struct ata_taskfile *tf)
492 ata_tf_from_fis(fis, tf); 488 ata_tf_from_fis(fis, tf);
493} 489}
494 490
495static u8 sil24_check_status(struct ata_port *ap)
496{
497 struct sil24_port_priv *pp = ap->private_data;
498 return pp->tf.command;
499}
500
501static int sil24_scr_map[] = { 491static int sil24_scr_map[] = {
502 [SCR_CONTROL] = 0, 492 [SCR_CONTROL] = 0,
503 [SCR_STATUS] = 1, 493 [SCR_STATUS] = 1,
@@ -1074,10 +1064,9 @@ static void sil24_error_intr(struct ata_port *ap)
1074 } 1064 }
1075 1065
1076 /* record error info */ 1066 /* record error info */
1077 if (qc) { 1067 if (qc)
1078 sil24_read_tf(ap, qc->tag, &pp->tf);
1079 qc->err_mask |= err_mask; 1068 qc->err_mask |= err_mask;
1080 } else 1069 else
1081 ehi->err_mask |= err_mask; 1070 ehi->err_mask |= err_mask;
1082 1071
1083 ehi->action |= action; 1072 ehi->action |= action;
@@ -1210,8 +1199,6 @@ static int sil24_port_start(struct ata_port *ap)
1210 if (!pp) 1199 if (!pp)
1211 return -ENOMEM; 1200 return -ENOMEM;
1212 1201
1213 pp->tf.command = ATA_DRDY;
1214
1215 cb = dmam_alloc_coherent(dev, cb_size, &cb_dma, GFP_KERNEL); 1202 cb = dmam_alloc_coherent(dev, cb_size, &cb_dma, GFP_KERNEL);
1216 if (!cb) 1203 if (!cb)
1217 return -ENOMEM; 1204 return -ENOMEM;