Skip to contentSkip to conversation

power: Add brcm,bcm6358-power-controller device tree binding

PATCH In review Simon Arlott 3 participants 5 messages Dec 9, 2015 – Dec 15, 2015

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

PATCH 1/2 power: Add brcm,bcm6358-power-controller device tree binding

The BCM6358 contains power domains controlled with a register. Power domains are indexed by bits in the register. Power domain bits can be interleaved with other status bits and clocks in the same register.

Newer SoCs with dedicated power domain registers are active low.

---
 .../power/brcm,bcm6358-power-controller.txt        | 53 ++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt
Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt new file +53 -0
new file mode 100644
index 0000000..556c323
@@ -0,0 +1,53 @@
+Broadcom BCM6358 Power domain controller
+
+This binding uses the power domain bindings:
+        Documentation/devicetree/bindings/power/power_domain.txt
+
+The BCM6358 contains power domains controlled with a register. Power
+domains are indexed by bits in the register. Power domain bits can be
+interleaved with other status bits and clocks in the same register.
+
+Newer SoCs with dedicated power domain registers are active low.
+
+Required properties:
+- compatible:           Should be "brcm,bcm<soc>-power-controller", "brcm,bcm6358-power-controller"
+- #power-domain-cells:  Should be <1>.
+- regmap:               The register map phandle
+- offset:               Offset in the register map for the power domain register (in bytes)
+- power-domain-indices: The bits in the register used for power domains.
+- power-domain-names:   Should be a list of strings of power domain names
+                        indexed by the power domain indices.
+
+Optional properties:
+- active-low:           Specify that the bits are active low.
+
+Example:
+
+misc_iddq_ctrl: power-controller {
+	compatible = "brcm,bcm63168-power-controller", "brcm,bcm6358-power-controller";
+	regmap = <&misc>;
+	offset = <0x4c>;
+
+	#power-domain-cells = <1>;
+	power-domain-indices =
+	                <0>,         <1>,      <2>,    <3>,         <4>,
+	                <5>,         <6>,      <7>,    <8>,         <9>,
+	                <10>,        <11>,     <12>,   <13>,        <17>,
+	                <18>;
+	power-domain-names =
+	                "sar",       "ipsec",  "mips", "dect",      "usbh",
+	                "usbd",      "robosw", "pcm",  "periph",    "vdsl_phy",
+	                "vdsl_mips", "fap",    "pcie", "wlan_pads", "gphy",
+	                "gmac";
+	active-low;
+};
+
+periph_iddq: power-controller {
+	compatible = "brcm,bcm6368-power-controller", "brcm,bcm6358-power-controller";
+	regmap = <&periph_cntl>;
+	offset = <0x4>;
+
+	#power-domain-cells = <1>;
+	power-domain-indices = <19>;
+	power-domain-names = "usbh";
+};
Signature · 4 lines
2.1.4

-- 
Simon Arlott
#1 lore raw

PATCH 2/2 power: bcm6358-power: Add BCM6358 power domain controller support

The BCM6358 contains power domains controlled with a register. Power domains are indexed by bits in the register. Power domain bits can be interleaved with other status bits and clocks in the same register.

Newer SoCs with dedicated power domain registers are active low.

---
 MAINTAINERS                   |   1 +
 drivers/power/Kconfig         |  11 +++
 drivers/power/Makefile        |   1 +
 drivers/power/bcm6358-power.c | 198 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 211 insertions(+)
 create mode 100644 drivers/power/bcm6358-power.c
MAINTAINERS +1 -0
index 0370aba..5546a53 100644
@@ -2391,6 +2391,7 @@ F:	drivers/clk/bcm/clk-bcm6345*
 F:	drivers/irqchip/irq-bcm63*
 F:	drivers/irqchip/irq-bcm7*
 F:	drivers/irqchip/irq-brcmstb*
+F:	drivers/power/bcm6358*
 F:	drivers/reset/bcm/reset-bcm6345*
 F:	include/linux/bcm63xx_wdt.h
 
drivers/power/Kconfig +11 -0
index 1ddd13c..3d6f842 100644
@@ -506,3 +506,14 @@ endif # POWER_SUPPLY
 
 source "drivers/power/reset/Kconfig"
 source "drivers/power/avs/Kconfig"
+
+config BCM6358_POWER
+	bool "BCM6358 power domain support"
+	depends on BMIPS_GENERIC && PM && OF
+	select PM_GENERIC_DOMAINS
+	select PM_GENERIC_DOMAINS_OF
+	default BMIPS_GENERIC
+	help
+	  Say Y here to enable support for power domains on the BCM6358.
+	  Required to ensure that power is enabled for SoC peripheral
+	  devices, and that power is disabled to unused devices.
drivers/power/Makefile +1 -0
index 0e4eab5..0b72dd2 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_GENERIC_ADC_BATTERY)	+= generic-adc-battery.o
 obj-$(CONFIG_PDA_POWER)		+= pda_power.o
 obj-$(CONFIG_APM_POWER)		+= apm_power.o
 obj-$(CONFIG_AXP20X_POWER)	+= axp20x_usb_power.o
+obj-$(CONFIG_BCM6358_POWER)	+= bcm6358-power.o
 obj-$(CONFIG_MAX8925_POWER)	+= max8925_power.o
 obj-$(CONFIG_WM831X_BACKUP)	+= wm831x_backup.o
 obj-$(CONFIG_WM831X_POWER)	+= wm831x_power.o
drivers/power/bcm6358-power.c new file +198 -0

198 lines not on this page · raw message

Signature · 4 lines
2.1.4

