[U-Boot] [PATCH v2 1/3] MX31: Add NAND SPL for i.MX31.

Magnus Lilja
2009-06-01T20:21:47Z

Hi

2009/5/30 Magnus Lilja <lilja.magnus@gmail.com>:
> 2009/5/29 Scott Wood <scottwood@freescale.com>:
>> On Sun, May 03, 2009 at 09:56:57PM +0200, Magnus Lilja wrote:
>>> +static void mx31_nand_page_address(unsigned int page_address)
>>> +{
>>> + ? ? unsigned int page_count;
>>> +
>>> + ? ? writew(0x00, NFC_FLASH_ADDR);
>>> + ? ? writew(NFC_ADDR, NFC_CONFIG2);
>>> + ? ? mx31_wait_ready();
>>> +
>>> + ? ? /* code only for 2kb flash */
>>> + ? ? if (CFG_NAND_PAGE_SIZE == 0x800) {
>>> + ? ? ? ? ? ? writew(0x00, NFC_FLASH_ADDR);
>>> + ? ? ? ? ? ? writew(NFC_ADDR, NFC_CONFIG2);
>>> + ? ? ? ? ? ? mx31_wait_ready();
>>> + ? ? }
>>> +
>>> + ? ? page_count = CFG_NAND_CHIP_SIZE / CFG_NAND_PAGE_SIZE;
>>> +
>>> + ? ? if (page_address <= page_count) {
>>> + ? ? ? ? ? ? page_count--; /* transform 0x01000000 to 0x00ffffff */
>>> + ? ? ? ? ? ? do {
>>> + ? ? ? ? ? ? ? ? ? ? writew(page_address & 0xff, NFC_FLASH_ADDR);
>>> + ? ? ? ? ? ? ? ? ? ? writew(NFC_ADDR, NFC_CONFIG2);
>>> + ? ? ? ? ? ? ? ? ? ? mx31_wait_ready();
>>> + ? ? ? ? ? ? ? ? ? ? page_address = page_address >> 8;
>>> + ? ? ? ? ? ? ? ? ? ? page_count = page_count >> 8;
>>> + ? ? ? ? ? ? } while (page_count);
>>> + ? ? }
>>
>> Does the number of address bytes really need to depend on the size of the
>> flash chip, or can you base it on the number of non-zero bytes in
>> page_address (the chip will know when the address phase is over because
>> ALE drops)?
>
> Ok, will try to look into it.

I did try to output only the non-zero bytes in the page_address but
that didn't work at all, u-boot didn't boot Don't know why though.

/Magnus