2 * Copyright (C) 2012 Samsung Electronics
3 * Rajeshwari Shinde <rajeshwari.s@samsung.com>
5 * SPDX-License-Identifier: GPL-2.0+
11 #include <power/pmic.h>
12 #include <power/max77686_pmic.h>
15 DECLARE_GLOBAL_DATA_PTR;
17 int pmic_init(unsigned char bus)
19 static const char name[] = "MAX77686_PMIC";
20 struct pmic *p = pmic_alloc();
23 printf("%s: POWER allocation error!\n", __func__);
27 #ifdef CONFIG_OF_CONTROL
28 const void *blob = gd->fdt_blob;
31 node = fdtdec_next_compatible(blob, 0, COMPAT_MAXIM_MAX77686_PMIC);
33 debug("PMIC: No node for PMIC Chip in device tree\n");
34 debug("node = %d\n", node);
38 parent = fdt_parent_offset(blob, node);
40 debug("%s: Cannot find node parent\n", __func__);
44 p->bus = i2c_get_bus_num_fdt(parent);
46 debug("%s: Cannot find I2C bus\n", __func__);
49 p->hw.i2c.addr = fdtdec_get_int(blob, node, "reg", 9);
52 p->hw.i2c.addr = MAX77686_I2C_ADDR;
56 p->interface = PMIC_I2C;
57 p->number_of_regs = PMIC_NUM_OF_REGS;
60 puts("Board PMIC init\n");