All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Florian Fainelli <f.fainelli@gmail.com>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Lee Jones <lee.jones@linaro.org>
Cc: 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-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	Stefan Wahren <stefan.wahren@i2se.com>
Subject: [PATCH V2 10/11] soc: bcm: bcm2835-power: Add support for BCM2711's RPiVid ASB
Date: Wed,  1 Jun 2022 14:53:43 +0200	[thread overview]
Message-ID: <20220601125344.60602-11-stefan.wahren@i2se.com> (raw)
In-Reply-To: <20220601125344.60602-1-stefan.wahren@i2se.com>

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.

Use the fact that 'pm->rpivid_asb' is populated as a hint that we're on
BCM2711.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
---
 drivers/soc/bcm/bcm2835-power.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/bcm/bcm2835-power.c b/drivers/soc/bcm/bcm2835-power.c
index 9c352f66e6d5..1e06d91c0739 100644
--- a/drivers/soc/bcm/bcm2835-power.c
+++ b/drivers/soc/bcm/bcm2835-power.c
@@ -126,6 +126,8 @@
 
 #define ASB_AXI_BRDG_ID			0x20
 
+#define BCM2835_BRDG_ID			0x62726467
+
 struct bcm2835_power_domain {
 	struct generic_pm_domain base;
 	struct bcm2835_power *power;
@@ -139,6 +141,8 @@ struct bcm2835_power {
 	void __iomem		*base;
 	/* AXI Async bridge registers. */
 	void __iomem		*asb;
+	/* RPiVid bridge registers. */
+	void __iomem		*rpivid_asb;
 
 	struct genpd_onecell_data pd_xlate;
 	struct bcm2835_power_domain domains[BCM2835_POWER_DOMAIN_COUNT];
@@ -151,8 +155,15 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable
 	u64 start;
 	u32 val;
 
-	if (!reg)
+	switch (reg) {
+	case 0:
 		return 0;
+	case ASB_V3D_S_CTRL:
+	case ASB_V3D_M_CTRL:
+		if (power->rpivid_asb)
+			base = power->rpivid_asb;
+		break;
+	}
 
 	start = ktime_get_ns();
 
@@ -621,13 +632,23 @@ static int bcm2835_power_probe(struct platform_device *pdev)
 	power->dev = dev;
 	power->base = pm->base;
 	power->asb = pm->asb;
+	power->rpivid_asb = pm->rpivid_asb;
 
 	id = readl(power->asb + ASB_AXI_BRDG_ID);
-	if (id != 0x62726467 /* "BRDG" */) {
+	if (id != BCM2835_BRDG_ID /* "BRDG" */) {
 		dev_err(dev, "ASB register ID returned 0x%08x\n", id);
 		return -ENODEV;
 	}
 
+	if (power->rpivid_asb) {
+		id = readl(power->rpivid_asb + ASB_AXI_BRDG_ID);
+		if (id != BCM2835_BRDG_ID /* "BRDG" */) {
+			dev_err(dev, "RPiVid ASB register ID returned 0x%08x\n",
+				     id);
+			return -ENODEV;
+		}
+	}
+
 	power->pd_xlate.domains = devm_kcalloc(dev,
 					       ARRAY_SIZE(power_domain_names),
 					       sizeof(*power->pd_xlate.domains),
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Florian Fainelli <f.fainelli@gmail.com>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Lee Jones <lee.jones@linaro.org>
Cc: 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-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	Stefan Wahren <stefan.wahren@i2se.com>
Subject: [PATCH V2 10/11] soc: bcm: bcm2835-power: Add support for BCM2711's RPiVid ASB
Date: Wed,  1 Jun 2022 14:53:43 +0200	[thread overview]
Message-ID: <20220601125344.60602-11-stefan.wahren@i2se.com> (raw)
In-Reply-To: <20220601125344.60602-1-stefan.wahren@i2se.com>

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.

Use the fact that 'pm->rpivid_asb' is populated as a hint that we're on
BCM2711.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
---
 drivers/soc/bcm/bcm2835-power.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/bcm/bcm2835-power.c b/drivers/soc/bcm/bcm2835-power.c
index 9c352f66e6d5..1e06d91c0739 100644
--- a/drivers/soc/bcm/bcm2835-power.c
+++ b/drivers/soc/bcm/bcm2835-power.c
@@ -126,6 +126,8 @@
 
 #define ASB_AXI_BRDG_ID			0x20
 
+#define BCM2835_BRDG_ID			0x62726467
+
 struct bcm2835_power_domain {
 	struct generic_pm_domain base;
 	struct bcm2835_power *power;
@@ -139,6 +141,8 @@ struct bcm2835_power {
 	void __iomem		*base;
 	/* AXI Async bridge registers. */
 	void __iomem		*asb;
+	/* RPiVid bridge registers. */
+	void __iomem		*rpivid_asb;
 
 	struct genpd_onecell_data pd_xlate;
 	struct bcm2835_power_domain domains[BCM2835_POWER_DOMAIN_COUNT];
@@ -151,8 +155,15 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable
 	u64 start;
 	u32 val;
 
-	if (!reg)
+	switch (reg) {
+	case 0:
 		return 0;
+	case ASB_V3D_S_CTRL:
+	case ASB_V3D_M_CTRL:
+		if (power->rpivid_asb)
+			base = power->rpivid_asb;
+		break;
+	}
 
 	start = ktime_get_ns();
 
@@ -621,13 +632,23 @@ static int bcm2835_power_probe(struct platform_device *pdev)
 	power->dev = dev;
 	power->base = pm->base;
 	power->asb = pm->asb;
+	power->rpivid_asb = pm->rpivid_asb;
 
 	id = readl(power->asb + ASB_AXI_BRDG_ID);
-	if (id != 0x62726467 /* "BRDG" */) {
+	if (id != BCM2835_BRDG_ID /* "BRDG" */) {
 		dev_err(dev, "ASB register ID returned 0x%08x\n", id);
 		return -ENODEV;
 	}
 
+	if (power->rpivid_asb) {
+		id = readl(power->rpivid_asb + ASB_AXI_BRDG_ID);
+		if (id != BCM2835_BRDG_ID /* "BRDG" */) {
+			dev_err(dev, "RPiVid ASB register ID returned 0x%08x\n",
+				     id);
+			return -ENODEV;
+		}
+	}
+
 	power->pd_xlate.domains = devm_kcalloc(dev,
 					       ARRAY_SIZE(power_domain_names),
 					       sizeof(*power->pd_xlate.domains),
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-06-01 12:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01 12:53 [PATCH V2 00/11] soc: bcm2835-power: Prepare BCM2711 V3D support Stefan Wahren
2022-06-01 12:53 ` Stefan Wahren
2022-06-01 12:53 ` [PATCH V2 01/11] dt-bindings: soc: bcm: bcm2835-pm: Convert bindings to DT schema Stefan Wahren
2022-06-01 12:53   ` Stefan Wahren
2022-06-01 12:53 ` [PATCH V2 02/11] dt-bindings: soc: bcm: bcm2835-pm: Introduce reg-names Stefan Wahren
2022-06-01 12:53   ` Stefan Wahren
2022-06-01 13:13   ` Peter Robinson
2022-06-01 13:13     ` Peter Robinson
2022-06-01 12:53 ` [PATCH V2 03/11] dt-bindings: soc: bcm: bcm2835-pm: Add support for bcm2711 Stefan Wahren
2022-06-01 12:53   ` Stefan Wahren
2022-06-01 13:12   ` Peter Robinson
2022-06-01 13:12     ` Peter Robinson
2022-06-05 22:30   ` Rob Herring
2022-06-05 22:30     ` Rob Herring
2022-06-01 12:53 ` [PATCH V2 04/11] ARM: dts: bcm2835/bcm2711: Introduce reg-names in watchdog node Stefan Wahren
2022-06-01 12:53   ` Stefan Wahren
2022-06-01 12:53 ` [PATCH V2 05/11] ARM: dts: bcm2711: Use proper compatible in PM/Watchdog node Stefan Wahren
2022-06-01 12:53   ` Stefan Wahren
2022-06-01 12:53 ` [PATCH V2 06/11] mfd: bcm2835-pm: Use 'reg-names' to get resources Stefan Wahren
2022-06-01 12:53   ` Stefan Wahren
2022-06-01 12:53 ` [PATCH V2 07/11] mfd: bcm2835-pm: Add support for BCM2711 Stefan Wahren
2022-06-01 12:53   ` Stefan Wahren
2022-06-01 13:14   ` Peter Robinson
2022-06-01 13:14     ` Peter Robinson
2022-06-01 12:53 ` [PATCH V2 08/11] soc: bcm: bcm2835-power: Refactor ASB control Stefan Wahren
2022-06-01 12:53   ` Stefan Wahren
2022-06-01 12:53 ` [PATCH V2 09/11] soc: bcm: bcm2835-power: Resolve ASB register macros Stefan Wahren
2022-06-01 12:53   ` Stefan Wahren
2022-06-01 12:53 ` Stefan Wahren [this message]
2022-06-01 12:53   ` [PATCH V2 10/11] soc: bcm: bcm2835-power: Add support for BCM2711's RPiVid ASB Stefan Wahren
2022-06-01 12:53 ` [PATCH V2 11/11] soc: bcm: bcm2835-power: Bypass power_on/off() calls Stefan Wahren
2022-06-01 12:53   ` Stefan Wahren
2022-06-01 13:19 ` [PATCH V2 00/11] soc: bcm2835-power: Prepare BCM2711 V3D support Peter Robinson
2022-06-01 13:19   ` Peter Robinson
2022-06-01 13:31   ` Stefan Wahren
2022-06-01 13:31     ` Stefan Wahren

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=20220601125344.60602-11-stefan.wahren@i2se.com \
    --to=stefan.wahren@i2se.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=maxime@cerno.tech \
    --cc=melissa.srw@gmail.com \
    --cc=nsaenz@kernel.org \
    --cc=pbrobinson@gmail.com \
    --cc=phil@raspberrypi.com \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.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 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.