mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/6] MIPS: rework ns16550 debug_ll
@ 2013-06-01  7:52 Antony Pavlov
  2013-06-01  7:52 ` [PATCH 1/6] MIPS: XBurst: use mach-specific debug_ll setup Antony Pavlov
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Antony Pavlov @ 2013-06-01  7:52 UTC (permalink / raw)
  To: barebox

This patch series adds low-level debug ns16550 output helpers
for MIPS pbl. This helpers make possible easely produce
debug output via ns16550-like UART on very early pbl stage.

[PATCH 1/6] MIPS: XBurst: use mach-specific debug_ll setup
[PATCH 2/6] MIPS: pbl: add low-level debug asm macros for ns16550
[PATCH 3/6] MIPS: rzx50: pbl: use debug_ll
[PATCH 4/6] MIPS: rzx50_defconfig: use UART1 for low-level debug
[PATCH 5/6] MIPS: malta: adapt for new debug_ll
[PATCH 6/6] MIPS: unificate ns16550 debug_ll support code

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 1/6] MIPS: XBurst: use mach-specific debug_ll setup
  2013-06-01  7:52 [PATCH 0/6] MIPS: rework ns16550 debug_ll Antony Pavlov
@ 2013-06-01  7:52 ` Antony Pavlov
  2013-06-01  7:52 ` [PATCH 2/6] MIPS: pbl: add low-level debug asm macros for ns16550 Antony Pavlov
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Antony Pavlov @ 2013-06-01  7:52 UTC (permalink / raw)
  To: barebox

Ingenic JZ4755 SoC (JZ4750D family) has three UARTs.
So we can give to the user choose which one of them
to use for low level debug (debug_ll) output.

Also this commit adapts the only JZ4755 board
(Ritmix RZX50) for using the new debug_ll port
selection.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/boards/rzx50/include/board/debug_ll.h    |    5 +--
 arch/mips/mach-xburst/Kconfig                      |   18 ++++++++++
 .../mach-xburst/include/mach/debug_ll_jz4750d.h    |   37 ++++++++++++++++++++
 arch/mips/mach-xburst/include/mach/jz4750d_regs.h  |    2 ++
 4 files changed, 58 insertions(+), 4 deletions(-)
 create mode 100644 arch/mips/mach-xburst/include/mach/debug_ll_jz4750d.h

diff --git a/arch/mips/boards/rzx50/include/board/debug_ll.h b/arch/mips/boards/rzx50/include/board/debug_ll.h
index 3d183b0..7ae0e2a 100644
--- a/arch/mips/boards/rzx50/include/board/debug_ll.h
+++ b/arch/mips/boards/rzx50/include/board/debug_ll.h
@@ -18,9 +18,6 @@
 #ifndef __INCLUDE_RZX50_BOARD_DEBUG_LL_H__
 #define __INCLUDE_RZX50_BOARD_DEBUG_LL_H__
 
-#include <mach/jz4750d_regs.h>
-
-#define DEBUG_LL_UART_ADDR	UART1_BASE
-#define DEBUG_LL_UART_SHIFT	2
+#include <mach/debug_ll_jz4750d.h>
 
 #endif  /* __INCLUDE_RZX50_BOARD_DEBUG_LL_H__ */
diff --git a/arch/mips/mach-xburst/Kconfig b/arch/mips/mach-xburst/Kconfig
index c72b741..e6413d5 100644
--- a/arch/mips/mach-xburst/Kconfig
+++ b/arch/mips/mach-xburst/Kconfig
@@ -17,6 +17,24 @@ config BOARD_RZX50
 
 endchoice
 
+if DEBUG_LL
+if CPU_JZ4755
+choice
+	prompt "DEBUG_LL port"
+
+config JZ4750D_DEBUG_LL_UART0
+	bool "UART0"
+
+config JZ4750D_DEBUG_LL_UART1
+	bool "UART1"
+
+config JZ4750D_DEBUG_LL_UART2
+	bool "UART2"
+
+endchoice
+endif # CPU_JZ4755
+endif # DEBUG_LL
+
 source arch/mips/boards/rzx50/Kconfig
 
 endif
diff --git a/arch/mips/mach-xburst/include/mach/debug_ll_jz4750d.h b/arch/mips/mach-xburst/include/mach/debug_ll_jz4750d.h
new file mode 100644
index 0000000..7bf66b1
--- /dev/null
+++ b/arch/mips/mach-xburst/include/mach/debug_ll_jz4750d.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2013 Antony Pavlov <antonynpavlov@gmail.com>
+ *
+ * This file is part of barebox.
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * 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.
+ *
+ * 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 __INCLUDE_DEBUG_LL_JZ4750D_H__
+#define __INCLUDE_DEBUG_LL_JZ4750D_H__
+
+#include <mach/jz4750d_regs.h>
+
+#ifdef CONFIG_JZ4750D_DEBUG_LL_UART0
+#define DEBUG_LL_UART_ADDR	UART0_BASE
+#endif
+
+#ifdef CONFIG_JZ4750D_DEBUG_LL_UART1
+#define DEBUG_LL_UART_ADDR	UART1_BASE
+#endif
+
+#ifdef CONFIG_JZ4750D_DEBUG_LL_UART2
+#define DEBUG_LL_UART_ADDR	UART2_BASE
+#endif
+
+#define DEBUG_LL_UART_SHIFT	2
+
+#endif /* __INCLUDE_DEBUG_LL_JZ4750D_H__ */
diff --git a/arch/mips/mach-xburst/include/mach/jz4750d_regs.h b/arch/mips/mach-xburst/include/mach/jz4750d_regs.h
index eafdd2f..7a3daad 100644
--- a/arch/mips/mach-xburst/include/mach/jz4750d_regs.h
+++ b/arch/mips/mach-xburst/include/mach/jz4750d_regs.h
@@ -16,7 +16,9 @@
 #define TCU_BASE        0xb0002000
 #define WDT_BASE        0xb0002000
 #define RTC_BASE        0xb0003000
+#define UART0_BASE      0xb0030000
 #define UART1_BASE      0xb0031000
+#define UART2_BASE      0xb0032000
 
 /*************************************************************************
  * TCU (Timer Counter Unit)
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/6] MIPS: pbl: add low-level debug asm macros for ns16550
  2013-06-01  7:52 [PATCH 0/6] MIPS: rework ns16550 debug_ll Antony Pavlov
  2013-06-01  7:52 ` [PATCH 1/6] MIPS: XBurst: use mach-specific debug_ll setup Antony Pavlov
