Commit 4264c980 authored by Matias Bjørling's avatar Matias Bjørling Committed by Jens Axboe

lightnvm: check for NAND flash and its type

Only NAND flash with SLC and MLC is supported. Make sure to not try to
initialize TLC memory or other non-volatile memory types.
Signed-off-by: default avatarMatias Bjørling <m@bjorling.me>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 73387e7b
...@@ -185,6 +185,16 @@ static int nvm_core_init(struct nvm_dev *dev) ...@@ -185,6 +185,16 @@ static int nvm_core_init(struct nvm_dev *dev)
dev->plane_mode = NVM_PLANE_SINGLE; dev->plane_mode = NVM_PLANE_SINGLE;
dev->max_rq_size = dev->ops->max_phys_sect * dev->sec_size; dev->max_rq_size = dev->ops->max_phys_sect * dev->sec_size;
if (grp->mtype != 0) {
pr_err("nvm: memory type not supported\n");
return -EINVAL;
}
if (grp->fmtype != 0 && grp->fmtype != 1) {
pr_err("nvm: flash type not supported\n");
return -EINVAL;
}
if (grp->mpos & 0x020202) if (grp->mpos & 0x020202)
dev->plane_mode = NVM_PLANE_DOUBLE; dev->plane_mode = NVM_PLANE_DOUBLE;
if (grp->mpos & 0x040404) if (grp->mpos & 0x040404)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment