This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using DMA to access NAND-Flash (u-boot)

Other Parts Discussed in Thread: AM3517

Hello,

to improve the boot-performance of our am3517 modul i want to set up DMA for NAND-Flash reading.

Without DMA only 2MByte/s  can be read from the NAND-Flash.

I have been able to set a the DMA like the example from the reference manual for a RAM to RAM transfer with u-boot.

I tried to modifie this for a NAND-Flash read but then I´ve got a problem with the ECC.

My first approach was to replace the code within nand_read_buf like the following:

/**
 * nand_read_buf - [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 8bit buswith
 */
static void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
{
    /*
    int i;
    struct nand_chip *chip = mtd->priv;

    for (i = 0; i < len; i++)
    {
        //buf[i] = *(volatile unsigned char *)( 0x6e000084);
        buf[i] = readb(chip->IO_ADDR_R);
    }
*/
    struct omap3_dma4 *omap3_dma4_base     = (struct omap3_dma4*)OMAP3_SDMA_BASE_ADDR;
    struct nand_chip *chip = mtd->priv;

    /* setting up dma */
    omap3_dma4_base->channel[0].csdp     = DATA_TYPE(DATATYPE_8BIT_SCALAR);
    omap3_dma4_base->channel[0].cen        = 32;
    omap3_dma4_base->channel[0].cfn        = 64;
    omap3_dma4_base->channel[0].cssa    = chip->IO_ADDR_R;
    omap3_dma4_base->channel[0].cdsa    = buf;
    omap3_dma4_base->channel[0].csei    = 1;
    omap3_dma4_base->channel[0].csfi    = 1;
    omap3_dma4_base->channel[0].cdei    = 1;
    omap3_dma4_base->channel[0].cdfi    = 1;
    omap3_dma4_base->channel[0].ccr        = DST_ADDR_MODE(POST_INCR_ADDR_MODE) | SRC_ADDR_MODE(CONSTANT_ADDR_MODE);

    /* start dma*/
    omap3_dma4_base->channel[0].ccr        |= CHA_ENABLE;

    while (omap3_dma4_base->channel[0].ccr    & CHA_ENABLE) { asm volatile("nop"); }
}

Is it possible to get a example how to setup a DMA for NAND-Flash access?

What do i need to change?

Thank You, Regards

Ludwig