From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] KB9202: Add NAND support
Date: Wed, 03 Jun 2009 14:50:40 -0500 [thread overview]
Message-ID: <4A26D410.8050806@freescale.com> (raw)
In-Reply-To: <20090603174200.GC3813@darwin>
Matthias Kaehlcke wrote:
> hi,
>
> El Fri, May 15, 2009 at 05:30:48PM -0500 Scott Wood ha dit:
>
>> Matthias Kaehlcke wrote:
>>> +/*
>>> + * Board-specific function to access the device ready signal.
>>> + */
>>> +static int kb9202_nand_ready(struct mtd_info *mtd)
>>> +{
>>> + return (((AT91C_BASE_PIOC->PIO_PDSR) & KB9202_NAND_BUSY) != 0);
>>> +}
>> Use I/O accessors.
[snip]
> + if (ctrl & NAND_NCE)
> + AT91C_BASE_PIOC->PIO_CODR = KB9202_NAND_NCE;
> + else
> + AT91C_BASE_PIOC->PIO_SODR = KB9202_NAND_NCE;
You're still not using I/O accessors in many places.
> +#ifdef CONFIG_CMD_NAND
Put this in the makefile instead.
> +static int kb9202_nand_ready(struct mtd_info *mtd)
> +{
> + const unsigned int value = readl(AT91C_PIOC_PDSR);
> +
> + return ((value & KB9202_NAND_BUSY) != 0);
> +}
static int kb9202_nand_ready(struct mtd_info *mtd)
{
return readl(AT91C_PIOC_PDSR) & KB9202_NAND_BUSY;
}
> +int board_nand_init(struct nand_chip *nand)
> +{
> + unsigned int value;
> + struct _AT91S_SMC2 *at91s_smc2 = AT91C_BASE_SMC2;
> +
> + nand->ecc.mode = NAND_ECC_SOFT;
> + nand->options &= ~(NAND_BUSWIDTH_16);
Unnecessary parens.
> + nand->cmd_ctrl = kb9202_nand_hwcontrol;
> + nand->dev_ready = kb9202_nand_ready;
> +
> + /* in case running outside of bootloader */
> + AT91C_BASE_PMC->PMC_PCER = ((unsigned) 1 << AT91C_ID_PIOC);
Unnecessary cast and parens.
> + at91s_smc2->SMC2_CSR[3] =
> + AT91C_SMC2_WSEN |
> + (4 & AT91C_SMC2_NWS) |
> + ((1 << 8) & AT91C_SMC2_TDF) |
> + AT91C_SMC2_DBW_8 |
> + ((1 << 24) & AT91C_SMC2_RWSETUP) |
> + ((1 << 29) & AT91C_SMC2_RWHOLD);
Are those instances of (constant1 & constant2) ever going to evaluate to
anything but constant1? Can we get rid of the magic numbers?
Otherwise, ACK.
-Scott
next prev parent reply other threads:[~2009-06-03 19:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-15 22:15 [U-Boot] [PATCH 2/2] KB9202: Add NAND support Matthias Kaehlcke
2009-05-15 22:30 ` Scott Wood
2009-05-16 14:11 ` Matthias Kaehlcke
2009-05-18 17:38 ` Scott Wood
2009-05-19 7:25 ` Matthias Kaehlcke
2009-06-03 17:42 ` Matthias Kaehlcke
2009-06-03 19:50 ` Scott Wood [this message]
2009-06-04 17:45 ` Matthias Kaehlcke
2009-06-04 6:53 ` Stefan Roese
2009-06-04 17:49 ` Matthias Kaehlcke
2009-06-04 18:08 ` Stefan Roese
2009-06-04 18:50 ` Matthias Kaehlcke
2009-06-04 19:08 ` Wolfgang Denk
2009-06-11 18:46 ` [U-Boot] [PATCH 2/2 v4] " Matthias Kaehlcke
2009-06-23 21:19 ` Scott Wood
2009-06-24 15:23 ` [U-Boot] [PATCH 2/2 v5] " Matthias Kaehlcke
2009-06-24 20:51 ` Scott Wood
2009-07-12 19:57 ` Jean-Christophe PLAGNIOL-VILLARD
2009-07-16 18:45 ` Scott Wood
2009-07-16 19:19 ` [U-Boot] [PATCH 2/2 v6] " Matthias Kaehlcke
2009-08-06 21:47 ` Scott Wood
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=4A26D410.8050806@freescale.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox