Skip to content

Commit 47bddab

Browse files
Md Sadre Alammiquelraynal
authored andcommitted
mtd: rawnand: qcom: Fix last codeword read in qcom_param_page_type_exec()
For QPIC V2 onwards there is a separate register to read last code word "QPIC_NAND_READ_LOCATION_LAST_CW_n". qcom_param_page_type_exec() is used to read only one code word If it configures the number of code words to 1 in QPIC_NAND_DEV0_CFG0 register then QPIC controller thinks its reading the last code word, since we are having separate register to read the last code word, we have to configure "QPIC_NAND_READ_LOCATION_LAST_CW_n" register to fetch data from QPIC buffer to system memory. Without this change page read was failing with timeout error / # hexdump -C /dev/mtd1 [ 129.206113] qcom-nandc 1cc8000.nand-controller: failure to read page/oob hexdump: /dev/mtd1: Connection timed out This issue only seen on SDX targets since SDX target used QPICv2. But same working on IPQ targets since IPQ used QPICv1. Cc: [email protected] Fixes: 89550be ("mtd: rawnand: qcom: Implement exec_op()") Reviewed-by: Manivannan Sadhasivam <[email protected]> Tested-by: Lakshmi Sowjanya D <[email protected]> Signed-off-by: Md Sadre Alam <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
1 parent ee00096 commit 47bddab

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/mtd/nand/raw/qcom_nandc.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,7 +1863,12 @@ static int qcom_param_page_type_exec(struct nand_chip *chip, const struct nand_
18631863
const struct nand_op_instr *instr = NULL;
18641864
unsigned int op_id = 0;
18651865
unsigned int len = 0;
1866-
int ret;
1866+
int ret, reg_base;
1867+
1868+
reg_base = NAND_READ_LOCATION_0;
1869+
1870+
if (nandc->props->qpic_version2)
1871+
reg_base = NAND_READ_LOCATION_LAST_CW_0;
18671872

18681873
ret = qcom_parse_instructions(chip, subop, &q_op);
18691874
if (ret)
@@ -1915,7 +1920,10 @@ static int qcom_param_page_type_exec(struct nand_chip *chip, const struct nand_
19151920
op_id = q_op.data_instr_idx;
19161921
len = nand_subop_get_data_len(subop, op_id);
19171922

1918-
nandc_set_read_loc(chip, 0, 0, 0, len, 1);
1923+
if (nandc->props->qpic_version2)
1924+
nandc_set_read_loc_last(chip, reg_base, 0, len, 1);
1925+
else
1926+
nandc_set_read_loc_first(chip, reg_base, 0, len, 1);
19191927

19201928
if (!nandc->props->qpic_version2) {
19211929
qcom_write_reg_dma(nandc, &nandc->regs->vld, NAND_DEV_CMD_VLD, 1, 0);

0 commit comments

Comments
 (0)