Hi Cyril,

On Fri, Apr 23, 2010 at 23:26:52, Chemparathy, Cyril wrote:
> This patch adopts a debug uart selection similar to the OMAP model.  During
> the boot process, the uncompress code determines the physical and virtual base
> addresses of the board-specific debug uart.  These addresses are then passed
> on to the in-kernel debug macros through a small chunk of memory placed just
> below the page tables (@0x80003ff8).

Thanks! Looks much better than the ifdefry being used currently.
Some comments below.

>
> Signed-off-by: Cyril Chemparathy <[email protected]>
> Tested-by: Sandeep Paulraj <[email protected]>
> ---
> v4: unchanged from v3
>
>  arch/arm/mach-davinci/include/mach/debug-macro.S |   51 +++++++++++---
>  arch/arm/mach-davinci/include/mach/serial.h      |   13 ++++
>  arch/arm/mach-davinci/include/mach/uncompress.h  |   80 
> ++++++++++++++++------
>  3 files changed, 112 insertions(+), 32 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/include/mach/debug-macro.S 
> b/arch/arm/mach-davinci/include/mach/debug-macro.S
> index 3cd93a8..ac0fa02 100644
> --- a/arch/arm/mach-davinci/include/mach/debug-macro.S
> +++ b/arch/arm/mach-davinci/include/mach/debug-macro.S
> @@ -17,22 +17,51 @@
>   */
>
>  #include <linux/serial_reg.h>
> +
> +#include <asm/memory.h>
> +
> +#include <mach/serial.h>
> +
>  #define UART_SHIFT   2
>
> +             .pushsection .data
> +davinci_uart_phys:   .word   0
> +davinci_uart_virt:   .word   0
> +             .popsection
> +
>               .macro addruart, rx, tmp
> +
> +             /* Use davinci_uart_phys/virt if already configured */
> +10:          mrc     p15, 0, \rx, c1, c0
> +             tst     \rx, #1                 @ MMU enabled?
> +             ldreq   \rx, =__virt_to_phys(davinci_uart_phys)
> +             ldrne   \rx, =davinci_uart_virt
> +             ldr     \rx, [\rx]
> +             cmp     \rx, #0                 @ is port configured?
> +             bne     99f                     @ already configured
> +
> +             /* Copy uart phys address from decompressor uart info */
>               mrc     p15, 0, \rx, c1, c0
>               tst     \rx, #1                 @ MMU enabled?
> -             moveq   \rx, #0x01000000        @ physical base address
> -             movne   \rx, #0xfe000000        @ virtual base
> -#if defined(CONFIG_ARCH_DAVINCI_DA8XX) && defined(CONFIG_ARCH_DAVINCI_DMx)
> -#error Cannot enable DaVinci and DA8XX platforms concurrently
> -#elif defined(CONFIG_MACH_DAVINCI_DA830_EVM) || \
> -     defined(CONFIG_MACH_DAVINCI_DA850_EVM)
> -             orr     \rx, \rx, #0x00d00000   @ physical base address
> -             orr     \rx, \rx, #0x0000d000   @ of UART 2
> -#else
> -             orr     \rx, \rx, #0x00c20000   @ UART 0
> -#endif
> +             ldreq   \tmp, =__virt_to_phys(davinci_uart_phys)
> +             ldrne   \tmp, =davinci_uart_phys
> +             ldreq   \rx, =DAVINCI_UART_INFO
> +             ldrne   \rx, =__phys_to_virt(DAVINCI_UART_INFO)
> +             ldr     \rx, [\rx, #0]
> +             str     \rx, [\tmp]
> +
> +             /* Copy uart virt address from decompressor uart info */
> +             mrc     p15, 0, \rx, c1, c0
> +             tst     \rx, #1                 @ MMU enabled?
> +             ldreq   \tmp, =__virt_to_phys(davinci_uart_virt)
> +             ldrne   \tmp, =davinci_uart_virt
> +             ldreq   \rx, =DAVINCI_UART_INFO
> +             ldrne   \rx, =__phys_to_virt(DAVINCI_UART_INFO)
> +             ldr     \rx, [\rx, #4]
> +             str     \rx, [\tmp]

You should be able to combine the code chunks into
one by using ldr/str{cond} to configure either the
virtual or physical base depending on whether MMU
is enabled on not. No need to configure both at the
same time.

Also please consider using a temporary variable to
store the result of the first mrc call.

Thanks,
Sekhar
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to