summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/hisi504_nand.c
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-09-13 04:05:50 +0200
committerBoris Brezillon <boris.brezillon@free-electrons.com>2017-09-18 14:55:52 +0200
commit14157f861437ebe2d624b0a845b91bbdf8ca9a2d (patch)
treeee3b430a97c0516cd92455525419a3edc3db25d5 /drivers/mtd/nand/hisi504_nand.c
parentmtd: nand: Use standard large page OOB layout when using NAND_ECC_NONE (diff)
downloadlinux-14157f861437ebe2d624b0a845b91bbdf8ca9a2d.tar.xz
linux-14157f861437ebe2d624b0a845b91bbdf8ca9a2d.zip
mtd: nand: introduce NAND_ROW_ADDR_3 flag
Several drivers check ->chipsize to see if the third row address cycle is needed. Instead of embedding magic sizes such as 32MB, 128MB in drivers, introduce a new flag NAND_ROW_ADDR_3 for clean-up. Since nand_scan_ident() knows well about the device, it can handle this properly. The flag is set if the row address bit width is greater than 16. Delete comments such as "One more address cycle for ..." because intention is now clear enough from the code. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Wenyou Yang <wenyou.yang@microchip.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Diffstat (limited to 'drivers/mtd/nand/hisi504_nand.c')
-rw-r--r--drivers/mtd/nand/hisi504_nand.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/mtd/nand/hisi504_nand.c b/drivers/mtd/nand/hisi504_nand.c
index d9ee1a7e6956..0897261c3e17 100644
--- a/drivers/mtd/nand/hisi504_nand.c
+++ b/drivers/mtd/nand/hisi504_nand.c
@@ -432,8 +432,7 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr)
host->addr_value[0] |= (page_addr & 0xffff)
<< (host->addr_cycle * 8);
host->addr_cycle += 2;
- /* One more address cycle for devices > 128MiB */
- if (chip->chipsize > (128 << 20)) {
+ if (chip->options & NAND_ROW_ADDR_3) {
host->addr_cycle += 1;
if (host->command == NAND_CMD_ERASE1)
host->addr_value[0] |= ((page_addr >> 16) & 0xff) << 16;