[U-Boot] [PATCH v2 07/12] mtd: nand: add Faraday FTNANDC021 NAND controller support

Wolfgang Denk
2013-04-18T11:04:37Z

Dear Kuo-Jung Su,

In message <1366277139-29728-8-git-send-email-dantesu@gmail.com> you wrote:
...
> +/* Register access macros */
> +#define NAND_READ(r) le32_to_cpu(readl(r))
> +#define NAND_WRITE(v, r) writel(cpu_to_le32(v), r)
> +#define NAND_SETBITS(m, r) setbits_le32(r, m)
> +#define NAND_CLRBITS(m, r) clrbits_le32(r, m)

As before: drop these.

> + /* wait until chip ready */
> + while (NAND_READ(&regs->srr) & SRR_CHIP_RESET)
> + ;

Please add a timeout (and fix similar locations in the rest of the
code if there are such).

> + switch (priv->bksz / priv->pgsz) {
> + case 16:
> + bk = 0;
> + break;
> + case 32:
> + bk = 1;
> + break;
> + case 64:
> + bk = 2;
> + break;
> + case 128:
> + bk = 3;
> + break;
> + }

bk = ffs(priv->bksz / priv->pgsz) - 4;

?

> + switch (priv->adrc) {
> + case 3:
> + ac = 0;
> + break;
> + case 4:
> + ac = 1;
> + break;
> + case 5:
> + ac = 2;
> + break;
> + }

ac = priv->adrc - 3;

?

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"You're just jealous." "What, of an overgrown puppy with a single-
figure IQ?" - Terry Pratchett, _Moving Pictures_