@ 2013-06-01  7:52 ` Antony Pavlov
  2013-06-01  7:52 ` [PATCH 3/6] MIPS: rzx50: pbl: use debug_ll Antony Pavlov
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Antony Pavlov @ 2013-06-01  7:52 UTC (permalink / raw)
  To: barebox

This patch adds macros for ns16550 port initialisation
and single char output. The macros can be used in
MIPS asm pbl code.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/include/asm/debug_ll_ns16550.h |  100 ++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)
 create mode 100644 arch/mips/include/asm/debug_ll_ns16550.h

diff --git a/arch/mips/include/asm/debug_ll_ns16550.h b/arch/mips/include/asm/debug_ll_ns16550.h
new file mode 100644
index 0000000..5dd1b39
--- /dev/null
+++ b/arch/mips/include/asm/debug_ll_ns16550.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2012, 2013 Antony Pavlov <antonynpavlov@gmail.com>
+ *
+ * This file is part of barebox.
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+/** @file
+ *  This file contains declaration for early output support
+ */
+#ifndef __INCLUDE_MIPS_ASM_DEBUG_LL_NS16550_H__
+#define __INCLUDE_MIPS_ASM_DEBUG_LL_NS16550_H__
+
+#ifdef CONFIG_DEBUG_LL
+
+#ifndef DEBUG_LL_UART_ADDR
+#error DEBUG_LL_UART_ADDR is undefined!
+#endif
+
+#ifndef DEBUG_LL_UART_SHIFT
+#error DEBUG_LL_UART_SHIFT is undefined!
+#endif
+
+#ifndef DEBUG_LL_UART_DIVISOR
+#error DEBUG_LL_UART_DIVISOR is undefined!
+#endif
+
+#endif /* CONFIG_DEBUG_LL */
+
+#define UART_THR	(0x0 << DEBUG_LL_UART_SHIFT)
+#define UART_DLL	(0x0 << DEBUG_LL_UART_SHIFT)
+#define UART_DLM	(0x1 << DEBUG_LL_UART_SHIFT)
+#define UART_LCR	(0x3 << DEBUG_LL_UART_SHIFT)
+#define UART_LSR	(0x5 << DEBUG_LL_UART_SHIFT)
+
+#define UART_LCR_W	0x07		/* Set UART to 8,N,2 & DLAB = 0 */
+#define UART_LCR_DLAB	0x87	/* Set UART to 8,N,2 & DLAB = 1 */
+
+#define UART_LSR_THRE	0x20	/* Xmit holding register empty */
+
+/*
+ * Macros for use in assembly language code
+ */
+
+.macro	debug_ll_ns16550_init
+#ifdef CONFIG_DEBUG_LL
+	la	t0, DEBUG_LL_UART_ADDR
+
+	li	t1, UART_LCR_DLAB		/* DLAB on */
+	sb	t1, UART_LCR(t0)		/* Write it out */
+
+	li	t1, DEBUG_LL_UART_DIVISOR
+	sb	t1, UART_DLL(t0)		/* write low order byte */
+	srl	t1, t1, 8
+	sb	t1, UART_DLM(t0)		/* write high order byte */
+
+	li	t1, UART_LCR_W			/* DLAB off */
+	sb	t1, UART_LCR(t0)		/* Write it out */
+#endif /* CONFIG_DEBUG_LL */
+.endm
+
+/*
+ * output a character in a0
+ */
+.macro	debug_ll_ns16550_outc chr
+#ifdef CONFIG_DEBUG_LL
+	li	a0, \chr
+	la	t0, DEBUG_LL_UART_ADDR
+
+1:	lbu	t1, UART_LSR(t0)	/* get line status */
+	nop
+	andi	t1, t1, UART_LSR_THRE	/* check for transmitter empty */
+	beqz	t1, 1b			/* try again */
+	 nop
+
+	sb	a0, UART_THR(t0)	/* write the character */
+#endif /* CONFIG_DEBUG_LL */
+.endm
+
+/*
+ * output CR + NL
+ */
+.macro	debug_ll_ns16550_outnl
+#ifdef CONFIG_DEBUG_LL
+	debug_ll_ns16550_outc '\r'
+	debug_ll_ns16550_outc '\n'
+#endif /* CONFIG_DEBUG_LL */
+.endm
+
+#endif /* __INCLUDE_MIPS_ASM_DEBUG_LL_NS16550_H__ */
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/6] MIPS: rzx50: pbl: use debug_ll
  2013-06-01  7:52 [PATCH 0/6] MIPS: rework ns16550 debug_ll Antony Pavlov
  2013-06-01  7:52 ` [PATCH 1/6] MIPS: XBurst: use mach-specific debug_ll setup Antony Pavlov
  2013-06-01  7:52 ` [PATCH 2/6] MIPS: pbl: add low-level debug asm macros for ns16550 Antony Pavlov
