Lines Matching refs:master
504 struct mtd_info *master = mtd_get_master(mtd); in mtd_wunit_to_pairing_info() local
505 int npairs = mtd_wunit_per_eb(master) / mtd_pairing_groups(master); in mtd_wunit_to_pairing_info()
510 if (master->pairing && master->pairing->get_info) in mtd_wunit_to_pairing_info()
511 return master->pairing->get_info(master, wunit, info); in mtd_wunit_to_pairing_info()
547 struct mtd_info *master = mtd_get_master(mtd); in mtd_pairing_info_to_wunit() local
548 int ngroups = mtd_pairing_groups(master); in mtd_pairing_info_to_wunit()
549 int npairs = mtd_wunit_per_eb(master) / ngroups; in mtd_pairing_info_to_wunit()
555 if (master->pairing && master->pairing->get_wunit) in mtd_pairing_info_to_wunit()
556 return mtd->pairing->get_wunit(master, info); in mtd_pairing_info_to_wunit()
574 struct mtd_info *master = mtd_get_master(mtd); in mtd_pairing_groups() local
576 if (!master->pairing || !master->pairing->ngroups) in mtd_pairing_groups()
579 return master->pairing->ngroups; in mtd_pairing_groups()
696 struct mtd_info *master = mtd_get_master(mtd); in add_mtd_device() local
718 if (WARN_ON((!mtd->erasesize || !master->_erase) && in add_mtd_device()
731 (!mtd_is_partition(mtd) || master->type != MTD_MLCNANDFLASH || in add_mtd_device()
732 !master->pairing || master->_writev)) in add_mtd_device()
757 int ngroups = mtd_pairing_groups(master); in add_mtd_device()
760 mtd->size = (u64)mtd_div_by_eb(mtd->size, master) * in add_mtd_device()
903 mutex_init(&mtd->master.partitions_lock); in mtd_set_dev_defaults()
904 mutex_init(&mtd->master.chrdev_lock); in mtd_set_dev_defaults()
1177 int mtd_device_unregister(struct mtd_info *master) in mtd_device_unregister() argument
1181 if (master->_reboot) { in mtd_device_unregister()
1182 unregister_reboot_notifier(&master->reboot_notifier); in mtd_device_unregister()
1183 memset(&master->reboot_notifier, 0, sizeof(master->reboot_notifier)); in mtd_device_unregister()
1186 nvmem_unregister(master->otp_user_nvmem); in mtd_device_unregister()
1187 nvmem_unregister(master->otp_factory_nvmem); in mtd_device_unregister()
1189 err = del_mtd_partitions(master); in mtd_device_unregister()
1193 if (!device_is_registered(&master->dev)) in mtd_device_unregister()
1196 return del_mtd_device(master); in mtd_device_unregister()
1299 struct mtd_info *master = mtd_get_master(mtd); in __get_mtd_device() local
1302 if (master->_get_device) { in __get_mtd_device()
1303 err = master->_get_device(mtd); in __get_mtd_device()
1308 if (!try_module_get(master->owner)) { in __get_mtd_device()
1309 if (master->_put_device) in __get_mtd_device()
1310 master->_put_device(master); in __get_mtd_device()
1315 if (mtd != master) in __get_mtd_device()
1321 kref_get(&master->refcnt); in __get_mtd_device()
1404 struct mtd_info *master = mtd_get_master(mtd); in __put_mtd_device() local
1410 if (mtd != master) in __put_mtd_device()
1416 kref_put(&master->refcnt, mtd_device_release); in __put_mtd_device()
1418 module_put(master->owner); in __put_mtd_device()
1421 if (master->_put_device) in __put_mtd_device()
1422 master->_put_device(master); in __put_mtd_device()
1433 struct mtd_info *master = mtd_get_master(mtd); in mtd_erase() local
1441 if (!mtd->erasesize || !master->_erase) in mtd_erase()
1456 master->erasesize; in mtd_erase()
1458 master->erasesize) - in mtd_erase()
1464 ret = master->_erase(master, &adjinstr); in mtd_erase()
1470 master); in mtd_erase()
1486 struct mtd_info *master = mtd_get_master(mtd); in mtd_point() local
1492 if (!master->_point) in mtd_point()
1500 return master->_point(master, from, len, retlen, virt, phys); in mtd_point()
1507 struct mtd_info *master = mtd_get_master(mtd); in mtd_unpoint() local
1509 if (!master->_unpoint) in mtd_unpoint()
1515 return master->_unpoint(master, mtd_get_master_ofs(mtd, from), len); in mtd_unpoint()
1542 static void mtd_update_ecc_stats(struct mtd_info *mtd, struct mtd_info *master, in mtd_update_ecc_stats() argument
1547 if (master == mtd) in mtd_update_ecc_stats()
1550 diff = master->ecc_stats; in mtd_update_ecc_stats()
1607 struct mtd_info *master = mtd_get_master(mtd); in mtd_panic_write() local
1610 if (!master->_panic_write) in mtd_panic_write()
1618 if (!master->oops_panic_write) in mtd_panic_write()
1619 master->oops_panic_write = true; in mtd_panic_write()
1621 return master->_panic_write(master, mtd_get_master_ofs(mtd, to), len, in mtd_panic_write()
1662 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_oob_std() local
1666 if (master->_read_oob) in mtd_read_oob_std()
1667 ret = master->_read_oob(master, from, ops); in mtd_read_oob_std()
1669 ret = master->_read(master, from, ops->len, &ops->retlen, in mtd_read_oob_std()
1678 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_oob_std() local
1682 if (master->_write_oob) in mtd_write_oob_std()
1683 ret = master->_write_oob(master, to, ops); in mtd_write_oob_std()
1685 ret = master->_write(master, to, ops->len, &ops->retlen, in mtd_write_oob_std()
1694 struct mtd_info *master = mtd_get_master(mtd); in mtd_io_emulated_slc() local
1695 int ngroups = mtd_pairing_groups(master); in mtd_io_emulated_slc()
1696 int npairs = mtd_wunit_per_eb(master) / ngroups; in mtd_io_emulated_slc()
1705 base = (loff_t)mtd_div_by_eb(start, mtd) * master->erasesize; in mtd_io_emulated_slc()
1716 base += master->erasesize; in mtd_io_emulated_slc()
1719 wunit = mtd_pairing_info_to_wunit(master, &info); in mtd_io_emulated_slc()
1756 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_oob() local
1757 struct mtd_ecc_stats old_stats = master->ecc_stats; in mtd_read_oob()
1769 if (!master->_read_oob && (!master->_read || ops->oobbuf)) in mtd_read_oob()
1780 mtd_update_ecc_stats(mtd, master, &old_stats); in mtd_read_oob()
1801 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_oob() local
1816 if (!master->_write_oob && (!master->_write || ops->oobbuf)) in mtd_write_oob()
1845 struct mtd_info *master = mtd_get_master(mtd); in mtd_ooblayout_ecc() local
1849 if (!master || section < 0) in mtd_ooblayout_ecc()
1852 if (!master->ooblayout || !master->ooblayout->ecc) in mtd_ooblayout_ecc()
1855 return master->ooblayout->ecc(master, section, oobecc); in mtd_ooblayout_ecc()
1879 struct mtd_info *master = mtd_get_master(mtd); in mtd_ooblayout_free() local
1883 if (!master || section < 0) in mtd_ooblayout_free()
1886 if (!master->ooblayout || !master->ooblayout->free) in mtd_ooblayout_free()
1889 return master->ooblayout->free(master, section, oobfree); in mtd_ooblayout_free()
2198 struct mtd_info *master = mtd_get_master(mtd); in mtd_get_fact_prot_info() local
2200 if (!master->_get_fact_prot_info) in mtd_get_fact_prot_info()
2204 return master->_get_fact_prot_info(master, len, retlen, buf); in mtd_get_fact_prot_info()
2211 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_fact_prot_reg() local
2214 if (!master->_read_fact_prot_reg) in mtd_read_fact_prot_reg()
2218 return master->_read_fact_prot_reg(master, from, len, retlen, buf); in mtd_read_fact_prot_reg()
2225 struct mtd_info *master = mtd_get_master(mtd); in mtd_get_user_prot_info() local
2227 if (!master->_get_user_prot_info) in mtd_get_user_prot_info()
2231 return master->_get_user_prot_info(master, len, retlen, buf); in mtd_get_user_prot_info()
2238 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_user_prot_reg() local
2241 if (!master->_read_user_prot_reg) in mtd_read_user_prot_reg()
2245 return master->_read_user_prot_reg(master, from, len, retlen, buf); in mtd_read_user_prot_reg()
2252 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_user_prot_reg() local
2256 if (!master->_write_user_prot_reg) in mtd_write_user_prot_reg()
2260 ret = master->_write_user_prot_reg(master, to, len, retlen, buf); in mtd_write_user_prot_reg()
2274 struct mtd_info *master = mtd_get_master(mtd); in mtd_lock_user_prot_reg() local
2276 if (!master->_lock_user_prot_reg) in mtd_lock_user_prot_reg()
2280 return master->_lock_user_prot_reg(master, from, len); in mtd_lock_user_prot_reg()
2286 struct mtd_info *master = mtd_get_master(mtd); in mtd_erase_user_prot_reg() local
2288 if (!master->_erase_user_prot_reg) in mtd_erase_user_prot_reg()
2292 return master->_erase_user_prot_reg(master, from, len); in mtd_erase_user_prot_reg()
2299 struct mtd_info *master = mtd_get_master(mtd); in mtd_lock() local
2301 if (!master->_lock) in mtd_lock()
2309 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_lock()
2310 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_lock()
2313 return master->_lock(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_lock()
2319 struct mtd_info *master = mtd_get_master(mtd); in mtd_unlock() local
2321 if (!master->_unlock) in mtd_unlock()
2329 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_unlock()
2330 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_unlock()
2333 return master->_unlock(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_unlock()
2339 struct mtd_info *master = mtd_get_master(mtd); in mtd_is_locked() local
2341 if (!master->_is_locked) in mtd_is_locked()
2349 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_is_locked()
2350 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_is_locked()
2353 return master->_is_locked(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_is_locked()
2359 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_isreserved() local
2363 if (!master->_block_isreserved) in mtd_block_isreserved()
2367 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_isreserved()
2369 return master->_block_isreserved(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_isreserved()
2375 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_isbad() local
2379 if (!master->_block_isbad) in mtd_block_isbad()
2383 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_isbad()
2385 return master->_block_isbad(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_isbad()
2391 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_markbad() local
2395 if (!master->_block_markbad) in mtd_block_markbad()
2403 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_markbad()
2407 if (master->_block_isbad) { in mtd_block_markbad()
2408 ret = master->_block_isbad(master, moffs); in mtd_block_markbad()
2413 ret = master->_block_markbad(master, moffs); in mtd_block_markbad()
2473 struct mtd_info *master = mtd_get_master(mtd); in mtd_writev() local
2479 if (!master->_writev) in mtd_writev()
2482 return master->_writev(master, vecs, count, in mtd_writev()