diff options
author | Jason <r64343@freescale.com> | 2009-12-28 17:29:00 +0800 |
---|---|---|
committer | Alejandro Gonzalez <alex.gonzalez@digi.com> | 2010-05-24 11:50:02 +0200 |
commit | ae9d33ef557c67f27e15513b0f1ffc9de6de3610 (patch) | |
tree | ae42a1c476b324c77da7c78fbf83ae38c2c0d260 /drivers/mtd | |
parent | f477742ebbbc78805cebb865e49394d2a53a1087 (diff) |
ENGR00119693 Uniform handling NFC INT bit clearance
Uniform handling NFC INT bit clearance, the INT bit
will be unformed cleared in the wait_op_done function
after any NFC operation.
Signed-off-by:Jason Liu <r64343@freescale.com>
Signed-off-by: Alejandro Gonzalez <alex.gonzalez@digi.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/mxc_nd2.c | 33 | ||||
-rw-r--r-- | drivers/mtd/nand/mxc_nd2.h | 14 |
2 files changed, 10 insertions, 37 deletions
diff --git a/drivers/mtd/nand/mxc_nd2.c b/drivers/mtd/nand/mxc_nd2.c index cac454b4b554..46e6380fe462 100644 --- a/drivers/mtd/nand/mxc_nd2.c +++ b/drivers/mtd/nand/mxc_nd2.c @@ -28,7 +28,7 @@ #include "mxc_nd2.h" #include "nand_device_info.h" -#define DVR_VER "2.5" +#define DVR_VER "3.0" /* Global address Variables */ static void __iomem *nfc_axi_base, *nfc_ip_base; @@ -192,12 +192,16 @@ static void wait_op_done(int maxRetries, bool useirq) { if (useirq) { if ((raw_read(REG_NFC_OPS_STAT) & NFC_OPS_STAT) == 0) { - /* Enable Interuupt */ + /* enable interrupt */ raw_write(raw_read(REG_NFC_INTRRUPT) & ~NFC_INT_MSK, REG_NFC_INTRRUPT); if (!wait_event_timeout(irq_waitq, (raw_read(REG_NFC_OPS_STAT) & NFC_OPS_STAT), msecs_to_jiffies(TROP_US_DELAY / 1000)) > 0) { + /* disable interrupt */ + raw_write(raw_read(REG_NFC_INTRRUPT) + | NFC_INT_MSK, REG_NFC_INTRRUPT); + printk(KERN_WARNING "%s(%d): INT not set\n", __func__, __LINE__); return; @@ -229,9 +233,6 @@ static inline void send_atomic_cmd(u16 cmd, bool useirq) /* fill command */ raw_write(cmd, REG_NFC_FLASH_CMD); - /* clear status */ - ACK_OPS; - /* send out command */ raw_write(NFC_CMD, REG_NFC_OPS); @@ -292,7 +293,6 @@ static void auto_cmd_interleave(struct mtd_info *mtd, u16 cmd) obuf += olen; NFC_SET_RBA(0); - ACK_OPS; raw_write(NFC_AUTO_PROG, REG_NFC_OPS); /* wait auto_prog_done bit set */ @@ -309,7 +309,6 @@ static void auto_cmd_interleave(struct mtd_info *mtd, u16 cmd) mxc_do_addr_cycle(mtd, 0, page_addr++); NFC_SET_RBA(0); - ACK_OPS; raw_write(NFC_AUTO_READ, REG_NFC_OPS); wait_op_done(TROP_US_DELAY, true); @@ -328,7 +327,6 @@ static void auto_cmd_interleave(struct mtd_info *mtd, u16 cmd) case NAND_CMD_ERASE2: for (i = 0; i < j; i++) { mxc_do_addr_cycle(mtd, -1, page_addr++); - ACK_OPS; raw_write(NFC_AUTO_ERASE, REG_NFC_OPS); wait_op_done(TROP_US_DELAY, true); } @@ -409,9 +407,6 @@ static void send_addr(u16 addr, bool useirq) /* fill address */ raw_write((addr << NFC_FLASH_ADDR_SHIFT), REG_NFC_FLASH_ADDR); - /* clear status */ - ACK_OPS; - /* send out address */ raw_write(NFC_ADDR, REG_NFC_OPS); @@ -433,9 +428,6 @@ static void send_prog_page(u8 buf_id) /* set ram buffer id */ NFC_SET_RBA(buf_id); - /* clear status */ - ACK_OPS; - /* transfer data from NFC ram to nand */ raw_write(NFC_INPUT, REG_NFC_OPS); @@ -458,9 +450,6 @@ static void send_read_page(u8 buf_id) /* set ram buffer id */ NFC_SET_RBA(buf_id); - /* clear status */ - ACK_OPS; - /* transfer data from nand to NFC ram */ raw_write(NFC_OUTPUT, REG_NFC_OPS); @@ -478,9 +467,6 @@ static void send_read_id(void) /* Set RBA bits for BUFFER0 */ NFC_SET_RBA(0); - /* clear status */ - ACK_OPS; - /* Read ID into main buffer */ raw_write(NFC_ID, REG_NFC_OPS); @@ -494,10 +480,6 @@ static inline void read_dev_status(u16 *status) { u32 mask = 0xFF << 16; - /* clear status */ - ACK_OPS; - - /* use atomic mode to read status instead of using auto mode,auto-mode has issues and the status is not correct. @@ -546,9 +528,6 @@ static u16 get_dev_status(void) /* Set ram buffer id */ NFC_SET_RBA(val); - /* clear status */ - ACK_OPS; - /* Read status into main buffer */ raw_write(NFC_STATUS, REG_NFC_OPS); diff --git a/drivers/mtd/nand/mxc_nd2.h b/drivers/mtd/nand/mxc_nd2.h index aa69b86d1608..16211706e9b9 100644 --- a/drivers/mtd/nand/mxc_nd2.h +++ b/drivers/mtd/nand/mxc_nd2.h @@ -143,10 +143,11 @@ do { \ #define WRITE_NFC_IP_REG(val,reg) \ do { \ - raw_write(NFC_IPC_CREQ, NFC_IPC); \ - while (!((raw_read(NFC_IPC) & NFC_IPC_ACK)>>1));\ + raw_write(raw_read(NFC_IPC) | NFC_IPC_CREQ, NFC_IPC); \ + while (!(raw_read(NFC_IPC) & NFC_IPC_ACK)) \ + ; \ raw_write(val, reg); \ - raw_write(0, NFC_IPC); \ + raw_write(raw_read(NFC_IPC) & ~NFC_IPC_CREQ, NFC_IPC); \ } while(0) #else @@ -333,11 +334,6 @@ do { \ #define raw_write(v,a) __raw_writel(v,a) #define raw_read(a) __raw_readl(a) -/* Explcit ack ops status (if any), before issue of any command */ -#define ACK_OPS \ - raw_write((raw_read(REG_NFC_OPS_STAT) & ~NFC_OPS_STAT), \ - REG_NFC_OPS_STAT); - /* Set RBA buffer id*/ #define NFC_SET_RBA(val) \ raw_write((raw_read(REG_NFC_SET_RBA) & \ @@ -668,8 +664,6 @@ do { \ #define NFC_GET_MAXCHIP_SP() 1 #define NFC_SET_WPC(val) val -/* NULL Definitions */ -#define ACK_OPS #define NFC_SET_RBA(val) raw_write(val, REG_NFC_SET_RBA); #ifdef CONFIG_ARCH_MXC_HAS_NFC_V2_1 |