@ 2013-06-01  7:52 ` Antony Pavlov
  2013-06-03  7:31   ` Sascha Hauer
  2013-06-01  7:52 ` [PATCH 4/6] MIPS: rzx50_defconfig: use UART1 for low-level debug Antony Pavlov
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Antony Pavlov @ 2013-06-01  7:52 UTC (permalink / raw)
  To: barebox

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/boards/rzx50/include/board/board_pbl_start.h |    6 ++++++
 arch/mips/mach-xburst/include/mach/debug_ll_jz4750d.h  |    4 ++++
 2 files changed, 10 insertions(+)

diff --git a/arch/mips/boards/rzx50/include/board/board_pbl_start.h b/arch/mips/boards/rzx50/include/board/board_pbl_start.h
index cba3e7f..f71641a 100644
--- a/arch/mips/boards/rzx50/include/board/board_pbl_start.h
+++ b/arch/mips/boards/rzx50/include/board/board_pbl_start.h
@@ -18,6 +18,7 @@
  */
 
 #include <asm/pbl_macros.h>
+#include <mach/debug_ll.h>
 
 	.macro	board_pbl_start
 	.set	push
@@ -28,6 +29,11 @@
 	/* CPU/SoC specific setup ... */
 	/* ... absent */
 
+	debug_ll_ns16550_init
+
+	debug_ll_ns16550_outc '.'
+	debug_ll_ns16550_outnl
+
 	copy_to_link_location	pbl_start
 
 	.set	pop
diff --git a/arch/mips/mach-xburst/include/mach/debug_ll_jz4750d.h b/arch/mips/mach-xburst/include/mach/debug_ll_jz4750d.h
index 7bf66b1..2a55dea 100644
--- a/arch/mips/mach-xburst/include/mach/debug_ll_jz4750d.h
+++ b/arch/mips/mach-xburst/include/mach/debug_ll_jz4750d.h
@@ -34,4 +34,8 @@
 
 #define DEBUG_LL_UART_SHIFT	2
 
+#define DEBUG_LL_UART_CLK	(12000000 / 16)
+#define DEBUG_LL_UART_BPS	CONFIG_BAUDRATE
+#define DEBUG_LL_UART_DIVISOR	(DEBUG_LL_UART_CLK / DEBUG_LL_UART_BPS)
+
 #endif /* __INCLUDE_DEBUG_LL_JZ4750D_H__ */
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 4/6] MIPS: rzx50_defconfig: use UART1 for low-level debug
  2013-06-01  7:52 [PATCH 0/6] MIPS: rework ns16550 debug_ll Antony Pavlov
                   ` (2 preceding siblings ...)
  2013-06-01  7:52 ` [PATCH 3/6] MIPS: rzx50: pbl: use debug_ll Antony Pavlov
@ 2013-06-01  7:52 ` Antony Pavlov
  2013-06-01  7:52 ` [PATCH 5/6] MIPS: malta: adapt for new debug_ll Antony Pavlov
  2013-06-01  7:52 ` [PATCH 6/6] MIPS: unificate ns16550 debug_ll support code Antony Pavlov
  5 siblings, 0 replies; 11+ messages in thread
From: Antony Pavlov @ 2013-06-01  7:52 UTC (permalink / raw)
  To: barebox

