Re: [PATCH v4 2/5] mtd: nand: Qualcomm NAND controller driver

From: Brian Norris
Date: Fri Oct 02 2015 - 13:31:40 EST


One more nit noticed by my build tests:

On Wed, Aug 19, 2015 at 10:19:03AM +0530, Archit Taneja wrote:

[...]

> +static int qcom_nandc_ecc_init(struct qcom_nandc_data *this)
> +{
> + struct mtd_info *mtd = &this->mtd;
> + struct nand_chip *chip = &this->chip;
> + struct nand_ecc_ctrl *ecc = &chip->ecc;
> + int cwperpage;

drivers/mtd/nand/qcom_nandc.c: In function âqcom_nandc_ecc_initâ:
drivers/mtd/nand/qcom_nandc.c:1517:6: warning: variable âcwperpageâ set but not used [-Wunused-but-set-variable]

> + bool wide_bus;
> +
> + /* the nand controller fetches codewords/chunks of 512 bytes */
> + cwperpage = mtd->writesize >> 9;
> +
> + ecc->strength = this->ecc_strength;
> +
> + wide_bus = chip->options & NAND_BUSWIDTH_16 ? true : false;
> +
> + if (ecc->strength >= 8) {
> + /* 8 bit ECC defaults to BCH ECC on all platforms */
> + ecc->bytes = wide_bus ? 14 : 13;
> + } else {
> + /*
> + * if the controller supports BCH for 4 bit ECC, the controller
> + * uses lesser bytes for ECC. If RS is used, the ECC bytes is
> + * always 10 bytes
> + */
> + if (this->ecc_modes & ECC_BCH_4BIT)
> + ecc->bytes = wide_bus ? 8 : 7;
> + else
> + ecc->bytes = 10;
> + }
> +
> + /* each step consists of 512 bytes of data */
> + ecc->size = NANDC_STEP_SIZE;
> +
> + ecc->read_page = qcom_nandc_read_page;
> + ecc->read_oob = qcom_nandc_read_oob;
> + ecc->write_page = qcom_nandc_write_page;
> + ecc->write_oob = qcom_nandc_write_oob;
> +
> + /*
> + * the bad block marker is readable only when we read the page with ECC
> + * disabled. all the ops above run with ECC enabled. We need raw read
> + * and write function for oob in order to access bad block marker.
> + */
> + ecc->read_oob_raw = qcom_nandc_read_oob_raw;
> + ecc->write_oob_raw = qcom_nandc_write_oob_raw;
> +
> + switch (mtd->oobsize) {
> + case 64:
> + ecc->layout = &layout_oob_64;
> + break;
> + case 128:
> + ecc->layout = &layout_oob_128;
> + break;
> + case 224:
> + if (wide_bus)
> + ecc->layout = &layout_oob_224_x16;
> + else
> + ecc->layout = &layout_oob_224_x8;
> + break;
> + case 256:
> + ecc->layout = &layout_oob_256;
> + break;
> + default:
> + dev_err(this->dev, "unsupported NAND device, oobsize %d\n",
> + mtd->oobsize);
> + return -ENODEV;
> + }
> +
> + ecc->mode = NAND_ECC_HW;
> +
> + /* enable ecc by default */
> + this->use_ecc = true;
> +
> + return 0;
> +}

[...]

Brian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/