From patchwork Sat Jun 25 11:36:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 12895340 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CBCBC43334 for ; Sat, 25 Jun 2022 11:41:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aVCWYUn565paPfwYGzoKBZ34+RS58/aWMpzNNDpJHJg=; b=vhX/7Nl7xWUpNf 4fiEO8KamwCfyR0ECO3/idoEIpt2MbPKLTSYE2iTgweEycbxaY6w/wr72w2mLeBHXsQaY3LWpvwb3 yjNrhq2wIrruvucS4AFt0aUk+B/2jR0XcNPzakRp8PZQFmTTD3y4/umoVYLhwxfnAuSttO6k2mzVk lI4xCrd66zlPrmOYE5HHbq1rPh1ApS5gtCd17eu6dhP77tdEYvFxzK/XUhI+VTXlTM0sh6BbDZpBo haZFWcozaxKRIUOypy9bGPeGTFAjADRJmUxI1cMQFUfMHKZSiqXqypTdsABn6Ocnu+999kFkjUzAH SIDoetsGib06y75vs0Og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o548y-005nrB-9R; Sat, 25 Jun 2022 11:40:04 +0000 Received: from mout.kundenserver.de ([212.227.17.10]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o546B-005ma3-IV for linux-arm-kernel@lists.infradead.org; Sat, 25 Jun 2022 11:37:15 +0000 Received: from localhost.localdomain ([37.4.249.155]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M8xsm-1nz05v1cla-006AK8; Sat, 25 Jun 2022 13:37:05 +0200 From: Stefan Wahren To: Florian Fainelli , Ray Jui , Scott Branden , Lee Jones Cc: Peter Robinson , Melissa Wen , Phil Elwell , bcm-kernel-feedback-list@broadcom.com, Maxime Ripard , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stefan Wahren Subject: [PATCH V4 10/11] soc: bcm: bcm2835-power: Add support for BCM2711's RPiVid ASB Date: Sat, 25 Jun 2022 13:36:18 +0200 Message-Id: <20220625113619.15944-11-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220625113619.15944-1-stefan.wahren@i2se.com> References: <20220625113619.15944-1-stefan.wahren@i2se.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:CrAi4k9Wo8hscyvh6c49EdnfeKAOjVeZNKoVyBNv8a+wSJRWS4z X/dnARLoxXrNsaNJuB3fMJjmvMU76kAJIFnvdg7ZQFqHQJk2a5jmXokxxiyn0ZCZMCPrFu1 oMYRVrOpRUgB03KFIBxMrvNUpKINUwNKaiGQTrfgKzP69Kye/ORXYetqhdDfvk4CyeKOHr+ GjUm+OE04XcpEs0z20hmg== X-UI-Out-Filterresults: notjunk:1;V03:K0:l/7/A6MLRNI=:mqVwQO8FHcu1+Z0dh9v62s 1NGbvXmwIPOM/x6UOc9ib/+79IjAd/vEQgGf3cmWwuyBMn+t1eyVHS8SppX1T4E3sF2BBuadT CHxr+zZpE2ck1uSpoLY06yDbvhsmtx1l42M/2+5uvhUWxF/J1CRe+GU1dxO25FEsuWGgfgBKI i0RUZaSJ8FCO1gRbM6yckG2hhbi+W49uO9hNEEn9opj1SReUcaogh8Yno0lf3trxV1v9txL4O 7kTHjWtpVzIsjTfCPaTW97LvZhjJFV5W1utVL9ApqKeO5ujvAT/90xM/D9jGFF+m0pvqQ/RUi 7clsRhNyzgDagcQ5LIqBRl1vyuBI7FKmsO2Znyaor+nH/CmD/Qd3UlkX9TIkrhK1vM4meKeex 76oBBDcuHzgE0v3t2/0Wk+mWEEYS1sapIX5kM8WDc1SSD+g9fWBiYP5wxuS3ArVMhYT79Msyg xrABKXhUXIVvCJ8OsBDlW20jAY1R7iUaCp/9hUNoocbYYYbpwaOhcc+XSYtNwXrQ0fe2SZ8ZQ +/9f/Ui0NZgNzvT7XioW6jTqbGLbnfjrNLbW5cS366R30OPPlpRjam5t4oHWlZIVXPGlA7LSl uBWGVOobtJ5BDz6jmc8gHLSN3rR7eYcTRgoRBvIli2Ma1AIofEQLj1jCPpMEnC1Jwl7P+PeKZ bgMk6nmJFOcyvs1DgMrapS0QSfZmx6P9viKM1F+XE4jvuZfrEbDl6SNRet6tUJpEyJzsspnrW uJDtszOpgc5XvM2VVA6b8h7Xrx6nDuPM151MokCtQxGQ9DkMd+l9Vxr3Euw= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220625_043711_966395_9D8512CB X-CRM114-Status: GOOD ( 16.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In BCM2711 the new RPiVid ASB took over V3D. The old ASB is still present with the ISP and H264 bits, and V3D is in the same place in the new ASB as the old one. Use the fact that 'pm->rpivid_asb' is populated as a hint that we're on BCM2711. Signed-off-by: Stefan Wahren Reviewed-by: Peter Robinson Acked-by: Florian Fainelli --- drivers/soc/bcm/bcm2835-power.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/soc/bcm/bcm2835-power.c b/drivers/soc/bcm/bcm2835-power.c index 9c352f66e6d5..1e06d91c0739 100644 --- a/drivers/soc/bcm/bcm2835-power.c +++ b/drivers/soc/bcm/bcm2835-power.c @@ -126,6 +126,8 @@ #define ASB_AXI_BRDG_ID 0x20 +#define BCM2835_BRDG_ID 0x62726467 + struct bcm2835_power_domain { struct generic_pm_domain base; struct bcm2835_power *power; @@ -139,6 +141,8 @@ struct bcm2835_power { void __iomem *base; /* AXI Async bridge registers. */ void __iomem *asb; + /* RPiVid bridge registers. */ + void __iomem *rpivid_asb; struct genpd_onecell_data pd_xlate; struct bcm2835_power_domain domains[BCM2835_POWER_DOMAIN_COUNT]; @@ -151,8 +155,15 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable u64 start; u32 val; - if (!reg) + switch (reg) { + case 0: return 0; + case ASB_V3D_S_CTRL: + case ASB_V3D_M_CTRL: + if (power->rpivid_asb) + base = power->rpivid_asb; + break; + } start = ktime_get_ns(); @@ -621,13 +632,23 @@ static int bcm2835_power_probe(struct platform_device *pdev) power->dev = dev; power->base = pm->base; power->asb = pm->asb; + power->rpivid_asb = pm->rpivid_asb; id = readl(power->asb + ASB_AXI_BRDG_ID); - if (id != 0x62726467 /* "BRDG" */) { + if (id != BCM2835_BRDG_ID /* "BRDG" */) { dev_err(dev, "ASB register ID returned 0x%08x\n", id); return -ENODEV; } + if (power->rpivid_asb) { + id = readl(power->rpivid_asb + ASB_AXI_BRDG_ID); + if (id != BCM2835_BRDG_ID /* "BRDG" */) { + dev_err(dev, "RPiVid ASB register ID returned 0x%08x\n", + id); + return -ENODEV; + } + } + power->pd_xlate.domains = devm_kcalloc(dev, ARRAY_SIZE(power_domain_names), sizeof(*power->pd_xlate.domains),