* problem with accessing memory mapped area
@ 2005-02-11 4:37 Vijay Padiyar
2005-02-11 13:27 ` Mark Chambers
0 siblings, 1 reply; 2+ messages in thread
From: Vijay Padiyar @ 2005-02-11 4:37 UTC (permalink / raw)
To: Embedded TUX, LinuxPPC Support
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: problem with accessing memory mapped area
2005-02-11 4:37 problem with accessing memory mapped area Vijay Padiyar
@ 2005-02-11 13:27 ` Mark Chambers
0 siblings, 0 replies; 2+ messages in thread
From: Mark Chambers @ 2005-02-11 13:27 UTC (permalink / raw)
To: Vijay Padiyar, LinuxPPC Support
> 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:
>
> 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.
>
If you are getting 'bus error' it sounds like the memory controller is not
set
up [correctly] for this address. Do you know if the bootloader is
configuring
the CPLD chip select correctly?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-02-11 13:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-11 4:37 problem with accessing memory mapped area Vijay Padiyar
2005-02-11 13:27 ` Mark Chambers
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).