[PATCH 1/4] pmdomain: bcm: bcm2835-power: Prepare to support BCM2712

Stanimir Varbanov posted 4 patches 4 months, 3 weeks ago
There is a newer version of this series
[PATCH 1/4] pmdomain: bcm: bcm2835-power: Prepare to support BCM2712
Posted by Stanimir Varbanov 4 months, 3 weeks ago
BCM2712 has a PM block but lacks asb and rpivid_asb register
spaces. To avoid unwanted results add a check for asb existence
during probe and also add a new register offset for bcm2712 to
control grafx_v3d power domain. The decision to use the new
register is implicit - if asb register base is null then the
driver is probed for bcm2712 (the other supported SoCs have
asb register space).

Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
---
 drivers/pmdomain/bcm/bcm2835-power.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/pmdomain/bcm/bcm2835-power.c b/drivers/pmdomain/bcm/bcm2835-power.c
index f5289fd184d0..1d29addfe036 100644
--- a/drivers/pmdomain/bcm/bcm2835-power.c
+++ b/drivers/pmdomain/bcm/bcm2835-power.c
@@ -79,6 +79,7 @@
 #define PM_IMAGE			0x108
 #define PM_GRAFX			0x10c
 #define PM_PROC				0x110
+#define PM_GRAFX_2712			0x304
 #define PM_ENAB				BIT(12)
 #define PM_ISPRSTN			BIT(8)
 #define PM_H264RSTN			BIT(7)
@@ -381,6 +382,9 @@ static int bcm2835_power_pd_power_on(struct generic_pm_domain *domain)
 		return bcm2835_power_power_on(pd, PM_GRAFX);
 
 	case BCM2835_POWER_DOMAIN_GRAFX_V3D:
+		if (!power->asb)
+			return bcm2835_asb_power_on(pd, PM_GRAFX_2712,
+						    0, 0, PM_V3DRSTN);
 		return bcm2835_asb_power_on(pd, PM_GRAFX,
 					    ASB_V3D_M_CTRL, ASB_V3D_S_CTRL,
 					    PM_V3DRSTN);
@@ -447,6 +451,9 @@ static int bcm2835_power_pd_power_off(struct generic_pm_domain *domain)
 		return bcm2835_power_power_off(pd, PM_GRAFX);
 
 	case BCM2835_POWER_DOMAIN_GRAFX_V3D:
+		if (!power->asb)
+			return bcm2835_asb_power_off(pd, PM_GRAFX_2712,
+						     0, 0, PM_V3DRSTN);
 		return bcm2835_asb_power_off(pd, PM_GRAFX,
 					     ASB_V3D_M_CTRL, ASB_V3D_S_CTRL,
 					     PM_V3DRSTN);
@@ -635,10 +642,12 @@ static int bcm2835_power_probe(struct platform_device *pdev)
 	power->asb = pm->asb;
 	power->rpivid_asb = pm->rpivid_asb;
 
-	id = readl(power->asb + ASB_AXI_BRDG_ID);
-	if (id != BCM2835_BRDG_ID /* "BRDG" */) {
-		dev_err(dev, "ASB register ID returned 0x%08x\n", id);
-		return -ENODEV;
+	if (power->asb) {
+		id = readl(power->asb + ASB_AXI_BRDG_ID);
+		if (id != BCM2835_BRDG_ID /* "BRDG" */) {
+			dev_err(dev, "ASB register ID returned 0x%08x\n", id);
+			return -ENODEV;
+		}
 	}
 
 	if (power->rpivid_asb) {
-- 
2.47.0
Re: [PATCH 1/4] pmdomain: bcm: bcm2835-power: Prepare to support BCM2712
Posted by Andrea della Porta 3 months ago
Hi Stan,

On 09:32 Wed 17 Sep     , Stanimir Varbanov wrote:
> BCM2712 has a PM block but lacks asb and rpivid_asb register
> spaces. To avoid unwanted results add a check for asb existence
> during probe and also add a new register offset for bcm2712 to
> control grafx_v3d power domain. The decision to use the new
> register is implicit - if asb register base is null then the
> driver is probed for bcm2712 (the other supported SoCs have
> asb register space).
> 
> Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
> ---
>  drivers/pmdomain/bcm/bcm2835-power.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pmdomain/bcm/bcm2835-power.c b/drivers/pmdomain/bcm/bcm2835-power.c
> index f5289fd184d0..1d29addfe036 100644
> --- a/drivers/pmdomain/bcm/bcm2835-power.c
> +++ b/drivers/pmdomain/bcm/bcm2835-power.c
> @@ -79,6 +79,7 @@
>  #define PM_IMAGE			0x108
>  #define PM_GRAFX			0x10c
>  #define PM_PROC				0x110
> +#define PM_GRAFX_2712			0x304
>  #define PM_ENAB				BIT(12)
>  #define PM_ISPRSTN			BIT(8)
>  #define PM_H264RSTN			BIT(7)
> @@ -381,6 +382,9 @@ static int bcm2835_power_pd_power_on(struct generic_pm_domain *domain)
>  		return bcm2835_power_power_on(pd, PM_GRAFX);
>  
>  	case BCM2835_POWER_DOMAIN_GRAFX_V3D:
> +		if (!power->asb)
> +			return bcm2835_asb_power_on(pd, PM_GRAFX_2712,
> +						    0, 0, PM_V3DRSTN);
>  		return bcm2835_asb_power_on(pd, PM_GRAFX,
>  					    ASB_V3D_M_CTRL, ASB_V3D_S_CTRL,
>  					    PM_V3DRSTN);
> @@ -447,6 +451,9 @@ static int bcm2835_power_pd_power_off(struct generic_pm_domain *domain)
>  		return bcm2835_power_power_off(pd, PM_GRAFX);
>  
>  	case BCM2835_POWER_DOMAIN_GRAFX_V3D:
> +		if (!power->asb)
> +			return bcm2835_asb_power_off(pd, PM_GRAFX_2712,
> +						     0, 0, PM_V3DRSTN);
>  		return bcm2835_asb_power_off(pd, PM_GRAFX,
>  					     ASB_V3D_M_CTRL, ASB_V3D_S_CTRL,
>  					     PM_V3DRSTN);
> @@ -635,10 +642,12 @@ static int bcm2835_power_probe(struct platform_device *pdev)
>  	power->asb = pm->asb;
>  	power->rpivid_asb = pm->rpivid_asb;
>  
> -	id = readl(power->asb + ASB_AXI_BRDG_ID);
> -	if (id != BCM2835_BRDG_ID /* "BRDG" */) {
> -		dev_err(dev, "ASB register ID returned 0x%08x\n", id);
> -		return -ENODEV;
> +	if (power->asb) {
> +		id = readl(power->asb + ASB_AXI_BRDG_ID);
> +		if (id != BCM2835_BRDG_ID /* "BRDG" */) {
> +			dev_err(dev, "ASB register ID returned 0x%08x\n", id);
> +			return -ENODEV;
> +		}
>  	}
>  
>  	if (power->rpivid_asb) {
> -- 
> 2.47.0
>

Tested-by: Andrea della Porta <andrea.porta@suse.com>

Cheers,
Andrea
Re: [PATCH 1/4] pmdomain: bcm: bcm2835-power: Prepare to support BCM2712
Posted by Florian Fainelli 3 months, 2 weeks ago

On 9/16/2025 11:32 PM, Stanimir Varbanov wrote:
> BCM2712 has a PM block but lacks asb and rpivid_asb register
> spaces. To avoid unwanted results add a check for asb existence
> during probe and also add a new register offset for bcm2712 to
> control grafx_v3d power domain. The decision to use the new
> register is implicit - if asb register base is null then the
> driver is probed for bcm2712 (the other supported SoCs have
> asb register space).
> 
> Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian