Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6409099pxb; Wed, 17 Feb 2021 03:55:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6DJaW7yX3Nq3HuLCfPQsz5V8zcmTXv5K32H/X2Yf/yDsnY8chY6bsGQlHOhZ0ke7ITzgf X-Received: by 2002:a50:eb8b:: with SMTP id y11mr22378291edr.216.1613562904682; Wed, 17 Feb 2021 03:55:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613562904; cv=none; d=google.com; s=arc-20160816; b=HbP5vzZKUh4D3k4z7MEQhzvFRPhZfvNlp6j/DDr7x+Hy69E9BoKFPrhjI4XHzikhdC ZfcLjlJROpuHebd28PX0FdRdzNyDnt34Cpe3IUTt5dFDuEdg5QC1Bz8J7Nkw7/M/IofD FYcfmPTy21vH4fKV0Cf+uJSPvOFOVLqwtOD8m0KXZ4DvRJ5yBDAciT6UDfiGhfo6lxSa 2rdNXiMkIqF1Z72QIlAFliAzqfne9Mg4BGdwLbK+x+STX6QWiJbZ2PcwUkLj/lxQiQv9 ovuxQE478kjhvkqpCtoQabGlRqhrApgrt4ePlF/yM6GNm6YfIByytM6SmXxyxUtMYnP6 IOXA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=IorWgGhKf37twSNC6j5dL64YJ/4a9qI1vFFF1+KmEXw=; b=OSN6btit4Di254aLWFL5f/pSnMEbcO3s55u22WfLKSDcP38kj8Prlu2BKacgucyggw fqjLIDxHiyqt7Q/3za4YiZuqH5RgL9kvVds7Hrt9qFXRAAvaEN/ibPRcWSdmn3DVIL4m 6nAvnZ/WaY0kxPZzA1/+uv36GsFPHWlyxPFqwoU5G1AKegUeFrQiRmd9NdsXJyw45MJP 8akBp8Il2mCFhuKV57Inu73eiv23P5/ts9sYy4dZ9A6WvZwOWf0G31gzsKEb403abfwa vjsWvd7NHeLpjbuEGA2V+PoLER43CwDMtSShCRNdkaiAkS22KNThSqZfLEnwV0/J46PN zS3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m25si1291042eda.322.2021.02.17.03.54.41; Wed, 17 Feb 2021 03:55:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232429AbhBQLwu (ORCPT + 99 others); Wed, 17 Feb 2021 06:52:50 -0500 Received: from mx2.suse.de ([195.135.220.15]:33978 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232430AbhBQLtq (ORCPT ); Wed, 17 Feb 2021 06:49:46 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 34983B808; Wed, 17 Feb 2021 11:48:28 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Lee Jones , Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com Cc: linux-rpi-kernel@lists.infradead.org, phil@raspberrypi.com, wahrenst@gmx.net, mripard@kernel.org, eric@anholt.net, robh@kernel.org Subject: [PATCH v3 07/15] mfd: bcm2835-pm: Add support for BCM2711 Date: Wed, 17 Feb 2021 12:48:02 +0100 Message-Id: <20210217114811.22069-8-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210217114811.22069-1-nsaenzjulienne@suse.de> References: <20210217114811.22069-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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: Nicolas Saenz Julienne [1] See: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi 4 support") --- Changes since v2: - Correct names again! Changes since v1: - Use reg-names - Correct ASB names drivers/mfd/bcm2835-pm.c | 25 +++++++++++++++++++++++-- include/linux/mfd/bcm2835-pm.h | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/bcm2835-pm.c b/drivers/mfd/bcm2835-pm.c index 36fede92775c..a06e9cf19b64 100644 --- a/drivers/mfd/bcm2835-pm.c +++ b/drivers/mfd/bcm2835-pm.c @@ -6,6 +6,7 @@ * the WDT and power drivers. */ +#include #include #include #include @@ -17,6 +18,9 @@ #include #include +#define BCM2835 BIT(1) +#define BCM2711 BIT(2) + static const struct mfd_cell bcm2835_pm_devs[] = { { .name = "bcm2835-wdt" }, }; @@ -28,6 +32,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 = (uintptr_t)device_get_match_data(pm->dev) & BCM2711; + /* If no 'reg-names' property is found we can assume we're using old * firmware. */ @@ -41,6 +47,10 @@ static int bcm2835_pm_get_pdata(struct platform_device *pdev, pm->asb = devm_platform_ioremap_resource(pdev, 1); if (IS_ERR(pm->asb)) pm->asb = NULL; + + pm->rpivid_asb = devm_platform_ioremap_resource(pdev, 2); + if (IS_ERR(pm->rpivid_asb)) + pm->rpivid_asb = NULL; } else { pm->base = devm_platform_ioremap_resource_byname(pdev, "pm"); if (IS_ERR(pm->base)) @@ -49,6 +59,16 @@ static int bcm2835_pm_get_pdata(struct platform_device *pdev, pm->asb = devm_platform_ioremap_resource_byname(pdev, "asb"); if (IS_ERR(pm->base)) pm->asb = NULL; + + pm->rpivid_asb = devm_platform_ioremap_resource_byname(pdev, + "rpivid_asb"); + if (IS_ERR(pm->base)) + 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; @@ -89,8 +109,9 @@ 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,bcm2835-pm-wdt", .data = (void *)BCM2835}, + { .compatible = "brcm,bcm2835-pm", .data = (void *)BCM2835}, + { .compatible = "brcm,bcm2711-pm", .data = (void *)BCM2711}, {}, }; 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 */ -- 2.30.0