Skip to contentSkip to conversation

BCM59056 PMU regulator support

PATCH Superseded Matt Porter 4 participants 10 messages Mar 11, 2014 – Mar 12, 2014

Subsystems (6)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover BCM59056 PMU regulator support

The BCM59056 is a multi-function power management unit used with the BCM281xx family of SoCs. This series adds an MFD and voltage regulator driver to support the BCM59056. The bcm28155-ap DT support is updated to enable use of regulators on the otg and sdhci peripherals.

Changes since v3:
- remove needless init of local ret variable in mfd driver probe

Changes since v2:
- Move to mfd_add_devices() approach, eliminating representation of the regulator block as a hardware subdevice. Regulators are listed in the PMU binding and referenced via the parent device of_node by the regulator driver.
- Allow mfd driver to build as module
- Remove regulator constraints from the .dtsi include only the board-specific constraints in the board .dts.

Changes since v1:
- renamed to bcm590xx to accomodate future family parts
- remove use of subsys_initcall
- fix BCM590XX_MAX_REGISTER value
- remove unused chip id in mfd of/i2c matching
- switch to of_platform_populate() in mfd
- update binding to single document with regulators as optional properties in the regulator subdevice IP description
- remove unused regulator get/set mode ops
- remove unneeded regulator NULL constraint check
- regulators property is optional, allow the driver to probe when it is missing
- move of_node presence check into bcm590xx_parse_dt_reg_data()

Matt Porter (5):
mfd: add bcm590xx pmu DT binding
mfd: add bcm590xx pmu driver
regulator: add bcm590xx regulator driver
ARM: configs: bcm_defconfig: enable bcm590xx regulator support
ARM: dts: add bcm590xx pmu support and enable for bcm28155-ap

 Documentation/devicetree/bindings/mfd/bcm590xx.txt |  41 ++
 arch/arm/boot/dts/bcm28155-ap.dts                  |  47 ++-
 arch/arm/boot/dts/bcm59056.dtsi                    |  77 ++++
 arch/arm/configs/bcm_defconfig                     |   7 +
 drivers/mfd/Kconfig                                |   8 +
 drivers/mfd/Makefile                               |   1 +
 drivers/mfd/bcm590xx.c                             |  93 +++++
 drivers/regulator/Kconfig                          |   8 +
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/bcm590xx-regulator.c             | 413 +++++++++++++++++++++
 include/linux/mfd/bcm590xx.h                       |  31 ++
 11 files changed, 726 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/bcm590xx.txt
 create mode 100644 arch/arm/boot/dts/bcm59056.dtsi
 create mode 100644 drivers/mfd/bcm590xx.c
 create mode 100644 drivers/regulator/bcm590xx-regulator.c
 create mode 100644 include/linux/mfd/bcm590xx.h
Signature · 1 line
1.8.4
#1 lore raw

PATCH v4 1/5 mfd: add bcm590xx pmu DT binding

Add a DT binding for the BCM590xx PMUs. The binding inherits from the generic regulator bindings.

---
 Documentation/devicetree/bindings/mfd/bcm590xx.txt | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/bcm590xx.txt
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +41 -0
new file mode 100644
index 0000000..2300246
@@ -0,0 +1,41 @@
+-------------------------------
+BCM590xx Power Management Units
+-------------------------------
+
+Required properties:
+- compatible: "brcm,bcm59056"
+- reg: I2C slave address
+- interrupts: interrupt for the PMU. Generic interrupt client node bindings
+  are described in interrupt-controller/interrupts.txt
+
+------------------
+Voltage Regulators
+------------------
+
+Optional properties:
+- regulators: This is the list of child nodes that specify the regulator
+  initialization data for defined regulators.  Generic regulator bindings
+  are described in regulator/regulator.txt.
+
+  The valid regulator nodes for BCM59056 are:
+  	rfldo, camldo1, camldo2, simldo1, simldo2, sdldo, sdxldo,
+	mmcldo1, mmcldo2, audldo, micldo, usbldo, vibldo,
+	csr, iosr1, iosr2, msr, sdsr1, sdsr2, vsr
+
+Example:
+	pmu: bcm59056 at 8 {
+		compatible = "brcm,bcm59056";
+		reg = <0x08>;
+		interrupts = <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>;
+		regulators {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			rfldo_reg: rfldo {
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3300000>;
+			};
+
+			...
+		};
+	};
Signature · 1 line
1.8.4
#2 lore raw