By default CONFIG_JZ4750D_DEBUG_LL_UART0 is selected.
This can confuse the Ritmix RZX50 user as the board
has only UART1 connected.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/configs/rzx50_defconfig |    1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/configs/rzx50_defconfig b/arch/mips/configs/rzx50_defconfig
index 5d994c7..7b75909 100644
--- a/arch/mips/configs/rzx50_defconfig
+++ b/arch/mips/configs/rzx50_defconfig
@@ -1,4 +1,5 @@
 CONFIG_MACH_MIPS_XBURST=y
+CONFIG_JZ4750D_DEBUG_LL_UART1=y
 CONFIG_PBL_IMAGE=y
 CONFIG_BAUDRATE=57600
 CONFIG_GLOB=y
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 5/6] MIPS: malta: adapt for new debug_ll
  2013-06-01  7:52 [PATCH 0/6] MIPS: rework ns16550 debug_ll Antony Pavlov
                   ` (3 preceding siblings ...)
  2013-06-01  7:52 ` [PATCH 4/6] MIPS: rzx50_defconfig: use UART1 for low-level debug Antony Pavlov
@ 2013-06-01  7:52 ` Antony Pavlov
  2013-06-01  7:52 ` [PATCH 6/6] MIPS: unificate ns16550 debug_ll support code Antony Pavlov
  5 siblings, 0 replies; 11+ messages in thread
From: Antony Pavlov @ 2013-06-01  7:52 UTC (permalink / raw)
  To: barebox

Set fake DEBUG_LL_UART_DIVISOR to use <asm/debug_ll_ns16550.h>.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/mach-malta/include/mach/hardware.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/mach-malta/include/mach/hardware.h b/arch/mips/mach-malta/include/mach/hardware.h
index 5e8e276..8bd814d 100644
--- a/arch/mips/mach-malta/include/mach/hardware.h
+++ b/arch/mips/mach-malta/include/mach/hardware.h
@@ -20,6 +20,7 @@
 
 #define DEBUG_LL_UART_ADDR	0xb00003f8
 #define DEBUG_LL_UART_SHIFT	0
+#define DEBUG_LL_UART_DIVISOR	1	/* no matter for emulated port */
 
 /*
  * Reset register.
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 6/6] MIPS: unificate ns16550 debug_ll support code
  2013-06-01  7:52 [PATCH 0/6] MIPS: rework ns16550 debug_ll Antony Pavlov
                   ` (4 preceding siblings ...)
  2013-06-01  7:52 ` [PATCH 5/6] MIPS: malta: adapt for new debug_ll Antony Pavlov
@ 2013-06-01  7:52 ` Antony Pavlov
  2013-06-01  8:07   ` antonynpavlov
  5 siblings, 1 reply; 11+ messages in thread
From: Antony Pavlov @ 2013-06-01  7:52 UTC (permalink / raw)
  To: barebox

This commit moves the C debug_ll code from
the MIPS <debug_ll_ns16550.h> header file to
the MIPS <asm/debug_ll_ns16550.h> header file,
so the C code and the asm code can use the same
register address macros.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/include/asm/debug_ll_ns16550.h      |   15 ++++++++++
 arch/mips/include/debug_ll_ns16550.h          |   37 -------------------------
 arch/mips/mach-malta/include/mach/debug_ll.h  |    2 +-
 arch/mips/mach-xburst/include/mach/debug_ll.h |    2 +-
 4 files changed, 17 insertions(+), 39 deletions(-)
 delete mode 100644 arch/mips/include/debug_ll_ns16550.h

diff --git a/arch/mips/include/asm/debug_ll_ns16550.h b/arch/mips/include/asm/debug_ll_ns16550.h
index 5dd1b39..f00f348 100644
--- a/arch/mips/include/asm/debug_ll_ns16550.h
+++ b/arch/mips/include/asm/debug_ll_ns16550.h
@@ -48,6 +48,20 @@
 
 #define UART_LSR_THRE	0x20	/* Xmit holding register empty */
 
+#ifndef __ASSEMBLY__
+/*
+ * C macros
+ */
+
+#include <asm/io.h>
+
+static __inline__ void PUTC_LL(char ch)
+{
+	while (!(__raw_readb((u8 *)DEBUG_LL_UART_ADDR + UART_LSR) & UART_LSR_THRE))
+		;
+	__raw_writeb(ch, (u8 *)DEBUG_LL_UART_ADDR + UART_THR);
+}
+#else /* __ASSEMBLY__ */
 /*
  * Macros for use in assembly language code
  */
@@ -96,5 +110,6 @@
 	debug_ll_ns16550_outc '\n'
 #endif /* CONFIG_DEBUG_LL */
 .endm
+#endif /* __ASSEMBLY__ */
 
 #endif /* __INCLUDE_MIPS_ASM_DEBUG_LL_NS16550_H__ */
