From patchwork Sun May 15 20:20:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 12850083 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 85006C433EF for ; Sun, 15 May 2022 20:24:20 +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=3Wiixa2MFVd0bAVT5CXxvQ5RIxbnN6ClhpAwZf5Hxlg=; b=WCxKVf+yntC3Hi KDQO8exsZYnlk1j0+vKI40KrJX5L9gPAoqiQxyUlQyhepChYBfRixeNGQodFqWvG4B10kEzxXCny2 az0XIsTvPS4oheE4+whXhadLMtgXP+pSpuM99TWoC8bgZfLlHZxgVdgX6LMHxQYb8JB3Az/UMnfOv Yo3a4rzgaC08qt1J69Yy7UrPaU0MwS8Db944FFQpWWPbQ5PAfWvvdYVjgVgG9uHMMx1hx4ZjR0RRx 2x/kYqqwsjdh7eQ3PkrxWkooXOKZSUNIurSo8ZL+M+i8Ec2fkzeR9Q84n45tGrajyYhluDD5ALNvy UGZC1iCwklJjLdxB5W4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqKlp-004uym-AM; Sun, 15 May 2022 20:23:17 +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 1nqKk5-004u8h-41; 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 1MZkd5-1oMQb71GTv-00WlUa; Sun, 15 May 2022 22:21:22 +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 07/11] mfd: bcm2835-pm: Add support for BCM2711 Date: Sun, 15 May 2022 22:20:28 +0200 Message-Id: <20220515202032.3046-8-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:4Si2iYUKDyfIR2VHN4xNZ0Z/q2PQv44pgS66WVd8M3m1i6viOYR oRgb2yw1kWXBgrmCAZIMMsk/gtPpggZxhQcI/AKhgvz+VJMfftnk0H1rpHFNrR/jrAEFgZI oUmIxK9pozZR611xU4mlawbjl+n0UQ00Uy4XnduezRvQK5rSP2V1p8Bmod0NiawibRq3+NO i3E8MqKpJSB1ARgeGI/mw== X-UI-Out-Filterresults: notjunk:1;V03:K0:pfukOn779hw=:1m6QlStlv6APXT+MSX+2i2 ezFuRRGV/sc2LQ8wa39xRg4YG4VserQbNqXkJ/BLy1Fx9zxYhAh7VThHDjdbAghQ/0W+D4SJS TADTHngJvIzBWiVJCiQr9okKhsHCuUj/J9vy1x3yhqFI69C7hnzFTegeK8zvYdn8d5LJOy+CH RsRiGVr1DGSsHoHhn2tnxYSX8E2Or430SG8D/mZhCdVIaBjXf4dYkI2ZDk4ya0fWr1Zc2mZpI j38Q/uw5qo1Z7VUWAsD6ZNWaIEPMjbMh1qfC5/7AU7WLOKTKNIvhA1JJmihIB8GAYBBFaXsj4 rkyNL+VZKqSIzRPrzpXiTafBWVRk+0xWHRahc+f0rh9MNaL2hLisARdyvPvBr+FUBHiXbi/PA V34ekwt/shVG2E9BDKq1hynJumCL+O+TwCvaQLZJIy/8dz/emw6QyPhQK6jKemlRm+zwoU1pd +Fj148Cp6mFQE8dOy4Slm3kZ0PGcz7g6srXAfb2GBiMIKXGEPp7+7c5Qlgy9SfHAScyPi8IA8 8ha/ZcJ4Nvsc8u1bAmvGmSrPIZwluJhtaFeZKJe11haFy1dOMIMe7+P+64BR936Wj8y/sKAvh E7VjqrcjHbwJvIMZSYaSpKhBqLL5dATBBGfhV6t1aYvJRaoLQGXzNmmOZ5kbVH0m/Q9Qh2foS +XGVT9SWJIPTeNfj+7gWI2j/KoVXO6K4AgawEFQf2G5qghEJtwaK95aGTHIXGH7CYhnMpXKcn ojVjXSR63E5NV6t+ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220515_132129_537749_3E85FDE0 X-CRM114-Status: GOOD ( 17.38 ) 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. As per the devicetree bindings, BCM2711 will provide both the old and new ASB resources, so get both of them and pass them into 'bcm2835-power,' which will take care of selecting which one to use accordingly. Since the RPiVid ASB's resources were being provided prior to formalizing the bindings[1], also support the old firmwares that didn't use 'reg-names.' Signed-off-by: Stefan Wahren --- drivers/mfd/bcm2835-pm.c | 18 ++++++++++++++++++ include/linux/mfd/bcm2835-pm.h | 1 + 2 files changed, 19 insertions(+) diff --git a/drivers/mfd/bcm2835-pm.c b/drivers/mfd/bcm2835-pm.c index 1656d786993a..da110767c6a4 100644 --- a/drivers/mfd/bcm2835-pm.c +++ b/drivers/mfd/bcm2835-pm.c @@ -28,6 +28,8 @@ static const struct mfd_cell bcm2835_power_devs[] = { static int bcm2835_pm_get_pdata(struct platform_device *pdev, struct bcm2835_pm *pm) { + bool is_bcm2711 = of_device_is_compatible(pm->dev->of_node, "brcm,bcm2711-pm"); + /* If no 'reg-names' property is found we can assume we're using old * firmware. */ @@ -39,6 +41,7 @@ static int bcm2835_pm_get_pdata(struct platform_device *pdev, return PTR_ERR(pm->base); pm->asb = devm_platform_ioremap_resource(pdev, 1); + pm->rpivid_asb = devm_platform_ioremap_resource(pdev, 2); } else { struct resource *res; @@ -50,11 +53,25 @@ static int bcm2835_pm_get_pdata(struct platform_device *pdev, "asb"); if (res) pm->asb = devm_ioremap_resource(&pdev->dev, res); + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, + "rpivid_asb"); + if (res) + pm->rpivid_asb = devm_ioremap_resource(&pdev->dev, + res); } if (IS_ERR(pm->asb)) pm->asb = NULL; + if (IS_ERR(pm->rpivid_asb)) + pm->rpivid_asb = NULL; + + if (pm->rpivid_asb && !is_bcm2711) { + dev_err(pm->dev, "RPiVid ASB support only present in BCM2711\n"); + return -EINVAL; + } + return 0; } @@ -95,6 +112,7 @@ static int bcm2835_pm_probe(struct platform_device *pdev) static const struct of_device_id bcm2835_pm_of_match[] = { { .compatible = "brcm,bcm2835-pm-wdt", }, { .compatible = "brcm,bcm2835-pm", }, + { .compatible = "brcm,bcm2711-pm", }, {}, }; MODULE_DEVICE_TABLE(of, bcm2835_pm_of_match); diff --git a/include/linux/mfd/bcm2835-pm.h b/include/linux/mfd/bcm2835-pm.h index ed37dc40e82a..f70a810c55f7 100644 --- a/include/linux/mfd/bcm2835-pm.h +++ b/include/linux/mfd/bcm2835-pm.h @@ -9,6 +9,7 @@ struct bcm2835_pm { struct device *dev; void __iomem *base; void __iomem *asb; + void __iomem *rpivid_asb; }; #endif /* BCM2835_MFD_PM_H */