Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d914c932 authored by David Mosberger's avatar David Mosberger Committed by David Woodhouse
Browse files

mtd: nand_base: Only use GET/SET FEATURES command on chips that support them.



Spansion's S34MLx chips support ONFI but not the GET/SET FEATURES calls.

Signed-off-by: default avatarDavid Mosberger <dmosberger@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 64ddba4d
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -2709,7 +2709,9 @@ static int nand_onfi_set_features(struct mtd_info *mtd, struct nand_chip *chip,
{
	int status;

	if (!chip->onfi_version)
	if (!chip->onfi_version ||
	    !(le16_to_cpu(chip->onfi_params.opt_cmd)
	      & ONFI_OPT_CMD_SET_GET_FEATURES))
		return -EINVAL;

	chip->cmdfunc(mtd, NAND_CMD_SET_FEATURES, addr, -1);
@@ -2730,7 +2732,9 @@ static int nand_onfi_set_features(struct mtd_info *mtd, struct nand_chip *chip,
static int nand_onfi_get_features(struct mtd_info *mtd, struct nand_chip *chip,
			int addr, uint8_t *subfeature_param)
{
	if (!chip->onfi_version)
	if (!chip->onfi_version ||
	    !(le16_to_cpu(chip->onfi_params.opt_cmd)
	      & ONFI_OPT_CMD_SET_GET_FEATURES))
		return -EINVAL;

	/* clear the sub feature parameters */
+3 −0
Original line number Diff line number Diff line
@@ -217,6 +217,9 @@ struct nand_chip;
/* ONFI subfeature parameters length */
#define ONFI_SUBFEATURE_PARAM_LEN	4

/* ONFI optional commands SET/GET FEATURES supported? */
#define ONFI_OPT_CMD_SET_GET_FEATURES	(1 << 2)

struct nand_onfi_params {
	/* rev info and features block */
	/* 'O' 'N' 'F' 'I'  */