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 3/4] mtd: nand: add Freescale NFC driver
Date: Mon, 11 Aug 2014 17:33:46 -0500	[thread overview]
Message-ID: <1407796426.7427.100.camel@snotra.buserror.net> (raw)
In-Reply-To: <4ea124ab817db6e3dee2067aadd6db14643990f5.1407312577.git.stefan@agner.ch>

On Wed, 2014-08-06 at 10:59 +0200, Stefan Agner 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/Makefile b/drivers/mtd/nand/Makefile
> index bf1312a..85cb0dd 100644
> --- a/drivers/mtd/nand/Makefile
> +++ b/drivers/mtd/nand/Makefile
> @@ -51,6 +51,7 @@ obj-$(CONFIG_NAND_KB9202) += kb9202_nand.o
>  obj-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
>  obj-$(CONFIG_NAND_KMETER1) += kmeter1_nand.o
>  obj-$(CONFIG_NAND_MPC5121_NFC) += mpc5121_nfc.o
> +obj-$(CONFIG_NAND_FSL_NFC) += fsl_nfc.o
>  obj-$(CONFIG_NAND_MXC) += mxc_nand.o

Could you explain how this differs from mpc5121_nfc, mxc_nand, etc?  If
it's truly different enough to deserve its own driver, it should at
least get a more specific name.

> +static u32 nfc_read(struct mtd_info *mtd, uint reg)
> +{
> +	struct fsl_nfc *nfc = mtd_to_nfc(mtd);
> +
> +	if (reg == NFC_FLASH_STATUS1 ||
> +	    reg == NFC_FLASH_STATUS2 ||
> +	    reg == NFC_IRQ_STATUS)
> +		return __raw_readl(nfc->regs + reg);
> +	/* Gang read/writes together for most registers. */
> +	else
> +		return *(u32 *)(nfc->regs + reg);
> +}
> +
> +static void nfc_write(struct mtd_info *mtd, uint reg, u32 val)
> +{
> +	struct fsl_nfc *nfc = mtd_to_nfc(mtd);
> +
> +	if (reg == NFC_FLASH_STATUS1 ||
> +	    reg == NFC_FLASH_STATUS2 ||
> +	    reg == NFC_IRQ_STATUS)
> +		__raw_writel(val, nfc->regs + reg);
> +	/* Gang read/writes together for most registers. */
> +	else
> +		*(u32 *)(nfc->regs + reg) = val;
> +}

You should always be using raw I/O accessors.  If the intent is to
bypass I/O ordering for certain registers, the raw accessors should
already be skipping that.

> +int board_nand_init(struct nand_chip *chip)
> +{
[snip]
> +	/* second phase scan */
> +	if (nand_scan_tail(mtd)) {
> +		err = -ENXIO;
> +		goto error;
> +	}
> +

board_nand_init() should only call nand_scan_tail if
CONFIG_SYS_NAND_SELF_INIT is defined -- and if it is defined, then
board_nand_init() takes no arguments.

-Scott

  parent reply	other threads:[~2014-08-11 22:33 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
2014-08-11 22:33   ` Scott Wood [this message]
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=1407796426.7427.100.camel@snotra.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.