Skip to contentSkip to conversation

BCM59056 PMU regulator support

PATCH Applied Matt Porter 3 participants 15 messages Mar 11, 2014 – Mar 12, 2014

Subsystems (6)

v3 of 5 Applied Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 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 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 v3 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

PATCH v3 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
Acked-by on v3 2/5
#3 lore raw

Re: [PATCH v3 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

I have a tiny nit that 'ret' doesn't need to be initialised before use in probe(), but apart from that...

Looks pretty sensible:

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

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

Quoted 16 lines · Lee Jones
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
Quoted 5 lines

I have a tiny nit that 'ret' doesn't need to be initialised before use in probe(), but apart from that...

Looks pretty sensible:

Ok, thanks. When I get back in front of my desktop I'll send a v4 of just this patch to address that nit. Mark already applied the regulator driver from this series, will you be taking this through your tree? For that matter, I wonder if the binding would also go through your tree with this driver.

-Matt

#5 lore raw

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

Quoted 19 lines
Quoted 19 lines
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

I have a tiny nit that 'ret' doesn't need to be initialised before use in probe(), but apart from that...

Quoted 8 lines
Quoted 2 lines

Looks pretty sensible:

Ok, thanks. When I get back in front of my desktop I'll send a v4 of just this patch to address that nit. Mark already applied the regulator driver from this series, will you be taking this through your tree? For that matter, I wonder if the binding would also go through your tree with this driver.

At least the MFD portion and the DT binding doc will go through the MFD tree.

Are there any inter-patch dependencies in the set? If so, we should know about them so we can coordinate a sensible solution.

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

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

Quoted 28 lines · Lee Jones
Quoted 19 lines
Quoted 19 lines
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

I have a tiny nit that 'ret' doesn't need to be initialised before use in probe(), but apart from that...

Quoted 8 lines
Quoted 2 lines

Looks pretty sensible:

Ok, thanks. When I get back in front of my desktop I'll send a v4 of just this patch to address that nit. Mark already applied the regulator driver from this series, will you be taking this through your tree? For that matter, I wonder if the binding would also go through your tree with this driver.

Quoted 5 lines

At least the MFD portion and the DT binding doc will go through the MFD tree.

Are there any inter-patch dependencies in the set? If so, we should know about them so we can coordinate a sensible solution.

Yes, the regulator driver (3/5) that Mark applied is dependent on this patch...the regulator driver includes include/linux/mfd/bcm590xx.h.

-Matt

maintainer
#7 lore raw

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

Quoted 7 lines · Matt Porter
Quoted 2 lines · Lee Jones

Are there any inter-patch dependencies in the set? If so, we should know about them so we can coordinate a sensible solution.

Yes, the regulator driver (3/5) that Mark applied is dependent on this patch...the regulator driver includes include/linux/mfd/bcm590xx.h.

There's no actual dependency though - the regulator driver can only be
built if the MFD is enabled in Kconfig since it depends on it so until
the MFD is present in the tree it won't get built.
-------------- 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/d57ecd17/attachment.sig>

#8 lore raw

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

Quoted 6 lines · Mark Brown
Quoted 4 lines · Matt Porter
Quoted 2 lines · Lee Jones

Are there any inter-patch dependencies in the set? If so, we should know about them so we can coordinate a sensible solution.

Quoted 6 lines
Quoted 2 lines

Yes, the regulator driver (3/5) that Mark applied is dependent on this patch...the regulator driver includes include/linux/mfd/bcm590xx.h.

There's no actual dependency though - the regulator driver can only be built if the MFD is enabled in Kconfig since it depends on it so until the MFD is present in the tree it won't get built.

Oh, right. Lee, no dependencies then.

-Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140311/0d0fa461/attachment-0001.sig>

#9 lore raw

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

Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Are there any inter-patch dependencies in the set? If so, we should know about them so we can coordinate a sensible solution.

Yes, the regulator driver (3/5) that Mark applied is dependent on this patch...the regulator driver includes include/linux/mfd/bcm590xx.h.

There's no actual dependency though - the regulator driver can only be built if the MFD is enabled in Kconfig since it depends on it so until the MFD is present in the tree it won't get built.

Oh, right. Lee, no dependencies then.

Perfect, I'll just apply the MFD patch.

We still need the DT guys to look over your document, so nothing will be certain until a) we receive their Ack or b) enough time passes, so we will review it between ourselves.

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

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

In reply to Matt Porter
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

Applied, thanks.

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

PATCH v3 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
maintainer
#12 lore raw

Re: [PATCH v3 3/5] regulator: add bcm590xx regulator driver

Quoted 3 lines · 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.

Applied, thanks.
-------------- 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/20140311/f7b63f13/attachment.sig>

#13 lore raw

PATCH v3 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
#14 lore raw

PATCH v3 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