Lines Matching refs:ctrl
35 struct fsl_ifc_ctrl *ctrl; member
226 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in set_addr() local
227 struct fsl_ifc_runtime *ifc = ctrl->regs.rregs; in set_addr()
230 ctrl->page = page_addr; in set_addr()
238 ctrl->addr = priv->vbase + buf_num * (mtd->writesize * 2); in set_addr()
239 ctrl->index = column; in set_addr()
243 ctrl->index += mtd->writesize; in set_addr()
247 static int check_read_ecc(struct mtd_info *mtd, struct fsl_ifc_ctrl *ctrl, in check_read_ecc() argument
260 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_run_command() local
261 struct fsl_ifc_runtime *ifc = ctrl->regs.rregs; in fsl_ifc_run_command()
278 ctrl->status = ifc_in32(&ifc->ifc_nand.nand_evter_stat); in fsl_ifc_run_command()
280 if (ctrl->status & IFC_NAND_EVTER_STAT_OPC) in fsl_ifc_run_command()
284 ifc_out32(&ifc->ifc_nand.nand_evter_stat, ctrl->status); in fsl_ifc_run_command()
286 if (ctrl->status & IFC_NAND_EVTER_STAT_FTOER) in fsl_ifc_run_command()
288 if (ctrl->status & IFC_NAND_EVTER_STAT_WPER) in fsl_ifc_run_command()
291 if (ctrl->eccread) { in fsl_ifc_run_command()
293 int bufnum = ctrl->page & priv->bufnum_mask; in fsl_ifc_run_command()
305 errors = check_read_ecc(mtd, ctrl, eccstat, i); in fsl_ifc_run_command()
316 ctrl->status |= IFC_NAND_EVTER_STAT_ECCER; in fsl_ifc_run_command()
323 ctrl->eccread = 0; in fsl_ifc_run_command()
327 return ctrl->status == IFC_NAND_EVTER_STAT_OPC ? 0 : -EIO; in fsl_ifc_run_command()
335 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_do_read() local
336 struct fsl_ifc_runtime *ifc = ctrl->regs.rregs; in fsl_ifc_do_read()
373 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_cmdfunc() local
374 struct fsl_ifc_runtime *ifc = ctrl->regs.rregs; in fsl_ifc_cmdfunc()
377 ctrl->read_bytes = 0; in fsl_ifc_cmdfunc()
379 ctrl->index = 0; in fsl_ifc_cmdfunc()
387 ctrl->read_bytes = mtd->writesize + mtd->oobsize; in fsl_ifc_cmdfunc()
388 ctrl->index += column; in fsl_ifc_cmdfunc()
391 ctrl->eccread = 1; in fsl_ifc_cmdfunc()
403 ctrl->read_bytes = mtd->writesize + mtd->oobsize; in fsl_ifc_cmdfunc()
430 ctrl->read_bytes = 256; in fsl_ifc_cmdfunc()
454 ctrl->read_bytes = 0; in fsl_ifc_cmdfunc()
461 ctrl->column = column; in fsl_ifc_cmdfunc()
462 ctrl->oob = 0; in fsl_ifc_cmdfunc()
514 ctrl->oob = 1; in fsl_ifc_cmdfunc()
517 set_addr(mtd, column, page_addr, ctrl->oob); in fsl_ifc_cmdfunc()
523 if (ctrl->oob) in fsl_ifc_cmdfunc()
525 ctrl->index - ctrl->column); in fsl_ifc_cmdfunc()
540 ctrl->read_bytes = 1; in fsl_ifc_cmdfunc()
549 ifc_out16(ctrl->addr, in fsl_ifc_cmdfunc()
550 ifc_in16(ctrl->addr) | NAND_STATUS_WP); in fsl_ifc_cmdfunc()
552 out_8(ctrl->addr, in_8(ctrl->addr) | NAND_STATUS_WP); in fsl_ifc_cmdfunc()
576 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_write_buf() local
581 ctrl->status = 0; in fsl_ifc_write_buf()
585 if ((unsigned int)len > bufsize - ctrl->index) { in fsl_ifc_write_buf()
588 __func__, len, bufsize - ctrl->index); in fsl_ifc_write_buf()
589 len = bufsize - ctrl->index; in fsl_ifc_write_buf()
592 memcpy_toio(ctrl->addr + ctrl->index, buf, len); in fsl_ifc_write_buf()
593 ctrl->index += len; in fsl_ifc_write_buf()
604 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_read_byte() local
611 if (ctrl->index < ctrl->read_bytes) { in fsl_ifc_read_byte()
612 offset = ctrl->index++; in fsl_ifc_read_byte()
613 return in_8(ctrl->addr + offset); in fsl_ifc_read_byte()
628 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_read_byte16() local
635 if (ctrl->index < ctrl->read_bytes) { in fsl_ifc_read_byte16()
636 data = ifc_in16(ctrl->addr + ctrl->index); in fsl_ifc_read_byte16()
637 ctrl->index += 2; in fsl_ifc_read_byte16()
652 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_read_buf() local
658 avail = min((unsigned int)len, ctrl->read_bytes - ctrl->index); in fsl_ifc_read_buf()
659 memcpy_fromio(buf, ctrl->addr + ctrl->index, avail); in fsl_ifc_read_buf()
660 ctrl->index += avail; in fsl_ifc_read_buf()
674 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_wait() local
675 struct fsl_ifc_runtime *ifc = ctrl->regs.rregs; in fsl_ifc_wait()
679 if (ctrl->status != IFC_NAND_EVTER_STAT_OPC) in fsl_ifc_wait()
690 ctrl->read_bytes = 1; in fsl_ifc_wait()
694 if (ctrl->status != IFC_NAND_EVTER_STAT_OPC) in fsl_ifc_wait()
741 struct fsl_ifc_ctrl *ctrl = priv->ctrl; in fsl_ifc_read_page() local
746 if (ctrl->status & IFC_NAND_EVTER_STAT_ECCER) in fsl_ifc_read_page()
749 if (ctrl->status != IFC_NAND_EVTER_STAT_OPC) in fsl_ifc_read_page()
902 priv->ctrl = ifc_ctrl; in fsl_ifc_chip_init()