From patchwork Fri Feb 10 08:59:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 55331 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp840319wrn; Fri, 10 Feb 2023 01:02:04 -0800 (PST) X-Google-Smtp-Source: AK7set/9+4Q+8Qa9Qt/X6nM0c1hi74+Uxamxb87jmI69m5WqPR5ABkT0H0SqEFkUWLDwSP0hSnL/ X-Received: by 2002:a17:90b:3a8b:b0:230:96f7:443d with SMTP id om11-20020a17090b3a8b00b0023096f7443dmr16636340pjb.22.1676019724640; Fri, 10 Feb 2023 01:02:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676019724; cv=none; d=google.com; s=arc-20160816; b=SFj11dXk3Cv6a0LjVNAi3Oh4hH9HchsxWjy1+nIad0eLQ5a2HPP52zEKegS5OQuEm5 T/BMbuOm70zRXpU5bXBDw2hpKMxsg3PycrbRlH5z7Z9CcVQhQAAErwwx0GmIHLgQw+Nj QnnG/uu/z7bnKkBszTQNJnq3vr12KZPMlrR97HZMGsY7TiLK9rjCAIWHStcv56kzSXrT zRDSjdXbp1RaBiPoVYdMe6PlHaGatJ8rnROhZu24Wtmeg8KgoX5UCiFVsynczFGbyoXe L9kGQNYlMgVWZ/aEztsEg5GpWpaeI0bsPZ4uLCm2xc10/idpXvGMAcvavKx0N5QoZzPt yr3Q== 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:dkim-signature; bh=N1GRvMdgWHjes1U/8i84hO5LS0vKzH78vNx/oJKWdA0=; b=kPaOR7E9j5vipWBx/ZtDR+vzqgkK6xDROM/LoeSQ4SlWpJCi99V8P8PAe8xXcAowRW 4wKcbmHHSlOT12LvAqBjcqxhvYdTPT9GBDsodC30Q58fB+2dwzUtltLg3hftmCdBwCnT 12+uBPbDKoSLxsNSKDf6PxAZyb1B/MYDInvR4ox0P8zfYW3+z3S0qruDoPAgDjgEdsaY jVmAbiHRID9L/H7ZkAuk1HwFb+hIGnmW+pqsFuyLtXqu5Raop7/juw4nhJyLuT+z8D+Q +uoN6zbUVXXr3JwN0LKwNug4CUcH5nxzkWM2/qD15XOzrSKNqjFtjQ/MmW4+hHz+sR/Q dGvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Ue7dDebG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fw4-20020a17090b128400b00229661af23fsi4274399pjb.110.2023.02.10.01.01.52; Fri, 10 Feb 2023 01:02:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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; dkim=pass header.i=@mediatek.com header.s=dk header.b=Ue7dDebG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231806AbjBJJAN (ORCPT + 99 others); Fri, 10 Feb 2023 04:00:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231707AbjBJI7o (ORCPT ); Fri, 10 Feb 2023 03:59:44 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A32864C0D4; Fri, 10 Feb 2023 00:59:41 -0800 (PST) X-UUID: 3dbf36a4a92111eda06fc9ecc4dadd91-20230210 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=N1GRvMdgWHjes1U/8i84hO5LS0vKzH78vNx/oJKWdA0=; b=Ue7dDebGzRId6kNmyd9a93by/R3eGFiP4dcXIAb+gWMOszHvI4T66GTqw74/mJROuBC/Mq7SyKP49Cl/5G2ZqUBc0UJXp4e1xBZ5i8tFN+a5dPj9evjpYQ6Rm1zmPn5Aeyc4nCGDs7kBh28eH0qTlOFhorpp3Df3/SvgbKORI/k=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:49b31ff2-82b0-40f6-b028-5f0215194da4,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.19,REQID:49b31ff2-82b0-40f6-b028-5f0215194da4,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:885ddb2,CLOUDID:b1bc0ff8-ff42-4fb0-b929-626456a83c14,B ulkID:2302101659363JI45V3W,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-UUID: 3dbf36a4a92111eda06fc9ecc4dadd91-20230210 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2043132446; Fri, 10 Feb 2023 16:59:35 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Fri, 10 Feb 2023 16:59:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 10 Feb 2023 16:59:34 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v5 10/12] remoteproc: mediatek: Handle MT8195 SCP core 1 watchdog timeout Date: Fri, 10 Feb 2023 16:59:29 +0800 Message-ID: <20230210085931.8941-11-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230210085931.8941-1-tinghan.shen@mediatek.com> References: <20230210085931.8941-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757434058718166426?= X-GMAIL-MSGID: =?utf-8?q?1757434058718166426?= The MT8195 SCP core 1 watchdog timeout needs to be handled in the SCP core 0 IRQ handler because the MT8195 SCP core 1 watchdog timeout IRQ is wired on the same IRQ entry for core 0 watchdog timeout. MT8195 SCP has a watchdog status register to identify the watchdog timeout source when IRQ triggered. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_common.h | 4 ++++ drivers/remoteproc/mtk_scp.c | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index e4ef97f2d3a1..ca2395b98d27 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -55,6 +55,10 @@ #define MT8192_CORE0_WDT_IRQ 0x10030 #define MT8192_CORE0_WDT_CFG 0x10034 +#define MT8195_SYS_STATUS 0x4004 +#define MT8195_CORE0_WDT BIT(16) +#define MT8195_CORE1_WDT BIT(17) + #define MT8195_L1TCM_SRAM_PDN_RESERVED_RSI_BITS GENMASK(7, 4) #define MT8195_CPU1_SRAM_PD 0x1084 diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 569e915dfa0f..2b43e23f6de7 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -222,6 +222,29 @@ static void mt8192_scp_irq_handler(struct mtk_scp *scp) } } +static void mt8195_scp_irq_handler(struct mtk_scp *scp) +{ + u32 scp_to_host; + + scp_to_host = readl(scp->reg_base + MT8192_SCP2APMCU_IPC_SET); + + if (scp_to_host & MT8192_SCP_IPC_INT_BIT) { + scp_ipi_handler(scp); + } else { + u32 reason = readl(scp->reg_base + MT8195_SYS_STATUS); + + if (reason & MT8195_CORE0_WDT) + writel(1, scp->reg_base + MT8192_CORE0_WDT_IRQ); + + if (reason & MT8195_CORE1_WDT) + writel(1, scp->reg_base + MT8195_CORE1_WDT_IRQ); + + scp_wdt_handler(scp, reason); + } + + writel(scp_to_host, scp->reg_base + MT8192_SCP2APMCU_IPC_CLR); +} + static void mt8195_scp_c1_irq_handler(struct mtk_scp *scp) { u32 scp_to_host; @@ -1273,7 +1296,7 @@ static const struct mtk_scp_of_data mt8192_of_data = { static const struct mtk_scp_of_data mt8195_of_data = { .scp_clk_get = mt8195_scp_clk_get, .scp_before_load = mt8195_scp_before_load, - .scp_irq_handler = mt8192_scp_irq_handler, + .scp_irq_handler = mt8195_scp_irq_handler, .scp_reset_assert = mt8192_scp_reset_assert, .scp_reset_deassert = mt8192_scp_reset_deassert, .scp_stop = mt8195_scp_stop,