aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_fsl.c
diff options
context:
space:
mode:
authorLi Yang <leoli@freescale.com>2007-10-31 07:27:53 -0400
committerJeff Garzik <jeff@garzik.org>2007-11-03 08:46:27 -0400
commit1bf617b712380940ed357cb94b488fb262069594 (patch)
tree7e4ce1ddcffabf1fa50a1b41d6edb4318a339e64 /drivers/ata/sata_fsl.c
parent74521c28e550c4ec265cda14114bd9b908e9de34 (diff)
ata/sata_fsl: Update for ata_link introduction
Update the driver to use the newly added ata_link structure. Signed-off-by: Li Yang <leoli@freescale.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_fsl.c')
-rw-r--r--drivers/ata/sata_fsl.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index b4c37b9e413c..8a8ce9dbe034 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -34,7 +34,8 @@ enum {
34 34
35 SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 35 SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
36 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | 36 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
37 ATA_FLAG_NCQ | ATA_FLAG_SKIP_D2H_BSY), 37 ATA_FLAG_NCQ),
38 SATA_FSL_HOST_LFLAGS = ATA_LFLAG_SKIP_D2H_BSY,
38 39
39 SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, 40 SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH,
40 SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ 41 SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */
@@ -728,9 +729,10 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap)
728 return ata_dev_classify(&tf); 729 return ata_dev_classify(&tf);
729} 730}
730 731
731static int sata_fsl_softreset(struct ata_port *ap, unsigned int *class, 732static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
732 unsigned long deadline) 733 unsigned long deadline)
733{ 734{
735 struct ata_port *ap = link->ap;
734 struct sata_fsl_port_priv *pp = ap->private_data; 736 struct sata_fsl_port_priv *pp = ap->private_data;
735 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 737 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
736 void __iomem *hcr_base = host_priv->hcr_base; 738 void __iomem *hcr_base = host_priv->hcr_base;
@@ -811,7 +813,7 @@ try_offline_again:
811 */ 813 */
812 814
813 temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500); 815 temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500);
814 if ((!(temp & 0x10)) || ata_port_offline(ap)) { 816 if ((!(temp & 0x10)) || ata_link_offline(link)) {
815 ata_port_printk(ap, KERN_WARNING, 817 ata_port_printk(ap, KERN_WARNING,
816 "No Device OR PHYRDY change,Hstatus = 0x%x\n", 818 "No Device OR PHYRDY change,Hstatus = 0x%x\n",
817 ioread32(hcr_base + HSTATUS)); 819 ioread32(hcr_base + HSTATUS));
@@ -842,12 +844,12 @@ try_offline_again:
842 * reached here, we can send a command to the target device 844 * reached here, we can send a command to the target device
843 */ 845 */
844 846
845 if (ap->sactive) 847 if (link->sactive)
846 goto skip_srst_do_ncq_error_handling; 848 goto skip_srst_do_ncq_error_handling;
847 849
848 DPRINTK("Sending SRST/device reset\n"); 850 DPRINTK("Sending SRST/device reset\n");
849 851
850 ata_tf_init(ap->device, &tf); 852 ata_tf_init(link->device, &tf);
851 cfis = (u8 *) & pp->cmdentry->cfis; 853 cfis = (u8 *) & pp->cmdentry->cfis;
852 854
853 /* device reset/SRST is a control register update FIS, uses tag0 */ 855 /* device reset/SRST is a control register update FIS, uses tag0 */
@@ -919,7 +921,7 @@ skip_srst_do_ncq_error_handling:
919 VPRINTK("Sending read log ext(10h) command\n"); 921 VPRINTK("Sending read log ext(10h) command\n");
920 922
921 memset(&qc, 0, sizeof(struct ata_queued_cmd)); 923 memset(&qc, 0, sizeof(struct ata_queued_cmd));
922 ata_tf_init(ap->device, &tf); 924 ata_tf_init(link->device, &tf);
923 925
924 tf.command = ATA_CMD_READ_LOG_EXT; 926 tf.command = ATA_CMD_READ_LOG_EXT;
925 tf.lbal = ATA_LOG_SATA_NCQ; 927 tf.lbal = ATA_LOG_SATA_NCQ;
@@ -931,7 +933,7 @@ skip_srst_do_ncq_error_handling:
931 qc.tag = ATA_TAG_INTERNAL; 933 qc.tag = ATA_TAG_INTERNAL;
932 qc.scsicmd = NULL; 934 qc.scsicmd = NULL;
933 qc.ap = ap; 935 qc.ap = ap;
934 qc.dev = ap->device; 936 qc.dev = link->device;
935 937
936 qc.tf = tf; 938 qc.tf = tf;
937 qc.flags |= ATA_QCFLAG_RESULT_TF; 939 qc.flags |= ATA_QCFLAG_RESULT_TF;
@@ -981,7 +983,7 @@ skip_srst_do_ncq_error_handling:
981 *class = ATA_DEV_NONE; 983 *class = ATA_DEV_NONE;
982 984
983 /* Verify if SStatus indicates device presence */ 985 /* Verify if SStatus indicates device presence */
984 if (ata_port_online(ap)) { 986 if (ata_link_online(link)) {
985 /* 987 /*
986 * if we are here, device presence has been detected, 988 * if we are here, device presence has been detected,
987 * 1st D2H FIS would have been received, but sfis in 989 * 1st D2H FIS would have been received, but sfis in
@@ -1042,7 +1044,8 @@ static void sata_fsl_irq_clear(struct ata_port *ap)
1042 1044
1043static void sata_fsl_error_intr(struct ata_port *ap) 1045static void sata_fsl_error_intr(struct ata_port *ap)
1044{ 1046{
1045 struct ata_eh_info *ehi = &ap->eh_info; 1047 struct ata_link *link = &ap->link;
1048 struct ata_eh_info *ehi = &link->eh_info;
1046 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 1049 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
1047 void __iomem *hcr_base = host_priv->hcr_base; 1050 void __iomem *hcr_base = host_priv->hcr_base;
1048 u32 hstatus, dereg, cereg = 0, SError = 0; 1051 u32 hstatus, dereg, cereg = 0, SError = 0;
@@ -1111,7 +1114,7 @@ static void sata_fsl_error_intr(struct ata_port *ap)
1111 } 1114 }
1112 1115
1113 /* record error info */ 1116 /* record error info */
1114 qc = ata_qc_from_tag(ap, ap->active_tag); 1117 qc = ata_qc_from_tag(ap, link->active_tag);
1115 1118
1116 if (qc) { 1119 if (qc) {
1117 sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap); 1120 sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap);
@@ -1139,6 +1142,7 @@ static void sata_fsl_qc_complete(struct ata_queued_cmd *qc)
1139 1142
1140static void sata_fsl_host_intr(struct ata_port *ap) 1143static void sata_fsl_host_intr(struct ata_port *ap)
1141{ 1144{
1145 struct ata_link *link = &ap->link;
1142 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 1146 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
1143 void __iomem *hcr_base = host_priv->hcr_base; 1147 void __iomem *hcr_base = host_priv->hcr_base;
1144 u32 hstatus, qc_active = 0; 1148 u32 hstatus, qc_active = 0;
@@ -1161,7 +1165,7 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1161 return; 1165 return;
1162 } 1166 }
1163 1167
1164 if (ap->sactive) { /* only true for NCQ commands */ 1168 if (link->sactive) { /* only true for NCQ commands */
1165 int i; 1169 int i;
1166 /* Read command completed register */ 1170 /* Read command completed register */
1167 qc_active = ioread32(hcr_base + CC); 1171 qc_active = ioread32(hcr_base + CC);
@@ -1190,10 +1194,10 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1190 1194
1191 } else if (ap->qc_active) { 1195 } else if (ap->qc_active) {
1192 iowrite32(1, hcr_base + CC); 1196 iowrite32(1, hcr_base + CC);
1193 qc = ata_qc_from_tag(ap, ap->active_tag); 1197 qc = ata_qc_from_tag(ap, link->active_tag);
1194 1198
1195 DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n", 1199 DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n",
1196 ap->active_tag, ioread32(hcr_base + CC)); 1200 link->active_tag, ioread32(hcr_base + CC));
1197 1201
1198 if (qc) { 1202 if (qc) {
1199 sata_fsl_qc_complete(qc); 1203 sata_fsl_qc_complete(qc);
@@ -1348,6 +1352,7 @@ static const struct ata_port_operations sata_fsl_ops = {
1348static const struct ata_port_info sata_fsl_port_info[] = { 1352static const struct ata_port_info sata_fsl_port_info[] = {
1349 { 1353 {
1350 .flags = SATA_FSL_HOST_FLAGS, 1354 .flags = SATA_FSL_HOST_FLAGS,
1355 .link_flags = SATA_FSL_HOST_LFLAGS,
1351 .pio_mask = 0x1f, /* pio 0-4 */ 1356 .pio_mask = 0x1f, /* pio 0-4 */
1352 .udma_mask = 0x7f, /* udma 0-6 */ 1357 .udma_mask = 0x7f, /* udma 0-6 */
1353 .port_ops = &sata_fsl_ops, 1358 .port_ops = &sata_fsl_ops,