Skip to contentSkip to conversation

MIPS: rework ns16550 debug_ll

PATCH In review Antony Pavlov 2 participants 7 messages Jun 3, 2013 – Jun 4, 2013 MIPS

lore
Share & tools
lore
#0 lore raw

v2 cover MIPS: rework ns16550 debug_ll

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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

PATCH v2 1/5 MIPS: rzx50: prepare for new debug_ll

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.

---
 arch/mips/mach-xburst/include/mach/debug_ll_jz4750d.h |    4 ++++
 1 file changed, 4 insertions(+)
arch/mips/mach-xburst/include/mach/debug_ll_jz4750d.h +4 -0
index 7bf66b1..2a55dea 100644
@@ -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__ */
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH v2 2/5 MIPS: malta: prepare for new debug_ll

In reply to Antony Pavlov

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

---
 arch/mips/mach-malta/include/mach/hardware.h |    1 +
 1 file changed, 1 insertion(+)
arch/mips/mach-malta/include/mach/hardware.h +1 -0
index 5e8e276..8bd814d 100644
@@ -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.
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH v2 3/5 MIPS: unify ns16550 debug_ll support code

In reply to Antony Pavlov

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.

---
 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
arch/mips/include/asm/debug_ll_ns16550.h +15 -0
index 5dd1b39..f00f348 100644
@@ -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__ */
arch/mips/include/debug_ll_ns16550.h deleted +0 -37
deleted file mode 100644
index e9c7ecf..0000000
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 Antony Pavlov <[email protected]>
- *
- * 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__ */
arch/mips/mach-malta/include/mach/debug_ll.h +1 -1
index 3a91c93..3e8b01b 100644
@@ -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__ */
arch/mips/mach-xburst/include/mach/debug_ll.h +1 -1
index f260e65..6c3c980 100644
@@ -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__ */
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH v2 4/5 MIPS: rzx50: pbl: use debug_ll

In reply to Antony Pavlov
---
 arch/mips/boards/rzx50/include/board/board_pbl_start.h |    6 ++++++
 1 file changed, 6 insertions(+)
arch/mips/boards/rzx50/include/board/board_pbl_start.h +6 -0
index cba3e7f..f71641a 100644
@@ -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
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH v2 5/5 MIPS: rzx50_defconfig: use UART1 for low-level debug

In reply to Antony Pavlov

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

---
 arch/mips/configs/rzx50_defconfig |    1 +
 1 file changed, 1 insertion(+)
arch/mips/configs/rzx50_defconfig +1 -0
index 5d994c7..7b75909 100644
@@ -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
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw
In reply to Antony Pavlov
Quoted 5 lines · Antony Pavlov

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

Quoted 7 lines

[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

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox