Skip to contentSkip to conversation

ARM: brcmstb: Add earlyprintk support using run-time checks

PATCH Applied Florian Fainelli 1 participant 2 messages Jul 11, 2016 – Jul 20, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: brcmstb: Add earlyprintk support using run-time checks

The SUN_TOP_CTRL_FAMILY_ID register is at a fixed absolute address for all of our supported chips, so utilize its value to determine what the UARTA base address should be based on the value we read.

Since the code is called both during decompressor when the MMU is off, and after the MMU has been turned on in the kernel, and we want to do the lookup only once, we use the same technique as tegra.S and have a shared storage location between the decompressor and the kernel.

---
Changes in v2:

- improved help text to explain how this works
- updated the comment about adding a 16MB bitmask to the UART virtual register
- added missing !DEBUG_BRCMSTB_UART for DEBUG_UNCOMPRESS

 arch/arm/Kconfig.debug           |  14 ++--
 arch/arm/include/debug/brcmstb.S | 145 +++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-bcm/brcmstb.c      |  16 +++++
 3 files changed, 168 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/include/debug/brcmstb.S
arch/arm/Kconfig.debug +7 -7
index 19a3dcf5eb2e..293aef4b8e08 100644
@@ -168,10 +168,11 @@ choice
 	config DEBUG_BRCMSTB_UART
 		bool "Use BRCMSTB UART for low-level debug"
 		depends on ARCH_BRCMSTB
-		select DEBUG_UART_8250
 		help
 		  Say Y here if you want the debug print routines to direct
-		  their output to the first serial port on these devices.
+		  their output to the first serial port on these devices. The
+		  UART physical and virtual address is automatically provided
+		  based on the chip identification register value.
 
 		  If you have a Broadcom STB chip and would like early print
 		  messages to appear over the UART, select this option.
@@ -1408,6 +1409,7 @@ config DEBUG_LL_INCLUDE
 	default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1
 	default "debug/bcm63xx.S" if DEBUG_BCM63XX_UART
 	default "debug/digicolor.S" if DEBUG_DIGICOLOR_UA0
+	default "debug/brcmstb.S" if DEBUG_BRCMSTB_UART
 	default "mach/debug-macro.S"
 
 # Compatibility options for PL01x
@@ -1498,7 +1500,6 @@ config DEBUG_UART_PHYS
 	default 0xe6e60000 if DEBUG_RCAR_GEN2_SCIF0
 	default 0xe8008000 if DEBUG_R7S72100_SCIF2
 	default 0xf0000be0 if ARCH_EBSA110
-	default 0xf040ab00 if DEBUG_BRCMSTB_UART
 	default 0xf1012000 if DEBUG_MVEBU_UART0_ALTERNATE
 	default 0xf1012100 if DEBUG_MVEBU_UART1_ALTERNATE
 	default 0xf7fc9000 if DEBUG_BERLIN_UART
@@ -1574,7 +1575,6 @@ config DEBUG_UART_VIRT
 	default 0xfb002000 if DEBUG_CNS3XXX
 	default 0xfb009000 if DEBUG_REALVIEW_STD_PORT
 	default 0xfb10c000 if DEBUG_REALVIEW_PB1176_PORT
-	default 0xfc40ab00 if DEBUG_BRCMSTB_UART
 	default 0xfc705000 if DEBUG_ZTE_ZX
 	default 0xfcfe8600 if DEBUG_BCM63XX_UART
 	default 0xfd000000 if DEBUG_SPEAR3XX || DEBUG_SPEAR13XX
@@ -1646,8 +1646,7 @@ config DEBUG_UART_8250_WORD
 		DEBUG_ALPINE_UART0 || \
 		DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \
 		DEBUG_DAVINCI_DA8XX_UART2 || \
-		DEBUG_BCM_KONA_UART || DEBUG_RK32_UART2 || \
-		DEBUG_BRCMSTB_UART
+		DEBUG_BCM_KONA_UART || DEBUG_RK32_UART2
 
 config DEBUG_UART_8250_PALMCHIP
 	bool "8250 UART is Palmchip BK-310x"
@@ -1666,7 +1665,8 @@ config DEBUG_UNCOMPRESS
 	bool
 	depends on ARCH_MULTIPLATFORM || PLAT_SAMSUNG || ARM_SINGLE_ARMV7M
 	default y if DEBUG_LL && !DEBUG_OMAP2PLUS_UART && \
-		     (!DEBUG_TEGRA_UART || !ZBOOT_ROM)
+		     (!DEBUG_TEGRA_UART || !ZBOOT_ROM) && \
+		     !DEBUG_BRCMSTB_UART
 	help
 	  This option influences the normal decompressor output for
 	  multiplatform kernels.  Normally, multiplatform kernels disable
arch/arm/include/debug/brcmstb.S new file +145 -0

145 lines not on this page · raw message

arch/arm/mach-bcm/brcmstb.c +16 -0
index 99a67cfb7c0d..07e3a86c6466 100644
@@ -19,6 +19,22 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
+/*
+ * Storage for debug-macro.S's state.
+ *
+ * This must be in .data not .bss so that it gets initialized each time the
+ * kernel is loaded. The data is declared here rather than debug-macro.S so
+ * that multiple inclusions of debug-macro.S point at the same data.
+ */
+u32 brcmstb_uart_config[3] = {
+	/* Debug UART initialization required */
+	1,
+	/* Debug UART physical address */
+	0,
+	/* Debug UART virtual address */
+	0,
+};
+
 static void __init brcmstb_init_irq(void)
 {
 	irqchip_init();
Signature · 1 line
2.7.4
author Applied
#1 lore raw
Quoted 10 lines · Florian Fainelli

The SUN_TOP_CTRL_FAMILY_ID register is at a fixed absolute address for all of our supported chips, so utilize its value to determine what the UARTA base address should be based on the value we read.

Since the code is called both during decompressor when the MMU is off, and after the MMU has been turned on in the kernel, and we want to do the lookup only once, we use the same technique as tegra.S and have a shared storage location between the decompressor and the kernel.

Applied to soc/next.

Signature · 1 line
Florian