linux-mips
[Top] [All Lists]

Re: [PATCH V3 06/10] MIPS: lantiq: add NOR flash support

To: John Crispin <blogic@openwrt.org>
Subject: Re: [PATCH V3 06/10] MIPS: lantiq: add NOR flash support
From: Sergei Shtylyov <sshtylyov@mvista.com>
Date: Fri, 04 Mar 2011 18:10:32 +0300
Cc: Ralf Baechle <ralf@linux-mips.org>, Ralph Hempel <ralph.hempel@lantiq.com>, David Woodhouse <dwmw2@infradead.org>, Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>, linux-mips@linux-mips.org, linux-mtd@lists.infradead.org
In-reply-to: <4D70DDEA.2050308@mvista.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1299146626-17428-1-git-send-email-blogic@openwrt.org> <1299146626-17428-7-git-send-email-blogic@openwrt.org> <4D70DDEA.2050308@mvista.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 2.0.0.21 (X11/20090320)
I wrote:

NOR flash is attached to the same EBU (External Bus Unit) as PCI. As described in the PCI patch, the EBU is a little buggy, resulting in the upper and lower 16 bit of the data on a 32 bit read are swapped. (essentially we have a addr^=2)

   "Are" not needed.

To work around this we do a addr^=2 during the probe. Once probed we adapt
cfi->addr_unlock1 and cfi->addr_unlock2 to represent the endianess bug.

Signed-off-by: John Crispin<blogic@openwrt.org>
Signed-off-by: Ralph Hempel<ralph.hempel@lantiq.com>
Cc: David Woodhouse<dwmw2@infradead.org>
Cc: Daniel Schwierzeck<daniel.schwierzeck@googlemail.com>
Cc: linux-mips@linux-mips.org
Cc: linux-mtd@lists.infradead.org
[...]

diff --git a/drivers/mtd/maps/lantiq.c b/drivers/mtd/maps/lantiq.c
new file mode 100644
index 0000000..674be0a
--- /dev/null
+++ b/drivers/mtd/maps/lantiq.c
@@ -0,0 +1,190 @@
[...]
+void
+ltq_copy_from(struct map_info *map, void *to,
 > +    unsigned long from, ssize_t len)

   Shouldn't it be static?

+{
+    unsigned char *p;
+    unsigned char *to_8;
+    unsigned long flags;
+
+    spin_lock_irqsave(&ebu_lock, flags);
+    from = (unsigned long) (map->virt + from);

   Why not:

    from += (unsigned long) map->virt;

like you do in ltq_copy_to()?

+    p = (unsigned char *) from;

   Could be done in initializer, like in ltq_copy_to().

+    to_8 = (unsigned char *) to;
+    while (len--)
+        *to_8++ = *p++;

   BTW, you could use memcpy_fromio().

Actually not, as on MIPS it's implemented via memcpy(). On ARM it doesn byte-by-byte copying -- that's why I remembered about it...

WBR, Sergei

<Prev in Thread] Current Thread [Next in Thread>