Lines Matching refs:ctrl
36 struct fsl_ifc_ctrl *ctrl; member
227 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in set_addr() local
228 struct fsl_ifc_runtime *ifc = ctrl->regs.rregs; in set_addr()
231 ctrl->page = page_addr; in set_addr()
239 ctrl->addr = priv->vbase + buf_num * (mtd->writesize * 2); in set_addr()
240 ctrl->index = column; in set_addr()
244 ctrl->index += mtd->writesize; in set_addr()
248 static int check_read_ecc(struct mtd_info *mtd, struct fsl_ifc_ctrl *ctrl, in check_read_ecc() argument
261 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_run_command() local
262 struct fsl_ifc_runtime *ifc = ctrl->regs.rregs; in fsl_ifc_run_command()
279 ctrl->status = ifc_in32(&ifc->ifc_nand.nand_evter_stat); in fsl_ifc_run_command()
281 if (ctrl->status & IFC_NAND_EVTER_STAT_OPC) in fsl_ifc_run_command()
285 ifc_out32(&ifc->ifc_nand.nand_evter_stat, ctrl->status); in fsl_ifc_run_command()
287 if (ctrl->status & IFC_NAND_EVTER_STAT_FTOER) in fsl_ifc_run_command()
289 if (ctrl->status & IFC_NAND_EVTER_STAT_WPER) in fsl_ifc_run_command()
292 if (ctrl->eccread) { in fsl_ifc_run_command()
294 int bufnum = ctrl->page & priv->bufnum_mask; in fsl_ifc_run_command()
306 errors = check_read_ecc(mtd, ctrl, eccstat, i); in fsl_ifc_run_command()
317 ctrl->status |= IFC_NAND_EVTER_STAT_ECCER; in fsl_ifc_run_command()
324 ctrl->eccread = 0; in fsl_ifc_run_command()
328 return ctrl->status == IFC_NAND_EVTER_STAT_OPC ? 0 : -EIO; in fsl_ifc_run_command()
336 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_do_read() local
337 struct fsl_ifc_runtime *ifc = ctrl->regs.rregs; in fsl_ifc_do_read()
374 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_cmdfunc() local
375 struct fsl_ifc_runtime *ifc = ctrl->regs.rregs; in fsl_ifc_cmdfunc()
378 ctrl->read_bytes = 0; in fsl_ifc_cmdfunc()
380 ctrl->index = 0; in fsl_ifc_cmdfunc()
388 ctrl->read_bytes = mtd->writesize + mtd->oobsize; in fsl_ifc_cmdfunc()
389 ctrl->index += column; in fsl_ifc_cmdfunc()
392 ctrl->eccread = 1; in fsl_ifc_cmdfunc()
404 ctrl->read_bytes = mtd->writesize + mtd->oobsize; in fsl_ifc_cmdfunc()
434 ctrl->read_bytes = len; in fsl_ifc_cmdfunc()
458 ctrl->read_bytes = 0; in fsl_ifc_cmdfunc()
465 ctrl->column = column; in fsl_ifc_cmdfunc()
466 ctrl->oob = 0; in fsl_ifc_cmdfunc()
518 ctrl->oob = 1; in fsl_ifc_cmdfunc()
521 set_addr(mtd, column, page_addr, ctrl->oob); in fsl_ifc_cmdfunc()
527 if (ctrl->oob) in fsl_ifc_cmdfunc()
529 ctrl->index - ctrl->column); in fsl_ifc_cmdfunc()
544 ctrl->read_bytes = 1; in fsl_ifc_cmdfunc()
553 ifc_out16(ctrl->addr, in fsl_ifc_cmdfunc()
554 ifc_in16(ctrl->addr) | NAND_STATUS_WP); in fsl_ifc_cmdfunc()
556 out_8(ctrl->addr, in_8(ctrl->addr) | NAND_STATUS_WP); in fsl_ifc_cmdfunc()
580 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_write_buf() local
585 ctrl->status = 0; in fsl_ifc_write_buf()
589 if ((unsigned int)len > bufsize - ctrl->index) { in fsl_ifc_write_buf()
592 __func__, len, bufsize - ctrl->index); in fsl_ifc_write_buf()
593 len = bufsize - ctrl->index; in fsl_ifc_write_buf()
596 memcpy_toio(ctrl->addr + ctrl->index, buf, len); in fsl_ifc_write_buf()
597 ctrl->index += len; in fsl_ifc_write_buf()
608 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_read_byte() local
615 if (ctrl->index < ctrl->read_bytes) { in fsl_ifc_read_byte()
616 offset = ctrl->index++; in fsl_ifc_read_byte()
617 return in_8(ctrl->addr + offset); in fsl_ifc_read_byte()
632 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_read_byte16() local
639 if (ctrl->index < ctrl->read_bytes) { in fsl_ifc_read_byte16()
640 data = ifc_in16(ctrl->addr + ctrl->index); in fsl_ifc_read_byte16()
641 ctrl->index += 2; in fsl_ifc_read_byte16()
656 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_read_buf() local
662 avail = min((unsigned int)len, ctrl->read_bytes - ctrl->index); in fsl_ifc_read_buf()
663 memcpy_fromio(buf, ctrl->addr + ctrl->index, avail); in fsl_ifc_read_buf()
664 ctrl->index += avail; in fsl_ifc_read_buf()
678 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_wait() local
679 struct fsl_ifc_runtime *ifc = ctrl->regs.rregs; in fsl_ifc_wait()
683 if (ctrl->status != IFC_NAND_EVTER_STAT_OPC) in fsl_ifc_wait()
694 ctrl->read_bytes = 1; in fsl_ifc_wait()
698 if (ctrl->status != IFC_NAND_EVTER_STAT_OPC) in fsl_ifc_wait()
745 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_read_page() local
750 if (ctrl->status & IFC_NAND_EVTER_STAT_ECCER) in fsl_ifc_read_page()
753 if (ctrl->status != IFC_NAND_EVTER_STAT_OPC) in fsl_ifc_read_page()
906 priv->ctrl = ifc_ctrl; in fsl_ifc_chip_init()