From patchwork Tue Jun 7 20:42:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 12872368 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 60408C43334 for ; Tue, 7 Jun 2022 20:45:15 +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=Rnv7bb0yBYQJwK T9OtodFUSqc9vSjODuFohGFSyeXh3Ku1naZ9UurOrCmggTmt2oR4/UCQp4GX9oAFr3/5JPpdouIiD KUMJ2GUTMItb+GlOw1CUsGT516/2fH2byYFUdIMHZZ5N8eWQgjh+yVrggFTAIjzPNmc2iEWALMZZs XmBucrvWIOq4qbqi1V0F8xBxXUm3Bqr8WptzNrxgOsWWh/f7eIHPs/UNVN+J3+R1mUQO4QqZUDqBt lnTmDddwPwhJk1MKO7nDN1g6OpZX+RRFa2Jdppm+nLPIwLL+Lvs0G0jBieipnKRzhJmQuZkS11Dk5 eLbVSNhhiJMng662WlkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyg3g-009aE6-2H; Tue, 07 Jun 2022 20:44:12 +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 1nyg2Z-009Zbp-FY for linux-arm-kernel@lists.infradead.org; Tue, 07 Jun 2022 20:43:06 +0000 Received: from localhost.localdomain ([37.4.249.155]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MLyzP-1oG4Qr2uED-00I0KD; Tue, 07 Jun 2022 22:42:56 +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 V3 10/11] soc: bcm: bcm2835-power: Add support for BCM2711's RPiVid ASB Date: Tue, 7 Jun 2022 22:42:25 +0200 Message-Id: <20220607204226.8703-11-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220607204226.8703-1-stefan.wahren@i2se.com> References: <20220607204226.8703-1-stefan.wahren@i2se.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:DrGPhiljN2HHySf7QaT4eoAuopHSufIfvWCuC3mvkeBvEQWoQEe ATtwlTHKorTQg94UivVxR/Bi1ZqpPRfxt9eC8yLue2HfmFqtZXi5l2D2aEP+nIJk8s1Gqc1 Ddx237LFrHMpMjm+NWGCKxlOQsg2TYpefPg7+92PzZWGf7DjqgFjQNNIYHMbcu1s1m9w8Cq dmijuFpeVBFAvbrUJlR3A== X-UI-Out-Filterresults: notjunk:1;V03:K0:hfI6Mk31Q0E=:iTaH2Nqxxp5KO18o1zeINK twrxC8hi6t1wH+4KKJe1qGI19q/k/hrANoV2prRrN4VTrpYpAqeh5eqWi25MtmE0WwYuNV3+p dG+mYZrsF2eV0oSNmjio9vFkH9tDTXNV1MlugS7InNxYjICO6BnxdIT4In8DqsHHdIvq56pBh aLfPvkHJY2CevIdiOWs6Ph46jk321o7LLsQTy2xppBXrKcCaPY+BQ7WaonLA7W4Rb2bfyXhUK LcOP2qd0pwpA8rG8bE30GzSyws2BJUIvBffDNPZUvbXNre2cilqkJL+Axo4ncdslDpoeAyfXm MuqB4ks3rehxsOY7UuptIojxLHMUkbxC4Od19UroHyULkWQ4kK+Xvvl6vYqx5LdGpDX7lX3Q8 8GVLC+CuJVkiJlkcpLY2eRuG9Y9WFC//2eVh740i0jenAEubg3dWbGa+kRe5IvaYwUjetUA61 Mq1vZ/Qy+rLNtoEHSe+gM8nTvmeG34+thQYX5Yw5FpUYrrO800nP8jLD4z13k9lLVOKgm7bID fJLUe+tY4R999URUqqlAoVf6ulx69k2Y9qoem9F2Q982Cso5MI2ld5ov+w51K8NGpgXRFr8Op Xe+l5w9z2LfnK+jL47TNIGg7H9rheJAd3g8TceasV5sqW7qiR13ENHBgo8MZDDUcAJHSyJtm+ 59El4HmHuvXQ6l05WH7FeBSooEAnJPpgN2zu4UNMuUGPupyfQI4jam9DMXwzHrEOLTkJlYOVj 7Up6I+DM49AwcHOF+0QDkkf1wBAhY6qbITvqZfx234yoS7MT+7tAEei1NQU= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220607_134303_882861_ECAD1B55 X-CRM114-Status: GOOD ( 17.04 ) 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 | 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),