Lines Matching defs:nand

14 #include <linux/mtd/nand.h>
15 #include <linux/mtd/nand-ecc-sw-bch.h>
19 * @nand: NAND device
23 int nand_ecc_sw_bch_calculate(struct nand_device *nand,
26 struct nand_ecc_sw_bch_conf *engine_conf = nand->ecc.ctx.priv;
30 bch_encode(engine_conf->bch, buf, nand->ecc.ctx.conf.step_size, code);
42 * @nand: NAND device
49 int nand_ecc_sw_bch_correct(struct nand_device *nand, unsigned char *buf,
52 struct nand_ecc_sw_bch_conf *engine_conf = nand->ecc.ctx.priv;
53 unsigned int step_size = nand->ecc.ctx.conf.step_size;
80 * @nand: NAND device
82 static void nand_ecc_sw_bch_cleanup(struct nand_device *nand)
84 struct nand_ecc_sw_bch_conf *engine_conf = nand->ecc.ctx.priv;
93 * @nand: NAND device
97 * Initialize NAND BCH error correction. @nand.ecc parameters 'step_size' and
108 static int nand_ecc_sw_bch_init(struct nand_device *nand)
110 struct nand_ecc_sw_bch_conf *engine_conf = nand->ecc.ctx.priv;
111 unsigned int eccsize = nand->ecc.ctx.conf.step_size;
165 nand_ecc_sw_bch_cleanup(nand);
170 int nand_ecc_sw_bch_init_ctx(struct nand_device *nand)
172 struct nand_ecc_props *conf = &nand->ecc.ctx.conf;
173 struct mtd_info *mtd = nanddev_to_mtd(nand);
189 conf->step_size = nand->ecc.user_conf.step_size;
190 conf->strength = nand->ecc.user_conf.strength;
210 if (nand->ecc.user_conf.flags & NAND_ECC_MAXIMIZE_STRENGTH) {
234 ret = nand_ecc_init_req_tweaking(&engine_conf->req_ctx, nand);
246 nand->ecc.ctx.priv = engine_conf;
247 nand->ecc.ctx.nsteps = nsteps;
248 nand->ecc.ctx.total = nsteps * code_size;
250 ret = nand_ecc_sw_bch_init(nand);
256 nand->ecc.ctx.nsteps * engine_conf->code_size) {
265 nand_ecc_sw_bch_cleanup(nand);
277 void nand_ecc_sw_bch_cleanup_ctx(struct nand_device *nand)
279 struct nand_ecc_sw_bch_conf *engine_conf = nand->ecc.ctx.priv;
282 nand_ecc_sw_bch_cleanup(nand);
291 static int nand_ecc_sw_bch_prepare_io_req(struct nand_device *nand,
294 struct nand_ecc_sw_bch_conf *engine_conf = nand->ecc.ctx.priv;
295 struct mtd_info *mtd = nanddev_to_mtd(nand);
296 int eccsize = nand->ecc.ctx.conf.step_size;
298 int eccsteps = nand->ecc.ctx.nsteps;
299 int total = nand->ecc.ctx.total;
322 nand_ecc_sw_bch_calculate(nand, data, &ecccalc[i]);
328 static int nand_ecc_sw_bch_finish_io_req(struct nand_device *nand,
331 struct nand_ecc_sw_bch_conf *engine_conf = nand->ecc.ctx.priv;
332 struct mtd_info *mtd = nanddev_to_mtd(nand);
333 int eccsize = nand->ecc.ctx.conf.step_size;
334 int total = nand->ecc.ctx.total;
336 int eccsteps = nand->ecc.ctx.nsteps;
365 nand_ecc_sw_bch_calculate(nand, data, &ecccalc[i]);
368 for (eccsteps = nand->ecc.ctx.nsteps, i = 0, data = req->databuf.in;
371 int stat = nand_ecc_sw_bch_correct(nand, data,