Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp499087pxb; Tue, 15 Feb 2022 19:56:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDqEak/v8lec2zA1nefv5OUqe20AUF9TVpakDxQDwno6I8AvvuuuNA5OeRZlPMa45rV3+B X-Received: by 2002:a50:becc:0:b0:410:a35f:c5a7 with SMTP id e12-20020a50becc000000b00410a35fc5a7mr1002352edk.170.1644983790212; Tue, 15 Feb 2022 19:56:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644983790; cv=none; d=google.com; s=arc-20160816; b=ciYt9y0zMSppHp3KckslOPbSnc1bllVaqUqTnNulh/iY/pgeFyS/pmJ9F48MCWduLe DO3KMwIghLnPSmrk5VxUX0nx23f8mHHBW10Fq8BsHQiJlQPnu/zIh18lqGsoslmD4enp VJSygJCH8C3kBYBsSL5NyrwvzAAmKjrCDm67obiX0r0Xa5Z1Jvo1HHUzJNwXGgYSHIiC l6jH8hQ4q3TWdXlnqF4BxwzNb7EbMUXEyLnTunPVJMZKWDBHy4bRzOar/IdvTAeyoUym bcYhDLW9Pxp3Lq/Cu6QmONZM25PpURo2PQnzpzuu2CvK8ZOxWWTulx806LPXx6jcuiKh 0/WA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=5nwJCAXmAEEQDEi5OPnoDyIcmw2O91v0GkZ8eEPI9s8=; b=tn0zz/jOajX1jYPf129mbJVyXA9pM9zpFXK30L3EXC4RBZkXXpye155E611gGBXcyV 2OqPvtUw7uzZ+2Zk5/VgM65j8UJg73mJMy2wTCHiB8WuCEFBmboWDNlV6h0sdyf15OPw K9uFxoRoAuyPIVke2SdpVLC1GBAye9hSkORrDX32Nfh++LjULCe0S1trwnVN/ZoSAt9Y 7wWAnVXNB42qLUuXHEUE2i4+4YIT7kEtYK5dKke8Q+hrEtSiI4vOLvmZg1WhpnAi2ecp 7yyCL8Wx25fOEBn2X9WGmXoaDceK9QsqkCm7KZc/qk0wXw7XjKJd6jnKJdqTv1f2Omlq znEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="O/3tC6A7"; 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=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z18si1282407edb.609.2022.02.15.19.56.07; Tue, 15 Feb 2022 19:56:30 -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=@collabora.com header.s=mail header.b="O/3tC6A7"; 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=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243265AbiBOSrW (ORCPT + 99 others); Tue, 15 Feb 2022 13:47:22 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243240AbiBOSrN (ORCPT ); Tue, 15 Feb 2022 13:47:13 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D48023136A for ; Tue, 15 Feb 2022 10:47:01 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: alyssa) with ESMTPSA id C83521F44C43 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1644950820; bh=Jo+q2iQ2HhAa53Jyc9hotJ72iRGY8gVAx2ZkJDQVWGs=; h=From:To:Cc:Subject:Date:From; b=O/3tC6A7Y2k4vIRMj3hfKSEHSGeZoMgX6+aVJ82NXCd+tB2+It8IgQtZJQcAjUvZp tMZ5HVFsejX4SMoMyUII0+qa0pUH1S+U7I6dfqFR+uCSJ7Mfei4JZx8Lp5dnb7N1l2 c0FFJRW8s2M/9iAq+GjOAestYeZxGr4egQePe3M4kM3fYkWCMsBlSZuUX1cJqo0EZw ynWyFjvHnj4jMbrHz1o/8bp2BFeZtETATMa/S+lzMe+zm4iHdfDryquVxjCD3SClkS Q4+VV86gXKLI5Q7rz4fuBF6T/0OAw3yEwnrFebY186J7HSHvq/MYh2dmFC26KLAaJt LzjHw7cZuHrsg== From: Alyssa Rosenzweig To: linux-mediatek@lists.infradead.org Cc: Matthias Brugger , Chun-Jie Chen , Robin Murphy , Alyssa Rosenzweig , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nick Fan , Nicolas Boichat , Stephen Boyd , AngeloGioacchino Del Regno Subject: [PATCH v2] soc: mediatek: mtk-infracfg: Disable ACP on MT8192 Date: Tue, 15 Feb 2022 13:46:51 -0500 Message-Id: <20220215184651.12168-1-alyssa.rosenzweig@collabora.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,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 MT8192 contains an experimental Accelerator Coherency Port implementation, which does not work correctly but was unintentionally enabled by default. For correct operation of the GPU, we must set a chicken bit disabling ACP on MT8192. Adapted from the following downstream change to the out-of-tree, legacy Mali GPU driver: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2781271/5 Note this change is required for both Panfrost and the legacy kernel driver. v2: Move the change from clk-mt8192.c to mtk-infracfg.c (Robin). Although it does not make sense to add this platform-specific hack to the GPU driver, it has nothing to do with clocks. We already have mtk-infracfg.c to manage other infracfg bits; the ACP disable should live there too. Co-developed-by: Robin Murphy Signed-off-by: Robin Murphy Signed-off-by: Alyssa Rosenzweig Cc: Nick Fan Cc: Nicolas Boichat Cc: Chen-Yu Tsai Cc: Stephen Boyd Cc: AngeloGioacchino Del Regno --- drivers/soc/mediatek/mtk-infracfg.c | 19 +++++++++++++++++++ include/linux/soc/mediatek/infracfg.h | 3 +++ 2 files changed, 22 insertions(+) diff --git a/drivers/soc/mediatek/mtk-infracfg.c b/drivers/soc/mediatek/mtk-infracfg.c index 0590b68e0d78..2acf19676af2 100644 --- a/drivers/soc/mediatek/mtk-infracfg.c +++ b/drivers/soc/mediatek/mtk-infracfg.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -72,3 +73,21 @@ int mtk_infracfg_clear_bus_protection(struct regmap *infracfg, u32 mask, return ret; } + +static int __init mtk_infracfg_init(void) +{ + struct regmap *infracfg; + + /* + * MT8192 has an experimental path to route GPU traffic to the DSU's + * Accelerator Coherency Port, which is inadvertently enabled by + * default. It turns out not to work, so disable it to prevent spurious + * GPU faults. + */ + infracfg = syscon_regmap_lookup_by_compatible("mediatek,mt8192-infracfg"); + if (!IS_ERR(infracfg)) + regmap_set_bits(infracfg, MT8192_INFRA_CTRL, + MT8192_INFRA_CTRL_DISABLE_MFG2ACP); + return 0; +} +postcore_initcall(mtk_infracfg_init); diff --git a/include/linux/soc/mediatek/infracfg.h b/include/linux/soc/mediatek/infracfg.h index d858e0bab7a2..fcbbd0dd5e55 100644 --- a/include/linux/soc/mediatek/infracfg.h +++ b/include/linux/soc/mediatek/infracfg.h @@ -229,6 +229,9 @@ #define INFRA_TOPAXI_PROTECTEN_SET 0x0260 #define INFRA_TOPAXI_PROTECTEN_CLR 0x0264 +#define MT8192_INFRA_CTRL 0x290 +#define MT8192_INFRA_CTRL_DISABLE_MFG2ACP BIT(9) + #define REG_INFRA_MISC 0xf00 #define F_DDR_4GB_SUPPORT_EN BIT(13) -- 2.34.1