All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sukumar Ghorai <s-ghorai@ti.com>
To: linux-omap@vger.kernel.org
Cc: Sukumar Ghorai <s-ghorai@ti.com>, Vimal Singh <vimalsingh@ti.com>
Subject: [PATCH] omap: NAND: ecc layout select from board file
Date: Tue, 13 Apr 2010 23:07:25 +0530	[thread overview]
Message-ID: <1271180246-31779-14-git-send-email-s-ghorai@ti.com> (raw)
In-Reply-To: <1271180246-31779-13-git-send-email-s-ghorai@ti.com>

    This patch makes it possible to select sw or hw (different layout options)
    ecc scheme supported by omap nand driver.  And hw ecc layout selected for
    sdp and zoom boards, by default.

Signed-off-by: Sukumar Ghorai <s-ghorai@ti.com>
Signed-off-by: Vimal Singh <vimalsingh@ti.com>
---
 arch/arm/mach-omap2/board-sdp-flash.c  |    1 +
 arch/arm/mach-omap2/board-zoom-flash.c |    1 +
 arch/arm/plat-omap/include/plat/nand.h |    4 ++++
 drivers/mtd/nand/omap2.c               |   28 ++++++++++++----------------
 4 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-omap2/board-sdp-flash.c b/arch/arm/mach-omap2/board-sdp-flash.c
index 663c9c2..29e0768 
--- a/arch/arm/mach-omap2/board-sdp-flash.c
+++ b/arch/arm/mach-omap2/board-sdp-flash.c
@@ -162,6 +162,7 @@ __init board_nand_init(struct flash_partitions sdp_nand_parts, u8 cs)
 	sdp_nand_data.cs		= cs;
 	sdp_nand_data.parts		= sdp_nand_parts.parts;
 	sdp_nand_data.nr_parts		= sdp_nand_parts.nr_parts;
+	sdp_nand_data.ecc_opt		= 0x1; /* HW ECC in default layout */
 	if (cpu_is_omap3630())
 		sdp_nand_data.devsize = 1; /* 0: 8-bit, 1: 16-bit device */
 
diff --git a/arch/arm/mach-omap2/board-zoom-flash.c b/arch/arm/mach-omap2/board-zoom-flash.c
index 6a5dcf4..1547bdb
--- a/arch/arm/mach-omap2/board-zoom-flash.c
+++ b/arch/arm/mach-omap2/board-zoom-flash.c
@@ -71,6 +71,7 @@ void __init zoom_flash_init(struct flash_partitions zoom_nand_parts[], int cs)
 	zoom_nand_data.cs		= cs;
 	zoom_nand_data.parts		= zoom_nand_parts[0].parts;
 	zoom_nand_data.nr_parts		= zoom_nand_parts[0].nr_parts;
+	zoom_nand_data.ecc_opt		= 0x1; /* HW ECC in default layout */
 	zoom_nand_data.gpmc_baseaddr	= (void *)(gpmc_base_add);
 	zoom_nand_data.gpmc_cs_baseaddr	= (void *)(gpmc_base_add +
 					GPMC_CS0_BASE +	cs * GPMC_CS_SIZE);
diff --git a/arch/arm/plat-omap/include/plat/nand.h b/arch/arm/plat-omap/include/plat/nand.h
index 8ba2e3e..b2ccd68 100644
--- a/arch/arm/plat-omap/include/plat/nand.h
+++ b/arch/arm/plat-omap/include/plat/nand.h
@@ -25,6 +25,10 @@ struct omap_nand_platform_data {
 	void __iomem		*gpmc_cs_baseaddr;
 	void __iomem		*gpmc_baseaddr;
 	int			devsize;
+	int			ecc_opt; /* 0x0 - sw ecc
+					  * 0x1 - hw ecc default ecc layout
+					  * 0x2 - hw ecc in romcode layout
+					  */
 };
 
 /* size (4 KiB) for IO mapping */
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 5b49c84..b42d058
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -31,7 +31,6 @@
 #define	GPMC_BUF_FULL	0x00000001
 #define	GPMC_BUF_EMPTY	0x00000000
 
-#ifdef CONFIG_MTD_NAND_OMAP_HWECC
 #define NAND_Ecc_P1e		(1 << 0)
 #define NAND_Ecc_P2e		(1 << 1)
 #define NAND_Ecc_P4e		(1 << 2)
@@ -98,7 +97,6 @@
 
 #define P4e_s(a)	(TF(a & NAND_Ecc_P4e)		<< 0)
 #define P4o_s(a)	(TF(a & NAND_Ecc_P4o)		<< 1)
-#endif /* CONFIG_MTD_NAND_OMAP_HWECC */
 
 #ifdef CONFIG_MTD_PARTITIONS
 static const char *part_probes[] = { "cmdlinepart", NULL };
@@ -679,7 +677,6 @@ static int omap_verify_buf(struct mtd_info *mtd, const u_char * buf, int len)
 	return 0;
 }
 
-#ifdef CONFIG_MTD_NAND_OMAP_HWECC
 /**
  * omap_hwecc_init - Initialize the HW ECC for NAND flash in GPMC controller
  * @mtd: MTD device structure
@@ -957,7 +954,6 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int mode)
 
 	__raw_writel(val, info->gpmc_baseaddr + GPMC_ECC_CONFIG);
 }
-#endif
 
 /**
  * omap_wait - wait until the command is done
@@ -1145,19 +1141,19 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
 	}
 	info->nand.verify_buf = omap_verify_buf;
 
-#ifdef CONFIG_MTD_NAND_OMAP_HWECC
-	info->nand.ecc.bytes		= 3;
-	info->nand.ecc.size		= 512;
-	info->nand.ecc.calculate	= omap_calculate_ecc;
-	info->nand.ecc.hwctl		= omap_enable_hwecc;
-	info->nand.ecc.correct		= omap_correct_data;
-	info->nand.ecc.mode		= NAND_ECC_HW;
+	if (pdata->ecc_opt & 0x3) {
+		info->nand.ecc.bytes		= 3;
+		info->nand.ecc.size		= 512;
+		info->nand.ecc.calculate	= omap_calculate_ecc;
+		info->nand.ecc.hwctl		= omap_enable_hwecc;
+		info->nand.ecc.correct		= omap_correct_data;
+		info->nand.ecc.mode		= NAND_ECC_HW;
 
-	/* init HW ECC */
-	omap_hwecc_init(&info->mtd);
-#else
-	info->nand.ecc.mode = NAND_ECC_SOFT;
-#endif
+		/* init HW ECC */
+		omap_hwecc_init(&info->mtd);
+	} else {
+		info->nand.ecc.mode = NAND_ECC_SOFT;
+	}
 
 	/* DIP switches on some boards change between 8 and 16 bit
 	 * bus widths for flash.  Try the other width if the first try fails.
-- 
1.5.4.7


  reply	other threads:[~2010-04-13 17:37 UTC|newest]

Thread overview: 159+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Sukumar Ghorai <s-ghorai@ti.com>
2010-04-06 12:29 ` [PATCH 0/2] OMAP: Flash device support 3630 sdp board Sukumar Ghorai
2010-04-06 12:29   ` [PATCH 1/2] OMAP3630SDP: Add support for Flash Sukumar Ghorai
2010-04-06 12:29     ` [PATCH 2/2] OMAP3630SDP: enable Flash device support Sukumar Ghorai
2010-04-06 13:02     ` [PATCH 1/2] OMAP3630SDP: Add support for Flash Vimal Singh
2010-04-13 17:37 ` [PATCH] nand support on omap3 boards Sukumar Ghorai
2010-04-13 17:37   ` [PATCH v3 1/8] omap3: zoom: Introducing 'board-zoom-flash.c' Sukumar Ghorai
2010-04-13 17:37     ` [PATCH v3 2/8] omap3: add support for NAND on zoom2 board Sukumar Ghorai
2010-04-13 17:37       ` [PATCH v3 3/8] omap3: add support for NAND on zoom3 board Sukumar Ghorai
2010-04-13 17:37         ` [PATCH v2 4/8] omap-3630-sdp : Add support for Flash Sukumar Ghorai
2010-04-13 17:37           ` [PATCH v2 5/8] omap-3630-sdp: enable Flash device support Sukumar Ghorai
2010-04-13 17:37             ` [PATCH v2 6/8] omap3: add support for NAND on LDP board Sukumar Ghorai
2010-04-13 17:37               ` [PATCH 7/8] zoom2: enable NAND support Sukumar Ghorai
2010-04-13 17:37                 ` [PATCH 8/8] zoom3: " Sukumar Ghorai
2010-04-13 17:37                   ` [PATCH] nand support on omap3 boards Sukumar Ghorai
2010-04-13 17:37                     ` [PATCH 8/8] omap3: GPMC register definition at common location Sukumar Ghorai
2010-04-13 17:37                       ` [PATCH] omap3: NAND Prefetch in IRQ mode support Sukumar Ghorai
2010-04-13 17:37                         ` [PATCH] omap-3630 NAND: enable NAND io in prefetch-irq mode Sukumar Ghorai
2010-04-13 17:37                           ` Sukumar Ghorai [this message]
2010-04-13 17:37                             ` [PATCH] omap: NAND: Making ecc layout as compatible with romcode ecc Sukumar Ghorai
2010-04-14  4:35                     ` [PATCH] nand support on omap3 boards Vimal Singh
2010-04-14  4:37                       ` Vimal Singh
2010-04-14  4:38                       ` Ghorai, Sukumar
2010-05-04  6:00   ` Ghorai, Sukumar
2010-05-04  6:01   ` Ghorai, Sukumar
2010-05-28 13:48   ` Ghorai, Sukumar
2010-04-13 17:44 ` Sukumar Ghorai
2010-04-16 11:32 ` [PATCH 0/6] nand prefetch-irq support and ecc layout chanage Sukumar Ghorai
2010-04-16 11:32   ` Sukumar Ghorai
2010-04-16 11:34 ` [PATCH 1/6] omap3: GPMC register definition at common location Sukumar Ghorai
2010-04-16 11:34   ` Sukumar Ghorai
2010-04-16 11:35 ` [PATCH 2/6] omap3: NAND Prefetch in IRQ mode support Sukumar Ghorai
2010-04-16 11:35   ` Sukumar Ghorai
2010-04-16 11:35 ` [PATCH 3/6] OMAP NAND: configurable fifo threshold to gain the throughput Sukumar Ghorai
2010-04-16 11:35   ` Sukumar Ghorai
2010-04-16 12:45   ` Vimal Singh
2010-04-16 12:45     ` Vimal Singh
2010-04-16 11:35 ` [PATCH 4/6] omap-3630 NAND: enable NAND io in prefetch-irq mode Sukumar Ghorai
2010-04-16 11:35   ` Sukumar Ghorai
2010-04-16 11:35 ` [PATCH 5/6] omap: NAND: ecc layout select from board file Sukumar Ghorai
2010-04-16 11:35   ` Sukumar Ghorai
2010-04-16 11:35 ` [PATCH 6/6] omap: NAND: Making ecc layout as compatible with romcode ecc Sukumar Ghorai
2010-04-16 11:35   ` Sukumar Ghorai
2010-05-12  9:48 ` [PATCH 0/3] omap3 nand: cleanup exiting platform related code Sukumar Ghorai
2010-05-12  9:48   ` Sukumar Ghorai
2010-05-12  9:48   ` [PATCH 1/3] omap3: GPMC register definition at common location Sukumar Ghorai
2010-05-12  9:48     ` Sukumar Ghorai
2010-05-12  9:48     ` [PATCH 2/3] omap3 nand: cleanup for not to use GPMC virtual address Sukumar Ghorai
2010-05-12  9:48       ` Sukumar Ghorai
2010-05-12  9:48       ` [PATCH 3/3] omap3 nand: fix issue in board file to detect the nand Sukumar Ghorai
2010-05-12  9:48         ` Sukumar Ghorai
2010-05-13 15:41       ` [PATCH 2/3] omap3 nand: cleanup for not to use GPMC virtual address Tony Lindgren
2010-05-13 15:41         ` Tony Lindgren
2010-05-13 18:48         ` Ghorai, Sukumar
2010-05-13 18:48           ` Ghorai, Sukumar
2010-05-13  6:15     ` [PATCH 1/3] omap3: GPMC register definition at common location Mike Rapoport
2010-05-13  6:15       ` Mike Rapoport
2010-05-13 15:41     ` Tony Lindgren
2010-05-13 15:41       ` Tony Lindgren
2010-05-13 15:44   ` [PATCH 0/3] omap3 nand: cleanup exiting platform related code Tony Lindgren
2010-05-13 15:44     ` Tony Lindgren
2010-05-14 15:23 ` [PATCH v2 0/2] " Sukumar Ghorai
2010-05-14 15:23   ` Sukumar Ghorai
2010-05-14 15:23   ` [PATCH v2 1/2] omap3 nand: cleanup for not to use GPMC virtual address Sukumar Ghorai
2010-05-14 15:23     ` Sukumar Ghorai
2010-05-14 15:23     ` [PATCH v2 2/2] omap3 nand: fix issue in board file to detect the nand Sukumar Ghorai
2010-05-14 15:23       ` Sukumar Ghorai
2010-05-14 15:28     ` [PATCH v2 1/2] omap3 nand: cleanup for not to use GPMC virtual address Tony Lindgren
2010-05-14 15:28       ` Tony Lindgren
2010-05-14 18:02     ` Vimal Singh
2010-05-14 18:02       ` Vimal Singh
2010-05-17  4:22       ` Ghorai, Sukumar
2010-05-17  4:22         ` Ghorai, Sukumar
2010-05-17 14:26         ` Vimal Singh
2010-05-17 14:26           ` Vimal Singh
2010-05-17 14:34           ` Ghorai, Sukumar
2010-05-17 14:34             ` Ghorai, Sukumar
2010-05-14 23:58     ` Tony Lindgren
2010-05-14 23:58       ` Tony Lindgren
2010-05-17  5:48       ` Ghorai, Sukumar
2010-05-17  5:48         ` Ghorai, Sukumar
2010-05-18 11:16 ` [PATCH v3 0/3] omap3 nand: cleanup exiting platform related code Sukumar Ghorai
2010-05-18 11:16   ` Sukumar Ghorai
2010-05-18 11:16   ` [PATCH v3 1/3] omap3 gpmc: functionality enhancement Sukumar Ghorai
2010-05-18 11:16     ` Sukumar Ghorai
2010-05-18 11:16     ` [PATCH v3 2/3] omap3 nand: cleanup virtual address usages Sukumar Ghorai
2010-05-18 11:16       ` Sukumar Ghorai
2010-05-18 11:16       ` [PATCH v3 3/3] omap3 nand: fix issue in board file to detect nand Sukumar Ghorai
2010-05-18 11:16         ` Sukumar Ghorai
2010-05-19 15:30       ` [PATCH v3 2/3] omap3 nand: cleanup virtual address usages Vimal Singh
2010-05-19 15:30         ` Vimal Singh
2010-05-19 17:24         ` Ghorai, Sukumar
2010-05-19 17:24           ` Ghorai, Sukumar
2010-05-19 18:07           ` Vimal Singh
2010-05-19 18:07             ` Vimal Singh
2010-05-19 18:19             ` Tony Lindgren
2010-05-19 18:19               ` Tony Lindgren
2010-05-19 14:46     ` [PATCH v3 1/3] omap3 gpmc: functionality enhancement Vimal Singh
2010-05-19 14:46       ` Vimal Singh
2010-05-19 15:14       ` Peter Barada
2010-05-19 15:14         ` Peter Barada
2010-05-19 15:48       ` Peter Barada
2010-05-19 15:48         ` Peter Barada
2010-05-19 18:04         ` Ghorai, Sukumar
2010-05-19 18:04           ` Ghorai, Sukumar
2010-05-19 18:30           ` Vimal Singh
2010-05-19 18:30             ` Vimal Singh
2010-05-20  5:38             ` Ghorai, Sukumar
2010-05-20  5:38               ` Ghorai, Sukumar
2010-05-20 14:34               ` Vimal Singh
2010-05-20 14:34                 ` Vimal Singh
2010-05-25 14:37             ` Ghorai, Sukumar
2010-05-25 14:37               ` Ghorai, Sukumar
2010-05-25 15:34               ` Vimal Singh
2010-05-25 15:34                 ` Vimal Singh
2010-05-27 13:24 ` [PATCH v4 0/3] omap3 nand: cleanup exiting platform related code Sukumar Ghorai
2010-05-27 13:24   ` [PATCH v4 1/3] omap3 gpmc: functionality enhancement Sukumar Ghorai
2010-05-27 13:24     ` [PATCH v4 2/3] omap3 nand: cleanup virtual address usages Sukumar Ghorai
2010-05-27 13:24       ` [PATCH v4 3/3] omap3 nand: fix issue in board file to detect nand Sukumar Ghorai
2010-05-27 18:26     ` [PATCH v4 1/3] omap3 gpmc: functionality enhancement Vimal Singh
2010-06-04  7:40 ` [PATCH v5 0/3] omap3 nand: cleanup exiting platform related code Sukumar Ghorai
2010-06-04  7:40   ` Sukumar Ghorai
2010-06-04  7:40   ` [PATCH v5 1/3] omap3 gpmc: functionality enhancement Sukumar Ghorai
2010-06-04  7:40     ` Sukumar Ghorai
2010-06-04  7:40     ` [PATCH v5 2/3] omap3 nand: cleanup virtual address usages Sukumar Ghorai
2010-06-04  7:40       ` Sukumar Ghorai
2010-06-04  7:40       ` [PATCH v5 3/3] omap3 nand: fix issue in board file to detect nand Sukumar Ghorai
2010-06-04  7:40         ` Sukumar Ghorai
2010-07-07 10:21       ` [PATCH v5 2/3] omap3 nand: cleanup virtual address usages Tony Lindgren
2010-07-07 10:21         ` Tony Lindgren
2010-07-07 12:22         ` Ghorai, Sukumar
2010-07-07 12:22           ` Ghorai, Sukumar
2010-07-07 10:18     ` [PATCH v5 1/3] omap3 gpmc: functionality enhancement Tony Lindgren
2010-07-07 10:18       ` Tony Lindgren
2010-07-07 12:32       ` Ghorai, Sukumar
2010-07-07 12:32         ` Ghorai, Sukumar
2010-07-07 13:01         ` Tony Lindgren
2010-07-07 13:01           ` Tony Lindgren
2010-07-08  3:54           ` Ghorai, Sukumar
2010-07-08  3:54             ` Ghorai, Sukumar
2010-06-08 17:12   ` [PATCH v5 0/3] omap3 nand: cleanup exiting platform related code Vimal Singh
2010-06-08 17:12     ` Vimal Singh
2010-06-15 13:26     ` Ghorai, Sukumar
2010-06-15 13:26       ` Ghorai, Sukumar
2010-06-30 14:42     ` Ghorai, Sukumar
2010-06-30 14:42       ` Ghorai, Sukumar
2010-06-16 11:39 ` [PATCH v3 0/8] nand support on omap3 boards Sukumar Ghorai
2010-06-16 11:39   ` [PATCH v3 1/8] omap3 flash: rename board-sdp-flash.c to be use by other boards Sukumar Ghorai
2010-06-16 11:39     ` [PATCH v3 2/8] omap3: add support for NAND on zoom2 board Sukumar Ghorai
2010-06-16 11:39       ` [PATCH v3 3/8] omap3: add support for NAND on zoom3 board Sukumar Ghorai
2010-06-16 11:39         ` [PATCH v3 4/8] omap-3630-sdp : Add support for Flash Sukumar Ghorai
2010-06-16 11:39           ` [PATCH v3 5/8] omap3: add support for NAND on LDP board Sukumar Ghorai
2010-06-16 11:39             ` [PATCH v3 6/8] omap-3630-sdp: enable Flash device support Sukumar Ghorai
2010-06-16 11:39               ` [PATCH v3 7/8] zoom2: enable NAND support Sukumar Ghorai
2010-06-16 11:40                 ` [PATCH v3 8/8] zoom3: " Sukumar Ghorai
2010-07-05 12:27               ` [PATCH v3 6/8] omap-3630-sdp: enable Flash device support Tony Lindgren
2010-07-06  5:23                 ` Ghorai, Sukumar
2010-07-05 12:23     ` [PATCH v3 1/8] omap3 flash: rename board-sdp-flash.c to be use by other boards Tony Lindgren
2010-07-06  6:05       ` Shilimkar, Santosh
2010-07-06  6:27         ` Ghorai, Sukumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1271180246-31779-14-git-send-email-s-ghorai@ti.com \
    --to=s-ghorai@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=vimalsingh@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.