Lines Matching full:user

346 	struct atmel_pmecc_user *user;  in atmel_pmecc_create_user()  local
354 size = sizeof(*user); in atmel_pmecc_create_user()
365 user = kzalloc(size, GFP_KERNEL); in atmel_pmecc_create_user()
366 if (!user) in atmel_pmecc_create_user()
369 user->pmecc = pmecc; in atmel_pmecc_create_user()
371 user->partial_syn = (s16 *)PTR_ALIGN(user + 1, sizeof(u16)); in atmel_pmecc_create_user()
372 user->si = user->partial_syn + ((2 * req->ecc.strength) + 1); in atmel_pmecc_create_user()
373 user->lmu = user->si + ((2 * req->ecc.strength) + 1); in atmel_pmecc_create_user()
374 user->smu = user->lmu + (req->ecc.strength + 1); in atmel_pmecc_create_user()
375 user->mu = (s32 *)PTR_ALIGN(user->smu + in atmel_pmecc_create_user()
379 user->dmu = user->mu + req->ecc.strength + 1; in atmel_pmecc_create_user()
380 user->delta = user->dmu + req->ecc.strength + 1; in atmel_pmecc_create_user()
384 kfree(user); in atmel_pmecc_create_user()
388 user->gf_tables = gf_tables; in atmel_pmecc_create_user()
390 user->eccbytes = req->ecc.bytes / req->ecc.nsectors; in atmel_pmecc_create_user()
397 user->cache.cfg = PMECC_CFG_BCH_STRENGTH(strength) | in atmel_pmecc_create_user()
401 user->cache.cfg |= PMECC_CFG_SECTOR1024; in atmel_pmecc_create_user()
403 user->cache.sarea = req->oobsize - 1; in atmel_pmecc_create_user()
404 user->cache.saddr = req->ecc.ooboffset; in atmel_pmecc_create_user()
405 user->cache.eaddr = req->ecc.ooboffset + req->ecc.bytes - 1; in atmel_pmecc_create_user()
407 return user; in atmel_pmecc_create_user()
411 void atmel_pmecc_destroy_user(struct atmel_pmecc_user *user) in atmel_pmecc_destroy_user() argument
413 kfree(user); in atmel_pmecc_destroy_user()
417 static int get_strength(struct atmel_pmecc_user *user) in get_strength() argument
419 const int *strengths = user->pmecc->caps->strengths; in get_strength()
421 return strengths[user->cache.cfg & PMECC_CFG_BCH_STRENGTH_MASK]; in get_strength()
424 static int get_sectorsize(struct atmel_pmecc_user *user) in get_sectorsize() argument
426 return user->cache.cfg & PMECC_CFG_SECTOR1024 ? 1024 : 512; in get_sectorsize()
429 static void atmel_pmecc_gen_syndrome(struct atmel_pmecc_user *user, int sector) in atmel_pmecc_gen_syndrome() argument
431 int strength = get_strength(user); in atmel_pmecc_gen_syndrome()
437 value = readl_relaxed(user->pmecc->regs.base + in atmel_pmecc_gen_syndrome()
442 user->partial_syn[(2 * i) + 1] = value; in atmel_pmecc_gen_syndrome()
446 static void atmel_pmecc_substitute(struct atmel_pmecc_user *user) in atmel_pmecc_substitute() argument
448 int degree = get_sectorsize(user) == 512 ? 13 : 14; in atmel_pmecc_substitute()
450 int strength = get_strength(user); in atmel_pmecc_substitute()
451 s16 *alpha_to = user->gf_tables->alpha_to; in atmel_pmecc_substitute()
452 s16 *index_of = user->gf_tables->index_of; in atmel_pmecc_substitute()
453 s16 *partial_syn = user->partial_syn; in atmel_pmecc_substitute()
461 si = user->si; in atmel_pmecc_substitute()
487 static void atmel_pmecc_get_sigma(struct atmel_pmecc_user *user) in atmel_pmecc_get_sigma() argument
489 s16 *lmu = user->lmu; in atmel_pmecc_get_sigma()
490 s16 *si = user->si; in atmel_pmecc_get_sigma()
491 s32 *mu = user->mu; in atmel_pmecc_get_sigma()
492 s32 *dmu = user->dmu; in atmel_pmecc_get_sigma()
493 s32 *delta = user->delta; in atmel_pmecc_get_sigma()
494 int degree = get_sectorsize(user) == 512 ? 13 : 14; in atmel_pmecc_get_sigma()
496 int strength = get_strength(user); in atmel_pmecc_get_sigma()
498 s16 *index_of = user->gf_tables->index_of; in atmel_pmecc_get_sigma()
499 s16 *alpha_to = user->gf_tables->alpha_to; in atmel_pmecc_get_sigma()
502 s16 *smu = user->smu; in atmel_pmecc_get_sigma()
641 static int atmel_pmecc_err_location(struct atmel_pmecc_user *user) in atmel_pmecc_err_location() argument
643 int sector_size = get_sectorsize(user); in atmel_pmecc_err_location()
645 struct atmel_pmecc *pmecc = user->pmecc; in atmel_pmecc_err_location()
646 int strength = get_strength(user); in atmel_pmecc_err_location()
649 s16 *smu = user->smu; in atmel_pmecc_err_location()
654 for (i = 0; i <= user->lmu[strength + 1] >> 1; i++) { in atmel_pmecc_err_location()
680 if (roots_nbr == user->lmu[strength + 1] >> 1) in atmel_pmecc_err_location()
690 int atmel_pmecc_correct_sector(struct atmel_pmecc_user *user, int sector, in atmel_pmecc_correct_sector() argument
693 struct atmel_pmecc *pmecc = user->pmecc; in atmel_pmecc_correct_sector()
694 int sectorsize = get_sectorsize(user); in atmel_pmecc_correct_sector()
695 int eccbytes = user->eccbytes; in atmel_pmecc_correct_sector()
698 if (!(user->isr & BIT(sector))) in atmel_pmecc_correct_sector()
701 atmel_pmecc_gen_syndrome(user, sector); in atmel_pmecc_correct_sector()
702 atmel_pmecc_substitute(user); in atmel_pmecc_correct_sector()
703 atmel_pmecc_get_sigma(user); in atmel_pmecc_correct_sector()
705 nerrors = atmel_pmecc_err_location(user); in atmel_pmecc_correct_sector()
746 bool atmel_pmecc_correct_erased_chunks(struct atmel_pmecc_user *user) in atmel_pmecc_correct_erased_chunks() argument
748 return user->pmecc->caps->correct_erased_chunks; in atmel_pmecc_correct_erased_chunks()
752 void atmel_pmecc_get_generated_eccbytes(struct atmel_pmecc_user *user, in atmel_pmecc_get_generated_eccbytes() argument
755 struct atmel_pmecc *pmecc = user->pmecc; in atmel_pmecc_get_generated_eccbytes()
759 for (i = 0; i < user->eccbytes; i++) in atmel_pmecc_get_generated_eccbytes()
772 int atmel_pmecc_enable(struct atmel_pmecc_user *user, int op) in atmel_pmecc_enable() argument
774 struct atmel_pmecc *pmecc = user->pmecc; in atmel_pmecc_enable()
782 mutex_lock(&user->pmecc->lock); in atmel_pmecc_enable()
784 cfg = user->cache.cfg; in atmel_pmecc_enable()
791 writel(user->cache.sarea, pmecc->regs.base + ATMEL_PMECC_SAREA); in atmel_pmecc_enable()
792 writel(user->cache.saddr, pmecc->regs.base + ATMEL_PMECC_SADDR); in atmel_pmecc_enable()
793 writel(user->cache.eaddr, pmecc->regs.base + ATMEL_PMECC_EADDR); in atmel_pmecc_enable()
802 void atmel_pmecc_disable(struct atmel_pmecc_user *user) in atmel_pmecc_disable() argument
804 atmel_pmecc_reset(user->pmecc); in atmel_pmecc_disable()
805 mutex_unlock(&user->pmecc->lock); in atmel_pmecc_disable()
809 int atmel_pmecc_wait_rdy(struct atmel_pmecc_user *user) in atmel_pmecc_wait_rdy() argument
811 struct atmel_pmecc *pmecc = user->pmecc; in atmel_pmecc_wait_rdy()
825 user->isr = readl_relaxed(pmecc->regs.base + ATMEL_PMECC_ISR); in atmel_pmecc_wait_rdy()
950 * resources are directly defined in the user pdev at position in devm_atmel_pmecc_get()