linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] ARM: Add inituart macro to initialize DEBUG_LL serial port based on the machine ID
Date: Thu, 03 Feb 2011 17:22:07 -0800	[thread overview]
Message-ID: <20110204012207.26298.16649.stgit@baageli.muru.com> (raw)
In-Reply-To: <20110204012008.26298.16341.stgit@baageli.muru.com>

Allow machine specific init of the DEBUG_LL serial port. This is needed
to debug kernels built with support for multiple machines compiled in
without recompiling the kernel.

As some SoCs need to use variables to store the port address and LSR
register configuration, we must call inituart again after clearing
the BSS.

If variables are being used for for inituart and addruart, this setup
won't work properly for debugging the uncompress code without patching
arch/arm/boot/compressed/head.S for the machine in question.

For adding DEBUG_LL support for new machines, only two lines are needed
in debug-macro.S:

	.macro	inituart, id, a, v
	...
	ldr	\v, =MACH_TYPE_SOMETHING1
	cmp	\id, \v
	ldrne	\v, =MACH_TYPE_SOMETHING2
	cmpne	\id, \v
	ldrne	\v, =MACH_TYPE_SOMETHING3
	cmpne	\id, \v
	...
	.endm

Note that this patch depends on a patch to add empty inituart macro for
each debug-macro.S file.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/kernel/head-common.S |    7 +++++++
 arch/arm/kernel/head.S        |    5 +++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
index c84b57d..0b66d6b 100644
--- a/arch/arm/kernel/head-common.S
+++ b/arch/arm/kernel/head-common.S
@@ -63,6 +63,9 @@ ENDPROC(__vet_atags)
  *  r1  = machine ID
  *  r2  = atags pointer
  *  r9  = processor ID
+ *
+ * Note that if the machine uses BSS to store the debug UART configuration,
+ * debug_ll code will not work after clear BSS until inituart is called again.
  */
 	__INIT
 __mmap_switched:
@@ -80,6 +83,10 @@ __mmap_switched:
 	strcc	fp, [r6],#4
 	bcc	1b
 
+#if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_ICEDCC)
+	inituart r1, r4, r5
+#endif
+
  ARM(	ldmia	r3, {r4, r5, r6, r7, sp})
  THUMB(	ldmia	r3, {r4, r5, r6, r7}	)
  THUMB(	ldr	sp, [r3, #16]		)
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 591a2ea..be64264 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -75,6 +75,11 @@
 ENTRY(stext)
 	setmode	PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode
 						@ and irqs disabled
+
+#if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_ICEDCC)
+	inituart r1, r3, r4
+#endif
+
 	mrc	p15, 0, r9, c0, c0		@ get processor id
 	bl	__lookup_processor_type		@ r5=procinfo r9=cpuid
 	movs	r10, r5				@ invalid processor (r5=0)?

  reply	other threads:[~2011-02-04  1:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-04  1:22 [PATCH 0/2] Allow using machine ID for DEBUG_LL macros Tony Lindgren
2011-02-04  1:22 ` Tony Lindgren [this message]
2011-02-04  2:16   ` [PATCH 1/2] ARM: Add inituart macro to initialize DEBUG_LL serial port based on the machine ID Nicolas Pitre
2011-02-04  8:39   ` Russell King - ARM Linux
2011-02-04 12:32     ` Russell King - ARM Linux
2011-02-04 16:44       ` Tony Lindgren
2011-02-04  1:22 ` [PATCH 2/2] ARM: Add empty inituart macros Tony Lindgren
2011-02-04  2:20   ` Nicolas Pitre
2011-02-04  3:07     ` Tony Lindgren
2011-02-04  2:02 ` [PATCH 0/2] Allow using machine ID for DEBUG_LL macros Nicolas Pitre
2011-02-04  3:13   ` Tony Lindgren
2011-02-04  3:39     ` Nicolas Pitre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110204012207.26298.16649.stgit@baageli.muru.com \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).