cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
5,469 Views
Registered: ‎03-03-2008

How accessing to my IP registers from Linux

Hi,

 

I have put xilinx kernel on my board : a memec FX12 based on a Virtex 4 FX. Everything thing is OK, I have my serial console, Ethernet is also OK.

I have to make some drivers. For example one for the LCD screen. It is my first driver so I want to try with something easier like LEDs. I know there is a driver from Xilinx but I want to do it by myself. Moreover it is only a file to adapt Xilinx standelone driver for Kernel.

 

I try to read and to write the registers of my GPIO IP which is working, I have made some tests in standelone. How accessing to these registers ?

I have tried with this for example but without success :

ptr = ioremap_nocache(0x70001e00,0x00000004);
printk("GPIO_DATA (readl): %u\n",readl(ptr));

 

readl, outl, ioread32 : same result.

 

Thanks

 

Best Regards

 

Ludovic Desroches

0 Kudos
1 Reply
Highlighted
Visitor
Visitor
5,440 Views
Registered: ‎03-03-2008

I think I know where is the problem. The mapping of physical address seems to be wrong


   static unsigned int *virtual_base = 0;
   static unsigned long mem_addr = 0x70001e00;
   static unsigned long mem_size = 0x100;

    // request memory for the device
    request_mem_region(mem_addr,mem_size,"gpio");

    // remap
    virtual_base = ioremap_nocache(mem_addr,mem_size);
    printk("ioremap: Virtual Address %08x\n",(unsigned int)virtual_base);
    printk("Physical Address %08x\n",(unsigned int)virt_to_phys(virtual_base));


it gives :

ioremap: Virtual Address c500ee00
Physical Address 0500ee00
 
so I probably don't read or write at the good address

 

0 Kudos