[U-Boot] [PATCH v7 02/19] nand: mxc: Add support for i.MX5

Fabio Estevam
2013-02-26T17:03:56Z

On Tue, Feb 26, 2013 at 1:49 PM, Beno?t Th?baudeau
<benoit.thebaudeau@advansee.com> wrote:
> Hi Fabio,
>
> On Tuesday, February 26, 2013 5:35:28 PM, Fabio Estevam wrote:
>> On Tue, Feb 26, 2013 at 1:08 PM, Beno?t Th?baudeau
>> <benoit.thebaudeau@advansee.com> wrote:
>>
>> > This boot pin / fuse config has been used by this driver for all i.MX
>> > platforms
>> > from the beginning. I don't think that we really need one more software
>> > config
>> > here. This is hardware stuff, and the i.MX provides a dedicated hardware
>> > configuration for it, so I think that we should use it, even if it's made
>> > for
>> > NAND boot, since it's just describing the present hardware, just like DT
>> > would.
>> >
>> > In the particular case of the mx53ard, there is a DIP switch that you can
>> > use to
>> > fix this config to 8-bit NAND Flash. But if you have blown the fuses to
>> > override
>> > the boot pin config, then of course we're doomed because a wrong NAND Flash
>> > config has been blow.
>>
>> The boot config jumpers are correctly set to boot from MMC card and
>> this is what I am using as the boot media.
>
> OK, then we don't have a choice.
>
>> Why should we decide the NAND width via boot pins if I am not booting
>> from NAND at all?
>>
>> I see that current mxc nand drivers are doing like this, but I don't
>> think this makes sense if we use NAND and does not boot from it.
>
> If the NAND boot config for bus width is not used by the actuel boot config to
> mean something else (which is not your case), then it's a handy way of
> describing the NAND hardware setup without involving software. But anyway we're
> not in this case, so we need a software config.
>
>> I agree with this comment from tt01.h:
>>
>> "/*
>> * it's not 16 bit:
>> * #define CONFIG_SYS_NAND_BUSWIDTH_16BIT
>> * the current u-boot mxc_nand.c tries to auto-detect, but this only
>> * reads the boot settings during reset (which might be wrong)
>> */"
>>
>> and we can also see the a workaround at board/davedenx/qong/qong.c in
>> order to tell the nand bus width is 8 bits:
>>
>> void qong_nand_plat_init(void *chip)
>> {
>> struct nand_chip *nand = (struct nand_chip *)chip;
>> nand->chip_delay = 20;
>> nand->select_chip = qong_nand_select_chip;
>> nand->options &= ~NAND_BUSWIDTH_16;
>> board_nand_setup();
>> }
>
> OK, then let's use something like CONFIG_SYS_NAND_BUSWIDTH_16BIT for all boards
> with mxc_nand enabled.

Documentation/devicetree/bindings/mtd/nand.txt says:

nand-bus-width : 8 or 16 bus width if not present 8

I think we could do the same here, ie, if
CONFIG_SYS_NAND_BUSWIDTH_16BIT is not defined in the board file, then
assume it is 8-bit nand.

I can send this as a separate patch.

Thanks,

Fabio Estevam