Skip to contentSkip to conversation

BCM59056 PMU regulator support

PATCH Superseded Matt Porter 2 participants 14 messages Feb 18, 2014 – Mar 11, 2014

Subsystems (6)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 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 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 |  49 +++
 arch/arm/boot/dts/bcm28155-ap.dts                  |  43 ++-
 arch/arm/boot/dts/bcm59056.dtsi                    | 162 ++++++++
 arch/arm/configs/bcm_defconfig                     |   7 +
 drivers/mfd/Kconfig                                |   8 +
 drivers/mfd/Makefile                               |   1 +
 drivers/mfd/bcm590xx.c                             |  86 +++++
 drivers/regulator/Kconfig                          |   8 +
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/bcm590xx-regulator.c             | 419 +++++++++++++++++++++
 include/linux/mfd/bcm590xx.h                       |  31 ++
 11 files changed, 814 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 v2 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 | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/bcm590xx.txt
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +49 -0
new file mode 100644
index 0000000..a4a8039
@@ -0,0 +1,49 @@
+-------------------------------
+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
+
+-----------------------
+BCM590xx PMU Regulators
+-----------------------
+
+Required properties:
+- compatible: "brcm,bcm59056-regs"
+
+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-compatible values for BCM59056 are:
+  	rfldo, camldo1, camldo2, simldo1, simlso2, 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>;
+		regs {
+			compatible = "brcm,bcm59056-regs";
+			regulators {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				rfldo_reg: regulator at 0 {
+					reg = <0>;
+					regulator-compatible = "rfldo";
+					regulator-min-microvolt = <1200000>;
+					regulator-max-microvolt = <3300000>;
+				};
+
+				...
+			};
+		};
+	};
Signature · 1 line
1.8.4
#4 lore raw

PATCH v2 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       | 86 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/bcm590xx.h | 31 ++++++++++++++++
 4 files changed, 126 insertions(+)
 create mode 100644 drivers/mfd/bcm590xx.c
 create mode 100644 include/linux/mfd/bcm590xx.h
drivers/mfd/Kconfig +8 -0
index 49bb445..eda60de 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
+	bool "Broadcom BCM590xx PMUs"
+	select MFD_CORE
+	select REGMAP_I2C
+	depends on I2C=y
+	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 +86 -0

86 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
#7 lore raw

PATCH v2 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 | 419 +++++++++++++++++++++++++++++++++
 3 files changed, 428 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 +419 -0

419 lines not on this page · raw message

Signature · 1 line
1.8.4
#10 lore raw

PATCH v2 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
#11 lore raw

PATCH v2 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 |  43 +++++++++-
 arch/arm/boot/dts/bcm59056.dtsi   | 162 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/bcm59056.dtsi
arch/arm/boot/dts/bcm28155-ap.dts +42 -1
index 5ff2382..28fe731 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,34 @@
 		status = "okay";
 	};
 };
+
+#include "bcm59056.dtsi"
+
+&pmu {
+	interrupts = <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>;
+	regs {
+		regulators {
+			camldo1_reg: regulator at 1 {
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+			};
+
+			sdldo_reg: regulator at 5 {
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+			};
+
+			usbldo_reg: regulator at 11 {
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			iosr1_reg: regulator at 14 {
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+			};
+		};
+	};
+};
arch/arm/boot/dts/bcm59056.dtsi new file +162 -0

162 lines not on this page · raw message

Signature · 1 line
1.8.4
maintainer
#12 lore raw

Re: [PATCH v2 5/5] ARM: dts: add bcm590xx pmu support and enable for bcm28155-ap

arch/arm/boot/dts/bcm59056.dtsi line 117

Quoted 6 lines · Matt Porter
arch/arm/boot/dts/bcm59056.dtsi new file +6 -0
+			csr_reg: regulator at 13 {
+				reg = <13>;
+				regulator-compatible = "csr";
+				regulator-min-microvolt = <860000>;
+				regulator-max-microvolt = <1440000>;
+			};

You should not be setting voltage ranges like this in a .dtsi - you've
no idea if these voltage ranges are in fact valid for any given board so
they can't be set safely. In general I would not expect to see any
configuration at all for regulators in an include file for the chip.
-------------- 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/20140219/0491f4d5/attachment.sig>

maintainer
#5 lore raw

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

In reply to Matt Porter

drivers/mfd/Kconfig config MFD_AAT2870_CORE · line 69

Quoted 8 lines · Matt Porter
drivers/mfd/Kconfig +8 -0
+config MFD_BCM590XX
+	bool "Broadcom BCM590xx PMUs"
+	select MFD_CORE
+	select REGMAP_I2C
+	depends on I2C=y
+	help
+	  Support for the BCM590xx PMUs from Broadcom
+

Why does this need to be built in?
-------------- 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/20140219/0fccb03f/attachment.sig>

maintainer
#2 lore raw

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

In reply to Matt Porter

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

Quoted 3 lines · Matt Porter
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +3 -0
+
+				rfldo_reg: regulator at 0 {
+					reg = <0>;

What do these reg values mean, they don't seem to be documented in the
binding?
-------------- 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/20140219/5424dd98/attachment-0001.sig>

maintainer
#8 lore raw

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

In reply to Matt Porter

drivers/regulator/bcm590xx-regulator.c line 404

Quoted 4 lines · Matt Porter
drivers/regulator/bcm590xx-regulator.c new file +4 -0
+static struct of_device_id bcm590xx_of_match[] = {
+	{ .compatible = "brcm,bcm59056-regs", },
+	{ }
+};

This looks pretty much OK however I am in general suspicious of MFDs that have subdevices like this in the DT - it doesn't seem like this is a reusable device which can appear anywhere else so you're pretty much just representing the way that Linux splits things up here rather than a reusable IP that can reasonably have a separate binding.

If you had a binding which did something like enumerate the individual
IP blocks as individual devices that'd be more interesting, I could see
for example that a different PMIC might have a different set of register
compatible regulator IPs laid out. It looks like that might be doable,
but it's in no way essential.
-------------- 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/20140219/3104d004/attachment-0001.sig>

#9 lore raw

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

Quoted 13 lines · Mark Brown

drivers/regulator/bcm590xx-regulator.c line 404

Quoted 4 lines · Matt Porter
drivers/regulator/bcm590xx-regulator.c new file +4 -0
+static struct of_device_id bcm590xx_of_match[] = {
+	{ .compatible = "brcm,bcm59056-regs", },
+	{ }
+};

This looks pretty much OK however I am in general suspicious of MFDs that have subdevices like this in the DT - it doesn't seem like this is a reusable device which can appear anywhere else so you're pretty much just representing the way that Linux splits things up here rather than a reusable IP that can reasonably have a separate binding.

Quoted 5 lines

If you had a binding which did something like enumerate the individual IP blocks as individual devices that'd be more interesting, I could see for example that a different PMIC might have a different set of register compatible regulator IPs laid out. It looks like that might be doable, but it's in no way essential.

Ok I dropped this for v3 in favor of using mfd_add_device() and having the regulator driver reference the of_node from the parent device.

-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/da50f352/attachment.sig>

#3 lore raw

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

In reply to Mark Brown
Quoted 8 lines · Mark Brown

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

Quoted 3 lines · Matt Porter
Documentation/devicetree/bindings/mfd/bcm590xx.txt new file +3 -0
+
+				rfldo_reg: regulator at 0 {
+					reg = <0>;

What do these reg values mean, they don't seem to be documented in the binding?

Dropped this and the deprecated regulator-compatible property in v3 in favor of using node name matching.

-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/28baf18b/attachment.sig>

#6 lore raw

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

In reply to Mark Brown
Quoted 12 lines · Mark Brown

drivers/mfd/Kconfig config MFD_AAT2870_CORE · line 69

Quoted 8 lines · Matt Porter
drivers/mfd/Kconfig +8 -0
+config MFD_BCM590XX
+	bool "Broadcom BCM590xx PMUs"
+	select MFD_CORE
+	select REGMAP_I2C
+	depends on I2C=y
+	help
+	  Support for the BCM590xx PMUs from Broadcom
+

Why does this need to be built in?

It doesn't. Just an oversight now fixed in v3.

-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/406757c6/attachment.sig>

#13 lore raw

Re: [PATCH v2 5/5] ARM: dts: add bcm590xx pmu support and enable for bcm28155-ap

In reply to Mark Brown
Quoted 14 lines · Mark Brown

arch/arm/boot/dts/bcm59056.dtsi line 117

Quoted 6 lines · Matt Porter
arch/arm/boot/dts/bcm59056.dtsi new file +6 -0
+			csr_reg: regulator at 13 {
+				reg = <13>;
+				regulator-compatible = "csr";
+				regulator-min-microvolt = <860000>;
+				regulator-max-microvolt = <1440000>;
+			};

You should not be setting voltage ranges like this in a .dtsi - you've no idea if these voltage ranges are in fact valid for any given board so they can't be set safely. In general I would not expect to see any configuration at all for regulators in an include file for the chip.

Agreed. I moved all constraints where they belong in the board-specific dts.

Thanks,
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/cc0408bb/attachment.sig>