]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
msm: Support DEBUG_LL on MSM8660 and MSM8960
authorStephen Boyd <sboyd@codeaurora.org>
Tue, 8 Nov 2011 18:33:04 +0000 (10:33 -0800)
committerDavid Brown <davidb@codeaurora.org>
Thu, 10 Nov 2011 18:17:06 +0000 (10:17 -0800)
Add support for DEBUG_LL on the 8660 and 8960 development boards.
While we're here cleanup the uncompress.h code a bit. Avoid
the use of readl/writel as those are Linux specific APIs that
aren't guaranteed to work in the decompressor.

Cc: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
arch/arm/Kconfig.debug
arch/arm/mach-msm/Kconfig
arch/arm/mach-msm/include/mach/debug-macro.S
arch/arm/mach-msm/include/mach/msm_iomap-8960.h
arch/arm/mach-msm/include/mach/msm_iomap-8x60.h
arch/arm/mach-msm/include/mach/uncompress.h
arch/arm/mach-msm/io.c

index 333b6a416d2fa4c618e93529839f7805b880703a..4c1eb7dd2a7ec933060252885465b49fe3791eba 100644 (file)
@@ -268,6 +268,22 @@ choice
                  Say Y here if you want the debug print routines to direct
                  their output to the third serial port on MSM devices.
 
+       config DEBUG_MSM8660_UART
+               bool "Kernel low-level debugging messages via MSM 8660 UART"
+               depends on ARCH_MSM8X60
+               select MSM_HAS_DEBUG_UART_HS
+               help
+                 Say Y here if you want the debug print routines to direct
+                 their output to the serial port on MSM 8660 devices.
+
+       config DEBUG_MSM8960_UART
+               bool "Kernel low-level debugging messages via MSM 8960 UART"
+               depends on ARCH_MSM8960
+               select MSM_HAS_DEBUG_UART_HS
+               help
+                 Say Y here if you want the debug print routines to direct
+                 their output to the serial port on MSM 8960 devices.
+
 endchoice
 
 config EARLY_PRINTK
index 5b07b6104e5d73ad1e76d7456299056640fb8791..000ddf0a4f33935c274504ce45516267b1ddfb5d 100644 (file)
@@ -60,6 +60,9 @@ config ARCH_MSM8960
 
 endchoice
 
+config MSM_HAS_DEBUG_UART_HS
+       bool
+
 config MSM_SOC_REV_A
        bool
 config  ARCH_MSM_SCORPIONMP
index db1f22830d645d6ca86e6fef2e01411ebdf60728..3ffd8668c9a5dae483613e8bcc59a98a4bc975a7 100644 (file)
@@ -1,6 +1,7 @@
 /*
  *
  * Copyright (C) 2007 Google, Inc.
+ * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
  * Author: Brian Swetland <swetland@google.com>
  *
  * This software is licensed under the terms of the GNU General Public
 #endif
        .endm
 
-       .macro  senduart,rd,rx
+       .macro  senduart, rd, rx
+#ifdef CONFIG_MSM_HAS_DEBUG_UART_HS
+       @ Write the 1 character to UARTDM_TF
+       str     \rd, [\rx, #0x70]
+#else
        teq     \rx, #0
        strne   \rd, [\rx, #0x0C]
+#endif
        .endm
 
-       .macro  waituart,rd,rx
+       .macro  waituart, rd, rx
+#ifdef CONFIG_MSM_HAS_DEBUG_UART_HS
+       @ check for TX_EMT in UARTDM_SR
+       ldr     \rd, [\rx, #0x08]
+       tst     \rd, #0x08
+       bne     1002f
+       @ wait for TXREADY in UARTDM_ISR
+1001:  ldr     \rd, [\rx, #0x14]
+       tst     \rd, #0x80
+       beq     1001b
+1002:
+       @ Clear TX_READY by writing to the UARTDM_CR register
+       mov     \rd, #0x300
+       str     \rd, [\rx, #0x10]
+       @ Write 0x1 to NCF register
+       mov     \rd, #0x1
+       str     \rd, [\rx, #0x40]
+       @ UARTDM reg. Read to induce delay
+       ldr     \rd, [\rx, #0x08]
+#else
        @ wait for TX_READY
 1001:  ldr     \rd, [\rx, #0x08]
        tst     \rd, #0x04
        beq     1001b
+#endif
        .endm
 
-       .macro  busyuart,rd,rx
+       .macro  busyuart, rd, rx
        .endm
index 3c9d9602a318b935ebb5e5a940df12fba6fdbeb6..800b55767e6b83ee7856692bf4e8fcf122df5863 100644 (file)
@@ -45,4 +45,9 @@
 #define MSM8960_TMR0_PHYS      0x0208A000
 #define MSM8960_TMR0_SIZE      SZ_4K
 
+#ifdef CONFIG_DEBUG_MSM8960_UART
+#define MSM_DEBUG_UART_BASE    0xE1040000
+#define MSM_DEBUG_UART_PHYS    0x16440000
+#endif
+
 #endif
index 3b19b8f244b8808d63489a1b92fc1851a38e0ffb..54e12caa8d860a99a4d6c4e11505e25a7d269d62 100644 (file)
@@ -62,4 +62,9 @@
 #define MSM8X60_TMR0_PHYS      0x02040000
 #define MSM8X60_TMR0_SIZE      SZ_4K
 
+#ifdef CONFIG_DEBUG_MSM8660_UART
+#define MSM_DEBUG_UART_BASE    0xE1040000
+#define MSM_DEBUG_UART_PHYS    0x19C40000
+#endif
+
 #endif
index d94292c29d8e27ed6a736a8bb24b7d8f640d3dd0..169a8400745659171efcfcefa6a4e55b9dbef060 100644 (file)
@@ -1,6 +1,6 @@
-/* arch/arm/mach-msm/include/mach/uncompress.h
- *
+/*
  * Copyright (C) 2007 Google, Inc.
+ * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
  */
 
 #ifndef __ASM_ARCH_MSM_UNCOMPRESS_H
+#define __ASM_ARCH_MSM_UNCOMPRESS_H
+
+#include <asm/processor.h>
+#include <mach/msm_iomap.h>
+
+#define UART_CSR      (*(volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x08))
+#define UART_TF       (*(volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x0c))
 
-#include "hardware.h"
-#include "linux/io.h"
-#include "mach/msm_iomap.h"
+#define UART_DM_SR    (*((volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x08)))
+#define UART_DM_CR    (*((volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x10)))
+#define UART_DM_ISR   (*((volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x14)))
+#define UART_DM_NCHAR (*((volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x40)))
+#define UART_DM_TF    (*((volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x70)))
 
 static void putc(int c)
 {
 #if defined(MSM_DEBUG_UART_PHYS)
-       unsigned base = MSM_DEBUG_UART_PHYS;
-       while (!(readl(base + 0x08) & 0x04)) ;
-       writel(c, base + 0x0c);
+#ifdef CONFIG_MSM_HAS_DEBUG_UART_HS
+       /*
+        * Wait for TX_READY to be set; but skip it if we have a
+        * TX underrun.
+        */
+       if (UART_DM_SR & 0x08)
+               while (!(UART_DM_ISR & 0x80))
+                       cpu_relax();
+
+       UART_DM_CR = 0x300;
+       UART_DM_NCHAR = 0x1;
+       UART_DM_TF = c;
+#else
+       while (!(UART_CSR & 0x04))
+               cpu_relax();
+       UART_TF = c;
+#endif
 #endif
 }
 
index 03036afe6266c7dbcce8716d8ceecf532b1c9105..578b04e42deb8cbc1d29fa66b75fb20c3a21ff43 100644 (file)
@@ -111,6 +111,9 @@ static struct map_desc msm8x60_io_desc[] __initdata = {
        MSM_CHIP_DEVICE(TMR0, MSM8X60),
        MSM_DEVICE(ACC),
        MSM_DEVICE(GCC),
+#ifdef CONFIG_DEBUG_MSM8660_UART
+       MSM_DEVICE(DEBUG_UART),
+#endif
 };
 
 void __init msm_map_msm8x60_io(void)
@@ -125,6 +128,9 @@ static struct map_desc msm8960_io_desc[] __initdata = {
        MSM_CHIP_DEVICE(QGIC_CPU, MSM8960),
        MSM_CHIP_DEVICE(TMR, MSM8960),
        MSM_CHIP_DEVICE(TMR0, MSM8960),
+#ifdef CONFIG_DEBUG_MSM8960_UART
+       MSM_DEVICE(DEBUG_UART),
+#endif
 };
 
 void __init msm_map_msm8960_io(void)