linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Jiaxun Yang <jiaxun.yang@flygoat.com>
Subject: [PATCH v2 7/9] MIPS: debug_ll: Implement support for AR933X uarts
Date: Tue, 26 Mar 2024 20:35:39 +0000	[thread overview]
Message-ID: <20240326-mips_debug_ll-v2-7-b64abc76f2a1@flygoat.com> (raw)
In-Reply-To: <20240326-mips_debug_ll-v2-0-b64abc76f2a1@flygoat.com>

Implement support for AR933X uarts which has it's own register
definition.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/mips/Kconfig.debug          |  9 +++++++++
 arch/mips/include/debug/ar933x.S | 41 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index aef116058654..a6687c503c34 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -265,6 +265,14 @@ choice
 		  Say Y here if you want kernel low-level debugging support
 		  on uart of alchemy SoCs.
 
+	config DEBUG_AR933X_UART
+		bool "Kernel low-level debugging messages via Alchemy UART"
+		depends on MIPS_ALCHEMY
+		select DEBUG_LL_UART
+		help
+		  Say Y here if you want kernel low-level debugging support
+		  on uart of AR933X SoCs.
+
 endchoice
 
 config DEBUG_LL_INCLUDE
@@ -303,6 +311,7 @@ config DEBUG_UART_PHYS
 	default 0x1fe00000 if DEBUG_LOONGSON2K_UART
 	default 0x10030000 if DEBUG_INGENIC_UART
 	default 0x11100000 if DEBUG_ALCHEMY_UART
+	default 0x18020000 if DEBUG_AR933X_UART
 	help
 	  This is the physical base address of the debug UART. It must be
 	  accessible from unmapped kernel space (i.e. KSEG1 for 32bit kernels
diff --git a/arch/mips/include/debug/ar933x.S b/arch/mips/include/debug/ar933x.S
new file mode 100644
index 000000000000..1a0449082080
--- /dev/null
+++ b/arch/mips/include/debug/ar933x.S
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2023, Jiaxun Yang <jiaxun.yang@flygoat.com>
+ * MIPS Low level debug include file for ar933x UART
+ */
+
+#include <asm/addrspace.h>
+#include <asm/asm.h>
+#include <asm/mach-ath79/ar933x_uart.h>
+
+#define DEBUG_LL_UART
+
+#define UART_BASE	CKSEG1ADDR(CONFIG_DEBUG_UART_PHYS)
+
+# define UART_L		lw
+# define UART_S		sw
+
+		.macro	addruart,rd,rx
+		PTR_LA	\rd, UART_BASE
+		.endm
+
+		.macro	senduart,rd,rx
+		UART_S   \rd, AR933X_UART_DATA_REG(\rx)
+		.endm
+
+        /* CTS and RDY are handled by AR933X_UART_DATA_TX_CSR as well */
+		.macro	busyuart,rd,rx
+1002:
+		UART_L	\rd, AR933X_UART_DATA_REG(\rx)
+		andi	\rd, \rd, (AR933X_UART_DATA_TX_CSR)
+		xori	\rd, (AR933X_UART_DATA_TX_CSR)
+		bnez	\rd, 1002b
+		.endm
+
+		.macro	waituarttxrdy,rd,rx
+        busyuart \rd, \rx
+		.endm
+
+		.macro	waituartcts,rd,rx
+        busyuart \rd, \rx
+		.endm

-- 
2.34.1


  parent reply	other threads:[~2024-03-26 20:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 20:35 [PATCH v2 0/9] MIPS: Unify low-level debugging functionalities Jiaxun Yang
2024-03-26 20:35 ` [PATCH v2 1/9] MIPS: asm: Move strings to .rodata.str section Jiaxun Yang
2024-04-08  6:48   ` Philippe Mathieu-Daudé
2024-03-26 20:35 ` [PATCH v2 2/9] MIPS: debug: Implement low-level debugging functions Jiaxun Yang
2024-04-08  6:48   ` Philippe Mathieu-Daudé
2024-03-26 20:35 ` [PATCH v2 3/9] MIPS: debug: Hook up DEBUG_LL with early printk Jiaxun Yang
2024-04-08  6:46   ` Philippe Mathieu-Daudé
2024-03-26 20:35 ` [PATCH v2 4/9] MIPS: debug: Provide an early exception vector for low-level debugging Jiaxun Yang
2024-03-26 20:35 ` [PATCH v2 5/9] MIPS: debug_ll: Add Kconfig symbols for some 8250 uarts Jiaxun Yang
2024-04-08  6:46   ` Philippe Mathieu-Daudé
2024-03-26 20:35 ` [PATCH v2 6/9] MIPS: debug_ll: Implement support for Alchemy uarts Jiaxun Yang
2024-03-26 20:35 ` Jiaxun Yang [this message]
2024-03-26 20:35 ` [PATCH v2 8/9] MIPS: zboot: Convert to use debug_ll facilities Jiaxun Yang
2024-04-08  6:50   ` Philippe Mathieu-Daudé
2024-03-26 20:35 ` [PATCH v2 9/9] MIPS: CPS: " Jiaxun Yang
2024-04-08  6:43   ` Philippe Mathieu-Daudé

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=20240326-mips_debug_ll-v2-7-b64abc76f2a1@flygoat.com \
    --to=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /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).