This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ioremap() issues in Linux 2.6.37



Hi,

I am using DM365 hardware with Linux 2.6.37 kernel. I want to write to VPBE registers of DM365.

I did a ioremap(). It returned me  a chunk of address. To this address I am trying to write and trying to read it back. Write is successful, but read back is not giving me the expectd values. Plese find the chunk of code I used below.

void __iomem *test;
test = ioremap(0xZZZZ,0x4);
((unsigned int *)test)[0] = 0xA;                   
printk("ov9712_ravi:  val =0x%x \n",((unsigned int *)test)[0]);
iounmap(test);

Above piece of code my write and read are successful. I m wring oxA and able to read back 0xA.

But immediately after this, I did below ioremap of same address.

test = ioremap(0xZZZZ,0x4);
printk("ov9712_ravi:  val =0x%x \n",((unsigned int *)test)[0]);
iounmap(test);

Now I expect value to be 0xA since address is same. But it reads "0".

I tried this with about more than 50 addresses. & behavior is same throughout. 

Thanks.

  • Hi,

    First of all are you using the valid physical address for ioremap() ?

    Instead of ((unsigned int *)test)[0] = 0xA;  ,use the IO functions like readb/writeb

    Also check the return values of ioremap. you can also try ioremap_nocache().

    Regards,

    --Prabhakar Lad

    http://in.linkedin.com/in/prabhakarlad