power: pmic: add pfuze3000 support
authorAdrian Alonso <aalonso@freescale.com>
Tue, 11 Aug 2015 16:19:49 +0000 (11:19 -0500)
committerStefano Babic <sbabic@denx.de>
Wed, 2 Sep 2015 13:31:33 +0000 (15:31 +0200)
* Add pmic pfuze3000 support, implement power_pfuze3000_init to be
  used in power_init_board callback function.

Signed-off-by: Adrian Alonso <aalonso@freescale.com>
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
drivers/power/pmic/Makefile
drivers/power/pmic/pmic_pfuze3000.c [new file with mode: 0644]
include/power/pfuze3000_pmic.h [new file with mode: 0644]

index 99c5778334a4350bf1b52b8aeb4ade0095d35c99..e7a761703e186824d8c8a0656f63401172addef2 100644 (file)
@@ -19,6 +19,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 (file)
index 0000000..ac807a8
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2015 Freescale Semiconductor, Inc.
+ * Peng Fan <Peng.Fan@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 (file)
index 0000000..e8b892b
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ *  Copyright (C) 2015 Freescale Semiconductor, Inc
+ *  Peng Fan <Peng.Fan@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