-- 
Simon Arlott
maintainer
#2 lore raw
In reply to Simon Arlott
Quoted 25 lines · Simon Arlott

The BCM6358 contains power domains controlled with a register. Power domains are indexed by bits in the register. Power domain bits can be interleaved with other status bits and clocks in the same register.

Newer SoCs with dedicated power domain registers are active low.

---
 .../power/brcm,bcm6358-power-controller.txt        | 53 ++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt
Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt new file +7 -0
new file mode 100644
index 0000000..556c323
@@ -0,0 +1,53 @@
+Broadcom BCM6358 Power domain controller
+
+This binding uses the power domain bindings:
+        Documentation/devicetree/bindings/power/power_domain.txt
+
+The BCM6358 contains power domains controlled with a register. Power
+domains are indexed by bits in the register. Power domain bits can be

Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt line 17

Quoted 10 lines
Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt new file +10 -0
+interleaved with other status bits and clocks in the same register.
+
+Newer SoCs with dedicated power domain registers are active low.
+
+Required properties:
+- compatible:           Should be "brcm,bcm<soc>-power-controller", "brcm,bcm6358-power-controller"
+- #power-domain-cells:  Should be <1>.
+- regmap:               The register map phandle
+- offset:               Offset in the register map for the power domain register (in bytes)
+- power-domain-indices: The bits in the register used for power domains.

You should drop this and make the cell values be the register offsets.

Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt line 19

Quoted 2 lines
Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt new file +2 -0
+- power-domain-names:   Should be a list of strings of power domain names
+                        indexed by the power domain indices.

This isn't really needed anyway.

Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt line 22

Quoted 3 lines
Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt new file +3 -0
+
+Optional properties:
+- active-low:           Specify that the bits are active low.

This should be implied by the compatible property.

Rob

#3 lore raw
Quoted 30 lines · Rob Herring
Quoted 29 lines · Simon Arlott

The BCM6358 contains power domains controlled with a register. Power domains are indexed by bits in the register. Power domain bits can be interleaved with other status bits and clocks in the same register.

Newer SoCs with dedicated power domain registers are active low.

---
 .../power/brcm,bcm6358-power-controller.txt        | 53 ++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt
Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt new file +11 -0
new file mode 100644
index 0000000..556c323
@@ -0,0 +1,53 @@
+Broadcom BCM6358 Power domain controller
+
+This binding uses the power domain bindings:
+        Documentation/devicetree/bindings/power/power_domain.txt
+
+The BCM6358 contains power domains controlled with a register. Power
+domains are indexed by bits in the register. Power domain bits can be
+interleaved with other status bits and clocks in the same register.
+
+Newer SoCs with dedicated power domain registers are active low.
+
Quoted 8 lines

Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt line 17

Quoted 6 lines
Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt new file +6 -0
+Required properties:
+- compatible:           Should be "brcm,bcm<soc>-power-controller", "brcm,bcm6358-power-controller"
+- #power-domain-cells:  Should be <1>.
+- regmap:               The register map phandle
+- offset:               Offset in the register map for the power domain register (in bytes)
+- power-domain-indices: The bits in the register used for power domains.

You should drop this and make the cell values be the register offsets.

I need to register every power domain in order to get the kernel to turn off those that are unused. Even if I could enumerate all device tree devices that reference the power-controller node, not all of them have bindings to allow them to be specified in the device tree file.

I can't register all 32 bits because that won't work on the BCM6358 that only has 1 power domain bit in the register and several clock bits. On the BCM63268 there are power domain bits that have no device that I don't want the kernel to disable (like the memory controller).

How should I determine which bits to register a power domain for?

	misc_iddq_ctrl: power-controller@1000184c {
		compatible = "brcm,bcm6358-power-controller";
		regmap = <&misc>;
		offset = <0x4c>;

		mask = <0x1043fff>;

		#power-domain-cells = <1>;
	};

or

	misc_iddq_ctrl: power-controller@1000184c {
		compatible = "brcm,bcm6358-power-controller";
		regmap = <&misc>;
		offset = <0x4c>;

		#address-cells = <1>;
		#size-cells = <0>;

		sar: power-controller@0 {
			reg = <0>;
			#power-domain-cells = <0>;
		};

		ipsec: power-controller@1 {
			reg = <1>;
			#power-domain-cells = <0>;
		};

		...
	};

or something else?

Quoted 4 lines

Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt line 19

Quoted 2 lines
Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt new file +2 -0
+- power-domain-names:   Should be a list of strings of power domain names
+                        indexed by the power domain indices.

This isn't really needed anyway.

If I remove this then I'll have to use the same node name for each struct generic_pm_domain "name" field that I register, although these names don't appear to be exported anywhere.

Quoted 5 lines

Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt line 22

Quoted 3 lines
Documentation/devicetree/bindings/power/brcm,bcm6358-power-controller.txt new file +3 -0
+
+Optional properties:
+- active-low:           Specify that the bits are active low.

This should be implied by the compatible property.

Ok, I'll create "brcm,bcm6358-power-controller" that's active high and "brcm,bcm6328-power-controller" that's active low. This appear to be the earliest chips that introduced or changed "iddq" register bits.

Signature · 1 line
Simon Arlott
#4 lore raw
In reply to Simon Arlott

Hi,

Quoted 5 lines · Simon Arlott

The BCM6358 contains power domains controlled with a register. Power domains are indexed by bits in the register. Power domain bits can be interleaved with other status bits and clocks in the same register.

Newer SoCs with dedicated power domain registers are active low.

That's neither a power supply driver (like a battery charger or a fuel gauge), nor a reboot/poweroff driver, so does not really fit into my tree. I will add generic PM maintainers to the discussion.

-- Sebastian