From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> To: f.fainelli@gmail.com, linux-kernel@vger.kernel.org, Lee Jones <lee.jones@linaro.org>, Nicolas Saenz Julienne <nsaenzjulienne@suse.de>, Ray Jui <rjui@broadcom.com>, Scott Branden <sbranden@broadcom.com>, bcm-kernel-feedback-list@broadcom.com Cc: linux-rpi-kernel@lists.infradead.org, phil@raspberrypi.com, wahrenst@gmx.net, linux-arm-kernel@lists.infradead.org, mripard@kernel.org, eric@anholt.net Subject: [RFC/PATCH v2 08/16] mfd: bcm2835-pm: Add support for BCM2711 Date: Tue, 9 Feb 2021 13:59:04 +0100 [thread overview] Message-ID: <20210209125912.3398-9-nsaenzjulienne@suse.de> (raw) In-Reply-To: <20210209125912.3398-1-nsaenzjulienne@suse.de> In BCM2711 the new Argon 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 Argon 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 <nsaenzjulienne@suse.de> [1] See: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi 4 support") --- 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 182ccdc2a06b..26666ad11f12 100644 --- a/drivers/mfd/bcm2835-pm.c +++ b/drivers/mfd/bcm2835-pm.c @@ -6,6 +6,7 @@ * the WDT and power drivers. */ +#include <linux/bits.h> #include <linux/delay.h> #include <linux/io.h> #include <linux/mfd/bcm2835-pm.h> @@ -17,6 +18,9 @@ #include <linux/types.h> #include <linux/watchdog.h> +#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->rpivid_asb = devm_platform_ioremap_resource(pdev, 1); if (IS_ERR(pm->rpivid_asb)) pm->rpivid_asb = NULL; + + pm->argon_asb = devm_platform_ioremap_resource(pdev, 2); + if (IS_ERR(pm->argon_asb)) + pm->argon_asb = NULL; } else { pm->base = devm_platform_ioremap_resource_byname(pdev, "pm"); if (IS_ERR(pm->base)) @@ -50,6 +60,16 @@ static int bcm2835_pm_get_pdata(struct platform_device *pdev, "rpivid_asb"); if (IS_ERR(pm->base)) pm->rpivid_asb = NULL; + + pm->argon_asb = devm_platform_ioremap_resource_byname(pdev, + "argon_asb"); + if (IS_ERR(pm->base)) + pm->argon_asb = NULL; + + if (pm->argon_asb && !is_bcm2711) { + dev_err(pm->dev, "Argon ASB support only present in BCM2711\n"); + return -EINVAL; + } } return 0; @@ -90,8 +110,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 ed4bd548db09..89fb2b5cdc1a 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 *rpivid_asb; + void __iomem *argon_asb; }; #endif /* BCM2835_MFD_PM_H */ -- 2.30.0
WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> To: f.fainelli@gmail.com, linux-kernel@vger.kernel.org, Lee Jones <lee.jones@linaro.org>, Nicolas Saenz Julienne <nsaenzjulienne@suse.de>, Ray Jui <rjui@broadcom.com>, Scott Branden <sbranden@broadcom.com>, bcm-kernel-feedback-list@broadcom.com Cc: mripard@kernel.org, eric@anholt.net, wahrenst@gmx.net, phil@raspberrypi.com, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org Subject: [RFC/PATCH v2 08/16] mfd: bcm2835-pm: Add support for BCM2711 Date: Tue, 9 Feb 2021 13:59:04 +0100 [thread overview] Message-ID: <20210209125912.3398-9-nsaenzjulienne@suse.de> (raw) In-Reply-To: <20210209125912.3398-1-nsaenzjulienne@suse.de> In BCM2711 the new Argon 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 Argon 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 <nsaenzjulienne@suse.de> [1] See: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi 4 support") --- 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 182ccdc2a06b..26666ad11f12 100644 --- a/drivers/mfd/bcm2835-pm.c +++ b/drivers/mfd/bcm2835-pm.c @@ -6,6 +6,7 @@ * the WDT and power drivers. */ +#include <linux/bits.h> #include <linux/delay.h> #include <linux/io.h> #include <linux/mfd/bcm2835-pm.h> @@ -17,6 +18,9 @@ #include <linux/types.h> #include <linux/watchdog.h> +#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->rpivid_asb = devm_platform_ioremap_resource(pdev, 1); if (IS_ERR(pm->rpivid_asb)) pm->rpivid_asb = NULL; + + pm->argon_asb = devm_platform_ioremap_resource(pdev, 2); + if (IS_ERR(pm->argon_asb)) + pm->argon_asb = NULL; } else { pm->base = devm_platform_ioremap_resource_byname(pdev, "pm"); if (IS_ERR(pm->base)) @@ -50,6 +60,16 @@ static int bcm2835_pm_get_pdata(struct platform_device *pdev, "rpivid_asb"); if (IS_ERR(pm->base)) pm->rpivid_asb = NULL; + + pm->argon_asb = devm_platform_ioremap_resource_byname(pdev, + "argon_asb"); + if (IS_ERR(pm->base)) + pm->argon_asb = NULL; + + if (pm->argon_asb && !is_bcm2711) { + dev_err(pm->dev, "Argon ASB support only present in BCM2711\n"); + return -EINVAL; + } } return 0; @@ -90,8 +110,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 ed4bd548db09..89fb2b5cdc1a 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 *rpivid_asb; + void __iomem *argon_asb; }; #endif /* BCM2835_MFD_PM_H */ -- 2.30.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-02-09 13:04 UTC|newest] Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-09 12:58 [RFC/PATCH v2 00/16] Raspberry PI 4 V3D enablement Nicolas Saenz Julienne 2021-02-09 12:58 ` Nicolas Saenz Julienne 2021-02-09 12:58 ` Nicolas Saenz Julienne 2021-02-09 12:58 ` [RFC/PATCH v2 01/16] dt-bindings: soc: bcm: bcm2835-pm: Convert bindings to DT schema Nicolas Saenz Julienne 2021-02-09 12:58 ` Nicolas Saenz Julienne 2021-02-10 22:26 ` Rob Herring 2021-02-10 22:26 ` Rob Herring 2021-02-09 12:58 ` [RFC/PATCH v2 02/16] dt-bindings: soc: bcm: bcm2835-pm: Introduce reg-names Nicolas Saenz Julienne 2021-02-09 12:58 ` Nicolas Saenz Julienne 2021-02-10 22:44 ` Rob Herring 2021-02-10 22:44 ` Rob Herring 2021-02-09 12:58 ` [RFC/PATCH v2 03/16] dt-bindings: soc: bcm: bcm2835-pm: Add support for bcm2711 Nicolas Saenz Julienne 2021-02-09 12:58 ` Nicolas Saenz Julienne 2021-02-10 22:44 ` Rob Herring 2021-02-10 22:44 ` Rob Herring 2021-02-09 12:59 ` [RFC/PATCH v2 04/16] ARM: dts: bcm2835/bcm2711: Introduce reg-names in watchdog node Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-09 12:59 ` [RFC/PATCH v2 05/16] ARM: dts: bcm2711: Use proper compatible in PM/Watchdog node Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-09 12:59 ` [RFC/PATCH v2 06/16] mfd: bcm2835-pm: Rename asb to rpivid_asb Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-09 12:59 ` [RFC/PATCH v2 07/16] mfd: bcm2835-pm: Use 'reg-names' to get resources Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne [this message] 2021-02-09 12:59 ` [RFC/PATCH v2 08/16] mfd: bcm2835-pm: Add support for BCM2711 Nicolas Saenz Julienne 2021-02-09 12:59 ` [RFC/PATCH v2 09/16] soc: bcm: bcm2835-power: Add support for BCM2711's Argon ASB Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-09 13:19 ` Phil Elwell 2021-02-09 13:19 ` Phil Elwell 2021-02-09 14:00 ` Nicolas Saenz Julienne 2021-02-09 14:00 ` Nicolas Saenz Julienne 2021-02-09 16:38 ` Phil Elwell 2021-02-09 16:38 ` Phil Elwell 2021-02-09 16:50 ` Nicolas Saenz Julienne 2021-02-09 16:50 ` Nicolas Saenz Julienne 2021-02-09 12:59 ` [RFC/PATCH v2 10/16] soc: bcm: bcm2835-power: Bypass power_on/off() calls Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-09 12:59 ` [RFC/PATCH v2 11/16] dt-bindings: gpu: v3d: Add BCM2711's compatible Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-10 22:45 ` Rob Herring 2021-02-10 22:45 ` Rob Herring 2021-02-10 22:45 ` Rob Herring 2021-02-09 12:59 ` [RFC/PATCH v2 12/16] drm/v3d: Get rid of pm code Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-09 12:59 ` [RFC/PATCH v2 13/16] drm/v3d: Add support for bcm2711 Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-09 12:59 ` [RFC/PATCH v2 14/16] ARM: dts: bcm2711: Enable V3D Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-09 12:59 ` [RFC/PATCH v2 15/16] ARM: configs: Enable DRM_V3D Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne 2021-02-09 12:59 ` [RFC/PATCH v2 16/16] arm64: config: " Nicolas Saenz Julienne 2021-02-09 12:59 ` Nicolas Saenz Julienne
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210209125912.3398-9-nsaenzjulienne@suse.de \ --to=nsaenzjulienne@suse.de \ --cc=bcm-kernel-feedback-list@broadcom.com \ --cc=eric@anholt.net \ --cc=f.fainelli@gmail.com \ --cc=lee.jones@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-rpi-kernel@lists.infradead.org \ --cc=mripard@kernel.org \ --cc=phil@raspberrypi.com \ --cc=rjui@broadcom.com \ --cc=sbranden@broadcom.com \ --cc=wahrenst@gmx.net \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.