problem with accessing memory mapped area
Vijay Padiyar
vijay_padiyar at hotmail.com
Fri Feb 11 15:37:53 EST 2005
Hi there
I'm running a Linux 2.6.10 kernel with BusyBox 1.0 on an MPC8260 platform.
My board's memory map is as follows:
SDRAM: 0x00000000 - 0x07FFFFFF (128 MB)
FLASH: 0xFE000000 - 0xFFFFFFFF (32 MB)
In addition, in the address range 0x30000000-0x300000FF, I have a CPLD
mapped.
Now, I wish to access the registers of this CPLD. For this, I create a
module and insert it into the kernel. Now, in my 'init_module' function, I
map the address range 0x30000000-0x300000FF to cpld_mem:
unsigned char *cpld_mem;
int init_module(void)
{
...
...
cpld_mem = (unsigned char *) ioremap (0x30000000, 0x100);
}
Let's say my file operation functions are device_open, device_release,
device_read, device_write and device_ioctl.
Now, I wish to write to the address 0x30000014. In device_write, I do the
following:
ssize_t device_write(...)
{
...
printk(KERN_DEBUG "Writing to CPLD");
outb(0x00, cpldMem + 0x14);
}
But when I execute this program on the target, it crashes after displaying
"Writing to CPLD". Sometimes it says 'Bus error' and some other times I get
a 'Kernel panic' message and the system reboots.
Where could I be going wrong? I tried with 'writeb()' as well. It gave the
same results. :-( Am I making some obvious silly mistakes?
Regards
Vijay Padiyar
http://www.vijaypadiyar.eu.tf
More information about the Linuxppc-embedded
mailing list