From: Lee Jones <lee.jones@linaro.org>
To: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
Peter Robinson <pbrobinson@gmail.com>,
Melissa Wen <melissa.srw@gmail.com>,
Phil Elwell <phil@raspberrypi.com>,
bcm-kernel-feedback-list@broadcom.com,
Maxime Ripard <maxime@cerno.tech>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH V3 07/11] mfd: bcm2835-pm: Add support for BCM2711
Date: Thu, 23 Jun 2022 09:41:08 +0100 [thread overview]
Message-ID: <YrQnJBCzQNb9VcUf@google.com> (raw)
In-Reply-To: <20220607204226.8703-8-stefan.wahren@i2se.com>
On Tue, 07 Jun 2022, Stefan Wahren wrote:
> 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 DT files that didn't use
> 'reg-names.'
>
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
>
> [1] See: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi 4 support")
> ---
> drivers/mfd/bcm2835-pm.c | 21 +++++++++++++++++++++
> include/linux/mfd/bcm2835-pm.h | 1 +
> 2 files changed, 22 insertions(+)
>
> diff --git a/drivers/mfd/bcm2835-pm.c b/drivers/mfd/bcm2835-pm.c
> index ff0dae5a026d..4a2be669674a 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");
> +
Since this is only used once, probably better to call
of_device_is_compatible() in-place.
> /* 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,28 @@ 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;
> +
> + /* Ensure that rpivid_asb is set only for BCM2711, so subsequent
> + * driver can rely on this and don't get confused by broken DTB.
> + */
Please use proper formatting.
> + if (pm->rpivid_asb && !is_bcm2711) {
> + dev_err(pm->dev, "Unexpected rpivid_asb register, please fix your DTB.\n");
Not sure we should be validating values from DT like this.
If incorrect hardware information is placed into DT, unexpected
behaviour will occur. This is known. Perhaps a mention of this
should be placed into the DT binding documentation, but checking for
it here seems odd.
Same goes for the previous patch come to think of it. Please remove
the "update your DTB" warning from there too.
> + return -EINVAL;
> + }
> +
> return 0;
> }
>
> @@ -95,6 +115,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 */
--
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
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:[~2022-06-23 8:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-07 20:42 [PATCH V3 00/11] soc: bcm2835-power: Prepare BCM2711 V3D support Stefan Wahren
2022-06-07 20:42 ` [PATCH V3 01/11] dt-bindings: soc: bcm: bcm2835-pm: Convert bindings to DT schema Stefan Wahren
2022-06-07 20:42 ` [PATCH V3 02/11] dt-bindings: soc: bcm: bcm2835-pm: Introduce reg-names Stefan Wahren
2022-06-07 20:42 ` [PATCH V3 03/11] dt-bindings: soc: bcm: bcm2835-pm: Add support for bcm2711 Stefan Wahren
2022-06-09 20:42 ` Rob Herring
2022-06-07 20:42 ` [PATCH V3 04/11] ARM: dts: bcm2835/bcm2711: Introduce reg-names in watchdog node Stefan Wahren
2022-06-07 20:42 ` [PATCH V3 05/11] ARM: dts: bcm2711: Use proper compatible in PM/Watchdog node Stefan Wahren
2022-06-07 20:42 ` [PATCH V3 06/11] mfd: bcm2835-pm: Use 'reg-names' to get resources Stefan Wahren
2022-06-23 8:27 ` Lee Jones
2022-06-07 20:42 ` [PATCH V3 07/11] mfd: bcm2835-pm: Add support for BCM2711 Stefan Wahren
2022-06-23 8:41 ` Lee Jones [this message]
2022-06-07 20:42 ` [PATCH V3 08/11] soc: bcm: bcm2835-power: Refactor ASB control Stefan Wahren
2022-06-07 20:42 ` [PATCH V3 09/11] soc: bcm: bcm2835-power: Resolve ASB register macros Stefan Wahren
2022-06-07 20:42 ` [PATCH V3 10/11] soc: bcm: bcm2835-power: Add support for BCM2711's RPiVid ASB Stefan Wahren
2022-06-07 20:42 ` [PATCH V3 11/11] soc: bcm: bcm2835-power: Bypass power_on/off() calls Stefan Wahren
2022-06-08 9:27 ` [PATCH V3 00/11] soc: bcm2835-power: Prepare BCM2711 V3D support Florian Fainelli
2022-06-15 17:38 ` Florian Fainelli
2022-06-23 2:02 ` Florian Fainelli
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=YrQnJBCzQNb9VcUf@google.com \
--to=lee.jones@linaro.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maxime@cerno.tech \
--cc=melissa.srw@gmail.com \
--cc=pbrobinson@gmail.com \
--cc=phil@raspberrypi.com \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=stefan.wahren@i2se.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).