From: Abhishek Sahu <absahu@codeaurora.org>
To: Boris Brezillon <boris.brezillon@bootlin.com>,
Miquel Raynal <miquel.raynal@bootlin.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Marek Vasut <marek.vasut@gmail.com>,
Richard Weinberger <richard@nod.at>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mtd@lists.infradead.org, Andy Gross <andy.gross@linaro.org>,
Abhishek Sahu <absahu@codeaurora.org>
Subject: [PATCH 3/5] mtd: rawnand: qcom: fix NAND register write errors
Date: Fri, 6 Jul 2018 13:21:57 +0530 [thread overview]
Message-ID: <1530863519-5564-4-git-send-email-absahu@codeaurora.org> (raw)
In-Reply-To: <1530863519-5564-1-git-send-email-absahu@codeaurora.org>
Fix the following NAND register write errors which will
be generated if access protection is enabled.
1. SFLASHC_BURST_CFG register is not available for supported
NAND contollers by this driver, so this can be removed.
2. NAND_CTRL is operational register and register writes to
operational registers should always be done through
command descriptors if BAM_MODE is already enabled.
With full boot chain, bootloader already enables
BAM_MODE so read the NAND_CTRL register value and write
only if BAM_MODE is not set.
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
---
drivers/mtd/nand/raw/qcom_nandc.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
index df12cf3..9e6b383 100644
--- a/drivers/mtd/nand/raw/qcom_nandc.c
+++ b/drivers/mtd/nand/raw/qcom_nandc.c
@@ -2693,15 +2693,20 @@ static int qcom_nandc_setup(struct qcom_nand_controller *nandc)
{
u32 nand_ctrl;
- /* kill onenand */
- nandc_write(nandc, SFLASHC_BURST_CFG, 0);
nandc_write(nandc, dev_cmd_reg_addr(nandc, NAND_DEV_CMD_VLD),
NAND_DEV_CMD_VLD_VAL);
/* enable ADM or BAM DMA */
if (nandc->props->is_bam) {
nand_ctrl = nandc_read(nandc, NAND_CTRL);
- nandc_write(nandc, NAND_CTRL, nand_ctrl | BAM_MODE_EN);
+ /*
+ * Once BAM_MODE_EN bit is set then QPIC_NAND_CTRL register
+ * should be written with BAM instead of writel.
+ * Check if BAM_MODE_EN is already set by bootloader and write
+ * only if this bit is not set.
+ */
+ if (!(nand_ctrl & BAM_MODE_EN))
+ nandc_write(nandc, NAND_CTRL, nand_ctrl | BAM_MODE_EN);
} else {
nandc_write(nandc, NAND_FLASH_CHIP_SELECT, DM_EN);
}
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc.
is a member of Code Aurora Forum, hosted by The Linux Foundation
next prev parent reply other threads:[~2018-07-06 7:51 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-06 7:51 [PATCH 0/5] Update for removing driver specific BBM functions Abhishek Sahu
2018-07-06 7:51 ` [PATCH 1/5] mtd: rawnand: qcom: remove driver specific bad block check function Abhishek Sahu
2018-07-06 7:51 ` [PATCH 2/5] mtd: rawnand: qcom: remove driver specific block_markbad function Abhishek Sahu
2018-07-18 21:23 ` Miquel Raynal
2018-07-18 21:43 ` Boris Brezillon
2018-07-20 12:16 ` Abhishek Sahu
2018-07-20 13:03 ` Boris Brezillon
2018-11-04 15:56 ` Boris Brezillon
2018-11-09 6:18 ` Abhishek Sahu
2018-07-06 7:51 ` Abhishek Sahu [this message]
2018-07-06 7:51 ` [PATCH 4/5] mtd: rawnand: qcom: update BBT related flags Abhishek Sahu
2018-07-18 21:15 ` Miquel Raynal
2018-07-18 21:36 ` Boris Brezillon
2018-07-18 21:41 ` Miquel Raynal
2018-07-18 21:42 ` Miquel Raynal
2018-07-20 7:14 ` Abhishek Sahu
2018-07-06 7:51 ` [PATCH 5/5] mtd: rawnand: qcom: reorganization by removing read/write helpers Abhishek Sahu
2018-07-18 21:29 ` Miquel Raynal
2018-07-18 21:54 ` Boris Brezillon
2018-07-28 10:20 ` Abhishek Sahu
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=1530863519-5564-4-git-send-email-absahu@codeaurora.org \
--to=absahu@codeaurora.org \
--cc=andy.gross@linaro.org \
--cc=boris.brezillon@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
/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;
as well as URLs for NNTP newsgroup(s).