[U-Boot] [PATCH v5 01/13] power: pmic: add pfuze3000 support

Adrian Alonso aalonso at freescale.com
Tue Aug 11 18:19:49 CEST 2015


* Add pmic pfuze3000 support, implement power_pfuze3000_init to be
  used in power_init_board callback function.

Signed-off-by: Adrian Alonso <aalonso at freescale.com>
Signed-off-by: Peng Fan <Peng.Fan at freescale.com>
---
Changes for V2:
- Correct pfuze device name to pfuze3000; Freescale documentation uses
  Pfuze 3000 as product name for the pmic, align driver name with the
  actual product name.
Changes for V3: Resend
Changes for V4: Resend
Changes for V5: Rewok patch so it can be applyed in master

 drivers/power/pmic/Makefile         |  1 +
 drivers/power/pmic/pmic_pfuze3000.c | 32 +++++++++++++++
 include/power/pfuze3000_pmic.h      | 78 +++++++++++++++++++++++++++++++++++++
 3 files changed, 111 insertions(+)
 create mode 100644 drivers/power/pmic/pmic_pfuze3000.c
 create mode 100644 include/power/pfuze3000_pmic.h

diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
index 6ef149a..af3e03c 100644
--- a/drivers/power/pmic/Makefile
+++ b/drivers/power/pmic/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_POWER_MAX8997) += pmic_max8997.o
 obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
 obj-$(CONFIG_POWER_MAX77686) += pmic_max77686.o
 obj-$(CONFIG_POWER_PFUZE100) += pmic_pfuze100.o
+obj-$(CONFIG_POWER_PFUZE3000) += pmic_pfuze3000.o
 obj-$(CONFIG_POWER_TPS65217) += pmic_tps65217.o
 obj-$(CONFIG_POWER_TPS65218) += pmic_tps62362.o
 obj-$(CONFIG_POWER_TPS65218) += pmic_tps65218.o
diff --git a/drivers/power/pmic/pmic_pfuze3000.c b/drivers/power/pmic/pmic_pfuze3000.c
new file mode 100644
index 0000000..ac807a8
--- /dev/null
+++ b/drivers/power/pmic/pmic_pfuze3000.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2015 Freescale Semiconductor, Inc.
+ * Peng Fan <Peng.Fan at freescale.com>
+ *
+ * SPDX-License-Identifier:      GPL-2.0+
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <i2c.h>
+#include <power/pmic.h>
+#include <power/pfuze3000_pmic.h>
+
+int power_pfuze3000_init(unsigned char bus)
+{
+	static const char name[] = "PFUZE3000";
+	struct pmic *p = pmic_alloc();
+
+	if (!p) {
+		printf("%s: POWER allocation error!\n", __func__);
+		return -ENOMEM;
+	}
+
+	p->name = name;
+	p->interface = PMIC_I2C;
+	p->number_of_regs = PMIC_NUM_OF_REGS;
+	p->hw.i2c.addr = CONFIG_POWER_PFUZE3000_I2C_ADDR;
+	p->hw.i2c.tx_num = 1;
+	p->bus = bus;
+
+	return 0;
+}
diff --git a/include/power/pfuze3000_pmic.h b/include/power/pfuze3000_pmic.h
new file mode 100644
index 0000000..e8b892b
--- /dev/null
+++ b/include/power/pfuze3000_pmic.h
@@ -0,0 +1,78 @@
+/*
+ *  Copyright (C) 2015 Freescale Semiconductor, Inc
+ *  Peng Fan <Peng.Fan at freescale.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+#ifndef __PFUZE3000_PMIC_H_
+#define __PFUZE3000_PMIC_H_
+
+/* PFUZE3000 registers */
+enum {
+	PFUZE3000_DEVICEID	= 0x00,
+
+	PFUZE3000_REVID		= 0x03,
+	PFUZE3000_FABID		= 0x04,
+	PFUZE3000_INTSTAT0	= 0x05,
+	PFUZE3000_INTMASK0	= 0x06,
+	PFUZE3000_INTSENSE0	= 0x07,
+	PFUZE3000_INTSTAT1	= 0x08,
+	PFUZE3000_INTMASK1	= 0x09,
+	PFUZE3000_INTSENSE1	= 0x0A,
+
+	PFUZE3000_INTSTAT3	= 0x0E,
+	PFUZE3000_INTMASK3	= 0x0F,
+	PFUZE3000_INTSENSE3	= 0x10,
+	PFUZE3000_INTSTAT4	= 0x11,
+	PFUZE3000_INTMASK4	= 0x12,
+	PFUZE3000_INTSENSE4	= 0x13,
+
+	PFUZE3000_COINCTL	= 0x1A,
+	PFUZE3000_PWRCTL	= 0x1B,
+	PFUZE3000_MEMA		= 0x1C,
+	PFUZE3000_MEMB		= 0x1D,
+	PFUZE3000_MEMC		= 0x1E,
+	PFUZE3000_MEMD		= 0x1F,
+
+	PFUZE3000_SW1AVOLT	= 0x20,
+	PFUZE3000_SW1ASTBY	= 0x21,
+	PFUZE3000_SW1AOFF	= 0x22,
+	PFUZE3000_SW1AMODE	= 0x23,
+	PFUZE3000_SW1ACONF	= 0x24,
+
+	PFUZE3000_SW1BVOLT	= 0x2E,
+	PFUZE3000_SW1BSTBY	= 0x2F,
+	PFUZE3000_SW1BOFF	= 0x30,
+	PFUZE3000_SW1BMODE	= 0x31,
+	PFUZE3000_SW1BCONF	= 0x32,
+
+	PFUZE3000_SW2VOLT	= 0x35,
+	PFUZE3000_SW2STBY	= 0x36,
+	PFUZE3000_SW2OFF	= 0x37,
+	PFUZE3000_SW2MODE	= 0x38,
+	PFUZE3000_SW2CONF	= 0x39,
+
+	PFUZE3000_SW3VOLT	= 0x3C,
+	PFUZE3000_SW3STBY	= 0x3D,
+	PFUZE3000_SW3OFF	= 0x3E,
+	PFUZE3000_SW3MODE	= 0x3F,
+	PFUZE3000_SW3CONF	= 0x40,
+
+	PFUZE3000_SWBSTCTL	= 0x66,
+
+	PFUZE3000_LDOGCTL	= 0x69,
+	PFUZE3000_VREFDDRCTL	= 0x6A,
+	PFUZE3000_VSNVSCTL	= 0x6B,
+	PFUZE3000_VLDO1CTL	= 0x6C,
+	PFUZE3000_VLDO2CTL	= 0x6D,
+	PFUZE3000_VCC_SDCTL	= 0x6E,
+	PFUZE3000_V33CTL	= 0x6F,
+	PFUZE3000_VLDO3CTL	= 0x70,
+	PFUZE3000_VLD4CTL	= 0x71,
+
+	PMIC_NUM_OF_REGS	= 0x7F,
+};
+
+int power_pfuze3000_init(unsigned char bus);
+
+#endif
-- 
2.1.4



More information about the U-Boot mailing list