Hi,
To perform a Memory Mapped access of a device, I setup the OR and BR
registers in the bootloader (u-boot). I am able to read and write to
the device being in the u-boot prompt. However, when I try to access
the device after the Linux kernel boots up (say, in a driver), it
gives me a exception message as follows.
#################################################################
enabl0004, DSISR: 00000063
TASK = c3ef4000[18] 'insmod' Last syscall: 128
last math 00000000 last altivec 00000000
GPR00: C60B0338 C3EF5E50 C3EF4000 60000004 00001032 00000001 C018009E C60B0000
GPR08: C60B0BB8 C60B085C C60B0BBC C60B0000 C0180000 10056374 00000000 00000000
3
TASK = c3ef4000[18] 'insmod' Last syscall: 128
last math 00000000 last altivec 00000000
GPR00: C60B0338 C3EF5E50 C3EF4000 60000004 00001032 00000001 C018009E C60B0000
GPR08: C60B0BB8 C60B085C C60B0BBC C60B0000 C0180000 10056374 00000000 00000000
GPR16: 00000000 00000000 00000000 00000000 00009032 C3EF5E98 10064EBC C3E2C000
GPR24: C02EEA80 00000008 C60B2000 00000060 FFFFFFEA 00000000 C60B0000 C60B0000
Call backtrace:
00000000 C60B0338 C0014DE4 C000447C 10050000 1000B27C 1000C344
10003CBC 100038C8 0FE70E88 00000000
#################################################################
My platform is MPC880 Processor.
Do I need to setup something more in the kernel?
--
Rupesh S
On Tue, Oct 12, 2004 at 02:24:50PM -0700, Rupesh S wrote:
Hi,
To perform a Memory Mapped access of a device, I setup the OR and BR
registers in the bootloader (u-boot). I am able to read and write to
the device being in the u-boot prompt. However, when I try to access
the device after the Linux kernel boots up (say, in a driver), it
gives me a exception message as follows.
#################################################################
enabl0004, DSISR: 00000063
TASK = c3ef4000[18] 'insmod' Last syscall: 128
last math 00000000 last altivec 00000000
GPR00: C60B0338 C3EF5E50 C3EF4000 60000004 00001032 00000001 C018009E C60B0000
GPR08: C60B0BB8 C60B085C C60B0BBC C60B0000 C0180000 10056374 00000000 00000000
3
TASK = c3ef4000[18] 'insmod' Last syscall: 128
last math 00000000 last altivec 00000000
GPR00: C60B0338 C3EF5E50 C3EF4000 60000004 00001032 00000001 C018009E C60B0000
GPR08: C60B0BB8 C60B085C C60B0BBC C60B0000 C0180000 10056374 00000000 00000000
GPR16: 00000000 00000000 00000000 00000000 00009032 C3EF5E98 10064EBC C3E2C000
GPR24: C02EEA80 00000008 C60B2000 00000060 FFFFFFEA 00000000 C60B0000 C60B0000
Call backtrace:
00000000 C60B0338 C0014DE4 C000447C 10050000 1000B27C 1000C344
10003CBC 100038C8 0FE70E88 00000000
#################################################################
My platform is MPC880 Processor.
Do I need to setup something more in the kernel?
Did you use ioremap to get valid kernel virtual address for your
device registers? You generally cannot just use physical address to
access device from the device driver.
--
Eugene
From: Jon Masters <hidden> Date: 2004-10-12 23:03:23
On Tue, 12 Oct 2004 14:36:34 -0700, Eugene Surovegin [off-list ref] wrote:
Did you use ioremap to get valid kernel virtual address for your
device registers? You generally cannot just use physical address to
access device from the device driver.
Possibly also use io_block_mapping on ppc to map a block of IO memory
before ioremapping.
Jon.
On Wed, Oct 13, 2004 at 12:03:21AM +0100, Jon Masters wrote:
On Tue, 12 Oct 2004 14:36:34 -0700, Eugene Surovegin [off-list ref] wrote:
quoted
Did you use ioremap to get valid kernel virtual address for your
device registers? You generally cannot just use physical address to
access device from the device driver.
Possibly also use io_block_mapping on ppc to map a block of IO memory
before ioremapping.
Yes, this is possible but considered obsoleted and not-recommended way
of accessing device registers.
--
Eugene
From: Jon Masters <hidden> Date: 2004-10-13 22:27:05
On Tue, Oct 12, 2004 at 04:34:32PM -0700, Eugene Surovegin wrote:
On Wed, Oct 13, 2004 at 12:03:21AM +0100, Jon Masters wrote:
quoted
On Tue, 12 Oct 2004 14:36:34 -0700, Eugene Surovegin [off-list ref] wrote:
quoted
Did you use ioremap to get valid kernel virtual address for your
device registers? You generally cannot just use physical address to
access device from the device driver.
Possibly also use io_block_mapping on ppc to map a block of IO memory
before ioremapping.
Yes, this is possible but considered obsoleted and not-recommended way
of accessing device registers.
Thanks for the informations.
I used "ioremap" and it works !!
However, when I checked out some documentaions on this regard, I
happened to notice that for "cache disabled acees in some arch", we
would probably need to use "ioremap_nocache". My requirement is for a
cache disabled access. Also, I read that in some processor arch, the
"nocache" and the normmal version is all the same. How is it in PPC ?
I could also read that it is encouraged to use "readl", "writel" to
access the memory rather than the normal pointer dereferencing.
However, in my driver, the normal pointer dereferencing works, but the
"readl" and "writel" doesn't work. Here is the code snippet for the
write operation. Any clues ?
################################################################
volatile __u32* __fpga;
__fpga = (__u32*) ioremap_nocache(0x60000000, (4*1024));
/* writel(data, ((__u32)__fpga + 0x0C)); */ /* This does not work */
*(volatile __u32*)((__u32)__fpga + 0x0C) = data; /* This works */
#############################################################
On Wed, 13 Oct 2004 00:03:21 +0100, Jon Masters [off-list ref] wrote:
On Tue, 12 Oct 2004 14:36:34 -0700, Eugene Surovegin [off-list ref] wrote:
quoted
Did you use ioremap to get valid kernel virtual address for your
device registers? You generally cannot just use physical address to
access device from the device driver.
Possibly also use io_block_mapping on ppc to map a block of IO memory
before ioremapping.
Jon.