All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Sanjay Tandel <sanjay.tandel@rockwellcollins.com>,
	Matt Weber <matthew.weber@rockwellcollins.com>,
	linux-mtd <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH] map-ram chip driver: 16-bit block transfer
Date: Mon, 14 Aug 2017 10:08:40 +0200	[thread overview]
Message-ID: <CAK8P3a2pOtoug30CUe7sgB4CnQmRJSJMWmpniMyOHvV1w0nd9A@mail.gmail.com> (raw)
In-Reply-To: <20170812193947.046dafd1@bbrezillon>

On Sat, Aug 12, 2017 at 7:39 PM, Boris Brezillon
<boris.brezillon@free-electrons.com> wrote:
> Le Fri, 11 Aug 2017 18:42:44 -0500,
> Sanjay Tandel <sanjay.tandel@rockwellcollins.com> a écrit :
>> On Fri, Aug 11, 2017 at 4:30 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> > On Fri, Aug 11, 2017 at 11:03 PM, Sanjay Tandel
>> > <sanjay.tandel@rockwellcollins.com> wrote:

>> Before, it used to corrupt every 2nd byte(2nd,4rth,6th ... upto N) in memory,
>> with memcpy_toio() using 8-bit accesses for our 16-bit chip.
>>
>> Now, with backporting 7ddfe625cbc1/1bd46782d08b, it corrupts (N + 1)th byte
>> in memory, when I tried to write N number of bytes (where N is not aligned to
>> 4-byte boundary).That means, it still tries 8-bit access for last odd byte and
>> ends up corrupting next byte.
>
> Yes, that's expected as the size is not 16bit aligned.
>
> Anyway, I read the whole thread again and AFAIU memcpy_to/fromio() is
> only appropriate if the bus controller the device is connected to is
> smart enough to hide all alignment problems to its users.
>
> Don't know what controller is causing trouble here, but you should
> probably have a dedicated driver (if that's not already the case) that
> overloads the ->copy_from()/->copy_to() methods to do the right thing
> for your memory controller.

Right, I think that is a good conclusion. My understanding from the discussion
so far is that the existing code in the core mtd layer works efficiently and
correctly on most bus interfaces, so we should keep that but have
workarounds in the controller driver for any bus interface where this is
not the case.

I think it would be different if this was a regression and the core MTD support
worked correctly in the past, but from what I read, it always behaved like
this.

       Arnd

  reply	other threads:[~2017-08-14  8:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04 13:02 [PATCH] map-ram chip driver: 16-bit block transfer Matt Weber
2017-08-09 18:10 ` Boris Brezillon
2017-08-09 19:51   ` Arnd Bergmann
2017-08-11 17:57     ` Sanjay Tandel
2017-08-11 19:42       ` Arnd Bergmann
2017-08-11 16:50   ` Sanjay Tandel
2017-08-11 19:41     ` Arnd Bergmann
2017-08-11 21:03       ` Sanjay Tandel
2017-08-11 21:30         ` Arnd Bergmann
2017-08-11 23:42           ` Sanjay Tandel
2017-08-12 17:39             ` Boris Brezillon
2017-08-14  8:08               ` Arnd Bergmann [this message]
2017-08-14 16:33                 ` Sanjay Tandel
2017-08-29  2:23                 ` Matthew Weber
2017-08-29  7:12                   ` Boris Brezillon

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=CAK8P3a2pOtoug30CUe7sgB4CnQmRJSJMWmpniMyOHvV1w0nd9A@mail.gmail.com \
    --to=arnd@arndb.de \
    --cc=boris.brezillon@free-electrons.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=matthew.weber@rockwellcollins.com \
    --cc=sanjay.tandel@rockwellcollins.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.