Skip to content

Commit 86ede0a

Browse files
Ansuelmiquelraynal
authored andcommitted
mtd: rawnand: qcom: fix broken config in qcom_param_page_type_exec
Fix broken config in qcom_param_page_type_exec caused by copy-paste error from commit 0c08080 ("mtd: rawnand: qcom: use FIELD_PREP and GENMASK") In qcom_param_page_type_exec the value needs to be set to nandc->regs->cfg0 instead of host->cfg0. This wrong configuration caused the Qcom NANDC driver to malfunction on any device that makes use of it (IPQ806x, IPQ40xx, IPQ807x, IPQ60xx) with the following error: [ 0.885369] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xaa [ 0.885909] nand: Micron NAND 256MiB 1,8V 8-bit [ 0.892499] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 [ 0.896823] nand: ECC (step, strength) = (512, 8) does not fit in OOB [ 0.896836] qcom-nandc 79b0000.nand-controller: No valid ECC settings possible [ 0.910996] bam-dma-engine 7984000.dma-controller: Cannot free busy channel [ 0.918070] qcom-nandc: probe of 79b0000.nand-controller failed with error -28 Restore original configuration fix the problem and makes the driver work again. Also restore the wrongly dropped cpu_to_le32 to correctly support BE systems. Cc: stable@vger.kernel.org Fixes: 0c08080 ("mtd: rawnand: qcom: use FIELD_PREP and GENMASK") Tested-by: Robert Marko <robimarko@gmail.com> # IPQ8074 and IPQ6018 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent f37d135 commit 86ede0a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/mtd/nand/raw/qcom_nandc.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,18 +1881,18 @@ static int qcom_param_page_type_exec(struct nand_chip *chip, const struct nand_
18811881
nandc->regs->addr0 = 0;
18821882
nandc->regs->addr1 = 0;
18831883

1884-
host->cfg0 = FIELD_PREP(CW_PER_PAGE_MASK, 0) |
1885-
FIELD_PREP(UD_SIZE_BYTES_MASK, 512) |
1886-
FIELD_PREP(NUM_ADDR_CYCLES_MASK, 5) |
1887-
FIELD_PREP(SPARE_SIZE_BYTES_MASK, 0);
1888-
1889-
host->cfg1 = FIELD_PREP(NAND_RECOVERY_CYCLES_MASK, 7) |
1890-
FIELD_PREP(BAD_BLOCK_BYTE_NUM_MASK, 17) |
1891-
FIELD_PREP(CS_ACTIVE_BSY, 0) |
1892-
FIELD_PREP(BAD_BLOCK_IN_SPARE_AREA, 1) |
1893-
FIELD_PREP(WR_RD_BSY_GAP_MASK, 2) |
1894-
FIELD_PREP(WIDE_FLASH, 0) |
1895-
FIELD_PREP(DEV0_CFG1_ECC_DISABLE, 1);
1884+
nandc->regs->cfg0 = cpu_to_le32(FIELD_PREP(CW_PER_PAGE_MASK, 0) |
1885+
FIELD_PREP(UD_SIZE_BYTES_MASK, 512) |
1886+
FIELD_PREP(NUM_ADDR_CYCLES_MASK, 5) |
1887+
FIELD_PREP(SPARE_SIZE_BYTES_MASK, 0));
1888+
1889+
nandc->regs->cfg1 = cpu_to_le32(FIELD_PREP(NAND_RECOVERY_CYCLES_MASK, 7) |
1890+
FIELD_PREP(BAD_BLOCK_BYTE_NUM_MASK, 17) |
1891+
FIELD_PREP(CS_ACTIVE_BSY, 0) |
1892+
FIELD_PREP(BAD_BLOCK_IN_SPARE_AREA, 1) |
1893+
FIELD_PREP(WR_RD_BSY_GAP_MASK, 2) |
1894+
FIELD_PREP(WIDE_FLASH, 0) |
1895+
FIELD_PREP(DEV0_CFG1_ECC_DISABLE, 1));
18961896

18971897
if (!nandc->props->qpic_version2)
18981898
nandc->regs->ecc_buf_cfg = cpu_to_le32(ECC_CFG_ECC_DISABLE);

0 commit comments

Comments
 (0)