From patchwork Sun Feb 13 22:56:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Robinson X-Patchwork-Id: 12744725 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 EF627C433F5 for ; Sun, 13 Feb 2022 23:00:54 +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=ossE9LWNPjZZv4qRiLwqTzZz0Ln8zYeo2c2PdDlKcyM=; b=FdzANNf73tskcO AgdzcR4UkDLaV1QxF71OA9V9huEyRuRpX/Vru5G0HHegfLMm/kV6uTc9Tx2CoX1MlK8x0bNl4yOJ5 29hBue4zz+x1azQPMSskkm/QwBWcnG8n2eDFfqAM721qi/R2fh5tnTd5lN7Sl/Tttq1mAUo4r/IGr Yckf3g/XgbRFzaDUQ+XfpPBQEZzaB30yBQ3V1Sg+0yaxWKyYFuaQtkFkwSh4hLHvuLAm8mECU3zKG I+a2T7nJTLAFSawcPzTuM6BFgDOApbOVUxtgsu7SXrDROJ11BKrYDzNsU4g31458aRE0tewaJSVXo 1M0lx0ekbLWJCU1GvP2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNq5-00CigR-FH; Sun, 13 Feb 2022 22:59:29 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNom-00Ci5p-Cx; Sun, 13 Feb 2022 22:58:10 +0000 Received: by mail-ej1-x634.google.com with SMTP id p9so11020236ejd.6; Sun, 13 Feb 2022 14:58:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gH8fsrRlg3C6SSTb3qLzsD14CS9me/GxO3/rmRt1Yy4=; b=ps4J/eHO+enBkq9qoHdjxixoy6iK+cwVsFnT/rqf6Hd2oEdirw3vOj21XoUfYBYp06 7qDZE8DAoVTdBUcxk5KVFkHnRI7FCaBFJVvwtxFwuwyJlUaPCizlcxaJNNSMS0MyxzOx efK+tPYUPeC5VDgJWYYKA61I2cwpWdyVEw2nJUQLILM+weurWsHmTxiv0+5+Wv2XY29u jH7T8KPW0uHueWPEP2cf8249U1lroBqUugq/vdkPUH6CEs3B+kSfzXL1nqWZoqbKgrv4 rnWCgpwxQFRUDhVQ+Ibp5/ZOn9hJcc1Lk9HScUZ3yHsb4SjzeR+yEaT04nPoQWvKizks OyOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gH8fsrRlg3C6SSTb3qLzsD14CS9me/GxO3/rmRt1Yy4=; b=CKsiTikPiAjnGiIBeuKaaYXSGTRvOZXxe5xfQeEVJ4cPKp8iFO7gNIg/cM0kkNMEWQ p8IY/wrBNIdQ5qhWWCSxXxd5K8prCcXeJE5ddPTHAwzXyWJahODIdK8Q9E1vORGzenT2 mhZbw8CYIvWGkCZPXvmThblYhsIC3W9si2An9DOWVPyZfV6pICk7dzx0ci81zJJEK81O uMbOw02MPgaK6knsy6V6HbfzHYMxgOlse6rTNcnz8ZbDYONO1bm2kgCIhWp+Gm7PsrQq d2fiKHZ2PR5SrLEbeRT1Xi62Nyw8+BdrEkiB/Cd6wf4ooEpuOOu8V0xw8bBhfVn43dXA YSmQ== X-Gm-Message-State: AOAM53195qWRabGdSlKBcbv9QjJtepbvprw1jmezIsE/RusZC9rRUKLa +/Ao4qJIYkdlAyc2/YgSQgk= X-Google-Smtp-Source: ABdhPJxFnysaGfjAPQJ745Q6+KqLdQRZe6OfpJuU9XJWEdFNQYylEnVAQpnKRTUxZkRhcWmb2eMhfw== X-Received: by 2002:a17:907:3d8f:: with SMTP id he15mr9290907ejc.623.1644793086517; Sun, 13 Feb 2022 14:58:06 -0800 (PST) Received: from morpheus.home.roving-it.com (3.e.2.0.0.0.0.0.0.0.0.0.0.0.0.0.1.8.6.2.1.1.b.f.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:fb11:2681::2e3]) by smtp.googlemail.com with ESMTPSA id g14sm3189163edb.55.2022.02.13.14.58.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 14:58:06 -0800 (PST) From: Peter Robinson To: Nicolas Saenz Julienne , Rob Herring , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Lee Jones , Emma Anholt , David Airlie , Daniel Vetter , Russell King , Arnd Bergmann , Catalin Marinas , Will Deacon Cc: Nicolas Saenz Julienne , Peter Robinson Subject: [PATCH v4 07/15] mfd: bcm2835-pm: Add support for BCM2711 Date: Sun, 13 Feb 2022 22:56:39 +0000 Message-Id: <20220213225646.67761-8-pbrobinson@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220213225646.67761-1-pbrobinson@gmail.com> References: <20220213225646.67761-1-pbrobinson@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220213_145808_523001_234FDE79 X-CRM114-Status: GOOD ( 22.74 ) 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 From: Nicolas Saenz Julienne 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 Signed-off-by: Peter Robinson [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 */