linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Support uncompress debug message for multiplatform build
@ 2012-12-12 13:45 Shawn Guo
  2012-12-12 13:45 ` [PATCH 1/4] ARM: imx: use separated debug uart symbol for imx31 and imx35 Shawn Guo
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Shawn Guo @ 2012-12-12 13:45 UTC (permalink / raw)
  To: linux-arm-kernel

After moving i.MX to multiplatform build, I hear people complaining
that it's bad to lose the uncompress debug message, because not only
does it mean that we will never see message "Uncompressing Linux...
done, booting the kernel.", but also that the debug facility in
arch/arm/boot/compressed/head.S outputs nothing even DEBUG is turned on.

The series follows the approach handling DEBUG_LL to create a Kconfig
symbol CONFIG_UNCOMPRESS_INCLUDE for choosing the correct uncompress
header.  For traditional build, mach/uncompress.h will be included in
arch/arm/boot/compressed/misc.c, and nothing changes than before. For
multiplatform build with none DEBUG_LL port enabled, a set of empty
functions defined in debug/uncompress/dummy.h will be used.  And for
multiplatform build with a DEBUG_LL port, platform specific
uncompress header like debug/uncompress/imx.h will come to play.

Different from traditional build that uncompress output and DEBUG_LL
are two separate pieces, for multiplatform build uncompress output
becomes a subset of DEBUG_LL and relies on DEBUG_LL to select the uart
port, so it only works when DEBUG_LL is enabled.  I think it's an
acceptable compromise to have the uncompress debug facility back.

Shawn Guo (4):
  ARM: imx: use separated debug uart symbol for imx31 and imx35
  ARM: imx: support DEBUG_LL uart port selection for all i.MX SoCs
  ARM: imx: restore uncompress.h to a common place
  ARM: uncompress: support uncompress debug for multiplatform build

 arch/arm/Kconfig.debug                    |   44 ++++++++++++---
 arch/arm/boot/compressed/misc.c           |    8 +--
 arch/arm/include/debug/imx-uart.h         |   88 +++++++++++++++++++++++++++++
 arch/arm/include/debug/imx.S              |   29 +---------
 arch/arm/include/debug/uncompress/dummy.h |    3 +
 arch/arm/include/debug/uncompress/imx.h   |   63 +++++++++++++++++++++
 6 files changed, 191 insertions(+), 44 deletions(-)
 create mode 100644 arch/arm/include/debug/imx-uart.h
 create mode 100644 arch/arm/include/debug/uncompress/dummy.h
 create mode 100644 arch/arm/include/debug/uncompress/imx.h

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/4] ARM: imx: use separated debug uart symbol for imx31 and imx35
  2012-12-12 13:45 [PATCH 0/4] Support uncompress debug message for multiplatform build Shawn Guo
@ 2012-12-12 13:45 ` Shawn Guo
  2012-12-12 13:45 ` [PATCH 2/4] ARM: imx: support DEBUG_LL uart port selection for all i.MX SoCs Shawn Guo
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Shawn Guo @ 2012-12-12 13:45 UTC (permalink / raw)
  To: linux-arm-kernel

It's improper to use combined symbol DEBUG_IMX31_IMX35_UART for
imx31 and imx35, because imx31 has 5 UARTs while imx35 only has 3.
So later when we add UART port selection for DEBUG_IMX31_IMX35_UART,
we will have problem.

Use separated Kconfig options for imx31 and imx35 debug uart selection.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/Kconfig.debug |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 661030d..ae2ee04 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -205,12 +205,19 @@ choice
 		  Say Y here if you want kernel low-level debugging support
 		  on i.MX28.
 
-	config DEBUG_IMX31_IMX35_UART
-		bool "i.MX31 and i.MX35 Debug UART"
-		depends on SOC_IMX31 || SOC_IMX35
+	config DEBUG_IMX31_UART
+		bool "i.MX31 Debug UART"
+		depends on SOC_IMX31
 		help
 		  Say Y here if you want kernel low-level debugging support
-		  on i.MX31 or i.MX35.
+		  on i.MX31.
+
+	config DEBUG_IMX35_UART
+		bool "i.MX35 Debug UART"
+		depends on SOC_IMX35
+		help
+		  Say Y here if you want kernel low-level debugging support
+		  on i.MX35.
 
 	config DEBUG_IMX51_UART
 		bool "i.MX51 Debug UART"
@@ -495,7 +502,8 @@ config DEBUG_LL_INCLUDE
 	default "debug/imx.S" if DEBUG_IMX1_UART || \
 				 DEBUG_IMX25_UART || \
 				 DEBUG_IMX21_IMX27_UART || \
-				 DEBUG_IMX31_IMX35_UART || \
+				 DEBUG_IMX31_UART || \
+				 DEBUG_IMX35_UART || \
 				 DEBUG_IMX51_UART || \
 				 DEBUG_IMX50_IMX53_UART ||\
 				 DEBUG_IMX6Q_UART
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/4] ARM: imx: support DEBUG_LL uart port selection for all i.MX SoCs
  2012-12-12 13:45 [PATCH 0/4] Support uncompress debug message for multiplatform build Shawn Guo
  2012-12-12 13:45 ` [PATCH 1/4] ARM: imx: use separated debug uart symbol for imx31 and imx35 Shawn Guo
@ 2012-12-12 13:45 ` Shawn Guo
  2013-03-12 14:35   ` Karl Beldan
  2012-12-12 13:45 ` [PATCH 3/4] ARM: imx: restore uncompress.h to a common place Shawn Guo
  2012-12-12 13:45 ` [PATCH 4/4] ARM: uncompress: support uncompress debug for multiplatform build Shawn Guo
  3 siblings, 1 reply; 14+ messages in thread
From: Shawn Guo @ 2012-12-12 13:45 UTC (permalink / raw)
  To: linux-arm-kernel

Extend imx6q DEBUG_LL uart port selection support to cover all i.MX
SoCs.  The 'range' of the Kconfig option gets dropped, as users
looking at the option must know the uart number on his board.  The
bottom line is that the build system will report an error if an
invalid port number is picked for given SoC.

The header arch/arm/include/debug/imx-uart.h is created to accommodate
all the uart base addresses.  And the header will also be used for
other low-level debug facility later.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/Kconfig.debug            |   13 ++++--
 arch/arm/include/debug/imx-uart.h |   88 +++++++++++++++++++++++++++++++++++++
 arch/arm/include/debug/imx.S      |   29 +-----------
 3 files changed, 98 insertions(+), 32 deletions(-)
 create mode 100644 arch/arm/include/debug/imx-uart.h

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index ae2ee04..05f83c8 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -457,11 +457,16 @@ choice
 
 endchoice
 
-config DEBUG_IMX6Q_UART_PORT
-	int "i.MX6Q Debug UART Port (1-5)" if DEBUG_IMX6Q_UART
-	range 1 5
+config DEBUG_IMX_UART_PORT
+	int "i.MX Debug UART Port Selection" if DEBUG_IMX1_UART || \
+						DEBUG_IMX25_UART || \
+						DEBUG_IMX21_IMX27_UART || \
+						DEBUG_IMX31_UART || \
+						DEBUG_IMX35_UART || \
+						DEBUG_IMX51_UART || \
+						DEBUG_IMX50_IMX53_UART || \
+						DEBUG_IMX6Q_UART
 	default 1
-	depends on SOC_IMX6Q
 	help
 	  Choose UART port on which kernel low-level debug messages
 	  should be output.
diff --git a/arch/arm/include/debug/imx-uart.h b/arch/arm/include/debug/imx-uart.h
new file mode 100644
index 0000000..a51b727
--- /dev/null
+++ b/arch/arm/include/debug/imx-uart.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __DEBUG_IMX_UART_H
+#define __DEBUG_IMX_UART_H
+
+#define IMX1_UART1_BASE_ADDR	0x00206000
+#define IMX1_UART2_BASE_ADDR	0x00207000
+#define IMX1_UART_BASE_ADDR(n)	IMX1_UART##n##_BASE_ADDR
+#define IMX1_UART_BASE(n)	IMX1_UART_BASE_ADDR(n)
+
+#define IMX21_UART1_BASE_ADDR	0x1000a000
+#define IMX21_UART2_BASE_ADDR	0x1000b000
+#define IMX21_UART3_BASE_ADDR	0x1000c000
+#define IMX21_UART4_BASE_ADDR	0x1000d000
+#define IMX21_UART_BASE_ADDR(n)	IMX21_UART##n##_BASE_ADDR
+#define IMX21_UART_BASE(n)	IMX21_UART_BASE_ADDR(n)
+
+#define IMX25_UART1_BASE_ADDR	0x43f90000
+#define IMX25_UART2_BASE_ADDR	0x43f94000
+#define IMX25_UART3_BASE_ADDR	0x5000c000
+#define IMX25_UART4_BASE_ADDR	0x50008000
+#define IMX25_UART5_BASE_ADDR	0x5002c000
+#define IMX25_UART_BASE_ADDR(n)	IMX25_UART##n##_BASE_ADDR
+#define IMX25_UART_BASE(n)	IMX25_UART_BASE_ADDR(n)
+
+#define IMX31_UART1_BASE_ADDR	0x43f90000
+#define IMX31_UART2_BASE_ADDR	0x43f94000
+#define IMX31_UART3_BASE_ADDR	0x5000c000
+#define IMX31_UART4_BASE_ADDR	0x43fb0000
+#define IMX31_UART5_BASE_ADDR	0x43fb4000
+#define IMX31_UART_BASE_ADDR(n)	IMX31_UART##n##_BASE_ADDR
+#define IMX31_UART_BASE(n)	IMX31_UART_BASE_ADDR(n)
+
+#define IMX35_UART1_BASE_ADDR	0x43f90000
+#define IMX35_UART2_BASE_ADDR	0x43f94000
+#define IMX35_UART3_BASE_ADDR	0x5000c000
+#define IMX35_UART_BASE_ADDR(n)	IMX35_UART##n##_BASE_ADDR
+#define IMX35_UART_BASE(n)	IMX35_UART_BASE_ADDR(n)
+
+#define IMX51_UART1_BASE_ADDR	0x73fbc000
+#define IMX51_UART2_BASE_ADDR	0x73fc0000
+#define IMX51_UART3_BASE_ADDR	0x7000c000
+#define IMX51_UART_BASE_ADDR(n)	IMX51_UART##n##_BASE_ADDR
+#define IMX51_UART_BASE(n)	IMX51_UART_BASE_ADDR(n)
+
+#define IMX53_UART1_BASE_ADDR	0x53fbc000
+#define IMX53_UART2_BASE_ADDR	0x53fc0000
+#define IMX53_UART3_BASE_ADDR	0x5000c000
+#define IMX53_UART4_BASE_ADDR	0x53ff0000
+#define IMX53_UART5_BASE_ADDR	0x63f90000
+#define IMX53_UART_BASE_ADDR(n)	IMX53_UART##n##_BASE_ADDR
+#define IMX53_UART_BASE(n)	IMX53_UART_BASE_ADDR(n)
+
+#define IMX6Q_UART1_BASE_ADDR	0x02020000
+#define IMX6Q_UART2_BASE_ADDR	0x021e8000
+#define IMX6Q_UART3_BASE_ADDR	0x021ec000
+#define IMX6Q_UART4_BASE_ADDR	0x021f0000
+#define IMX6Q_UART5_BASE_ADDR	0x021f4000
+#define IMX6Q_UART_BASE_ADDR(n)	IMX6Q_UART##n##_BASE_ADDR
+#define IMX6Q_UART_BASE(n)	IMX6Q_UART_BASE_ADDR(n)
+
+#define IMX_DEBUG_UART_BASE(soc) soc##_UART_BASE(CONFIG_DEBUG_IMX_UART_PORT)
+
+#ifdef CONFIG_DEBUG_IMX1_UART
+#define UART_PADDR	IMX_DEBUG_UART_BASE(IMX1)
+#elif defined(CONFIG_DEBUG_IMX21_IMX27_UART)
+#define UART_PADDR	IMX_DEBUG_UART_BASE(IMX21)
+#elif defined(CONFIG_DEBUG_IMX25_UART)
+#define UART_PADDR	IMX_DEBUG_UART_BASE(IMX25)
+#elif defined(CONFIG_DEBUG_IMX31_UART)
+#define UART_PADDR	IMX_DEBUG_UART_BASE(IMX31)
+#elif defined(CONFIG_DEBUG_IMX35_UART)
+#define UART_PADDR	IMX_DEBUG_UART_BASE(IMX35)
+#elif defined(CONFIG_DEBUG_IMX51_UART)
+#define UART_PADDR	IMX_DEBUG_UART_BASE(IMX51)
+#elif defined(CONFIG_DEBUG_IMX50_IMX53_UART)
+#define UART_PADDR	IMX_DEBUG_UART_BASE(IMX53)
+#elif defined(CONFIG_DEBUG_IMX6Q_UART)
+#define UART_PADDR	IMX_DEBUG_UART_BASE(IMX6Q)
+#endif
+
+#endif /* __DEBUG_IMX_UART_H */
diff --git a/arch/arm/include/debug/imx.S b/arch/arm/include/debug/imx.S
index 0c4e17d..619d8cc 100644
--- a/arch/arm/include/debug/imx.S
+++ b/arch/arm/include/debug/imx.S
@@ -10,35 +10,8 @@
  * published by the Free Software Foundation.
  *
  */
-#define IMX6Q_UART1_BASE_ADDR	0x02020000
-#define IMX6Q_UART2_BASE_ADDR	0x021e8000
-#define IMX6Q_UART3_BASE_ADDR	0x021ec000
-#define IMX6Q_UART4_BASE_ADDR	0x021f0000
-#define IMX6Q_UART5_BASE_ADDR	0x021f4000
 
-/*
- * IMX6Q_UART_BASE_ADDR is put in the middle to force the expansion
- * of IMX6Q_UART##n##_BASE_ADDR.
- */
-#define IMX6Q_UART_BASE_ADDR(n)	IMX6Q_UART##n##_BASE_ADDR
-#define IMX6Q_UART_BASE(n)	IMX6Q_UART_BASE_ADDR(n)
-#define IMX6Q_DEBUG_UART_BASE	IMX6Q_UART_BASE(CONFIG_DEBUG_IMX6Q_UART_PORT)
-
-#ifdef CONFIG_DEBUG_IMX1_UART
-#define UART_PADDR	0x00206000
-#elif defined (CONFIG_DEBUG_IMX25_UART)
-#define UART_PADDR	0x43f90000
-#elif defined (CONFIG_DEBUG_IMX21_IMX27_UART)
-#define UART_PADDR	0x1000a000
-#elif defined (CONFIG_DEBUG_IMX31_IMX35_UART)
-#define UART_PADDR	0x43f90000
-#elif defined (CONFIG_DEBUG_IMX51_UART)
-#define UART_PADDR	0x73fbc000
-#elif defined (CONFIG_DEBUG_IMX50_IMX53_UART)
-#define UART_PADDR	0x53fbc000
-#elif defined (CONFIG_DEBUG_IMX6Q_UART)
-#define UART_PADDR	IMX6Q_DEBUG_UART_BASE
-#endif
+#include "imx-uart.h"
 
 /*
  * FIXME: This is a copy of IMX_IO_P2V in hardware.h, and needs to
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/4] ARM: imx: restore uncompress.h to a common place
  2012-12-12 13:45 [PATCH 0/4] Support uncompress debug message for multiplatform build Shawn Guo
  2012-12-12 13:45 ` [PATCH 1/4] ARM: imx: use separated debug uart symbol for imx31 and imx35 Shawn Guo
  2012-12-12 13:45 ` [PATCH 2/4] ARM: imx: support DEBUG_LL uart port selection for all i.MX SoCs Shawn Guo
@ 2012-12-12 13:45 ` Shawn Guo
  2013-01-12  6:25   ` Dirk Behme
  2012-12-12 13:45 ` [PATCH 4/4] ARM: uncompress: support uncompress debug for multiplatform build Shawn Guo
  3 siblings, 1 reply; 14+ messages in thread
From: Shawn Guo @ 2012-12-12 13:45 UTC (permalink / raw)
  To: linux-arm-kernel

Restore arch/arm/plat-mxc/include/mach/uncompress.h removed by commit
3995eb8 (ARM: imx: merge plat-mxc into mach-imx) to a common place as
arch/arm/include/debug/uncompress/imx.h.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/include/debug/uncompress/imx.h |  132 +++++++++++++++++++++++++++++++
 1 file changed, 132 insertions(+)
 create mode 100644 arch/arm/include/debug/uncompress/imx.h

diff --git a/arch/arm/include/debug/uncompress/imx.h b/arch/arm/include/debug/uncompress/imx.h
new file mode 100644
index 0000000..477971b
--- /dev/null
+++ b/arch/arm/include/debug/uncompress/imx.h
@@ -0,0 +1,132 @@
+/*
+ *  arch/arm/plat-mxc/include/mach/uncompress.h
+ *
+ *  Copyright (C) 1999 ARM Limited
+ *  Copyright (C) Shane Nay (shane at minirl.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#ifndef __ASM_ARCH_MXC_UNCOMPRESS_H__
+#define __ASM_ARCH_MXC_UNCOMPRESS_H__
+
+#define __MXC_BOOT_UNCOMPRESS
+
+#include <asm/mach-types.h>
+
+unsigned long uart_base;
+
+#define UART(x) (*(volatile unsigned long *)(uart_base + (x)))
+
+#define USR2 0x98
+#define USR2_TXFE (1<<14)
+#define TXR  0x40
+#define UCR1 0x80
+#define UCR1_UARTEN 1
+
+/*
+ * The following code assumes the serial port has already been
+ * initialized by the bootloader.  We search for the first enabled
+ * port in the most probable order.  If you didn't setup a port in
+ * your bootloader then nothing will appear (which might be desired).
+ *
+ * This does not append a newline
+ */
+
+static void putc(int ch)
+{
+	if (!uart_base)
+		return;
+	if (!(UART(UCR1) & UCR1_UARTEN))
+		return;
+
+	while (!(UART(USR2) & USR2_TXFE))
+		barrier();
+
+	UART(TXR) = ch;
+}
+
+static inline void flush(void)
+{
+}
+
+#define MX1_UART1_BASE_ADDR	0x00206000
+#define MX25_UART1_BASE_ADDR	0x43f90000
+#define MX2X_UART1_BASE_ADDR	0x1000a000
+#define MX3X_UART1_BASE_ADDR	0x43F90000
+#define MX3X_UART2_BASE_ADDR	0x43F94000
+#define MX3X_UART5_BASE_ADDR	0x43FB4000
+#define MX51_UART1_BASE_ADDR	0x73fbc000
+#define MX50_UART1_BASE_ADDR	0x53fbc000
+#define MX53_UART1_BASE_ADDR	0x53fbc000
+
+static __inline__ void __arch_decomp_setup(unsigned long arch_id)
+{
+	switch (arch_id) {
+	case MACH_TYPE_MX1ADS:
+	case MACH_TYPE_SCB9328:
+		uart_base = MX1_UART1_BASE_ADDR;
+		break;
+	case MACH_TYPE_MX25_3DS:
+		uart_base = MX25_UART1_BASE_ADDR;
+		break;
+	case MACH_TYPE_IMX27LITE:
+	case MACH_TYPE_MX27_3DS:
+	case MACH_TYPE_MX27ADS:
+	case MACH_TYPE_PCM038:
+	case MACH_TYPE_MX21ADS:
+	case MACH_TYPE_PCA100:
+	case MACH_TYPE_MXT_TD60:
+	case MACH_TYPE_IMX27IPCAM:
+		uart_base = MX2X_UART1_BASE_ADDR;
+		break;
+	case MACH_TYPE_MX31LITE:
+	case MACH_TYPE_ARMADILLO5X0:
+	case MACH_TYPE_MX31MOBOARD:
+	case MACH_TYPE_QONG:
+	case MACH_TYPE_MX31_3DS:
+	case MACH_TYPE_PCM037:
+	case MACH_TYPE_MX31ADS:
+	case MACH_TYPE_MX35_3DS:
+	case MACH_TYPE_PCM043:
+	case MACH_TYPE_LILLY1131:
+	case MACH_TYPE_VPR200:
+	case MACH_TYPE_EUKREA_CPUIMX35SD:
+		uart_base = MX3X_UART1_BASE_ADDR;
+		break;
+	case MACH_TYPE_MAGX_ZN5:
+		uart_base = MX3X_UART2_BASE_ADDR;
+		break;
+	case MACH_TYPE_BUG:
+		uart_base = MX3X_UART5_BASE_ADDR;
+		break;
+	case MACH_TYPE_MX51_BABBAGE:
+	case MACH_TYPE_EUKREA_CPUIMX51SD:
+	case MACH_TYPE_MX51_3DS:
+		uart_base = MX51_UART1_BASE_ADDR;
+		break;
+	case MACH_TYPE_MX50_RDP:
+		uart_base = MX50_UART1_BASE_ADDR;
+		break;
+	case MACH_TYPE_MX53_EVK:
+	case MACH_TYPE_MX53_LOCO:
+	case MACH_TYPE_MX53_SMD:
+	case MACH_TYPE_MX53_ARD:
+		uart_base = MX53_UART1_BASE_ADDR;
+		break;
+	default:
+		break;
+	}
+}
+
+#define arch_decomp_setup()	__arch_decomp_setup(arch_id)
+#define arch_decomp_wdog()
+
+#endif				/* __ASM_ARCH_MXC_UNCOMPRESS_H__ */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/4] ARM: uncompress: support uncompress debug for multiplatform build
  2012-12-12 13:45 [PATCH 0/4] Support uncompress debug message for multiplatform build Shawn Guo
                   ` (2 preceding siblings ...)
  2012-12-12 13:45 ` [PATCH 3/4] ARM: imx: restore uncompress.h to a common place Shawn Guo
