Lines Matching refs:anand
154 struct anand { struct
195 static struct anand *to_anand(struct nand_chip *nand) in to_anand()
197 return container_of(nand, struct anand, chip); in to_anand()
226 struct anand *anand = to_anand(chip); in anfc_wait_for_rb() local
232 val & BIT(anand->rb), in anfc_wait_for_rb()
277 struct anand *anand = to_anand(chip); in anfc_select_target() local
282 writel_relaxed(anand->timings, nfc->base + DATA_INTERFACE_REG); in anfc_select_target()
285 if (nfc->cur_clk != anand->clk) { in anfc_select_target()
287 ret = clk_set_rate(nfc->bus_clk, anand->clk); in anfc_select_target()
300 nfc->cur_clk = anand->clk; in anfc_select_target()
333 struct anand *anand = to_anand(chip); in anfc_read_page_hw_ecc() local
343 (page & 0xFF) << (8 * (anand->caddr_cycles)) | in anfc_read_page_hw_ecc()
344 (((page >> 8) & 0xFF) << (8 * (1 + anand->caddr_cycles))), in anfc_read_page_hw_ecc()
347 ADDR2_STRENGTH(anand->strength) | in anfc_read_page_hw_ecc()
348 ADDR2_CS(anand->cs), in anfc_read_page_hw_ecc()
352 CMD_PAGE_SIZE(anand->page_sz) | in anfc_read_page_hw_ecc()
354 CMD_NADDRS(anand->caddr_cycles + in anfc_read_page_hw_ecc()
355 anand->raddr_cycles), in anfc_read_page_hw_ecc()
394 memset(anand->hw_ecc, 0, chip->ecc.bytes); in anfc_read_page_hw_ecc()
395 nand_extract_bits(anand->hw_ecc, 0, in anfc_read_page_hw_ecc()
396 &chip->oob_poi[mtd->oobsize - anand->ecc_total], in anfc_read_page_hw_ecc()
397 anand->ecc_bits * step, anand->ecc_bits); in anfc_read_page_hw_ecc()
399 bf = bch_decode(anand->bch, raw_buf, chip->ecc.size, in anfc_read_page_hw_ecc()
400 anand->hw_ecc, NULL, NULL, anand->errloc); in anfc_read_page_hw_ecc()
406 if (anand->errloc[i] < (chip->ecc.size * 8)) { in anfc_read_page_hw_ecc()
407 bit = BIT(anand->errloc[i] & 7); in anfc_read_page_hw_ecc()
408 byte = anand->errloc[i] >> 3; in anfc_read_page_hw_ecc()
449 struct anand *anand = to_anand(chip); in anfc_write_page_hw_ecc() local
460 (page & 0xFF) << (8 * (anand->caddr_cycles)) | in anfc_write_page_hw_ecc()
461 (((page >> 8) & 0xFF) << (8 * (1 + anand->caddr_cycles))), in anfc_write_page_hw_ecc()
464 ADDR2_STRENGTH(anand->strength) | in anfc_write_page_hw_ecc()
465 ADDR2_CS(anand->cs), in anfc_write_page_hw_ecc()
469 CMD_PAGE_SIZE(anand->page_sz) | in anfc_write_page_hw_ecc()
471 CMD_NADDRS(anand->caddr_cycles + in anfc_write_page_hw_ecc()
472 anand->raddr_cycles) | in anfc_write_page_hw_ecc()
477 writel_relaxed(anand->ecc_conf, nfc->base + ECC_CONF_REG); in anfc_write_page_hw_ecc()
479 ECC_SP_ADDRS(anand->caddr_cycles), in anfc_write_page_hw_ecc()
523 struct anand *anand = to_anand(chip); in anfc_parse_instructions() local
530 nfc_op->addr2_reg = ADDR2_CS(anand->cs); in anfc_parse_instructions()
531 nfc_op->cmd_reg = CMD_PAGE_SIZE(anand->page_sz); in anfc_parse_instructions()
884 struct anand *anand = to_anand(chip); in anfc_setup_interface() local
919 anand->timings = DIFACE_SDR | in anfc_setup_interface()
922 anand->timings = DIFACE_NVDDR | in anfc_setup_interface()
926 anand->clk = ANFC_XLNX_SDR_DFLT_CORE_CLK; in anfc_setup_interface()
929 anand->clk = div_u64((u64)NSEC_PER_SEC * 1000, in anfc_setup_interface()
941 anand->clk = ANFC_XLNX_SDR_HS_CORE_CLK; in anfc_setup_interface()
992 struct anand *anand = to_anand(chip); in anfc_init_hw_ecc_controller() local
1016 anand->strength = 0x1; in anfc_init_hw_ecc_controller()
1019 anand->strength = 0x2; in anfc_init_hw_ecc_controller()
1022 anand->strength = 0x3; in anfc_init_hw_ecc_controller()
1025 anand->strength = 0x4; in anfc_init_hw_ecc_controller()
1050 anand->ecc_bits = bch_gf_mag * ecc->strength; in anfc_init_hw_ecc_controller()
1051 ecc->bytes = DIV_ROUND_UP(anand->ecc_bits, 8); in anfc_init_hw_ecc_controller()
1052 anand->ecc_total = DIV_ROUND_UP(anand->ecc_bits * ecc->steps, 8); in anfc_init_hw_ecc_controller()
1053 ecc_offset = mtd->writesize + mtd->oobsize - anand->ecc_total; in anfc_init_hw_ecc_controller()
1054 anand->ecc_conf = ECC_CONF_COL(ecc_offset) | in anfc_init_hw_ecc_controller()
1055 ECC_CONF_LEN(anand->ecc_total) | in anfc_init_hw_ecc_controller()
1058 anand->errloc = devm_kmalloc_array(nfc->dev, ecc->strength, in anfc_init_hw_ecc_controller()
1059 sizeof(*anand->errloc), GFP_KERNEL); in anfc_init_hw_ecc_controller()
1060 if (!anand->errloc) in anfc_init_hw_ecc_controller()
1063 anand->hw_ecc = devm_kmalloc(nfc->dev, ecc->bytes, GFP_KERNEL); in anfc_init_hw_ecc_controller()
1064 if (!anand->hw_ecc) in anfc_init_hw_ecc_controller()
1068 anand->bch = bch_init(bch_gf_mag, ecc->strength, bch_prim_poly, true); in anfc_init_hw_ecc_controller()
1069 if (!anand->bch) in anfc_init_hw_ecc_controller()
1080 struct anand *anand = to_anand(chip); in anfc_attach_chip() local
1086 anand->caddr_cycles = 1; in anfc_attach_chip()
1088 anand->caddr_cycles = 2; in anfc_attach_chip()
1091 anand->raddr_cycles = 3; in anfc_attach_chip()
1093 anand->raddr_cycles = 2; in anfc_attach_chip()
1097 anand->page_sz = 0; in anfc_attach_chip()
1100 anand->page_sz = 5; in anfc_attach_chip()
1103 anand->page_sz = 1; in anfc_attach_chip()
1106 anand->page_sz = 2; in anfc_attach_chip()
1109 anand->page_sz = 3; in anfc_attach_chip()
1112 anand->page_sz = 4; in anfc_attach_chip()
1141 struct anand *anand = to_anand(chip); in anfc_detach_chip() local
1143 if (anand->bch) in anfc_detach_chip()
1144 bch_free(anand->bch); in anfc_detach_chip()
1156 struct anand *anand; in anfc_chip_init() local
1161 anand = devm_kzalloc(nfc->dev, sizeof(*anand), GFP_KERNEL); in anfc_chip_init()
1162 if (!anand) in anfc_chip_init()
1189 anand->cs = cs; in anfc_chip_init()
1190 anand->rb = rb; in anfc_chip_init()
1192 chip = &anand->chip; in anfc_chip_init()
1217 list_add_tail(&anand->node, &nfc->chips); in anfc_chip_init()
1224 struct anand *anand, *tmp; in anfc_chips_cleanup() local
1228 list_for_each_entry_safe(anand, tmp, &nfc->chips, node) { in anfc_chips_cleanup()
1229 chip = &anand->chip; in anfc_chips_cleanup()
1233 list_del(&anand->node); in anfc_chips_cleanup()