public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 12/13] mxc nand: Homogenize IP revisions with Linux
Date: Mon, 13 Aug 2012 22:50:53 +0200 (CEST)	[thread overview]
Message-ID: <930819564.2375006.1344891053640.JavaMail.root@advansee.com> (raw)
In-Reply-To: <1580773374.2374979.1344890876408.JavaMail.root@advansee.com>

Use the same IP revisions as in Linux in order to make the comparison more
clear.

Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 .../drivers/mtd/nand/mxc_nand.c                    |   16 ++++++++--------
 .../include/fsl_nfc.h                              |   16 +++++++++-------
 .../nand_spl/nand_boot_fsl_nfc.c                   |    4 ++--
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git u-boot-4d3c95f.orig/drivers/mtd/nand/mxc_nand.c u-boot-4d3c95f/drivers/mtd/nand/mxc_nand.c
index e743796..cf2a7b0 100644
--- u-boot-4d3c95f.orig/drivers/mtd/nand/mxc_nand.c
+++ u-boot-4d3c95f/drivers/mtd/nand/mxc_nand.c
@@ -77,7 +77,7 @@ static struct nand_ecclayout nand_hw_eccoob2k = {
 	.oobfree = { {2, 4}, {11, 11}, {27, 11}, {43, 11}, {59, 5} },
 };
 #endif
