Ilya, On Wed, May 6, 2009 at 8:30 PM, Ilya Yanok <ya...@emcraft.com> wrote: > Driver for NFC NAND controller found on Freescale's MX2 and MX3 > processors. Ported from Linux. Tested only with i.MX27 but should > works with other MX2 and MX3 processors too. [..] > --- /dev/null > +++ b/drivers/mtd/nand/mxc_nand.c > @@ -0,0 +1,891 @@ [...] > +/* This function polls the NANDFC to wait for the basic operation to > + * complete by checking the INT bit of config2 register. > + */ > +static void wait_op_done(struct mxc_nand_host *host, int max_retries, > + uint16_t param, int useirq) > +{ > + uint32_t tmp; > + > + while (max_retries-- > 0) { > + if (readw(host->regs + NFC_CONFIG2) & NFC_INT) { > + tmp = readw(host->regs + NFC_CONFIG2); > + tmp &= ~NFC_INT; > + writew(tmp, host->regs + NFC_CONFIG2); > + break; > + } > + udelay(1); > + } > + if (max_retries <= 0) > + MTDDEBUG(MTD_DEBUG_LEVEL0, "%s(%d): INT not set\n", > + __func__, param); > +}
As you don't have an interrupt handler (as opposed to the Linux driver), why keep the 'useirq' parameter ? [...] > +static void send_cmd(struct mxc_nand_host *host, uint16_t cmd, int useirq) Same comment (also renders all 'islast' parameters obsolete). [...] > +int board_nand_init(struct nand_chip *this) > +{ [...] > + > + tmp = readw(host->regs + NFC_CONFIG1); > + tmp |= NFC_INT_MSK; > + writew(tmp, host->regs + NFC_CONFIG1); I don't think this is needed on i.MX27, since you don't have an interrupt handler. Setting NFC_INT_MSK on i.MX21 will cause NFC_INT in NFC_CONFIG2 to never get set (and wait_op_done() to always time out) You might want to have a look at u-boot-v2's MXC nand driver, that one works on both i.MX21 and i.MX27, without setting NFC_INT_MSK: http://git.denx.de/?p=u-boot/u-boot-v2.git;a=blob;f=drivers/nand/nand_imx.c;hb=HEAD Also, see my post on linux-arm-kernel, "[RFC][PATCH] MXC NAND i.MX21 support": http://www.spinics.net/lists/arm-kernel/msg64970.html Best regards, Ivo. _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot