[U-Boot] [PATCH 04/10] mxc_nand: add nand driver for MX2/MX3

Magnus Lilja lilja.magnus at gmail.com
Fri May 8 10:58:47 CEST 2009


Hi

2009/5/8 Ivo Clarysse <ivo.clarysse at gmail.com>:
> Ilya,
>
> On Wed, May 6, 2009 at 8:30 PM, Ilya Yanok <yanok at 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).

I think it's a good idea to keep the code as close as possible to the
original linux driver. That way it's easy to make a diff and update
the U-boot driver with whatever changes are done in Linux.

Regards, Magnus


More information about the U-Boot mailing list