Skip to contentSkip to conversation

Broadcom's PMB (Power Management Bus) support

PATCH In review Rafał Miłecki 4 participants 9 messages Dec 14, 2020 – Jan 13, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Broadcom's PMB (Power Management Bus) support

From: Rafał Miłecki <[email protected]>

PMB is a hardware block used for powering SoC devices like PCIe, USB, SATA. Initially I planned to treat it as a reset controller and Philipp pointed out in review that PMB driver should use a power subsystem.

This is my refactored support.

***

Please note one difference when compared to the initial reset attempt.

As I store info about SoC devices in the driver now, I had to put support for multiple buses there. That's required to avoid things like:

compatible = "brcm,bcm4908-pmb-no-1";
compatible = "brcm,bcm4908-pmb-no-2";

So now a single "reg" covers bigger buses (e.g. 0x40) in size, see:

reg = <0x802800e0 0x40>;

Other SoCs my use something like:

reg = <0x802800e0 0x20>;
reg = <0x802800e0 0x60>;

***

AFAIU this should go through Florian's tree. I based in on top of the soc-arm64/next.

V2: Use drivers/soc/bcm/bcm63xx/ and add Kconfig help message

Rafał Miłecki (2):
dt-bindings: power: document Broadcom's PMB binding
soc: bcm: add PM driver for Broadcom's PMB

 .../bindings/power/brcm,bcm-pmb.yaml          |  50 +++
 MAINTAINERS                                   |  10 +
 drivers/soc/bcm/Makefile                      |   2 +-
 drivers/soc/bcm/bcm63xx/Kconfig               |   9 +
 drivers/soc/bcm/bcm63xx/Makefile              |   1 +
 drivers/soc/bcm/bcm63xx/bcm-pmb.c             | 333 ++++++++++++++++++
 include/dt-bindings/soc/bcm-pmb.h             |  11 +
 7 files changed, 415 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/power/brcm,bcm-pmb.yaml
 create mode 100644 drivers/soc/bcm/bcm63xx/bcm-pmb.c
 create mode 100644 include/dt-bindings/soc/bcm-pmb.h
Signature · 1 line
2.26.2
#1 lore raw

PATCH v2 1/2 dt-bindings: power: document Broadcom's PMB binding

From: Rafał Miłecki <[email protected]>

Broadcom's PMB is power controller used for disabling and enabling SoC devices.

---
 .../bindings/power/brcm,bcm-pmb.yaml          | 50 +++++++++++++++++++
 include/dt-bindings/soc/bcm-pmb.h             | 11 ++++
 2 files changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/brcm,bcm-pmb.yaml
 create mode 100644 include/dt-bindings/soc/bcm-pmb.h
Documentation/devicetree/bindings/power/brcm,bcm-pmb.yaml new file +50 -0
new file mode 100644
index 000000000000..40b08d83c80b
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/brcm,bcm-pmb.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom PMB (Power Management Bus) controller
+
+description: This document describes Broadcom's PMB controller. It supports
+  powering various types of connected devices (e.g. PCIe, USB, SATA).
+
+maintainers:
+  - Rafał Miłecki <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - brcm,bcm4908-pmb
+
+  reg:
+    description: register space of one or more buses
+    maxItems: 1
+
+  big-endian:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: Flag to use for block working in big endian mode.
+
+  "#power-domain-cells":
+    description: cell specifies device ID (see bcm-pmb.h)
+    const: 1
+
+required:
+  - reg
+  - "#power-domain-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/bcm-pmb.h>
+
+    pmb: power-controller@802800e0 {
+        compatible = "brcm,bcm4908-pmb";
+        reg = <0x802800e0 0x40>;
+        #power-domain-cells = <1>;
+    };
+
+    foo {
+        power-domains = <&pmb BCM_PMB_PCIE0>;
+    };
include/dt-bindings/soc/bcm-pmb.h new file +11 -0
new file mode 100644
index 000000000000..744dc3af4d41
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR MIT */
+
+#ifndef __DT_BINDINGS_SOC_BCM_PMB_H
+#define __DT_BINDINGS_SOC_BCM_PMB_H
+
+#define BCM_PMB_PCIE0				0x01
+#define BCM_PMB_PCIE1				0x02
+#define BCM_PMB_PCIE2				0x03
+#define BCM_PMB_HOST_USB			0x04
+
+#endif
Signature · 1 line
2.26.2
maintainer Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH V2 1/2] dt-bindings: power: document Broadcom's PMB binding

Quoted 5 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Broadcom's PMB is power controller used for disabling and enabling SoC devices.

Quoted 8 lines
---
 .../bindings/power/brcm,bcm-pmb.yaml          | 50 +++++++++++++++++++
 include/dt-bindings/soc/bcm-pmb.h             | 11 ++++
 2 files changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/brcm,bcm-pmb.yaml
 create mode 100644 include/dt-bindings/soc/bcm-pmb.h
Acked-by on v2 1/2
#4 lore raw

Re: [PATCH V2 1/2] dt-bindings: power: document Broadcom's PMB binding

In reply to Rafał Miłecki
Quoted 7 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Broadcom's PMB is power controller used for disabling and enabling SoC devices.

Apologize for the delay!

Kind regards
Uffe

Quoted 83 lines
---
 .../bindings/power/brcm,bcm-pmb.yaml          | 50 +++++++++++++++++++
 include/dt-bindings/soc/bcm-pmb.h             | 11 ++++
 2 files changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/brcm,bcm-pmb.yaml
 create mode 100644 include/dt-bindings/soc/bcm-pmb.h
Documentation/devicetree/bindings/power/brcm,bcm-pmb.yaml new file +50 -0
new file mode 100644
index 000000000000..40b08d83c80b
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/brcm,bcm-pmb.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom PMB (Power Management Bus) controller
+
+description: This document describes Broadcom's PMB controller. It supports
+  powering various types of connected devices (e.g. PCIe, USB, SATA).
+
+maintainers:
+  - Rafał Miłecki <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - brcm,bcm4908-pmb
+
+  reg:
+    description: register space of one or more buses
+    maxItems: 1
+
+  big-endian:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: Flag to use for block working in big endian mode.
+
+  "#power-domain-cells":
+    description: cell specifies device ID (see bcm-pmb.h)
+    const: 1
+
+required:
+  - reg
+  - "#power-domain-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/bcm-pmb.h>
+
+    pmb: power-controller@802800e0 {
+        compatible = "brcm,bcm4908-pmb";
+        reg = <0x802800e0 0x40>;
+        #power-domain-cells = <1>;
+    };
+
+    foo {
+        power-domains = <&pmb BCM_PMB_PCIE0>;
+    };
include/dt-bindings/soc/bcm-pmb.h new file +11 -1
new file mode 100644
index 000000000000..744dc3af4d41
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR MIT */
+
+#ifndef __DT_BINDINGS_SOC_BCM_PMB_H
+#define __DT_BINDINGS_SOC_BCM_PMB_H
+
+#define BCM_PMB_PCIE0                          0x01
+#define BCM_PMB_PCIE1                          0x02
+#define BCM_PMB_PCIE2                          0x03
+#define BCM_PMB_HOST_USB                       0x04
+
+#endif
--

2.26.2

#5 lore raw

PATCH v2 2/2 soc: bcm: add PM driver for Broadcom's PMB

In reply to Rafał Miłecki

From: Rafał Miłecki <[email protected]>

PMB originally comes from BCM63138 but can be also found on many other chipsets (e.g. BCM4908). It's needed to power on and off SoC blocks like PCIe, SATA, USB.

---
V2: Use drivers/soc/bcm/bcm63xx/
Add help to the config BCM_PMB
Drop debugging print

---
 MAINTAINERS                       |  10 +
 drivers/soc/bcm/Makefile          |   2 +-
 drivers/soc/bcm/bcm63xx/Kconfig   |   9 +
 drivers/soc/bcm/bcm63xx/Makefile  |   1 +
 drivers/soc/bcm/bcm63xx/bcm-pmb.c | 333 ++++++++++++++++++++++++++++++
 5 files changed, 354 insertions(+), 1 deletion(-)
 create mode 100644 drivers/soc/bcm/bcm63xx/bcm-pmb.c
