Lines Matching refs:chip
441 static int zynq_nand_read_oob(struct mtd_info *mtd, struct nand_chip *chip, in zynq_nand_read_oob() argument
448 chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); in zynq_nand_read_oob()
450 p = chip->oob_poi; in zynq_nand_read_oob()
451 chip->read_buf(mtd, p, (mtd->oobsize - data_width)); in zynq_nand_read_oob()
454 data_phase_addr = (unsigned long)chip->IO_ADDR_R; in zynq_nand_read_oob()
456 chip->IO_ADDR_R = (void __iomem *)data_phase_addr; in zynq_nand_read_oob()
457 chip->read_buf(mtd, p, data_width); in zynq_nand_read_oob()
468 static int zynq_nand_write_oob(struct mtd_info *mtd, struct nand_chip *chip, in zynq_nand_write_oob() argument
472 const u8 *buf = chip->oob_poi; in zynq_nand_write_oob()
475 chip->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize, page); in zynq_nand_write_oob()
477 chip->write_buf(mtd, buf, (mtd->oobsize - data_width)); in zynq_nand_write_oob()
480 data_phase_addr = (unsigned long)chip->IO_ADDR_W; in zynq_nand_write_oob()
483 chip->IO_ADDR_W = (void __iomem *)data_phase_addr; in zynq_nand_write_oob()
484 chip->write_buf(mtd, buf, data_width); in zynq_nand_write_oob()
487 chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1); in zynq_nand_write_oob()
488 status = chip->waitfunc(mtd, chip); in zynq_nand_write_oob()
501 static int zynq_nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, in zynq_nand_read_page_raw() argument
508 chip->read_buf(mtd, buf, mtd->writesize); in zynq_nand_read_page_raw()
510 p = chip->oob_poi; in zynq_nand_read_page_raw()
511 chip->read_buf(mtd, p, (mtd->oobsize - data_width)); in zynq_nand_read_page_raw()
514 data_phase_addr = (unsigned long)chip->IO_ADDR_R; in zynq_nand_read_page_raw()
516 chip->IO_ADDR_R = (void __iomem *)data_phase_addr; in zynq_nand_read_page_raw()
518 chip->read_buf(mtd, p, data_width); in zynq_nand_read_page_raw()
523 struct nand_chip *chip, u8 *buf, int oob_required, int page) in zynq_nand_read_page_raw_nooob() argument
525 chip->read_buf(mtd, buf, mtd->writesize); in zynq_nand_read_page_raw_nooob()
530 struct nand_chip *chip, u32 data_offs, in zynq_nand_read_subpage_raw() argument
534 chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_offs, -1); in zynq_nand_read_subpage_raw()
537 chip->read_buf(mtd, buf, readlen); in zynq_nand_read_subpage_raw()
550 struct nand_chip *chip, const u8 *buf, int oob_required, int page) in zynq_nand_write_page_raw() argument
556 chip->write_buf(mtd, buf, mtd->writesize); in zynq_nand_write_page_raw()
558 p = chip->oob_poi; in zynq_nand_write_page_raw()
559 chip->write_buf(mtd, p, (mtd->oobsize - data_width)); in zynq_nand_write_page_raw()
562 data_phase_addr = (unsigned long)chip->IO_ADDR_W; in zynq_nand_write_page_raw()
565 chip->IO_ADDR_W = (void __iomem *)data_phase_addr; in zynq_nand_write_page_raw()
567 chip->write_buf(mtd, p, data_width); in zynq_nand_write_page_raw()
582 struct nand_chip *chip, const u8 *buf, int oob_required, int page) in zynq_nand_write_page_hwecc() argument
584 int i, eccsteps, eccsize = chip->ecc.size; in zynq_nand_write_page_hwecc()
585 u8 *ecc_calc = chip->buffers->ecccalc; in zynq_nand_write_page_hwecc()
587 u32 *eccpos = chip->ecc.layout->eccpos; in zynq_nand_write_page_hwecc()
592 for (eccsteps = chip->ecc.steps; (eccsteps - 1); eccsteps--) { in zynq_nand_write_page_hwecc()
593 chip->write_buf(mtd, p, eccsize); in zynq_nand_write_page_hwecc()
596 chip->write_buf(mtd, p, (eccsize - data_width)); in zynq_nand_write_page_hwecc()
600 data_phase_addr = (unsigned long) chip->IO_ADDR_W; in zynq_nand_write_page_hwecc()
602 chip->IO_ADDR_W = (void __iomem *)data_phase_addr; in zynq_nand_write_page_hwecc()
603 chip->write_buf(mtd, p, data_width); in zynq_nand_write_page_hwecc()
607 chip->ecc.calculate(mtd, p, &ecc_calc[0]); in zynq_nand_write_page_hwecc()
609 for (i = 0; i < chip->ecc.total; i++) in zynq_nand_write_page_hwecc()
610 chip->oob_poi[eccpos[i]] = ~(ecc_calc[i]); in zynq_nand_write_page_hwecc()
613 data_phase_addr = (unsigned long)chip->IO_ADDR_W; in zynq_nand_write_page_hwecc()
615 chip->IO_ADDR_W = (void __iomem *)data_phase_addr; in zynq_nand_write_page_hwecc()
618 oob_ptr = chip->oob_poi; in zynq_nand_write_page_hwecc()
619 chip->write_buf(mtd, oob_ptr, (mtd->oobsize - data_width)); in zynq_nand_write_page_hwecc()
621 data_phase_addr = (unsigned long)chip->IO_ADDR_W; in zynq_nand_write_page_hwecc()
624 chip->IO_ADDR_W = (void __iomem *)data_phase_addr; in zynq_nand_write_page_hwecc()
626 chip->write_buf(mtd, oob_ptr, data_width); in zynq_nand_write_page_hwecc()
640 struct nand_chip *chip, const u8 *buf, int oob_required, int page) in zynq_nand_write_page_swecc() argument
642 int i, eccsize = chip->ecc.size; in zynq_nand_write_page_swecc()
643 int eccbytes = chip->ecc.bytes; in zynq_nand_write_page_swecc()
644 int eccsteps = chip->ecc.steps; in zynq_nand_write_page_swecc()
645 u8 *ecc_calc = chip->buffers->ecccalc; in zynq_nand_write_page_swecc()
647 u32 *eccpos = chip->ecc.layout->eccpos; in zynq_nand_write_page_swecc()
651 chip->ecc.calculate(mtd, p, &ecc_calc[i]); in zynq_nand_write_page_swecc()
653 for (i = 0; i < chip->ecc.total; i++) in zynq_nand_write_page_swecc()
654 chip->oob_poi[eccpos[i]] = ecc_calc[i]; in zynq_nand_write_page_swecc()
656 return chip->ecc.write_page_raw(mtd, chip, buf, 1, page); in zynq_nand_write_page_swecc()
673 struct nand_chip *chip, u8 *buf, int oob_required, int page) in zynq_nand_read_page_hwecc() argument
675 int i, stat, eccsteps, eccsize = chip->ecc.size; in zynq_nand_read_page_hwecc()
676 int eccbytes = chip->ecc.bytes; in zynq_nand_read_page_hwecc()
678 u8 *ecc_calc = chip->buffers->ecccalc; in zynq_nand_read_page_hwecc()
679 u8 *ecc_code = chip->buffers->ecccode; in zynq_nand_read_page_hwecc()
680 u32 *eccpos = chip->ecc.layout->eccpos; in zynq_nand_read_page_hwecc()
685 for (eccsteps = chip->ecc.steps; (eccsteps - 1); eccsteps--) { in zynq_nand_read_page_hwecc()
686 chip->read_buf(mtd, p, eccsize); in zynq_nand_read_page_hwecc()
689 chip->read_buf(mtd, p, (eccsize - data_width)); in zynq_nand_read_page_hwecc()
693 data_phase_addr = (unsigned long)chip->IO_ADDR_R; in zynq_nand_read_page_hwecc()
695 chip->IO_ADDR_R = (void __iomem *)data_phase_addr; in zynq_nand_read_page_hwecc()
696 chip->read_buf(mtd, p, data_width); in zynq_nand_read_page_hwecc()
700 chip->ecc.calculate(mtd, p, &ecc_calc[0]); in zynq_nand_read_page_hwecc()
703 data_phase_addr = (unsigned long)chip->IO_ADDR_R; in zynq_nand_read_page_hwecc()
705 chip->IO_ADDR_R = (void __iomem *)data_phase_addr; in zynq_nand_read_page_hwecc()
708 oob_ptr = chip->oob_poi; in zynq_nand_read_page_hwecc()
709 chip->read_buf(mtd, oob_ptr, (mtd->oobsize - data_width)); in zynq_nand_read_page_hwecc()
712 data_phase_addr = (unsigned long)chip->IO_ADDR_R; in zynq_nand_read_page_hwecc()
714 chip->IO_ADDR_R = (void __iomem *)data_phase_addr; in zynq_nand_read_page_hwecc()
717 chip->read_buf(mtd, oob_ptr, data_width); in zynq_nand_read_page_hwecc()
719 for (i = 0; i < chip->ecc.total; i++) in zynq_nand_read_page_hwecc()
720 ecc_code[i] = ~(chip->oob_poi[eccpos[i]]); in zynq_nand_read_page_hwecc()
722 eccsteps = chip->ecc.steps; in zynq_nand_read_page_hwecc()
727 stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]); in zynq_nand_read_page_hwecc()
745 struct nand_chip *chip, u8 *buf, int oob_required, int page) in zynq_nand_read_page_swecc() argument
747 int i, eccsize = chip->ecc.size; in zynq_nand_read_page_swecc()
748 int eccbytes = chip->ecc.bytes; in zynq_nand_read_page_swecc()
749 int eccsteps = chip->ecc.steps; in zynq_nand_read_page_swecc()
751 u8 *ecc_calc = chip->buffers->ecccalc; in zynq_nand_read_page_swecc()
752 u8 *ecc_code = chip->buffers->ecccode; in zynq_nand_read_page_swecc()
753 u32 *eccpos = chip->ecc.layout->eccpos; in zynq_nand_read_page_swecc()
755 chip->ecc.read_page_raw(mtd, chip, buf, 1, page); in zynq_nand_read_page_swecc()
758 chip->ecc.calculate(mtd, p, &ecc_calc[i]); in zynq_nand_read_page_swecc()
760 for (i = 0; i < chip->ecc.total; i++) in zynq_nand_read_page_swecc()
761 ecc_code[i] = chip->oob_poi[eccpos[i]]; in zynq_nand_read_page_swecc()
763 eccsteps = chip->ecc.steps; in zynq_nand_read_page_swecc()
769 stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]); in zynq_nand_read_page_swecc()
786 static void zynq_nand_select_chip(struct mtd_info *mtd, int chip) in zynq_nand_select_chip() argument
801 struct nand_chip *chip = mtd_to_nand(mtd); in zynq_nand_cmd_function() local
802 struct nand_drv *smc = nand_get_controller_data(chip); in zynq_nand_cmd_function()
857 addr_cycles = chip->onfi_params.addr_cycles & in zynq_nand_cmd_function()
859 addr_cycles += ((chip->onfi_params.addr_cycles & in zynq_nand_cmd_function()
884 chip->IO_ADDR_R = (void __iomem *)data_phase_addr; in zynq_nand_cmd_function()
885 chip->IO_ADDR_W = chip->IO_ADDR_R; in zynq_nand_cmd_function()
890 if (chip->options & NAND_BUSWIDTH_16) in zynq_nand_cmd_function()
896 if (chip->chipsize > (128 << 20)) { in zynq_nand_cmd_function()
907 if ((chip->options & NAND_BUSWIDTH_16) && in zynq_nand_cmd_function()
941 struct nand_chip *chip = mtd_to_nand(mtd); in zynq_nand_read_buf() local
947 *buf = readb(chip->IO_ADDR_R); in zynq_nand_read_buf()
955 *(u16 *)buf = readw(chip->IO_ADDR_R); in zynq_nand_read_buf()
964 *(u32 *)buf = readl(chip->IO_ADDR_R); in zynq_nand_read_buf()
972 *(u16 *)buf = readw(chip->IO_ADDR_R); in zynq_nand_read_buf()
977 *buf = readb(chip->IO_ADDR_R); in zynq_nand_read_buf()
989 struct nand_chip *chip = mtd_to_nand(mtd); in zynq_nand_write_buf() local
990 const u32 *nand = chip->IO_ADDR_W; in zynq_nand_write_buf()