mtd: mtk-nor: adjust sequence of trigger function and assignment function

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Jan 12 15:59:27 PST 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=80e1ca692107b0bc5b088fd9c4a20726fb1a66a2
Commit:     80e1ca692107b0bc5b088fd9c4a20726fb1a66a2
Parent:     8142b47ef33c655a34e08efd46b65732fe190675
Author:     Bayi Cheng <bayi.cheng at mediatek.com>
AuthorDate: Fri Dec 18 11:02:40 2015 +0800
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Fri Dec 18 15:05:43 2015 -0800

    mtd: mtk-nor: adjust sequence of trigger function and assignment function
    
    Move write data register before excute command to avoid
    missing first byte write to nor flash
    
    Signed-off-by: Bayi Cheng <bayi.cheng at mediatek.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/spi-nor/mtk-quadspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/mtk-quadspi.c b/drivers/mtd/spi-nor/mtk-quadspi.c
index e1dd9fd..d5f850d 100644
--- a/drivers/mtd/spi-nor/mtk-quadspi.c
+++ b/drivers/mtd/spi-nor/mtk-quadspi.c
@@ -272,10 +272,10 @@ static int mt8173_nor_write_single_byte(struct mt8173_nor *mt8173_nor,
 	mt8173_nor_set_addr(mt8173_nor, addr);
 
 	for (i = 0; i < length; i++) {
+		writeb(*data++, mt8173_nor->base + MTK_NOR_WDATA_REG);
 		ret = mt8173_nor_execute_cmd(mt8173_nor, MTK_NOR_PIO_WR_CMD);
 		if (ret < 0)
 			return ret;
-		writeb(*data++, mt8173_nor->base + MTK_NOR_WDATA_REG);
 	}
 	return 0;
 }



More information about the linux-mtd-cvs mailing list