Lines Matching refs:chip
149 struct nand_chip chip; member
155 static inline struct stm32_fmc2_nand *to_fmc2_nand(struct nand_chip *chip) in to_fmc2_nand() argument
157 return container_of(chip, struct stm32_fmc2_nand, chip); in to_fmc2_nand()
179 static void stm32_fmc2_nfc_timings_init(struct nand_chip *chip) in stm32_fmc2_nfc_timings_init() argument
181 struct stm32_fmc2_nfc *nfc = to_stm32_nfc(chip->controller); in stm32_fmc2_nfc_timings_init()
182 struct stm32_fmc2_nand *nand = to_fmc2_nand(chip); in stm32_fmc2_nfc_timings_init()
207 static void stm32_fmc2_nfc_setup(struct nand_chip *chip) in stm32_fmc2_nfc_setup() argument
209 struct stm32_fmc2_nfc *nfc = to_stm32_nfc(chip->controller); in stm32_fmc2_nfc_setup()
215 if (chip->ecc.strength == FMC2_ECC_BCH8) { in stm32_fmc2_nfc_setup()
218 } else if (chip->ecc.strength == FMC2_ECC_BCH4) { in stm32_fmc2_nfc_setup()
224 if (chip->options & NAND_BUSWIDTH_16) in stm32_fmc2_nfc_setup()
236 struct nand_chip *chip = mtd_to_nand(mtd); in stm32_fmc2_nfc_select_chip() local
237 struct stm32_fmc2_nfc *nfc = to_stm32_nfc(chip->controller); in stm32_fmc2_nfc_select_chip()
238 struct stm32_fmc2_nand *nand = to_fmc2_nand(chip); in stm32_fmc2_nfc_select_chip()
247 chip->IO_ADDR_R = (void __iomem *)nfc->data_base[nfc->cs_sel]; in stm32_fmc2_nfc_select_chip()
248 chip->IO_ADDR_W = (void __iomem *)nfc->data_base[nfc->cs_sel]; in stm32_fmc2_nfc_select_chip()
250 stm32_fmc2_nfc_setup(chip); in stm32_fmc2_nfc_select_chip()
251 stm32_fmc2_nfc_timings_init(chip); in stm32_fmc2_nfc_select_chip()
279 struct nand_chip *chip = mtd_to_nand(mtd); in stm32_fmc2_nfc_cmd_ctrl() local
280 struct stm32_fmc2_nfc *nfc = to_stm32_nfc(chip->controller); in stm32_fmc2_nfc_cmd_ctrl()
299 struct nand_chip *chip = mtd_to_nand(mtd); in stm32_fmc2_nfc_hwctl() local
300 struct stm32_fmc2_nfc *nfc = to_stm32_nfc(chip->controller); in stm32_fmc2_nfc_hwctl()
304 if (chip->ecc.strength != FMC2_ECC_HAM) { in stm32_fmc2_nfc_hwctl()
322 struct nand_chip *chip = mtd_to_nand(mtd); in stm32_fmc2_nfc_ham_calculate() local
323 struct stm32_fmc2_nfc *nfc = to_stm32_nfc(chip->controller); in stm32_fmc2_nfc_ham_calculate()
406 struct nand_chip *chip = mtd_to_nand(mtd); in stm32_fmc2_nfc_bch_calculate() local
407 struct stm32_fmc2_nfc *nfc = to_stm32_nfc(chip->controller); in stm32_fmc2_nfc_bch_calculate()
431 if (chip->ecc.strength == FMC2_ECC_BCH8) { in stm32_fmc2_nfc_bch_calculate()
452 struct nand_chip *chip = mtd_to_nand(mtd); in stm32_fmc2_nfc_bch_correct() local
453 struct stm32_fmc2_nfc *nfc = to_stm32_nfc(chip->controller); in stm32_fmc2_nfc_bch_correct()
456 int i, ret, den, eccsize = chip->ecc.size; in stm32_fmc2_nfc_bch_correct()
504 struct nand_chip *chip, u8 *buf, in stm32_fmc2_nfc_read_page() argument
507 int i, s, stat, eccsize = chip->ecc.size; in stm32_fmc2_nfc_read_page()
508 int eccbytes = chip->ecc.bytes; in stm32_fmc2_nfc_read_page()
509 int eccsteps = chip->ecc.steps; in stm32_fmc2_nfc_read_page()
510 int eccstrength = chip->ecc.strength; in stm32_fmc2_nfc_read_page()
512 u8 *ecc_calc = chip->buffers->ecccalc; in stm32_fmc2_nfc_read_page()
513 u8 *ecc_code = chip->buffers->ecccode; in stm32_fmc2_nfc_read_page()
518 chip->ecc.hwctl(mtd, NAND_ECC_READ); in stm32_fmc2_nfc_read_page()
521 chip->cmdfunc(mtd, NAND_CMD_RNDOUT, s * eccsize, -1); in stm32_fmc2_nfc_read_page()
522 chip->read_buf(mtd, p, eccsize); in stm32_fmc2_nfc_read_page()
525 chip->cmdfunc(mtd, NAND_CMD_RNDOUT, i, -1); in stm32_fmc2_nfc_read_page()
526 chip->read_buf(mtd, ecc_code, eccbytes); in stm32_fmc2_nfc_read_page()
529 stat = chip->ecc.correct(mtd, p, ecc_code, ecc_calc); in stm32_fmc2_nfc_read_page()
547 chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1); in stm32_fmc2_nfc_read_page()
548 chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); in stm32_fmc2_nfc_read_page()
595 static void stm32_fmc2_nfc_calc_timings(struct nand_chip *chip, in stm32_fmc2_nfc_calc_timings() argument
598 struct stm32_fmc2_nfc *nfc = to_stm32_nfc(chip->controller); in stm32_fmc2_nfc_calc_timings()
599 struct stm32_fmc2_nand *nand = to_fmc2_nand(chip); in stm32_fmc2_nfc_calc_timings()
728 struct nand_chip *chip = mtd_to_nand(mtd); in stm32_fmc2_nfc_setup_interface() local
738 stm32_fmc2_nfc_calc_timings(chip, sdrt); in stm32_fmc2_nfc_setup_interface()
739 stm32_fmc2_nfc_timings_init(chip); in stm32_fmc2_nfc_setup_interface()
744 static void stm32_fmc2_nfc_nand_callbacks_setup(struct nand_chip *chip) in stm32_fmc2_nfc_nand_callbacks_setup() argument
746 chip->ecc.hwctl = stm32_fmc2_nfc_hwctl; in stm32_fmc2_nfc_nand_callbacks_setup()
752 if (chip->ecc.strength == FMC2_ECC_HAM) { in stm32_fmc2_nfc_nand_callbacks_setup()
754 chip->ecc.calculate = stm32_fmc2_nfc_ham_calculate; in stm32_fmc2_nfc_nand_callbacks_setup()
755 chip->ecc.correct = stm32_fmc2_nfc_ham_correct; in stm32_fmc2_nfc_nand_callbacks_setup()
756 chip->ecc.bytes = chip->options & NAND_BUSWIDTH_16 ? 4 : 3; in stm32_fmc2_nfc_nand_callbacks_setup()
757 chip->ecc.options |= NAND_ECC_GENERIC_ERASED_CHECK; in stm32_fmc2_nfc_nand_callbacks_setup()
762 chip->ecc.read_page = stm32_fmc2_nfc_read_page; in stm32_fmc2_nfc_nand_callbacks_setup()
763 chip->ecc.calculate = stm32_fmc2_nfc_bch_calculate; in stm32_fmc2_nfc_nand_callbacks_setup()
764 chip->ecc.correct = stm32_fmc2_nfc_bch_correct; in stm32_fmc2_nfc_nand_callbacks_setup()
766 if (chip->ecc.strength == FMC2_ECC_BCH8) in stm32_fmc2_nfc_nand_callbacks_setup()
767 chip->ecc.bytes = chip->options & NAND_BUSWIDTH_16 ? 14 : 13; in stm32_fmc2_nfc_nand_callbacks_setup()
769 chip->ecc.bytes = chip->options & NAND_BUSWIDTH_16 ? 8 : 7; in stm32_fmc2_nfc_nand_callbacks_setup()
826 nand->chip.flash_node = ofnode_to_offset(node); in stm32_fmc2_nfc_parse_child()
887 struct nand_chip *chip = &nand->chip; in stm32_fmc2_nfc_probe() local
888 struct mtd_info *mtd = &chip->mtd; in stm32_fmc2_nfc_probe()
961 chip->controller = &nfc->base; in stm32_fmc2_nfc_probe()
962 chip->select_chip = stm32_fmc2_nfc_select_chip; in stm32_fmc2_nfc_probe()
963 chip->setup_data_interface = stm32_fmc2_nfc_setup_interface; in stm32_fmc2_nfc_probe()
964 chip->cmd_ctrl = stm32_fmc2_nfc_cmd_ctrl; in stm32_fmc2_nfc_probe()
965 chip->chip_delay = FMC2_RB_DELAY_US; in stm32_fmc2_nfc_probe()
966 chip->options |= NAND_BUSWIDTH_AUTO | NAND_NO_SUBPAGE_WRITE | in stm32_fmc2_nfc_probe()
970 chip->ecc.mode = NAND_ECC_HW; in stm32_fmc2_nfc_probe()
971 chip->ecc.size = FMC2_ECC_STEP_SIZE; in stm32_fmc2_nfc_probe()
972 chip->ecc.strength = FMC2_ECC_BCH8; in stm32_fmc2_nfc_probe()
985 if (chip->ecc.mode != NAND_ECC_HW) { in stm32_fmc2_nfc_probe()
990 ret = nand_check_ecc_caps(chip, &stm32_fmc2_nfc_ecc_caps, in stm32_fmc2_nfc_probe()
997 if (chip->bbt_options & NAND_BBT_USE_FLASH) in stm32_fmc2_nfc_probe()
998 chip->bbt_options |= NAND_BBT_NO_OOB; in stm32_fmc2_nfc_probe()
1000 stm32_fmc2_nfc_nand_callbacks_setup(chip); in stm32_fmc2_nfc_probe()
1004 ecclayout->eccbytes = chip->ecc.bytes * in stm32_fmc2_nfc_probe()
1005 (mtd->writesize / chip->ecc.size); in stm32_fmc2_nfc_probe()
1011 chip->ecc.layout = ecclayout; in stm32_fmc2_nfc_probe()
1013 if (chip->options & NAND_BUSWIDTH_16) in stm32_fmc2_nfc_probe()