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 02/13] mxc nand: cosmectic: Light cleanup
Date: Mon, 13 Aug 2012 22:48:26 +0200 (CEST)	[thread overview]
Message-ID: <1249369398.2374984.1344890906091.JavaMail.root@advansee.com> (raw)
In-Reply-To: <1580773374.2374979.1344890876408.JavaMail.root@advansee.com>

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                    |    9 +++------
 .../include/fsl_nfc.h                              |    1 +
 .../nand_spl/nand_boot_fsl_nfc.c                   |   14 +++++++-------
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git u-boot-4d3c95f.orig/drivers/mtd/nand/mxc_nand.c u-boot-4d3c95f/drivers/mtd/nand/mxc_nand.c
index 9a9260c..62d8c6b 100644
--- u-boot-4d3c95f.orig/drivers/mtd/nand/mxc_nand.c
+++ u-boot-4d3c95f/drivers/mtd/nand/mxc_nand.c
@@ -123,8 +123,7 @@ static int is_16bit_nand(void)
 #elif defined(CONFIG_MX25) || defined(CONFIG_MX35)
 static int is_16bit_nand(void)
 {
-	struct ccm_regs *ccm =
-		(struct ccm_regs *)IMX_CCM_BASE;
+	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
 
 	if (readl(&ccm->rcsr) & CCM_RCSR_NF_16BIT_SEL)
 		return 1;
@@ -238,7 +237,7 @@ static void send_prog_page(struct mxc_nand_host *host, uint8_t buf_id,
 		if (spare_only)
 			config1 |= NFC_SP_EN;
 		else
-			config1 &= ~(NFC_SP_EN);
+			config1 &= ~NFC_SP_EN;
 		writew(config1, &host->regs->config1);
 	}
 
@@ -687,7 +686,6 @@ static int mxc_nand_correct_data(struct mtd_info *mtd, u_char *dat,
 #define mxc_nand_write_page_syndrome NULL
 #define mxc_nand_write_page_raw_syndrome NULL
 #define mxc_nand_write_oob_syndrome NULL
-#define mxc_nfc_11_nand_correct_data NULL
 
 static int mxc_nand_correct_data(struct mtd_info *mtd, u_char *dat,
 				 u_char *read_ecc, u_char *calc_ecc)
@@ -1188,7 +1186,6 @@ int board_nand_init(struct nand_chip *this)
 {
 	struct mtd_info *mtd;
 	uint16_t tmp;
-	int err = 0;
 
 #ifdef CONFIG_SYS_NAND_USE_FLASH_BBT
 	this->options |= NAND_USE_FLASH_BBT;
@@ -1287,5 +1284,5 @@ int board_nand_init(struct nand_chip *this)
 	this->ecc.layout = &nand_hw_eccoob;
 #endif
 	mxc_setup_config1();
-	return err;
+	return 0;
 }
diff --git u-boot-4d3c95f.orig/include/fsl_nfc.h u-boot-4d3c95f/include/fsl_nfc.h
index 6691e41..1c16c71 100644
--- u-boot-4d3c95f.orig/include/fsl_nfc.h
+++ u-boot-4d3c95f/include/fsl_nfc.h
@@ -166,5 +166,6 @@ struct fsl_nfc_regs {
 #define NFC_RST		(1 << 6)
 #define NFC_CE		(1 << 7)
 #define NFC_ONE_CYCLE	(1 << 8)
+#define NFC_FP_INT	(1 << 11)
 
 #endif /* __FSL_NFC_H */
diff --git u-boot-4d3c95f.orig/nand_spl/nand_boot_fsl_nfc.c u-boot-4d3c95f/nand_spl/nand_boot_fsl_nfc.c
index f437deb..b90f93e 100644
--- u-boot-4d3c95f.orig/nand_spl/nand_boot_fsl_nfc.c
+++ u-boot-4d3c95f/nand_spl/nand_boot_fsl_nfc.c
@@ -45,10 +45,10 @@ static void nfc_wait_ready(void)
 	writew(tmp, &nfc->config2);
 }
 
-void nfc_nand_init(void)
+static void nfc_nand_init(void)
 {
 #if defined(MXC_NFC_V1_1)
-	int ecc_per_page  = CONFIG_SYS_NAND_PAGE_SIZE / 512;
+	int ecc_per_page = CONFIG_SYS_NAND_PAGE_SIZE / 512;
 	int config1;
 
 	writew(CONFIG_SYS_NAND_SPARE_SIZE / 2, &nfc->spare_area_size);
@@ -57,12 +57,12 @@ void nfc_nand_init(void)
 	writew(0x2, &nfc->config);
 
 	/* hardware ECC checking and correct */
-	config1 = readw(&nfc->config1) | NFC_ECC_EN | 0x800;
+	config1 = readw(&nfc->config1) | NFC_ECC_EN | NFC_FP_INT;
 	/*
 	 * if spare size is larger that 16 bytes per 512 byte hunk
 	 * then use 8 symbol correction instead of 4
 	 */
-	if ((CONFIG_SYS_NAND_SPARE_SIZE / ecc_per_page) > 16)
+	if (CONFIG_SYS_NAND_SPARE_SIZE / ecc_per_page > 16)
 		config1 &= ~NFC_4_8N_ECC;
 	else
 		config1 |= NFC_4_8N_ECC;
@@ -133,7 +133,7 @@ static void nfc_nand_data_output(void)
 	 * This NAND controller requires multiple input commands
 	 * for pages larger than 512 bytes.
 	 */
-	for (i = 1; i < (CONFIG_SYS_NAND_PAGE_SIZE / 512); i++) {
+	for (i = 1; i < CONFIG_SYS_NAND_PAGE_SIZE / 512; i++) {
 		config1 = readw(&nfc->config1);
 		config1 |= NFC_ECC_EN | NFC_INT_MSK;
 		writew(config1, &nfc->config1);
@@ -171,7 +171,7 @@ static int nfc_read_page(unsigned int page_address, unsigned char *buf)
 	dst = (u32 *)buf;
 
 	/* main copy loop from NAND-buffer to SDRAM memory */
-	for (i = 0; i < (CONFIG_SYS_NAND_PAGE_SIZE / 4); i++) {
+	for (i = 0; i < CONFIG_SYS_NAND_PAGE_SIZE / 4; i++) {
 		writel(readl(src), dst);
 		src++;
 		dst++;
@@ -230,7 +230,7 @@ static int nand_load(unsigned int from, unsigned int size, unsigned char *buf)
 	page = from / CONFIG_SYS_NAND_PAGE_SIZE;
 	i = 0;
 
-	while (i < (size / CONFIG_SYS_NAND_PAGE_SIZE)) {
+	while (i < size / CONFIG_SYS_NAND_PAGE_SIZE) {
 		if (nfc_read_page(page, buf) < 0)
 			return -1;
 

  parent reply	other threads:[~2012-08-13 20:48 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 ` Benoît Thébaudeau [this message]
2012-08-14  8:41   ` [U-Boot] [PATCH 02/13] mxc nand: cosmectic: Light cleanup 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 ` [U-Boot] [PATCH 12/13] mxc nand: Homogenize IP revisions with Linux Benoît Thébaudeau
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=1249369398.2374984.1344890906091.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