diff --git a/arch/mips/include/debug_ll_ns16550.h b/arch/mips/include/debug_ll_ns16550.h
deleted file mode 100644
index e9c7ecf..0000000
--- a/arch/mips/include/debug_ll_ns16550.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 Antony Pavlov <antonynpavlov@gmail.com>
- *
- * This file is part of barebox.
- * See file CREDITS for list of people who contributed to this project.
- *
- * 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.
- *
- * 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.
- *
- */
-
-/** @file
- *  This file contains declaration for early output support
- */
-#ifndef __INCLUDE_ARCH_DEBUG_LL_NS16550_H__
-#define __INCLUDE_ARCH_DEBUG_LL_NS16550_H__
-
-#include <asm/io.h>
-
-#define rbr		(0 << DEBUG_LL_UART_SHIFT)
-#define lsr		(5 << DEBUG_LL_UART_SHIFT)
-
-#define LSR_THRE	0x20	/* Xmit holding register empty */
-
-static __inline__ void PUTC_LL(char ch)
-{
-	while (!(__raw_readb((u8 *)DEBUG_LL_UART_ADDR + lsr) & LSR_THRE));
-	__raw_writeb(ch, (u8 *)DEBUG_LL_UART_ADDR + rbr);
-}
-
-#endif  /* __INCLUDE_ARCH_DEBUG_LL_NS16550_H__ */
diff --git a/arch/mips/mach-malta/include/mach/debug_ll.h b/arch/mips/mach-malta/include/mach/debug_ll.h
index 3a91c93..3e8b01b 100644
--- a/arch/mips/mach-malta/include/mach/debug_ll.h
+++ b/arch/mips/mach-malta/include/mach/debug_ll.h
@@ -23,6 +23,6 @@
 
 #include <mach/hardware.h>
 
-#include <debug_ll_ns16550.h>
+#include <asm/debug_ll_ns16550.h>
 
 #endif  /* __INCLUDE_ARCH_DEBUG_LL_H__ */
diff --git a/arch/mips/mach-xburst/include/mach/debug_ll.h b/arch/mips/mach-xburst/include/mach/debug_ll.h
index f260e65..6c3c980 100644
--- a/arch/mips/mach-xburst/include/mach/debug_ll.h
+++ b/arch/mips/mach-xburst/include/mach/debug_ll.h
@@ -22,6 +22,6 @@
  *  This File contains declaration for early output support
  */
 #include <board/debug_ll.h>
-#include <debug_ll_ns16550.h>
+#include <asm/debug_ll_ns16550.h>
 
 #endif  /* __MACH_XBURST_DEBUG_LL__ */
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 6/6] MIPS: unificate ns16550 debug_ll support code
  2013-06-01  7:52 ` [PATCH 6/6] MIPS: unificate ns16550 debug_ll support code Antony Pavlov
@ 2013-06-01  8:07   ` antonynpavlov
  2013-06-02  9:25     ` Sascha Hauer
  0 siblings, 1 reply; 11+ messages in thread
From: antonynpavlov @ 2013-06-01  8:07 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On Sat,  1 Jun 2013 11:52:49 +0400
Antony Pavlov <antonynpavlov@gmail.com> wrote:

Sorry, not "unificate" but "unify".

> This commit moves the C debug_ll code from
> the MIPS <debug_ll_ns16550.h> header file to
> the MIPS <asm/debug_ll_ns16550.h> header file,
> so the C code and the asm code can use the same
> register address macros.
> 
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
>  arch/mips/include/asm/debug_ll_ns16550.h      |   15 ++++++++++
>  arch/mips/include/debug_ll_ns16550.h          |   37 -------------------------
>  arch/mips/mach-malta/include/mach/debug_ll.h  |    2 +-
>  arch/mips/mach-xburst/include/mach/debug_ll.h |    2 +-
>  4 files changed, 17 insertions(+), 39 deletions(-)
>  delete mode 100644 arch/mips/include/debug_ll_ns16550.h
> 
> diff --git a/arch/mips/include/asm/debug_ll_ns16550.h b/arch/mips/include/asm/debug_ll_ns16550.h
> index 5dd1b39..f00f348 100644
> --- a/arch/mips/include/asm/debug_ll_ns16550.h
> +++ b/arch/mips/include/asm/debug_ll_ns16550.h
> @@ -48,6 +48,20 @@
>  
>  #define UART_LSR_THRE	0x20	/* Xmit holding register empty */
>  
> +#ifndef __ASSEMBLY__
> +/*
> + * C macros
> + */
> +
> +#include <asm/io.h>
> +
> +static __inline__ void PUTC_LL(char ch)
> +{
> +	while (!(__raw_readb((u8 *)DEBUG_LL_UART_ADDR + UART_LSR) & UART_LSR_THRE))
> +		;
> +	__raw_writeb(ch, (u8 *)DEBUG_LL_UART_ADDR + UART_THR);
> +}
> +#else /* __ASSEMBLY__ */
>  /*
>   * Macros for use in assembly language code
>   */
> @@ -96,5 +110,6 @@
>  	debug_ll_ns16550_outc '\n'
>  #endif /* CONFIG_DEBUG_LL */
>  .endm
> +#endif /* __ASSEMBLY__ */
>  
>  #endif /* __INCLUDE_MIPS_ASM_DEBUG_LL_NS16550_H__ */
> diff --git a/arch/mips/include/debug_ll_ns16550.h b/arch/mips/include/debug_ll_ns16550.h
> deleted file mode 100644
> index e9c7ecf..0000000
> --- a/arch/mips/include/debug_ll_ns16550.h
> +++ /dev/null
> @@ -1,37 +0,0 @@
> -/*
> - * Copyright (C) 2012 Antony Pavlov <antonynpavlov@gmail.com>
> - *
> - * This file is part of barebox.
> - * See file CREDITS for list of people who contributed to this project.
> - *
> - * 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.
> - *
> - * 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.
> - *
> - */
> -
> -/** @file
> - *  This file contains declaration for early output support
> - */
> -#ifndef __INCLUDE_ARCH_DEBUG_LL_NS16550_H__
> -#define __INCLUDE_ARCH_DEBUG_LL_NS16550_H__
> -
> -#include <asm/io.h>
> -
> -#define rbr		(0 << DEBUG_LL_UART_SHIFT)
> -#define lsr		(5 << DEBUG_LL_UART_SHIFT)
> -
> -#define LSR_THRE	0x20	/* Xmit holding register empty */
> -
> -static __inline__ void PUTC_LL(char ch)
> -{
> -	while (!(__raw_readb((u8 *)DEBUG_LL_UART_ADDR + lsr) & LSR_THRE));
> -	__raw_writeb(ch, (u8 *)DEBUG_LL_UART_ADDR + rbr);
> -}
> -
> -#endif  /* __INCLUDE_ARCH_DEBUG_LL_NS16550_H__ */
> diff --git a/arch/mips/mach-malta/include/mach/debug_ll.h b/arch/mips/mach-malta/include/mach/debug_ll.h
> index 3a91c93..3e8b01b 100644
> --- a/arch/mips/mach-malta/include/mach/debug_ll.h
> +++ b/arch/mips/mach-malta/include/mach/debug_ll.h
> @@ -23,6 +23,6 @@
>  
>  #include <mach/hardware.h>
>  
> -#include <debug_ll_ns16550.h>
> +#include <asm/debug_ll_ns16550.h>
>  
>  #endif  /* __INCLUDE_ARCH_DEBUG_LL_H__ */
> diff --git a/arch/mips/mach-xburst/include/mach/debug_ll.h b/arch/mips/mach-xburst/include/mach/debug_ll.h
> index f260e65..6c3c980 100644
> --- a/arch/mips/mach-xburst/include/mach/debug_ll.h
> +++ b/arch/mips/mach-xburst/include/mach/debug_ll.h
> @@ -22,6 +22,6 @@
>   *  This File contains declaration for early output support
>   */
>  #include <board/debug_ll.h>
> -#include <debug_ll_ns16550.h>
> +#include <asm/debug_ll_ns16550.h>
>  
>  #endif  /* __MACH_XBURST_DEBUG_LL__ */
> -- 
> 1.7.10.4
> 


-- 
-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 6/6] MIPS: unificate ns16550 debug_ll support code
  2013-06-01  8:07   ` antonynpavlov
