public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* 64 bit bus access on a customed MPC8245 board
@ 2004-01-28  3:47 Shawn Jin
  2004-01-28 15:48 ` Eric W. Biederman
  0 siblings, 1 reply; 5+ messages in thread
From: Shawn Jin @ 2004-01-28  3:47 UTC (permalink / raw)
  To: linux-mtd

[-- 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);
}

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-01-28 18:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-28  3:47 64 bit bus access on a customed MPC8245 board Shawn Jin
2004-01-28 15:48 ` Eric W. Biederman
2004-01-28 15:59   ` David Woodhouse
2004-01-28 17:58     ` Shawn Jin
2004-01-28 18:39     ` Shawn Jin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox