mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 0/5] MIPS: rework ns16550 debug_ll
@ 2013-06-03 10:53 Antony Pavlov
  2013-06-03 10:53 ` [PATCH v2 1/5] MIPS: rzx50: prepare for new debug_ll Antony Pavlov
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Antony Pavlov @ 2013-06-03 10:53 UTC (permalink / raw)
  To: barebox

This patch series makes possible easely produce
debug output via ns16550-like UART on very early pbl stage.

v2 patch series is based on the 'master' branch
and it does not break bisectibility.

[PATCH v2 1/5] MIPS: rzx50: prepare for new debug_ll
[PATCH v2 2/5] MIPS: malta: prepare for new debug_ll
[PATCH v2 3/5] MIPS: unify ns16550 debug_ll support code
[PATCH v2 4/5] MIPS: rzx50: pbl: use debug_ll
[PATCH v2 5/5] MIPS: rzx50_defconfig: use UART1 for low-level debug

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

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

* [PATCH v2 1/5] MIPS: rzx50: prepare for new debug_ll
  2013-06-03 10:53 [PATCH v2 0/5] MIPS: rework ns16550 debug_ll Antony Pavlov
@ 2013-06-03 10:53 ` Antony Pavlov
  2013-06-03 10:53 ` [PATCH v2 2/5] MIPS: malta: " Antony Pavlov
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Antony Pavlov @ 2013-06-03 10:53 UTC (permalink / raw)
  To: barebox

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

The JZ4755 uses 24 MHz as the main reference frequency (EXCLK).
The UART controller can work on full EXCLK or on EXCLK/2.
Just now we use EXCLK/2 legacy clock setup made by U-Boot.
So set UART controller base frequency to 12 MHz.

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

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] 7+ messages in thread

* [PATCH v2 2/5] MIPS: malta: prepare for new debug_ll
  2013-06-03 10:53 [PATCH v2 0/5] MIPS: rework ns16550 debug_ll Antony Pavlov
  2013-06-03 10:53 ` [PATCH v2 1/5] MIPS: rzx50: prepare for new debug_ll Antony Pavlov
@ 2013-06-03 10:53 ` Antony Pavlov
  2013-06-03 10:53 ` [PATCH v2 3/5] MIPS: unify ns16550 debug_ll support code Antony Pavlov
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Antony Pavlov @ 2013-06-03 10:53 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] 7+ messages in thread

* [PATCH v2 3/5] MIPS: unify ns16550 debug_ll support code
  2013-06-03 10:53 [PATCH v2 0/5] MIPS: rework ns16550 debug_ll Antony Pavlov
  2013-06-03 10:53 ` [PATCH v2 1/5] MIPS: rzx50: prepare for new debug_ll Antony Pavlov
  2013-06-03 10:53 ` [PATCH v2 2/5] MIPS: malta: " Antony Pavlov
@ 2013-06-03 10:53 ` Antony Pavlov
  2013-06-03 10:53 ` [PATCH v2 4/5] MIPS: rzx50: pbl: use debug_ll Antony Pavlov
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Antony Pavlov @ 2013-06-03 10:53 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] 7+ messages in thread

* [PATCH v2 4/5] MIPS: rzx50: pbl: use debug_ll
  2013-06-03 10:53 [PATCH v2 0/5] MIPS: rework ns16550 debug_ll Antony Pavlov
                   ` (2 preceding siblings ...)
  2013-06-03 10:53 ` [PATCH v2 3/5] MIPS: unify ns16550 debug_ll support code Antony Pavlov
@ 2013-06-03 10:53 ` Antony Pavlov
  2013-06-03 10:53 ` [PATCH v2 5/5] MIPS: rzx50_defconfig: use UART1 for low-level debug Antony Pavlov
  2013-06-04  7:03 ` [PATCH v2 0/5] MIPS: rework ns16550 debug_ll Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Antony Pavlov @ 2013-06-03 10:53 UTC (permalink / raw)
  To: barebox

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/boards/rzx50/include/board/board_pbl_start.h |    6 ++++++
 1 file changed, 6 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
-- 
1.7.10.4


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

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

* [PATCH v2 5/5] MIPS: rzx50_defconfig: use UART1 for low-level debug
  2013-06-03 10:53 [PATCH v2 0/5] MIPS: rework ns16550 debug_ll Antony Pavlov
                   ` (3 preceding siblings ...)
  2013-06-03 10:53 ` [PATCH v2 4/5] MIPS: rzx50: pbl: use debug_ll Antony Pavlov
@ 2013-06-03 10:53 ` Antony Pavlov
  2013-06-04  7:03 ` [PATCH v2 0/5] MIPS: rework ns16550 debug_ll Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Antony Pavlov @ 2013-06-03 10:53 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] 7+ messages in thread

* Re: [PATCH v2 0/5] MIPS: rework ns16550 debug_ll
  2013-06-03 10:53 [PATCH v2 0/5] MIPS: rework ns16550 debug_ll Antony Pavlov
                   ` (4 preceding siblings ...)
  2013-06-03 10:53 ` [PATCH v2 5/5] MIPS: rzx50_defconfig: use UART1 for low-level debug Antony Pavlov
@ 2013-06-04  7:03 ` Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2013-06-04  7:03 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Mon, Jun 03, 2013 at 02:53:22PM +0400, Antony Pavlov wrote:
> This patch series makes possible easely produce
> debug output via ns16550-like UART on very early pbl stage.
> 
> v2 patch series is based on the 'master' branch
> and it does not break bisectibility.

Thanks for redoing this. Applied.

Sascha

> 
> [PATCH v2 1/5] MIPS: rzx50: prepare for new debug_ll
> [PATCH v2 2/5] MIPS: malta: prepare for new debug_ll
> [PATCH v2 3/5] MIPS: unify ns16550 debug_ll support code
> [PATCH v2 4/5] MIPS: rzx50: pbl: use debug_ll
> [PATCH v2 5/5] MIPS: rzx50_defconfig: use UART1 for low-level debug
> 

-- 
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] 7+ messages in thread

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-03 10:53 [PATCH v2 0/5] MIPS: rework ns16550 debug_ll Antony Pavlov
2013-06-03 10:53 ` [PATCH v2 1/5] MIPS: rzx50: prepare for new debug_ll Antony Pavlov
2013-06-03 10:53 ` [PATCH v2 2/5] MIPS: malta: " Antony Pavlov
2013-06-03 10:53 ` [PATCH v2 3/5] MIPS: unify ns16550 debug_ll support code Antony Pavlov
2013-06-03 10:53 ` [PATCH v2 4/5] MIPS: rzx50: pbl: use debug_ll Antony Pavlov
2013-06-03 10:53 ` [PATCH v2 5/5] MIPS: rzx50_defconfig: use UART1 for low-level debug Antony Pavlov
2013-06-04  7:03 ` [PATCH v2 0/5] MIPS: rework ns16550 debug_ll Sascha Hauer

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