@ 2013-06-02  9:25     ` Sascha Hauer
  0 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2013-06-02  9:25 UTC (permalink / raw)
  To: antonynpavlov; +Cc: barebox

On Sat, Jun 01, 2013 at 12:07:48PM +0400, antonynpavlov@gmail.com wrote:
> On Sat,  1 Jun 2013 11:52:49 +0400
> Antony Pavlov <antonynpavlov@gmail.com> wrote:
> 
> Sorry, not "unificate" but "unify".

Fixed this while applying.

Thanks
 Sascha

> 
> > This commit moves the C debug_ll code from
> > the MIPS <debug_ll_ns16550.h> header file to
> > the MIPS <asm/debug_ll_ns16550.h> header file,
> > so the C code and the asm code can use the same
> > register address macros.
> > 
> > Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> > ---
> >  arch/mips/include/asm/debug_ll_ns16550.h      |   15 ++++++++++
> >  arch/mips/include/debug_ll_ns16550.h          |   37 -------------------------
> >  arch/mips/mach-malta/include/mach/debug_ll.h  |    2 +-
> >  arch/mips/mach-xburst/include/mach/debug_ll.h |    2 +-
> >  4 files changed, 17 insertions(+), 39 deletions(-)
> >  delete mode 100644 arch/mips/include/debug_ll_ns16550.h
> > 
> > diff --git a/arch/mips/include/asm/debug_ll_ns16550.h b/arch/mips/include/asm/debug_ll_ns16550.h
> > index 5dd1b39..f00f348 100644
> > --- a/arch/mips/include/asm/debug_ll_ns16550.h
> > +++ b/arch/mips/include/asm/debug_ll_ns16550.h
> > @@ -48,6 +48,20 @@
> >  
> >  #define UART_LSR_THRE	0x20	/* Xmit holding register empty */
> >  
> > +#ifndef __ASSEMBLY__
> > +/*
> > + * C macros
> > + */
> > +
> > +#include <asm/io.h>
> > +
> > +static __inline__ void PUTC_LL(char ch)
> > +{
> > +	while (!(__raw_readb((u8 *)DEBUG_LL_UART_ADDR + UART_LSR) & UART_LSR_THRE))
> > +		;
> > +	__raw_writeb(ch, (u8 *)DEBUG_LL_UART_ADDR + UART_THR);
> > +}
> > +#else /* __ASSEMBLY__ */
> >  /*
> >   * Macros for use in assembly language code
> >   */
> > @@ -96,5 +110,6 @@
> >  	debug_ll_ns16550_outc '\n'
> >  #endif /* CONFIG_DEBUG_LL */
> >  .endm
> > +#endif /* __ASSEMBLY__ */
> >  
> >  #endif /* __INCLUDE_MIPS_ASM_DEBUG_LL_NS16550_H__ */
> > diff --git a/arch/mips/include/debug_ll_ns16550.h b/arch/mips/include/debug_ll_ns16550.h
> > deleted file mode 100644
> > index e9c7ecf..0000000
> > --- a/arch/mips/include/debug_ll_ns16550.h
> > +++ /dev/null
> > @@ -1,37 +0,0 @@
> > -/*
> > - * Copyright (C) 2012 Antony Pavlov <antonynpavlov@gmail.com>
> > - *
> > - * This file is part of barebox.
> > - * See file CREDITS for list of people who contributed to this project.
> > - *
> > - * 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.
> > - *
> > - * 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.
> > - *
> > - */
> > -
> > -/** @file
> > - *  This file contains declaration for early output support
> > - */
> > -#ifndef __INCLUDE_ARCH_DEBUG_LL_NS16550_H__
> > -#define __INCLUDE_ARCH_DEBUG_LL_NS16550_H__
> > -
> > -#include <asm/io.h>
> > -
> > -#define rbr		(0 << DEBUG_LL_UART_SHIFT)
> > -#define lsr		(5 << DEBUG_LL_UART_SHIFT)
> > -
> > -#define LSR_THRE	0x20	/* Xmit holding register empty */
> > -
> > -static __inline__ void PUTC_LL(char ch)
> > -{
> > -	while (!(__raw_readb((u8 *)DEBUG_LL_UART_ADDR + lsr) & LSR_THRE));
> > -	__raw_writeb(ch, (u8 *)DEBUG_LL_UART_ADDR + rbr);
> > -}
> > -
> > -#endif  /* __INCLUDE_ARCH_DEBUG_LL_NS16550_H__ */
> > diff --git a/arch/mips/mach-malta/include/mach/debug_ll.h b/arch/mips/mach-malta/include/mach/debug_ll.h
> > index 3a91c93..3e8b01b 100644
> > --- a/arch/mips/mach-malta/include/mach/debug_ll.h
> > +++ b/arch/mips/mach-malta/include/mach/debug_ll.h
> > @@ -23,6 +23,6 @@
> >  
> >  #include <mach/hardware.h>
> >  
> > -#include <debug_ll_ns16550.h>
> > +#include <asm/debug_ll_ns16550.h>
> >  
> >  #endif  /* __INCLUDE_ARCH_DEBUG_LL_H__ */
> > diff --git a/arch/mips/mach-xburst/include/mach/debug_ll.h b/arch/mips/mach-xburst/include/mach/debug_ll.h
> > index f260e65..6c3c980 100644
> > --- a/arch/mips/mach-xburst/include/mach/debug_ll.h
> > +++ b/arch/mips/mach-xburst/include/mach/debug_ll.h
> > @@ -22,6 +22,6 @@
> >   *  This File contains declaration for early output support
> >   */
> >  #include <board/debug_ll.h>
> > -#include <debug_ll_ns16550.h>
> > +#include <asm/debug_ll_ns16550.h>
> >  
> >  #endif  /* __MACH_XBURST_DEBUG_LL__ */
> > -- 
> > 1.7.10.4
> > 
> 
> 
> -- 
> -- 
> Best regards,
>   Antony Pavlov
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 3/6] MIPS: rzx50: pbl: use debug_ll
  2013-06-01  7:52 ` [PATCH 3/6] MIPS: rzx50: pbl: use debug_ll Antony Pavlov
