From: Wolfgang Denk Date: Thu, 18 Apr 2013 13:04:37 +0200 Subject: [U-Boot] [PATCH v2 07/12] mtd: nand: add Faraday FTNANDC021 NAND controller support In-Reply-To: <1366277139-29728-8-git-send-email-dantesu@gmail.com> References: <1366277139-29728-1-git-send-email-dantesu@gmail.com> <1364540788-13943-2-git-send-email-dantesu@gmail.com> <1366277139-29728-8-git-send-email-dantesu@gmail.com> Message-ID: <20130418110437.6D22420019A@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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(®s->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_