Re: [PATCH v4 1/5] mfd: add bcm590xx pmu DT binding

Quoted 17 lines · Matt Porter

Add a DT binding for the BCM590xx PMUs. The binding inherits from the generic regulator bindings.

---
 Documentation/devicetree/bindings/mfd/bcm590xx.txt | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/bcm590xx.txt
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +0 -0
new file mode 100644
index 0000000..2300246

Documentation/devicetree/bindings/mfd/bcm590xx.txt line 9

Quoted 9 lines
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +9 -0
@@ -0,0 +1,41 @@
+-------------------------------
+BCM590xx Power Management Units
+-------------------------------
+
+Required properties:
+- compatible: "brcm,bcm59056"
+- reg: I2C slave address
+- interrupts: interrupt for the PMU. Generic interrupt client node bindings
+  are described in interrupt-controller/interrupts.txt

This all looks sane.

Documentation/devicetree/bindings/mfd/bcm590xx.txt line 18

Quoted 9 lines
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +9 -0
+
+------------------
+Voltage Regulators
+------------------
+
+Optional properties:
+- regulators: This is the list of child nodes that specify the regulator
+  initialization data for defined regulators.  Generic regulator bindings
+  are described in regulator/regulator.txt.

This is a subnode, not a property. How about:

Optional child nodes:

- regulators: container node for regulators follwoing the generic regulator binding in regulator/regulator.txt.

Documentation/devicetree/bindings/mfd/bcm590xx.txt line 20

Quoted 2 lines
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +2 -0
+
+  The valid regulator nodes for BCM59056 are:

s/nodes/node names/

Quoted 6 lines
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +6 -0
+  	rfldo, camldo1, camldo2, simldo1, simldo2, sdldo, sdxldo,
+	mmcldo1, mmcldo2, audldo, micldo, usbldo, vibldo,
+	csr, iosr1, iosr2, msr, sdsr1, sdsr2, vsr
+
+Example:
+	pmu: bcm59056 at 8 {

Documentation/devicetree/bindings/mfd/bcm590xx.txt line 36

Quoted 10 lines
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +10 -0
+		compatible = "brcm,bcm59056";
+		reg = <0x08>;
+		interrupts = <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>;
+		regulators {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			rfldo_reg: rfldo {
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3300000>;

Are any specific properties required on these children?

Thanks,
Mark.

Quoted 9 lines
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +5 -0
+			};
+
+			...
+		};
+	};
Signature · 1 line
1.8.4
maintainer
#3 lore raw

Re: [PATCH v4 1/5] mfd: add bcm590xx pmu DT binding

Quoted 7 lines · Mark Rutland

Documentation/devicetree/bindings/mfd/bcm590xx.txt line 36