-#elif defined(MXC_NFC_V1_1)
+#elif defined(MXC_NFC_V2_1)
 #ifndef CONFIG_SYS_NAND_LARGEPAGE
 static struct nand_ecclayout nand_hw_eccoob = {
 	.eccbytes = 9,
@@ -213,7 +213,7 @@ static void send_prog_page(struct mxc_nand_host *host, uint8_t buf_id,
 	if (spare_only)
 		MTDDEBUG(MTD_DEBUG_LEVEL1, "send_prog_page (%d)\n", spare_only);
 
-	if (is_mxc_nfc_11()) {
+	if (is_mxc_nfc_21()) {
 		int i;
 		/*
 		 *  The controller copies the 64 bytes of spare data from
@@ -273,7 +273,7 @@ static void send_read_page(struct mxc_nand_host *host, uint8_t buf_id,
 	/* Wait for operation to complete */
 	wait_op_done(host, TROP_US_DELAY, spare_only);
 
-	if (is_mxc_nfc_11()) {
+	if (is_mxc_nfc_21()) {
 		int i;
 
 		/*
@@ -377,7 +377,7 @@ static void mxc_nand_enable_hwecc(struct mtd_info *mtd, int mode)
 	 */
 }
 
-#ifdef MXC_NFC_V1_1
+#ifdef MXC_NFC_V2_1
 static int mxc_nand_read_oob_syndrome(struct mtd_info *mtd,
 				      struct nand_chip *chip,
 				      int page, int sndcmd)
@@ -1061,7 +1061,7 @@ void mxc_nand_command(struct mtd_info *mtd, unsigned command,
 	case NAND_CMD_PAGEPROG:
 		send_prog_page(host, 0, host->spare_only);
 
-		if (host->pagesize_2k && !is_mxc_nfc_11()) {
+		if (host->pagesize_2k && is_mxc_nfc_1()) {
 			/* data in 4 areas */
 			send_prog_page(host, 1, host->spare_only);
 			send_prog_page(host, 2, host->spare_only);
@@ -1111,7 +1111,7 @@ void mxc_nand_command(struct mtd_info *mtd, unsigned command,
 			send_cmd(host, NAND_CMD_READSTART);
 			/* read for each AREA */
 			send_read_page(host, 0, host->spare_only);
-			if (!is_mxc_nfc_11()) {
+			if (is_mxc_nfc_1()) {
 				send_read_page(host, 1, host->spare_only);
 				send_read_page(host, 2, host->spare_only);
 				send_read_page(host, 3, host->spare_only);
@@ -1200,7 +1200,7 @@ int board_nand_init(struct nand_chip *this)
 	this->ecc.calculate = mxc_nand_calculate_ecc;
 	this->ecc.hwctl = mxc_nand_enable_hwecc;
 	this->ecc.correct = mxc_nand_correct_data;
-	if (is_mxc_nfc_11()) {
+	if (is_mxc_nfc_21()) {
 		this->ecc.mode = NAND_ECC_HW_SYNDROME;
 		this->ecc.read_page = mxc_nand_read_page_syndrome;
 		this->ecc.read_page_raw = mxc_nand_read_page_raw_syndrome;
@@ -1238,7 +1238,7 @@ int board_nand_init(struct nand_chip *this)
 	this->ecc.layout = &nand_hw_eccoob;
 #endif
 
-#ifdef MXC_NFC_V1_1
+#ifdef MXC_NFC_V2_1
 	tmp = readw(&host->regs->config1);
 	tmp |= NFC_ONE_CYCLE;
 	tmp |= NFC_4_8N_ECC;
diff --git u-boot-4d3c95f.orig/include/fsl_nfc.h u-boot-4d3c95f/include/fsl_nfc.h
index 6618089..ff537b4 100644
--- u-boot-4d3c95f.orig/include/fsl_nfc.h
+++ u-boot-4d3c95f/include/fsl_nfc.h
@@ -33,7 +33,7 @@
  *	to support up to 2K byte pagesize nand.
  *	Reading or writing a 2K page requires 4 FDI/FDO cycles.
  *
- * MX25 and MX35 have version 1.1, which has:
+ * MX25 and MX35 have version 2.1, which has:
  *	8 512-byte main buffers and
  *	8 64-byte spare buffers
  *	to support up to 4K byte pagesize nand.
@@ -42,10 +42,12 @@
  */
 #if defined(CONFIG_MX27) || defined(CONFIG_MX31)
 #define MXC_NFC_V1
-#define is_mxc_nfc_11()		0
+#define is_mxc_nfc_1()		1
+#define is_mxc_nfc_21()		0
 #elif defined(CONFIG_MX25) || defined(CONFIG_MX35)
-#define MXC_NFC_V1_1
-#define is_mxc_nfc_11()		1
+#define MXC_NFC_V2_1
+#define is_mxc_nfc_1()		0
+#define is_mxc_nfc_21()		1
 #else
 #error "MXC NFC implementation not supported"
 #endif
@@ -55,7 +57,7 @@
 #define NAND_MXC_SPARE_BUF_SIZE		16
 #define NAND_MXC_REG_OFFSET		0xe00
 #define NAND_MXC_2K_MULTI_CYCLE
-#elif defined(MXC_NFC_V1_1)
+#elif defined(MXC_NFC_V2_1)
 #define NAND_MXC_NR_BUFS		8
 #define NAND_MXC_SPARE_BUF_SIZE		64
 #define NAND_MXC_REG_OFFSET		0x1e00
@@ -86,7 +88,7 @@ struct fsl_nfc_regs {
 	u16 nf_wrprst;
 	u16 config1;
 	u16 config2;
-#elif defined(MXC_NFC_V1_1)
+#elif defined(MXC_NFC_V2_1)
 	u16 reserved2[2];
 	u16 buf_addr;
 	u16 flash_addr;
@@ -153,7 +155,7 @@ struct fsl_nfc_regs {
  */
 #define NFC_INT		0x8000
 
-#ifdef MXC_NFC_V1_1
+#ifdef MXC_NFC_V2_1
 #define NFC_4_8N_ECC	(1 << 0)
 #endif
 #define NFC_SP_EN	(1 << 2)
diff --git u-boot-4d3c95f.orig/nand_spl/nand_boot_fsl_nfc.c u-boot-4d3c95f/nand_spl/nand_boot_fsl_nfc.c
index ea05952..a40c998 100644
--- u-boot-4d3c95f.orig/nand_spl/nand_boot_fsl_nfc.c
+++ u-boot-4d3c95f/nand_spl/nand_boot_fsl_nfc.c
@@ -47,7 +47,7 @@ static void nfc_wait_ready(void)
 
 static void nfc_nand_init(void)
 {
-#if defined(MXC_NFC_V1_1)
+#if defined(MXC_NFC_V2_1)
 	int ecc_per_page = CONFIG_SYS_NAND_PAGE_SIZE / 512;
 	int config1;
 
@@ -142,7 +142,7 @@ static int nfc_nand_check_ecc(void)
 #if defined(MXC_NFC_V1)
 	u16 ecc_status = readw(&nfc->ecc_status_result);
 	return (ecc_status & 0x3) == 2 || (ecc_status >> 2) == 2;
-#elif defined(MXC_NFC_V1_1)
+#elif defined(MXC_NFC_V2_1)
 	u32 ecc_status = readl(&nfc->ecc_status_result);
 	int ecc_per_page = CONFIG_SYS_NAND_PAGE_SIZE / 512;
 	int err_limit = CONFIG_SYS_NAND_SPARE_SIZE / ecc_per_page > 16 ? 8 : 4;

  parent reply	other threads:[~2012-08-13 20:50 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-13 20:47 [U-Boot] [PATCH 00/13] mxc nand: Add support for i.MX5 Benoît Thébaudeau
2012-08-13 20:48 ` [U-Boot] [PATCH 01/13] mxc nand: Merge mtd and spl register definitions Benoît Thébaudeau
2012-08-14  8:37   ` Stefano Babic
2012-08-14 10:15     ` Benoît Thébaudeau
2012-08-14 10:46       ` Stefano Babic
2012-08-14 11:13         ` Benoît Thébaudeau
2012-08-14 14:02           ` Stefano Babic
2012-08-14 14:29             ` Benoît Thébaudeau
2012-08-15 18:11               ` Benoît Thébaudeau
2012-08-16  7:27                 ` Stefano Babic
2012-08-14 16:01     ` Scott Wood
2012-08-13 20:48 ` [U-Boot] [PATCH 02/13] mxc nand: cosmectic: Light cleanup Benoît Thébaudeau
2012-08-14  8:41   ` Stefano Babic
2012-08-13 20:48 ` [U-Boot] [PATCH 03/13] spl mxc nand: Merge duplicated code Benoît Thébaudeau
2012-08-14  9:25   ` Stefano Babic
2012-08-13 20:49 ` [U-Boot] [PATCH 04/13] spl mxc nand: Remove " Benoît Thébaudeau
2012-08-13 20:49 ` [U-Boot] [PATCH 05/13] spl mxc nand: Set symmetric mode Benoît Thébaudeau
2012-08-13 20:49 ` [U-Boot] [PATCH 06/13] mxc nand: Access all ecc_status_result fields Benoît Thébaudeau
2012-09-18  0:39   ` Scott Wood
2012-09-18  0:50     ` Scott Wood
2012-08-13 20:49 ` [U-Boot] [PATCH 07/13] spl mxc nand: Fix broken boot for correctable ECC errors Benoît Thébaudeau
2012-08-13 20:50 ` [U-Boot] [PATCH 08/13] mtd mxc nand: Use _mxc_nand_enable_hwecc() Benoît Thébaudeau
2012-08-14  8:50   ` Stefano Babic
2012-08-14 10:04     ` Benoît Thébaudeau
2012-08-13 20:50 ` [U-Boot] [PATCH 09/13] mtd mxc nand: Fix ECC state after read_page_raw_syndrome() Benoît Thébaudeau
2012-08-13 20:50 ` [U-Boot] [PATCH 10/13] mtd mxc nand: Merge init functions Benoît Thébaudeau
2012-08-13 20:50 ` [U-Boot] [PATCH 11/13] mxc nand: Let driver detect IP revision Benoît Thébaudeau
2012-08-14  9:28   ` Stefano Babic
2012-08-13 20:50 ` Benoît Thébaudeau [this message]
2012-08-13 20:51 ` [U-Boot] [PATCH 13/13] mxc nand: Add support for i.MX5 Benoît Thébaudeau
2012-08-13 21:04   ` Troy Kisky
2012-08-13 21:06     ` Troy Kisky
2012-08-21 21:04   ` [U-Boot] [PATCH v2 " Benoît Thébaudeau
2012-08-21 21:21     ` Scott Wood
2012-09-18  0:36     ` Scott Wood
2012-09-18 18:11       ` Tom Rini
2012-11-15 22:22         ` Scott Wood
2012-11-16 20:15           ` Benoît Thébaudeau
2012-11-16 20:18             ` Scott Wood
2012-11-16 20:19               ` Scott Wood
2012-11-16 20:28             ` Benoît Thébaudeau
2012-11-17  0:01               ` Scott Wood
2012-11-17  1:43                 ` Benoît Thébaudeau
2012-11-20 23:03                   ` Scott Wood
2012-11-20 23:31                     ` Benoît Thébaudeau
2012-11-17 18:37             ` Fabio Estevam
2012-11-20 20:33               ` Matt Sealey
2012-09-18  1:01     ` Scott Wood
2012-09-18 10:18       ` Benoît Thébaudeau
2012-09-18  1:19 ` [U-Boot] [PATCH 00/13] " Scott Wood
2013-01-07 13:02 ` Marek Vasut
2013-01-07 13:37   ` Benoît Thébaudeau
2013-01-07 13:47     ` Marek Vasut
2013-01-08  0:49       ` Scott Wood
2013-01-08  6:59         ` Marek Vasut
2013-01-07 14:36     ` Fabio Estevam
2013-01-07 15:08       ` Marek Vasut
2013-01-07 15:30         ` Benoît Thébaudeau
2013-01-07 15:33           ` Marek Vasut
2013-01-07 16:42           ` Marek Vasut
2013-01-07 16:55             ` Benoît Thébaudeau
2013-01-08  7:15               ` Marek Vasut

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=930819564.2375006.1344891053640.JavaMail.root@advansee.com \
    --to=benoit.thebaudeau@advansee.com \
    --cc=u-boot@lists.denx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox