Google
  Web www.spinics.net

Re: at91 dataflash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Fri, Mar 28, 2008 at 11:17:42AM +0100, Victor Librado wrote:
> 
>  So ...
> 
> what is the point in the failure with dma error while trying to write to 
> the mtd partition of the dataflash, command:
> 
> dd if=bootloAder.bin of=/dev/mtdblock2.
> 
> Bug, under the driver, in AT91 dataflash card support CONFIG option in 
> kernel sources?

It's a bug, plain and simple.

Unfortunately, MTD does this (in brief):

static int dataflash_read(struct mtd_info *mtd, loff_t from, size_t len,
                               size_t *retlen, u_char *buf)
{
        x[1].rx_buf = buf;
        x[1].len = len;
        spi_message_add_tail(&x[1], &msg);
        status = spi_sync(priv->spi, &msg);
}

static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos,
                            int len, const char *buf)
{
	/* mtd->read is dataflash_read */
                                ret = mtd->read(mtd, sect_start, sect_size,
                                                &retlen, mtdblk->cache_data);
}

static int mtdblock_writesect(struct mtd_blktrans_dev *dev,
                              unsigned long block, char *buf)
{
        if (unlikely(!mtdblk->cache_data && mtdblk->cache_size)) {
                mtdblk->cache_data = vmalloc(mtdblk->mtd->erasesize);
        return do_cached_write(mtdblk, block<<9, 512, buf);
}

Consequently, ->cache_data (which is a pointer to remapped memory) ends up
being passed to the DMA API, which is completely invalid and unsupported.

I don't know what the fix is for this, but it's for the SPI/dataflash/MTD
folk to resolve.  They must NOT pass a remapped memory pointer to the DMA
API.

-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

[Site Home]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux ARM Kernel]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Tools]     [DDR & Rambus]     [Monitors]

Powered by Linux

Google PageRank Checking tool