All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v1 0/2] support for ROHM BD71827 and BD71847 PMICs
@ 2019-04-08 10:26 Matti Vaittinen
  2019-04-08 10:28 ` [U-Boot] [PATCH v1 1/2] regulator: bd71837: copy the bd71837 pmic driver from NXP imx u-boot Matti Vaittinen
  2019-04-08 10:30 ` [U-Boot] [PATCH v1 2/2] regulator: bd718x7: support ROHM BD71837 and BD71847 PMICs Matti Vaittinen
  0 siblings, 2 replies; 5+ messages in thread
From: Matti Vaittinen @ 2019-04-08 10:26 UTC (permalink / raw)
  To: u-boot

Patch series to support for ROHM BD71827 and BD71847 PMICs.

ROHM BD71837 and BD71847 is PMIC intended for powering single-core,
dual-core, and quad-core SoC’s such as NXP-i.MX 8M. BD71847 is used
for example on NXP imx8mm EVK.

Series adds PMIC driver with register read and write support, and
regulator driver with enable/disable and voltage changing support
with certain limitations:
- Enable/Disable state control is by default only allowed for BD71837
  bucks 3 and 4. This is due to a HW feature which leaves SW
  controlled power rails unpowered after reset which leads to SNVS
  state.
- Voltage control for enabled regulator is only allowed for "DVS"
  regulators (bucks 1-4 on BD71837, bucks 1 and 2 on BD71847). This
  is done because changing voltage on other regulators may cause
  under-/over shoot when regulator is enabled.

Drivers expect to see PMIC node with proper regulator sub-nodes given
from device tree but.

Driver is tested using BD71837 and BD71847 break-out board connected
to Beagle Bone Black and device-tree entry which was created as
desctibed in dt-binding document for BD718x7 shipped with Linux.

This patch series does not support DT properties which allow changing
the reset target between SNVS and READY or identifying boot-critical
regulators and disabling SW control based on reset target as the
Linux driver does.

Changelog v1:
- This version is created based on the RFC v1.
  https://lists.denx.de/pipermail/u-boot/2019-March/363076.html
  https://lists.denx.de/pipermail/u-boot/2019-March/363077.html
- Support BD71847.
- Unlock the PMIC protection register

Patch 1:
- Cherry picks the initial PMIC driver for BD71837 from NXP's i.MX
  repository at: https://source.codeaurora.org/external/imx/uboot-imx
  (commits e9a3bec2e95a and acdc5c297a96). Fixes checkpatch issues.

Patch 2:
- Support BD71847 PMIC.
- Add support for BD71837 and BD71847 regulators.

---

Matti Vaittinen (2):
  regulator: bd71837: copy the bd71837 pmic driver from NXP imx u-boot
  regulator: bd718x7: support ROHM BD71837 and BD71847 PMICs

 drivers/power/pmic/Kconfig        |   7 +
 drivers/power/pmic/Makefile       |   2 +
 drivers/power/pmic/bd71837.c      | 121 ++++++++
 drivers/power/pmic/pmic_bd71837.c |  31 ++
 drivers/power/regulator/Kconfig   |  15 +
 drivers/power/regulator/Makefile  |   1 +
 drivers/power/regulator/bd71837.c | 457 ++++++++++++++++++++++++++++++
 include/power/bd71837.h           | 105 +++++++
 8 files changed, 739 insertions(+)
 create mode 100644 drivers/power/pmic/bd71837.c
 create mode 100644 drivers/power/pmic/pmic_bd71837.c
 create mode 100644 drivers/power/regulator/bd71837.c
 create mode 100644 include/power/bd71837.h

-- 
2.17.2


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v1 1/2] regulator: bd71837: copy the bd71837 pmic driver from NXP imx u-boot
  2019-04-08 10:26 [U-Boot] [PATCH v1 0/2] support for ROHM BD71827 and BD71847 PMICs Matti Vaittinen
@ 2019-04-08 10:28 ` Matti Vaittinen
  2019-04-24  3:54   ` Simon Glass
  2019-04-08 10:30 ` [U-Boot] [PATCH v1 2/2] regulator: bd718x7: support ROHM BD71837 and BD71847 PMICs Matti Vaittinen
  1 sibling, 1 reply; 5+ messages in thread
From: Matti Vaittinen @ 2019-04-08 10:28 UTC (permalink / raw)
  To: u-boot

https://source.codeaurora.org/external/imx/uboot-imx

cherry picked, styled and merged commits:
- MLK-18387 pmic: Add pmic driver for BD71837: e9a3bec2e95a
- MLK-18590 pmic: bd71837: Change to use new fdt API: acdc5c297a96

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
---

Based on RFC:
https://lists.denx.de/pipermail/u-boot/2019-March/363076.html

 drivers/power/pmic/Kconfig        |  7 +++
 drivers/power/pmic/Makefile       |  2 +
 drivers/power/pmic/bd71837.c      | 89 +++++++++++++++++++++++++++++++
 drivers/power/pmic/pmic_bd71837.c | 31 +++++++++++
 include/power/bd71837.h           | 64 ++++++++++++++++++++++
 5 files changed, 193 insertions(+)
 create mode 100644 drivers/power/pmic/bd71837.c
 create mode 100644 drivers/power/pmic/pmic_bd71837.c
 create mode 100644 include/power/bd71837.h

diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index 8cf60ebcf3..e154d0a57b 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -48,6 +48,13 @@ config PMIC_AS3722
 	  interface and is designs to cover most of the power managementment
 	  required for a tablets or laptop.
 
+config DM_PMIC_BD71837
+ 	bool "Enable Driver Model for PMIC BD71837"
+ 	depends on DM_PMIC
+ 	help
+	  This config enables implementation of driver-model pmic uclass features
+	  for PMIC BD71837. The driver implements read/write operations.
+
 config DM_PMIC_FAN53555
 	bool "Enable support for OnSemi FAN53555"
 	depends on DM_PMIC && DM_REGULATOR && DM_I2C
diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
index 637352ab2b..e74c6190a8 100644
--- a/drivers/power/pmic/Makefile
+++ b/drivers/power/pmic/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_DM_PMIC_FAN53555) += fan53555.o
 obj-$(CONFIG_DM_PMIC_MAX77686) += max77686.o
 obj-$(CONFIG_DM_PMIC_MAX8998) += max8998.o
 obj-$(CONFIG_DM_PMIC_MC34708) += mc34708.o
+obj-$(CONFIG_$(SPL_)DM_PMIC_BD71837) += bd71837.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_PFUZE100) += pfuze100.o
 obj-$(CONFIG_PMIC_S2MPS11) += s2mps11.o
 obj-$(CONFIG_DM_PMIC_SANDBOX) += sandbox.o i2c_pmic_emul.o
@@ -30,6 +31,7 @@ obj-$(CONFIG_POWER_MAX77696) += pmic_max77696.o
 obj-$(CONFIG_POWER_MAX8998) += pmic_max8998.o
 obj-$(CONFIG_POWER_MAX8997) += pmic_max8997.o
 obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
+obj-$(CONFIG_POWER_BD71837) += pmic_bd71837.o
 obj-$(CONFIG_POWER_PFUZE100) += pmic_pfuze100.o
 obj-$(CONFIG_POWER_PFUZE3000) += pmic_pfuze3000.o
 obj-$(CONFIG_POWER_TPS65217) += pmic_tps65217.o
diff --git a/drivers/power/pmic/bd71837.c b/drivers/power/pmic/bd71837.c
new file mode 100644
index 0000000000..eadf373a18
--- /dev/null
+++ b/drivers/power/pmic/bd71837.c
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier:      GPL-2.0+
+//
+// Copyright 2018 NXP  *
+
+#include <common.h>
+#include <fdtdec.h>
+#include <errno.h>
+#include <dm.h>
+#include <i2c.h>
+#include <power/pmic.h>
+#include <power/regulator.h>
+#include <power/bd71837.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static const struct pmic_child_info pmic_children_info[] = {
+	/* buck */
+	{ .prefix = "b", .driver = BD71837_REGULATOR_DRIVER},
+	/* ldo */
+	{ .prefix = "l", .driver = BD71837_REGULATOR_DRIVER},
+	{ },
+};
+
+static int bd71837_reg_count(struct udevice *dev)
+{
+	return BD71837_REG_NUM;
+}
+
+static int bd71837_write(struct udevice *dev, uint reg, const uint8_t *buff,
+			 int len)
+{
+	if (dm_i2c_write(dev, reg, buff, len)) {
+		pr_err("write error to device: %p register: %#x!", dev, reg);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int bd71837_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
+{
+	if (dm_i2c_read(dev, reg, buff, len)) {
+		pr_err("read error from device: %p register: %#x!", dev, reg);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int bd71837_bind(struct udevice *dev)
+{
+	int children;
+	ofnode regulators_node;
+
+	regulators_node = dev_read_subnode(dev, "regulators");
+	if (!ofnode_valid(regulators_node)) {
+		debug("%s: %s regulators subnode not found!", __func__,
+		      dev->name);
+		return -ENXIO;
+	}
+
+	debug("%s: '%s' - found regulators subnode\n", __func__, dev->name);
+
+	children = pmic_bind_children(dev, regulators_node, pmic_children_info);
+	if (!children)
+		debug("%s: %s - no child found\n", __func__, dev->name);
+
+	/* Always return success for this device */
+	return 0;
+}
+
+static struct dm_pmic_ops bd71837_ops = {
+	.reg_count = bd71837_reg_count,
+	.read = bd71837_read,
+	.write = bd71837_write,
+};
+
+static const struct udevice_id bd71837_ids[] = {
+	{ .compatible = "rohm,bd71837", .data = 0x4b, },
+	{ }
+};
+
+U_BOOT_DRIVER(pmic_bd71837) = {
+	.name = "bd71837 pmic",
+	.id = UCLASS_PMIC,
+	.of_match = bd71837_ids,
+	.bind = bd71837_bind,
+	.ops = &bd71837_ops,
+};
diff --git a/drivers/power/pmic/pmic_bd71837.c b/drivers/power/pmic/pmic_bd71837.c
new file mode 100644
index 0000000000..3bb8db4081
--- /dev/null
+++ b/drivers/power/pmic/pmic_bd71837.c
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier:      GPL-2.0+
+//
+// Copyright (C) 2014 Gateworks Corporation
+//
+// Tim Harvey <tharvey@gateworks.com>
+
+#include <common.h>
+#include <errno.h>
+#include <i2c.h>
+#include <power/pmic.h>
+#include <power/bd71837.h>
+
+static const char bd71837_name[] = "BD71837";
+int power_bd71837_init(unsigned char bus)
+{
+	struct pmic *p = pmic_alloc();
+
+	if (!p) {
+		printf("%s: POWER allocation error!\n", __func__);
+		return -ENOMEM;
+	}
+
+	p->name = bd71837_name;
+	p->interface = PMIC_I2C;
+	p->number_of_regs = BD71837_REG_NUM;
+	p->hw.i2c.addr = 0x4b;
+	p->hw.i2c.tx_num = 1;
+	p->bus = bus;
+
+	return 0;
+}
diff --git a/include/power/bd71837.h b/include/power/bd71837.h
new file mode 100644
index 0000000000..9c74f6fc61
--- /dev/null
+++ b/include/power/bd71837.h
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* Copyright (C) 2018 ROHM Semiconductors */
+
+#ifndef BD71837_H_
+#define BD71837_H_
+
+#define BD71837_REGULATOR_DRIVER "bd71837_regulator"
+
+enum {
+	BD71837_REV		= 0x00,
+	BD71837_SWRESET		= 0x01,
+	BD71837_I2C_DEV		= 0x02,
+	BD71837_PWRCTRL0	= 0x03,
+	BD71837_PWRCTRL1	= 0x04,
+	BD71837_BUCK1_CTRL	= 0x05,
+	BD71837_BUCK2_CTRL	= 0x06,
+	BD71837_BUCK3_CTRL	= 0x07,
+	BD71837_BUCK4_CTRL	= 0x08,
+	BD71837_BUCK5_CTRL	= 0x09,
+	BD71837_BUCK6_CTRL	= 0x0A,
+	BD71837_BUCK7_CTRL	= 0x0B,
+	BD71837_BUCK8_CTRL	= 0x0C,
+	BD71837_BUCK1_VOLT_RUN	= 0x0D,
+	BD71837_BUCK1_VOLT_IDLE	= 0x0E,
+	BD71837_BUCK1_VOLT_SUSP	= 0x0F,
+	BD71837_BUCK2_VOLT_RUN	= 0x10,
+	BD71837_BUCK2_VOLT_IDLE	= 0x11,
+	BD71837_BUCK3_VOLT_RUN	= 0x12,
+	BD71837_BUCK4_VOLT_RUN	= 0x13,
+	BD71837_BUCK5_VOLT	= 0x14,
+	BD71837_BUCK6_VOLT	= 0x15,
+	BD71837_BUCK7_VOLT	= 0x16,
+	BD71837_BUCK8_VOLT	= 0x17,
+	BD71837_LDO1_VOLT	= 0x18,
+	BD71837_LDO2_VOLT	= 0x19,
+	BD71837_LDO3_VOLT	= 0x1A,
+	BD71837_LDO4_VOLT	= 0x1B,
+	BD71837_LDO5_VOLT	= 0x1C,
+	BD71837_LDO6_VOLT	= 0x1D,
+	BD71837_LDO7_VOLT	= 0x1E,
+	BD71837_TRANS_COND0	= 0x1F,
+	BD71837_TRANS_COND1	= 0x20,
+	BD71837_VRFAULTEN	= 0x21,
+	BD71837_MVRFLTMASK0	= 0x22,
+	BD71837_MVRFLTMASK1	= 0x23,
+	BD71837_MVRFLTMASK2	= 0x24,
+	BD71837_RCVCFG		= 0x25,
+	BD71837_RCVNUM		= 0x26,
+	BD71837_PWRONCONFIG0	= 0x27,
+	BD71837_PWRONCONFIG1	= 0x28,
+	BD71837_RESETSRC	= 0x29,
+	BD71837_MIRQ		= 0x2A,
+	BD71837_IRQ		= 0x2B,
+	BD71837_IN_MON		= 0x2C,
+	BD71837_POW_STATE	= 0x2D,
+	BD71837_OUT32K		= 0x2E,
+	BD71837_REGLOCK		= 0x2F,
+	BD71837_MUXSW_EN	= 0x30,
+	BD71837_REG_NUM,
+};
+
+int power_bd71837_init(unsigned char bus);
+
+#endif
-- 
2.17.2


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v1 2/2] regulator: bd718x7: support ROHM BD71837 and BD71847 PMICs
  2019-04-08 10:26 [U-Boot] [PATCH v1 0/2] support for ROHM BD71827 and BD71847 PMICs Matti Vaittinen
  2019-04-08 10:28 ` [U-Boot] [PATCH v1 1/2] regulator: bd71837: copy the bd71837 pmic driver from NXP imx u-boot Matti Vaittinen
@ 2019-04-08 10:30 ` Matti Vaittinen
  1 sibling, 0 replies; 5+ messages in thread
From: Matti Vaittinen @ 2019-04-08 10:30 UTC (permalink / raw)
  To: u-boot

BD71837 and BD71847 is PMIC intended for powering single-core,
dual-core, and quad-core SoC’s such as NXP-i.MX 8M. BD71847
is used for example on NXP imx8mm EVK.

Add regulator driver for ROHM BD71837 and BD71847 PMICs.
BD71837 contains 8 bucks and 7 LDOS. BD71847 is reduced
version containing 6 bucks and 6 LDOs. Voltages for DVS
bucks (1-4 on BD71837, 1 and 2 on BD71847) can be adjusted
when regulators are enabled. For other bucks and LDOs we may
have over- or undershooting if voltage is adjusted when
regulator is enabled. Thus this is prevented by default.

BD718x7 has a quirk which may leave power output disabled
after reset if enable/disable state was controlled by SW.
Thus the SW control is only allowed for BD71837  bucks
3 and 4 by default. The impact of this limitation must be
evaluated board-by board and restrictions may need to be
modified. (Linux driver get's these limitations from DT and we
may want to implement same on u-Boot driver).

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>

---

Changelog v1:
  This version is created based on the RFC v1.
  https://lists.denx.de/pipermail/u-boot/2019-March/363077.html
  Additionally
- Support BD71847.
- Unlock the PMIC protection register

 drivers/power/pmic/bd71837.c      |  42 ++-
 drivers/power/regulator/Kconfig   |  15 +
 drivers/power/regulator/Makefile  |   1 +
 drivers/power/regulator/bd71837.c | 457 ++++++++++++++++++++++++++++++
 include/power/bd71837.h           | 147 ++++++----
 5 files changed, 604 insertions(+), 58 deletions(-)
 create mode 100644 drivers/power/regulator/bd71837.c

diff --git a/drivers/power/pmic/bd71837.c b/drivers/power/pmic/bd71837.c
index eadf373a18..babddcba60 100644
--- a/drivers/power/pmic/bd71837.c
+++ b/drivers/power/pmic/bd71837.c
@@ -2,6 +2,8 @@
 //
 // Copyright 2018 NXP  *
 
+#define DEBUG
+
 #include <common.h>
 #include <fdtdec.h>
 #include <errno.h>
@@ -15,15 +17,15 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static const struct pmic_child_info pmic_children_info[] = {
 	/* buck */
-	{ .prefix = "b", .driver = BD71837_REGULATOR_DRIVER},
+	{ .prefix = "b", .driver = BD718XX_REGULATOR_DRIVER},
 	/* ldo */
-	{ .prefix = "l", .driver = BD71837_REGULATOR_DRIVER},
+	{ .prefix = "l", .driver = BD718XX_REGULATOR_DRIVER},
 	{ },
 };
 
 static int bd71837_reg_count(struct udevice *dev)
 {
-	return BD71837_REG_NUM;
+	return BD718XX_MAX_REGISTER - 1;
 }
 
 static int bd71837_write(struct udevice *dev, uint reg, const uint8_t *buff,
@@ -54,7 +56,7 @@ static int bd71837_bind(struct udevice *dev)
 
 	regulators_node = dev_read_subnode(dev, "regulators");
 	if (!ofnode_valid(regulators_node)) {
-		debug("%s: %s regulators subnode not found!", __func__,
+		debug("%s: %s regulators subnode not found!\n", __func__,
 		      dev->name);
 		return -ENXIO;
 	}
@@ -69,6 +71,34 @@ static int bd71837_bind(struct udevice *dev)
 	return 0;
 }
 
+static int bd718x7_probe(struct udevice *dev)
+{
+	int ret;
+	u8 unlock;
+
+	/* Unlock the PMIC regulator control before probing the children */
+	ret = pmic_reg_read(dev, BD718XX_REGLOCK);
+	if (ret < 0) {
+		debug("%s: %s Failed to read lock register, error %d\n",
+		      __func__, dev->name, ret);
+		return ret;
+	}
+
+	unlock = ret;
+	unlock &= ~(BD718XX_REGLOCK_PWRSEQ | BD718XX_REGLOCK_VREG);
+
+	ret = pmic_reg_write(dev, BD718XX_REGLOCK, unlock);
+	if (ret) {
+		debug("%s: %s Failed to unlock regulator control\n", __func__,
+		      dev->name);
+		return ret;
+	}
+	debug("%s: '%s' - BD718x7 PMIC register unlocked\n", __func__,
+	      dev->name);
+
+	return 0;
+}
+
 static struct dm_pmic_ops bd71837_ops = {
 	.reg_count = bd71837_reg_count,
 	.read = bd71837_read,
@@ -76,7 +106,8 @@ static struct dm_pmic_ops bd71837_ops = {
 };
 
 static const struct udevice_id bd71837_ids[] = {
-	{ .compatible = "rohm,bd71837", .data = 0x4b, },
+	{ .compatible = "rohm,bd71837", .data = ROHM_CHIP_TYPE_BD71837, },
+	{ .compatible = "rohm,bd71847", .data = ROHM_CHIP_TYPE_BD71847, },
 	{ }
 };
 
@@ -85,5 +116,6 @@ U_BOOT_DRIVER(pmic_bd71837) = {
 	.id = UCLASS_PMIC,
 	.of_match = bd71837_ids,
 	.bind = bd71837_bind,
+	.probe = bd718x7_probe,
 	.ops = &bd71837_ops,
 };
diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index 3ed0dd2264..323516587c 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -43,6 +43,21 @@ config REGULATOR_AS3722
 	  but does not yet support change voltages. Currently this must be
 	  done using direct register writes to the PMIC.
 
+config DM_REGULATOR_BD71837
+	bool "Enable Driver Model for REGULATOR BD71837"
+	depends on DM_REGULATOR && DM_PMIC_BD71837
+	help
+	This config enables implementation of driver-model regulator uclass
+	features for REGULATOR BD71837. The driver implements get/set api for:
+	value and enable.
+
+config SPL_DM_REGULATOR_BD71837
+	bool "Enable Driver Model for REGULATOR BD71837 in SPL"
+	depends on DM_REGULATOR_BD71837
+	help
+	This config enables implementation of driver-model regulator uclass
+	features for REGULATOR BD71837 in SPL.
+
 config DM_REGULATOR_PFUZE100
 	bool "Enable Driver Model for REGULATOR PFUZE100"
 	depends on DM_REGULATOR && DM_PMIC_PFUZE100
diff --git a/drivers/power/regulator/Makefile b/drivers/power/regulator/Makefile
index f617ce723a..898ed5f084 100644
--- a/drivers/power/regulator/Makefile
+++ b/drivers/power/regulator/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_REGULATOR_ACT8846) += act8846.o
 obj-$(CONFIG_REGULATOR_AS3722)	+= as3722_regulator.o
 obj-$(CONFIG_DM_REGULATOR_MAX77686) += max77686.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_PFUZE100) += pfuze100.o
+obj-$(CONFIG_$(SPL_)DM_REGULATOR_BD71837) += bd71837.o
 obj-$(CONFIG_$(SPL_)REGULATOR_PWM) += pwm_regulator.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR_FAN53555) += fan53555.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR_FIXED) += fixed.o
diff --git a/drivers/power/regulator/bd71837.c b/drivers/power/regulator/bd71837.c
new file mode 100644
index 0000000000..c320a1dc4e
--- /dev/null
+++ b/drivers/power/regulator/bd71837.c
@@ -0,0 +1,457 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+//
+// Copyright (C) 2019 ROHM Semiconductors
+//
+// ROHM BD71837 regulator driver
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <i2c.h>
+#include <power/pmic.h>
+#include <power/regulator.h>
+#include <power/bd71837.h>
+
+#define HW_STATE_CONTROL 0
+#define DEBUG
+
+struct bd71837_vrange {
+	unsigned int	min_volt;
+	unsigned int	step;
+	u8		min_sel;
+	u8		max_sel;
+	u8		rangeval;
+};
+
+struct bd71837_data {
+	const char		*name;
+	u8			enable_reg;
+	u8			enablemask;
+	u8			volt_reg;
+	u8			volt_mask;
+	struct bd71837_vrange	*ranges;
+	unsigned int		numranges;
+	u8			rangemask;
+	u8			sel_mask;
+	bool			dvs;
+};
+
+#define BD_RANGE(_min, _vstep, _sel_low, _sel_hi, _range_sel) \
+{ \
+	.min_volt = (_min), .step = (_vstep), .min_sel = (_sel_low), \
+	.max_sel = (_sel_hi), .rangeval = (_range_sel) \
+}
+
+#define BD_DATA(_name, enreg, enmask, vreg, vmask, _range, rmask, _dvs, sel) \
+{ \
+	.name = (_name), .enable_reg = (enreg), .enablemask = (enmask), \
+	.volt_reg = (vreg), .volt_mask = (vmask), .ranges = (_range), \
+	.numranges = ARRAY_SIZE(_range), .rangemask = (rmask), .dvs = (_dvs), \
+	.sel_mask = (sel) \
+}
+
+static struct bd71837_vrange dvs_buck_vranges[] = {
+	BD_RANGE(700000, 10000, 0, 0x3C, 0),
+	BD_RANGE(1300000, 0, 0x3D, 0x3F, 0),
+};
+
+static struct bd71837_vrange bd71847_buck3_vranges[] = {
+	BD_RANGE(700000, 100000, 0x00, 0x03, 0),
+	BD_RANGE(1050000, 50000, 0x04, 0x05, 0),
+	BD_RANGE(1200000, 150000, 0x06, 0x07, 0),
+	BD_RANGE(550000, 50000, 0x0, 0x7, 0x40),
+	BD_RANGE(675000, 100000, 0x0, 0x3, 0x80),
+	BD_RANGE(1025000, 50000, 0x4, 0x5, 0x80),
+	BD_RANGE(1175000, 150000, 0x6, 0x7, 0x80),
+};
+
+static struct bd71837_vrange bd71847_buck4_vranges[] = {
+	BD_RANGE(3000000, 100000, 0x00, 0x03, 0),
+	BD_RANGE(2600000, 100000, 0x00, 0x03, 40),
+};
+
+static struct bd71837_vrange bd71837_buck5_vranges[] = {
+	BD_RANGE(700000, 100000, 0, 0x3, 0),
+	BD_RANGE(1050000, 50000, 0x04, 0x05, 0),
+	BD_RANGE(1200000, 150000, 0x06, 0x07, 0),
+	BD_RANGE(675000, 100000, 0x0, 0x3, 0x80),
+	BD_RANGE(1025000, 50000, 0x04, 0x05, 0x80),
+	BD_RANGE(1175000, 150000, 0x06, 0x07, 0x80),
+};
+
+static struct bd71837_vrange bd71837_buck6_vranges[] = {
+	BD_RANGE(3000000, 100000, 0x00, 0x03, 0),
+};
+
+static struct bd71837_vrange nodvs_buck3_vranges[] = {
+	BD_RANGE(1605000, 90000, 0, 1, 0),
+	BD_RANGE(1755000, 45000, 2, 4, 0),
+	BD_RANGE(1905000, 45000, 5, 7, 0),
+};
+
+static struct bd71837_vrange nodvs_buck4_vranges[] = {
+	BD_RANGE(800000, 10000, 0x00, 0x3C, 0),
+};
+
+static struct bd71837_vrange ldo1_vranges[] = {
+	BD_RANGE(3000000, 100000, 0x00, 0x03, 0),
+	BD_RANGE(1600000, 100000, 0x00, 0x03, 0x20),
+};
+
+static struct bd71837_vrange ldo2_vranges[] = {
+	BD_RANGE(900000, 0, 0, 0, 0),
+	BD_RANGE(800000, 0, 1, 1, 0),
+};
+
+static struct bd71837_vrange ldo3_vranges[] = {
+	BD_RANGE(1800000, 100000, 0x00, 0x0F, 0),
+};
+
+static struct bd71837_vrange ldo4_vranges[] = {
+	BD_RANGE(900000, 100000, 0x00, 0x09, 0),
+};
+
+static struct bd71837_vrange bd71837_ldo5_vranges[] = {
+	BD_RANGE(1800000, 100000, 0x00, 0x0F, 0),
+};
+
+static struct bd71837_vrange bd71847_ldo5_vranges[] = {
+	BD_RANGE(1800000, 100000, 0x00, 0x0F, 0),
+	BD_RANGE(800000, 100000, 0x00, 0x0F, 0x20),
+};
+
+static struct bd71837_vrange ldo6_vranges[] = {
+	BD_RANGE(900000, 100000, 0x00, 0x09, 0),
+};
+
+static struct bd71837_vrange ldo7_vranges[] = {
+	BD_RANGE(1800000, 100000, 0x00, 0x0F, 0),
+};
+
+/* We use enable mask 'HW_STATE_CONTROL' to indicate that this regulator
+ * must not be enabled or disabled by SW. The typical use-case for BD71837
+ * is powering NXP i.MX8. In this use-case we (for now) only allow control
+ * for BUCK3 and BUCK4 which are not boot critical.
+ */
+static struct bd71837_data bd71837_reg_data[] = {
+/* Bucks 1-4 which support dynamic voltage scaling */
+	BD_DATA("BUCK1", BD718XX_BUCK1_CTRL, HW_STATE_CONTROL,
+		BD718XX_BUCK1_VOLT_RUN, DVS_BUCK_RUN_MASK, dvs_buck_vranges, 0,
+		true, BD718XX_BUCK_SEL),
+	BD_DATA("BUCK2", BD718XX_BUCK2_CTRL, HW_STATE_CONTROL,
+		BD718XX_BUCK2_VOLT_RUN, DVS_BUCK_RUN_MASK, dvs_buck_vranges, 0,
+		true, BD718XX_BUCK_SEL),
+	BD_DATA("BUCK3", BD71837_BUCK3_CTRL, BD718XX_BUCK_EN,
+		BD71837_BUCK3_VOLT_RUN, DVS_BUCK_RUN_MASK, dvs_buck_vranges, 0,
+		true, BD718XX_BUCK_SEL),
+	BD_DATA("BUCK4", BD71837_BUCK4_CTRL, BD718XX_BUCK_EN,
+		BD71837_BUCK4_VOLT_RUN, DVS_BUCK_RUN_MASK, dvs_buck_vranges, 0,
+		true, BD718XX_BUCK_SEL),
+/* Bucks 5-8 which do not support dynamic voltage scaling */
+	BD_DATA("BUCK5", BD718XX_1ST_NODVS_BUCK_CTRL, HW_STATE_CONTROL,
+		BD718XX_1ST_NODVS_BUCK_VOLT, BD718XX_1ST_NODVS_BUCK_MASK,
+		bd71837_buck5_vranges, 0x80, false, BD718XX_BUCK_SEL),
+	BD_DATA("BUCK6", BD718XX_2ND_NODVS_BUCK_CTRL, HW_STATE_CONTROL,
+		BD718XX_2ND_NODVS_BUCK_VOLT, BD71837_BUCK6_MASK,
+		bd71837_buck6_vranges, 0, false, BD718XX_BUCK_SEL),
+	BD_DATA("BUCK7", BD718XX_3RD_NODVS_BUCK_CTRL, HW_STATE_CONTROL,
+		BD718XX_3RD_NODVS_BUCK_VOLT, BD718XX_3RD_NODVS_BUCK_MASK,
+		nodvs_buck3_vranges, 0, false, BD718XX_BUCK_SEL),
+	BD_DATA("BUCK8", BD718XX_4TH_NODVS_BUCK_CTRL, HW_STATE_CONTROL,
+		BD718XX_4TH_NODVS_BUCK_VOLT, BD718XX_4TH_NODVS_BUCK_MASK,
+		nodvs_buck4_vranges, 0, false, BD718XX_BUCK_SEL),
+/* LDOs */
+	BD_DATA("LDO1", BD718XX_LDO1_VOLT, HW_STATE_CONTROL, BD718XX_LDO1_VOLT,
+		BD718XX_LDO1_MASK, ldo1_vranges, 0x20, false, BD718XX_LDO_SEL),
+	BD_DATA("LDO2", BD718XX_LDO2_VOLT, HW_STATE_CONTROL, BD718XX_LDO2_VOLT,
+		BD718XX_LDO2_MASK, ldo2_vranges, 0, false, BD718XX_LDO_SEL),
+	BD_DATA("LDO3", BD718XX_LDO3_VOLT, HW_STATE_CONTROL, BD718XX_LDO3_VOLT,
+		BD718XX_LDO3_MASK, ldo3_vranges, 0, false, BD718XX_LDO_SEL),
+	BD_DATA("LDO4", BD718XX_LDO4_VOLT, HW_STATE_CONTROL, BD718XX_LDO4_VOLT,
+		BD718XX_LDO4_MASK, ldo4_vranges, 0, false, BD718XX_LDO_SEL),
+	BD_DATA("LDO5", BD718XX_LDO5_VOLT, HW_STATE_CONTROL, BD718XX_LDO5_VOLT,
+		BD71837_LDO5_MASK, bd71837_ldo5_vranges, 0, false,
+		BD718XX_LDO_SEL),
+	BD_DATA("LDO6", BD718XX_LDO6_VOLT, HW_STATE_CONTROL, BD718XX_LDO6_VOLT,
+		BD718XX_LDO6_MASK, ldo6_vranges, 0, false, BD718XX_LDO_SEL),
+	BD_DATA("LDO7", BD71837_LDO7_VOLT, HW_STATE_CONTROL, BD71837_LDO7_VOLT,
+		BD71837_LDO7_MASK, ldo7_vranges, 0, false, BD718XX_LDO_SEL),
+};
+
+static struct bd71837_data bd71847_reg_data[] = {
+/* Bucks 1 and 2 which support dynamic voltage scaling */
+	BD_DATA("BUCK1", BD718XX_BUCK1_CTRL, HW_STATE_CONTROL,
+		BD718XX_BUCK1_VOLT_RUN, DVS_BUCK_RUN_MASK, dvs_buck_vranges, 0,
+		true, BD718XX_BUCK_SEL),
+	BD_DATA("BUCK2", BD718XX_BUCK2_CTRL, HW_STATE_CONTROL,
+		BD718XX_BUCK2_VOLT_RUN, DVS_BUCK_RUN_MASK, dvs_buck_vranges, 0,
+		true, BD718XX_BUCK_SEL),
+/* Bucks 3-6 which do not support dynamic voltage scaling */
+	BD_DATA("BUCK3", BD718XX_1ST_NODVS_BUCK_CTRL, HW_STATE_CONTROL,
+		BD718XX_1ST_NODVS_BUCK_VOLT, BD718XX_1ST_NODVS_BUCK_MASK,
+		bd71847_buck3_vranges, 0xC0, false, BD718XX_BUCK_SEL),
+	BD_DATA("BUCK4", BD718XX_2ND_NODVS_BUCK_CTRL, HW_STATE_CONTROL,
+		BD718XX_2ND_NODVS_BUCK_VOLT, BD71837_BUCK6_MASK,
+		bd71847_buck4_vranges, 0x40, false, BD718XX_BUCK_SEL),
+	BD_DATA("BUCK5", BD718XX_3RD_NODVS_BUCK_CTRL, HW_STATE_CONTROL,
+		BD718XX_3RD_NODVS_BUCK_VOLT, BD718XX_3RD_NODVS_BUCK_MASK,
+		nodvs_buck3_vranges, 0, false, BD718XX_BUCK_SEL),
+	BD_DATA("BUCK6", BD718XX_4TH_NODVS_BUCK_CTRL, HW_STATE_CONTROL,
+		BD718XX_4TH_NODVS_BUCK_VOLT, BD718XX_4TH_NODVS_BUCK_MASK,
+		nodvs_buck4_vranges, 0, false, BD718XX_BUCK_SEL),
+/* LDOs */
+	BD_DATA("LDO1", BD718XX_LDO1_VOLT, HW_STATE_CONTROL, BD718XX_LDO1_VOLT,
+		BD718XX_LDO1_MASK, ldo1_vranges, 0x20, false, BD718XX_LDO_SEL),
+	BD_DATA("LDO2", BD718XX_LDO2_VOLT, HW_STATE_CONTROL, BD718XX_LDO2_VOLT,
+		BD718XX_LDO2_MASK, ldo2_vranges, 0, false, BD718XX_LDO_SEL),
+	BD_DATA("LDO3", BD718XX_LDO3_VOLT, HW_STATE_CONTROL, BD718XX_LDO3_VOLT,
+		BD718XX_LDO3_MASK, ldo3_vranges, 0, false, BD718XX_LDO_SEL),
+	BD_DATA("LDO4", BD718XX_LDO4_VOLT, HW_STATE_CONTROL, BD718XX_LDO4_VOLT,
+		BD718XX_LDO4_MASK, ldo4_vranges, 0, false, BD718XX_LDO_SEL),
+	BD_DATA("LDO5", BD718XX_LDO5_VOLT, HW_STATE_CONTROL, BD718XX_LDO5_VOLT,
+		BD71847_LDO5_MASK, bd71847_ldo5_vranges, 0x20, false,
+		BD718XX_LDO_SEL),
+	BD_DATA("LDO6", BD718XX_LDO6_VOLT, HW_STATE_CONTROL, BD718XX_LDO6_VOLT,
+		BD718XX_LDO6_MASK, ldo6_vranges, 0, false, BD718XX_LDO_SEL),
+};
+
+static int vrange_find_value(struct bd71837_vrange *r, u8 sel,
+			     unsigned int *val)
+{
+	if (!val || sel < r->min_sel || sel > r->max_sel)
+		return -EINVAL;
+
+	*val = r->min_volt + r->step * (sel - r->min_sel);
+	return 0;
+}
+
+static int vrange_find_selector(struct bd71837_vrange *r, int val, u8 *sel)
+{
+	int ret = -EINVAL;
+	int num_vals = r->max_sel - r->min_sel + 1;
+
+	if (val >= r->min_volt &&
+	    val <= r->min_volt + r->step * (num_vals - 1)) {
+		if (r->step) {
+			*sel = r->min_sel + ((val - r->min_volt) / r->step);
+			ret = 0;
+		} else {
+			*sel = r->min_sel;
+			ret = 0;
+		}
+	}
+	return ret;
+}
+
+static int bd71837_get_enable(struct udevice *dev)
+{
+	int val;
+	struct bd71837_data *d = dev_get_platdata(dev);
+
+	/* boot critical regulators on bd71837 must not be controlled by sw
+	 * due to the 'feature' which leaves power rails down if bd71837 is
+	 * reseted to snvs state. hence we can't get the state here.
+	 *
+	 * if we are alive it means we probably are on run state and
+	 * if the regulator can't be controlled we can assume it is
+	 * enabled.
+	 */
+	if (d->enablemask == HW_STATE_CONTROL)
+		return 1;
+
+	val = pmic_reg_read(dev->parent, d->enable_reg);
+
+	if (val < 0)
+		return val;
+
+	return (val & d->enablemask);
+}
+
+static int bd71837_set_enable(struct udevice *dev, bool enable)
+{
+	int val;
+	struct bd71837_data *d = dev_get_platdata(dev);
+
+	/* boot critical regulators on bd71837 must not be controlled by sw
+	 * due to the 'feature' which leaves power rails down if bd71837 is
+	 * reseted to snvs state. Hence we can't set the state here.
+	 */
+	if (d->enablemask == HW_STATE_CONTROL)
+		return -EINVAL;
+
+	val = pmic_reg_read(dev->parent, d->enable_reg);
+
+	if (val < 0)
+		return val;
+
+	if (enable)
+		val |= d->enablemask;
+	else
+		val &= ~d->enablemask;
+
+	return pmic_reg_write(dev->parent, d->enable_reg, val);
+}
+
+static int bd71837_set_value(struct udevice *dev, int uvolt)
+{
+	u8 sel, reg;
+	u8 range;
+	int i;
+	int not_found = 1;
+	struct bd71837_data *d = dev_get_platdata(dev);
+
+	/* An under/overshooting may occur if voltage is changed for other
+	 * regulators but buck 1,2,3 or 4 when regulator is enabled. Prevent
+	 * change to protect the HW
+	 */
+	if (!d->dvs)
+		if (bd71837_get_enable(dev)) {
+			pr_err("Only DVS bucks can be changed when enabled\n");
+			return -EINVAL;
+		}
+
+	for (i = 0; i < d->numranges; i++) {
+		struct bd71837_vrange *r = &d->ranges[i];
+
+		not_found = vrange_find_selector(r, uvolt, &sel);
+		if (!not_found) {
+			unsigned int tmp;
+
+			/* We require exactly the requested value to be
+			 * supported - this can be changed later if needed
+			 */
+			range = r->rangeval;
+			not_found = vrange_find_value(r, sel, &tmp);
+			if (!not_found && tmp == uvolt)
+				break;
+			not_found = 1;
+		}
+	}
+
+	if (not_found)
+		return -EINVAL;
+
+	sel <<= ffs(d->volt_mask) - 1;
+
+	reg = pmic_reg_read(dev->parent, d->volt_reg);
+	if (reg < 0)
+		return reg;
+
+	reg &= ~d->volt_mask;
+	reg |= sel;
+	if (d->rangemask) {
+		reg &= ~d->rangemask;
+		reg |= range;
+	}
+
+	return pmic_reg_write(dev->parent, d->volt_reg, reg);
+}
+
+static int bd71837_get_value(struct udevice *dev)
+{
+	u8 reg, range;
+	unsigned int tmp;
+	struct bd71837_data *d = dev_get_platdata(dev);
+	int i;
+
+	reg = pmic_reg_read(dev->parent, d->volt_reg);
+	if (reg < 0)
+		return reg;
+
+	range = reg & d->rangemask;
+
+	reg &= d->volt_mask;
+	reg >>= ffs(d->volt_mask) - 1;
+
+	for (i = 0; i < d->numranges; i++) {
+		struct bd71837_vrange *r = &d->ranges[i];
+
+		if (d->rangemask && ((d->rangemask & range) != r->rangeval))
+			continue;
+
+		if (!vrange_find_value(r, reg, &tmp))
+			return tmp;
+	}
+
+	pr_err("Unknown voltage value read from pmic\n");
+
+	return -EINVAL;
+}
+
+static int bd71837_regulator_probe(struct udevice *dev)
+{
+	struct bd71837_data *d = dev_get_platdata(dev);
+	int i, ret;
+	struct dm_regulator_uclass_platdata *uc_pdata;
+	int type;
+	struct bd71837_data *init_data;
+	int data_amnt;
+
+	type = dev_get_driver_data(dev_get_parent(dev));
+
+	switch (type) {
+	case ROHM_CHIP_TYPE_BD71837:
+		init_data = bd71837_reg_data;
+		data_amnt = ARRAY_SIZE(bd71837_reg_data);
+		break;
+	case ROHM_CHIP_TYPE_BD71847:
+		init_data = bd71847_reg_data;
+		data_amnt = ARRAY_SIZE(bd71847_reg_data);
+		break;
+	default:
+		debug("Unknown PMIC type\n");
+		init_data = NULL;
+		data_amnt = 0;
+		break;
+	}
+
+	for (i = 0; i < data_amnt; i++) {
+		if (!strcmp(dev->name, init_data[i].name)) {
+			*d = init_data[i];
+			if (d->enablemask != HW_STATE_CONTROL) {
+				u8 ctrl;
+
+				/* Take the regulator under SW control. Ensure
+				 * the initial state matches dt flags and then
+				 * write the SEL bit
+				 */
+				uc_pdata = dev_get_uclass_platdata(dev);
+				ret = bd71837_set_enable(dev,
+							 !!(uc_pdata->boot_on ||
+							 uc_pdata->always_on));
+				if (ret)
+					return ret;
+
+				ret = pmic_reg_read(dev->parent,
+						    d->enable_reg);
+				if (ret < 0)
+					return ret;
+
+				ctrl = ret;
+				ctrl |= d->sel_mask;
+				return pmic_reg_write(dev->parent,
+						      d->enable_reg, ctrl);
+			}
+			return 0;
+		}
+	}
+
+	pr_err("Unknown regulator '%s'\n", dev->name);
+
+	return -EINVAL;
+}
+
+static const struct dm_regulator_ops bd71837_regulator_ops = {
+	.get_value  = bd71837_get_value,
+	.set_value  = bd71837_set_value,
+	.get_enable = bd71837_get_enable,
+	.set_enable = bd71837_set_enable,
+};
+
+U_BOOT_DRIVER(bd71837_regulator) = {
+	.name = BD718XX_REGULATOR_DRIVER,
+	.id = UCLASS_REGULATOR,
+	.ops = &bd71837_regulator_ops,
+	.probe = bd71837_regulator_probe,
+	.platdata_auto_alloc_size = sizeof(struct bd71837_data),
+};
diff --git a/include/power/bd71837.h b/include/power/bd71837.h
index 9c74f6fc61..cdb9955860 100644
--- a/include/power/bd71837.h
+++ b/include/power/bd71837.h
@@ -1,64 +1,105 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Copyright (C) 2018 ROHM Semiconductors */
 
-#ifndef BD71837_H_
-#define BD71837_H_
+#ifndef BD718XX_H_
+#define BD718XX_H_
 
-#define BD71837_REGULATOR_DRIVER "bd71837_regulator"
+#define BD718XX_REGULATOR_DRIVER "bd718x7_regulator"
 
 enum {
-	BD71837_REV		= 0x00,
-	BD71837_SWRESET		= 0x01,
-	BD71837_I2C_DEV		= 0x02,
-	BD71837_PWRCTRL0	= 0x03,
-	BD71837_PWRCTRL1	= 0x04,
-	BD71837_BUCK1_CTRL	= 0x05,
-	BD71837_BUCK2_CTRL	= 0x06,
-	BD71837_BUCK3_CTRL	= 0x07,
-	BD71837_BUCK4_CTRL	= 0x08,
-	BD71837_BUCK5_CTRL	= 0x09,
-	BD71837_BUCK6_CTRL	= 0x0A,
-	BD71837_BUCK7_CTRL	= 0x0B,
-	BD71837_BUCK8_CTRL	= 0x0C,
-	BD71837_BUCK1_VOLT_RUN	= 0x0D,
-	BD71837_BUCK1_VOLT_IDLE	= 0x0E,
-	BD71837_BUCK1_VOLT_SUSP	= 0x0F,
-	BD71837_BUCK2_VOLT_RUN	= 0x10,
-	BD71837_BUCK2_VOLT_IDLE	= 0x11,
-	BD71837_BUCK3_VOLT_RUN	= 0x12,
-	BD71837_BUCK4_VOLT_RUN	= 0x13,
-	BD71837_BUCK5_VOLT	= 0x14,
-	BD71837_BUCK6_VOLT	= 0x15,
-	BD71837_BUCK7_VOLT	= 0x16,
-	BD71837_BUCK8_VOLT	= 0x17,
-	BD71837_LDO1_VOLT	= 0x18,
-	BD71837_LDO2_VOLT	= 0x19,
-	BD71837_LDO3_VOLT	= 0x1A,
-	BD71837_LDO4_VOLT	= 0x1B,
-	BD71837_LDO5_VOLT	= 0x1C,
-	BD71837_LDO6_VOLT	= 0x1D,
-	BD71837_LDO7_VOLT	= 0x1E,
-	BD71837_TRANS_COND0	= 0x1F,
-	BD71837_TRANS_COND1	= 0x20,
-	BD71837_VRFAULTEN	= 0x21,
-	BD71837_MVRFLTMASK0	= 0x22,
-	BD71837_MVRFLTMASK1	= 0x23,
-	BD71837_MVRFLTMASK2	= 0x24,
-	BD71837_RCVCFG		= 0x25,
-	BD71837_RCVNUM		= 0x26,
-	BD71837_PWRONCONFIG0	= 0x27,
-	BD71837_PWRONCONFIG1	= 0x28,
-	BD71837_RESETSRC	= 0x29,
-	BD71837_MIRQ		= 0x2A,
-	BD71837_IRQ		= 0x2B,
-	BD71837_IN_MON		= 0x2C,
-	BD71837_POW_STATE	= 0x2D,
-	BD71837_OUT32K		= 0x2E,
-	BD71837_REGLOCK		= 0x2F,
-	BD71837_MUXSW_EN	= 0x30,
-	BD71837_REG_NUM,
+	ROHM_CHIP_TYPE_BD71837 = 0,
+	ROHM_CHIP_TYPE_BD71847,
+	ROHM_CHIP_TYPE_BD70528,
+	ROHM_CHIP_TYPE_AMOUNT
 };
 
+enum {
+	BD718XX_REV			= 0x00,
+	BD718XX_SWRESET			= 0x01,
+	BD718XX_I2C_DEV			= 0x02,
+	BD718XX_PWRCTRL0		= 0x03,
+	BD718XX_PWRCTRL1		= 0x04,
+	BD718XX_BUCK1_CTRL		= 0x05,
+	BD718XX_BUCK2_CTRL		= 0x06,
+	BD71837_BUCK3_CTRL		= 0x07,
+	BD71837_BUCK4_CTRL		= 0x08,
+	BD718XX_1ST_NODVS_BUCK_CTRL	= 0x09,
+	BD718XX_2ND_NODVS_BUCK_CTRL	= 0x0A,
+	BD718XX_3RD_NODVS_BUCK_CTRL	= 0x0B,
+	BD718XX_4TH_NODVS_BUCK_CTRL	= 0x0C,
+	BD718XX_BUCK1_VOLT_RUN		= 0x0D,
+	BD718XX_BUCK1_VOLT_IDLE		= 0x0E,
+	BD718XX_BUCK1_VOLT_SUSP		= 0x0F,
+	BD718XX_BUCK2_VOLT_RUN		= 0x10,
+	BD718XX_BUCK2_VOLT_IDLE		= 0x11,
+	BD71837_BUCK3_VOLT_RUN		= 0x12,
+	BD71837_BUCK4_VOLT_RUN		= 0x13,
+	BD718XX_1ST_NODVS_BUCK_VOLT	= 0x14,
+	BD718XX_2ND_NODVS_BUCK_VOLT	= 0x15,
+	BD718XX_3RD_NODVS_BUCK_VOLT	= 0x16,
+	BD718XX_4TH_NODVS_BUCK_VOLT	= 0x17,
+	BD718XX_LDO1_VOLT		= 0x18,
+	BD718XX_LDO2_VOLT		= 0x19,
+	BD718XX_LDO3_VOLT		= 0x1A,
+	BD718XX_LDO4_VOLT		= 0x1B,
+	BD718XX_LDO5_VOLT		= 0x1C,
+	BD718XX_LDO6_VOLT		= 0x1D,
+	BD71837_LDO7_VOLT		= 0x1E,
+	BD718XX_TRANS_COND0		= 0x1F,
+	BD718XX_TRANS_COND1		= 0x20,
+	BD718XX_VRFAULTEN		= 0x21,
+	BD718XX_MVRFLTMASK0		= 0x22,
+	BD718XX_MVRFLTMASK1		= 0x23,
+	BD718XX_MVRFLTMASK2		= 0x24,
+	BD718XX_RCVCFG			= 0x25,
+	BD718XX_RCVNUM			= 0x26,
+	BD718XX_PWRONCONFIG0		= 0x27,
+	BD718XX_PWRONCONFIG1		= 0x28,
+	BD718XX_RESETSRC		= 0x29,
+	BD718XX_MIRQ			= 0x2A,
+	BD718XX_IRQ			= 0x2B,
+	BD718XX_IN_MON			= 0x2C,
+	BD718XX_POW_STATE		= 0x2D,
+	BD718XX_OUT32K			= 0x2E,
+	BD718XX_REGLOCK			= 0x2F,
+	BD718XX_MUXSW_EN		= 0x30,
+	BD718XX_REG_OTPVER		= 0xFF,
+	BD718XX_MAX_REGISTER		= 0x100,
+};
+
+#define BD718XX_REGLOCK_PWRSEQ		0x1
+#define BD718XX_REGLOCK_VREG		0x10
+
+#define BD718XX_BUCK_EN			0x01
+#define BD718XX_LDO_EN			0x40
+#define BD718XX_BUCK_SEL		0x02
+#define BD718XX_LDO_SEL			0x80
+
+#define DVS_BUCK_RUN_MASK		0x3F
+#define BD718XX_1ST_NODVS_BUCK_MASK	0x07
+#define BD718XX_3RD_NODVS_BUCK_MASK	0x07
+#define BD718XX_4TH_NODVS_BUCK_MASK	0x3F
+
+#define BD71847_BUCK3_MASK		0x07
+#define BD71847_BUCK3_RANGE_MASK	0xC0
+#define BD71847_BUCK4_MASK		0x03
+#define BD71847_BUCK4_RANGE_MASK	0x40
+
+#define BD71837_BUCK5_RANGE_MASK	0x80
+#define BD71837_BUCK6_MASK		0x03
+
+#define BD718XX_LDO1_MASK		0x03
+#define BD718XX_LDO1_RANGE_MASK		0x20
+#define BD718XX_LDO2_MASK		0x20
+#define BD718XX_LDO3_MASK		0x0F
+#define BD718XX_LDO4_MASK		0x0F
+#define BD718XX_LDO6_MASK		0x0F
+
+#define BD71837_LDO5_MASK		0x0F
+#define BD71847_LDO5_MASK		0x0F
+#define BD71847_LDO5_RANGE_MASK		0x20
+#define BD71837_LDO7_MASK		0x0F
+
 int power_bd71837_init(unsigned char bus);
 
 #endif
-- 
2.17.2


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v1 1/2] regulator: bd71837: copy the bd71837 pmic driver from NXP imx u-boot
  2019-04-08 10:28 ` [U-Boot] [PATCH v1 1/2] regulator: bd71837: copy the bd71837 pmic driver from NXP imx u-boot Matti Vaittinen
@ 2019-04-24  3:54   ` Simon Glass
  2019-04-24  6:08     ` Vaittinen, Matti
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Glass @ 2019-04-24  3:54 UTC (permalink / raw)
  To: u-boot

Hi Matti,

On Mon, 8 Apr 2019 at 04:28, Matti Vaittinen
<matti.vaittinen@fi.rohmeurope.com> wrote:
>
> https://source.codeaurora.org/external/imx/uboot-imx
>
> cherry picked, styled and merged commits:
> - MLK-18387 pmic: Add pmic driver for BD71837: e9a3bec2e95a
> - MLK-18590 pmic: bd71837: Change to use new fdt API: acdc5c297a96
>
> Signed-off-by: Ye Li <ye.li@nxp.com>
> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> ---
>
> Based on RFC:
> https://lists.denx.de/pipermail/u-boot/2019-March/363076.html
>
>  drivers/power/pmic/Kconfig        |  7 +++
>  drivers/power/pmic/Makefile       |  2 +
>  drivers/power/pmic/bd71837.c      | 89 +++++++++++++++++++++++++++++++
>  drivers/power/pmic/pmic_bd71837.c | 31 +++++++++++
>  include/power/bd71837.h           | 64 ++++++++++++++++++++++
>  5 files changed, 193 insertions(+)
>  create mode 100644 drivers/power/pmic/bd71837.c
>  create mode 100644 drivers/power/pmic/pmic_bd71837.c
>  create mode 100644 include/power/bd71837.h
>
> diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
> index 8cf60ebcf3..e154d0a57b 100644
> --- a/drivers/power/pmic/Kconfig
> +++ b/drivers/power/pmic/Kconfig
> @@ -48,6 +48,13 @@ config PMIC_AS3722
>           interface and is designs to cover most of the power managementment
>           required for a tablets or laptop.
>
> +config DM_PMIC_BD71837
> +       bool "Enable Driver Model for PMIC BD71837"
> +       depends on DM_PMIC
> +       help
> +         This config enables implementation of driver-model pmic uclass features
> +         for PMIC BD71837. The driver implements read/write operations.
> +
>  config DM_PMIC_FAN53555
>         bool "Enable support for OnSemi FAN53555"
>         depends on DM_PMIC && DM_REGULATOR && DM_I2C
> diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
> index 637352ab2b..e74c6190a8 100644
> --- a/drivers/power/pmic/Makefile
> +++ b/drivers/power/pmic/Makefile
> @@ -8,6 +8,7 @@ obj-$(CONFIG_DM_PMIC_FAN53555) += fan53555.o
>  obj-$(CONFIG_DM_PMIC_MAX77686) += max77686.o
>  obj-$(CONFIG_DM_PMIC_MAX8998) += max8998.o
>  obj-$(CONFIG_DM_PMIC_MC34708) += mc34708.o
> +obj-$(CONFIG_$(SPL_)DM_PMIC_BD71837) += bd71837.o
>  obj-$(CONFIG_$(SPL_)DM_PMIC_PFUZE100) += pfuze100.o
>  obj-$(CONFIG_PMIC_S2MPS11) += s2mps11.o
>  obj-$(CONFIG_DM_PMIC_SANDBOX) += sandbox.o i2c_pmic_emul.o
> @@ -30,6 +31,7 @@ obj-$(CONFIG_POWER_MAX77696) += pmic_max77696.o
>  obj-$(CONFIG_POWER_MAX8998) += pmic_max8998.o
>  obj-$(CONFIG_POWER_MAX8997) += pmic_max8997.o
>  obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
> +obj-$(CONFIG_POWER_BD71837) += pmic_bd71837.o
>  obj-$(CONFIG_POWER_PFUZE100) += pmic_pfuze100.o
>  obj-$(CONFIG_POWER_PFUZE3000) += pmic_pfuze3000.o
>  obj-$(CONFIG_POWER_TPS65217) += pmic_tps65217.o
> diff --git a/drivers/power/pmic/bd71837.c b/drivers/power/pmic/bd71837.c
> new file mode 100644
> index 0000000000..eadf373a18
> --- /dev/null
> +++ b/drivers/power/pmic/bd71837.c
> @@ -0,0 +1,89 @@
> +// SPDX-License-Identifier:      GPL-2.0+
> +//
> +// Copyright 2018 NXP  *
> +
> +#include <common.h>
> +#include <fdtdec.h>
> +#include <errno.h>
> +#include <dm.h>
> +#include <i2c.h>
> +#include <power/pmic.h>
> +#include <power/regulator.h>
> +#include <power/bd71837.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +static const struct pmic_child_info pmic_children_info[] = {
> +       /* buck */
> +       { .prefix = "b", .driver = BD71837_REGULATOR_DRIVER},
> +       /* ldo */
> +       { .prefix = "l", .driver = BD71837_REGULATOR_DRIVER},
> +       { },
> +};
> +
> +static int bd71837_reg_count(struct udevice *dev)
> +{
> +       return BD71837_REG_NUM;
> +}
> +
> +static int bd71837_write(struct udevice *dev, uint reg, const uint8_t *buff,
> +                        int len)
> +{
> +       if (dm_i2c_write(dev, reg, buff, len)) {
> +               pr_err("write error to device: %p register: %#x!", dev, reg);
> +               return -EIO;
> +       }
> +
> +       return 0;
> +}
> +
> +static int bd71837_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
> +{
> +       if (dm_i2c_read(dev, reg, buff, len)) {
> +               pr_err("read error from device: %p register: %#x!", dev, reg);
> +               return -EIO;
> +       }
> +
> +       return 0;
> +}
> +
> +static int bd71837_bind(struct udevice *dev)
> +{
> +       int children;
> +       ofnode regulators_node;
> +
> +       regulators_node = dev_read_subnode(dev, "regulators");
> +       if (!ofnode_valid(regulators_node)) {
> +               debug("%s: %s regulators subnode not found!", __func__,
> +                     dev->name);
> +               return -ENXIO;
> +       }
> +
> +       debug("%s: '%s' - found regulators subnode\n", __func__, dev->name);
> +
> +       children = pmic_bind_children(dev, regulators_node, pmic_children_info);
> +       if (!children)
> +               debug("%s: %s - no child found\n", __func__, dev->name);
> +
> +       /* Always return success for this device */
> +       return 0;
> +}
> +
> +static struct dm_pmic_ops bd71837_ops = {
> +       .reg_count = bd71837_reg_count,
> +       .read = bd71837_read,
> +       .write = bd71837_write,
> +};
> +
> +static const struct udevice_id bd71837_ids[] = {
> +       { .compatible = "rohm,bd71837", .data = 0x4b, },
> +       { }
> +};
> +
> +U_BOOT_DRIVER(pmic_bd71837) = {
> +       .name = "bd71837 pmic",
> +       .id = UCLASS_PMIC,
> +       .of_match = bd71837_ids,
> +       .bind = bd71837_bind,
> +       .ops = &bd71837_ops,
> +};
> diff --git a/drivers/power/pmic/pmic_bd71837.c b/drivers/power/pmic/pmic_bd71837.c
> new file mode 100644
> index 0000000000..3bb8db4081
> --- /dev/null
> +++ b/drivers/power/pmic/pmic_bd71837.c
> @@ -0,0 +1,31 @@
> +// SPDX-License-Identifier:      GPL-2.0+
> +//
> +// Copyright (C) 2014 Gateworks Corporation
> +//
> +// Tim Harvey <tharvey@gateworks.com>
> +
> +#include <common.h>
> +#include <errno.h>
> +#include <i2c.h>
> +#include <power/pmic.h>
> +#include <power/bd71837.h>
> +
> +static const char bd71837_name[] = "BD71837";
> +int power_bd71837_init(unsigned char bus)
> +{
> +       struct pmic *p = pmic_alloc();

This is the old PMIC interface.  This should not be needed.

> +
> +       if (!p) {
> +               printf("%s: POWER allocation error!\n", __func__);
> +               return -ENOMEM;
> +       }
> +
> +       p->name = bd71837_name;
> +       p->interface = PMIC_I2C;
> +       p->number_of_regs = BD71837_REG_NUM;
> +       p->hw.i2c.addr = 0x4b;
> +       p->hw.i2c.tx_num = 1;
> +       p->bus = bus;
> +
> +       return 0;
> +}
> diff --git a/include/power/bd71837.h b/include/power/bd71837.h
> new file mode 100644
> index 0000000000..9c74f6fc61
> --- /dev/null
> +++ b/include/power/bd71837.h
> @@ -0,0 +1,64 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/* Copyright (C) 2018 ROHM Semiconductors */
> +
> +#ifndef BD71837_H_
> +#define BD71837_H_
> +
> +#define BD71837_REGULATOR_DRIVER "bd71837_regulator"
> +
> +enum {
> +       BD71837_REV             = 0x00,
> +       BD71837_SWRESET         = 0x01,
> +       BD71837_I2C_DEV         = 0x02,
> +       BD71837_PWRCTRL0        = 0x03,
> +       BD71837_PWRCTRL1        = 0x04,
> +       BD71837_BUCK1_CTRL      = 0x05,
> +       BD71837_BUCK2_CTRL      = 0x06,
> +       BD71837_BUCK3_CTRL      = 0x07,
> +       BD71837_BUCK4_CTRL      = 0x08,
> +       BD71837_BUCK5_CTRL      = 0x09,
> +       BD71837_BUCK6_CTRL      = 0x0A,
> +       BD71837_BUCK7_CTRL      = 0x0B,
> +       BD71837_BUCK8_CTRL      = 0x0C,
> +       BD71837_BUCK1_VOLT_RUN  = 0x0D,
> +       BD71837_BUCK1_VOLT_IDLE = 0x0E,
> +       BD71837_BUCK1_VOLT_SUSP = 0x0F,
> +       BD71837_BUCK2_VOLT_RUN  = 0x10,
> +       BD71837_BUCK2_VOLT_IDLE = 0x11,
> +       BD71837_BUCK3_VOLT_RUN  = 0x12,
> +       BD71837_BUCK4_VOLT_RUN  = 0x13,
> +       BD71837_BUCK5_VOLT      = 0x14,
> +       BD71837_BUCK6_VOLT      = 0x15,
> +       BD71837_BUCK7_VOLT      = 0x16,
> +       BD71837_BUCK8_VOLT      = 0x17,
> +       BD71837_LDO1_VOLT       = 0x18,
> +       BD71837_LDO2_VOLT       = 0x19,
> +       BD71837_LDO3_VOLT       = 0x1A,
> +       BD71837_LDO4_VOLT       = 0x1B,
> +       BD71837_LDO5_VOLT       = 0x1C,
> +       BD71837_LDO6_VOLT       = 0x1D,
> +       BD71837_LDO7_VOLT       = 0x1E,
> +       BD71837_TRANS_COND0     = 0x1F,
> +       BD71837_TRANS_COND1     = 0x20,
> +       BD71837_VRFAULTEN       = 0x21,
> +       BD71837_MVRFLTMASK0     = 0x22,
> +       BD71837_MVRFLTMASK1     = 0x23,
> +       BD71837_MVRFLTMASK2     = 0x24,
> +       BD71837_RCVCFG          = 0x25,
> +       BD71837_RCVNUM          = 0x26,
> +       BD71837_PWRONCONFIG0    = 0x27,
> +       BD71837_PWRONCONFIG1    = 0x28,
> +       BD71837_RESETSRC        = 0x29,
> +       BD71837_MIRQ            = 0x2A,
> +       BD71837_IRQ             = 0x2B,
> +       BD71837_IN_MON          = 0x2C,
> +       BD71837_POW_STATE       = 0x2D,
> +       BD71837_OUT32K          = 0x2E,
> +       BD71837_REGLOCK         = 0x2F,
> +       BD71837_MUXSW_EN        = 0x30,
> +       BD71837_REG_NUM,

Lower-case hex please.

> +};
> +
> +int power_bd71837_init(unsigned char bus);

Should be able to drop this.

> +
> +#endif
> --
> 2.17.2

Regards,
Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v1 1/2] regulator: bd71837: copy the bd71837 pmic driver from NXP imx u-boot
  2019-04-24  3:54   ` Simon Glass
@ 2019-04-24  6:08     ` Vaittinen, Matti
  0 siblings, 0 replies; 5+ messages in thread
From: Vaittinen, Matti @ 2019-04-24  6:08 UTC (permalink / raw)
  To: u-boot

Thanks for looking at this Simon!

On Tue, 2019-04-23 at 21:54 -0600, Simon Glass wrote:
> Hi Matti,
> 
> On Mon, 8 Apr 2019 at 04:28, Matti Vaittinen
> <matti.vaittinen@fi.rohmeurope.com> wrote:
> > 
> > https://source.codeaurora.org/external/imx/uboot-imx
> > 
> > cherry picked, styled and merged commits:
> > - MLK-18387 pmic: Add pmic driver for BD71837: e9a3bec2e95a
> > - MLK-18590 pmic: bd71837: Change to use new fdt API: acdc5c297a96
> > 
> > Signed-off-by: Ye Li <ye.li@nxp.com>
> > Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> > ---
> > 
> > Based on RFC:
> > https://lists.denx.de/pipermail/u-boot/2019-March/363076.html
> > 
> >  drivers/power/pmic/Kconfig        |  7 +++
> >  drivers/power/pmic/Makefile       |  2 +
> >  drivers/power/pmic/bd71837.c      | 89
> > +++++++++++++++++++++++++++++++
> >  drivers/power/pmic/pmic_bd71837.c | 31 +++++++++++
> >  include/power/bd71837.h           | 64 ++++++++++++++++++++++
> >  5 files changed, 193 insertions(+)
> >  create mode 100644 drivers/power/pmic/bd71837.c
> >  create mode 100644 drivers/power/pmic/pmic_bd71837.c
> >  create mode 100644 include/power/bd71837.h

// Snip.

> > diff --git a/drivers/power/pmic/pmic_bd71837.c
> > b/drivers/power/pmic/pmic_bd71837.c
> > new file mode 100644
> > index 0000000000..3bb8db4081
> > --- /dev/null
> > +++ b/drivers/power/pmic/pmic_bd71837.c
> > @@ -0,0 +1,31 @@
> > +// SPDX-License-Identifier:      GPL-2.0+
> > +//
> > +// Copyright (C) 2014 Gateworks Corporation
> > +//
> > +// Tim Harvey <tharvey@gateworks.com>
> > +
> > +#include <common.h>
> > +#include <errno.h>
> > +#include <i2c.h>
> > +#include <power/pmic.h>
> > +#include <power/bd71837.h>
> > +
> > +static const char bd71837_name[] = "BD71837";
> > +int power_bd71837_init(unsigned char bus)
> > +{
> > +       struct pmic *p = pmic_alloc();
> 
> This is the old PMIC interface.  This should not be needed.

Do you mean I can drop whole pmic_bd71837.c? I'll do that at the next
patch version =)

> 
> > +
> > +       if (!p) {
> > +               printf("%s: POWER allocation error!\n", __func__);
> > +               return -ENOMEM;
> > +       }
> > +
> > +       p->name = bd71837_name;
> > +       p->interface = PMIC_I2C;
> > +       p->number_of_regs = BD71837_REG_NUM;
> > +       p->hw.i2c.addr = 0x4b;
> > +       p->hw.i2c.tx_num = 1;
> > +       p->bus = bus;
> > +
> > +       return 0;
> > +}
> > diff --git a/include/power/bd71837.h b/include/power/bd71837.h
> > new file mode 100644
> > index 0000000000..9c74f6fc61
> > --- /dev/null
> > +++ b/include/power/bd71837.h
> > @@ -0,0 +1,64 @@
> > +/* SPDX-License-Identifier: GPL-2.0-or-later */
> > +/* Copyright (C) 2018 ROHM Semiconductors */
> > +
> > +#ifndef BD71837_H_
> > +#define BD71837_H_
> > +
> > +#define BD71837_REGULATOR_DRIVER "bd71837_regulator"
> > +
> > +enum {
> > +       BD71837_REV             = 0x00,
> > +       BD71837_SWRESET         = 0x01,
> > +       BD71837_I2C_DEV         = 0x02,
> > +       BD71837_PWRCTRL0        = 0x03,
> > +       BD71837_PWRCTRL1        = 0x04,
> > +       BD71837_BUCK1_CTRL      = 0x05,
> > +       BD71837_BUCK2_CTRL      = 0x06,
> > +       BD71837_BUCK3_CTRL      = 0x07,
> > +       BD71837_BUCK4_CTRL      = 0x08,
> > +       BD71837_BUCK5_CTRL      = 0x09,
> > +       BD71837_BUCK6_CTRL      = 0x0A,
> > +       BD71837_BUCK7_CTRL      = 0x0B,
> > +       BD71837_BUCK8_CTRL      = 0x0C,
> > +       BD71837_BUCK1_VOLT_RUN  = 0x0D,
> > +       BD71837_BUCK1_VOLT_IDLE = 0x0E,
> > +       BD71837_BUCK1_VOLT_SUSP = 0x0F,
> > +       BD71837_BUCK2_VOLT_RUN  = 0x10,
> > +       BD71837_BUCK2_VOLT_IDLE = 0x11,
> > +       BD71837_BUCK3_VOLT_RUN  = 0x12,
> > +       BD71837_BUCK4_VOLT_RUN  = 0x13,
> > +       BD71837_BUCK5_VOLT      = 0x14,
> > +       BD71837_BUCK6_VOLT      = 0x15,
> > +       BD71837_BUCK7_VOLT      = 0x16,
> > +       BD71837_BUCK8_VOLT      = 0x17,
> > +       BD71837_LDO1_VOLT       = 0x18,
> > +       BD71837_LDO2_VOLT       = 0x19,
> > +       BD71837_LDO3_VOLT       = 0x1A,
> > +       BD71837_LDO4_VOLT       = 0x1B,
> > +       BD71837_LDO5_VOLT       = 0x1C,
> > +       BD71837_LDO6_VOLT       = 0x1D,
> > +       BD71837_LDO7_VOLT       = 0x1E,
> > +       BD71837_TRANS_COND0     = 0x1F,
> > +       BD71837_TRANS_COND1     = 0x20,
> > +       BD71837_VRFAULTEN       = 0x21,
> > +       BD71837_MVRFLTMASK0     = 0x22,
> > +       BD71837_MVRFLTMASK1     = 0x23,
> > +       BD71837_MVRFLTMASK2     = 0x24,
> > +       BD71837_RCVCFG          = 0x25,
> > +       BD71837_RCVNUM          = 0x26,
> > +       BD71837_PWRONCONFIG0    = 0x27,
> > +       BD71837_PWRONCONFIG1    = 0x28,
> > +       BD71837_RESETSRC        = 0x29,
> > +       BD71837_MIRQ            = 0x2A,
> > +       BD71837_IRQ             = 0x2B,
> > +       BD71837_IN_MON          = 0x2C,
> > +       BD71837_POW_STATE       = 0x2D,
> > +       BD71837_OUT32K          = 0x2E,
> > +       BD71837_REGLOCK         = 0x2F,
> > +       BD71837_MUXSW_EN        = 0x30,
> > +       BD71837_REG_NUM,
> 
> Lower-case hex please.

Ok.

> 
> > +};
> > +
> > +int power_bd71837_init(unsigned char bus);
> 
> Should be able to drop this.

Yep. I'll drop this at the same time I drop the file pmic_bd71837.c

Br,
	Matti Vaittinen

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-24  6:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-08 10:26 [U-Boot] [PATCH v1 0/2] support for ROHM BD71827 and BD71847 PMICs Matti Vaittinen
2019-04-08 10:28 ` [U-Boot] [PATCH v1 1/2] regulator: bd71837: copy the bd71837 pmic driver from NXP imx u-boot Matti Vaittinen
2019-04-24  3:54   ` Simon Glass
2019-04-24  6:08     ` Vaittinen, Matti
2019-04-08 10:30 ` [U-Boot] [PATCH v1 2/2] regulator: bd718x7: support ROHM BD71837 and BD71847 PMICs Matti Vaittinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.