Hi Alexander,
Digging books and tutorials I finally did it.
0x1200_0000 is a reserved memory space and can't be accessed
directly. We have to remap that region to a random memory space area
via kernel functions to do so. I'll post the snippet of the code to do
that below:
#define GPIOCR 0x12000000UL
function()
{
unsigned long gpiocr = 0, gpiocr1, gpiocr2, gpiocr3;
volatile char *ptr;
printk("DUMB: modulo adicionando\n");
if(check_mem_region(GPIOCR, 4)) {
printk("DUMB: espaco de memoria em uso: GPIOCR\n");
return -EBUSY;
}
request_mem_region(GPIOCR, 4, "dumb_driver");
ptr = __ioremap(GPIOCR, 4, 0);
printk("dumb: ptr remap = %p\n", ptr);
#define GPIOCREG0 ((volatile char *)(ptr))
#define GPIOCREG1 ((volatile char *)(ptr+1))
#define GPIOCREG2 ((volatile char *)(ptr+2))
#define GPIOCREG3 ((volatile char *)(ptr+3))
gpiocr = readb(GPIOCREG0);
gpiocr1 = readb(GPIOCREG1);
gpiocr2 = readb(GPIOCREG2);
gpiocr3 = readb(GPIOCREG3);
release_mem_region(GPIOCR, 4);
printk("DUMB: lido CR 0x%lx 0x%lx 0x%lx 0x%lx\n", gpiocr,
gpiocr1, gpiocr2, gpiocr3);
...
}
Hope that helps you.
--- In Alexander Clouter <> wrote:
>
> Hi,
>
> basement_mobile2004 <> [20080313 13:41:06 -0000]:
> >
> > I'm trying to access DIO registers from kernel space but it
> > redirects the address to upper addresses.
> >
> > [snipped]
> >
> > Result:
> > Unable to handle kernel paging request at virtual address 72000000
> > pgd = c511c000
> > [72000000] *pgd=00000000, *pmd = 00000000
> >
> don't get excited, I'm curious about the answer to this too. I have
no idea
> about physical and virtual memory; however I would have expected the
macros
> __phys_to_virt() and __virt_to_phys() to have helped me.
>
> Once I know this secret, the regular rtc-m48t86.c driver in the
linux kernel
> will work along with (hopefully) the orion_nand.c MTD driver.
>
> A plea to the Clued(tm) out there....pointers please. :)
>
> Cheers
>
> Alex
>
> --
> ________________________________________
> / To err is human. To blame someone else \
> \ for your mistakes is even more human. /
> ----------------------------------------
> \ ^__^
> \ (oo)\_______
> (__)\ )\/\
> ||----w |
> || ||
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|