Skip to contentSkip to conversation

MTD/GPMI bugfix : reset the BCH module when it is not MX23

PATCH New Huang Shijie 2 participants 3 messages Dec 30, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MTD/GPMI bugfix : reset the BCH module when it is not MX23

In MX28, if we do not reset the BCH module. The BCH module may becomes unstable when the board reboots for several thousands times. This bug has been catched in customer's production.

The patch adds some comments, and fixes it now.

Also change gpmi_reset_block() to static.

---
 drivers/mtd/nand/gpmi-nand/gpmi-lib.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
drivers/mtd/nand/gpmi-nand/gpmi-lib.c +10 -3
index de4db76..f54063d 100644
@@ -69,7 +69,8 @@ static int clear_poll_bit(void __iomem *addr, u32 mask)
  *  [1] enable the module.
  *  [2] reset the module.
  *
- * In most of the cases, it's ok. But there is a hardware bug in the BCH block.
+ * In most of the cases, it's ok.
+ * But in MX23, there is a hardware bug in the BCH block.
  * If you try to soft reset the BCH block, it becomes unusable until
  * the next hard reset. This case occurs in the NAND boot mode. When the board
  * boots by NAND, the ROM of the chip will initialize the BCH blocks itself.
@@ -78,8 +79,10 @@ static int clear_poll_bit(void __iomem *addr, u32 mask)
  *
  * To avoid this bug, just add a new parameter `just_enable` for
  * the mxs_reset_block(), and rewrite it here.
+ *
+ * The bug has been fixed in the following chips, such as MX28.
  */
-int gpmi_reset_block(void __iomem *reset_addr, bool just_enable)
+static int gpmi_reset_block(void __iomem *reset_addr, bool just_enable)
 {
 	int ret;
 	int timeout = 0x400;
@@ -206,7 +209,11 @@ int bch_set_geometry(struct gpmi_nand_data *this)
 	if (ret)
 		goto err_out;
 
-	ret = gpmi_reset_block(r->bch_regs, true);
+	/* The bug only exits in mx23, the following chips fix it. */
+	if (GPMI_IS_MX23(this))
+		ret = gpmi_reset_block(r->bch_regs, true);
+	else
+		ret = gpmi_reset_block(r->bch_regs, false);
 	if (ret)
 		goto err_out;
 
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 MTD/GPMI bugfix : reset the BCH module when it is not MX23

Hi Huang,

Quoted 10 lines · Huang Shijie

In MX28, if we do not reset the BCH module. The BCH module may becomes unstable when the board reboots for several thousands times. This bug has been catched in customer's production.

The patch adds some comments, and fixes it now.

Also change gpmi_reset_block() to static.

---

[snip]

drivers/mtd/nand/gpmi-nand/gpmi-lib.c int bch_set_geometry(struct gpmi_nand_data *this) · line 216

Quoted 6 lines
drivers/mtd/nand/gpmi-nand/gpmi-lib.c +5 -1
-	ret = gpmi_reset_block(r->bch_regs, true);
+	/* The bug only exits in mx23, the following chips fix it. */
+	if (GPMI_IS_MX23(this))
+		ret = gpmi_reset_block(r->bch_regs, true);
+	else
+		ret = gpmi_reset_block(r->bch_regs, false);

This can be shortened to:

    ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this));
Quoted 5 lines
(quoted diff) +0 -0
 	if (ret)
 		goto err_out;
Signature · 2 lines
-- 
1.7.0.4

baruch

Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#2 lore raw

PATCH 1/1 MTD/GPMI bugfix : reset the BCH module when it is not MX23

Hi Baruch:

Quoted 23 lines

Hi Huang,

Quoted 10 lines · Huang Shijie

In MX28, if we do not reset the BCH module. The BCH module may becomes unstable when the board reboots for several thousands times. This bug has been catched in customer's production.

The patch adds some comments, and fixes it now.

Also change gpmi_reset_block() to static.

---

[snip]

drivers/mtd/nand/gpmi-nand/gpmi-lib.c int bch_set_geometry(struct gpmi_nand_data *this) · line 216

Quoted 6 lines
drivers/mtd/nand/gpmi-nand/gpmi-lib.c +5 -1
-	ret = gpmi_reset_block(r->bch_regs, true);
+	/* The bug only exits in mx23, the following chips fix it. */
+	if (GPMI_IS_MX23(this))
+		ret = gpmi_reset_block(r->bch_regs, true);
+	else
+		ret = gpmi_reset_block(r->bch_regs, false);

This can be shortened to:

Quoted 1 line
     ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this));

thanks a lot.

I will use it in new patch.

Huang Shijie

Quoted 7 lines
Quoted 5 lines

if (ret)
goto err_out;

Signature · 1 line
1.7.0.4

baruch