Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1023848lqm; Thu, 2 May 2024 03:01:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfcPt68G3JtyLMCz8uQngusZ6i1e1DfurxN++/1wpnhrabwh7HfMdw6l5R2Wtg5V8zMDJ1zVU1KTlDt58T/BhtWESzf7az5QMZ/LgagA== X-Google-Smtp-Source: AGHT+IGsn0s/Pa1T/obgCHdExmxQSy5wMiCjL6Du33e1kTxNVfYelRoUHnQnZ5t80QtN4TNwkw/U X-Received: by 2002:a05:620a:4691:b0:788:31a1:4a16 with SMTP id bq17-20020a05620a469100b0078831a14a16mr1823836qkb.43.1714644060974; Thu, 02 May 2024 03:01:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714644060; cv=pass; d=google.com; s=arc-20160816; b=s1KzePPwWK4AZQk+cacuuvnJd/tt5bnGhUYoosw9+83AGe1AdPPEHIr8ftWggUIqgm hFH9HPebx99RX12QRajiHH3n9l9Reg/WFxrjye8aDBlUNPzTv4El7VftdJlrrAOplifX sWFvfC57JwZp6sJ6YOWDxE6vRPXkbCew9UGEzzjYg4j+NDgO0/skAXlgs9KywRTsZR0c vvlMKEE8g4Gaus4XfsQ2dKZ2SI972k+G/XnvJPR2l7BWEmRgQBt1dbMxD0G1AXu9aJ8t RGU8cC6udvMgSHJtZfnyf82VAW16C1GgScV+WRDOUpXFtxgNA+19K6fLSIBh6B0tiBT8 ouNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:feedback-id:dkim-signature:dkim-signature; bh=0mxEqLNYpkEtGR4Posnw0M8UDvrKtPSNjSiy1sxuJiA=; fh=Dii/wXcZb/mJUCmsdlZbBl/o0XRcaQ9S/xOY9NGTLc4=; b=mQi9MAplKw97EeM0tbTESg5Eyzh5q9wzSTaNIUQcrklx4C90Q3a/I5503Sb8ibFZAr r8X5lS+Ucdip4d2RWMqyd3UtzY/d2wqbDaAKSJsxwg0Hw0E3e0nPGXYT3qykAozNSGDe mE+m6uohHn5CCfiOSOnTlApQT6UcgGR3gr2NttOyhD6c0UmZishwmmxQ1xVSfPKrQPQc G3i8G0IWZRi5o3SM4Npf2Z8LXxZnzzDQIKuBeEjdfOS1lhICDdjp0yWiwf379pcHxFCK 7DTJCkY3y28qthnYbnhAEGtY3YUm0HfkTtUJrr8G7GlTOE5xD2EK28YP4uImEMmRWXPX 6Aeg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=r4HLchic; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=gwdEI43H; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-166270-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166270-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d10-20020a05620a240a00b0078ecdb3c832si580791qkn.781.2024.05.02.03.01.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 03:01:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166270-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=r4HLchic; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=gwdEI43H; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-166270-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166270-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A134A1C21B01 for ; Thu, 2 May 2024 10:01:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C75E06024A; Thu, 2 May 2024 09:59:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="r4HLchic"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="gwdEI43H" Received: from fout6-smtp.messagingengine.com (fout6-smtp.messagingengine.com [103.168.172.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC16A59162; Thu, 2 May 2024 09:59:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714643985; cv=none; b=ftGS6GdkI/8nIh4PF2Xv5H2RhcG/dG8CB/x62elutXzfh/+a3QEZLJKgZFWxNLrMuREZD4KCYZVvPlnU8T99yycu62Pedx6CxQsheKSwsu6MnEzEDZwqeDr6NGUIkmhxywQ3AATy2V76ZpbBgnGVmRDbCQZufoh7HpivNGLmkxE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714643985; c=relaxed/simple; bh=dssAdswcFICvMOQneWOD2aRjHwqfi0CLy3Px0yTWsrA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oG0OJYflastKcqLuGUlredv3ajLqc58paV7TaB76APPEQjnVNsUYHlm8ypqRSPeYfl9poGrsMLt7uWLziUQtTGbXJ7eoEEgez0uDjQdVNG3punBh7pUIpxLmI0XotilprQPPZgTm4OeXfmO88Za4f5qSdL5ORtBxUyDoSn8bkso= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com; spf=pass smtp.mailfrom=flygoat.com; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b=r4HLchic; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=gwdEI43H; arc=none smtp.client-ip=103.168.172.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.nyi.internal (Postfix) with ESMTP id 271CE1380F77; Thu, 2 May 2024 05:59:43 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 02 May 2024 05:59:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1714643983; x=1714730383; bh=0mxEqLNYpkEtGR4Posnw0M8UDvrKtPSNjSiy1sxuJiA=; b= r4HLchicTleHy0Acw3A7itptHa0HNwC8oQ+Y6fI9lrp9rLdGDOmEyYUVB4RiOvSW M0wtbjN4AVdcCaydMhiPL8h7tndHBQELTkl/FerAMrKPfJpmkXv2Kg6HiJSTt003 qzL2E/a3nQ8BIPhwOkJ5Sr4s2d98RFeWJCnmg0ag9R1vMiwlOQp8m0MqtzJQoE/S JJNWMeDjYsSUG0uXYZDPrCrkqjVuWVusTAUfhzmv7RDzZ+laqovSebIDFC4Z3wi/ B9houdCTKm1EfF0q74GkbPfNEVr3DkehFmNOsu5hcAJbXaAjxYAwB4RvKWgzIUT8 snj+3O4EaH8V/d1cde4H0w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1714643983; x= 1714730383; bh=0mxEqLNYpkEtGR4Posnw0M8UDvrKtPSNjSiy1sxuJiA=; b=g wdEI43HuvinBdqDJskjrFTEfSURjiCYj9VYlpVb4zTRi5Sc7iHt5sP1NNobOQQxC LjaMC0Fdz/K6zNivBXJYfeO0LeAQR1gzr64NTlATWsu3ZwBiJGKqsu2Z3wU+WZW0 QV38tDSN1rpcl4OODY8WQjUXYz8eAZJ+EcElpSCKtenvz3vcHQnl/xNhISeYWjY3 yUngBwhfdHpn/WBNWDftetH7aF4BL9xM8Os23VOtA2nI79Fd1D/KkNOFMbFAu1Aa iS/PVRayUAPeSsRWE+lioU2Clvu7S5vodSDyKtbRVwXytUR4w/nLdQRLprDcZudg vACVlhHEOHgMZqpp/0eoQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddukedgvdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvddvtddvfffgjeeltdejveevheeiveejgfeljeekteffteeu jedutdeggefhjeejnecuffhomhgrihhnpegrlhgthhgvmhihrdhssgenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhg sehflhihghhorghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 2 May 2024 05:59:42 -0400 (EDT) From: Jiaxun Yang Date: Thu, 02 May 2024 10:59:33 +0100 Subject: [PATCH v3 6/9] MIPS: debug_ll: Implement support for Alchemy uarts Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240502-mips_debug_ll-v3-6-3b61f30e484c@flygoat.com> References: <20240502-mips_debug_ll-v3-0-3b61f30e484c@flygoat.com> In-Reply-To: <20240502-mips_debug_ll-v3-0-3b61f30e484c@flygoat.com> To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Jiaxun Yang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2825; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=dssAdswcFICvMOQneWOD2aRjHwqfi0CLy3Px0yTWsrA=; b=owGbwMvMwCHmXMhTe71c8zDjabUkhjTjFHZ2AZXdC2Z9Te2ZGbej6vPVS46S926c3ZCxZdcyJ nbJFVm7OkpZGMQ4GGTFFFlCBJT6NjReXHD9QdYfmDmsTCBDGLg4BWAi7/8x/LO1Xe0Sdach+ozv FRWrwo3t+Yf5MlOi98T9kGu3n5/1zI+RYdsppQ/PkhS2xtQ6JaUy7dtlrXWQ++NrucdXRb+fNGV 6zwEA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Alchemy uart is a 8250 derivative that requires some special care on barriers and readys, also they have a wired register layout. Implement it as a special include. Signed-off-by: Jiaxun Yang --- arch/mips/Kconfig.debug | 10 +++++++++ arch/mips/include/debug/alchemy.S | 46 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug index 3609d298a9eb..aef116058654 100644 --- a/arch/mips/Kconfig.debug +++ b/arch/mips/Kconfig.debug @@ -257,11 +257,20 @@ choice Say Y here if you want kernel low-level debugging support on uart0 of Ingenic SoCs. + config DEBUG_ALCHEMY_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 alchemy SoCs. + endchoice config DEBUG_LL_INCLUDE string default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 + default "debug/alchemy.S" if DEBUG_ALCHEMY_UART default "debug/uhi.S" if DEBUG_MIPS_UHI default "debug-macro.S" @@ -293,6 +302,7 @@ config DEBUG_UART_PHYS default 0x1fd003f8 if DEBUG_LOONGSON3_UART default 0x1fe00000 if DEBUG_LOONGSON2K_UART default 0x10030000 if DEBUG_INGENIC_UART + default 0x11100000 if DEBUG_ALCHEMY_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/alchemy.S b/arch/mips/include/debug/alchemy.S new file mode 100644 index 000000000000..933efc6e828c --- /dev/null +++ b/arch/mips/include/debug/alchemy.S @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2023, Jiaxun Yang + * MIPS Low level debug include file for Au1xxx UART + * Dereived from drivers/tty/serial/8250/8250_rt288x.c + */ + +#include +#include +#include + +#define DEBUG_LL_UART + +#define UART_BASE CKSEG1ADDR(CONFIG_DEBUG_UART_PHYS) + +#define UART_TX_OFS (1 << 2) +#define UART_LSR_OFS (7 << 2) + +# 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, UART_TX_OFS(\rx) + sync /* wmb */ + .endm + + .macro busyuart,rd,rx +1002: + UART_L \rd, UART_LSR_OFS(\rx) + andi \rd, \rd, (UART_LSR_TEMT | UART_LSR_THRE) + xori \rd, (UART_LSR_TEMT | UART_LSR_THRE) + sync /* cpu_relax */ + bnez \rd, 1002b + .endm + + .macro waituarttxrdy,rd,rx + busyuart \rd, \rx + .endm + + /* Au1xxx has no MSR */ + .macro waituartcts,rd,rx + .endm -- 2.34.1