mtd: nand: sunxi: Improve sunxi_nfc_cmd_ctrl()
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sun Feb 12 18:59:05 PST 2017
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=cad32741218299eee3f75de21ac9ccab8485bd62
Commit: cad32741218299eee3f75de21ac9ccab8485bd62
Parent: 8de15e1feb232086d1d14e01a6a7648d10002c19
Author: Boris Brezillon <boris.brezillon at free-electrons.com>
AuthorDate: Fri Jan 6 10:42:07 2017 +0100
Committer: Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Mon Feb 6 09:35:19 2017 +0100
mtd: nand: sunxi: Improve sunxi_nfc_cmd_ctrl()
We only need to call sunxi_nfc_wait_cmd_fifo_empty() if we want to send
a new command. Move the sunxi_nfc_wait_cmd_fifo_empty() call to right
place to avoid extra register reads.
Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
drivers/mtd/nand/sunxi_nand.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index 76449f7..0eeeb8b 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -604,10 +604,6 @@ static void sunxi_nfc_cmd_ctrl(struct mtd_info *mtd, int dat,
struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller);
int ret;
- ret = sunxi_nfc_wait_cmd_fifo_empty(nfc);
- if (ret)
- return;
-
if (dat == NAND_CMD_NONE && (ctrl & NAND_NCE) &&
!(ctrl & (NAND_CLE | NAND_ALE))) {
u32 cmd = 0;
@@ -637,6 +633,10 @@ static void sunxi_nfc_cmd_ctrl(struct mtd_info *mtd, int dat,
writel(sunxi_nand->addr[1],
nfc->regs + NFC_REG_ADDR_HIGH);
+ ret = sunxi_nfc_wait_cmd_fifo_empty(nfc);
+ if (ret)
+ return;
+
writel(cmd, nfc->regs + NFC_REG_CMD);
sunxi_nand->addr[0] = 0;
sunxi_nand->addr[1] = 0;
More information about the linux-mtd-cvs
mailing list