Quoted 3 lines · Matt Porter
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +3 -0
+			rfldo_reg: rfldo {
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3300000>;

Are any specific properties required on these children?

Regulator nodes can be completely empty (or missing) - for most drivers
there's nothing driver specific, the standard binding covers everything.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140312/a2fa89e2/attachment.sig>

#4 lore raw

Re: [PATCH v4 1/5] mfd: add bcm590xx pmu DT binding

In reply to Mark Rutland
Quoted 42 lines · Mark Rutland
Quoted 17 lines · Matt Porter

Add a DT binding for the BCM590xx PMUs. The binding inherits from the generic regulator bindings.

---
 Documentation/devicetree/bindings/mfd/bcm590xx.txt | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/bcm590xx.txt
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +0 -0
new file mode 100644
index 0000000..2300246

Documentation/devicetree/bindings/mfd/bcm590xx.txt line 9

Quoted 9 lines
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +9 -0
@@ -0,0 +1,41 @@
+-------------------------------
+BCM590xx Power Management Units
+-------------------------------
+
+Required properties:
+- compatible: "brcm,bcm59056"
+- reg: I2C slave address
+- interrupts: interrupt for the PMU. Generic interrupt client node bindings
+  are described in interrupt-controller/interrupts.txt

This all looks sane.

Documentation/devicetree/bindings/mfd/bcm590xx.txt line 18

Quoted 9 lines
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +9 -0
+
+------------------
+Voltage Regulators
+------------------
+
+Optional properties:
+- regulators: This is the list of child nodes that specify the regulator
+  initialization data for defined regulators.  Generic regulator bindings
+  are described in regulator/regulator.txt.

This is a subnode, not a property. How about:

Quoted 4 lines

Optional child nodes:

- regulators: container node for regulators follwoing the generic regulator binding in regulator/regulator.txt.

Agreed, I'll reword like that...makes more sense like that.

Quoted 4 lines

Documentation/devicetree/bindings/mfd/bcm590xx.txt line 20

Quoted 2 lines
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +2 -0
+
+  The valid regulator nodes for BCM59056 are:

s/nodes/node names/

Ok

Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +10 -0
+  	rfldo, camldo1, camldo2, simldo1, simldo2, sdldo, sdxldo,
+	mmcldo1, mmcldo2, audldo, micldo, usbldo, vibldo,
+	csr, iosr1, iosr2, msr, sdsr1, sdsr2, vsr
+
+Example:
+	pmu: bcm59056 at 8 {
+		compatible = "brcm,bcm59056";
+		reg = <0x08>;
+		interrupts = <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>;
+		regulators {
Quoted 8 lines

Documentation/devicetree/bindings/mfd/bcm590xx.txt line 36

Quoted 6 lines
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +6 -0
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			rfldo_reg: rfldo {
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3300000>;

Are any specific properties required on these children?

None. The only requirement is that when regulator node exists, the node names must match those listed.

I'll send out another version with rewording suggested above.

Thanks,
Matt

#5 lore raw

PATCH v4 2/5 mfd: add bcm590xx pmu driver

In reply to Matt Porter

Add a driver for the BCM590xx PMU multi-function devices. The driver initially supports regmap initialization and instantiation of the voltage regulator device function of the PMU.

---
 drivers/mfd/Kconfig          |  8 ++++
 drivers/mfd/Makefile         |  1 +
 drivers/mfd/bcm590xx.c       | 93 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/bcm590xx.h | 31 +++++++++++++++
 4 files changed, 133 insertions(+)
 create mode 100644 drivers/mfd/bcm590xx.c
 create mode 100644 include/linux/mfd/bcm590xx.h
drivers/mfd/Kconfig +8 -0
index 49bb445..27ff37c 100644
@@ -59,6 +59,14 @@ config MFD_AAT2870_CORE
 	  additional drivers must be enabled in order to use the
 	  functionality of the device.
 
+config MFD_BCM590XX
+	tristate "Broadcom BCM590xx PMUs"
+	select MFD_CORE
+	select REGMAP_I2C
+	depends on I2C
+	help
+	  Support for the BCM590xx PMUs from Broadcom
+
 config MFD_CROS_EC
 	tristate "ChromeOS Embedded Controller"
 	select MFD_CORE
drivers/mfd/Makefile +1 -0
index 5aea5ef..4c342bf 100644
@@ -8,6 +8,7 @@ obj-$(CONFIG_MFD_88PM800)	+= 88pm800.o 88pm80x.o
 obj-$(CONFIG_MFD_88PM805)	+= 88pm805.o 88pm80x.o
 obj-$(CONFIG_MFD_SM501)		+= sm501.o
 obj-$(CONFIG_MFD_ASIC3)		+= asic3.o tmio_core.o
+obj-$(CONFIG_MFD_BCM590XX)	+= bcm590xx.o
 obj-$(CONFIG_MFD_CROS_EC)	+= cros_ec.o
 obj-$(CONFIG_MFD_CROS_EC_I2C)	+= cros_ec_i2c.o
 obj-$(CONFIG_MFD_CROS_EC_SPI)	+= cros_ec_spi.o
drivers/mfd/bcm590xx.c new file +93 -0

93 lines not on this page · raw message

include/linux/mfd/bcm590xx.h new file +31 -0
new file mode 100644
index 0000000..434df2d
@@ -0,0 +1,31 @@
+/*
+ * Broadcom BCM590xx PMU
+ *
+ * Copyright 2014 Linaro Limited
+ * Author: Matt Porter <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under  the terms of the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef __LINUX_MFD_BCM590XX_H
+#define __LINUX_MFD_BCM590XX_H
+
+#include <linux/device.h>
+#include <linux/i2c.h>
+#include <linux/regmap.h>
+
+/* max register address */
+#define BCM590XX_MAX_REGISTER	0xe7
+
+struct bcm590xx {
+	struct device *dev;
+	struct i2c_client *i2c_client;
+	struct regmap *regmap;
+	unsigned int id;
+};
+
+#endif /*  __LINUX_MFD_BCM590XX_H */
Signature · 1 line
1.8.4
#6 lore raw

Re: [PATCH v4 2/5] mfd: add bcm590xx pmu driver

Quoted 7 lines

Add a driver for the BCM590xx PMU multi-function devices. The driver initially supports regmap initialization and instantiation of the voltage regulator device function of the PMU.

Quoted 8 lines
---
 drivers/mfd/Kconfig          |  8 ++++
 drivers/mfd/Makefile         |  1 +
 drivers/mfd/bcm590xx.c       | 93 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/bcm590xx.h | 31 +++++++++++++++
 4 files changed, 133 insertions(+)
 create mode 100644 drivers/mfd/bcm590xx.c
 create mode 100644 include/linux/mfd/bcm590xx.h

Ah, you fixed the nit.

Applied this one instead then.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#7 lore raw

PATCH v4 3/5 regulator: add bcm590xx regulator driver

In reply to Matt Porter

Add a regulator driver for the BCM590xx PMU voltage regulators. The driver supports LDOs and DCDCs in normal mode only. There is no support for low-power mode or power sequencing.

---
 drivers/regulator/Kconfig              |   8 +
 drivers/regulator/Makefile             |   1 +
 drivers/regulator/bcm590xx-regulator.c | 413 +++++++++++++++++++++++++++++++++
 3 files changed, 422 insertions(+)
 create mode 100644 drivers/regulator/bcm590xx-regulator.c
drivers/regulator/Kconfig +8 -0
index 6a79328..1169a42 100644
@@ -139,6 +139,14 @@ config REGULATOR_AS3722
 	  AS3722 PMIC. This will enable support for all the software
 	  controllable DCDC/LDO regulators.
 
+config REGULATOR_BCM590XX
+	tristate "Broadcom BCM590xx PMU Regulators"
+	depends on MFD_BCM590XX
+	help
+	  This driver provides support for the voltage regulators on the
+	  BCM590xx PMUs. This will enable support for the software
+	  controllable LDO/Switching regulators.
+
 config REGULATOR_DA903X
 	tristate "Dialog Semiconductor DA9030/DA9034 regulators"
 	depends on PMIC_DA903X
drivers/regulator/Makefile +1 -0
index 979f9dd..e1ab514 100644
@@ -20,6 +20,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
 obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o
 obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o
+obj-$(CONFIG_REGULATOR_BCM590XX) += bcm590xx-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X)	+= da903x.o
 obj-$(CONFIG_REGULATOR_DA9052)	+= da9052-regulator.o
 obj-$(CONFIG_REGULATOR_DA9055)	+= da9055-regulator.o
drivers/regulator/bcm590xx-regulator.c new file +413 -0

413 lines not on this page · raw message

Signature · 1 line
1.8.4
#8 lore raw

PATCH v4 4/5 ARM: configs: bcm_defconfig: enable bcm590xx regulator support

In reply to Matt Porter

Enable BCM590xx MFD and regulator drivers to manage voltage regulators on BCM281xx platforms.

---
 arch/arm/configs/bcm_defconfig | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/configs/bcm_defconfig +7 -0
index 2519d6d..0100464 100644
@@ -79,6 +79,13 @@ CONFIG_HW_RANDOM=y
 CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=y
 # CONFIG_HWMON is not set
+CONFIG_MFD_BCM590XX=y
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
+CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
+CONFIG_REGULATOR_USERSPACE_CONSUMER=y
+CONFIG_REGULATOR_BCM590XX=y
+
 CONFIG_VIDEO_OUTPUT_CONTROL=y
 CONFIG_FB=y
 CONFIG_BACKLIGHT_LCD_SUPPORT=y
Signature · 1 line
1.8.4
#9 lore raw

PATCH v4 5/5 ARM: dts: add bcm590xx pmu support and enable for bcm28155-ap

In reply to Matt Porter

Add a dtsi to support the BCM590xx PMUs used by the BCM281xx family of SoCs. Enable regulators for use with the dwc2 and sdhci on bcm28155-ap.

---
 arch/arm/boot/dts/bcm28155-ap.dts | 47 +++++++++++++++++++++++-
 arch/arm/boot/dts/bcm59056.dtsi   | 77 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 123 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/bcm59056.dtsi
arch/arm/boot/dts/bcm28155-ap.dts +46 -1
index 5ff2382..99ff0c1 100644
@@ -46,7 +46,11 @@
 
 	i2c at 3500d000 {
 		status="okay";
-		clock-frequency = <400000>;
+		clock-frequency = <100000>;
+
+		pmu: pmu at 8 {
+			reg = <0x08>;
+		};
 	};
 
 	sdio1: sdio at 3f180000 {
@@ -57,16 +61,22 @@
 	sdio2: sdio at 3f190000 {
 		non-removable;
 		max-frequency = <48000000>;
+		vmmc-supply = <&camldo1_reg>;
+		vqmmc-supply = <&iosr1_reg>;
 		status = "okay";
 	};
 
 	sdio4: sdio at 3f1b0000 {
 		max-frequency = <48000000>;
 		cd-gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+		vmmc-supply = <&sdldo_reg>;
+		vqmmc-supply = <&sdxldo_reg>;
 		status = "okay";
 	};
 
 	usbotg: usb at 3f120000 {
+		vusb_d-supply = <&usbldo_reg>;
+		vusb_a-supply = <&iosr1_reg>;
 		status = "okay";
 	};
 
@@ -74,3 +84,38 @@
 		status = "okay";
 	};
 };
+
+#include "bcm59056.dtsi"
+
+&pmu {
+	compatible = "brcm,bcm59056";
+	interrupts = <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>;
+	regulators {
+		camldo1_reg: camldo1 {
+			regulator-min-microvolt = <3300000>;
+			regulator-max-microvolt = <3300000>;
+		};
+
+		sdldo_reg: sdldo {
+			regulator-min-microvolt = <3000000>;
+			regulator-max-microvolt = <3000000>;
+		};
+
+		sdxldo_reg: sdxldo {
+			regulator-min-microvolt = <2700000>;
+			regulator-max-microvolt = <3300000>;
+		};
+
+		usbldo_reg: usbldo {
+			regulator-min-microvolt = <3300000>;
+			regulator-max-microvolt = <3300000>;
+			regulator-always-on;
+		};
+
+		iosr1_reg: iosr1 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+			regulator-always-on;
+		};
+	};
+};
arch/arm/boot/dts/bcm59056.dtsi new file +77 -0

77 lines not on this page · raw message

Signature · 1 line
1.8.4