static I/O device mapping of UART for early prints & console

pcuser p pcuser.mails at gmail.com
Sun Mar 11 01:59:44 EST 2012


I'm doing kernel porting to arm926 based FPGA board (similar to
samsung-s3c6410 board). I'm trying to setup UART for early print and
console.
I gone through some reference boards(samsung-s3c6410) for setting up
uart for early print & console.

I can't trace the virtual mapping for UART registers in "adduart"
macro in "debug-macro.S" file

.macro addruart, rp, rv
 ldr     \rp, = S3C_PA_UART
 ldr     \rv, = S3C_VA_UART


Basically,I want to know how to calculate this virtual
address(S3C_VA_UART)  from the physical address(S3C_PA_UART)

Below are the details

#define PLAT_PHYS_OFFSET       0x50000000 (with 256 MB SDRAM)
#define CONFIG_PAGE_OFFSET  0xc0000000

#define S3C_ADDR_BASE   0xF6000000 (virtual address for device registers)
#define S3C_VA_UART       (S3C_ADDR_BASE + (0x01000000) )

#define S3C_PA_UART  0x7F005000 (UART - Physical address)
#define S3C_VA_UART  0xF7000000 (UART virtual address = 0xF6000000  +
0x01000000)


I tried to calculate the virtual address by using " __phys_to_virt(x)" macro.

#define __phys_to_virt(x)     ((x) - PHYS_OFFSET + PAGE_OFFSET)
from the above macro, I expect
__phys_to_virt(S3C_PA_UART) = S3C_VA_UART = 0xF7000000

but if i do calc,
0x7F005000 - 0x50000000 + 0xc0000000 = 0xef005000
which is not correct.
I think, i'm not using the correct macro for getting the virtual
address for UART.

can someone suggest how to do this calculation for getting proper
virtual address for UART for the above configuration.


Thanks,
pcuser



More information about the Kernelnewbies mailing list