]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.6/0024-mtd-gpmi-nand-bugfix-reset-the-BCH-module-when-it-is.patch
linux-ti335x-psp 3.2: update to 3.2.6
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.6 / 0024-mtd-gpmi-nand-bugfix-reset-the-BCH-module-when-it-is.patch
1 From 5e71844e1d3a9ae8681fc18781a3579eed4b2406 Mon Sep 17 00:00:00 2001
2 From: Huang Shijie <b32955@freescale.com>
3 Date: Wed, 4 Jan 2012 11:18:46 +0800
4 Subject: [PATCH 24/87] mtd: gpmi-nand bugfix: reset the BCH module when it is
5  not MX23
7 commit 9398d1ce09b9009996f7d2468e1d3c785fa6feda upstream.
9 In MX28, if we do not reset the BCH module. The BCH module may
10 becomes unstable when the board reboots for several thousands times.
11 This bug has been catched in customer's production.
13 The patch adds some comments (some from Wolfram Sang), and fixes it now.
15 Also change gpmi_reset_block() to static.
17 Signed-off-by: Huang Shijie <b32955@freescale.com>
18 Acked-by: Marek Vasut <marek.vasut@gmail.com>
19 Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
20 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 ---
23  drivers/mtd/nand/gpmi-nand/gpmi-lib.c |   18 ++++++++++++++----
24  1 files changed, 14 insertions(+), 4 deletions(-)
26 diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
27 index de4db76..bb2fe60 100644
28 --- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
29 +++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
30 @@ -69,17 +69,19 @@ static int clear_poll_bit(void __iomem *addr, u32 mask)
31   *  [1] enable the module.
32   *  [2] reset the module.
33   *
34 - * In most of the cases, it's ok. But there is a hardware bug in the BCH block.
35 + * In most of the cases, it's ok.
36 + * But in MX23, there is a hardware bug in the BCH block (see erratum #2847).
37   * If you try to soft reset the BCH block, it becomes unusable until
38   * the next hard reset. This case occurs in the NAND boot mode. When the board
39   * boots by NAND, the ROM of the chip will initialize the BCH blocks itself.
40   * So If the driver tries to reset the BCH again, the BCH will not work anymore.
41 - * You will see a DMA timeout in this case.
42 + * You will see a DMA timeout in this case. The bug has been fixed
43 + * in the following chips, such as MX28.
44   *
45   * To avoid this bug, just add a new parameter `just_enable` for
46   * the mxs_reset_block(), and rewrite it here.
47   */
48 -int gpmi_reset_block(void __iomem *reset_addr, bool just_enable)
49 +static int gpmi_reset_block(void __iomem *reset_addr, bool just_enable)
50  {
51         int ret;
52         int timeout = 0x400;
53 @@ -206,7 +208,15 @@ int bch_set_geometry(struct gpmi_nand_data *this)
54         if (ret)
55                 goto err_out;
56  
57 -       ret = gpmi_reset_block(r->bch_regs, true);
58 +       /*
59 +       * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
60 +       * chip, otherwise it will lock up. So we skip resetting BCH on the MX23.
61 +       * On the other hand, the MX28 needs the reset, because one case has been
62 +       * seen where the BCH produced ECC errors constantly after 10000
63 +       * consecutive reboots. The latter case has not been seen on the MX23 yet,
64 +       * still we don't know if it could happen there as well.
65 +       */
66 +       ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this));
67         if (ret)
68                 goto err_out;
69  
70 -- 
71 1.7.7.4