linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jon Smirl <jonsmirl@gmail.com>
To: "Albrecht Dreß" <albrecht.dress@arcor.de>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [Solved/Patch Question] Weird 5200/mtd-ram problem
Date: Wed, 27 May 2009 23:10:23 -0400	[thread overview]
Message-ID: <9e4733910905272010j891b3deh89df84144b2bcb5e@mail.gmail.com> (raw)
In-Reply-To: <1243454097.3489.0@antares>

On Wed, May 27, 2009 at 3:54 PM, Albrecht Dre=DF <albrecht.dress@arcor.de> =
wrote:
> Hi all:
>
> Am 25.05.09 23:47 schrieb(en) Wolfram Sang:
>>>
>>> A word or long copy of 0x0055aaff with U-Boot works fine, but a byte co=
py
>>> filled the whole ram with 0x0000aaaa. =A0The reason is apparently that =
the
>>> chip is attached to the local bus in 16-bit mode, which is incompatible=
 with
>>> byte accesses. =A0However, the Local Bus doesn't provide "low byte" or =
"high
>>> byte" indicators in non-muxed mode. =A0How is this supposed to work the=
n?
>>
>> Hmm, as I feared... we were bitten by this, too:
>>
>> http://thread.gmane.org/gmane.linux.drivers.mtd/21521
>>
>> There is no generic solution yet :(
>
> At least for my case, I could completely (afaict) solve the problem, i.e.=
 I
> can now access the 16-bit nv ram as mtd char and block device, the latter
> with jffs2. =A0I would like to submit a patch, but I actually don't know
> exactly how...
>
> The solution itself is quite simple: add a new method which works like
> memcpy_toio, but respects the fact that no single bytes may be written
> (reading through memcpy_fromio works painlessly). =A0I think this functio=
n
> should go into arch/powerpc/kernel/io.c, depending upon CONFIG_PPC_MPC52x=
x,
> and the prototype into arch/powerpc/include/asm/io.h, right?
>
> The harder part is to actually call this function properly. =A0I now call=
 it
> in include/linux/mtd/map.h, function inline_map_copy_to(), if
> CONFIG_PPC_MPC52xx is defined and if map->bankwidth is 2. =A0However, is =
it
> acceptable to have a processor-type dependency in a top-level include fil=
e?
> =A0Or what would be the proper way to implement it?

This is an old jffs2 patch that was addressing this same problem.

diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 272872d..c982adc 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -16,6 +16,7 @@
 #include <linux/pagemap.h>
 #include <linux/crc32.h>
 #include <linux/compiler.h>
+#include <asm/io.h>
 #include "nodelist.h"
 #include "summary.h"
 #include "debug.h"
@@ -505,7 +506,7 @@ static int jffs2_scan_eraseblock (struct
jffs2_sb_info *c, struct jffs2_eraseblo
 					sumptr =3D kmalloc(sumlen, GFP_KERNEL);
 					if (!sumptr)
 						return -ENOMEM;
-					memcpy(sumptr + sumlen - buf_len, buf + buf_size - buf_len, buf_len);
+					memcpy_fromio(sumptr + sumlen - buf_len, buf + buf_size -
buf_len, buf_len);
 				}
 				if (buf_len < sumlen) {
 					/* Need to read more so that the entire summary node is present */
@@ -1035,7 +1036,7 @@ static int jffs2_scan_dirent_node(struct
jffs2_sb_info *c, struct jffs2_eraseblo
 	if (!fd) {
 		return -ENOMEM;
 	}
-	memcpy(&fd->name, rd->name, checkedlen);
+	memcpy_fromio(&fd->name, rd->name, checkedlen);
 	fd->name[checkedlen] =3D 0;

 	crc =3D crc32(0, fd->name, rd->nsize);



>
> Thanks, Albrecht.
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>



--=20
Jon Smirl
jonsmirl@gmail.com

      reply	other threads:[~2009-05-28  3:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-20 14:13 Weird 5200/mtd-ram problem Albrecht Dreß
2009-05-20 14:23 ` Gary Thomas
2009-05-20 19:36   ` Albrecht Dreß
2009-05-20 19:59     ` Gary Thomas
2009-05-20 20:01 ` Wolfram Sang
2009-05-25 17:41   ` Albrecht Dreß
2009-05-25 18:11     ` Wolfgang Denk
2009-05-25 21:47     ` Wolfram Sang
2009-05-27 19:54       ` [Solved/Patch Question] " Albrecht Dreß
2009-05-28  3:10         ` Jon Smirl [this message]

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=9e4733910905272010j891b3deh89df84144b2bcb5e@mail.gmail.com \
    --to=jonsmirl@gmail.com \
    --cc=albrecht.dress@arcor.de \
    --cc=linuxppc-dev@ozlabs.org \
    /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;
as well as URLs for NNTP newsgroup(s).