public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bill Pringlemeir <bpringlemeir@nbsps.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/4] mtd: nand: add Freescale NFC driver
Date: Wed, 06 Aug 2014 19:01:19 -0400	[thread overview]
Message-ID: <87ha1p9q9s.fsf@nbsps.com> (raw)
In-Reply-To: <4ea124ab817db6e3dee2067aadd6db14643990f5.1407312577.git.stefan@agner.ch> (Stefan Agner's message of "Wed, 6 Aug 2014 10:59:37 +0200")

On  6 Aug 2014, stefan at agner.ch wrote:

> This adds initial support for Freescale NFC (NAND Flash Controller).
> The IP is used in ARM based Vybrid SoCs as well as on some PowerPC
> devices. This driver is only tested on Vybrid.
> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>  drivers/mtd/nand/Makefile  |   1 +
>  drivers/mtd/nand/fsl_nfc.c | 676
> ++++++++++++++++++++++++++++++++++++++++++++> +
>  2 files changed, 677 insertions(+)
>  create mode 100644 drivers/mtd/nand/fsl_nfc.c
 
> diff --git a/drivers/mtd/nand/fsl_nfc.c b/drivers/mtd/nand/fsl_nfc.c
> new file mode 100644
> index 0000000..df2c8be
> --- /dev/null
> +++ b/drivers/mtd/nand/fsl_nfc.c
> @@ -0,0 +1,676 @@

[snip]

> +#define NFC_TIMEOUT	(1000)
> +
> +/* ECC status placed at end of buffers. */
> +#define ECC_SRAM_ADDR	((PAGE_2K+256-8) >> 3)
> +#define ECC_STATUS_MASK	0x80
> +#define ECC_ERR_COUNT	0x3F
> +
> +struct fsl_nfc {
> +	struct mtd_info	  *mtd;
> +	struct nand_chip   chip;
> +	struct device	  *dev;
> +	void __iomem	  *regs;
> +	//wait_queue_head_t  irq_waitq;

I think u-boot doesn't like C++ comments?

> +	uint               column;
> +	int                spareonly;
> +	int                page;
> +	/* Status and ID are in alternate locations. */
> +	int                alt_buf;
> +#define ALT_BUF_ID   1
> +#define ALT_BUF_STAT 2
> +	struct clk        *clk;
> +};
> +
> +#define mtd_to_nfc(_mtd) (struct fsl_nfc *)((struct nand_chip
> *)_mtd->priv)->priv;

[snip]

> +static int nfc_correct_data(struct mtd_info *mtd, u_char *dat,
> +				 u_char *read_ecc, u_char *calc_ecc)
> +{
> +	struct fsl_nfc *nfc = mtd_to_nfc(mtd);
> +	u32 ecc_status;
> +	u8 ecc_count;
> +	int flip;
> +
> +	/* 

Some extra ws here  Ie, '/* ' with a space after the star.  Maybe that
is from me?

> +	 * Errata: ECC status is stored at NFC_CFG[ECCADD] +4 for
> +	 * little-endian and +7 for big-endian SOC.  Access as 32 bits
> +	 * and use low byte.
> +	 */

This appears to be documented in the latest Vybrid manual (Rev7).

> +	ecc_status = __raw_readl(nfc->regs + ECC_SRAM_ADDR * 8 + 4);
> +	ecc_count = ecc_status & ECC_ERR_COUNT;
> +	if (!(ecc_status & ECC_STATUS_MASK))
> +		return ecc_count;

[snip]

> +static void nfc_enable_hwecc(struct mtd_info *mtd, int mode)
> +{
> +}
> +
> +struct nfc_config {
> +	int hardware_ecc;
> +	int width;
> +	int flash_bbt;
> +};
> +
> +//static int nfc_probe(struct platform_device *pdev)

Another C++ comment.

All minor nits.  I am certainly ok with this code being included in
u-boot.

Regards,
Bill Pringlemeir.

  reply	other threads:[~2014-08-06 23:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-06  8:59 [U-Boot] [PATCH 0/4] arm: vf610: add NAND flash support Stefan Agner
2014-08-06  8:59 ` [U-Boot] [PATCH 1/4] arm: vf610: add NFC pin mux Stefan Agner
2014-08-30 15:14   ` [U-Boot] [U-Boot,1/4] " Tom Rini
2014-08-06  8:59 ` [U-Boot] [PATCH 2/4] arm: vf610: add NFC clock support Stefan Agner
2014-08-30 15:14   ` [U-Boot] [U-Boot,2/4] " Tom Rini
2014-08-06  8:59 ` [U-Boot] [PATCH 3/4] mtd: nand: add Freescale NFC driver Stefan Agner
2014-08-06 23:01   ` Bill Pringlemeir [this message]
2014-08-11 22:33   ` Scott Wood
2014-08-12 21:13     ` Stefan Agner
2014-08-12 22:17       ` Scott Wood
2014-08-12 22:58         ` Bill Pringlemeir
2014-08-13  8:13           ` Stefan Agner
2014-08-13 11:20           ` Stefan Agner
2014-08-13 15:14             ` Bill Pringlemeir
2014-08-13 16:27               ` Stefan Agner
2014-08-13 17:11                 ` Bill Pringlemeir
2014-08-13 20:32             ` Scott Wood
2014-08-13 20:41           ` Scott Wood
2014-08-13 21:44             ` Bill Pringlemeir
2014-08-13 22:54               ` Scott Wood
2014-08-14 14:26                 ` Bill Pringlemeir
2014-08-06  8:59 ` [U-Boot] [PATCH 4/4] arm: vf610: add NAND support for vf610twr Stefan Agner

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=87ha1p9q9s.fsf@nbsps.com \
    --to=bpringlemeir@nbsps.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