From: Sourav Poddar To: Subject: [PATCH] fs: jffs2: Add setup code for spi nor flash. Date: Mon, 9 Dec 2013 10:44:35 +0530 Message-ID: <1386566075-28107-1-git-send-email-sourav.poddar@ti.com> MIME-Version: 1.0 Content-Type: text/plain Cc: Sourav Poddar , linux-mtd@lists.infradead.org, George Cherian , balbi@ti.com List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Flash need to be setup, while using it for Jffs2 filesystem. The setup code checks was not present for serial flash like m25p80. As a result of which, internal pointers/buffers are in unknown state. This leads to a. dumps like below[1] while mounting a jffs2 filesystem. b. Hang while doing a mount second time. [1]: root@am437x-evm:~# sync [ 84.112640] INFO: trying to register non-static key. [ 84.117553] the code is fine but needs lockdep annotation. [ 84.122985] turning off the locking correctness validator. [ 84.128417] CPU: 0 PID: 1289 Comm: sync Not tainted 3.12.0-67367-g2d1978c-dirty #18 [ 84.136016] [] (unwind_backtrace+0x0/0xf0) from [] (show_stack+0x10/0x14) [ 84.144439] [] (show_stack+0x10/0x14) from [] (dump_stack+0x78/0x94) [ 84.152465] [] (dump_stack+0x78/0x94) from [] (__lock_acquire+0x1788/0x1b8c) [ 84.161132] [] (__lock_acquire+0x1788/0x1b8c) from [] (lock_acquire+0x9c/0x104) [ 84.170104] [] (lock_acquire+0x9c/0x104) from [] (flush_work+0x38/0x78) [ 84.178375] [] (flush_work+0x38/0x78) from [] (__cancel_work_timer+0x84/0x124) [ 84.187225] [] (__cancel_work_timer+0x84/0x124) from [] (jffs2_sync_fs+0x14/0x38) [ 84.196380] [] (jffs2_sync_fs+0x14/0x38) from [] (sync_fs_one_sb+0x28/0x2c) [ 84.204986] [] (sync_fs_one_sb+0x28/0x2c) from [] (iterate_supers+0xb0/0xd8) [ 84.213684] [] (iterate_supers+0xb0/0xd8) from [] (sys_sync+0x3c/0x98) [ 84.221862] [] (sys_sync+0x3c/0x98) from [] (ret_fast_syscall+0x0/0x48) The patch fixes the above two issue. Signed-off-by: Sourav Poddar Signed-off-by: George Cherian --- fs/jffs2/fs.c | 7 +++++++ fs/jffs2/os-linux.h | 2 ++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index fe3c052..02003f0 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c @@ -725,6 +725,13 @@ static int jffs2_flash_setup(struct jffs2_sb_info *c) { return ret; } + /* m25p80 spi flash */ + if (jffs2_nor_spi_wbuf_flash(c)) { + ret = jffs2_nor_wbuf_flash_setup(c); + if (ret) + return ret; + } + /* and an UBI volume */ if (jffs2_ubivol(c)) { ret = jffs2_ubivol_setup(c); diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index d200a9b..09ba999 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h @@ -134,6 +134,8 @@ int jffs2_ubivol_setup(struct jffs2_sb_info *c); void jffs2_ubivol_cleanup(struct jffs2_sb_info *c); #define jffs2_nor_wbuf_flash(c) (c->mtd->type == MTD_NORFLASH && ! (c->mtd->flags & MTD_BIT_WRITEABLE)) +#define jffs2_nor_spi_wbuf_flash(c) \ + (c->mtd->type == MTD_NORFLASH && (c->mtd->flags & MTD_CAP_NORFLASH)) int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c); void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c); void jffs2_dirty_trigger(struct jffs2_sb_info *c); -- 1.7.1