1
0
Fork 0

Move pf100 debug output into separate function, dump SW4 and OTP register values

utp
Martin T. H. Sandsmark 2016-10-19 10:34:59 +02:00
parent afaeaaec02
commit be004af0e7
2 changed files with 67 additions and 19 deletions

View File

@ -272,6 +272,45 @@ struct i2c_pads_info i2c_pad_info1 = {
},
};
static void pfuze100_dump(struct pmic *p)
{
unsigned int reg;
pmic_reg_read(p, PFUZE100_DEVICEID, &reg);
/* Interrupt registers, reason for poweroff etc. */
pmic_reg_read(p, PFUZE100_INTSTAT0, &reg);
printf("PMIC: INTSTAT0: %x\n", reg);
pmic_reg_read(p, PFUZE100_INTSTAT1, &reg);
printf("PMIC: INTSTAT1: %x\n", reg);
pmic_reg_read(p, PFUZE100_INTSTAT3, &reg);
printf("PMIC: INTSTAT3: %x\n", reg);
pmic_reg_read(p, PFUZE100_INTSTAT4, &reg);
printf("PMIC: INTSTAT4: %x\n", reg);
/* Switch to extended register page for OTP SW4 voltage */
reg = PFUZE100_PAGE_EXT1;
pmic_reg_write(p, PFUZE100_PAGESELECT, reg);
/* Read set SW4 voltage from OTP register */
pmic_reg_read(p, PFUZE100_SW4OTPVOLT, &reg);
printf("PMIC: SW4 OTP volt before: %x\n", reg);
/* Check fuse settings */
pmic_reg_read(p, PFUZE100_OTP_FUZE_POR1, &reg);
printf("PMIC: POR1: %x\n", reg);
pmic_reg_read(p, PFUZE100_OTP_FUZE_POR_XOR, &reg);
printf("PMIC: POR XOR: %x\n", reg);
/* Switch back to normal pages */
reg = PFUZE100_PAGE_FUNC;
pmic_reg_write(p, PFUZE100_PAGESELECT, reg);
/* Read from normal register */
pmic_reg_read(p, PFUZE100_SW4VOL, &reg);
printf("First SW4 voltage from reg: %x\n", reg);
}
int power_init_board(void)
{
struct pmic *p;
@ -286,11 +325,10 @@ int power_init_board(void)
p = pmic_get("PFUZE100");
ret = pmic_probe(p);
if (ret)
if (ret) {
printf("PMIC: Unable to find PFUZE100!\n");
return ret;
pmic_reg_read(p, PFUZE100_DEVICEID, &reg);
printf("PMIC: PFUZE100 ID=0x%02x\n", reg);
}
/* Set SW1AB stanby volage to 0.975V */
pmic_reg_read(p, PFUZE100_SW1ABSTBY, &reg);
@ -316,15 +354,6 @@ int power_init_board(void)
reg |= SW1xCONF_DVSSPEED_4US;
pmic_reg_write(p, PFUZE100_SW1CCONF, reg);
pmic_reg_read(p, PFUZE100_INTSTAT0, &reg);
printf("INSTAT0: %x\n", reg);
pmic_reg_read(p, PFUZE100_INTSTAT1, &reg);
printf("INSTAT1: %x\n", reg);
pmic_reg_read(p, PFUZE100_INTSTAT3, &reg);
printf("INSTAT3: %x\n", reg);
pmic_reg_read(p, PFUZE100_INTSTAT4, &reg);
printf("INSTAT4: %x\n", reg);
/* Set 3V3_SW4 voltage to 3.3V */
pmic_reg_read(p, PFUZE100_SW4VOL, &reg);
reg &= ~SW4_VOL_MASK;
@ -337,11 +366,10 @@ int power_init_board(void)
reg |= LDOB_3_30V;
pmic_reg_write(p, PFUZE100_VGEN6VOL, reg);
/* Set modes */
/* Get ID, verify it is a supported version */
pmic_reg_read(p, PFUZE100_DEVICEID, &id);
id = id & 0xf;
printf("PMIC: PFUZE100 ID=0x%02x\n", id);
if (id == 0) {
switch_num = 6;
offset = PFUZE100_SW1CMODE;
@ -349,10 +377,11 @@ int power_init_board(void)
switch_num = 4;
offset = PFUZE100_SW2MODE;
} else {
printf("Not supported, id=%d\n", id);
printf("PMIC: PFUZE100 ID not supported, id=%d\n", id);
return -EINVAL;
}
/* Set modes */
ret = pmic_reg_write(p, PFUZE100_SW1ABMODE, APS_PFM);
if (ret < 0) {
printf("Set SW1AB mode error!\n");
@ -368,6 +397,9 @@ int power_init_board(void)
}
}
/* Dump some values from registers for debugging */
pfuze100_dump(p);
return ret;
}

View File

@ -75,7 +75,19 @@ enum {
PFUZE100_VGEN5VOL = 0x70,
PFUZE100_VGEN6VOL = 0x71,
PFUZE100_NUM_OF_REGS = 0x7f,
PFUZE100_PAGESELECT = 0x7f,
PFUZE100_SW4OTPVOLT = 0xb8,
PFUZE100_OTP_FUZE_POR1 = 0xe4,
PFUZE100_OTP_FUZE_POR_XOR = 0xe7,
/* Normal/page 1 registers */
/*PFUZE100_NUM_OF_REGS = 0x7f,*/
/* All, including extended/page 2 registers */
PFUZE100_NUM_OF_REGS = 0xfa,
};
/* Registor offset based on VOLT register */
@ -85,6 +97,10 @@ enum {
#define PFUZE100_MODE_OFFSET 3
#define PFUZE100_CONF_OFFSET 4
#define PFUZE100_PAGE_FUNC 0x0
#define PFUZE100_PAGE_EXT1 0x1
#define PFUZE100_PAGE_EXT2 0x2
/*
* Buck Regulators
*/
@ -94,7 +110,7 @@ enum {
/* SW4 Output Voltage Configuration */
#define SW4_1_800V 56
#define SW4_3_300V 114
#define SW4_VOL_MASK 0x3F
#define SW4_VOL_MASK 0x7F
/* SW1A/B/C Output Voltage Configuration */
#define SW1x_0_300V 0