I am using "ioremap" to map the address of a GPIO port in the datasheet of Ti AM3359 . The code is running fine.
Problem:
1> The problem is , why do we need to map the virtual address to physical address? Is it because physical address is the real address of the hardware that we want to access?
2> If above is true then, why don't the datasheets directly give the physical address .
3> Is the physical address returned by "ioremap" would be different in different Boards with different amount of RAM?
As for your first question, the reason you use
ioremap
is because the kernel's address space does not correspond to the physical address space. You need to map the physical pages into the virtual address space to be able to address them at all. This is whatioremap
does.As for your second and third questions, I wouldn't know what your datasheets give or do not give. :)
Normally, I would expect hardware datasheets to give physical addresses, unless it is that the physical address must be either found out or configured via bus-specific mechanisms. What is it that yours actually specify, if not that?
You may want to read this for further information.