public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Shawn Jin <shawnxtech@yahoo.com>
To: linux-mtd@lists.infradead.org
Subject: 64 bit bus access on a customed MPC8245 board
Date: Tue, 27 Jan 2004 19:47:34 -0800 (PST)	[thread overview]
Message-ID: <20040128034734.77883.qmail@web20725.mail.yahoo.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1348 bytes --]

Hi,

I'm working on a customed MPC8245 board with flash
chip Am29LV320 and trying to enable MTD driver
support.

The configuration is 32 bit bus width in each chip
with 2 chips interleaved. So CONFIG_MTD_CFI_B8 and
CONFIG_MTD_CFI_I2 are defined.

MPC8245 requires the following memory mapping:
bank 0: 0xFF800000 - 0xFFFFFFFF
bank 1: 0xFF000000 - 0xFF7FFFFF

I noticed that FPU must be enabled for 64-bit
read/write from/to flash.

I use read64() and write64() functions in the
attachment, which are copied from sbc8240.c. However
no chip can be found. Any suggestions? Thank you very
much.

The message is shown below.

mpc8245:Probing 0x00800000 at 0xff800000
mpc8245_write64 adr 0xff800000 data 0x000000f0000000f0
mpc8245_write64 adr 0xff8002a8 data 0x0000009800000098
mpc8245_read64 ofs 0xff800080 result
0xffffffffffffffff
CFI: Found no mpc8245 Flash Bank #0 device at location
zero
mpc8245:Probing 0x00800000 at 0xff000000
mpc8245_write64 adr 0xff000000 data 0x000000f0000000f0
mpc8245_write64 adr 0xff0002a8 data 0x0000009800000098
mpc8245_read64 ofs 0xff000080 result
0xffffffffffffffff
CFI: Found no MPC8245 Flash Bank #1 device at location
zero
mpc8245:No suppported flash chips found!

-Shawn.

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

[-- Attachment #2: flash.c --]
[-- Type: application/octet-stream, Size: 1782 bytes --]

__u64 mpc8245_read64(struct map_info *map, unsigned long ofs)
{
	unsigned long flags, msr, saved_msr;
	volatile unsigned long *p;

	save_flags(flags);
	cli();

	/* turn off floating point unavailable exceptions */

	__asm__ __volatile__ (
		"mfmsr %0" 
		: "=r" (msr) :);

	saved_msr = msr;
	msr |= MSR_FP;
	msr &= ~(MSR_FE0 | MSR_FE1);

	__asm__ __volatile__ (
		"mtmsr %0\n"
		"isync\n"
		: : "r" (msr));

	/* read the data via a floating point register */

	ofs = map->map_priv_1 + ofs;
	p = (unsigned long *) &result64;

	__asm__ __volatile__ (
		"lfd  1,0(%1)\n"
		"stfd 1,0(%0)\n"
		: : "r" (p), "r" (ofs)
		);

	/* restore state */

	__asm__ __volatile__ (
		"mtmsr %0\n"
		"isync\n"
		: : "r" (saved_msr));

	restore_flags(flags);

	p = (unsigned long *) &result64;
	debugk("mpc8245_read64 ofs 0x%x result 0x%08x%08x\n", ofs, *p, *(p+1));

	return result64;
}

void mpc8245_write64(struct map_info *map, __u64 d, unsigned long adr)
{
	unsigned long long tmp;
	unsigned long flags, msr, saved_msr, *p;
	volatile long saved_fr[2];

	save_flags(flags);
	cli();

	/* turn off floating point unavailable exceptions */

	__asm__ __volatile__ (
		"mfmsr %0" 
		: "=r" (msr) :);

	saved_msr = msr;
	msr |= MSR_FP;
	msr &= ~(MSR_FE0 | MSR_FE1);

	__asm__ __volatile__ (
		"mtmsr %0\n"
		"isync\n"
		: : "r" (msr));


	/* write the data via a floating point register */

	tmp = d;
	p = (unsigned long *) &tmp;
	adr = map->map_priv_1 + adr;
	debugk("mpc8245_write64 adr 0x%x data 0x%08x%08x\n", adr, *p, *(p+1));

	__asm__ __volatile__ (
		"stfd 1,0(%2)\n"
		"lfd  1,0(%0)\n"
		"stfd 1,0(%1)\n"
		"lfd  1,0(%2)\n"
		: : "r" (p), "r" (adr), "b" (saved_fr)
		);

	/* restore state */

	__asm__ __volatile__ (
		"mtmsr %0\n"
		"isync\n"
		: : "r" (saved_msr));

	restore_flags(flags);
}

             reply	other threads:[~2004-01-28  3:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-28  3:47 Shawn Jin [this message]
2004-01-28 15:48 ` 64 bit bus access on a customed MPC8245 board Eric W. Biederman
2004-01-28 15:59   ` David Woodhouse
2004-01-28 17:58     ` Shawn Jin
2004-01-28 18:39     ` Shawn Jin

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=20040128034734.77883.qmail@web20725.mail.yahoo.com \
    --to=shawnxtech@yahoo.com \
    --cc=linux-mtd@lists.infradead.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