Skip to content

Commit

Permalink
lightnvm: check for NAND flash and its type
Browse files Browse the repository at this point in the history
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: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Matias Bjørling authored and Jens Axboe committed Nov 16, 2015
1 parent 73387e7 commit 4264c98
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/lightnvm/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ static int nvm_core_init(struct nvm_dev *dev)
dev->plane_mode = NVM_PLANE_SINGLE;
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)
dev->plane_mode = NVM_PLANE_DOUBLE;
if (grp->mpos & 0x040404)
Expand Down

0 comments on commit 4264c98

Please sign in to comment.