]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: nand: omap: make am33xx/elm.c as common driver for all OMAPx and AMxxxx platforms
authorpekon gupta <pekon@ti.com>
Mon, 18 Nov 2013 13:32:59 +0000 (19:02 +0530)
committerScott Wood <scottwood@freescale.com>
Thu, 21 Nov 2013 19:33:41 +0000 (13:33 -0600)
ELM hardware engine which is used for ECC error detection, is present on all
latest OMAP SoC (like OMAP4xxx, OMAP5xxx, DRA7xxx, AM33xx, AM43xx). Thus ELM
driver should be moved to common drivers/mtd/nand/ folder so that all SoC
having on-chip ELM hardware engine can re-use it.
This patch has following changes:
- mv arch/arm/include/asm/arch-am33xx/elm.h arch/arm/include/asm/omap_elm.h
- mv arch/arm/cpu/armv7/am33xx/elm.c drivers/mtd/nand/omap_elm.c
- update Makefiles
- update #include <asm/elm.h>
- add CONFIG_NAND_OMAP_ELM to compile driver/mtd/nand/omap_elm.c
and include in all board configs using AM33xx SoC platform.

Signed-off-by: Pekon Gupta <pekon@ti.com>
arch/arm/cpu/armv7/am33xx/Makefile
arch/arm/include/asm/omap_elm.h [moved from arch/arm/include/asm/arch-am33xx/elm.h with 100% similarity]
doc/README.nand
drivers/mtd/nand/Makefile
drivers/mtd/nand/omap_elm.c [moved from arch/arm/cpu/armv7/am33xx/elm.c with 97% similarity]
drivers/mtd/nand/omap_gpmc.c
include/configs/am335x_evm.h
include/configs/am335x_igep0033.h
include/configs/siemens-am33x-common.h

index 966fcab71b477c1055013ab86d5d9dd489ecf48f..5566310d9481f68dc1b6191e6440f8c793b351df 100644 (file)
@@ -19,4 +19,3 @@ obj-y += ddr.o
 obj-y  += emif4.o
 obj-y  += board.o
 obj-y  += mux.o
-obj-$(CONFIG_NAND_OMAP_GPMC)   += elm.o
index 3a507b6c816cfe27509fccc34d3c39e24133a06d..ce7ea5e1e9d820d8d74cb29b895e2376b4a73cb7 100644 (file)
@@ -179,6 +179,25 @@ Configuration Options:
       Please convert your driver even if you don't need the extra
       flexibility, so that one day we can eliminate the old mechanism.
 
+
+Platform specific options
+=========================
+   CONFIG_NAND_OMAP_GPMC
+       Enables omap_gpmc.c driver for OMAPx and AMxxxx platforms.
+       GPMC controller is used for parallel NAND flash devices, and can
+       do ECC calculation (not ECC error detection) for HAM1, BCH4, BCH8
+       and BCH16 ECC algorithms.
+
+   CONFIG_NAND_OMAP_ELM
+       Enables omap_elm.c driver for OMAPx and AMxxxx platforms.
+       ELM controller is used for ECC error detection (not ECC calculation)
+       of BCH4, BCH8 and BCH16 ECC algorithms.
+       Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
+       thus such SoC platforms need to depend on software library for ECC error
+       detection. However ECC calculation on such plaforms would still be
+       done by GPMC controller.
+
+
 NOTE:
 =====
 
index eb1eafaf064f8151e3490e1bd374d766686d1539..e145cd18421ad764f661c174ea1b70357f2b4d4e 100644 (file)
@@ -58,6 +58,7 @@ obj-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o
 obj-$(CONFIG_NAND_SPEAR) += spr_nand.o
 obj-$(CONFIG_TEGRA_NAND) += tegra_nand.o
 obj-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
+obj-$(CONFIG_NAND_OMAP_ELM) += omap_elm.o
 obj-$(CONFIG_NAND_PLAT) += nand_plat.o
 obj-$(CONFIG_NAND_DOCG4) += docg4.o
 
similarity index 97%
rename from arch/arm/cpu/armv7/am33xx/elm.c
rename to drivers/mtd/nand/omap_elm.c
index 8f1d6afdd399a4b326f35cf4e38d5d4e8873bb24..2aa7807f3e5e5bba40b84b183073ada9bb490845 100644 (file)
@@ -18,7 +18,7 @@
 #include <asm/errno.h>
 #include <asm/arch/cpu.h>
 #include <asm/omap_gpmc.h>
-#include <asm/arch/elm.h>
+#include <asm/omap_elm.h>
 
 #define ELM_DEFAULT_POLY (0)
 
@@ -127,7 +127,7 @@ int elm_check_error(u8 *syndrome, u32 nibbles, u32 *error_count,
 
        for (i = 0; i < *error_count; i++) {
                error_locations[i] =
-                       readl(&elm_cfg->error_location[poly].error_location_x[i]);
+                    readl(&elm_cfg->error_location[poly].error_location_x[i]);
        }
 
        return 0;
@@ -175,7 +175,7 @@ void elm_reset(void)
 {
        /* initiate reset */
        writel((readl(&elm_cfg->sysconfig) | ELM_SYSCONFIG_SOFTRESET),
-                               &elm_cfg->sysconfig);
+                       &elm_cfg->sysconfig);
 
        /* wait for reset complete and normal operation */
        while ((readl(&elm_cfg->sysstatus) & ELM_SYSSTATUS_RESETDONE) !=
index ec1787f22492d93322a4014c6acc3d3da9ba2d9f..c8288597a49c62497c1218615d4972bf587b51f4 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/compiler.h>
 #include <nand.h>
 #ifdef CONFIG_AM33XX
-#include <asm/arch/elm.h>
+#include <asm/omap_elm.h>
 #endif
 
 static uint8_t cs;
index c2ba7e35d891bcf145885c9f278ba10e45d73c11..73d8b4dfba4d6744040e4c9c7fae88a4cd3196ab 100644 (file)
 #define CONFIG_SPL_LDSCRIPT            "$(CPUDIR)/am33xx/u-boot-spl.lds"
 
 #ifdef CONFIG_NAND
+#define CONFIG_NAND_OMAP_GPMC
+#define CONFIG_NAND_OMAP_ELM
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 #define CONFIG_SYS_NAND_PAGE_COUNT     (CONFIG_SYS_NAND_BLOCK_SIZE / \
                                         CONFIG_SYS_NAND_PAGE_SIZE)
index 2c69d4e30c53c5ea2ff112d7f1e121a395722bf2..88ced7311f5fd9321fdd8cb6cd4596d20eac12d2 100644 (file)
 /* NAND support */
 #define CONFIG_NAND
 #define CONFIG_NAND_OMAP_GPMC
+#define CONFIG_NAND_OMAP_ELM
 #define GPMC_NAND_ECC_LP_x16_LAYOUT    1
 #define CONFIG_SYS_NAND_BASE           (0x08000000)    /* phys address CS0 */
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
index 9eb0a04da6622dccafeb0211f64b4d3d69097cd0..f3b41975cf5e08389490a669455753786a740751 100644 (file)
                "\0"
 
 #define CONFIG_NAND_OMAP_GPMC
+#define CONFIG_NAND_OMAP_ELM
 #define GPMC_NAND_ECC_LP_x16_LAYOUT    1
 #define CONFIG_SYS_NAND_BASE           (0x08000000)    /* physical address */
                                                        /* to access nand at */