Problem using SA-1100 GPIO registers
I'm having some serious trouble using my GPIO pin registers on my intel SA-1100 device, from kernel space ofc..
I want to map the physical addresses to some usable ones using ioremap and then use write32 and read32 to write and read them. Should be simple.. But is this the easiest way?
For reference, the devmanual of the SA-1100 can be found here: HERE
Here is the code I have:
#define GPIO_BASE 0x90040000
#define GPIO_LENGTH 0xFFF
static void *io_base, *GPLR, *GPDR, *GPSR, *GPCR;
io_base = ioremap(GPIO_BASE, GPIO_LENGTH);
GPLR = io_base;
GPDR = io_base + 0x04;
GPSR = io_base + 0x08;
GPCR = io_base + 0x0C;
printk("io ports remapped %p\n ", GPLR);
Now I should be able to read the pins using:
But this is returning the incorrect values.. (not dependent on what i write) Somehow I have the feeling that I didn't map the correct address. The address returned by ioremap is ca000000 but that shouldn't say anything right? What am I not seeing? Or am I not using the right methods?
Any help is greatly appreciated.
Using ioremap to access GPIO in kernel space is fine. The issue is GPIO_BASE define. Is it correct physical address?
Perhaps the value of GPIO_BASE is already mapped or some mapped address space already covers it? Have you tried reading directly on the GPIO_BASE address?
Yes, since GPIO_BASE = GPLR. But the matter has just been solved using register shortcuts i found in hardware.h ... so much effort for nothing.
But thanks for the advice!
|All times are GMT -5. The time now is 05:44 PM.|