Lines Matching full:sata

16 #include <sata.h>
86 fsl_sata_t *sata; in init_sata() local
89 printf("the sata index %d is out of ranges\n\r", dev); in init_sata()
95 printf("SATA%d [dev = %d] is not enabled\n", dev+1, dev); in init_sata()
99 printf("SATA%d [dev = %d] is not enabled\n", dev+1, dev); in init_sata()
104 /* Allocate SATA device driver struct */ in init_sata()
105 sata = (fsl_sata_t *)malloc(sizeof(fsl_sata_t)); in init_sata()
106 if (!sata) { in init_sata()
107 printf("alloc the sata device struct failed\n\r"); in init_sata()
111 memset((void *)sata, 0, sizeof(fsl_sata_t)); in init_sata()
114 sata_dev_desc[dev].priv = (void *)sata; in init_sata()
116 snprintf(sata->name, 12, "SATA%d", dev); in init_sata()
120 sata->reg_base = reg; in init_sata()
125 sata->cmd_hdr_tbl_offset = (void *)malloc(length + align); in init_sata()
126 if (!sata->cmd_hdr_tbl_offset) { in init_sata()
131 cmd_hdr = (cmd_hdr_tbl_t *)(((u32)sata->cmd_hdr_tbl_offset + align) in init_sata()
133 sata->cmd_hdr = cmd_hdr; in init_sata()
136 memset((void *)sata->cmd_hdr_tbl_offset, 0, length + align); in init_sata()
141 sata->cmd_desc_offset = (void *)malloc(length + align); in init_sata()
142 if (!sata->cmd_desc_offset) { in init_sata()
146 sata->cmd_desc = (cmd_desc_t *)(((u32)sata->cmd_desc_offset + align) in init_sata()
149 memset((void *)sata->cmd_desc_offset, 0, length + align); in init_sata()
153 cda = ((u32)sata->cmd_desc + SATA_HC_CMD_DESC_SIZE * i) in init_sata()
187 /* No PM attatched, the SATA device direct connect */ in init_sata()
218 /* print sata device name */ in init_sata()
220 printf("%s ", sata->name); in init_sata()
222 printf(" %s ", sata->name); in init_sata()
231 sata->link = 1; in init_sata()
233 sata->link = 0; in init_sata()
245 sata->ata_device_type = ata_dev_classify(sig); in init_sata()
293 static int fsl_ata_exec_ata_cmd(struct fsl_sata *sata, struct sata_fis_h2d *cfis, in fsl_ata_exec_ata_cmd() argument
304 fsl_sata_reg_t __iomem *reg = sata->reg_base; in fsl_ata_exec_ata_cmd()
314 cmd_desc = sata->cmd_desc + tag; in fsl_ata_exec_ata_cmd()
378 cmd_hdr = (cmd_hdr_entry_t *)&sata->cmd_hdr->cmd_slot[tag]; in fsl_ata_exec_ata_cmd()
444 static int fsl_ata_exec_reset_cmd(struct fsl_sata *sata, struct sata_fis_h2d *cfis, in fsl_ata_exec_reset_cmd() argument
450 static int fsl_sata_exec_cmd(struct fsl_sata *sata, struct sata_fis_h2d *cfis, in fsl_sata_exec_cmd() argument
462 rc = fsl_ata_exec_ata_cmd(sata, cfis, 0, tag, buffer, len); in fsl_sata_exec_cmd()
465 rc = fsl_ata_exec_reset_cmd(sata, cfis, tag, buffer, len); in fsl_sata_exec_cmd()
468 rc = fsl_ata_exec_ata_cmd(sata, cfis, 1, tag, buffer, len); in fsl_sata_exec_cmd()
484 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in fsl_sata_identify() local
493 fsl_sata_exec_cmd(sata, cfis, CMD_ATA, 0, (u8 *)id, ATA_ID_WORDS * 2); in fsl_sata_identify()
499 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in fsl_sata_xfer_mode() local
501 sata->pio = id[ATA_ID_PIO_MODES]; in fsl_sata_xfer_mode()
502 sata->mwdma = id[ATA_ID_MWDMA_MODES]; in fsl_sata_xfer_mode()
503 sata->udma = id[ATA_ID_UDMA_MODES]; in fsl_sata_xfer_mode()
504 debug("pio %04x, mwdma %04x, udma %04x\n\r", sata->pio, sata->mwdma, sata->udma); in fsl_sata_xfer_mode()
509 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in fsl_sata_set_features() local
521 udma_cap = (u8)(sata->udma & 0xff); in fsl_sata_set_features()
533 fsl_sata_exec_cmd(sata, cfis, CMD_ATA, 0, NULL, 0); in fsl_sata_set_features()
538 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in fsl_sata_rw_cmd() local
557 fsl_sata_exec_cmd(sata, cfis, CMD_ATA, 0, buffer, ATA_SECT_SIZE * blkcnt); in fsl_sata_rw_cmd()
563 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in fsl_sata_flush_cache() local
572 fsl_sata_exec_cmd(sata, cfis, CMD_ATA, 0, NULL, 0); in fsl_sata_flush_cache()
577 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in fsl_sata_rw_cmd_ext() local
601 fsl_sata_exec_cmd(sata, cfis, CMD_ATA, 0, buffer, ATA_SECT_SIZE * blkcnt); in fsl_sata_rw_cmd_ext()
608 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in fsl_sata_rw_ncq_cmd() local
613 if (sata->lba48 != 1) { in fsl_sata_rw_ncq_cmd()
639 if (sata->queue_depth >= SATA_HC_MAX_CMD) in fsl_sata_rw_ncq_cmd()
642 ncq_channel = sata->queue_depth - 1; in fsl_sata_rw_ncq_cmd()
645 fsl_sata_exec_cmd(sata, cfis, CMD_NCQ, ncq_channel, buffer, ATA_SECT_SIZE * blkcnt); in fsl_sata_rw_ncq_cmd()
651 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in fsl_sata_flush_cache_ext() local
660 fsl_sata_exec_cmd(sata, cfis, CMD_ATA, 0, NULL, 0); in fsl_sata_flush_cache_ext()
665 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in fsl_sata_init_wcache() local
668 sata->wcache = 1; in fsl_sata_init_wcache()
670 sata->flush = 1; in fsl_sata_init_wcache()
672 sata->flush_ext = 1; in fsl_sata_init_wcache()
677 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in fsl_sata_get_wcache() local
678 return sata->wcache; in fsl_sata_get_wcache()
683 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in fsl_sata_get_flush() local
684 return sata->flush; in fsl_sata_get_flush()
689 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in fsl_sata_get_flush_ext() local
690 return sata->flush_ext; in fsl_sata_get_flush_ext()
758 * SATA interface between low level driver and command layer
763 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in sata_read() local
765 if (sata->lba48) in sata_read()
775 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in sata_write() local
777 if (sata->lba48) { in sata_write()
791 fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; in scan_sata() local
799 if (!sata->link) in scan_sata()
830 sata->lba48 = 1; in scan_sata()
837 sata->queue_depth = ata_id_queue_depth(id); in scan_sata()