MAINTAINERS +10 -0
index e73636b75f29..75140f0d1541 100644
@@ -3656,6 +3656,16 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/firmware/broadcom/*
 
+BROADCOM PMB (POWER MANAGEMENT BUS) DRIVER
+M:	Rafał Miłecki <[email protected]>
+M:	Florian Fainelli <[email protected]>
+M:	[email protected]
+L:	[email protected]
+S:	Maintained
+T:	git git://github.com/broadcom/stblinux.git
+F:	drivers/soc/bcm/bcm-pmb.c
+F:	include/dt-bindings/soc/bcm-pmb.h
+
 BROADCOM SPECIFIC AMBA DRIVER (BCMA)
 M:	Rafał Miłecki <[email protected]>
 L:	[email protected]
drivers/soc/bcm/Makefile +1 -1
index 7bc90e0bd773..0f0efa28d92b 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BCM2835_POWER)	+= bcm2835-power.o
 obj-$(CONFIG_RASPBERRYPI_POWER)	+= raspberrypi-power.o
-obj-$(CONFIG_SOC_BCM63XX)	+= bcm63xx/
+obj-y				+= bcm63xx/
 obj-$(CONFIG_SOC_BRCMSTB)	+= brcmstb/
drivers/soc/bcm/bcm63xx/Kconfig +9 -0
index 16f648a6c70a..9e501c8ac5ce 100644
@@ -10,3 +10,12 @@ config BCM63XX_POWER
 	  BCM6318, BCM6328, BCM6362 and BCM63268 SoCs.
 
 endif # SOC_BCM63XX
+
+config BCM_PMB
+	bool "Broadcom PMB (Power Management Bus) driver"
+	depends on ARCH_BCM4908 || (COMPILE_TEST && OF)
+	default ARCH_BCM4908
+	select PM_GENERIC_DOMAINS if PM
+	help
+	  This enables support for the Broadcom's PMB (Power Management Bus) that
+	  is used for disabling and enabling SoC devices.
drivers/soc/bcm/bcm63xx/Makefile +1 -0
index 0710d5e018cc..557eed3d67bd 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BCM63XX_POWER) += bcm63xx-power.o
+obj-$(CONFIG_BCM_PMB)		+= bcm-pmb.o
drivers/soc/bcm/bcm63xx/bcm-pmb.c new file +333 -0

333 lines not on this page · raw message

Signature · 1 line
2.26.2
#6 lore raw

Re: [PATCH V2 2/2] soc: bcm: add PM driver for Broadcom's PMB

Quoted 7 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

PMB originally comes from BCM63138 but can be also found on many other chipsets (e.g. BCM4908). It's needed to power on and off SoC blocks like PCIe, SATA, USB.

From a driver perspective this looks good to me and thanks for putting it under drivers/soc/bcm/bcm63xx. Ulf, Kevin, I would need an Ack from you so I can carry this through the Broadcom SoCs pull requests for v5.12, thanks!

Signature · 1 line
Florian
Acked-by
#7 lore raw

Re: [PATCH V2 2/2] soc: bcm: add PM driver for Broadcom's PMB

Quoted 10 lines · Florian Fainelli
Quoted 6 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

PMB originally comes from BCM63138 but can be also found on many other chipsets (e.g. BCM4908). It's needed to power on and off SoC blocks like PCIe, SATA, USB.

Quoted 6 lines
Quoted 1 line

From a driver perspective this looks good to me and thanks for putting it under drivers/soc/bcm/bcm63xx. Ulf, Kevin, I would need an Ack from you so I can carry this through the Broadcom SoCs pull requests for v5.12, thanks!

Apologize for the delay!

Kind regards
Uffe

#8 lore raw
In reply to Rafał Miłecki
Quoted 27 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

PMB is a hardware block used for powering SoC devices like PCIe, USB, SATA. Initially I planned to treat it as a reset controller and Philipp pointed out in review that PMB driver should use a power subsystem.

This is my refactored support.

***

Please note one difference when compared to the initial reset attempt.

As I store info about SoC devices in the driver now, I had to put support for multiple buses there. That's required to avoid things like:

compatible = "brcm,bcm4908-pmb-no-1";
compatible = "brcm,bcm4908-pmb-no-2";

So now a single "reg" covers bigger buses (e.g. 0x40) in size, see:

reg = <0x802800e0 0x40>;

Other SoCs my use something like:

reg = <0x802800e0 0x20>;
reg = <0x802800e0 0x60>;

Quoted 6 lines

***

AFAIU this should go through Florian's tree. I based in on top of the soc-arm64/next.

V2: Use drivers/soc/bcm/bcm63xx/ and add Kconfig help message

Series applied to drivers/next, thanks!

Signature · 1 line
Florian