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()
1113 * @master: the MTD device to unregister. This will unregister both the master
1116 int mtd_device_unregister(struct mtd_info *master) in mtd_device_unregister() argument
1120 if (master->_reboot) { in mtd_device_unregister()
1121 unregister_reboot_notifier(&master->reboot_notifier); in mtd_device_unregister()
1122 memset(&master->reboot_notifier, 0, sizeof(master->reboot_notifier)); in mtd_device_unregister()
1125 nvmem_unregister(master->otp_user_nvmem); in mtd_device_unregister()
1126 nvmem_unregister(master->otp_factory_nvmem); in mtd_device_unregister()
1128 err = del_mtd_partitions(master); in mtd_device_unregister()
1132 if (!device_is_registered(&master->dev)) in mtd_device_unregister()
1135 return del_mtd_device(master); in mtd_device_unregister()
1238 struct mtd_info *master = mtd_get_master(mtd); in __get_mtd_device() local
1241 if (master->_get_device) { in __get_mtd_device()
1242 err = master->_get_device(mtd); in __get_mtd_device()
1247 if (!try_module_get(master->owner)) { in __get_mtd_device()
1248 if (master->_put_device) in __get_mtd_device()
1249 master->_put_device(master); in __get_mtd_device()
1254 if (mtd != master) in __get_mtd_device()
1260 kref_get(&master->refcnt); in __get_mtd_device()
1343 struct mtd_info *master = mtd_get_master(mtd); in __put_mtd_device() local
1349 if (mtd != master) in __put_mtd_device()
1355 kref_put(&master->refcnt, mtd_device_release); in __put_mtd_device()
1357 module_put(master->owner); in __put_mtd_device()
1359 /* must be the last as master can be freed in the _put_device */ in __put_mtd_device()
1360 if (master->_put_device) in __put_mtd_device()
1361 master->_put_device(master); in __put_mtd_device()
1372 struct mtd_info *master = mtd_get_master(mtd); in mtd_erase() local
1380 if (!mtd->erasesize || !master->_erase) in mtd_erase()
1395 master->erasesize; in mtd_erase()
1397 master->erasesize) - in mtd_erase()
1403 ret = master->_erase(master, &adjinstr); in mtd_erase()
1409 master); in mtd_erase()
1425 struct mtd_info *master = mtd_get_master(mtd); in mtd_point() local
1431 if (!master->_point) in mtd_point()
1439 return master->_point(master, from, len, retlen, virt, phys); in mtd_point()
1446 struct mtd_info *master = mtd_get_master(mtd); in mtd_unpoint() local
1448 if (!master->_unpoint) in mtd_unpoint()
1454 return master->_unpoint(master, mtd_get_master_ofs(mtd, from), len); in mtd_unpoint()
1481 static void mtd_update_ecc_stats(struct mtd_info *mtd, struct mtd_info *master, in mtd_update_ecc_stats() argument
1486 if (master == mtd) in mtd_update_ecc_stats()
1489 diff = master->ecc_stats; in mtd_update_ecc_stats()
1546 struct mtd_info *master = mtd_get_master(mtd); in mtd_panic_write() local
1549 if (!master->_panic_write) in mtd_panic_write()
1557 if (!master->oops_panic_write) in mtd_panic_write()
1558 master->oops_panic_write = true; in mtd_panic_write()
1560 return master->_panic_write(master, mtd_get_master_ofs(mtd, to), len, in mtd_panic_write()
1601 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_oob_std() local
1605 if (master->_read_oob) in mtd_read_oob_std()
1606 ret = master->_read_oob(master, from, ops); in mtd_read_oob_std()
1608 ret = master->_read(master, from, ops->len, &ops->retlen, in mtd_read_oob_std()
1617 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_oob_std() local
1621 if (master->_write_oob) in mtd_write_oob_std()
1622 ret = master->_write_oob(master, to, ops); in mtd_write_oob_std()
1624 ret = master->_write(master, to, ops->len, &ops->retlen, in mtd_write_oob_std()
1633 struct mtd_info *master = mtd_get_master(mtd); in mtd_io_emulated_slc() local
1634 int ngroups = mtd_pairing_groups(master); in mtd_io_emulated_slc()
1635 int npairs = mtd_wunit_per_eb(master) / ngroups; in mtd_io_emulated_slc()
1644 base = (loff_t)mtd_div_by_eb(start, mtd) * master->erasesize; in mtd_io_emulated_slc()
1655 base += master->erasesize; in mtd_io_emulated_slc()
1658 wunit = mtd_pairing_info_to_wunit(master, &info); in mtd_io_emulated_slc()
1695 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_oob() local
1696 struct mtd_ecc_stats old_stats = master->ecc_stats; in mtd_read_oob()
1708 if (!master->_read_oob && (!master->_read || ops->oobbuf)) in mtd_read_oob()
1719 mtd_update_ecc_stats(mtd, master, &old_stats); in mtd_read_oob()
1740 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_oob() local
1755 if (!master->_write_oob && (!master->_write || ops->oobbuf)) in mtd_write_oob()
1784 struct mtd_info *master = mtd_get_master(mtd); in mtd_ooblayout_ecc() local
1788 if (!master || section < 0) in mtd_ooblayout_ecc()
1791 if (!master->ooblayout || !master->ooblayout->ecc) in mtd_ooblayout_ecc()
1794 return master->ooblayout->ecc(master, section, oobecc); in mtd_ooblayout_ecc()
1818 struct mtd_info *master = mtd_get_master(mtd); in mtd_ooblayout_free() local
1822 if (!master || section < 0) in mtd_ooblayout_free()
1825 if (!master->ooblayout || !master->ooblayout->free) in mtd_ooblayout_free()
1828 return master->ooblayout->free(master, section, oobfree); in mtd_ooblayout_free()
2137 struct mtd_info *master = mtd_get_master(mtd); in mtd_get_fact_prot_info() local
2139 if (!master->_get_fact_prot_info) in mtd_get_fact_prot_info()
2143 return master->_get_fact_prot_info(master, len, retlen, buf); in mtd_get_fact_prot_info()
2150 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_fact_prot_reg() local
2153 if (!master->_read_fact_prot_reg) in mtd_read_fact_prot_reg()
2157 return master->_read_fact_prot_reg(master, from, len, retlen, buf); in mtd_read_fact_prot_reg()
2164 struct mtd_info *master = mtd_get_master(mtd); in mtd_get_user_prot_info() local
2166 if (!master->_get_user_prot_info) in mtd_get_user_prot_info()
2170 return master->_get_user_prot_info(master, len, retlen, buf); in mtd_get_user_prot_info()
2177 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_user_prot_reg() local
2180 if (!master->_read_user_prot_reg) in mtd_read_user_prot_reg()
2184 return master->_read_user_prot_reg(master, from, len, retlen, buf); in mtd_read_user_prot_reg()
2191 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_user_prot_reg() local
2195 if (!master->_write_user_prot_reg) in mtd_write_user_prot_reg()
2199 ret = master->_write_user_prot_reg(master, to, len, retlen, buf); in mtd_write_user_prot_reg()
2213 struct mtd_info *master = mtd_get_master(mtd); in mtd_lock_user_prot_reg() local
2215 if (!master->_lock_user_prot_reg) in mtd_lock_user_prot_reg()
2219 return master->_lock_user_prot_reg(master, from, len); in mtd_lock_user_prot_reg()
2225 struct mtd_info *master = mtd_get_master(mtd); in mtd_erase_user_prot_reg() local
2227 if (!master->_erase_user_prot_reg) in mtd_erase_user_prot_reg()
2231 return master->_erase_user_prot_reg(master, from, len); in mtd_erase_user_prot_reg()
2238 struct mtd_info *master = mtd_get_master(mtd); in mtd_lock() local
2240 if (!master->_lock) in mtd_lock()
2248 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_lock()
2249 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_lock()
2252 return master->_lock(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_lock()
2258 struct mtd_info *master = mtd_get_master(mtd); in mtd_unlock() local
2260 if (!master->_unlock) in mtd_unlock()
2268 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_unlock()
2269 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_unlock()
2272 return master->_unlock(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_unlock()
2278 struct mtd_info *master = mtd_get_master(mtd); in mtd_is_locked() local
2280 if (!master->_is_locked) in mtd_is_locked()
2288 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_is_locked()
2289 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_is_locked()
2292 return master->_is_locked(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_is_locked()
2298 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_isreserved() local
2302 if (!master->_block_isreserved) in mtd_block_isreserved()
2306 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_isreserved()
2308 return master->_block_isreserved(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_isreserved()
2314 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_isbad() local
2318 if (!master->_block_isbad) in mtd_block_isbad()
2322 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_isbad()
2324 return master->_block_isbad(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_isbad()
2330 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_markbad() local
2333 if (!master->_block_markbad) in mtd_block_markbad()
2341 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_markbad()
2343 ret = master->_block_markbad(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_markbad()
2403 struct mtd_info *master = mtd_get_master(mtd); in mtd_writev() local
2409 if (!master->_writev) in mtd_writev()
2412 return master->_writev(master, vecs, count, in mtd_writev()