static void nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len) { int i; struct nand_chip *chip = mtd->priv; struct fsl_upm_nand *fun = chip->priv; for (i = 0; i < len; i++) { out_8(chip->IO_ADDR_W, buf[i]); if (fun->wait_flags & FSL_UPM_WAIT_WRITE_BYTE) fun_wait(fun); } if (fun->wait_flags & FSL_UPM_WAIT_WRITE_BUFFER) fun_wait(fun); }
static void upm_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len) { int i; struct nand_chip *chip = mtd_to_nand(mtd); struct fsl_upm_nand *fun = nand_get_controller_data(chip); for (i = 0; i < len; i++) { out_8(chip->IO_ADDR_W, buf[i]); if (fun->wait_flags & FSL_UPM_WAIT_WRITE_BYTE) fun_wait(fun); } if (fun->wait_flags & FSL_UPM_WAIT_WRITE_BUFFER) fun_wait(fun); }
static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) { struct nand_chip *chip = mtd->priv; struct fsl_upm_nand *fun = chip->priv; void __iomem *io_addr; u32 mar; if (!(ctrl & fun->last_ctrl)) { fsl_upm_end_pattern(&fun->upm); if (cmd == NAND_CMD_NONE) return; fun->last_ctrl = ctrl & (NAND_ALE | NAND_CLE); } if (ctrl & NAND_CTRL_CHANGE) { if (ctrl & NAND_ALE) fsl_upm_start_pattern(&fun->upm, fun->upm_addr_offset); else if (ctrl & NAND_CLE) fsl_upm_start_pattern(&fun->upm, fun->upm_cmd_offset); } mar = cmd << (32 - fun->width); io_addr = fun->upm.io_addr; #if CONFIG_SYS_NAND_MAX_CHIPS > 1 if (fun->chip_nr > 0) { io_addr += fun->chip_offset * fun->chip_nr; if (fun->upm_mar_chip_offset) mar |= fun->upm_mar_chip_offset * fun->chip_nr; } #endif fsl_upm_run_pattern(&fun->upm, fun->width, io_addr, mar); /* * Some boards/chips needs this. At least the MPC8360E-RDK and * TQM8548 need it. Probably weird chip, because I don't see * any need for this on MPC8555E + Samsung K9F1G08U0A. Usually * here are 0-2 unexpected busy states per block read. */ if (fun->wait_flags & FSL_UPM_WAIT_RUN_PATTERN) fun_wait(fun); }