Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1899037rwd; Thu, 18 May 2023 20:18:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5s17O27PRR7KxL0IROJTk2ZfBcBYPaBjupCX8JMAAyrfZ2nXBIzFe7C2omJBaxh8h0zCII X-Received: by 2002:a17:902:da90:b0:1ae:32d3:43b2 with SMTP id j16-20020a170902da9000b001ae32d343b2mr1661174plx.25.1684466312861; Thu, 18 May 2023 20:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684466312; cv=none; d=google.com; s=arc-20160816; b=yAvnx8fu/ge9c5hBkgY7eATVjDby2tB515tJHXkerTGEGwuqGHY0lEasUK65E+gpSs MCWXXmMZqegIXV30AfdhW4GiXr7LBBQXBxSqEmgqcGPp9tUuMVyRFV63VWF7NJUbcHWf WQSoLXEl38664g/vvRddnGeGJAyEToZx8hx0B0vbxLgtL8E0o2uHqJcmXTksRahdfyOt wCeVkVQUPVK8V/xQ20NkVlESd3SoLzfd0GWT1TYtCwjUP2q71S/Afy/CBfIdPH9gfrkD INMByDi6VRw57xJOWDVVEbo6SguZEH5Md9qkJ6JRdfYShe30F9ei1NMJmtJuh2y3FPbd DmMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :authenticated-by; bh=A8QQXg3MXGnloyBuv0DyftZZ6ya2Pet7kyFwnfg1wbQ=; b=PXZNaLxTXr2GNOYNpnPLCYtIlAhFGRDLjOMzU6UM1n+fK0kzlP+ESy3POL2/8DbYGD op04vXGXDgeruSlvQihN6afDwBQdr9WniAxNUkn45bZTmR0rtj9j1S1Nv09vqs4FTj0z ZFhoN3dnmWpLPGFrEqq77mE0P+2vv8gp8M2GO1ccubKvw9VzsLqfB643ql9Rm1qARACl oI5FIddXXmf2BF+4BnbK1MfZ27wVGUtKwX/hVrjUiaryQxIYz2rr8Ymu/zjqdgaTi/Zh GUCqXh908isFy5JF15q+lLxYUm5YT1S7rtcUFmqLUrdAZ9bluJmqz0aKSD9sfsvGFjcg ODTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 18-20020a170902c25200b001adbb45eae6si114313plg.331.2023.05.18.20.18.25; Thu, 18 May 2023 20:18:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230216AbjESDP0 (ORCPT + 62 others); Thu, 18 May 2023 23:15:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230139AbjESDPX (ORCPT ); Thu, 18 May 2023 23:15:23 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71E38110 for ; Thu, 18 May 2023 20:15:22 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 34J3F75G0004516, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 34J3F75G0004516 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Fri, 19 May 2023 11:15:07 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Fri, 19 May 2023 11:15:16 +0800 Received: from [127.0.1.1] (172.21.69.188) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Fri, 19 May 2023 11:15:16 +0800 From: Ping-Ke Shih To: CC: , Subject: [PATCH 5/7] wifi: rtw89: enlarge supported length of read_reg debugfs entry Date: Fri, 19 May 2023 11:14:58 +0800 Message-ID: <20230519031500.21087-6-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230519031500.21087-1-pkshih@realtek.com> References: <20230519031500.21087-1-pkshih@realtek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [172.21.69.188] X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The register ranges of upcoming chips are different from current, and even existing chips have different ranges, so support longer length to dump registers. Then, user space can decide the ranges according to chip. Since arbitrary length (e.g. 7) would be a little complicated, so simply make length a multiple of 16. The output looks like 18620000h : 8580801f 82828282 82828282 080800fd Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/debug.c | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c index 6f418f14ec3fe..39f6b7f5f6563 100644 --- a/drivers/net/wireless/realtek/rtw89/debug.c +++ b/drivers/net/wireless/realtek/rtw89/debug.c @@ -30,7 +30,7 @@ struct rtw89_debugfs_priv { u32 cb_data; struct { u32 addr; - u8 len; + u32 len; } read_reg; struct { u32 addr; @@ -164,12 +164,15 @@ static int rtw89_debug_priv_read_reg_get(struct seq_file *m, void *v) { struct rtw89_debugfs_priv *debugfs_priv = m->private; struct rtw89_dev *rtwdev = debugfs_priv->rtwdev; - u32 addr, data; - u8 len; + u32 addr, end, data, k; + u32 len; len = debugfs_priv->read_reg.len; addr = debugfs_priv->read_reg.addr; + if (len > 4) + goto ndata; + switch (len) { case 1: data = rtw89_read8(rtwdev, addr); @@ -187,6 +190,20 @@ static int rtw89_debug_priv_read_reg_get(struct seq_file *m, void *v) seq_printf(m, "get %d bytes at 0x%08x=0x%08x\n", len, addr, data); + return 0; + +ndata: + end = addr + len; + + for (; addr < end; addr += 16) { + seq_printf(m, "%08xh : ", 0x18600000 + addr); + for (k = 0; k < 16; k += 4) { + data = rtw89_read32(rtwdev, addr + k); + seq_printf(m, "%08x ", data); + } + seq_puts(m, "\n"); + } + return 0; } -- 2.25.1