Browse Source

lightnvm: add mccap support

Some flash media has extended capabilities, such as programming SLC
pages on MLC/TLC flash, erase/program suspend, scramble and encryption.
MCCAP is introduced to detect support for these capabilities in the
command set.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
Matias Bjørling 9 years ago
parent
commit
f9a9995072
2 changed files with 8 additions and 0 deletions
  1. 1 0
      drivers/lightnvm/core.c
  2. 7 0
      include/linux/lightnvm.h

+ 1 - 0
drivers/lightnvm/core.c

@@ -376,6 +376,7 @@ static int nvm_core_init(struct nvm_dev *dev)
 	dev->sec_size = grp->csecs;
 	dev->sec_size = grp->csecs;
 	dev->oob_size = grp->sos;
 	dev->oob_size = grp->sos;
 	dev->sec_per_pg = grp->fpg_sz / grp->csecs;
 	dev->sec_per_pg = grp->fpg_sz / grp->csecs;
+	dev->mccap = grp->mccap;
 	memcpy(&dev->ppaf, &id->ppaf, sizeof(struct nvm_addr_format));
 	memcpy(&dev->ppaf, &id->ppaf, sizeof(struct nvm_addr_format));
 
 
 	dev->plane_mode = NVM_PLANE_SINGLE;
 	dev->plane_mode = NVM_PLANE_SINGLE;

+ 7 - 0
include/linux/lightnvm.h

@@ -61,6 +61,12 @@ enum {
 	NVM_BLK_T_GRWN_BAD	= 0x2,
 	NVM_BLK_T_GRWN_BAD	= 0x2,
 	NVM_BLK_T_DEV		= 0x4,
 	NVM_BLK_T_DEV		= 0x4,
 	NVM_BLK_T_HOST		= 0x8,
 	NVM_BLK_T_HOST		= 0x8,
+
+	/* Memory capabilities */
+	NVM_ID_CAP_SLC		= 0x1,
+	NVM_ID_CAP_CMD_SUSPEND	= 0x2,
+	NVM_ID_CAP_SCRAMBLE	= 0x4,
+	NVM_ID_CAP_ENCRYPT	= 0x8,
 };
 };
 
 
 struct nvm_id_group {
 struct nvm_id_group {
@@ -278,6 +284,7 @@ struct nvm_dev {
 	int blks_per_lun;
 	int blks_per_lun;
 	int sec_size;
 	int sec_size;
 	int oob_size;
 	int oob_size;
+	int mccap;
 	struct nvm_addr_format ppaf;
 	struct nvm_addr_format ppaf;
 
 
 	/* Calculated/Cached values. These do not reflect the actual usable
 	/* Calculated/Cached values. These do not reflect the actual usable