public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/5] NetStar: Fix NAND
Date: Tue, 17 Mar 2009 20:50:53 +0100	[thread overview]
Message-ID: <20090317195053.GA2126@localhost.localdomain> (raw)
In-Reply-To: <20090317171730.GB12636@ld0162-tx32.am.freescale.net>

On Tue, Mar 17, 2009 at 12:17:30PM -0500, Scott Wood wrote:
> On Mon, Mar 16, 2009 at 11:28:24PM +0100, Ladislav Michl wrote:
> > Fix NAND support broken during new NAND code merge. Move those few lines of
> > code to board/netstar/netstar.c
> 
> What was the breakage?

Blocks being considered bad during read. I did not make any deeper analysis,
just copied proven code.

> > +static void netstar_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
> > +{
> > +	struct nand_chip *chip = mtd->priv;
> > +	unsigned long mask;
> > +
> > +	if (cmd == NAND_CMD_NONE)
> > +		return;
> > +
> > +	mask = (ctrl & NAND_CLE) ? 0x02 : 0;
> > +	if (ctrl & NAND_ALE)
> > +		mask |= 0x04;
> > +	writeb(cmd, (unsigned long)chip->IO_ADDR_W | mask);
> > +}
> 
> Do not pass integers as addresses.
> 
> The new function looks functionally identical to the old one (except that
> it ignores the interface in a couple of ways that it didn't before, but
> which don't really matter).  Why the change?  Why the difference between
> CLE using ?: and ALE using an if-statement?

The code above is identical to that found in linux driver. I'm considering
useful to keep it in sync for sake of easier future upgrades.
Sure it could be written as
if (ctrl & NAND_CLE)
	mask = 0x02;
else
	mask = 0;
if (ctrl & NAND_ALE)
	mask |= 0x04;
but the former is a bit shorter.

Best regards,
	ladis

  reply	other threads:[~2009-03-17 19:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-13 13:31 [U-Boot] [PATCH] Update board NetStar Ladislav Michl
2009-03-16 22:26 ` Ladislav Michl
2009-03-16 22:27   ` [U-Boot] [PATCH 1/5] NetStar: config reindentation Ladislav Michl
2009-03-18 19:42     ` Wolfgang Denk
2009-03-16 22:28   ` [U-Boot] [PATCH 2/5] NetStar: Fix NAND Ladislav Michl
2009-03-17 17:17     ` Scott Wood
2009-03-17 19:50       ` Ladislav Michl [this message]
2009-03-17 19:10         ` Scott Wood
2009-03-16 22:29   ` [U-Boot] [PATCH 3/5] NetStar: use generic flash driver Ladislav Michl
2009-03-18 19:44     ` Wolfgang Denk
2009-03-25  0:14       ` Ladislav Michl
2009-03-16 22:30   ` [U-Boot] [PATCH 4/5] NetStar: add RTC support Ladislav Michl
2009-03-16 22:31   ` [U-Boot] [PATCH 5/5] NetStar: update crcit utility Ladislav Michl

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=20090317195053.GA2126@localhost.localdomain \
    --to=ladis@linux-mips.org \
    --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