> Date: Sun, 11 Mar 2012 12:29:44 +0530 > Subject: static I/O device mapping of UART for early prints & console > From: pcuser.mails@xxxxxxxxx > To: kernelnewbies@xxxxxxxxxxxxxxxxx > > 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) actually, this is io_virtual_address map to io_physical_address, it is not equal to kernel_virtual_adress map to kernel_physical_address. differenct platform providers such as Qualcomm, TI, STE, Samsung use different fomula to map IO address. for example, for OMAP1, TI use a very simple fomula to map from io_virtual_address to io_physical_address: io_virtual_address = io_physical_address-0x01000000 so suppose TI's uart0 physical address is 0xFFFB0000, then the virtial address of uart0 is 0xFEFB0000. for Samsung S3c64XX: 1. both physical and virtual address of uart is defined in map.h: #define S3C_PA_UART (0x7F005000) /* See notes on UART VA mapping in debug-macro.S */ #define S3C_VA_UARTx(x) (S3C_VA_UART + (S3C_PA_UART & 0xfffff) + ((x) * S3C_UART_OFFSET)) #define S3C_VA_UART0 S3C_VA_UARTx(0) #define S3C_VA_UART1 S3C_VA_UARTx(1) #def ine S3C_VA_UART2 S3C_VA_UARTx(2) #define S3C_VA_UART3 S3C_VA_UARTx(3) 2. so for uart0, the virtual address will be: virtual_uart0_address = S3C_VA_UART + (S3C_PA_UART & 0xfffff) and in map-base.h: #define S3C_ADDR_BASE (0xF4000000) #define S3C_VA_UART S3C_ADDR(0x01000000) /* UART */ so S3C_VA_UART = 0xF5000000 3. at last: virtual_uart0_address = S3C_VA_UART + (S3C_PA_UART & 0xfffff) = 0xF5000000 + (0x7F005000&0xfffff) = 0xF5005000 please do not try to use __phys_to_virt, this is for kernel virtual address to kernel physical address translation, rather than IO address map. |
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies