Thanks for your answer, unfortunately it doesn't work. I'm doing this :<br><br>static unsigned int *virtual_base = 0;<br>static unsigned long mem_addr = 0x70001e00;<br>static unsigned long mem_size = 0x100;<br>static unsigned int reg3 = 0;<br>
<br>static int __init gpio_init(void) {<br><br> printk("<1>gpio: init_module\n");<br> if(check_mem_region(mem_addr,mem_size))<br> {<br> printk("gpio: memory already in use\n");<br>
return -EBUSY;<br> }<br> // request memory for the device<br> request_mem_region(mem_addr,mem_size,"gpio");<br> // remap<br> virtual_base = ioremap_nocache(mem_addr,mem_size);<br> printk("ioremap: Virtual Address %08x\n",(unsigned int)virtual_base);<br>
printk("Physical Address %08x\n",(unsigned int)virt_to_phys(virtual_base));<br> if( virtual_base==0 )<br> {<br> printk("ioremap failed\n");<br> return -EBUSY ;<br> }<br> else<br>
{<br> reg3 = XIo_Out32(virtual_base);<br> printk("Result of GPIO_DATA = %08x\n",reg3) ;<br> reg3 = XIo_Out32(virtual_base+4);<br> printk("Result of GPIO_TRI = %08x\n",reg3) ;<br>
<br> printk("Xio_Out32\n");<br> XIo_Out32(virtual_base, 0x00);<br> }<br> return 0;<br>}<br><br>the result is : <br><br>gpio: init_module<br>ioremap: Virtual Address c500ee00<br>Physical Address 0500ee00<br>
Xio_Out32<br><br>The LEDs stay ON. I find strange having physical address different from the physical adress I wanted to map. Can I have a problem with my MMU ? As other devices are working, I am not sure it's the MMU for exemple during boot : eth0: Xilinx 10/100 EMAC at 0x80400000 mapped to 0xC5020000, irq=1 and Ethernet is working so the MMU seems to be ok.<br>
<br><br>Thanks<br><br>Ludovic Desroches<br><br><br><div class="gmail_quote">2008/6/3 A. Nolson <<a href="mailto:alohanono@gmail.com">alohanono@gmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I have recently developed a similar driver for that. Your IO memory remapping should look like similar to this in your module_init:<br>
<br>
-------<br>
<br>
if ( (lcd_remap_address = (u32) ioremap(LCD_BASE, LCD_END - LCD_BASE +1 )) == 0) {<br>
printk(KERN_ERR "Couldn't ioremap memory at 0x%08lX\n",<br>
(unsigned long) LCD_BASE);<br>
return -EFAULT; }<br>
// Configure the IO as outputs<br>
XIo_Out32(lcd_remap_address + 0x4,0x00); <br>
------- <br>
/A<br>
<br>
Ludovic Desroches wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">
<br>
Hi,<br>
<br>
<br>
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.<br>
<br>
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.<br>
<br>
<br>
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 ?<br>
<br>
I have tried with this for example but without success :<br>
<br>
ptr = ioremap_nocache(0x70001e00,0x00000004);<br>
printk("GPIO_DATA (readl): %u\n",readl(ptr));<br>
<br>
<br>
readl, outl, ioread32 : same result.<br>
<br>
<br>
Thanks<br>
<br>
<br>
Best Regards<br>
<br>
<br>
-- <br>
Ludovic Desroches<br>
Ingénieur ESIEE 2008<br>
mobile : 06 19 21 02 08<br>
<a href="http://www.odulo.net" target="_blank">http://www.odulo.net</a><br></div></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Linuxppc-embedded mailing list<br>
<a href="mailto:Linuxppc-embedded@ozlabs.org" target="_blank">Linuxppc-embedded@ozlabs.org</a><br>
<a href="https://ozlabs.org/mailman/listinfo/linuxppc-embedded" target="_blank">https://ozlabs.org/mailman/listinfo/linuxppc-embedded</a><br>
</blockquote>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Ludovic Desroches<br>Ingénieur ESIEE 2008<br>mobile : 06 19 21 02 08<br><a href="http://www.odulo.net">http://www.odulo.net</a>