diff options
Diffstat (limited to 'drivers/ata/sata_fsl.c')
-rw-r--r-- | drivers/ata/sata_fsl.c | 159 |
1 files changed, 32 insertions, 127 deletions
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index b4c37b9e413..d015b4adcfe 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 */ |
@@ -264,10 +265,11 @@ struct sata_fsl_host_priv { | |||
264 | void __iomem *hcr_base; | 265 | void __iomem *hcr_base; |
265 | void __iomem *ssr_base; | 266 | void __iomem *ssr_base; |
266 | void __iomem *csr_base; | 267 | void __iomem *csr_base; |
268 | int irq; | ||
267 | }; | 269 | }; |
268 | 270 | ||
269 | static inline unsigned int sata_fsl_tag(unsigned int tag, | 271 | static inline unsigned int sata_fsl_tag(unsigned int tag, |
270 | void __iomem * hcr_base) | 272 | void __iomem *hcr_base) |
271 | { | 273 | { |
272 | /* We let libATA core do actual (queue) tag allocation */ | 274 | /* We let libATA core do actual (queue) tag allocation */ |
273 | 275 | ||
@@ -306,7 +308,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp, | |||
306 | pp->cmdslot[tag].prde_fis_len = | 308 | pp->cmdslot[tag].prde_fis_len = |
307 | cpu_to_le32((num_prde << 16) | (fis_len << 2)); | 309 | cpu_to_le32((num_prde << 16) | (fis_len << 2)); |
308 | pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03); | 310 | pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03); |
309 | pp->cmdslot[tag].desc_info = cpu_to_le32((desc_info | (tag & 0x1F))); | 311 | pp->cmdslot[tag].desc_info = cpu_to_le32(desc_info | (tag & 0x1F)); |
310 | 312 | ||
311 | VPRINTK("cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n", | 313 | VPRINTK("cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n", |
312 | pp->cmdslot[tag].cda, | 314 | pp->cmdslot[tag].cda, |
@@ -316,7 +318,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp, | |||
316 | } | 318 | } |
317 | 319 | ||
318 | static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, | 320 | static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, |
319 | u32 * ttl, dma_addr_t cmd_desc_paddr) | 321 | u32 *ttl, dma_addr_t cmd_desc_paddr) |
320 | { | 322 | { |
321 | struct scatterlist *sg; | 323 | struct scatterlist *sg; |
322 | unsigned int num_prde = 0; | 324 | unsigned int num_prde = 0; |
@@ -353,7 +355,7 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, | |||
353 | "s/g len unaligned : 0x%x\n", sg_len); | 355 | "s/g len unaligned : 0x%x\n", sg_len); |
354 | 356 | ||
355 | if ((num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1)) && | 357 | if ((num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1)) && |
356 | !ata_sg_is_last(sg, qc)) { | 358 | (qc->n_iter + 1 != qc->n_elem)) { |
357 | VPRINTK("setting indirect prde\n"); | 359 | VPRINTK("setting indirect prde\n"); |
358 | prd_ptr_to_indirect_ext = prd; | 360 | prd_ptr_to_indirect_ext = prd; |
359 | prd->dba = cpu_to_le32(indirect_ext_segment_paddr); | 361 | prd->dba = cpu_to_le32(indirect_ext_segment_paddr); |
@@ -404,7 +406,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc) | |||
404 | cd = (struct command_desc *)pp->cmdentry + tag; | 406 | cd = (struct command_desc *)pp->cmdentry + tag; |
405 | cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; | 407 | cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; |
406 | 408 | ||
407 | ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) & cd->cfis); | 409 | ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) &cd->cfis); |
408 | 410 | ||
409 | VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n", | 411 | VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n", |
410 | cd->cfis[0], cd->cfis[1], cd->cfis[2]); | 412 | cd->cfis[0], cd->cfis[1], cd->cfis[2]); |
@@ -470,16 +472,10 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in, | |||
470 | 472 | ||
471 | switch (sc_reg_in) { | 473 | switch (sc_reg_in) { |
472 | case SCR_STATUS: | 474 | case SCR_STATUS: |
473 | sc_reg = 0; | ||
474 | break; | ||
475 | case SCR_ERROR: | 475 | case SCR_ERROR: |
476 | sc_reg = 1; | ||
477 | break; | ||
478 | case SCR_CONTROL: | 476 | case SCR_CONTROL: |
479 | sc_reg = 2; | ||
480 | break; | ||
481 | case SCR_ACTIVE: | 477 | case SCR_ACTIVE: |
482 | sc_reg = 3; | 478 | sc_reg = sc_reg_in; |
483 | break; | 479 | break; |
484 | default: | 480 | default: |
485 | return -EINVAL; | 481 | return -EINVAL; |
@@ -487,7 +483,7 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in, | |||
487 | 483 | ||
488 | VPRINTK("xx_scr_write, reg_in = %d\n", sc_reg); | 484 | VPRINTK("xx_scr_write, reg_in = %d\n", sc_reg); |
489 | 485 | ||
490 | iowrite32(val, (void __iomem *)ssr_base + (sc_reg * 4)); | 486 | iowrite32(val, ssr_base + (sc_reg * 4)); |
491 | return 0; | 487 | return 0; |
492 | } | 488 | } |
493 | 489 | ||
@@ -500,16 +496,10 @@ static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in, | |||
500 | 496 | ||
501 | switch (sc_reg_in) { | 497 | switch (sc_reg_in) { |
502 | case SCR_STATUS: | 498 | case SCR_STATUS: |
503 | sc_reg = 0; | ||
504 | break; | ||
505 | case SCR_ERROR: | 499 | case SCR_ERROR: |
506 | sc_reg = 1; | ||
507 | break; | ||
508 | case SCR_CONTROL: | 500 | case SCR_CONTROL: |
509 | sc_reg = 2; | ||
510 | break; | ||
511 | case SCR_ACTIVE: | 501 | case SCR_ACTIVE: |
512 | sc_reg = 3; | 502 | sc_reg = sc_reg_in; |
513 | break; | 503 | break; |
514 | default: | 504 | default: |
515 | return -EINVAL; | 505 | return -EINVAL; |
@@ -517,7 +507,7 @@ static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in, | |||
517 | 507 | ||
518 | VPRINTK("xx_scr_read, reg_in = %d\n", sc_reg); | 508 | VPRINTK("xx_scr_read, reg_in = %d\n", sc_reg); |
519 | 509 | ||
520 | *val = ioread32((void __iomem *)ssr_base + (sc_reg * 4)); | 510 | *val = ioread32(ssr_base + (sc_reg * 4)); |
521 | return 0; | 511 | return 0; |
522 | } | 512 | } |
523 | 513 | ||
@@ -571,7 +561,6 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd | |||
571 | struct ata_port *ap) | 561 | struct ata_port *ap) |
572 | { | 562 | { |
573 | struct sata_fsl_port_priv *pp = ap->private_data; | 563 | struct sata_fsl_port_priv *pp = ap->private_data; |
574 | u8 fis[6 * 4]; | ||
575 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 564 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
576 | void __iomem *hcr_base = host_priv->hcr_base; | 565 | void __iomem *hcr_base = host_priv->hcr_base; |
577 | unsigned int tag = sata_fsl_tag(qc->tag, hcr_base); | 566 | unsigned int tag = sata_fsl_tag(qc->tag, hcr_base); |
@@ -579,8 +568,7 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd | |||
579 | 568 | ||
580 | cd = pp->cmdentry + tag; | 569 | cd = pp->cmdentry + tag; |
581 | 570 | ||
582 | memcpy(fis, &cd->sfis, 6 * 4); /* should we use memcpy_from_io() */ | 571 | ata_tf_from_fis(cd->sfis, &pp->tf); |
583 | ata_tf_from_fis(fis, &pp->tf); | ||
584 | } | 572 | } |
585 | 573 | ||
586 | static u8 sata_fsl_check_status(struct ata_port *ap) | 574 | static u8 sata_fsl_check_status(struct ata_port *ap) |
@@ -664,6 +652,7 @@ static int sata_fsl_port_start(struct ata_port *ap) | |||
664 | VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); | 652 | VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); |
665 | VPRINTK("CHBA = 0x%x\n", ioread32(hcr_base + CHBA)); | 653 | VPRINTK("CHBA = 0x%x\n", ioread32(hcr_base + CHBA)); |
666 | 654 | ||
655 | #ifdef CONFIG_MPC8315_DS | ||
667 | /* | 656 | /* |
668 | * Workaround for 8315DS board 3gbps link-up issue, | 657 | * Workaround for 8315DS board 3gbps link-up issue, |
669 | * currently limit SATA port to GEN1 speed | 658 | * currently limit SATA port to GEN1 speed |
@@ -676,6 +665,7 @@ static int sata_fsl_port_start(struct ata_port *ap) | |||
676 | sata_fsl_scr_read(ap, SCR_CONTROL, &temp); | 665 | sata_fsl_scr_read(ap, SCR_CONTROL, &temp); |
677 | dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n", | 666 | dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n", |
678 | temp); | 667 | temp); |
668 | #endif | ||
679 | 669 | ||
680 | return 0; | 670 | return 0; |
681 | } | 671 | } |
@@ -728,9 +718,10 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap) | |||
728 | return ata_dev_classify(&tf); | 718 | return ata_dev_classify(&tf); |
729 | } | 719 | } |
730 | 720 | ||
731 | static int sata_fsl_softreset(struct ata_port *ap, unsigned int *class, | 721 | static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, |
732 | unsigned long deadline) | 722 | unsigned long deadline) |
733 | { | 723 | { |
724 | struct ata_port *ap = link->ap; | ||
734 | struct sata_fsl_port_priv *pp = ap->private_data; | 725 | struct sata_fsl_port_priv *pp = ap->private_data; |
735 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 726 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
736 | void __iomem *hcr_base = host_priv->hcr_base; | 727 | void __iomem *hcr_base = host_priv->hcr_base; |
@@ -739,10 +730,6 @@ static int sata_fsl_softreset(struct ata_port *ap, unsigned int *class, | |||
739 | u8 *cfis; | 730 | u8 *cfis; |
740 | u32 Serror; | 731 | u32 Serror; |
741 | int i = 0; | 732 | int i = 0; |
742 | struct ata_queued_cmd qc; | ||
743 | u8 *buf; | ||
744 | dma_addr_t dma_address; | ||
745 | struct scatterlist *sg; | ||
746 | unsigned long start_jiffies; | 733 | unsigned long start_jiffies; |
747 | 734 | ||
748 | DPRINTK("in xx_softreset\n"); | 735 | DPRINTK("in xx_softreset\n"); |
@@ -811,7 +798,7 @@ try_offline_again: | |||
811 | */ | 798 | */ |
812 | 799 | ||
813 | temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500); | 800 | temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500); |
814 | if ((!(temp & 0x10)) || ata_port_offline(ap)) { | 801 | if ((!(temp & 0x10)) || ata_link_offline(link)) { |
815 | ata_port_printk(ap, KERN_WARNING, | 802 | ata_port_printk(ap, KERN_WARNING, |
816 | "No Device OR PHYRDY change,Hstatus = 0x%x\n", | 803 | "No Device OR PHYRDY change,Hstatus = 0x%x\n", |
817 | ioread32(hcr_base + HSTATUS)); | 804 | ioread32(hcr_base + HSTATUS)); |
@@ -842,13 +829,10 @@ try_offline_again: | |||
842 | * reached here, we can send a command to the target device | 829 | * reached here, we can send a command to the target device |
843 | */ | 830 | */ |
844 | 831 | ||
845 | if (ap->sactive) | ||
846 | goto skip_srst_do_ncq_error_handling; | ||
847 | |||
848 | DPRINTK("Sending SRST/device reset\n"); | 832 | DPRINTK("Sending SRST/device reset\n"); |
849 | 833 | ||
850 | ata_tf_init(ap->device, &tf); | 834 | ata_tf_init(link->device, &tf); |
851 | cfis = (u8 *) & pp->cmdentry->cfis; | 835 | cfis = (u8 *) &pp->cmdentry->cfis; |
852 | 836 | ||
853 | /* device reset/SRST is a control register update FIS, uses tag0 */ | 837 | /* device reset/SRST is a control register update FIS, uses tag0 */ |
854 | sata_fsl_setup_cmd_hdr_entry(pp, 0, | 838 | sata_fsl_setup_cmd_hdr_entry(pp, 0, |
@@ -912,76 +896,13 @@ try_offline_again: | |||
912 | * command bit of the CCreg | 896 | * command bit of the CCreg |
913 | */ | 897 | */ |
914 | iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */ | 898 | iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */ |
915 | goto check_device_signature; | ||
916 | |||
917 | skip_srst_do_ncq_error_handling: | ||
918 | |||
919 | VPRINTK("Sending read log ext(10h) command\n"); | ||
920 | |||
921 | memset(&qc, 0, sizeof(struct ata_queued_cmd)); | ||
922 | ata_tf_init(ap->device, &tf); | ||
923 | |||
924 | tf.command = ATA_CMD_READ_LOG_EXT; | ||
925 | tf.lbal = ATA_LOG_SATA_NCQ; | ||
926 | tf.nsect = 1; | ||
927 | tf.hob_nsect = 0; | ||
928 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE; | ||
929 | tf.protocol = ATA_PROT_PIO; | ||
930 | |||
931 | qc.tag = ATA_TAG_INTERNAL; | ||
932 | qc.scsicmd = NULL; | ||
933 | qc.ap = ap; | ||
934 | qc.dev = ap->device; | ||
935 | |||
936 | qc.tf = tf; | ||
937 | qc.flags |= ATA_QCFLAG_RESULT_TF; | ||
938 | qc.dma_dir = DMA_FROM_DEVICE; | ||
939 | |||
940 | buf = ap->sector_buf; | ||
941 | ata_sg_init_one(&qc, buf, 1 * ATA_SECT_SIZE); | ||
942 | |||
943 | /* | ||
944 | * Need to DMA-map the memory buffer associated with the command | ||
945 | */ | ||
946 | |||
947 | sg = qc.__sg; | ||
948 | dma_address = dma_map_single(ap->dev, qc.buf_virt, | ||
949 | sg->length, DMA_FROM_DEVICE); | ||
950 | |||
951 | sg_dma_address(sg) = dma_address; | ||
952 | sg_dma_len(sg) = sg->length; | ||
953 | |||
954 | VPRINTK("EH, addr = 0x%x, len = 0x%x\n", dma_address, sg->length); | ||
955 | |||
956 | sata_fsl_qc_prep(&qc); | ||
957 | sata_fsl_qc_issue(&qc); | ||
958 | |||
959 | temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000); | ||
960 | if (temp & 0x1) { | ||
961 | VPRINTK("READ_LOG_EXT_10H issue failed\n"); | ||
962 | |||
963 | VPRINTK("READ_LOG@5000,CQ=0x%x,CA=0x%x,CC=0x%x\n", | ||
964 | ioread32(CQ + hcr_base), | ||
965 | ioread32(CA + hcr_base), ioread32(CC + hcr_base)); | ||
966 | |||
967 | sata_fsl_scr_read(ap, SCR_ERROR, &Serror); | ||
968 | |||
969 | VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS)); | ||
970 | VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); | ||
971 | VPRINTK("Serror = 0x%x\n", Serror); | ||
972 | goto err; | ||
973 | } | ||
974 | |||
975 | iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */ | ||
976 | |||
977 | check_device_signature: | ||
978 | 899 | ||
979 | DPRINTK("SATA FSL : Now checking device signature\n"); | 900 | DPRINTK("SATA FSL : Now checking device signature\n"); |
980 | 901 | ||
981 | *class = ATA_DEV_NONE; | 902 | *class = ATA_DEV_NONE; |
982 | 903 | ||
983 | /* Verify if SStatus indicates device presence */ | 904 | /* Verify if SStatus indicates device presence */ |
984 | if (ata_port_online(ap)) { | 905 | if (ata_link_online(link)) { |
985 | /* | 906 | /* |
986 | * if we are here, device presence has been detected, | 907 | * if we are here, device presence has been detected, |
987 | * 1st D2H FIS would have been received, but sfis in | 908 | * 1st D2H FIS would have been received, but sfis in |
@@ -1002,25 +923,13 @@ err: | |||
1002 | return -EIO; | 923 | return -EIO; |
1003 | } | 924 | } |
1004 | 925 | ||
1005 | static int sata_fsl_hardreset(struct ata_port *ap, unsigned int *class, | ||
1006 | unsigned long deadline) | ||
1007 | { | ||
1008 | int retval; | ||
1009 | |||
1010 | retval = sata_std_hardreset(ap, class, deadline); | ||
1011 | |||
1012 | DPRINTK("SATA FSL : in xx_hardreset, retval = 0x%d\n", retval); | ||
1013 | |||
1014 | return retval; | ||
1015 | } | ||
1016 | |||
1017 | static void sata_fsl_error_handler(struct ata_port *ap) | 926 | static void sata_fsl_error_handler(struct ata_port *ap) |
1018 | { | 927 | { |
1019 | 928 | ||
1020 | DPRINTK("in xx_error_handler\n"); | 929 | DPRINTK("in xx_error_handler\n"); |
1021 | 930 | ||
1022 | /* perform recovery */ | 931 | /* perform recovery */ |
1023 | ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_fsl_hardreset, | 932 | ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_std_hardreset, |
1024 | ata_std_postreset); | 933 | ata_std_postreset); |
1025 | } | 934 | } |
1026 | 935 | ||
@@ -1042,7 +951,8 @@ static void sata_fsl_irq_clear(struct ata_port *ap) | |||
1042 | 951 | ||
1043 | static void sata_fsl_error_intr(struct ata_port *ap) | 952 | static void sata_fsl_error_intr(struct ata_port *ap) |
1044 | { | 953 | { |
1045 | struct ata_eh_info *ehi = &ap->eh_info; | 954 | struct ata_link *link = &ap->link; |
955 | struct ata_eh_info *ehi = &link->eh_info; | ||
1046 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 956 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
1047 | void __iomem *hcr_base = host_priv->hcr_base; | 957 | void __iomem *hcr_base = host_priv->hcr_base; |
1048 | u32 hstatus, dereg, cereg = 0, SError = 0; | 958 | u32 hstatus, dereg, cereg = 0, SError = 0; |
@@ -1111,7 +1021,7 @@ static void sata_fsl_error_intr(struct ata_port *ap) | |||
1111 | } | 1021 | } |
1112 | 1022 | ||
1113 | /* record error info */ | 1023 | /* record error info */ |
1114 | qc = ata_qc_from_tag(ap, ap->active_tag); | 1024 | qc = ata_qc_from_tag(ap, link->active_tag); |
1115 | 1025 | ||
1116 | if (qc) { | 1026 | if (qc) { |
1117 | sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap); | 1027 | sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap); |
@@ -1139,6 +1049,7 @@ static void sata_fsl_qc_complete(struct ata_queued_cmd *qc) | |||
1139 | 1049 | ||
1140 | static void sata_fsl_host_intr(struct ata_port *ap) | 1050 | static void sata_fsl_host_intr(struct ata_port *ap) |
1141 | { | 1051 | { |
1052 | struct ata_link *link = &ap->link; | ||
1142 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 1053 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
1143 | void __iomem *hcr_base = host_priv->hcr_base; | 1054 | void __iomem *hcr_base = host_priv->hcr_base; |
1144 | u32 hstatus, qc_active = 0; | 1055 | u32 hstatus, qc_active = 0; |
@@ -1161,7 +1072,7 @@ static void sata_fsl_host_intr(struct ata_port *ap) | |||
1161 | return; | 1072 | return; |
1162 | } | 1073 | } |
1163 | 1074 | ||
1164 | if (ap->sactive) { /* only true for NCQ commands */ | 1075 | if (link->sactive) { /* only true for NCQ commands */ |
1165 | int i; | 1076 | int i; |
1166 | /* Read command completed register */ | 1077 | /* Read command completed register */ |
1167 | qc_active = ioread32(hcr_base + CC); | 1078 | qc_active = ioread32(hcr_base + CC); |
@@ -1190,10 +1101,10 @@ static void sata_fsl_host_intr(struct ata_port *ap) | |||
1190 | 1101 | ||
1191 | } else if (ap->qc_active) { | 1102 | } else if (ap->qc_active) { |
1192 | iowrite32(1, hcr_base + CC); | 1103 | iowrite32(1, hcr_base + CC); |
1193 | qc = ata_qc_from_tag(ap, ap->active_tag); | 1104 | qc = ata_qc_from_tag(ap, link->active_tag); |
1194 | 1105 | ||
1195 | DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n", | 1106 | DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n", |
1196 | ap->active_tag, ioread32(hcr_base + CC)); | 1107 | link->active_tag, ioread32(hcr_base + CC)); |
1197 | 1108 | ||
1198 | if (qc) { | 1109 | if (qc) { |
1199 | sata_fsl_qc_complete(qc); | 1110 | sata_fsl_qc_complete(qc); |
@@ -1312,15 +1223,9 @@ static struct scsi_host_template sata_fsl_sht = { | |||
1312 | .slave_configure = ata_scsi_slave_config, | 1223 | .slave_configure = ata_scsi_slave_config, |
1313 | .slave_destroy = ata_scsi_slave_destroy, | 1224 | .slave_destroy = ata_scsi_slave_destroy, |
1314 | .bios_param = ata_std_bios_param, | 1225 | .bios_param = ata_std_bios_param, |
1315 | #ifdef CONFIG_PM | ||
1316 | .suspend = ata_scsi_device_suspend, | ||
1317 | .resume = ata_scsi_device_resume, | ||
1318 | #endif | ||
1319 | }; | 1226 | }; |
1320 | 1227 | ||
1321 | static const struct ata_port_operations sata_fsl_ops = { | 1228 | static const struct ata_port_operations sata_fsl_ops = { |
1322 | .port_disable = ata_port_disable, | ||
1323 | |||
1324 | .check_status = sata_fsl_check_status, | 1229 | .check_status = sata_fsl_check_status, |
1325 | .check_altstatus = sata_fsl_check_status, | 1230 | .check_altstatus = sata_fsl_check_status, |
1326 | .dev_select = ata_noop_dev_select, | 1231 | .dev_select = ata_noop_dev_select, |
@@ -1330,8 +1235,6 @@ static const struct ata_port_operations sata_fsl_ops = { | |||
1330 | .qc_prep = sata_fsl_qc_prep, | 1235 | .qc_prep = sata_fsl_qc_prep, |
1331 | .qc_issue = sata_fsl_qc_issue, | 1236 | .qc_issue = sata_fsl_qc_issue, |
1332 | .irq_clear = sata_fsl_irq_clear, | 1237 | .irq_clear = sata_fsl_irq_clear, |
1333 | .irq_on = ata_dummy_irq_on, | ||
1334 | .irq_ack = ata_dummy_irq_ack, | ||
1335 | 1238 | ||
1336 | .scr_read = sata_fsl_scr_read, | 1239 | .scr_read = sata_fsl_scr_read, |
1337 | .scr_write = sata_fsl_scr_write, | 1240 | .scr_write = sata_fsl_scr_write, |
@@ -1348,6 +1251,7 @@ static const struct ata_port_operations sata_fsl_ops = { | |||
1348 | static const struct ata_port_info sata_fsl_port_info[] = { | 1251 | static const struct ata_port_info sata_fsl_port_info[] = { |
1349 | { | 1252 | { |
1350 | .flags = SATA_FSL_HOST_FLAGS, | 1253 | .flags = SATA_FSL_HOST_FLAGS, |
1254 | .link_flags = SATA_FSL_HOST_LFLAGS, | ||
1351 | .pio_mask = 0x1f, /* pio 0-4 */ | 1255 | .pio_mask = 0x1f, /* pio 0-4 */ |
1352 | .udma_mask = 0x7f, /* udma 0-6 */ | 1256 | .udma_mask = 0x7f, /* udma 0-6 */ |
1353 | .port_ops = &sata_fsl_ops, | 1257 | .port_ops = &sata_fsl_ops, |
@@ -1398,6 +1302,7 @@ static int sata_fsl_probe(struct of_device *ofdev, | |||
1398 | dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n"); | 1302 | dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n"); |
1399 | goto error_exit_with_cleanup; | 1303 | goto error_exit_with_cleanup; |
1400 | } | 1304 | } |
1305 | host_priv->irq = irq; | ||
1401 | 1306 | ||
1402 | /* allocate host structure */ | 1307 | /* allocate host structure */ |
1403 | host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS); | 1308 | host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS); |
@@ -1444,7 +1349,7 @@ static int sata_fsl_remove(struct of_device *ofdev) | |||
1444 | 1349 | ||
1445 | dev_set_drvdata(&ofdev->dev, NULL); | 1350 | dev_set_drvdata(&ofdev->dev, NULL); |
1446 | 1351 | ||
1447 | irq_dispose_mapping(host->irq); | 1352 | irq_dispose_mapping(host_priv->irq); |
1448 | iounmap(host_priv->hcr_base); | 1353 | iounmap(host_priv->hcr_base); |
1449 | kfree(host_priv); | 1354 | kfree(host_priv); |
1450 | 1355 | ||