@ 2012-12-12 13:45 ` Shawn Guo
  2013-01-11 19:11   ` Olof Johansson
  3 siblings, 1 reply; 14+ messages in thread
From: Shawn Guo @ 2012-12-12 13:45 UTC (permalink / raw)
  To: linux-arm-kernel

When moving to multiplatform build, platforms lose the output from
decompressor.  Not only does it mean that we will never see message
"Uncompressing Linux... done, booting the kernel.", but also that
the debug facility in arch/arm/boot/compressed/head.S outputs nothing
even DEBUG is turned on.

The patch follows the approach handling DEBUG_LL to create a Kconfig
symbol CONFIG_UNCOMPRESS_INCLUDE for choosing the correct uncompress
header.  For traditional build, mach/uncompress.h will be included in
arch/arm/boot/compressed/misc.c.  For multiplatform build with none
DEBUG_LL port enabled, debug/uncompress/dummy.h will be used.  And
for multiplatform build with a DEBUG_LL port, platform specific
uncompress header like debug/uncompress/imx.h will come to play.

Different from traditional build that uncompress output and DEBUG_LL
are two separated pieces, for multiplatform build uncompress output
becomes a subset of DEBUG_LL and will not work unless DEBUG_LL is
enabled.

The arch/arm/include/debug/uncompress/imx.h is cleaned up and added
here as an example to show how this approach works.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/Kconfig.debug                    |   13 +++++
 arch/arm/boot/compressed/misc.c           |    8 +--
 arch/arm/include/debug/uncompress/dummy.h |    3 ++
 arch/arm/include/debug/uncompress/imx.h   |   75 ++---------------------------
 4 files changed, 20 insertions(+), 79 deletions(-)
 create mode 100644 arch/arm/include/debug/uncompress/dummy.h

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 05f83c8..3cb7a98 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -523,6 +523,19 @@ config DEBUG_LL_INCLUDE
 	default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1
 	default "mach/debug-macro.S"
 
+config UNCOMPRESS_INCLUDE
+	string
+	default "debug/uncompress/imx.h" if DEBUG_IMX1_UART || \
+					    DEBUG_IMX25_UART || \
+					    DEBUG_IMX21_IMX27_UART || \
+					    DEBUG_IMX31_UART || \
+					    DEBUG_IMX35_UART || \
+					    DEBUG_IMX51_UART || \
+					    DEBUG_IMX50_IMX53_UART || \
+					    DEBUG_IMX6Q_UART
+	default "debug/uncompress/dummy.h" if ARCH_MULTIPLATFORM
+	default "mach/uncompress.h"
+
 config EARLY_PRINTK
 	bool "Early printk"
 	depends on DEBUG_LL
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index df89983..31bd43b 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -25,13 +25,7 @@ unsigned int __machine_arch_type;
 static void putstr(const char *ptr);
 extern void error(char *x);
 
-#ifdef CONFIG_ARCH_MULTIPLATFORM
-static inline void putc(int c) {}
-static inline void flush(void) {}
-static inline void arch_decomp_setup(void) {}
-#else
-#include <mach/uncompress.h>
-#endif
+#include CONFIG_UNCOMPRESS_INCLUDE
 
 #ifdef CONFIG_DEBUG_ICEDCC
 
diff --git a/arch/arm/include/debug/uncompress/dummy.h b/arch/arm/include/debug/uncompress/dummy.h
new file mode 100644
index 0000000..e19955d
--- /dev/null
+++ b/arch/arm/include/debug/uncompress/dummy.h
@@ -0,0 +1,3 @@
+static inline void putc(int c) {}
+static inline void flush(void) {}
+static inline void arch_decomp_setup(void) {}
diff --git a/arch/arm/include/debug/uncompress/imx.h b/arch/arm/include/debug/uncompress/imx.h
index 477971b..7c5ad5d 100644
--- a/arch/arm/include/debug/uncompress/imx.h
+++ b/arch/arm/include/debug/uncompress/imx.h
@@ -17,9 +17,7 @@
 #ifndef __ASM_ARCH_MXC_UNCOMPRESS_H__
 #define __ASM_ARCH_MXC_UNCOMPRESS_H__
 
-#define __MXC_BOOT_UNCOMPRESS
-
-#include <asm/mach-types.h>
+#include "../imx-uart.h"
 
 unsigned long uart_base;
 
@@ -57,76 +55,9 @@ static inline void flush(void)
 {
 }
 
-#define MX1_UART1_BASE_ADDR	0x00206000
-#define MX25_UART1_BASE_ADDR	0x43f90000
-#define MX2X_UART1_BASE_ADDR	0x1000a000
-#define MX3X_UART1_BASE_ADDR	0x43F90000
-#define MX3X_UART2_BASE_ADDR	0x43F94000
-#define MX3X_UART5_BASE_ADDR	0x43FB4000
-#define MX51_UART1_BASE_ADDR	0x73fbc000
-#define MX50_UART1_BASE_ADDR	0x53fbc000
-#define MX53_UART1_BASE_ADDR	0x53fbc000
-
-static __inline__ void __arch_decomp_setup(unsigned long arch_id)
+static inline void arch_decomp_setup(void)
 {
-	switch (arch_id) {
-	case MACH_TYPE_MX1ADS:
-	case MACH_TYPE_SCB9328:
-		uart_base = MX1_UART1_BASE_ADDR;
-		break;
-	case MACH_TYPE_MX25_3DS:
-		uart_base = MX25_UART1_BASE_ADDR;
-		break;
-	case MACH_TYPE_IMX27LITE:
-	case MACH_TYPE_MX27_3DS:
-	case MACH_TYPE_MX27ADS:
-	case MACH_TYPE_PCM038:
-	case MACH_TYPE_MX21ADS:
-	case MACH_TYPE_PCA100:
-	case MACH_TYPE_MXT_TD60:
-	case MACH_TYPE_IMX27IPCAM:
-		uart_base = MX2X_UART1_BASE_ADDR;
-		break;
-	case MACH_TYPE_MX31LITE:
-	case MACH_TYPE_ARMADILLO5X0:
-	case MACH_TYPE_MX31MOBOARD:
-	case MACH_TYPE_QONG:
-	case MACH_TYPE_MX31_3DS:
-	case MACH_TYPE_PCM037:
-	case MACH_TYPE_MX31ADS:
-	case MACH_TYPE_MX35_3DS:
-	case MACH_TYPE_PCM043:
-	case MACH_TYPE_LILLY1131:
-	case MACH_TYPE_VPR200:
-	case MACH_TYPE_EUKREA_CPUIMX35SD:
-		uart_base = MX3X_UART1_BASE_ADDR;
-		break;
-	case MACH_TYPE_MAGX_ZN5:
-		uart_base = MX3X_UART2_BASE_ADDR;
-		break;
-	case MACH_TYPE_BUG:
-		uart_base = MX3X_UART5_BASE_ADDR;
-		break;
-	case MACH_TYPE_MX51_BABBAGE:
-	case MACH_TYPE_EUKREA_CPUIMX51SD:
-	case MACH_TYPE_MX51_3DS:
-		uart_base = MX51_UART1_BASE_ADDR;
-		break;
-	case MACH_TYPE_MX50_RDP:
-		uart_base = MX50_UART1_BASE_ADDR;
-		break;
-	case MACH_TYPE_MX53_EVK:
-	case MACH_TYPE_MX53_LOCO:
-	case MACH_TYPE_MX53_SMD:
-	case MACH_TYPE_MX53_ARD:
-		uart_base = MX53_UART1_BASE_ADDR;
-		break;
-	default:
-		break;
-	}
+	uart_base = UART_PADDR;
 }
 
-#define arch_decomp_setup()	__arch_decomp_setup(arch_id)
-#define arch_decomp_wdog()
-
 #endif				/* __ASM_ARCH_MXC_UNCOMPRESS_H__ */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/4] ARM: uncompress: support uncompress debug for multiplatform build
  2012-12-12 13:45 ` [PATCH 4/4] ARM: uncompress: support uncompress debug for multiplatform build Shawn Guo
@ 2013-01-11 19:11   ` Olof Johansson
  2013-01-12  3:29     ` Shawn Guo
  0 siblings, 1 reply; 14+ messages in thread
From: Olof Johansson @ 2013-01-11 19:11 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, Dec 12, 2012 at 09:45:45PM +0800, Shawn Guo wrote:
> When moving to multiplatform build, platforms lose the output from
> decompressor.  Not only does it mean that we will never see message
> "Uncompressing Linux... done, booting the kernel.", but also that
> the debug facility in arch/arm/boot/compressed/head.S outputs nothing
> even DEBUG is turned on.
> 
> The patch follows the approach handling DEBUG_LL to create a Kconfig
> symbol CONFIG_UNCOMPRESS_INCLUDE for choosing the correct uncompress
> header.  For traditional build, mach/uncompress.h will be included in
> arch/arm/boot/compressed/misc.c.  For multiplatform build with none
> DEBUG_LL port enabled, debug/uncompress/dummy.h will be used.  And
> for multiplatform build with a DEBUG_LL port, platform specific
> uncompress header like debug/uncompress/imx.h will come to play.
> 
> Different from traditional build that uncompress output and DEBUG_LL
> are two separated pieces, for multiplatform build uncompress output
> becomes a subset of DEBUG_LL and will not work unless DEBUG_LL is
> enabled.
> 
> The arch/arm/include/debug/uncompress/imx.h is cleaned up and added
> here as an example to show how this approach works.

Since this requires you to define a debug uart to get uncompress output,
it would make more sense to do a generic wrapper that uses the debug
code generically, instead of having to add this kind of wrapper for
every platform. That would solve it for all of them at once.


-Olof

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/4] ARM: uncompress: support uncompress debug for multiplatform build
  2013-01-11 19:11   ` Olof Johansson
@ 2013-01-12  3:29     ` Shawn Guo
  2013-01-15 19:04       ` Olof Johansson
  0 siblings, 1 reply; 14+ messages in thread
From: Shawn Guo @ 2013-01-12  3:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 11, 2013 at 11:11:16AM -0800, Olof Johansson wrote:
> Hi,
> 
> On Wed, Dec 12, 2012 at 09:45:45PM +0800, Shawn Guo wrote:
> > When moving to multiplatform build, platforms lose the output from
> > decompressor.  Not only does it mean that we will never see message
> > "Uncompressing Linux... done, booting the kernel.", but also that
> > the debug facility in arch/arm/boot/compressed/head.S outputs nothing
> > even DEBUG is turned on.
> > 
> > The patch follows the approach handling DEBUG_LL to create a Kconfig
> > symbol CONFIG_UNCOMPRESS_INCLUDE for choosing the correct uncompress
> > header.  For traditional build, mach/uncompress.h will be included in
> > arch/arm/boot/compressed/misc.c.  For multiplatform build with none
> > DEBUG_LL port enabled, debug/uncompress/dummy.h will be used.  And
> > for multiplatform build with a DEBUG_LL port, platform specific
> > uncompress header like debug/uncompress/imx.h will come to play.
> > 
> > Different from traditional build that uncompress output and DEBUG_LL
> > are two separated pieces, for multiplatform build uncompress output
> > becomes a subset of DEBUG_LL and will not work unless DEBUG_LL is
> > enabled.
> > 
> > The arch/arm/include/debug/uncompress/imx.h is cleaned up and added
> > here as an example to show how this approach works.
> 
> Since this requires you to define a debug uart to get uncompress output,
> it would make more sense to do a generic wrapper that uses the debug
> code generically, instead of having to add this kind of wrapper for
> every platform. That would solve it for all of them at once.
> 
I'm not entirely sure about what you mean here.  Can you please
elaborate that generic wrapper in your mind a little bit?

Shawn

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 3/4] ARM: imx: restore uncompress.h to a common place
  2012-12-12 13:45 ` [PATCH 3/4] ARM: imx: restore uncompress.h to a common place Shawn Guo
@ 2013-01-12  6:25   ` Dirk Behme
  2013-01-12 11:04     ` Shawn Guo
  0 siblings, 1 reply; 14+ messages in thread
From: Dirk Behme @ 2013-01-12  6:25 UTC (permalink / raw)
  To: linux-arm-kernel

On 12.12.2012 14:45, Shawn Guo wrote:
> Restore arch/arm/plat-mxc/include/mach/uncompress.h removed by commit
> 3995eb8 (ARM: imx: merge plat-mxc into mach-imx) to a common place as
> arch/arm/include/debug/uncompress/imx.h.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
...
> +++ b/arch/arm/include/debug/uncompress/imx.h
...
> + *  arch/arm/plat-mxc/include/mach/uncompress.h

In case you touch these patches again, you might check if the above 
path and file name in the file header should be adapted to the new 
file location, too.

Best regards

Dirk

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 3/4] ARM: imx: restore uncompress.h to a common place
  2013-01-12  6:25   ` Dirk Behme
@ 2013-01-12 11:04     ` Shawn Guo
  2013-01-12 11:58       ` Arnd Bergmann
  0 siblings, 1 reply; 14+ messages in thread
From: Shawn Guo @ 2013-01-12 11:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Jan 12, 2013 at 07:25:56AM +0100, Dirk Behme wrote:
> On 12.12.2012 14:45, Shawn Guo wrote:
> >Restore arch/arm/plat-mxc/include/mach/uncompress.h removed by commit
> >3995eb8 (ARM: imx: merge plat-mxc into mach-imx) to a common place as
> >arch/arm/include/debug/uncompress/imx.h.
> >
> >Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> >---
> ...
> >+++ b/arch/arm/include/debug/uncompress/imx.h
> ...
> >+ *  arch/arm/plat-mxc/include/mach/uncompress.h
> 
> In case you touch these patches again, you might check if the above
> path and file name in the file header should be adapted to the new
> file location, too.
> 
I would not bother to update that.  To me, it's quite pointless to have
a full file name there.  If I can choose, I would remove it completely.

Shawn

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 3/4] ARM: imx: restore uncompress.h to a common place
  2013-01-12 11:04     ` Shawn Guo
@ 2013-01-12 11:58       ` Arnd Bergmann
  0 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2013-01-12 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Saturday 12 January 2013, Shawn Guo wrote:
> On Sat, Jan 12, 2013 at 07:25:56AM +0100, Dirk Behme wrote:

> > In case you touch these patches again, you might check if the above
> > path and file name in the file header should be adapted to the new
> > file location, too.
> > 
> I would not bother to update that.  To me, it's quite pointless to have
> a full file name there.  If I can choose, I would remove it completely.

I agree, they tend to all get wrong over time. It's not worth
removing those statements all at once, but I also remove them
when moving files and I remember.

	Arnd

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/4] ARM: uncompress: support uncompress debug for multiplatform build
  2013-01-12  3:29     ` Shawn Guo
@ 2013-01-15 19:04       ` Olof Johansson
  2013-01-16 14:04         ` Shawn Guo
  0 siblings, 1 reply; 14+ messages in thread
From: Olof Johansson @ 2013-01-15 19:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Jan 12, 2013 at 11:29:37AM +0800, Shawn Guo wrote:
> On Fri, Jan 11, 2013 at 11:11:16AM -0800, Olof Johansson wrote:
> > Hi,
> > 
> > On Wed, Dec 12, 2012 at 09:45:45PM +0800, Shawn Guo wrote:
> > > When moving to multiplatform build, platforms lose the output from
> > > decompressor.  Not only does it mean that we will never see message
> > > "Uncompressing Linux... done, booting the kernel.", but also that
> > > the debug facility in arch/arm/boot/compressed/head.S outputs nothing
> > > even DEBUG is turned on.
> > > 
> > > The patch follows the approach handling DEBUG_LL to create a Kconfig
> > > symbol CONFIG_UNCOMPRESS_INCLUDE for choosing the correct uncompress
> > > header.  For traditional build, mach/uncompress.h will be included in
> > > arch/arm/boot/compressed/misc.c.  For multiplatform build with none
> > > DEBUG_LL port enabled, debug/uncompress/dummy.h will be used.  And
> > > for multiplatform build with a DEBUG_LL port, platform specific
> > > uncompress header like debug/uncompress/imx.h will come to play.
> > > 
> > > Different from traditional build that uncompress output and DEBUG_LL
> > > are two separated pieces, for multiplatform build uncompress output
> > > becomes a subset of DEBUG_LL and will not work unless DEBUG_LL is
> > > enabled.
> > > 
> > > The arch/arm/include/debug/uncompress/imx.h is cleaned up and added
> > > here as an example to show how this approach works.
> > 
> > Since this requires you to define a debug uart to get uncompress output,
> > it would make more sense to do a generic wrapper that uses the debug
> > code generically, instead of having to add this kind of wrapper for
> > every platform. That would solve it for all of them at once.
> > 
> I'm not entirely sure about what you mean here.  Can you please
> elaborate that generic wrapper in your mind a little bit?

Hi,

Sorry for the delay in responding.

Most functionality to deal with this already exist in the
include/debug/*.S files files, you just need to instantiate the macros
somewhere (compressed/head.S, or a separate file), and wrap the calls
to those instantiated assembly functions in a generic header file.

That way, every platform that has a DEBUG_LL implementation should be able to
reuse that, and no need to enable every platform one by one.

Or am I missing some complexity involved here?


-Olof

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/4] ARM: uncompress: support uncompress debug for multiplatform build
  2013-01-15 19:04       ` Olof Johansson
@ 2013-01-16 14:04         ` Shawn Guo
  0 siblings, 0 replies; 14+ messages in thread
From: Shawn Guo @ 2013-01-16 14:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 15, 2013 at 11:04:01AM -0800, Olof Johansson wrote:
> Most functionality to deal with this already exist in the
> include/debug/*.S files files, you just need to instantiate the macros
> somewhere (compressed/head.S, or a separate file), and wrap the calls
> to those instantiated assembly functions in a generic header file.
> 
> That way, every platform that has a DEBUG_LL implementation should be able to
> reuse that, and no need to enable every platform one by one.
> 
Ok, got your point.  I'm working on a solution as what you suggest here.
So please ignore that pull request I sent.

Shawn

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/4] ARM: imx: support DEBUG_LL uart port selection for all i.MX SoCs
  2012-12-12 13:45 ` [PATCH 2/4] ARM: imx: support DEBUG_LL uart port selection for all i.MX SoCs Shawn Guo
@ 2013-03-12 14:35   ` Karl Beldan
  2013-03-13  1:52     ` Shawn Guo
  0 siblings, 1 reply; 14+ messages in thread
From: Karl Beldan @ 2013-03-12 14:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Dec 12, 2012 at 09:45:43PM +0800, Shawn Guo wrote:
> Extend imx6q DEBUG_LL uart port selection support to cover all i.MX
> SoCs.  The 'range' of the Kconfig option gets dropped, as users
> looking at the option must know the uart number on his board.  The
> bottom line is that the build system will report an error if an
> invalid port number is picked for given SoC.
> 
> The header arch/arm/include/debug/imx-uart.h is created to accommodate
> all the uart base addresses.  And the header will also be used for
> other low-level debug facility later.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
>  arch/arm/Kconfig.debug            |   13 ++++--
>  arch/arm/include/debug/imx-uart.h |   88 +++++++++++++++++++++++++++++++++++++
>  arch/arm/include/debug/imx.S      |   29 +-----------
>  3 files changed, 98 insertions(+), 32 deletions(-)
>  create mode 100644 arch/arm/include/debug/imx-uart.h
> 
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index ae2ee04..05f83c8 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -457,11 +457,16 @@ choice
>  
>  endchoice
>  
> -config DEBUG_IMX6Q_UART_PORT
> -	int "i.MX6Q Debug UART Port (1-5)" if DEBUG_IMX6Q_UART
> -	range 1 5
> +config DEBUG_IMX_UART_PORT
> +	int "i.MX Debug UART Port Selection" if DEBUG_IMX1_UART || \
> +						DEBUG_IMX25_UART || \
> +						DEBUG_IMX21_IMX27_UART || \
> +						DEBUG_IMX31_UART || \
> +						DEBUG_IMX35_UART || \
> +						DEBUG_IMX51_UART || \
> +						DEBUG_IMX50_IMX53_UART || \
> +						DEBUG_IMX6Q_UART
>  	default 1
> -	depends on SOC_IMX6Q

After removing any dependency everybody gets a DEBUG_IMX_UART_PORT in
their config now.
 
Karl

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/4] ARM: imx: support DEBUG_LL uart port selection for all i.MX SoCs
  2013-03-12 14:35   ` Karl Beldan
@ 2013-03-13  1:52     ` Shawn Guo
  0 siblings, 0 replies; 14+ messages in thread
From: Shawn Guo @ 2013-03-13  1:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 12, 2013 at 03:35:10PM +0100, Karl Beldan wrote:
> > -config DEBUG_IMX6Q_UART_PORT
> > -	int "i.MX6Q Debug UART Port (1-5)" if DEBUG_IMX6Q_UART
> > -	range 1 5
> > +config DEBUG_IMX_UART_PORT
> > +	int "i.MX Debug UART Port Selection" if DEBUG_IMX1_UART || \
> > +						DEBUG_IMX25_UART || \
> > +						DEBUG_IMX21_IMX27_UART || \
> > +						DEBUG_IMX31_UART || \
> > +						DEBUG_IMX35_UART || \
> > +						DEBUG_IMX51_UART || \
> > +						DEBUG_IMX50_IMX53_UART || \
> > +						DEBUG_IMX6Q_UART
> >  	default 1
> > -	depends on SOC_IMX6Q
> 
> After removing any dependency everybody gets a DEBUG_IMX_UART_PORT in
> their config now.
>  
Right, this is something undesirable.  Will fix it.  Thanks for
reporting, Karl.

Shawn

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-03-13  1:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-12 13:45 [PATCH 0/4] Support uncompress debug message for multiplatform build Shawn Guo
2012-12-12 13:45 ` [PATCH 1/4] ARM: imx: use separated debug uart symbol for imx31 and imx35 Shawn Guo
2012-12-12 13:45 ` [PATCH 2/4] ARM: imx: support DEBUG_LL uart port selection for all i.MX SoCs Shawn Guo
2013-03-12 14:35   ` Karl Beldan
2013-03-13  1:52     ` Shawn Guo
2012-12-12 13:45 ` [PATCH 3/4] ARM: imx: restore uncompress.h to a common place Shawn Guo
2013-01-12  6:25   ` Dirk Behme
2013-01-12 11:04     ` Shawn Guo
2013-01-12 11:58       ` Arnd Bergmann
2012-12-12 13:45 ` [PATCH 4/4] ARM: uncompress: support uncompress debug for multiplatform build Shawn Guo
2013-01-11 19:11   ` Olof Johansson
2013-01-12  3:29     ` Shawn Guo
2013-01-15 19:04       ` Olof Johansson
2013-01-16 14:04         ` Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).