From patchwork Sun May 15 20:20:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 12850084 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 4E326C433EF for ; Sun, 15 May 2022 20:24:40 +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=6+QeKy7tUL7zj2g50/C2qzyGwlxt1DWQ4NgnDzbgKKk=; b=rTDN8U4H5Rs81A Y7xFu7oKEvEa8PTNJiLrCrn+ok1282Fp2q4b+k+cGJQg93JBy2Pz8yN1H2V5eaXUWjnCDQ5CgOzMn MYplP+fhJFpOg5d9GuAs+oFo5JsYgyXN6Ms/I2fJ+OZatk3KJmQlxbEWL3jryTYMQkavX2t23TX9m o26ORhIxd9Tr3R+DQC5cIi1ARyL7LHuh9Zw4UMWfWrgbpLZt49R2n826I3+msthlgXC2bFQDnOIY5 Pcjk8vbuFuoVNuhwrwLF7eWz+5uYEZGHHAFfG3fWpoXfg7grBg+mvmQmIHBWXkQM6MWdb1Khq7ZUn tUanNb6h526O6ram6xEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqKm6-004v9I-5B; Sun, 15 May 2022 20:23:34 +0000 Received: from mout.kundenserver.de ([212.227.126.133]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqKk6-004uAP-9J; Sun, 15 May 2022 20:21:33 +0000 Received: from localhost.localdomain ([37.4.249.94]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1McXwD-1nKJNR0aGT-00czwE; Sun, 15 May 2022 22:21:24 +0200 From: Stefan Wahren To: Florian Fainelli , Ray Jui , Scott Branden , Nicolas Saenz Julienne , Lee Jones Cc: Peter Robinson , Melissa Wen , Phil Elwell , bcm-kernel-feedback-list@broadcom.com, Maxime Ripard , devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Stefan Wahren Subject: [PATCH 10/11] soc: bcm: bcm2835-power: Add support for BCM2711's RPiVid ASB Date: Sun, 15 May 2022 22:20:31 +0200 Message-Id: <20220515202032.3046-11-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220515202032.3046-1-stefan.wahren@i2se.com> References: <20220515202032.3046-1-stefan.wahren@i2se.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:/fM6OPNtRTKLgroxg6P+k+A2l+bkQQQWlbyybbize/YASC+t83X kdU1dW3QG5zFrcc8pyOjvjJ6yXQjx8lLLjy67BWcwiZQ+ix/NyhV85yRWgrr8DC3y6Ld/0P fK1r2paB3eLhpVDlXZsPfdIUGrzlVg2ZMqZOro0ucklyV4G1wskb7nH60q+bDLgM0/T+wcU NXoPYPIEBjgjcG1qWWIjQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:bSEQsKQaPLo=:5oxFBjZxP2gIaziTg9zJ3b 4QrxNfA9a/JD8J6v06/FEQI1f4ZZwFddBDxa6SEnHrWXy2F2oV3yGiR3RE4r7jo38qpYvHt/O MEpVT+eWjMlnmAS9C12UNc0e9QWfnKN6gCy2gsANk20Nyp2hPsd0swjFp6t+pTqVy6RKyw8qA /l8Ha++tUDzZh3WbitqLAr+o2aUmntLycyDNBnpLTdgG0G+6x/p1Q22SAhdG2yGBEjREBRGRh TGEvEwakNDChHGzVlJNjqj/pmm3lIc1ecKzulYMfpNeu2cycRuKtT4fvHg3FxKy66wAX/R4pu OkBR7pU2QwDmssjaXk3ANXZ6MdYTh7J8YN+egn4wNGnuEcovQ821zyAFMbKMKOGn6tiTheH19 66vIrd9Pyw2pRP3OzDX5hMhlLwwd/T4M4PWUgC04DzZtR7AUNlSpkp1Xjw+mhkJ6eNiS8NaQ6 iVDKB4keilZ0vb1g5GBxMo/n7Ovhyzqxuj0m5nGGLbAS6Kxrrf1a3aLY2fGTQ93WyzAZq/Bsa IvQMlbMvF4SkxptIVRJ65QeUtoqGPbLfmPb0SzYy525sQZGKV6EJkDr215ojo8bNHiINATN/v IFMe+BDupZpJ2faoFch0jACIeoIeyak2+vvgD2i1NqHb1sxDcLLV+CQj4qukp1j7EgPRVHzMz Yxp0rC2WLQCR5+Ec/roBQARcVnDEpZ6Zq+W9ceaoGxkTYX12Mpai1WjkBvVinam2BGt9GGNBc BRUlGEPdFKIDM3I8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220515_132130_677188_0549BE2D X-CRM114-Status: GOOD ( 14.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 --- drivers/soc/bcm/bcm2835-power.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/soc/bcm/bcm2835-power.c b/drivers/soc/bcm/bcm2835-power.c index fa0a13035794..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,9 +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(); @@ -622,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),