Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1023993lqm; Thu, 2 May 2024 03:01:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVHWeeTjjTjfAlNpikzJuO6KguU1n04UOEYAMN3ZwCEFAvU4HGYfba6wGs4kepHhK2OIyNf6+vQfrrlpAAhcVgNEzPfNUM5JWKHtxNDSQ== X-Google-Smtp-Source: AGHT+IHtiTAxNLNTisOa95nFHqb9DOYkHp25j1JTquKF+DmHICp3OUO3dryuWrX1HWTlOOOoxbuI X-Received: by 2002:a05:6a00:1390:b0:6e6:ccec:fdc0 with SMTP id t16-20020a056a00139000b006e6ccecfdc0mr1673220pfg.33.1714644075657; Thu, 02 May 2024 03:01:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714644075; cv=pass; d=google.com; s=arc-20160816; b=H0r73nkHN6Cdkf9Ub/bDr3BRmFp7Pkg5ty8pMm/One3lE8pgrWD8oHcB+OvAwRs2DB h2sdULEhJM4uxR+szIsP2ZTrE1Ip4HDvSmCDT75JADhGUdNIDUtHRAeolVIOR/rxGk3d lRtgg07b/uGfCa46UWBqSUeZzSfABSXwryaJJu4XQgJVbTxqNcONkp4tPWBuyDkOCxXX heDnsZ113nEL5igmhONilA0cXxIsRY9gboLICtRi4ORGfWs3I71lnV4K7Bm2o9rUH+ob 4ED2nRwmaoyeL2VB9oZX706Zkpnj5tGhIWX/kkgmnQzsuYvF5bJaZhXzKJWEQ093GkNp 1DDw== 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=XPw34Iav2T+hzoHR6mAbmW6CU2TVaqRpR57TvU3su/0=; fh=Dii/wXcZb/mJUCmsdlZbBl/o0XRcaQ9S/xOY9NGTLc4=; b=Jps2hBbFSGcfu2+4saOgNt93DqIdHDoqLxQBVjmi0d4rMVprzcLqxDBtxXPLUponPU uOEs1PM7NN+4MfUdBShPzIC9po5T9qlEzm29QWYzellsAIDKND03f+G5EOuEMkxgjWTC l6/gzHQy/fMLWlf233Gk0xYaLEDG9gpv3HhHAihzo8wmyJQSuk+LzYe6lsHFLc/3xz8c +DlrbLtffNGJLDex4YzPz59iTAS2fx+ofYbineBaADo0bUu1xCHqOC7eijA3jwjbETyI KK+IF0NzDezo6YHOSF92M8jZYjjh6hbxgNt6faJjDKjntuYuUOjQYTMBJusoJdntWIwr scbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=TyBzsE2W; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=TseUbysy; 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-166271-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166271-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j1-20020a056a00130100b006f3e2b29eb9si749004pfu.71.2024.05.02.03.01.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 03:01:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166271-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=TyBzsE2W; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=TseUbysy; 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-166271-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166271-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 63AEF285D40 for ; Thu, 2 May 2024 10:01:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE7D060DEE; Thu, 2 May 2024 09:59:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="TyBzsE2W"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="TseUbysy" 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 133CA5C61C; Thu, 2 May 2024 09:59:44 +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=1714643986; cv=none; b=JaJoZFRcF25OQ+AndG8CksFu3GG/8deM1QGf+C9nanVg9DfK0qaJwHUnG2d60Tg90wzOZgjr06iKorpSIKFIL33bMhJ3+7R4o9jK5EQeOQp70Qzjx/aWF6m0G4IUKgA4PSWeDxO0HFp/Ujam/Eoo0Rho02cXlNCi2deqiOv+LYg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714643986; c=relaxed/simple; bh=7F+0NOYc+OjzTTyACC9ErsZ3xLNN6M7QVx5gFrlMcZg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iwn3bdzrzkBA6HiDVQ29CvjKAeKZEIKWmRdUc6pKodnFgEkJtU+V6Qivua/drjVxgJyNXB3/03R3QSAtO9iramctqidBTiRHGTwX9NbQbMu4dAnCArnnSAIxTq8pMPD2v1p1m1i/2EIQe9uLJSCpkwFRlX/2RkQYkpxS2MdNaJs= 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=TyBzsE2W; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=TseUbysy; 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 compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id 1B9101381120; Thu, 2 May 2024 05:59:44 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 02 May 2024 05:59:44 -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=1714643984; x=1714730384; bh=XPw34Iav2T+hzoHR6mAbmW6CU2TVaqRpR57TvU3su/0=; b= TyBzsE2WpwbEN8lFmjEw7oyzQGt9c9GCvOFxwNlQgaCr0KUA9/ponKP4CEHGwkog s5F5FtFeUbLnspK2djWp27YEdNcj2UjhHfQgOtVE4BLInINLvDmyKh38EA67q1vu DaB7bKvhyeozcKFGysHQgSCAalHnLWJNpw/vyUmLJARulClzEI+/GUYAKdX/VGSQ wA3Dnvluf4DaRcjXBBYSfiyM4r9lLBYWoDbfPVJaATRYfBfaQdiviDmy8tQVEsQo Dxr9+uBOZ4cjOHRKNiHAeKSxbFZTNQnH7J2clf6/WbictHhb0NUeqE1+8Rj2ibm0 EmfjTsJXhCGjwELgsYXpUA== 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=1714643984; x= 1714730384; bh=XPw34Iav2T+hzoHR6mAbmW6CU2TVaqRpR57TvU3su/0=; b=T seUbysyB0H54k/fRmvibOowl0xRzS3RGvxdoD/joGrz6aIR/2271sjWQZBbfxSXR egHPVUA9i/GE0uNE6KdVHgZzkiMKGZlKHWEY4hi58pKeRxNJ87DpdJLscmyNya+G iKQenLKvtPF/wU3oUU+VufXQyzwNgK1lk5wES5BmVgvrwt1QiNXtBvb3CheDTMWF 33djKD/HhsF3XatML7ZJ3bTZ3hq31O14zZ5PVKuOgvjV9pwdKlbeCwJQQvAmo02Z kSG/kj6R2pbyVeYVV+pJbVHYJ5s0WguenfDrV5w8HQfrxncNYFSEJpEXTM7RxqGL lr7x2gppjrrrLZtHN1XGA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddukedgvdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvedvgffggfdtuedukeefteelffekvdevleejffejieegkeef ffdvffelteeijefgnecuffhomhgrihhnpegrrhelfeefgidrshgsnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghes fhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 2 May 2024 05:59:43 -0400 (EDT) From: Jiaxun Yang Date: Thu, 02 May 2024 10:59:34 +0100 Subject: [PATCH v3 7/9] MIPS: debug_ll: Implement support for AR933X 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-7-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=2449; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=7F+0NOYc+OjzTTyACC9ErsZ3xLNN6M7QVx5gFrlMcZg=; b=owGbwMvMwCHmXMhTe71c8zDjabUkhjTjFPbdD07naCTVSFaVB/Clvb4tvXP+Y5sZLHXGWs8zN Lem/drbUcrCIMbBICumyBIioNS3ofHigusPsv7AzGFlAhnCwMUpABPZ84jhf5jXGa6NtufELu1b NUnx8k/Z51JFt9tWX+4+w/vhf+T8gBUM/8zbT7Ok5vO4Fy4P3XBpUZOV7Lv9Fwx9s8rr2L77bBO oZQMA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Implement support for AR933X uarts which has it's own register definition. Signed-off-by: Jiaxun Yang --- 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 + * MIPS Low level debug include file for ar933x UART + */ + +#include +#include +#include + +#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