From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:01:40
This series attempts to enable V3D on BCM2711, the SoC available on the
Raspberry Pi 4 family of boards.
Due to the lack of documentation some things are taken as it from
testing/downstream implementation[1], which I'm hilighting here:
- It's not clear that the following is 100% true, maybe someone can confirm:
"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."
- Patch #10 I took as is from the downstream implementation, I can't really
provide an exact explanation on what changed HW wise.
Ultimately, I need confirmation from the Broadcom folks that they are alright
with patch #12 (deleting pm ops in V3D).
With all this, I get a more or less stable experience using mesa 20.3.4 and
X11/Gnome.
Regards,
Nicolas
---
Changes since v1:
- Use 'reg-names'
- Correct ASB names
- Add missing binding patch for V3D
- Address Stefan's comments
Nicolas Saenz Julienne (16):
dt-bindings: soc: bcm: bcm2835-pm: Convert bindings to DT schema
dt-bindings: soc: bcm: bcm2835-pm: Introduce reg-names
dt-bindings: soc: bcm: bcm2835-pm: Add support for bcm2711
ARM: dts: bcm2835/bcm2711: Introduce reg-names in watchdog node
ARM: dts: bcm2711: Use proper compatible in PM/Watchdog node
mfd: bcm2835-pm: Rename asb to rpivid_asb
mfd: bcm2835-pm: Use 'reg-names' to get resources
mfd: bcm2835-pm: Add support for BCM2711
soc: bcm: bcm2835-power: Add support for BCM2711's Argon ASB
soc: bcm: bcm2835-power: Bypass power_on/off() calls
dt-bindings: gpu: v3d: Add BCM2711's compatible
drm/v3d: Get rid of pm code
drm/v3d: Add support for bcm2711
ARM: dts: bcm2711: Enable V3D
ARM: configs: Enable DRM_V3D
arm64: config: Enable DRM_V3D
.../devicetree/bindings/gpu/brcm,bcm-v3d.yaml | 1 +
.../bindings/soc/bcm/brcm,bcm2835-pm.txt | 46 ----------
.../bindings/soc/bcm/brcm,bcm2835-pm.yaml | 88 +++++++++++++++++++
arch/arm/boot/dts/bcm2711.dtsi | 15 +++-
arch/arm/boot/dts/bcm2835-common.dtsi | 1 +
arch/arm/configs/multi_v7_defconfig | 1 +
arch/arm64/configs/defconfig | 1 +
drivers/gpu/drm/v3d/Kconfig | 2 +-
drivers/gpu/drm/v3d/v3d_debugfs.c | 18 +---
drivers/gpu/drm/v3d/v3d_drv.c | 12 +--
drivers/gpu/drm/v3d/v3d_gem.c | 9 --
drivers/mfd/bcm2835-pm.c | 83 ++++++++++++-----
drivers/soc/bcm/bcm2835-power.c | 82 +++++++++++------
include/linux/mfd/bcm2835-pm.h | 3 +-
14 files changed, 225 insertions(+), 137 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-pm.txt
create mode 100644 Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-pm.yaml
--
2.30.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:01:41
Anticipating the introduction of BCM2711, of which we'll need to support
its new Argon ASB, introduce reg-names into bcm2835-pm's binding. This
will help to have a consistent mapping between resources and their
meaning.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
.../devicetree/bindings/soc/bcm/brcm,bcm2835-pm.yaml | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
@@ -26,8 +26,13 @@ properties:reg:minItems:1maxItems:2-description:Specifies base physical address and size of the two register-ranges, "PM" and "ASYNC_BRIDGE" in that order.++reg-names:+minItems:1+maxItems:2+items:+-const:pm+-const:rpivid_asb"#power-domain-cells":const:1
@@ -1,46 +0,0 @@-BCM2835 PM (Power domains, watchdog)--The PM block controls power domains and some reset lines, and includes-a watchdog timer. This binding supersedes the brcm,bcm2835-pm-wdt-binding which covered some of PM's register range and functionality.--Required properties:--- compatible: Should be "brcm,bcm2835-pm"-- reg: Specifies base physical address and size of the two- register ranges ("PM" and "ASYNC_BRIDGE" in that- order)-- clocks: a) v3d: The V3D clock from CPRMAN- b) peri_image: The PERI_IMAGE clock from CPRMAN- c) h264: The H264 clock from CPRMAN- d) isp: The ISP clock from CPRMAN-- #reset-cells: Should be 1. This property follows the reset controller- bindings[1].-- #power-domain-cells: Should be 1. This property follows the power domain- bindings[2].--Optional properties:--- timeout-sec: Contains the watchdog timeout in seconds-- system-power-controller: Whether the watchdog is controlling the- system power. This node follows the power controller bindings[3].--[1] Documentation/devicetree/bindings/reset/reset.txt-[2] Documentation/devicetree/bindings/power/power-domain.yaml-[3] Documentation/devicetree/bindings/power/power-controller.txt--Example:--pm {- compatible = "brcm,bcm2835-pm", "brcm,bcm2835-pm-wdt";- #power-domain-cells = <1>;- #reset-cells = <1>;- reg = <0x7e100000 0x114>,- <0x7e00a000 0x24>;- clocks = <&clocks BCM2835_CLOCK_V3D>,- <&clocks BCM2835_CLOCK_PERI_IMAGE>,- <&clocks BCM2835_CLOCK_H264>,- <&clocks BCM2835_CLOCK_ISP>;- clock-names = "v3d", "peri_image", "h264", "isp";- system-power-controller;-};
@@ -0,0 +1,79 @@+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause+%YAML1.2+---+$id:"http://devicetree.org/schemas/soc/bcm/brcm,bcm2835-pm.yaml#"+$schema:"http://devicetree.org/meta-schemas/core.yaml#"++title:BCM2835 PM (Power domains, watchdog)++description:|+The PM block controls power domains and some reset lines, and includes a+watchdog timer.++maintainers:+-Nicolas Saenz Julienne <nsaenzjulienne@suse.de>++allOf:+-$ref:../../watchdog/watchdog.yaml#++properties:+compatible:+items:+-enum:+-brcm,bcm2835-pm+-const:brcm,bcm2835-pm-wdt++reg:+minItems:1+maxItems:2+description:Specifies base physical address and size of the two register+ranges, "PM" and "ASYNC_BRIDGE" in that order.++"#power-domain-cells":+const:1++"#reset-cells":+const:1++clocks:+minItems:4+maxItems:4++clock-names:+items:+-const:v3d+-const:peri_image+-const:h264+-const:isp++system-power-controller:+type:boolean++timeout-sec:true++required:+-compatible+-reg+-"#power-domain-cells"+-"#reset-cells"+-clocks++additionalProperties:false++examples:+-|+#include <dt-bindings/clock/bcm2835.h>++watchdog@7e100000 {+compatible = "brcm,bcm2835-pm", "brcm,bcm2835-pm-wdt";+#power-domain-cells = <1>;+#reset-cells = <1>;+reg = <0x7e100000 0x114>,+<0x7e00a000 0x24>;+clocks = <&clocks BCM2835_CLOCK_V3D>,+<&clocks BCM2835_CLOCK_PERI_IMAGE>,+<&clocks BCM2835_CLOCK_H264>,+<&clocks BCM2835_CLOCK_ISP>;+clock-names = "v3d", "peri_image", "h264", "isp";+system-power-controller;+};
--
2.30.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:02:21
Add a new compatible string for BCM2711 and the option to provide a
third reg property for the board's new Argon ASB.
In BCM2711 the new Argon ASB took over V3D, which is our only consumer
of this driver so far. The old ASB is still be present with ISP and H264
bits but no V3D.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
.../devicetree/bindings/soc/bcm/brcm,bcm2835-pm.yaml | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:03:10
In anticipation to supporting BCM2711 on which new ASB took over V3D,
use a more explicit name on the currently supported one.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
drivers/mfd/bcm2835-pm.c | 8 ++++----
drivers/soc/bcm/bcm2835-power.c | 10 +++++-----
include/linux/mfd/bcm2835-pm.h | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
@@ -50,15 +50,15 @@ static int bcm2835_pm_probe(struct platform_device *pdev)if(ret)returnret;-/* We'll use the presence of the AXI ASB regs in the+/* We'll use the presence of the RPiVid ASB regs in the*bcm2835-pmbindingasthekeyforwhetherwecanreference*thefullPMregisterrangeandsupportpowerdomains.*/res=platform_get_resource(pdev,IORESOURCE_MEM,1);if(res){-pm->asb=devm_ioremap_resource(dev,res);-if(IS_ERR(pm->asb))-returnPTR_ERR(pm->asb);+pm->rpivid_asb=devm_ioremap_resource(dev,res);+if(IS_ERR(pm->rpivid_asb))+returnPTR_ERR(pm->rpivid_asb);ret=devm_mfd_add_devices(dev,-1,bcm2835_power_devs,
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:03:11
A new compatible string was introduced specifically for BCM2711, so make
use of it.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
arch/arm/boot/dts/bcm2711.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:03:48
If available in firmware, find resources by their 'reg-names' position
instead of relying on hardcoded offsets. Care is taken to support old
firmware nonetheless.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
drivers/mfd/bcm2835-pm.c | 56 ++++++++++++++++++++++++++--------------
1 file changed, 37 insertions(+), 19 deletions(-)
@@ -25,9 +25,38 @@ static const struct mfd_cell bcm2835_power_devs[] = {{.name="bcm2835-power"},};+staticintbcm2835_pm_get_pdata(structplatform_device*pdev,+structbcm2835_pm*pm)+{+/* If no 'reg-names' property is found we can assume we're using old+*firmware.+*/+if(!of_find_property(pm->dev->of_node,"reg-names",NULL)){+dev_warn(pm->dev,"Old devicetree detected, please update your firmware.\n");++pm->base=devm_platform_ioremap_resource(pdev,0);+if(IS_ERR(pm->base))+returnPTR_ERR(pm->base);++pm->rpivid_asb=devm_platform_ioremap_resource(pdev,1);+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))+returnPTR_ERR(pm->base);++pm->rpivid_asb=devm_platform_ioremap_resource_byname(pdev,+"rpivid_asb");+if(IS_ERR(pm->base))+pm->rpivid_asb=NULL;+}++return0;+}+staticintbcm2835_pm_probe(structplatform_device*pdev){-structresource*res;structdevice*dev=&pdev->dev;structbcm2835_pm*pm;intret;
@@ -39,10 +68,9 @@ static int bcm2835_pm_probe(struct platform_device *pdev)pm->dev=dev;-res=platform_get_resource(pdev,IORESOURCE_MEM,0);-pm->base=devm_ioremap_resource(dev,res);-if(IS_ERR(pm->base))-returnPTR_ERR(pm->base);+ret=bcm2835_pm_get_pdata(pdev,pm);+if(ret)+returnret;ret=devm_mfd_add_devices(dev,-1,bcm2835_pm_devs,ARRAY_SIZE(bcm2835_pm_devs),
@@ -54,20 +82,10 @@ static int bcm2835_pm_probe(struct platform_device *pdev)*bcm2835-pmbindingasthekeyforwhetherwecanreference*thefullPMregisterrangeandsupportpowerdomains.*/-res=platform_get_resource(pdev,IORESOURCE_MEM,1);-if(res){-pm->rpivid_asb=devm_ioremap_resource(dev,res);-if(IS_ERR(pm->rpivid_asb))-returnPTR_ERR(pm->rpivid_asb);--ret=devm_mfd_add_devices(dev,-1,-bcm2835_power_devs,-ARRAY_SIZE(bcm2835_power_devs),-NULL,0,NULL);-if(ret)-returnret;-}-+if(pm->rpivid_asb)+returndevm_mfd_add_devices(dev,-1,bcm2835_power_devs,+ARRAY_SIZE(bcm2835_power_devs),+NULL,0,NULL);return0;}
--
2.30.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:03:57
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.
Use the fact that 'pm->argon_asb' is populated as a hint that we're on
BCM2711. On top of that introduce the macro ASB_BASE() which will select
the correct ASB register base, based on whether we're trying to access
V3D and which platform we're on.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
Changes since v1:
- Correct names
drivers/soc/bcm/bcm2835-power.c | 68 ++++++++++++++++++++-------------
1 file changed, 42 insertions(+), 26 deletions(-)
@@ -178,8 +183,8 @@ static int bcm2835_asb_disable(struct bcm2835_power *power, u32 reg)start=ktime_get_ns();/* Enable the module's async AXI bridges. */-ASB_WRITE(reg,ASB_READ(reg)|ASB_REQ_STOP);-while(!(ASB_READ(reg)&ASB_ACK)){+ASB_WRITE(reg,ASB_READ(reg,is_v3d)|ASB_REQ_STOP,is_v3d);+while(!(ASB_READ(reg,is_v3d)&ASB_ACK)){cpu_relax();if(ktime_get_ns()-start>=1000)return-ETIMEDOUT;
@@ -274,7 +279,8 @@ static int bcm2835_asb_power_on(struct bcm2835_power_domain *pd,u32pm_reg,u32asb_m_reg,u32asb_s_reg,-u32reset_flags)+u32reset_flags,+boolis_v3d){structbcm2835_power*power=pd->power;intret;
@@ -301,13 +307,13 @@ static int bcm2835_asb_power_on(struct bcm2835_power_domain *pd,gotoerr_enable_resets;}-ret=bcm2835_asb_enable(power,asb_m_reg);+ret=bcm2835_asb_enable(power,asb_m_reg,is_v3d);if(ret){dev_err(power->dev,"Failed to enable ASB master for %s\n",pd->base.name);gotoerr_disable_clk;}-ret=bcm2835_asb_enable(power,asb_s_reg);+ret=bcm2835_asb_enable(power,asb_s_reg,is_v3d);if(ret){dev_err(power->dev,"Failed to enable ASB slave for %s\n",pd->base.name);
@@ -317,7 +323,7 @@ static int bcm2835_asb_power_on(struct bcm2835_power_domain *pd,return0;err_disable_asb_master:-bcm2835_asb_disable(power,asb_m_reg);+bcm2835_asb_disable(power,asb_m_reg,is_v3d);err_disable_clk:clk_disable_unprepare(pd->clk);err_enable_resets:
@@ -329,22 +335,23 @@ static int bcm2835_asb_power_off(struct bcm2835_power_domain *pd,u32pm_reg,u32asb_m_reg,u32asb_s_reg,-u32reset_flags)+u32reset_flags,+boolis_v3d){structbcm2835_power*power=pd->power;intret;-ret=bcm2835_asb_disable(power,asb_s_reg);+ret=bcm2835_asb_disable(power,asb_s_reg,is_v3d);if(ret){dev_warn(power->dev,"Failed to disable ASB slave for %s\n",pd->base.name);returnret;}-ret=bcm2835_asb_disable(power,asb_m_reg);+ret=bcm2835_asb_disable(power,asb_m_reg,is_v3d);if(ret){dev_warn(power->dev,"Failed to disable ASB master for %s\n",pd->base.name);-bcm2835_asb_enable(power,asb_s_reg);+bcm2835_asb_enable(power,asb_s_reg,is_v3d);returnret;}
@@ -369,7 +376,7 @@ static int bcm2835_power_pd_power_on(struct generic_pm_domain *domain)caseBCM2835_POWER_DOMAIN_GRAFX_V3D:returnbcm2835_asb_power_on(pd,PM_GRAFX,ASB_V3D_M_CTRL,ASB_V3D_S_CTRL,-PM_V3DRSTN);+PM_V3DRSTN,true);caseBCM2835_POWER_DOMAIN_IMAGE:returnbcm2835_power_power_on(pd,PM_IMAGE);
@@ -377,17 +384,17 @@ static int bcm2835_power_pd_power_on(struct generic_pm_domain *domain)caseBCM2835_POWER_DOMAIN_IMAGE_PERI:returnbcm2835_asb_power_on(pd,PM_IMAGE,0,0,-PM_PERIRSTN);+PM_PERIRSTN,false);caseBCM2835_POWER_DOMAIN_IMAGE_ISP:returnbcm2835_asb_power_on(pd,PM_IMAGE,ASB_ISP_M_CTRL,ASB_ISP_S_CTRL,-PM_ISPRSTN);+PM_ISPRSTN,false);caseBCM2835_POWER_DOMAIN_IMAGE_H264:returnbcm2835_asb_power_on(pd,PM_IMAGE,ASB_H264_M_CTRL,ASB_H264_S_CTRL,-PM_H264RSTN);+PM_H264RSTN,false);caseBCM2835_POWER_DOMAIN_USB:PM_WRITE(PM_USB,PM_USB_CTRLEN);
@@ -435,7 +442,7 @@ static int bcm2835_power_pd_power_off(struct generic_pm_domain *domain)caseBCM2835_POWER_DOMAIN_GRAFX_V3D:returnbcm2835_asb_power_off(pd,PM_GRAFX,ASB_V3D_M_CTRL,ASB_V3D_S_CTRL,-PM_V3DRSTN);+PM_V3DRSTN,true);caseBCM2835_POWER_DOMAIN_IMAGE:returnbcm2835_power_power_off(pd,PM_IMAGE);
@@ -443,17 +450,17 @@ static int bcm2835_power_pd_power_off(struct generic_pm_domain *domain)caseBCM2835_POWER_DOMAIN_IMAGE_PERI:returnbcm2835_asb_power_off(pd,PM_IMAGE,0,0,-PM_PERIRSTN);+PM_PERIRSTN,false);caseBCM2835_POWER_DOMAIN_IMAGE_ISP:returnbcm2835_asb_power_off(pd,PM_IMAGE,ASB_ISP_M_CTRL,ASB_ISP_S_CTRL,-PM_ISPRSTN);+PM_ISPRSTN,false);caseBCM2835_POWER_DOMAIN_IMAGE_H264:returnbcm2835_asb_power_off(pd,PM_IMAGE,ASB_H264_M_CTRL,ASB_H264_S_CTRL,-PM_H264RSTN);+PM_H264RSTN,false);caseBCM2835_POWER_DOMAIN_USB:PM_WRITE(PM_USB,0);
@@ -626,13 +633,22 @@ static int bcm2835_power_probe(struct platform_device *pdev)power->dev=dev;power->base=pm->base;power->rpivid_asb=pm->rpivid_asb;+power->argon_asb=pm->argon_asb;-id=ASB_READ(ASB_AXI_BRDG_ID);+id=ASB_READ(ASB_AXI_BRDG_ID,false);if(id!=0x62726467/* "BRDG" */){-dev_err(dev,"ASB register ID returned 0x%08x\n",id);+dev_err(dev,"RPiVid ASB register ID returned 0x%08x\n",id);return-ENODEV;}+if(pm->argon_asb){+id=ASB_READ(ASB_AXI_BRDG_ID,true);+if(id!=0x62726467/* "BRDG" */){+dev_err(dev,"Argon 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.30.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:04:34
Bypass power_on/power_off() when running on BCM2711 as they are not
needed.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
drivers/soc/bcm/bcm2835-power.c | 8 ++++++++
1 file changed, 8 insertions(+)
@@ -197,6 +197,10 @@ static int bcm2835_power_power_off(struct bcm2835_power_domain *pd, u32 pm_reg){structbcm2835_power*power=pd->power;+/* We don't run this on BCM2711 */+if(power->argon_asb)+return0;+/* Enable functional isolation */PM_WRITE(pm_reg,PM_READ(pm_reg)&~PM_ISFUNC);
@@ -218,6 +222,10 @@ static int bcm2835_power_power_on(struct bcm2835_power_domain *pd, u32 pm_reg)intinrush;boolpowok;+/* We don't run this on BCM2711 */+if(power->argon_asb)+return0;+/* If it was already powered on by the fw, leave it that way. */if(PM_READ(pm_reg)&PM_POWUP)return0;
--
2.30.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:04:38
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 <redacted>
[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(-)
@@ -28,6 +32,8 @@ static const struct mfd_cell bcm2835_power_devs[] = {staticintbcm2835_pm_get_pdata(structplatform_device*pdev,structbcm2835_pm*pm){+boolis_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;+}}return0;
@@ -90,8 +110,9 @@ static int bcm2835_pm_probe(struct platform_device *pdev)}staticconststructof_device_idbcm2835_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);
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:04:52
Runtime PM doesn't seem to work correctly on this driver. On top of
that, commit 8b6864e3e138 ("drm/v3d/v3d_drv: Remove unused static
variable 'v3d_v3d_pm_ops'") hints that it most likely never did as the
driver's PM ops were not hooked-up.
So, in order to support regular operation with V3D on BCM2711 (Raspberry
Pi 4), get rid of the PM code. PM will be reinstated once we figure out
the underlying issues.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
drivers/gpu/drm/v3d/v3d_debugfs.c | 18 +-----------------
drivers/gpu/drm/v3d/v3d_drv.c | 11 -----------
drivers/gpu/drm/v3d/v3d_gem.c | 9 ---------
3 files changed, 1 insertion(+), 37 deletions(-)
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:05:32
BCM2711, Raspberry Pi 4's SoC, contains a V3D core. So add its specific
compatible to the bindings.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml | 1 +
1 file changed, 1 insertion(+)
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:05:55
This enables V3D for bcm2711 (used in the Raspberry Pi 4).
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
Changes since v1:
- Correct node's name address
arch/arm/boot/dts/bcm2711.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+)
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:06:07
BCM2711, the SoC used on the Raspberry Pi 4 has a different GPU than its
predecessors. Enable it.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 13:06:59
BCM2711, the SoC used on the Raspberry Pi 4 has a different GPU than its
predecessors. Enable it.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
arch/arm/configs/multi_v7_defconfig | 1 +
1 file changed, 1 insertion(+)
From: Phil Elwell <hidden> Date: 2021-02-09 13:21:03
Hi Nicolas,
On Tue, 9 Feb 2021 at 13:00, Nicolas Saenz Julienne
[off-list ref] wrote:
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.
Use the fact that 'pm->argon_asb' is populated as a hint that we're on
BCM2711. On top of that introduce the macro ASB_BASE() which will select
the correct ASB register base, based on whether we're trying to access
V3D and which platform we're on.
Please don't refer to this block as ARGON - it is the IP of Raspberry
Pi Trading and it's name is RPiVid.
@@ -178,8 +183,8 @@ static int bcm2835_asb_disable(struct bcm2835_power *power, u32 reg)start=ktime_get_ns();/* Enable the module's async AXI bridges. */-ASB_WRITE(reg,ASB_READ(reg)|ASB_REQ_STOP);-while(!(ASB_READ(reg)&ASB_ACK)){+ASB_WRITE(reg,ASB_READ(reg,is_v3d)|ASB_REQ_STOP,is_v3d);+while(!(ASB_READ(reg,is_v3d)&ASB_ACK)){cpu_relax();if(ktime_get_ns()-start>=1000)return-ETIMEDOUT;
@@ -274,7 +279,8 @@ static int bcm2835_asb_power_on(struct bcm2835_power_domain *pd,u32pm_reg,u32asb_m_reg,u32asb_s_reg,-u32reset_flags)+u32reset_flags,+boolis_v3d){structbcm2835_power*power=pd->power;intret;
@@ -301,13 +307,13 @@ static int bcm2835_asb_power_on(struct bcm2835_power_domain *pd,gotoerr_enable_resets;}-ret=bcm2835_asb_enable(power,asb_m_reg);+ret=bcm2835_asb_enable(power,asb_m_reg,is_v3d);if(ret){dev_err(power->dev,"Failed to enable ASB master for %s\n",pd->base.name);gotoerr_disable_clk;}-ret=bcm2835_asb_enable(power,asb_s_reg);+ret=bcm2835_asb_enable(power,asb_s_reg,is_v3d);if(ret){dev_err(power->dev,"Failed to enable ASB slave for %s\n",pd->base.name);
@@ -317,7 +323,7 @@ static int bcm2835_asb_power_on(struct bcm2835_power_domain *pd,return0;err_disable_asb_master:-bcm2835_asb_disable(power,asb_m_reg);+bcm2835_asb_disable(power,asb_m_reg,is_v3d);err_disable_clk:clk_disable_unprepare(pd->clk);err_enable_resets:
@@ -329,22 +335,23 @@ static int bcm2835_asb_power_off(struct bcm2835_power_domain *pd,u32pm_reg,u32asb_m_reg,u32asb_s_reg,-u32reset_flags)+u32reset_flags,+boolis_v3d){structbcm2835_power*power=pd->power;intret;-ret=bcm2835_asb_disable(power,asb_s_reg);+ret=bcm2835_asb_disable(power,asb_s_reg,is_v3d);if(ret){dev_warn(power->dev,"Failed to disable ASB slave for %s\n",pd->base.name);returnret;}-ret=bcm2835_asb_disable(power,asb_m_reg);+ret=bcm2835_asb_disable(power,asb_m_reg,is_v3d);if(ret){dev_warn(power->dev,"Failed to disable ASB master for %s\n",pd->base.name);-bcm2835_asb_enable(power,asb_s_reg);+bcm2835_asb_enable(power,asb_s_reg,is_v3d);returnret;}
@@ -369,7 +376,7 @@ static int bcm2835_power_pd_power_on(struct generic_pm_domain *domain)caseBCM2835_POWER_DOMAIN_GRAFX_V3D:returnbcm2835_asb_power_on(pd,PM_GRAFX,ASB_V3D_M_CTRL,ASB_V3D_S_CTRL,-PM_V3DRSTN);+PM_V3DRSTN,true);caseBCM2835_POWER_DOMAIN_IMAGE:returnbcm2835_power_power_on(pd,PM_IMAGE);
@@ -377,17 +384,17 @@ static int bcm2835_power_pd_power_on(struct generic_pm_domain *domain)caseBCM2835_POWER_DOMAIN_IMAGE_PERI:returnbcm2835_asb_power_on(pd,PM_IMAGE,0,0,-PM_PERIRSTN);+PM_PERIRSTN,false);caseBCM2835_POWER_DOMAIN_IMAGE_ISP:returnbcm2835_asb_power_on(pd,PM_IMAGE,ASB_ISP_M_CTRL,ASB_ISP_S_CTRL,-PM_ISPRSTN);+PM_ISPRSTN,false);caseBCM2835_POWER_DOMAIN_IMAGE_H264:returnbcm2835_asb_power_on(pd,PM_IMAGE,ASB_H264_M_CTRL,ASB_H264_S_CTRL,-PM_H264RSTN);+PM_H264RSTN,false);caseBCM2835_POWER_DOMAIN_USB:PM_WRITE(PM_USB,PM_USB_CTRLEN);
@@ -435,7 +442,7 @@ static int bcm2835_power_pd_power_off(struct generic_pm_domain *domain)caseBCM2835_POWER_DOMAIN_GRAFX_V3D:returnbcm2835_asb_power_off(pd,PM_GRAFX,ASB_V3D_M_CTRL,ASB_V3D_S_CTRL,-PM_V3DRSTN);+PM_V3DRSTN,true);caseBCM2835_POWER_DOMAIN_IMAGE:returnbcm2835_power_power_off(pd,PM_IMAGE);
@@ -443,17 +450,17 @@ static int bcm2835_power_pd_power_off(struct generic_pm_domain *domain)caseBCM2835_POWER_DOMAIN_IMAGE_PERI:returnbcm2835_asb_power_off(pd,PM_IMAGE,0,0,-PM_PERIRSTN);+PM_PERIRSTN,false);caseBCM2835_POWER_DOMAIN_IMAGE_ISP:returnbcm2835_asb_power_off(pd,PM_IMAGE,ASB_ISP_M_CTRL,ASB_ISP_S_CTRL,-PM_ISPRSTN);+PM_ISPRSTN,false);caseBCM2835_POWER_DOMAIN_IMAGE_H264:returnbcm2835_asb_power_off(pd,PM_IMAGE,ASB_H264_M_CTRL,ASB_H264_S_CTRL,-PM_H264RSTN);+PM_H264RSTN,false);caseBCM2835_POWER_DOMAIN_USB:PM_WRITE(PM_USB,0);
@@ -626,13 +633,22 @@ static int bcm2835_power_probe(struct platform_device *pdev)power->dev=dev;power->base=pm->base;power->rpivid_asb=pm->rpivid_asb;+power->argon_asb=pm->argon_asb;-id=ASB_READ(ASB_AXI_BRDG_ID);+id=ASB_READ(ASB_AXI_BRDG_ID,false);if(id!=0x62726467/* "BRDG" */){-dev_err(dev,"ASB register ID returned 0x%08x\n",id);+dev_err(dev,"RPiVid ASB register ID returned 0x%08x\n",id);return-ENODEV;}+if(pm->argon_asb){+id=ASB_READ(ASB_AXI_BRDG_ID,true);+if(id!=0x62726467/* "BRDG" */){+dev_err(dev,"Argon ASB register ID returned 0x%08x\n",id);+return-ENODEV;+}+}+
Surely these are the same register. Is this the result of a bad merge?
Thanks,
Phil
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Nicolas Saenz Julienne <hidden> Date: 2021-02-09 14:02:11
On Tue, 2021-02-09 at 13:19 +0000, Phil Elwell wrote:
Hi Nicolas,
On Tue, 9 Feb 2021 at 13:00, Nicolas Saenz Julienne
[off-list ref] wrote:
quoted
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.
Use the fact that 'pm->argon_asb' is populated as a hint that we're on
BCM2711. On top of that introduce the macro ASB_BASE() which will select
the correct ASB register base, based on whether we're trying to access
V3D and which platform we're on.
Please don't refer to this block as ARGON - it is the IP of Raspberry
Pi Trading and it's name is RPiVid.
OK, sorry for that. I, again, mixed both ASB names. I'll rename the Argon ASB
to RPiVid. How should I call the one present in older RPis?
case BCM2835_POWER_DOMAIN_USB:
PM_WRITE(PM_USB, 0);
@@ -626,13 +633,22 @@ static int bcm2835_power_probe(struct platform_device *pdev)
power->dev = dev;
power->base = pm->base;
power->rpivid_asb = pm->rpivid_asb;
+ power->argon_asb = pm->argon_asb;
- id = ASB_READ(ASB_AXI_BRDG_ID);
+ id = ASB_READ(ASB_AXI_BRDG_ID, false);
if (id != 0x62726467 /* "BRDG" */) {
- dev_err(dev, "ASB register ID returned 0x%08x\n", id);
+ dev_err(dev, "RPiVid ASB register ID returned 0x%08x\n", id);
return -ENODEV;
}
+ if (pm->argon_asb) {
+ id = ASB_READ(ASB_AXI_BRDG_ID, true);
+ if (id != 0x62726467 /* "BRDG" */) {
+ dev_err(dev, "Argon ASB register ID returned 0x%08x\n", id);
+ return -ENODEV;
+ }
+ }
+
Surely these are the same register. Is this the result of a bad merge?
AFAIU There are two ASBs the old one at 0x7e00a000 and the new RPiVid one at
0x7ec11000. They both can be checked for valid IDs. Note the new argument in
ASB_READ().
Regards,
Nicolas
From: Phil Elwell <hidden> Date: 2021-02-09 16:40:02
Nicolas,
On Tue, 9 Feb 2021 at 14:00, Nicolas Saenz Julienne
[off-list ref] wrote:
On Tue, 2021-02-09 at 13:19 +0000, Phil Elwell wrote:
quoted
Hi Nicolas,
On Tue, 9 Feb 2021 at 13:00, Nicolas Saenz Julienne
[off-list ref] wrote:
quoted
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.
Use the fact that 'pm->argon_asb' is populated as a hint that we're on
BCM2711. On top of that introduce the macro ASB_BASE() which will select
the correct ASB register base, based on whether we're trying to access
V3D and which platform we're on.
Please don't refer to this block as ARGON - it is the IP of Raspberry
Pi Trading and it's name is RPiVid.
OK, sorry for that. I, again, mixed both ASB names. I'll rename the Argon ASB
to RPiVid. How should I call the one present in older RPis?
case BCM2835_POWER_DOMAIN_USB:
PM_WRITE(PM_USB, 0);
@@ -626,13 +633,22 @@ static int bcm2835_power_probe(struct platform_device *pdev) power->dev = dev; power->base = pm->base; power->rpivid_asb = pm->rpivid_asb;+ power->argon_asb = pm->argon_asb;- id = ASB_READ(ASB_AXI_BRDG_ID);+ id = ASB_READ(ASB_AXI_BRDG_ID, false); if (id != 0x62726467 /* "BRDG" */) {- dev_err(dev, "ASB register ID returned 0x%08x\n", id);+ dev_err(dev, "RPiVid ASB register ID returned 0x%08x\n", id); return -ENODEV; }+ if (pm->argon_asb) {+ id = ASB_READ(ASB_AXI_BRDG_ID, true);+ if (id != 0x62726467 /* "BRDG" */) {+ dev_err(dev, "Argon ASB register ID returned 0x%08x\n", id);+ return -ENODEV;+ }+ }+
Surely these are the same register. Is this the result of a bad merge?
AFAIU There are two ASBs the old one at 0x7e00a000 and the new RPiVid one at
0x7ec11000. They both can be checked for valid IDs. Note the new argument in
ASB_READ().
@@ -1,46 +0,0 @@-BCM2835 PM (Power domains, watchdog)--The PM block controls power domains and some reset lines, and includes-a watchdog timer. This binding supersedes the brcm,bcm2835-pm-wdt-binding which covered some of PM's register range and functionality.--Required properties:--- compatible: Should be "brcm,bcm2835-pm"-- reg: Specifies base physical address and size of the two- register ranges ("PM" and "ASYNC_BRIDGE" in that- order)-- clocks: a) v3d: The V3D clock from CPRMAN- b) peri_image: The PERI_IMAGE clock from CPRMAN- c) h264: The H264 clock from CPRMAN- d) isp: The ISP clock from CPRMAN-- #reset-cells: Should be 1. This property follows the reset controller- bindings[1].-- #power-domain-cells: Should be 1. This property follows the power domain- bindings[2].--Optional properties:--- timeout-sec: Contains the watchdog timeout in seconds-- system-power-controller: Whether the watchdog is controlling the- system power. This node follows the power controller bindings[3].--[1] Documentation/devicetree/bindings/reset/reset.txt-[2] Documentation/devicetree/bindings/power/power-domain.yaml-[3] Documentation/devicetree/bindings/power/power-controller.txt--Example:--pm {- compatible = "brcm,bcm2835-pm", "brcm,bcm2835-pm-wdt";- #power-domain-cells = <1>;- #reset-cells = <1>;- reg = <0x7e100000 0x114>,- <0x7e00a000 0x24>;- clocks = <&clocks BCM2835_CLOCK_V3D>,- <&clocks BCM2835_CLOCK_PERI_IMAGE>,- <&clocks BCM2835_CLOCK_H264>,- <&clocks BCM2835_CLOCK_ISP>;- clock-names = "v3d", "peri_image", "h264", "isp";- system-power-controller;-};
@@ -0,0 +1,79 @@+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause+%YAML1.2+---+$id:"http://devicetree.org/schemas/soc/bcm/brcm,bcm2835-pm.yaml#"+$schema:"http://devicetree.org/meta-schemas/core.yaml#"++title:BCM2835 PM (Power domains, watchdog)++description:|+The PM block controls power domains and some reset lines, and includes a+watchdog timer.++maintainers:+-Nicolas Saenz Julienne <nsaenzjulienne@suse.de>++allOf:+-$ref:../../watchdog/watchdog.yaml#++properties:+compatible:+items:+-enum:+-brcm,bcm2835-pm+-const:brcm,bcm2835-pm-wdt
Odd...
+
+ reg:
+ minItems: 1
+ maxItems: 2
+ description: Specifies base physical address and size of the two register
+ ranges, "PM" and "ASYNC_BRIDGE" in that order.
The number, what they are and order are captured with:
items:
- description: PM registers
- description: ASYNC_BRIDGE registers
'Specifies base physical address and size' is every 'reg'.
From: Rob Herring <robh@kernel.org> Date: 2021-02-10 22:45:16
On Tue, Feb 09, 2021 at 01:58:58PM +0100, Nicolas Saenz Julienne wrote:
quoted hunk
Anticipating the introduction of BCM2711, of which we'll need to support
its new Argon ASB, introduce reg-names into bcm2835-pm's binding. This
will help to have a consistent mapping between resources and their
meaning.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
.../devicetree/bindings/soc/bcm/brcm,bcm2835-pm.yaml | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
@@ -26,8 +26,13 @@ properties:reg:minItems:1maxItems:2-description:Specifies base physical address and size of the two register-ranges, "PM" and "ASYNC_BRIDGE" in that order.
Ah, it's okay this way if you have -names. Or have items to give a bit
more detail.
From: Rob Herring <robh@kernel.org> Date: 2021-02-10 22:45:35
On Tue, 09 Feb 2021 13:58:59 +0100, Nicolas Saenz Julienne wrote:
Add a new compatible string for BCM2711 and the option to provide a
third reg property for the board's new Argon ASB.
In BCM2711 the new Argon ASB took over V3D, which is our only consumer
of this driver so far. The old ASB is still be present with ISP and H264
bits but no V3D.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
.../devicetree/bindings/soc/bcm/brcm,bcm2835-pm.yaml | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
From: Rob Herring <robh@kernel.org> Date: 2021-02-10 22:46:04
On Tue, 09 Feb 2021 13:59:07 +0100, Nicolas Saenz Julienne wrote:
BCM2711, Raspberry Pi 4's SoC, contains a V3D core. So add its specific
compatible to the bindings.
Signed-off-by: Nicolas Saenz Julienne <redacted>
---
Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml | 1 +
1 file changed, 1 insertion(+)