All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: John Crispin <blogic@openwrt.org>
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
Subject: Re: [PATCH V3 06/10] MIPS: lantiq: add NOR flash support
Date: Fri, 04 Mar 2011 18:10:32 +0300	[thread overview]
Message-ID: <4D7100E8.101@mvista.com> (raw)
In-Reply-To: <4D70DDEA.2050308@mvista.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: John Crispin <blogic@openwrt.org>
Cc: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
	Ralph Hempel <ralph.hempel@lantiq.com>,
	linux-mtd@lists.infradead.org,
	Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH V3 06/10] MIPS: lantiq: add NOR flash support
Date: Fri, 04 Mar 2011 18:10:32 +0300	[thread overview]
Message-ID: <4D7100E8.101@mvista.com> (raw)
In-Reply-To: <4D70DDEA.2050308@mvista.com>

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

  reply	other threads:[~2011-03-04 15:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03 10:03 [PATCH V3 00/10] MIPS: add initial support for the Lantiq SoCs John Crispin
2011-03-03 10:03 ` [PATCH V3 01/10] MIPS: lantiq: add initial support for " John Crispin
2011-03-03 10:03 ` [PATCH V3 02/10] MIPS: lantiq: add SoC specific code for XWAY family John Crispin
2011-03-03 10:03 ` [PATCH V3 03/10] MIPS: lantiq: add PCI controller support John Crispin
2011-03-03 10:03 ` [PATCH V3 04/10] MIPS: lantiq: add serial port support John Crispin
2011-03-03 10:03 ` [PATCH V3 05/10] MIPS: lantiq: add watchdog support John Crispin
2011-03-03 11:44   ` Sergei Shtylyov
2011-03-03 11:58     ` John Crispin
2011-03-03 10:03 ` [PATCH V3 06/10] MIPS: lantiq: add NOR flash support John Crispin
2011-03-03 10:03   ` John Crispin
2011-03-04 12:41   ` Sergei Shtylyov
2011-03-04 12:41     ` Sergei Shtylyov
2011-03-04 15:10     ` Sergei Shtylyov [this message]
2011-03-04 15:10       ` Sergei Shtylyov
2011-03-04 20:13     ` John Crispin
2011-03-04 20:13       ` John Crispin
2011-03-03 10:03 ` [PATCH V3 07/10] MIPS: lantiq: add platform device support John Crispin
2011-03-03 10:03 ` [PATCH V3 08/10] MIPS: lantiq: add mips_machine support John Crispin
2011-03-03 10:03 ` [PATCH V3 09/10] MIPS: lantiq: add machtypes for lantiq eval kits John Crispin
2011-03-03 10:03 ` [PATCH V3 10/10] MIPS: lantiq: add more gpio drivers John Crispin

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=4D7100E8.101@mvista.com \
    --to=sshtylyov@mvista.com \
    --cc=blogic@openwrt.org \
    --cc=daniel.schwierzeck@googlemail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=ralf@linux-mips.org \
    --cc=ralph.hempel@lantiq.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.