コード例 #1
0
int pmic_88pm860_alloc(unsigned char bus, struct pmic_chip_desc *chip)
{
	struct pmic *p_base = pmic_alloc();
	struct pmic *p_power = pmic_alloc();
	struct pmic *p_gpadc = pmic_alloc();
	if (!p_base || !p_power || !p_gpadc) {
		printf("%s: pmic allocation error!\n", __func__);
		return -ENOMEM;
	}

	if (!chip) {
		printf("%s: chip description is empty!\n", __func__);
		return -EINVAL;
	}
	chip->base_name = MARVELL_PMIC_BASE;
	chip->power_name = MARVELL_PMIC_POWER;
	chip->gpadc_name = MARVELL_PMIC_GPADC;
	chip->charger_name = NULL;
	chip->fuelgauge_name = NULL;
	chip->battery_name = NULL;

	p_base->bus = bus;
	p_base->hw.i2c.addr = MARVELL88PM_I2C_ADDR;
	p_base->name = MARVELL_PMIC_BASE;
	p_base->interface = PMIC_I2C;
	p_base->number_of_regs = PMIC_NUM_OF_REGS;
	p_base->hw.i2c.tx_num = 1;

	p_power->bus = bus;
	p_power->hw.i2c.addr = MARVELL88PM_I2C_ADDR + 1;
	p_power->name = MARVELL_PMIC_POWER;
	p_power->interface = PMIC_I2C;
	p_power->number_of_regs = PMIC_NUM_OF_REGS;
	p_power->hw.i2c.tx_num = 1;

	p_gpadc->bus = bus;
	p_gpadc->hw.i2c.addr = MARVELL88PM_I2C_ADDR + 2;
	p_gpadc->name = MARVELL_PMIC_GPADC;
	p_gpadc->interface = PMIC_I2C;
	p_gpadc->number_of_regs = PMIC_NUM_OF_REGS;
	p_gpadc->hw.i2c.tx_num = 1;

	/* get functions */
	chip->set_buck_vol = marvell88pm860_set_buck_vol;
	chip->set_ldo_vol = marvell88pm860_set_ldo_vol;
	chip->get_buck_vol = marvell88pm860_get_buck_vol;
	chip->reg_update = marvell88pm860_reg_update;

	puts("Board PMIC init\n");

	g_chip = chip;

	return 0;
}
コード例 #2
0
ファイル: power_fsl.c プロジェクト: AnAtom/u-boot-sunxi
int pmic_init(unsigned char bus)
{
	static const char name[] = "FSL_PMIC";
	struct pmic *p = pmic_alloc();

	if (!p) {
		printf("%s: POWER allocation error!\n", __func__);
		return -ENOMEM;
	}

	p->name = name;
	p->number_of_regs = PMIC_NUM_OF_REGS;
	p->bus = bus;

#if defined(CONFIG_POWER_SPI)
	p->interface = PMIC_SPI;
	p->hw.spi.cs = CONFIG_FSL_PMIC_CS;
	p->hw.spi.clk = CONFIG_FSL_PMIC_CLK;
	p->hw.spi.mode = CONFIG_FSL_PMIC_MODE;
	p->hw.spi.bitlen = CONFIG_FSL_PMIC_BITLEN;
	p->hw.spi.flags = SPI_XFER_BEGIN | SPI_XFER_END;
	p->hw.spi.prepare_tx = pmic_spi_prepare_tx;
#elif defined(CONFIG_POWER_I2C)
	p->interface = PMIC_I2C;
	p->hw.i2c.addr = CONFIG_SYS_FSL_PMIC_I2C_ADDR;
	p->hw.i2c.tx_num = FSL_PMIC_I2C_LENGTH;
#else
#error "You must select CONFIG_POWER_SPI or CONFIG_PMIC_I2C"
#endif

	return 0;
}
コード例 #3
0
int pm830_bat_alloc(unsigned char bus, struct pmic_chip_desc *chip)
{
    static const char name[] = MARVELL_PMIC_BATTERY;
    struct pmic *p = pmic_alloc();

    if (!p) {
        printf("%s: POWER allocation error!\n", __func__);
        return -ENOMEM;
    }

    debug("Board BAT init\n");

    if (!chip) {
        printf("%s: PMIC chip is empty.\n", __func__);
        return -EINVAL;
    }
    chip->battery_name = name;

    p->interface = PMIC_NONE;
    p->name = name;
    p->bus = bus;

    p->pbat = &power_bat_ops;
    return 0;
}
コード例 #4
0
int pm88x_bat_alloc(unsigned char bus, struct pmic_chip_desc *chip)
{
	static const char name[] = MARVELL_PMIC_BATTERY;
	struct pmic *p = pmic_alloc();

	if (!p) {
		printf("%s: POWER allocation error!\n", __func__);
		return -ENOMEM;
	}

	debug("Board BAT init\n");

	if (!chip) {
		printf("%s: PMIC chip is empty.\n", __func__);
		return -EINVAL;
	}
	chip->battery_name = name;

	p->bus = bus;
	p->hw.i2c.addr = MARVELL88PM_I2C_ADDR + 3;
	p->hw.i2c.tx_num = 1;
	p->number_of_regs = PMIC_NUM_OF_REGS;
	p->interface = PMIC_I2C;
	p->name = name;

	p->pbat = &power_bat_ops;
	return 0;
}
コード例 #5
0
int pm830_fg_alloc(unsigned char bus, struct pmic_chip_desc *chip)
{
	static const char name[] = MARVELL_PMIC_FG;
	struct pmic *p = pmic_alloc();

	if (!p) {
		printf("%s: POWER allocation error!\n", __func__);
		return -ENOMEM;
	}

	debug("Board Fuel Gauge init\n");

	if (!chip) {
		printf("%s: PMIC chip is empty.\n", __func__);
		return -EINVAL;
	}
	chip->fuelgauge_name = name;

	p->name = name;
	p->interface = PMIC_I2C;
	p->number_of_regs = PM830_REG_NUM_OF_REGS;
	p->hw.i2c.addr = PM830_I2C_ADDR;
	p->hw.i2c.tx_num = 1;
	p->bus = bus;

	p->fg = &power_fg_ops;
	return 0;
}
コード例 #6
0
ファイル: pmic_rk818.c プロジェクト: mq002/miqi-uboot
static int rk818_parse_dt(const void* blob)
{
	int node, nd;
	struct fdt_gpio_state gpios[2];
	u32 bus, addr;
	int ret, i;

	node = fdt_node_offset_by_compatible(blob,
					0, COMPAT_ROCKCHIP_RK818);
	if (node < 0) {
		printf("can't find dts node for rk818\n");
		return -ENODEV;
	}

	if (!fdt_device_is_available(blob,node)) {
		printf("device rk818 is disabled\n");
		return -1;
	}
	
	ret = fdt_get_i2c_info(blob, node, &bus, &addr);
	if (ret < 0) {
		printf("pmic rk818 get fdt i2c failed\n");
		return ret;
	}

	ret = rk818_i2c_probe(bus, addr);
	if (ret < 0) {
		printf("pmic rk818 i2c probe failed\n");
		return ret;
	}
	
	nd = fdt_get_regulator_node(blob, node);
	if (nd < 0)
		printf("%s: Cannot find regulators\n", __func__);
	else
		fdt_regulator_match(blob, nd, rk818_reg_matches,
					RK818_NUM_REGULATORS);
	
	for (i = 0; i < RK818_NUM_REGULATORS; i++) {
		if (rk818_reg_matches[i].boot_on && (rk818_reg_matches[i].min_uV == rk818_reg_matches[i].max_uV))
			ret = rk818_set_regulator_init(&rk818_reg_matches[i], i);
	}

	fdtdec_decode_gpios(blob, node, "gpios", gpios, 2);
	support_dc_chg = fdtdec_get_int(blob, node, "rk818,support_dc_chg",0);

	rk818.pmic = pmic_alloc();
	rk818.node = node;
	rk818.pmic->hw.i2c.addr = addr;
	rk818.pmic->bus = bus;
	debug("rk818 i2c_bus:%d addr:0x%02x\n", rk818.pmic->bus,
		rk818.pmic->hw.i2c.addr);

	return 0;
}
コード例 #7
0
ファイル: pmic_rk808.c プロジェクト: michalliu/rkchrome_uboot
static int rk808_parse_dt(const void* blob)
{
	int node, parent, nd;
	u32 i2c_bus_addr, bus;
	int ret;
	fdt_addr_t addr;
	struct fdt_gpio_state gpios[2];
	node = fdt_node_offset_by_compatible(blob,
					0, COMPAT_ROCKCHIP_RK808);
	if (node < 0) {
		printf("can't find dts node for rk808\n");
		return -ENODEV;
	}

	if (!fdt_device_is_available(blob,node)) {
		debug("device rk808 is disabled\n");
		return -1;
	}
	
	addr = fdtdec_get_addr(blob, node, "reg");
	fdtdec_decode_gpios(blob, node, "gpios", gpios, 2);
	
	parent = fdt_parent_offset(blob, node);
	if (parent < 0) {
		debug("%s: Cannot find node parent\n", __func__);
		return -1;
	}
	i2c_bus_addr = fdtdec_get_addr(blob, parent, "reg");
	bus = i2c_get_bus_num_fdt(i2c_bus_addr);
	ret = rk808_i2c_probe(bus, addr);
	if (ret < 0) {
		debug("pmic rk808 i2c probe failed\n");
		return ret;
	}
	
	nd = fdt_get_regulator_node(blob, node);
	if (nd < 0)
		printf("%s: Cannot find regulators\n", __func__);
	else
		fdt_regulator_match(blob, nd, rk808_reg_matches,
					RK808_NUM_REGULATORS);
	rk808.pmic = pmic_alloc();
	rk808.node = node;
	rk808.pmic->hw.i2c.addr = addr;
	rk808.pmic->bus = bus;
	rk808.pwr_hold.gpio = rk_gpio_base_to_bank(gpios[1].gpio & RK_GPIO_BANK_MASK) | 
				(gpios[1].gpio & RK_GPIO_PIN_MASK);
	rk808.pwr_hold.flags = !(gpios[1].flags  & OF_GPIO_ACTIVE_LOW);
	debug("rk808 i2c_bus:%d addr:0x%02x\n", rk808.pmic->bus,
		rk808.pmic->hw.i2c.addr);
	return 0;
	 
}
コード例 #8
0
ファイル: pmic_max77686.c プロジェクト: CreatorDev/u-boot
int pmic_init(unsigned char bus)
{
	static const char name[] = "MAX77686_PMIC";
	struct pmic *p = pmic_alloc();
#ifdef CONFIG_OF_CONTROL
	const void *blob = gd->fdt_blob;
	int node, parent, tmp;
#endif

	if (!p) {
		printf("%s: POWER allocation error!\n", __func__);
		return -ENOMEM;
	}

#ifdef CONFIG_OF_CONTROL
	node = fdtdec_next_compatible(blob, 0, COMPAT_MAXIM_MAX77686_PMIC);
	if (node < 0) {
		debug("PMIC: No node for PMIC Chip in device tree\n");
		debug("node = %d\n", node);
		return -1;
	}

	parent = fdt_parent_offset(blob, node);
	if (parent < 0) {
		debug("%s: Cannot find node parent\n", __func__);
		return -1;
	}

	/* tmp since p->bus is unsigned */
	tmp = i2c_get_bus_num_fdt(parent);
	if (tmp < 0) {
		debug("%s: Cannot find I2C bus\n", __func__);
		return -1;
	}
	p->bus = tmp;
	p->hw.i2c.addr = fdtdec_get_int(blob, node, "reg", 9);
#else
	p->bus = bus;
	p->hw.i2c.addr = MAX77686_I2C_ADDR;
#endif

	p->name = name;
	p->interface = PMIC_I2C;
	p->number_of_regs = MAX77686_NUM_OF_REGS;
	p->hw.i2c.tx_num = 1;

	puts("Board PMIC init\n");

	return 0;
}
コード例 #9
0
int ricoh619_parse_dt(const void* blob)
{
	int node, parent, nd;
	u32 i2c_bus_addr, bus;
	int ret;
	fdt_addr_t addr;
	node = fdt_node_offset_by_compatible(blob, 0,
					COMPAT_RICOH_RICOH619);
	if (node < 0) {
		printf("can't find dts node for ricoh619\n");
		return -ENODEV;
	}

	if (!fdt_device_is_available(blob,node)) {
		debug("device ricoh619 is disabled\n");
		return -1;
	}
	
	addr = fdtdec_get_addr(blob, node, "reg");
	parent = fdt_parent_offset(blob, node);
	if (parent < 0) {
		debug("%s: Cannot find node parent\n", __func__);
		return -1;
	}
	i2c_bus_addr = fdtdec_get_addr(blob, parent, "reg");
	bus = i2c_get_bus_num_fdt(i2c_bus_addr);
	ret = ricoh619_i2c_probe(bus, addr);
	if (ret < 0) {
		debug("pmic ricoh619 i2c probe failed\n");
		return ret;
	}
	nd = fdt_get_regulator_node(blob, node);
	if (nd < 0)
		printf("%s: Cannot find regulators\n", __func__);
	else
		fdt_regulator_match(blob, nd, ricoh619_regulator_matches,
					RICOH619_NUM_REGULATORS);
	ricoh619.pmic = pmic_alloc();
	ricoh619.node = node;
	ricoh619.pmic->hw.i2c.addr = addr;
	ricoh619.pmic->bus = bus;
	debug("ricoh619 i2c_bus:%d addr:0x%02x\n", ricoh619.pmic->bus,
		ricoh619.pmic->hw.i2c.addr);
	return 0;
	 
}
コード例 #10
0
ファイル: pmic_tps65090.c プロジェクト: mconners/r2
int tps65090_init(void)
{
	struct pmic *p;
	int bus;
	int addr;
	const void *blob = gd->fdt_blob;
	int node, parent;

	node = fdtdec_next_compatible(blob, 0, COMPAT_TI_TPS65090);
	if (node < 0) {
		debug("PMIC: No node for PMIC Chip in device tree\n");
		debug("node = %d\n", node);
		return -ENODEV;
	}

	parent = fdt_parent_offset(blob, node);
	if (parent < 0) {
		debug("%s: Cannot find node parent\n", __func__);
		return -EINVAL;
	}

	bus = i2c_get_bus_num_fdt(parent);
	if (p->bus < 0) {
		debug("%s: Cannot find I2C bus\n", __func__);
		return -ENOENT;
	}
	addr = fdtdec_get_int(blob, node, "reg", TPS65090_I2C_ADDR);
	p = pmic_alloc();
	if (!p) {
		printf("%s: POWER allocation error!\n", __func__);
		return -ENOMEM;
	}

	p->name = TPS65090_NAME;
	p->bus = bus;
	p->interface = PMIC_I2C;
	p->number_of_regs = TPS65090_NUM_REGS;
	p->hw.i2c.addr = addr;
	p->hw.i2c.tx_num = 1;
	p->chrg = &power_chrg_pmic_ops;

	puts("TPS65090 PMIC init\n");

	return 0;
}
コード例 #11
0
int power_tps65218_init(unsigned char bus)
{
	static const char name[] = "TPS65218_PMIC";
	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 = TPS65218_PMIC_NUM_OF_REGS;
	p->hw.i2c.addr = TPS65218_CHIP_PM;
	p->hw.i2c.tx_num = 1;
	p->bus = bus;

	return 0;
}
コード例 #12
0
int power_ltc3676_init(unsigned char bus)
{
	static const char name[] = "LTC3676_PMIC";
	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 = LTC3676_NUM_OF_REGS;
	p->hw.i2c.addr = CONFIG_POWER_LTC3676_I2C_ADDR;
	p->hw.i2c.tx_num = 1;
	p->bus = bus;

	return 0;
}
コード例 #13
0
int power_bat_init(unsigned char bus)
{
	static const char name[] = "BAT_TRATS2";
	struct pmic *p = pmic_alloc();

	if (!p) {
		printf("%s: POWER allocation error!\n", __func__);
		return -ENOMEM;
	}

	debug("Board BAT init\n");

	p->interface = PMIC_NONE;
	p->name = name;
	p->bus = bus;

	p->pbat = &power_bat_trats2;
	return 0;
}
コード例 #14
0
int pmic_init(unsigned char bus)
{
	static const char name[] = "MAX77686_PMIC";
	struct pmic *p = pmic_alloc();

	if (!p) {
		printf("%s: POWER allocation error!\n", __func__);
		return -ENOMEM;
	}

	puts("Board PMIC init\n");
	p->name = name;
	p->interface = PMIC_I2C;
	p->number_of_regs = PMIC_NUM_OF_REGS;
	p->hw.i2c.addr = MAX77686_I2C_ADDR;
	p->hw.i2c.tx_num = 1;
	p->bus = bus;

	return 0;
}
コード例 #15
0
ファイル: pmic_rt5025.c プロジェクト: mq002/miqi-uboot
static int rt5025_parse_dt(const void* blob)
{
	int node, nd;
	u32 bus, addr;
	int ret;
	node = fdt_node_offset_by_compatible(blob,
					0, COMPAT_ROCKCHIP_RT5025);
	if (node < 0) {
		printf("can't find dts node for rt5025\n");
		return -ENODEV;
	}

	if (!fdt_device_is_available(blob,node)) {
		debug("device rt5025 is disabled\n");
		return -1;
	}
	
	ret = fdt_get_i2c_info(blob, node, &bus, &addr);
	if (ret < 0) {
		debug("pmic rt5025 get fdt i2c failed\n");
		return ret;
	}

	nd = rt5025_i2c_probe(bus, addr);
	if (nd < 0) {
		printf("pmic rt5025 i2c probe failed\n");
		return -1;
	}

	fdt_regulator_match(blob, nd, rt5025_reg_matches,
					RT5025_NUM_REGULATORS);
	
	rt5025.pmic = pmic_alloc();
	rt5025.node = node;
	rt5025.pmic->hw.i2c.addr = addr;
	rt5025.pmic->bus = bus;
	debug("rt5025 i2c_bus:%d addr:0x%02x\n", rt5025.pmic->bus,
		rt5025.pmic->hw.i2c.addr);

	return 0;
}
コード例 #16
0
ファイル: nxe2000_bat.c プロジェクト: iTOP4418/u-boot-2014.07
int power_nxe2000_bat_init(unsigned char bus)
{
	static const char name[] = "BAT_NXE2000";
	struct pmic *p = pmic_alloc();

	if (!p) {
		printf("%s: POWER allocation error!\n", __func__);
		return -ENOMEM;
	}

	debug("Board BAT init\n");

	p->name = name;
	p->interface = PMIC_I2C;
	p->number_of_regs = NXE2000_NUM_OF_REGS;
	p->hw.i2c.addr = NXE2000_I2C_ADDR;
	p->hw.i2c.tx_num = 1;
	p->bus = bus;

	p->pbat = &power_bat_nxe2000;
	return 0;
}
コード例 #17
0
ファイル: axp228_regu.c プロジェクト: projectnano/zeus
int power_regu_init(unsigned int bus)
{
	static const char name[] = "REGU_AXP228";
	struct pmic *p = pmic_alloc();

	PMIC_DBGOUT("%s\n", __func__);

	if (!p) {
		printf("%s: POWER allocation error!\n", __func__);
		return -ENOMEM;
	}

	p->name = name;
	p->interface = PMIC_I2C;
	p->number_of_regs = AXP228_NUM_OF_REGS;
	p->hw.i2c.addr = AXP228_I2C_ADDR;
	p->hw.i2c.tx_num = 1;
	p->bus = bus;

	p->regu = &power_regu_ops_axp228;
	return 0;
}
コード例 #18
0
ファイル: muic_max77693.c プロジェクト: 0s4l/u-boot-xlnx
int power_muic_init(unsigned int bus)
{
	static const char name[] = "MAX77693_MUIC";
	struct pmic *p = pmic_alloc();

	if (!p) {
		printf("%s: POWER allocation error!\n", __func__);
		return -ENOMEM;
	}

	debug("Board Micro USB Interface Controller init\n");

	p->name = name;
	p->interface = PMIC_I2C;
	p->number_of_regs = MUIC_NUM_OF_REGS;
	p->hw.i2c.addr = MAX77693_MUIC_I2C_ADDR;
	p->hw.i2c.tx_num = 1;
	p->bus = bus;

	p->chrg = &power_chrg_muic_ops;

	return 0;
}
コード例 #19
0
int pmic_88pm880_alloc(unsigned char bus, struct pmic_chip_desc *chip)
{
	struct pmic *p_base = pmic_alloc();
	struct pmic *p_gpadc = pmic_alloc();
	struct pmic *p_buck = pmic_alloc();
	struct pmic *p_ldo = pmic_alloc();
	struct pmic *p_power = pmic_alloc();
	struct pmic *p_led = pmic_alloc();
	if (!p_base || !p_gpadc || !p_ldo || !p_buck || !p_power) {
		printf("%s: pmic allocation error!\n", __func__);
		return -ENOMEM;
	}

	if (!chip) {
		printf("%s: chip description is empty!\n", __func__);
		return -EINVAL;
	}
	chip->base_name = MARVELL_PMIC_BASE;
	chip->buck_name = MARVELL_PMIC_BUCK;
	chip->ldo_name = MARVELL_PMIC_LDO;
	chip->power_name = MARVELL_PMIC_POWER;
	chip->gpadc_name = MARVELL_PMIC_GPADC;
	chip->led_name = MARVELL_PMIC_LED;
	chip->charger_name = MARVELL_PMIC_CHARGE;
	chip->fuelgauge_name = MARVELL_PMIC_FG;
	chip->battery_name = MARVELL_PMIC_BATTERY;

	p_base->bus = bus;
	p_base->hw.i2c.addr = MARVELL88PM_I2C_ADDR;
	p_base->name = MARVELL_PMIC_BASE;
	p_base->interface = PMIC_I2C;
	p_base->number_of_regs = PMIC_NUM_OF_REGS;
	p_base->hw.i2c.tx_num = 1;

	p_ldo->bus = bus;
	p_ldo->hw.i2c.addr = MARVELL88PM_I2C_ADDR + 1;
	p_ldo->name = MARVELL_PMIC_LDO;
	p_ldo->interface = PMIC_I2C;
	p_ldo->number_of_regs = PMIC_NUM_OF_REGS;
	p_ldo->hw.i2c.tx_num = 1;

	p_gpadc->bus = bus;
	p_gpadc->hw.i2c.addr = MARVELL88PM_I2C_ADDR + 2;
	p_gpadc->name = MARVELL_PMIC_GPADC;
	p_gpadc->interface = PMIC_I2C;
	p_gpadc->number_of_regs = PMIC_NUM_OF_REGS;
	p_gpadc->hw.i2c.tx_num = 1;

	p_led->bus = bus;
	p_led->hw.i2c.addr = MARVELL88PM_I2C_ADDR + 3;
	p_led->name = MARVELL_PMIC_LED;
	p_led->interface = PMIC_I2C;
	p_led->number_of_regs = PMIC_NUM_OF_REGS;
	p_led->hw.i2c.tx_num = 1;

	p_buck->bus = bus;
	p_buck->hw.i2c.addr = MARVELL88PM_I2C_ADDR + 4;
	p_buck->name = MARVELL_PMIC_BUCK;
	p_buck->interface = PMIC_I2C;
	p_buck->number_of_regs = PMIC_NUM_OF_REGS;
	p_buck->hw.i2c.tx_num = 1;

	/*
	 * dummy power page
	 * set the parameters as same as ldo
	 */
	p_power->bus = bus;
	p_power->hw.i2c.addr = MARVELL88PM_I2C_ADDR + 1;
	p_power->name = MARVELL_PMIC_POWER;
	p_power->interface = PMIC_I2C;
	p_power->number_of_regs = PMIC_NUM_OF_REGS;
	p_power->hw.i2c.tx_num = 1;

	/* get functions */
	chip->set_buck_vol = marvell88pm880_set_buck_vol;
	chip->set_ldo_vol = marvell88pm880_set_ldo_vol;
	chip->get_buck_vol = marvell88pm880_get_buck_vol;
	chip->reset_bd = marvell88pm880_reset_bd;

	puts("Board PMIC init\n");

	g_chip = chip;

	return 0;
}
コード例 #20
0
int pmic_88pm886_alloc(unsigned char bus, struct pmic_chip_desc *chip)
{
	struct pmic *p_base = pmic_alloc();
	struct pmic *p_power = pmic_alloc();
	struct pmic *p_gpadc = pmic_alloc();
	struct pmic *p_test = pmic_alloc();
	if (!p_base || !p_power || !p_gpadc || !p_test) {
		printf("%s: pmic allocation error!\n", __func__);
		return -ENOMEM;
	}

	if (!chip) {
		printf("%s: chip description is empty!\n", __func__);
		return -EINVAL;
	}
	chip->base_name = MARVELL_PMIC_BASE;
	chip->power_name = MARVELL_PMIC_POWER;
	chip->gpadc_name = MARVELL_PMIC_GPADC;
	chip->charger_name = MARVELL_PMIC_CHARGE;
	chip->fuelgauge_name = MARVELL_PMIC_FG;
	chip->battery_name = MARVELL_PMIC_BATTERY;

	p_base->bus = bus;
	p_base->hw.i2c.addr = MARVELL88PM_I2C_ADDR;
	p_base->name = MARVELL_PMIC_BASE;
	p_base->interface = PMIC_I2C;
	p_base->number_of_regs = PMIC_NUM_OF_REGS;
	p_base->hw.i2c.tx_num = 1;

	p_power->bus = bus;
	p_power->hw.i2c.addr = MARVELL88PM_I2C_ADDR + 1;
	p_power->name = MARVELL_PMIC_POWER;
	p_power->interface = PMIC_I2C;
	p_power->number_of_regs = PMIC_NUM_OF_REGS;
	p_power->hw.i2c.tx_num = 1;

	p_gpadc->bus = bus;
	p_gpadc->hw.i2c.addr = MARVELL88PM_I2C_ADDR + 2;
	p_gpadc->name = MARVELL_PMIC_GPADC;
	p_gpadc->interface = PMIC_I2C;
	p_gpadc->number_of_regs = PMIC_NUM_OF_REGS;
	p_gpadc->hw.i2c.tx_num = 1;

	/*
	 * this page is special, we just use it to apply some
	 * WA for pm886
	 */
	p_test->bus = bus;
	p_test->hw.i2c.addr = MARVELL88PM_I2C_ADDR + 7;
	p_test->name = MARVELL_PMIC_TEST;
	p_test->interface = PMIC_I2C;
	p_test->number_of_regs = PMIC_NUM_OF_REGS;
	p_test->hw.i2c.tx_num = 1;

	/* get functions */
	chip->set_buck_vol = marvell88pm886_set_buck_vol;
	chip->set_ldo_vol = marvell88pm886_set_ldo_vol;
	chip->get_buck_vol = marvell88pm886_get_buck_vol;
	chip->reset_bd = marvell88pm886_reset_bd;

	puts("Board PMIC init\n");

	g_chip = chip;

	return 0;
}