blob: 2cd17944298b91b49d7b330e4b3c23af1786e0c2 [file] [log] [blame]
Ye.Li5051ff52014-11-06 16:28:59 +08001/*
2 * Copyright 2014 Freescale Semiconductor, Inc.
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <power/pmic.h>
9#include <power/pfuze100_pmic.h>
10
11struct pmic *pfuze_common_init(unsigned char i2cbus)
12{
13 struct pmic *p;
14 int ret;
15 unsigned int reg;
16
17 ret = power_pfuze100_init(i2cbus);
18 if (ret)
19 return NULL;
20
21 p = pmic_get("PFUZE100");
22 ret = pmic_probe(p);
23 if (ret)
24 return NULL;
25
26 pmic_reg_read(p, PFUZE100_DEVICEID, &reg);
27 printf("PMIC: PFUZE100 ID=0x%02x\n", reg);
28
29 /* Set SW1AB stanby volage to 0.975V */
30 pmic_reg_read(p, PFUZE100_SW1ABSTBY, &reg);
31 reg &= ~SW1x_STBY_MASK;
32 reg |= SW1x_0_975V;
33 pmic_reg_write(p, PFUZE100_SW1ABSTBY, reg);
34
35 /* Set SW1AB/VDDARM step ramp up time from 16us to 4us/25mV */
36 pmic_reg_read(p, PUZE_100_SW1ABCONF, &reg);
37 reg &= ~SW1xCONF_DVSSPEED_MASK;
38 reg |= SW1xCONF_DVSSPEED_4US;
39 pmic_reg_write(p, PUZE_100_SW1ABCONF, reg);
40
41 /* Set SW1C standby voltage to 0.975V */
42 pmic_reg_read(p, PFUZE100_SW1CSTBY, &reg);
43 reg &= ~SW1x_STBY_MASK;
44 reg |= SW1x_0_975V;
45 pmic_reg_write(p, PFUZE100_SW1CSTBY, reg);
46
47 /* Set SW1C/VDDSOC step ramp up time from 16us to 4us/25mV */
48 pmic_reg_read(p, PFUZE100_SW1CCONF, &reg);
49 reg &= ~SW1xCONF_DVSSPEED_MASK;
50 reg |= SW1xCONF_DVSSPEED_4US;
51 pmic_reg_write(p, PFUZE100_SW1CCONF, reg);
52
53 return p;
54}