James Leung

UART's register read/write

Discussion created by James Leung on Mar 22, 2012

Hi i.mx experts,

 

I am trying create a hardware driver module for linux kernel. The hardware is connecting to the i.mx28 through UART, therefore I am trying to access the UART register directly through iowrite(). However I found that I can never write to the register address. Below is code I am using:


release_mem_region(UARTBASE_PA, 145); 
if(request_mem_region(UARTBASE_PA, 145, "myserial") ==NULL){ 
 printk("iomem request refused\n"); 
} else 
 UARTBASE =(u32) ioremap_nocache((u32) UARTBASE_PA, 145); 
iowrite32((u32) 0x100,(u32) (UARTBASE+0x20)); 
x=ioread32(UARTBASE+0x20); 
printk("%x\ \n", x);



Where the ioread() output always is the default value instead of the one I write to it.

I have no idea how to solve this problem, please help, any idea will be helpful.

Thank you in advance!

James


Outcomes