]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/freescale/common/pfuze.c
Merge branch 'master' of git://git.denx.de/u-boot-usb
[karo-tx-uboot.git] / board / freescale / common / pfuze.c
1 /*
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
11 struct 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 }