@ 2013-06-03  7:31   ` Sascha Hauer
  2013-06-03  7:46     ` antonynpavlov
  0 siblings, 1 reply; 11+ messages in thread
From: Sascha Hauer @ 2013-06-03  7:31 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Sat, Jun 01, 2013 at 11:52:46AM +0400, Antony Pavlov wrote:
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
>  arch/mips/boards/rzx50/include/board/board_pbl_start.h |    6 ++++++
>  arch/mips/mach-xburst/include/mach/debug_ll_jz4750d.h  |    4 ++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/arch/mips/boards/rzx50/include/board/board_pbl_start.h b/arch/mips/boards/rzx50/include/board/board_pbl_start.h
> index cba3e7f..f71641a 100644
> --- a/arch/mips/boards/rzx50/include/board/board_pbl_start.h
> +++ b/arch/mips/boards/rzx50/include/board/board_pbl_start.h
> @@ -18,6 +18,7 @@
>   */
>  
>  #include <asm/pbl_macros.h>
> +#include <mach/debug_ll.h>
>  
>  	.macro	board_pbl_start
>  	.set	push
> @@ -28,6 +29,11 @@
>  	/* CPU/SoC specific setup ... */
>  	/* ... absent */
>  
> +	debug_ll_ns16550_init
> +
> +	debug_ll_ns16550_outc '.'
> +	debug_ll_ns16550_outnl
> +
>  	copy_to_link_location	pbl_start

I had to drop this series beginning from this patch as it breaks
bisectibility. There seem to be some C stuff leaking in to the
assembler. I tried to fix this myself but I wasn't really sure what to
to. Could you update this based on current master?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 3/6] MIPS: rzx50: pbl: use debug_ll
  2013-06-03  7:31   ` Sascha Hauer
@ 2013-06-03  7:46     ` antonynpavlov
  0 siblings, 0 replies; 11+ messages in thread
From: antonynpavlov @ 2013-06-03  7:46 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On Mon, 3 Jun 2013 09:31:32 +0200
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> On Sat, Jun 01, 2013 at 11:52:46AM +0400, Antony Pavlov wrote:
> > Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> > ---
> >  arch/mips/boards/rzx50/include/board/board_pbl_start.h |    6 ++++++
> >  arch/mips/mach-xburst/include/mach/debug_ll_jz4750d.h  |    4 ++++
> >  2 files changed, 10 insertions(+)
> > 
> > diff --git a/arch/mips/boards/rzx50/include/board/board_pbl_start.h b/arch/mips/boards/rzx50/include/board/board_pbl_start.h
> > index cba3e7f..f71641a 100644
> > --- a/arch/mips/boards/rzx50/include/board/board_pbl_start.h
> > +++ b/arch/mips/boards/rzx50/include/board/board_pbl_start.h
> > @@ -18,6 +18,7 @@
> >   */
> >  
> >  #include <asm/pbl_macros.h>
> > +#include <mach/debug_ll.h>
> >  
> >  	.macro	board_pbl_start
> >  	.set	push
> > @@ -28,6 +29,11 @@
> >  	/* CPU/SoC specific setup ... */
> >  	/* ... absent */
> >  
> > +	debug_ll_ns16550_init
> > +
> > +	debug_ll_ns16550_outc '.'
> > +	debug_ll_ns16550_outnl
> > +
> >  	copy_to_link_location	pbl_start
> 
> I had to drop this series beginning from this patch as it breaks
> bisectibility. There seem to be some C stuff leaking in to the
> assembler.

Yes, I have moved the similar C and asm stuff to one place.

> I tried to fix this myself but I wasn't really sure what to
> to. Could you update this based on current master?

Hmm, I used the 'next' branch as the base for this patches.

I'll update the patches in a few hours.

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2013-06-03  7:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-01  7:52 [PATCH 0/6] MIPS: rework ns16550 debug_ll Antony Pavlov
2013-06-01  7:52 ` [PATCH 1/6] MIPS: XBurst: use mach-specific debug_ll setup Antony Pavlov
2013-06-01  7:52 ` [PATCH 2/6] MIPS: pbl: add low-level debug asm macros for ns16550 Antony Pavlov
2013-06-01  7:52 ` [PATCH 3/6] MIPS: rzx50: pbl: use debug_ll Antony Pavlov
2013-06-03  7:31   ` Sascha Hauer
2013-06-03  7:46     ` antonynpavlov
2013-06-01  7:52 ` [PATCH 4/6] MIPS: rzx50_defconfig: use UART1 for low-level debug Antony Pavlov
2013-06-01  7:52 ` [PATCH 5/6] MIPS: malta: adapt for new debug_ll Antony Pavlov
2013-06-01  7:52 ` [PATCH 6/6] MIPS: unificate ns16550 debug_ll support code Antony Pavlov
2013-06-01  8:07   ` antonynpavlov
2013-06-02  9:25     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox