[U-Boot] [4/5]devkit8000 nand_spl: Add SPL NAND support to omap_gpmc driver

Simon Schwarz simonschwarzcor at googlemail.com
Thu Jun 30 13:01:29 CEST 2011


Dear Andreas,

> You also set some special ECC handling in this patch, please honour this
> in your commit message!
will do.

>> +
>> +/**
>> + * nand_read_buf16 - [DEFAULT] read chip data into buffer
>> + * @mtd:    MTD device structure
>> + * @buf:    buffer to store date
>> + * @len:    number of bytes to read
>> + *
>> + * Default read function for 16bit buswith
>> + *
>> + * This function is based on nand_read_buf16 from nand_base.c. This version
>> + * reads 32bit not 16bit although the bus only has 16bit.
>> + */
>> +static void gpmc_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len)
>> +{
>> +     int i;
>> +     struct nand_chip *chip = mtd->priv;
>> +     u32 *p = (u32 *) buf;
>> +     len >>= 2;
>> +
>> +     for (i = 0; i < len; i++)
>> +             p[i] = readl(chip->IO_ADDR_R);
>> +}
>> +#endif
>> +
>>  /*
>>   * omap_hwecc_init - Initialize the Hardware ECC for NAND flash in
>>   *                   GPMC controller
>> @@ -278,7 +312,9 @@ void omap_nand_switch_ecc(int32_t hardware)
>>       /* Update NAND handling after ECC mode switch */
>>       nand_scan_tail(mtd);
>>
>> +     #ifndef CONFIG_SPL
>>       nand->options &= ~NAND_OWN_BUFFERS;
>> +     #endif
>>  }
>>
>>  /*
>> @@ -337,8 +373,23 @@ int board_nand_init(struct nand_chip *nand)
>>               nand->options |= NAND_BUSWIDTH_16;
>>
>>       nand->chip_delay = 100;
>> +     nand->dev_ready = omap_dev_ready;
>>       /* Default ECC mode */
>> +#ifndef CONFIG_PRELOADER
>
> should't this some CONFIG_USE_SOFT_ECC (or whatever config variable
> define that behaviour)?

Its the default ECC setting this is software for standard U-Boot. Just
for the Preloader it is HW. So i think using CONFIG_PRELOADER is ok
here.


>> +     nand->ecc.size = 512;
>> +     nand->ecc.bytes = 24;
>
> Ouch, these two values are extremely HW spwcific and need to be
> configurable then.
will change.

>
>> +     nand->ecc.hwctl = omap_enable_hwecc;
>> +     nand->ecc.correct = omap_correct_data;
>> +     nand->ecc.calculate = omap_calculate_ecc;
>
> Isn't that some kind of CONFIG_NAND_BUSWDITH (or whatever config
> variable define that behaviour) related setting?
Sorry don't understand that. These three functions are not related to
the bus width IMHO.

Thank you for the feedback!
Simon


More information about the U-Boot mailing list