Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1163632pxf; Fri, 9 Apr 2021 01:23:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeF0ZV0+Ll6w6Tl8j7XGvxya8Rqz6N0k23xhEwj8qLtsMI1ECK5Ls75xV2XEZJiLy6XIaX X-Received: by 2002:a17:90b:1498:: with SMTP id js24mr3182487pjb.83.1617956610172; Fri, 09 Apr 2021 01:23:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617956610; cv=none; d=google.com; s=arc-20160816; b=BCoVwl3b12TLiEpoVx5jGuTHJRWO5NPLimfqzwSdBq8Vbsa4pCY765JgcUiegNWSpE Fc0Lm3s66lKp9b5f2EsH685J0HtrJOmRJo/eQmHpnmhEN8y17SZ+TcGL9k1i6YBEJhFj /B641Di6AZ0YKf2vjjXnjoUp+btJXhf9m0b2xnDRE+cyFjo5TUMie2Df2uyT9vX7jlha XbReZWZZf8EAInaUq+YaVAfJVnbzBXSQFwLyKlLBQk2DSqq/Pcdm7yKClP2D+ynB27Lc GrNMQC5HfRB1JTi3AdC8g2jBRJ+NlFcjRF+dIs/B5DxuG65e57sCgtJYagtV9NZJj0Pm DdxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=NT12e0S/12NPgzHkp0McuKYqV2PmXzRd4RzZOdMROwo=; b=jw3HVEck1PG9Zjwc5yD8iJra5GccFdEi0gcSXeWm3JP+33I3YuUx3E3d5Eqmo1njES +k0B1Aso4UG61h05hHug/U/vMkLSAeWjafe3+GX9K2FdBD0KcKfMytcRApucXr0i3VW/ sXe+dceEYDvocqKL9TsJ3AtxJ03eh2u47PJOne+NLHN88L3TV5zycXMcy/QVmA/TQcDG tGa785XocgVtt4RQ/f/3DcAHzlmWXj2+Xajy43VW1fA/SEx2MZVzfZchcVRlV9P9+Z2g SYg5dDU+M/EqVlGda6fiFbqyceU8mmoIka+5b7bSUH4yUt+ywS2eMpELTu8cQk/cUNsd nnuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s12si2142678pgn.550.2021.04.09.01.23.18; Fri, 09 Apr 2021 01:23:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232651AbhDIIVo (ORCPT + 99 others); Fri, 9 Apr 2021 04:21:44 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:54903 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232704AbhDIIVl (ORCPT ); Fri, 9 Apr 2021 04:21:41 -0400 X-UUID: 35e67773653a456d8471ab3de3f9bee6-20210409 X-UUID: 35e67773653a456d8471ab3de3f9bee6-20210409 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2072133455; Fri, 09 Apr 2021 16:21:27 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 9 Apr 2021 16:21:24 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 9 Apr 2021 16:21:24 +0800 From: Nina Wu To: Rob Herring , Matthias Brugger CC: Nina Wu , Zhen Lei , Neal Liu , , , , , , Subject: [PATCH v3 5/7] soc: mediatek: devapc: add debug register for new IC support Date: Fri, 9 Apr 2021 16:19:35 +0800 Message-ID: <1617956377-4075-5-git-send-email-nina-cm.wu@mediatek.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1617956377-4075-1-git-send-email-nina-cm.wu@mediatek.com> References: <1617956377-4075-1-git-send-email-nina-cm.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 3C549EE1532870A94D5A7D3EFCA14F1F25D1A7FBBC15D67579D6860EE2A25D042000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nina Wu There are 3 debug info registers in new ICs while in legacy ones, we have only 2. We add a 'version' field in compatible data to decide how we extract the debug info. Signed-off-by: Nina Wu --- drivers/soc/mediatek/mtk-devapc.c | 43 +++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/drivers/soc/mediatek/mtk-devapc.c b/drivers/soc/mediatek/mtk-devapc.c index f5d63c5..bdc8fe9 100644 --- a/drivers/soc/mediatek/mtk-devapc.c +++ b/drivers/soc/mediatek/mtk-devapc.c @@ -26,12 +26,24 @@ struct mtk_devapc_vio_dbgs { u32 addr_h:4; u32 resv:4; } dbg0_bits; + + struct { + u32 dmnid:6; + u32 vio_w:1; + u32 vio_r:1; + u32 addr_h:4; + u32 resv:20; + } dbg0_bits_ver2; }; u32 vio_dbg1; + u32 vio_dbg2; }; struct mtk_devapc_data { + /* architecture version */ + u32 version; + /* default numbers of violation index */ u32 vio_idx_num; @@ -40,6 +52,7 @@ struct mtk_devapc_data { u32 vio_sta_offset; u32 vio_dbg0_offset; u32 vio_dbg1_offset; + u32 vio_dbg2_offset; u32 apc_con_offset; u32 vio_shift_sta_offset; u32 vio_shift_sel_offset; @@ -163,22 +176,43 @@ static void devapc_extract_vio_dbg(struct mtk_devapc_context *ctx) struct mtk_devapc_vio_dbgs vio_dbgs; void __iomem *vio_dbg0_reg; void __iomem *vio_dbg1_reg; + void __iomem *vio_dbg2_reg; + u32 vio_addr, bus_id, domain_id; + u32 vio_w, vio_r; vio_dbg0_reg = ctx->base + ctx->data->vio_dbg0_offset; vio_dbg1_reg = ctx->base + ctx->data->vio_dbg1_offset; + vio_dbg2_reg = ctx->base + ctx->data->vio_dbg2_offset; vio_dbgs.vio_dbg0 = readl(vio_dbg0_reg); vio_dbgs.vio_dbg1 = readl(vio_dbg1_reg); + if (ctx->data->version == 2U) + vio_dbgs.vio_dbg2 = readl(vio_dbg2_reg); + + if (ctx->data->version == 1U) { + /* arch version 1 */ + bus_id = vio_dbgs.dbg0_bits.mstid; + vio_addr = vio_dbgs.vio_dbg1; + domain_id = vio_dbgs.dbg0_bits.dmnid; + vio_w = vio_dbgs.dbg0_bits.vio_w; + vio_r = vio_dbgs.dbg0_bits.vio_r; + } else { + /* arch version 2 */ + bus_id = vio_dbgs.vio_dbg1; + vio_addr = vio_dbgs.vio_dbg2; + domain_id = vio_dbgs.dbg0_bits_ver2.dmnid; + vio_w = vio_dbgs.dbg0_bits_ver2.vio_w; + vio_r = vio_dbgs.dbg0_bits_ver2.vio_r; + } /* Print violation information */ - if (vio_dbgs.dbg0_bits.vio_w) + if (vio_w) dev_info(ctx->dev, "Write Violation\n"); - else if (vio_dbgs.dbg0_bits.vio_r) + else if (vio_r) dev_info(ctx->dev, "Read Violation\n"); dev_info(ctx->dev, "Bus ID:0x%x, Dom ID:0x%x, Vio Addr:0x%x\n", - vio_dbgs.dbg0_bits.mstid, vio_dbgs.dbg0_bits.dmnid, - vio_dbgs.vio_dbg1); + bus_id, domain_id, vio_addr); } /* @@ -219,6 +253,7 @@ static void stop_devapc(struct mtk_devapc_context *ctx) } static const struct mtk_devapc_data devapc_mt6779 = { + .version = 1, .vio_idx_num = 511, .vio_mask_offset = 0x0, .vio_sta_offset = 0x400, -- 2.6.4