public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Ian McDonnell <ian@brightstareng.com>
To: Duke <ezbonites@gmail.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>, linux-mtd@lists.infradead.org
Subject: Re: SPI Flash
Date: Wed, 19 Dec 2007 10:17:51 -0500	[thread overview]
Message-ID: <200712191017.51669.ian@brightstareng.com> (raw)
In-Reply-To: <mailman.54.1197992805.2861.linux-mtd@lists.infradead.org>

On Tuesday 18 December 2007 10:46, ezbonites@gmail.com wrote:
> Hi all,
> Has anyone use ST's SPI flash and Atmels SPI DataFlash
> suscessfully?
>
> How does the interface look from userspace? Is it still an
> mtdblockX device or is it a spi device node?
> Are these two manufacturers SPI flash compatable?
> How about access speed?
>
> Thanks,
> D.

I found I needed to tweak MTD's cache allocation to make it work
with the atmel DMA'ed SPI. Substitute kmalloc for vmalloc so
the cache buffer is mappable as per the Atmel SPI driver's
requirements.

-imcd


diff -u -I'$Id' -I'$Revision' -r1.1 -r1.2
--- mtdblock.c  13 Aug 2007 04:25:24 -0000      1.1
+++ mtdblock.c  14 Nov 2007 17:36:35 -0000      1.2
@@ -253,7 +253,11 @@
 {
        struct mtdblk_dev *mtdblk = mtdblks[dev->devnum];
        if (unlikely(!mtdblk->cache_data && mtdblk->cache_size)) {
+#ifdef CONFIG_BSE_TWEAKS // BSE fix for dataflash/spi DMA mapping
+               mtdblk->cache_data = kmalloc(mtdblk->mtd->erasesize, GFP_KERNEL);
+#else
                mtdblk->cache_data = vmalloc(mtdblk->mtd->erasesize);
+#endif
                if (!mtdblk->cache_data)
                        return -EINTR;
                /* -EINTR is not really correct, but it is the best match
@@ -315,7 +319,11 @@
                mtdblks[dev] = NULL;
                if (mtdblk->mtd->sync)
                        mtdblk->mtd->sync(mtdblk->mtd);
+#ifdef CONFIG_BSE_TWEAKS // BSE fix for dataflash/spi DMA mapping
+               kfree(mtdblk->cache_data);
+#else
                vfree(mtdblk->cache_data);
+#endif
                kfree(mtdblk);
        }
        DEBUG(MTD_DEBUG_LEVEL1, "ok\n");

       reply	other threads:[~2007-12-19 15:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.54.1197992805.2861.linux-mtd@lists.infradead.org>
2007-12-19 15:17 ` Ian McDonnell [this message]
2007-12-18 15:02 SPI Flash Duke
2007-12-18 15:39 ` Nicolas Ferre
2007-12-18 15:45   ` Duke
2007-12-18 15:46     ` Duke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200712191017.51669.ian@brightstareng.com \
    --to=ian@brightstareng.com \
    --cc=ezbonites@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=nicolas.ferre@atmel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox