From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Md Sadre Alam <quic_mdalam@quicinc.com>
Cc: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
bbrezillon@kernel.org, linux-mtd@lists.infradead.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
quic_srichara@quicinc.com, quic_varada@quicinc.com,
quic_nainmeht@quicinc.com, quic_laksd@quicinc.com
Subject: Re: [PATCH v2 1/3] mtd: rawnand: qcom: Pass 18 bit offset from QPIC base address to BAM
Date: Tue, 26 Nov 2024 11:00:19 +0530 [thread overview]
Message-ID: <20241126053019.ujdb7nkkj3f25jyn@thinkpad> (raw)
In-Reply-To: <20241122085933.2663927-2-quic_mdalam@quicinc.com>
On Fri, Nov 22, 2024 at 02:29:31PM +0530, Md Sadre Alam wrote:
> 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
SDX55's NANDc base is 0x01b30000 and it has bits 17 and 18 set corresponding to
0x30000. So it is correct that the IP only considers lower 18 bits and it used
to work as the driver ended up passing 0x3000 + register offset.
Your wording is not correct.
> 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
>
'all 0 for lower 18 bits' is not true.
> 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.
>
This paragraph is redundant now.
> 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
This address is wrong as I mentioned above.
> older targets.
>
> Cc: stable@vger.kernel.org
> Fixes: 8d6b6d7e135e ("mtd: nand: qcom: support for command descriptor formation")
> Signed-off-by: Md Sadre Alam <quic_mdalam@quicinc.com>
> ---
>
> 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,
What is this change?
- Mani
--
மணிவண்ணன் சதாசிவம்
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2024-11-26 5:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 8:59 [PATCH v2 0/3] QPIC v2 fixes for SDX75 Md Sadre Alam
2024-11-22 8:59 ` [PATCH v2 1/3] mtd: rawnand: qcom: Pass 18 bit offset from QPIC base address to BAM Md Sadre Alam
2024-11-26 5:30 ` Manivannan Sadhasivam [this message]
2024-11-27 9:05 ` Md Sadre Alam
2024-11-22 8:59 ` [PATCH v2 2/3] mtd: rawnand: qcom: Fix onfi param page read Md Sadre Alam
2024-11-26 5:41 ` Manivannan Sadhasivam
2024-11-27 9:11 ` Md Sadre Alam
2024-11-22 8:59 ` [PATCH v2 3/3] mtd: rawnand: qcom: Fix read len for onfi param page Md Sadre Alam
2024-11-26 5:45 ` Manivannan Sadhasivam
2024-11-26 5:49 ` Manivannan Sadhasivam
2024-11-22 17:44 ` [PATCH v2 0/3] QPIC v2 fixes for SDX75 Lakshmi Sowjanya D (QUIC)
2024-12-20 9:30 ` Manivannan Sadhasivam
2024-12-24 5:22 ` Md Sadre Alam
2024-12-24 8:09 ` Miquel Raynal
2024-12-24 11:53 ` Md Sadre Alam
2025-01-06 14:04 ` Manivannan Sadhasivam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241126053019.ujdb7nkkj3f25jyn@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=bbrezillon@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=quic_laksd@quicinc.com \
--cc=quic_mdalam@quicinc.com \
--cc=quic_nainmeht@quicinc.com \
--cc=quic_srichara@quicinc.com \
--cc=quic_varada@quicinc.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox