From: shawn.guo@freescale.com (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v8 05/15] ARM: mxs: Add low-level debug UART support
Date: Mon, 20 Dec 2010 22:57:42 +0800 [thread overview]
Message-ID: <1292857064-5032-2-git-send-email-shawn.guo@freescale.com> (raw)
In-Reply-To: <1292857064-5032-1-git-send-email-shawn.guo@freescale.com>
- DEBUG_LL support, which is incompatible with multi-soc MXS image
because of different DUART base address on MX23 and MX28
- uncompress message support
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
---
Changes for v8:
- Reuse debug-pl01x.S as mxs DUART is just an amba-pl011
Changes for v7:
- Add namespace for uart_base and UART()
Changes for v3:
- debug-macro.S: change inclusion of hardware.h to mx23.h plus mx28.h
- Remove #define __MXS_BOOT_UNCOMPRESS
- Add namespace MXS_DUART_ for macros
- Add comment "If it's not, the output is simply discarded."
Changes for v2:
- Remove incorrect comments
arch/arm/mach-mxs/include/mach/debug-macro.S | 38 +++++++++++++
arch/arm/mach-mxs/include/mach/uncompress.h | 76 ++++++++++++++++++++++++++
2 files changed, 114 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-mxs/include/mach/debug-macro.S
create mode 100644 arch/arm/mach-mxs/include/mach/uncompress.h
diff --git a/arch/arm/mach-mxs/include/mach/debug-macro.S b/arch/arm/mach-mxs/include/mach/debug-macro.S
new file mode 100644
index 0000000..79650a1
--- /dev/null
+++ b/arch/arm/mach-mxs/include/mach/debug-macro.S
@@ -0,0 +1,38 @@
+/* arch/arm/mach-mxs/include/mach/debug-macro.S
+ *
+ * Debugging macro include header
+ *
+ * Copyright (C) 1994-1999 Russell King
+ * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
+ *
+ * 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.
+ *
+ */
+
+#include <mach/mx23.h>
+#include <mach/mx28.h>
+
+#ifdef CONFIG_SOC_IMX23
+#ifdef UART_PADDR
+#error "CONFIG_DEBUG_LL is incompatible with multiple archs"
+#endif
+#define UART_PADDR MX23_DUART_BASE_ADDR
+#endif
+
+#ifdef CONFIG_SOC_IMX28
+#ifdef UART_PADDR
+#error "CONFIG_DEBUG_LL is incompatible with multiple archs"
+#endif
+#define UART_PADDR MX28_DUART_BASE_ADDR
+#endif
+
+#define UART_VADDR MXS_IO_ADDRESS(UART_PADDR)
+
+ .macro addruart, rp, rv
+ ldr \rp, =UART_PADDR @ physical
+ ldr \rv, =UART_VADDR @ virtual
+ .endm
+
+#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-mxs/include/mach/uncompress.h b/arch/arm/mach-mxs/include/mach/uncompress.h
new file mode 100644
index 0000000..a005e76
--- /dev/null
+++ b/arch/arm/mach-mxs/include/mach/uncompress.h
@@ -0,0 +1,76 @@
+/*
+ * arch/arm/mach-mxs/include/mach/uncompress.h
+ *
+ * Copyright (C) 1999 ARM Limited
+ * Copyright (C) Shane Nay (shane at minirl.com)
+ * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * 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 __MACH_MXS_UNCOMPRESS_H__
+#define __MACH_MXS_UNCOMPRESS_H__
+
+#include <asm/mach-types.h>
+
+static unsigned long mxs_duart_base;
+
+#define MXS_DUART(x) (*(volatile unsigned long *)(mxs_duart_base + (x)))
+
+#define MXS_DUART_DR 0x00
+#define MXS_DUART_FR 0x18
+#define MXS_DUART_FR_TXFE (1 << 7)
+#define MXS_DUART_CR 0x30
+#define MXS_DUART_CR_UARTEN (1 << 0)
+
+/*
+ * The following code assumes the serial port has already been
+ * initialized by the bootloader. If it's not, the output is
+ * simply discarded.
+ */
+
+static void putc(int ch)
+{
+ if (!mxs_duart_base)
+ return;
+ if (!(MXS_DUART(MXS_DUART_CR) & MXS_DUART_CR_UARTEN))
+ return;
+
+ while (!(MXS_DUART(MXS_DUART_FR) & MXS_DUART_FR_TXFE))
+ barrier();
+
+ MXS_DUART(MXS_DUART_DR) = ch;
+}
+
+static inline void flush(void)
+{
+}
+
+#define MX23_DUART_BASE_ADDR 0x80070000
+#define MX28_DUART_BASE_ADDR 0x80074000
+
+static inline void __arch_decomp_setup(unsigned long arch_id)
+{
+ switch (arch_id) {
+ case MACH_TYPE_MX23EVK:
+ mxs_duart_base = MX23_DUART_BASE_ADDR;
+ break;
+ case MACH_TYPE_MX28EVK:
+ mxs_duart_base = MX28_DUART_BASE_ADDR;
+ break;
+ default:
+ break;
+ }
+}
+
+#define arch_decomp_setup() __arch_decomp_setup(arch_id)
+#define arch_decomp_wdog()
+
+#endif /* __MACH_MXS_UNCOMPRESS_H__ */
--
1.7.1
next prev parent reply other threads:[~2010-12-20 14:57 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-20 14:57 [PATCH v8 00/15] ARM: mxs: Add initial support for MX23 and MX28 Shawn Guo
2010-12-20 14:57 ` Shawn Guo [this message]
2010-12-20 14:57 ` [PATCH v8 08/15] ARM: mxs: Add iomux support Shawn Guo
2010-12-20 14:57 ` [PATCH v8 13/15] ARM: mxs: Add initial mx23evk support Shawn Guo
2010-12-20 21:29 ` [PATCH v8 00/15] ARM: mxs: Add initial support for MX23 and MX28 Uwe Kleine-König
2010-12-21 8:45 ` Shawn Guo
2010-12-21 13:26 ` Shawn Guo
2010-12-21 13:12 ` [PATCH] ARM: mxs: Change duart device to use amba-pl011 Shawn Guo
2010-12-21 20:31 ` Wolfram Sang
2010-12-22 2:10 ` Shawn Guo
2010-12-22 11:41 ` Wolfram Sang
2010-12-22 20:25 ` Uwe Kleine-König
2010-12-27 11:49 ` Shawn Guo
2010-12-29 8:38 ` Uwe Kleine-König
2011-01-03 10:39 ` Russell King - ARM Linux
2011-01-04 5:41 ` Shawn Guo
2011-01-03 10:35 ` Russell King - ARM Linux
2010-12-28 15:23 ` [PATCH v2] " Shawn Guo
2010-12-29 9:12 ` Uwe Kleine-König
2010-12-31 5:16 ` Shawn Guo
2010-12-31 5:50 ` [PATCH v3] " Shawn Guo
2011-01-04 6:20 ` [PATCH v4] " Shawn Guo
2011-01-10 13:34 ` Wolfram Sang
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=1292857064-5032-2-git-send-email-shawn.guo@freescale.com \
--to=shawn.guo@freescale.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).