Lines Matching full:master
454 struct mtd_info *master = mtd_get_master(mtd); in mtd_wunit_to_pairing_info() local
455 int npairs = mtd_wunit_per_eb(master) / mtd_pairing_groups(master); in mtd_wunit_to_pairing_info()
460 if (master->pairing && master->pairing->get_info) in mtd_wunit_to_pairing_info()
461 return master->pairing->get_info(master, wunit, info); in mtd_wunit_to_pairing_info()
497 struct mtd_info *master = mtd_get_master(mtd); in mtd_pairing_info_to_wunit() local
498 int ngroups = mtd_pairing_groups(master); in mtd_pairing_info_to_wunit()
499 int npairs = mtd_wunit_per_eb(master) / ngroups; in mtd_pairing_info_to_wunit()
505 if (master->pairing && master->pairing->get_wunit) in mtd_pairing_info_to_wunit()
506 return mtd->pairing->get_wunit(master, info); in mtd_pairing_info_to_wunit()
524 struct mtd_info *master = mtd_get_master(mtd); in mtd_pairing_groups() local
526 if (!master->pairing || !master->pairing->ngroups) in mtd_pairing_groups()
529 return master->pairing->ngroups; in mtd_pairing_groups()
646 struct mtd_info *master = mtd_get_master(mtd); in add_mtd_device() local
652 * mtd_device_parse_register() multiple times on the same master MTD, in add_mtd_device()
668 if (WARN_ON((!mtd->erasesize || !master->_erase) && in add_mtd_device()
674 * master is an MLC NAND and has a proper pairing scheme defined. in add_mtd_device()
681 (!mtd_is_partition(mtd) || master->type != MTD_MLCNANDFLASH || in add_mtd_device()
682 !master->pairing || master->_writev)) in add_mtd_device()
707 int ngroups = mtd_pairing_groups(master); in add_mtd_device()
710 mtd->size = (u64)mtd_div_by_eb(mtd->size, master) * in add_mtd_device()
850 mutex_init(&mtd->master.partitions_lock); in mtd_set_dev_defaults()
851 mutex_init(&mtd->master.chrdev_lock); in mtd_set_dev_defaults()
1118 * @master: the MTD device to unregister. This will unregister both the master
1121 int mtd_device_unregister(struct mtd_info *master) in mtd_device_unregister() argument
1125 if (master->_reboot) { in mtd_device_unregister()
1126 unregister_reboot_notifier(&master->reboot_notifier); in mtd_device_unregister()
1127 memset(&master->reboot_notifier, 0, sizeof(master->reboot_notifier)); in mtd_device_unregister()
1130 nvmem_unregister(master->otp_user_nvmem); in mtd_device_unregister()
1131 nvmem_unregister(master->otp_factory_nvmem); in mtd_device_unregister()
1133 err = del_mtd_partitions(master); in mtd_device_unregister()
1137 if (!device_is_registered(&master->dev)) in mtd_device_unregister()
1140 return del_mtd_device(master); in mtd_device_unregister()
1243 struct mtd_info *master = mtd_get_master(mtd); in __get_mtd_device() local
1246 if (master->_get_device) { in __get_mtd_device()
1247 err = master->_get_device(mtd); in __get_mtd_device()
1252 if (!try_module_get(master->owner)) { in __get_mtd_device()
1253 if (master->_put_device) in __get_mtd_device()
1254 master->_put_device(master); in __get_mtd_device()
1259 if (mtd != master) in __get_mtd_device()
1265 kref_get(&master->refcnt); in __get_mtd_device()
1348 struct mtd_info *master = mtd_get_master(mtd); in __put_mtd_device() local
1354 if (mtd != master) in __put_mtd_device()
1360 kref_put(&master->refcnt, mtd_device_release); in __put_mtd_device()
1362 module_put(master->owner); in __put_mtd_device()
1364 /* must be the last as master can be freed in the _put_device */ in __put_mtd_device()
1365 if (master->_put_device) in __put_mtd_device()
1366 master->_put_device(master); in __put_mtd_device()
1377 struct mtd_info *master = mtd_get_master(mtd); in mtd_erase() local
1385 if (!mtd->erasesize || !master->_erase) in mtd_erase()
1400 master->erasesize; in mtd_erase()
1402 master->erasesize) - in mtd_erase()
1408 ret = master->_erase(master, &adjinstr); in mtd_erase()
1414 master); in mtd_erase()
1430 struct mtd_info *master = mtd_get_master(mtd); in mtd_point() local
1436 if (!master->_point) in mtd_point()
1444 return master->_point(master, from, len, retlen, virt, phys); in mtd_point()
1451 struct mtd_info *master = mtd_get_master(mtd); in mtd_unpoint() local
1453 if (!master->_unpoint) in mtd_unpoint()
1459 return master->_unpoint(master, mtd_get_master_ofs(mtd, from), len); in mtd_unpoint()
1486 static void mtd_update_ecc_stats(struct mtd_info *mtd, struct mtd_info *master, in mtd_update_ecc_stats() argument
1491 if (master == mtd) in mtd_update_ecc_stats()
1494 diff = master->ecc_stats; in mtd_update_ecc_stats()
1551 struct mtd_info *master = mtd_get_master(mtd); in mtd_panic_write() local
1554 if (!master->_panic_write) in mtd_panic_write()
1562 if (!master->oops_panic_write) in mtd_panic_write()
1563 master->oops_panic_write = true; in mtd_panic_write()
1565 return master->_panic_write(master, mtd_get_master_ofs(mtd, to), len, in mtd_panic_write()
1606 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_oob_std() local
1610 if (master->_read_oob) in mtd_read_oob_std()
1611 ret = master->_read_oob(master, from, ops); in mtd_read_oob_std()
1613 ret = master->_read(master, from, ops->len, &ops->retlen, in mtd_read_oob_std()
1622 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_oob_std() local
1626 if (master->_write_oob) in mtd_write_oob_std()
1627 ret = master->_write_oob(master, to, ops); in mtd_write_oob_std()
1629 ret = master->_write(master, to, ops->len, &ops->retlen, in mtd_write_oob_std()
1638 struct mtd_info *master = mtd_get_master(mtd); in mtd_io_emulated_slc() local
1639 int ngroups = mtd_pairing_groups(master); in mtd_io_emulated_slc()
1640 int npairs = mtd_wunit_per_eb(master) / ngroups; in mtd_io_emulated_slc()
1649 base = (loff_t)mtd_div_by_eb(start, mtd) * master->erasesize; in mtd_io_emulated_slc()
1660 base += master->erasesize; in mtd_io_emulated_slc()
1663 wunit = mtd_pairing_info_to_wunit(master, &info); in mtd_io_emulated_slc()
1700 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_oob() local
1701 struct mtd_ecc_stats old_stats = master->ecc_stats; in mtd_read_oob()
1713 if (!master->_read_oob && (!master->_read || ops->oobbuf)) in mtd_read_oob()
1724 mtd_update_ecc_stats(mtd, master, &old_stats); in mtd_read_oob()
1745 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_oob() local
1760 if (!master->_write_oob && (!master->_write || ops->oobbuf)) in mtd_write_oob()
1789 struct mtd_info *master = mtd_get_master(mtd); in mtd_ooblayout_ecc() local
1793 if (!master || section < 0) in mtd_ooblayout_ecc()
1796 if (!master->ooblayout || !master->ooblayout->ecc) in mtd_ooblayout_ecc()
1799 return master->ooblayout->ecc(master, section, oobecc); in mtd_ooblayout_ecc()
1823 struct mtd_info *master = mtd_get_master(mtd); in mtd_ooblayout_free() local
1827 if (!master || section < 0) in mtd_ooblayout_free()
1830 if (!master->ooblayout || !master->ooblayout->free) in mtd_ooblayout_free()
1833 return master->ooblayout->free(master, section, oobfree); in mtd_ooblayout_free()
2142 struct mtd_info *master = mtd_get_master(mtd); in mtd_get_fact_prot_info() local
2144 if (!master->_get_fact_prot_info) in mtd_get_fact_prot_info()
2148 return master->_get_fact_prot_info(master, len, retlen, buf); in mtd_get_fact_prot_info()
2155 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_fact_prot_reg() local
2158 if (!master->_read_fact_prot_reg) in mtd_read_fact_prot_reg()
2162 return master->_read_fact_prot_reg(master, from, len, retlen, buf); in mtd_read_fact_prot_reg()
2169 struct mtd_info *master = mtd_get_master(mtd); in mtd_get_user_prot_info() local
2171 if (!master->_get_user_prot_info) in mtd_get_user_prot_info()
2175 return master->_get_user_prot_info(master, len, retlen, buf); in mtd_get_user_prot_info()
2182 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_user_prot_reg() local
2185 if (!master->_read_user_prot_reg) in mtd_read_user_prot_reg()
2189 return master->_read_user_prot_reg(master, from, len, retlen, buf); in mtd_read_user_prot_reg()
2196 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_user_prot_reg() local
2200 if (!master->_write_user_prot_reg) in mtd_write_user_prot_reg()
2204 ret = master->_write_user_prot_reg(master, to, len, retlen, buf); in mtd_write_user_prot_reg()
2218 struct mtd_info *master = mtd_get_master(mtd); in mtd_lock_user_prot_reg() local
2220 if (!master->_lock_user_prot_reg) in mtd_lock_user_prot_reg()
2224 return master->_lock_user_prot_reg(master, from, len); in mtd_lock_user_prot_reg()
2230 struct mtd_info *master = mtd_get_master(mtd); in mtd_erase_user_prot_reg() local
2232 if (!master->_erase_user_prot_reg) in mtd_erase_user_prot_reg()
2236 return master->_erase_user_prot_reg(master, from, len); in mtd_erase_user_prot_reg()
2243 struct mtd_info *master = mtd_get_master(mtd); in mtd_lock() local
2245 if (!master->_lock) in mtd_lock()
2253 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_lock()
2254 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_lock()
2257 return master->_lock(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_lock()
2263 struct mtd_info *master = mtd_get_master(mtd); in mtd_unlock() local
2265 if (!master->_unlock) in mtd_unlock()
2273 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_unlock()
2274 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_unlock()
2277 return master->_unlock(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_unlock()
2283 struct mtd_info *master = mtd_get_master(mtd); in mtd_is_locked() local
2285 if (!master->_is_locked) in mtd_is_locked()
2293 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_is_locked()
2294 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_is_locked()
2297 return master->_is_locked(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_is_locked()
2303 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_isreserved() local
2307 if (!master->_block_isreserved) in mtd_block_isreserved()
2311 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_isreserved()
2313 return master->_block_isreserved(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_isreserved()
2319 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_isbad() local
2323 if (!master->_block_isbad) in mtd_block_isbad()
2327 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_isbad()
2329 return master->_block_isbad(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_isbad()
2335 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_markbad() local
2338 if (!master->_block_markbad) in mtd_block_markbad()
2346 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_markbad()
2348 ret = master->_block_markbad(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_markbad()
2408 struct mtd_info *master = mtd_get_master(mtd); in mtd_writev() local
2414 if (!master->_writev) in mtd_writev()
2417 return master->_writev(master, vecs, count, in mtd_writev()