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] [U-Boot,05/10] mtd: nand: s3c: Add S3C2440 specifics
Date: Wed, 26 Nov 2014 20:20:53 -0600	[thread overview]
Message-ID: <20141127022053.GA26896@home.buserror.net> (raw)
In-Reply-To: <1413045778-5690-5-git-send-email-marex@denx.de>

On Sat, Oct 11, 2014 at 06:42:53PM +0200, Marek Vasut wrote:
> +#ifdef CONFIG_S3C2410
>  #define S3C2410_NFCONF_TACLS(x)    ((x)<<8)
>  #define S3C2410_NFCONF_TWRPH0(x)   ((x)<<4)
>  #define S3C2410_NFCONF_TWRPH1(x)   ((x)<<0)
> +#else	/* S3C2412, S3C2440 */
> +#define S3C2410_NFCONF_TACLS(x)    ((x)<<12)
> +#define S3C2410_NFCONF_TWRPH0(x)   ((x)<<8)
> +#define S3C2410_NFCONF_TWRPH1(x)   ((x)<<4)
> +#endif

Is there any chance there will be a third variant?  Perhaps the S3C2440
variant should be explicitly requested with an #error if no variant is
selected.

>  #define S3C2410_ADDR_NALE 4
>  #define S3C2410_ADDR_NCLE 8
> @@ -42,25 +51,30 @@ static void s3c24x0_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
>  {
>  	struct nand_chip *chip = mtd->priv;
>  	struct s3c24x0_nand *nand = s3c24x0_get_base_nand();
> +	uint32_t sel_reg, sel_bit;
>  
>  	debug("hwcontrol(): 0x%02x 0x%08x\n", cmd & 0xff, ctrl);
>  
>  	if (ctrl & NAND_CTRL_CHANGE) {
> -		ulong IO_ADDR_W = (ulong)nand;
> +		chip->IO_ADDR_W = &nand->nfconf;
>  
>  		if (!(ctrl & NAND_CLE))
> -			IO_ADDR_W |= S3C2410_ADDR_NCLE;
> +			chip->IO_ADDR_W = &nand->nfaddr;
>  		if (!(ctrl & NAND_ALE))
> -			IO_ADDR_W |= S3C2410_ADDR_NALE;
> +			chip->IO_ADDR_W = &nand->nfcmd;
>  
> -		chip->IO_ADDR_W = (void *)IO_ADDR_W;
> +#ifdef CONFIG_S3C2410
> +		sel_reg = (uint32_t)&nand->nfconf;
> +		sel_bit = S3C2410_NFCONF_nFCE;
> +#else
> +		sel_reg = (uint32_t)&nand->nfcont;
> +		sel_bit = S3C2440_NFCONT_nFCE;
> +#endif

Why are you casting &nand->nfcon[ft] to an integer...

>  		if (ctrl & NAND_NCE)
> -			writel(readl(&nand->nfconf) & ~S3C2410_NFCONF_nFCE,
> -			       &nand->nfconf);
> +			clrbits_le32(sel_reg, sel_bit);
>  		else
> -			writel(readl(&nand->nfconf) | S3C2410_NFCONF_nFCE,
> -			       &nand->nfconf);
> +			setbits_le32(sel_reg, sel_bit);

...only to pass that integer to something that normally accepts a
pointer, which doesn't cause a warning only because of ARM's crappy I/O
accessors that don't do type checking?

At least the code that was there before used ulong for inappropriate
pointer-to-integer casts rather than uint32_t. :-P

> -	writel(readl(&clk_power->clkcon) | (1 << 4), &clk_power->clkcon);
> +	setbits_le32(&clk_power->clkcon, 1 << 4);

This change seems unrelated to adding s3c2440 support.  It'd be clearer
if the {clr,set,clrset}bits_le32() conversion were done separately,
before the s3c2440 stuff.  I'm not insisting that you redo this one, but
next time try to keep cleanup separate.

-Scott

  reply	other threads:[~2014-11-27  2:20 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-11 16:42 [U-Boot] [PATCH 01/10] video: Add S3C24xx framebuffer support Marek Vasut
2014-10-11 16:42 ` [U-Boot] [PATCH 02/10] arm: s3c24xx: Fix incorrect CONFIG_SYS_S3C2410_NAND_HWECC name Marek Vasut
2014-11-27  2:03   ` [U-Boot] [U-Boot, " Scott Wood
2015-05-02  0:46     ` Marek Vasut
2015-05-02  1:11       ` Scott Wood
2015-05-02  1:18         ` Marek Vasut
2015-05-02  3:41           ` Scott Wood
2014-10-11 16:42 ` [U-Boot] [PATCH 03/10] mtd: nand: s3c: Fix data type width in debug() Marek Vasut
2014-11-27  2:06   ` [U-Boot] [U-Boot, " Scott Wood
2014-10-11 16:42 ` [U-Boot] [PATCH 04/10] mtd: nand: s3c: Unify the register definition and naming Marek Vasut
2014-10-11 16:42 ` [U-Boot] [PATCH 05/10] mtd: nand: s3c: Add S3C2440 specifics Marek Vasut
2014-11-27  2:20   ` Scott Wood [this message]
2015-05-02  0:48     ` [U-Boot] [U-Boot,05/10] " Marek Vasut
2015-05-02  1:05       ` Scott Wood
2014-10-11 16:42 ` [U-Boot] [PATCH 06/10] mtd: nand: s3c: Add S3C2440 buffer reading Marek Vasut
2014-10-11 16:42 ` [U-Boot] [PATCH 07/10] mtd: nand: s3c: Add missing correction and select_chip functions Marek Vasut
2014-10-28 22:45   ` Scott Wood
2016-01-14  1:41     ` Marek Vasut
2016-02-12 23:18       ` Scott Wood
2016-02-19 17:53         ` Marek Vasut
2016-02-19 17:54           ` Scott Wood
2014-10-11 16:42 ` [U-Boot] [PATCH 08/10] i2c: s3c: Implant support for S3C2440 Marek Vasut
2015-05-02  1:12   ` Marek Vasut
2015-05-06  8:02     ` Minkyu Kang
2014-10-11 16:42 ` [U-Boot] [PATCH 09/10] gpio: s3c: Fix the GPIO driver Marek Vasut
2015-05-02  1:12   ` Marek Vasut
2015-05-06  8:02     ` Minkyu Kang
2014-10-11 16:42 ` [U-Boot] [PATCH 10/10] net: smc911x: Keep MAC programmed Marek Vasut
2014-11-10 21:29   ` [U-Boot] [U-Boot,10/10] " Tom Rini
2014-10-16  9:28 ` [U-Boot] [PATCH 01/10] video: Add S3C24xx framebuffer support Anatolij Gustschin
2015-05-02  1:12   ` Marek Vasut
2016-02-19 18:02     ` Anatolij Gustschin
2016-02-19 18:37       ` Marek Vasut
2016-02-22 17:10 ` Anatolij Gustschin

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=20141127022053.GA26896@home.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.