From patchwork Fri Nov 22 08:59:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Md Sadre Alam X-Patchwork-Id: 13882901 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 290141DDA00; Fri, 22 Nov 2024 09:00:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266020; cv=none; b=fe+XrQtwUBYbcqaU72BwSgVrc5RXf6BFBbjrB1zqDdKtbVOUvkIdjscXLT/7jYoOXn4kb5qKc8IjUbYLGGHo65D7wRqnCoHYSRksslTx6Z0Zm1NAtXAaUMLGGclpadPz9Xybnc27mHNIG1T/Dfdxg7U6HXJCYVyhvMMgTDWM2sI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266020; c=relaxed/simple; bh=hD45CYGpG6jUWQUmyN0/v/63OKKyqwATyTFtCQneoY0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=At2HcY78I38GZvQxPEJPusdKUQtJlulhHhIKvzy3n40fXq15KL2WabWvP6zmVe2vx9+Cyttlh725hc2j0jFqfTuuvjgiGgLdMHNJ/zUSeZJRGt5u33CFVxmBEf0IzcL69lctC8ZkZXfzl65dad2zdTeOSz1S8V2BzHC1oPaKp2s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=NXecoCDY; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="NXecoCDY" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AM2MwJ9027721; Fri, 22 Nov 2024 09:00:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= VONkYfjy0I+6ovntvwwQZ8DWBbOjQW91xna3prVvaKU=; b=NXecoCDYjxzO+O5P bhyxazw0ZDw+c5m4FOanWn3412gSHmH1fPYXpl51u7Vv/uBPa6hkg0QjgK4uVf/W IF9IlwqoU/qzYLIBEQoh6SPv/L/96wVkFSZxshPGfDWeb7G6BFYarBbi8pAw4BZX KoO2jwQywwItM3mWOJJHhzF6Xa2gau1N1qLALqFAhUvSXMPKl0TtN6207p1AhL+9 BYgqlxNik1CfGo8sJXTP5Kc9EPfI5jYRpksbaNhGCRMFInw0ML0bAXUZ8rn4ifFC aqnjy+fNhnTgWxaC238isaZsAiCpNXVIM7rtQKP24UPSQaQI1Ill1A7eispbXVDK wxAY3w== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 432h4drvbq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Nov 2024 09:00:00 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4AM8xxee012860 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Nov 2024 08:59:59 GMT Received: from hu-mdalam-blr.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 22 Nov 2024 00:59:54 -0800 From: Md Sadre Alam To: , , , , , , , CC: , , , , Subject: [PATCH v2 1/3] mtd: rawnand: qcom: Pass 18 bit offset from QPIC base address to BAM Date: Fri, 22 Nov 2024 14:29:31 +0530 Message-ID: <20241122085933.2663927-2-quic_mdalam@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241122085933.2663927-1-quic_mdalam@quicinc.com> References: <20241122085933.2663927-1-quic_mdalam@quicinc.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: q18ZRClQBdoAICs92S5DLDb7c-UwB6fC X-Proofpoint-GUID: q18ZRClQBdoAICs92S5DLDb7c-UwB6fC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 clxscore=1015 phishscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=999 spamscore=0 adultscore=0 mlxscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411220075 Currently we are configuring lower 24 bits of address in descriptor whereas QPIC design expects 18 bit register offset from QPIC base address to be configured in cmd descriptors. This is leading to a different address actually being used in HW, leading to wrong value read. the actual issue is that the NANDc base address is different from the QPIC base address. But the driver doesn't take it into account and just used the QPIC base as the NANDc base. This used to work as the NANDc IP only considers the lower 18 bits of the address passed by the driver to derive the register offset. Since the base address of QPIC used to contain all 0 for lower 18 bits (like 0x07980000), the driver ended up passing the actual register offset in it and NANDc worked properly. But on newer SoCs like SDX75, the QPIC base address doesn't contain all 0 for lower 18 bits (like 0x01C98000). So NANDc sees wrong offset as per the current logic Older targets also used same configuration (lower 24 bits) like SDX55, SDX65, IPQ8074, IPQ6018 etc. but issue is masked in older targets due to lower 18 bits of QPIC base address being zero leading to expected address generation. The address should be passed to BAM 0x30000 + offset. In older targets the lower 18-bits are zero so that correct address being paased. But in newer targets the lower 18-bits are non-zero in QPIC base so that 0x300000 + offset giving the wrong value. SDX75 : QPIC_QPIC | 0x01C98000 (Lower 18 bits are non zero) SDX55 : QPIC_QPIC | 0x07980000 (Lower 18 bits are zero) Same for older targets. Cc: stable@vger.kernel.org Fixes: 8d6b6d7e135e ("mtd: nand: qcom: support for command descriptor formation") Signed-off-by: Md Sadre Alam --- Change in [v2] * Updated commit message * Added Fixes tag * Added stable kernel tag * Renamed the variable from offset_from_qpic to nandc_offset Change in [v1] * Preliminary correction for the register address forwarded to BAM drivers/mtd/nand/raw/qcom_nandc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c index b8cff9240b28..cc59461df72e 100644 --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -207,7 +207,7 @@ nandc_set_reg(chip, reg, \ #define dev_cmd_reg_addr(nandc, reg) ((nandc)->props->dev_cmd_reg_start + (reg)) /* Returns the NAND register physical address */ -#define nandc_reg_phys(chip, offset) ((chip)->base_phys + (offset)) +#define nandc_reg_phys(chip, offset) ((nandc)->props->nandc_offset + (offset)) /* Returns the dma address for reg read buffer */ #define reg_buf_dma_addr(chip, vaddr) \ @@ -561,6 +561,7 @@ struct qcom_nandc_props { bool is_qpic; bool qpic_v2; bool use_codeword_fixup; + u32 nandc_offset; }; /* Frees the BAM transaction memory */ @@ -3477,6 +3478,7 @@ static const struct qcom_nandc_props ipq806x_nandc_props = { .is_bam = false, .use_codeword_fixup = true, .dev_cmd_reg_start = 0x0, + .nandc_offset = 0x30000, }; static const struct qcom_nandc_props ipq4019_nandc_props = { @@ -3484,6 +3486,7 @@ static const struct qcom_nandc_props ipq4019_nandc_props = { .is_bam = true, .is_qpic = true, .dev_cmd_reg_start = 0x0, + .nandc_offset = 0x30000, }; static const struct qcom_nandc_props ipq8074_nandc_props = { @@ -3491,6 +3494,7 @@ static const struct qcom_nandc_props ipq8074_nandc_props = { .is_bam = true, .is_qpic = true, .dev_cmd_reg_start = 0x7000, + .nandc_offset = 0x30000, }; static const struct qcom_nandc_props sdx55_nandc_props = { @@ -3498,7 +3502,8 @@ static const struct qcom_nandc_props sdx55_nandc_props = { .is_bam = true, .is_qpic = true, .qpic_v2 = true, - .dev_cmd_reg_start = 0x7000, + .dev_cmd_reg_start = 0x0, + .nandc_offset = 0x30000, }; /* From patchwork Fri Nov 22 08:59:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Md Sadre Alam X-Patchwork-Id: 13882899 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B16B61D6DD1; Fri, 22 Nov 2024 09:00:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266017; cv=none; b=M8D+XIOXOCcSTjt9WpDiQPTe2AyCmAFXECzVfRJWT2KhcIhtiQWdV5YB/r1LqdvTjdFBAh1Q6iVYtgHOHTvZjEEmNERgQc1e6yAWL2lixriW0lcE0jDFuNcNZXzJLsnKoxpHJiKx3WudEzi1szdTxchyzmxaqjmKxCAgBrvLw3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266017; c=relaxed/simple; bh=SGOZZyJGJ5Asz/NrCX2d0p+pLFu7ydRvl8e2LJX6bp0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A3GW1vZM55gmLSOEW+5thi5UpKJyXW6KkEOMMVB81A2CgblVEk50A2q40gIH3dDPw37VK/ftKEKcoDJZQJebrNE1uo/zecie18fA7acODIJP2kPFwdM03jOmPk0wra0zVmEwOixJ/3L+E0TdGZEJcmbQpB5jjGvLrlHme+LHo1c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=OsI2tHYw; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="OsI2tHYw" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AM77JnL015637; Fri, 22 Nov 2024 09:00:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= j8RlkcBwSknelNJedVbF4Hn94vRpuuPalPv0MPWy7N4=; b=OsI2tHYwbbqxaZ+l DYezQ4wSiBFEOW5yoUltShJSdnfMvsjV2AWz62sQjH+ZLoCKHVqJggbwneiu4z8l ItH5UBfje++3/wEHl4RXOU2VkS87UFXPt2jHGREf3/sfF5Zt4FBx4yTq6+Wb8ziP e8Eb2Zg3HPas9SlQuvQkq2rTsLPqwgB4WI+5xO31D4sFaSaciJgsAuI2adYxE+J9 JQwj7sq0LL5y2x7K3wlkzw0ierR+EbeuqYy5bumZSEA/4zVE3qCUvRvI0uvcruqp fqIzdT5Hi36MhemRM1je5JU+mf5XZAdaSDp0Dzd8NXhOC98O5S+lPaazlapdUGzT 3ZMjrg== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4320y9kk7y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Nov 2024 09:00:04 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4AM903Rt007179 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Nov 2024 09:00:04 GMT Received: from hu-mdalam-blr.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 22 Nov 2024 00:59:59 -0800 From: Md Sadre Alam To: , , , , , , , CC: , , , , Subject: [PATCH v2 2/3] mtd: rawnand: qcom: Fix onfi param page read Date: Fri, 22 Nov 2024 14:29:32 +0530 Message-ID: <20241122085933.2663927-3-quic_mdalam@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241122085933.2663927-1-quic_mdalam@quicinc.com> References: <20241122085933.2663927-1-quic_mdalam@quicinc.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: _zQySF_WN6ghSlxUy42AjrMcSpV091wK X-Proofpoint-ORIG-GUID: _zQySF_WN6ghSlxUy42AjrMcSpV091wK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 malwarescore=0 clxscore=1015 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411220075 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 will get configure 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: stable@vger.kernel.org Fixes: 89550beb098e ("mtd: rawnand: qcom: Implement exec_op()") Signed-off-by: Md Sadre Alam --- Change in [v2] * Updated commit message * Added stable kernel tag * Replaced the buf_count value of 512 with the len in bytes. Change in [v1] * Resolved the issue with reading a single code word in the parameter page read drivers/mtd/nand/raw/qcom_nandc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c index cc59461df72e..31ec3db1246d 100644 --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -2859,7 +2859,12 @@ static int qcom_param_page_type_exec(struct nand_chip *chip, const struct nand_ const struct nand_op_instr *instr = NULL; unsigned int op_id = 0; unsigned int len = 0; - int ret; + int ret, reg_base; + + reg_base = NAND_READ_LOCATION_0; + + if (nandc->props->qpic_v2) + reg_base = NAND_READ_LOCATION_LAST_CW_0; ret = qcom_parse_instructions(chip, subop, &q_op); if (ret) @@ -2911,7 +2916,10 @@ static int qcom_param_page_type_exec(struct nand_chip *chip, const struct nand_ op_id = q_op.data_instr_idx; len = nand_subop_get_data_len(subop, op_id); - nandc_set_read_loc(chip, 0, 0, 0, len, 1); + if (nandc->props->qpic_v2) + nandc_set_read_loc_last(chip, reg_base, 0, len, 1); + else + nandc_set_read_loc_first(chip, reg_base, 0, len, 1); if (!nandc->props->qpic_v2) { write_reg_dma(nandc, NAND_DEV_CMD_VLD, 1, 0); From patchwork Fri Nov 22 08:59:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Md Sadre Alam X-Patchwork-Id: 13882900 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0ADA91DD55A; Fri, 22 Nov 2024 09:00:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266020; cv=none; b=G+6vqD8DHNmO+X+2Kalt0yXnEDzz6j+hKEEXtshZVZZmhXnXEdSUaV2iwaZvxGBv/7mG8ySvASn6gG1cty1zwjChbQFNkm94WBRvUefdRAFNtaUtbcEtxWWgsLQTyrg12ezqZVGA1qOn1eoO1qgOTTwmkUL2gX08xphGFBxI7aE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266020; c=relaxed/simple; bh=s464gs4DI7paebfDghYbA6dIdZv01O8xRzvIPM+5cjg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gvP0xDXBG3fu9b7TNo4WcihMgRX4ZMC5MuCq7lbiUnf2StvBZ26W7Bgik1YwXpAFvbvX4Og4KlSSkI9F+82vRXlShYGJo8jEBDkDgT8cymyrQr399mgMCF1FKNPCBEa9XQZ+k70AHtCRFTyKLWLI0dB7n9r3s2WznsPI5qz7sTc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=W4YTXN40; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="W4YTXN40" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AM2NM1c029328; Fri, 22 Nov 2024 09:00:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= LkHS7Yzau84UEPEUeytcDhNp5BBXrcXJE2ofwaLbCrQ=; b=W4YTXN404PFFtj3T 6oYEURHK1yoVcgb+7JwGb2AtWgV30WzRPg965M9SEzmmcd5Znxk6qL+3pEaR/9zf wHcEqP9LU7k2bZNmsMH3LjvKirZOHCKJPKJwhspsLuUuMi1YYENimLRhT1at5OhH +gKIAEnLNTauZde4bXKxygvogVyV7HCZ8OXy0e3KjMi6jm1mso04CMKmBtkajn8N GKDVMn304ewO9gGw7rSKlRax9DrfxBwRbdF6fd8T+A++6B7Hw6kGMSg6AbEZMfkm DfKens6FQ3ghFmZ3j6xS48+X7KXtngBPDgcwVklPPGilVwCADIJOF99JT96APmWe VwP6Ag== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 432h4drvc6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Nov 2024 09:00:09 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4AM908Pl008109 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Nov 2024 09:00:08 GMT Received: from hu-mdalam-blr.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 22 Nov 2024 01:00:03 -0800 From: Md Sadre Alam To: , , , , , , , CC: , , , , Subject: [PATCH v2 3/3] mtd: rawnand: qcom: Fix read len for onfi param page Date: Fri, 22 Nov 2024 14:29:33 +0530 Message-ID: <20241122085933.2663927-4-quic_mdalam@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241122085933.2663927-1-quic_mdalam@quicinc.com> References: <20241122085933.2663927-1-quic_mdalam@quicinc.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: EdIk7u9Ary1X47T5c_-drj4TLUmdqQDR X-Proofpoint-GUID: EdIk7u9Ary1X47T5c_-drj4TLUmdqQDR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 clxscore=1015 phishscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=999 spamscore=0 adultscore=0 mlxscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411220075 The minimum size to fetch the data from device to QPIC buffer is 512-bytes. If size is less than 512-bytes the data will not be protected by ECC as per QPIC standard. So while reading onfi parameter page from NAND device setting nandc->buf_count = 512. Cc: stable@vger.kernel.org Fixes: 89550beb098e ("mtd: rawnand: qcom: Implement exec_op()") Signed-off-by: Md Sadre Alam --- Change in [v2] * Set buf_count to 512 in the parameter page read Change in [v1] * This patch was not included in v1 drivers/mtd/nand/raw/qcom_nandc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c index 31ec3db1246d..e1dca4857754 100644 --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -2926,7 +2926,7 @@ static int qcom_param_page_type_exec(struct nand_chip *chip, const struct nand_ write_reg_dma(nandc, NAND_DEV_CMD1, 1, NAND_BAM_NEXT_SGL); } - nandc->buf_count = len; + nandc->buf_count = 512; memset(nandc->data_buffer, 0xff, nandc->buf_count); config_nand_single_cw_page_read(chip, false, 0);