All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 06/13] mxc nand: Access all ecc_status_result fields
Date: Mon, 17 Sep 2012 19:39:35 -0500	[thread overview]
Message-ID: <20120918003935.GB31969@buserror.net> (raw)
In-Reply-To: <1372434962.2374989.1344890982845.JavaMail.root@advansee.com>

On Mon, Aug 13, 2012 at 10:49:42PM +0200, Beno?t Th?baudeau wrote:
> On the NFC IP 1.1, the 32-bit ecc_status_result value comes from 2
> consecutive 16-bit registers. This patch reads all the fields of this value,
> which makes a difference for 4-kiB NF pages.
> 
> 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                    |    2 +-
>  .../include/fsl_nfc.h                              |    3 +--
>  .../nand_spl/nand_boot_fsl_nfc.c                   |    4 ++++
>  3 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git u-boot-4d3c95f.orig/drivers/mtd/nand/mxc_nand.c u-boot-4d3c95f/drivers/mtd/nand/mxc_nand.c
> index 62d8c6b..4564b25 100644
> --- u-boot-4d3c95f.orig/drivers/mtd/nand/mxc_nand.c
> +++ u-boot-4d3c95f/drivers/mtd/nand/mxc_nand.c
> @@ -653,7 +653,7 @@ static int mxc_nand_correct_data(struct mtd_info *mtd, u_char *dat,
>  {
>  	struct nand_chip *nand_chip = mtd->priv;
>  	struct mxc_nand_host *host = nand_chip->priv;
> -	uint16_t ecc_status = readw(&host->regs->ecc_status_result);
> +	uint32_t ecc_status = readl(&host->regs->ecc_status_result);
>  	int subpages = mtd->writesize / nand_chip->subpagesize;
>  	int pg2blk_shift = nand_chip->phys_erase_shift -
>  			   nand_chip->page_shift;
> diff --git u-boot-4d3c95f.orig/include/fsl_nfc.h u-boot-4d3c95f/include/fsl_nfc.h
> index 1c16c71..c248cef 100644
> --- u-boot-4d3c95f.orig/include/fsl_nfc.h
> +++ u-boot-4d3c95f/include/fsl_nfc.h
> @@ -94,8 +94,7 @@ struct fsl_nfc_regs {
>  	u16 flash_addr;
>  	u16 flash_cmd;
>  	u16 config;
> -	u16 ecc_status_result;
> -	u16 ecc_status_result2;
> +	u32 ecc_status_result;
>  	u16 spare_area_size;
>  	u16 wrprot;
>  	u16 reserved3[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 842943c..4c5a7fe 100644
> --- u-boot-4d3c95f.orig/nand_spl/nand_boot_fsl_nfc.c
> +++ u-boot-4d3c95f/nand_spl/nand_boot_fsl_nfc.c
> @@ -139,7 +139,11 @@ static void nfc_nand_data_output(void)
>  
>  static int nfc_nand_check_ecc(void)
>  {
> +#if defined(MXC_NFC_V1)
>  	return readw(&nfc->ecc_status_result);
> +#elif defined(MXC_NFC_V1_1)
> +	return readl(&nfc->ecc_status_result);
> +#endif
>  }

On MXC_NFC_V1 you're using readw() on a u32 -- that's not OK, even if the
ARM accessors let you get away with it.  Use a union or #ifdef the struct
definition, or just always readl() if you can get away with it, or do two
readw()s on V1_1.

-Scott

  reply	other threads:[~2012-09-18  0:39 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 [this message]
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=20120918003935.GB31969@buserror.net \
    --to=scottwood@freescale.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 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.