/* setup board specific PMIC */ int power_init_board(void) { struct pmic *p; u32 reg; int ret; power_pfuze100_init(1); p = pmic_get("PFUZE100"); if (!p) return -EINVAL; ret = pmic_probe(p); if (ret) return ret; pmic_reg_read(p, PFUZE100_DEVICEID, ®); printf("PMIC: PFUZE100 ID=0x%02x\n", reg); /* Set SWBST to 5.0V and enable (for USB) */ pmic_reg_read(p, PFUZE100_SWBSTCON1, ®); reg &= ~(SWBST_MODE_MASK | SWBST_VOL_MASK); reg |= (SWBST_5_00V | SWBST_MODE_AUTO); pmic_reg_write(p, PFUZE100_SWBSTCON1, reg); return 0; }
int power_init_board(void) { struct pmic *p; int ret; unsigned int reg; ret = power_pfuze100_init(I2C_PMIC); if (ret) return ret; p = pmic_get("PFUZE100"); ret = pmic_probe(p); if (ret) return ret; pmic_reg_read(p, PFUZE100_DEVICEID, ®); printf("PMIC: PFUZE100 ID=0x%02x\n", reg); /* Increase VGEN3 from 2.5 to 2.8V */ pmic_reg_read(p, PFUZE100_VGEN3VOL, ®); reg &= ~LDO_VOL_MASK; reg |= LDOB_2_80V; pmic_reg_write(p, PFUZE100_VGEN3VOL, reg); /* Increase VGEN5 from 2.8 to 3V */ pmic_reg_read(p, PFUZE100_VGEN5VOL, ®); reg &= ~LDO_VOL_MASK; reg |= LDOB_3_00V; pmic_reg_write(p, PFUZE100_VGEN5VOL, reg); /* Set SW1AB stanby volage to 0.975V */ pmic_reg_read(p, PFUZE100_SW1ABSTBY, ®); reg &= ~SW1x_STBY_MASK; reg |= SW1x_0_975V; pmic_reg_write(p, PFUZE100_SW1ABSTBY, reg); /* Set SW1AB/VDDARM step ramp up time from 16us to 4us/25mV */ pmic_reg_read(p, PFUZE100_SW1ABCONF, ®); reg &= ~SW1xCONF_DVSSPEED_MASK; reg |= SW1xCONF_DVSSPEED_4US; pmic_reg_write(p, PFUZE100_SW1ABCONF, reg); /* Set SW1C standby voltage to 0.975V */ pmic_reg_read(p, PFUZE100_SW1CSTBY, ®); reg &= ~SW1x_STBY_MASK; reg |= SW1x_0_975V; pmic_reg_write(p, PFUZE100_SW1CSTBY, reg); /* Set SW1C/VDDSOC step ramp up time from 16us to 4us/25mV */ pmic_reg_read(p, PFUZE100_SW1CCONF, ®); reg &= ~SW1xCONF_DVSSPEED_MASK; reg |= SW1xCONF_DVSSPEED_4US; pmic_reg_write(p, PFUZE100_SW1CCONF, reg); return 0; }
static int pfuze_init(void) { struct pmic *p; int ret; unsigned int reg; ret = power_pfuze100_init(I2C_PMIC); if (ret) return ret; p = pmic_get("PFUZE100"); ret = pmic_probe(p); if (ret) return ret; pmic_reg_read(p, PFUZE100_DEVICEID, ®); printf("PMIC: PFUZE100 ID=0x%02x\n", reg); /* Set SW1AB standby voltage to 0.975V */ pmic_reg_read(p, PFUZE100_SW1ABSTBY, ®); reg &= ~0x3f; reg |= 0x1b; pmic_reg_write(p, PFUZE100_SW1ABSTBY, reg); /* Set SW1AB/VDDARM step ramp up time from 16us to 4us/25mV */ pmic_reg_read(p, PUZE_100_SW1ABCONF, ®); reg &= ~0xc0; reg |= 0x40; pmic_reg_write(p, PUZE_100_SW1ABCONF, reg); /* Set SW1C standby voltage to 0.975V */ pmic_reg_read(p, PFUZE100_SW1CSTBY, ®); reg &= ~0x3f; reg |= 0x1b; pmic_reg_write(p, PFUZE100_SW1CSTBY, reg); /* Set SW1C/VDDSOC step ramp up time from 16us to 4us/25mV */ pmic_reg_read(p, PFUZE100_SW1CCONF, ®); reg &= ~0xc0; reg |= 0x40; pmic_reg_write(p, PFUZE100_SW1CCONF, reg); /* Enable power of VGEN5 3V3, needed for SD3 */ pmic_reg_read(p, PFUZE100_VGEN5VOL, ®); reg &= ~0x1F; reg |= 0x1F; pmic_reg_write(p, PFUZE100_VGEN5VOL, reg); return 0; }
/* setup board specific PMIC */ int power_init_board(void) { struct pmic *p; u32 id1, id2, i; int ret; char const *lv_mipi; /* configure I2C multiplexer */ gpio_direction_output(MX6Q_QMX6_PFUZE_MUX, 1); power_pfuze100_init(I2C_PMIC); p = pmic_get("PFUZE100"); if (!p) return -EINVAL; ret = pmic_probe(p); if (ret) return ret; pmic_reg_read(p, PFUZE100_DEVICEID, &id1); pmic_reg_read(p, PFUZE100_REVID, &id2); printf("PFUZE100 Rev. [%02x/%02x] detected\n", id1, id2); if (id2 >= 0x20) return 0; /* set level of MIPI if specified */ lv_mipi = getenv("lv_mipi"); if (lv_mipi) return 0; for (i = 0; i < ARRAY_SIZE(mipi_levels); i++) { if (!strcmp(mipi_levels[i].name, lv_mipi)) { printf("set MIPI level %s\n", mipi_levels[i].name); ret = pmic_reg_write(p, PFUZE100_VGEN4VOL, mipi_levels[i].value); if (ret) return ret; } } return 0; }
struct pmic *pfuze_common_init(unsigned char i2cbus) { struct pmic *p; int ret; unsigned int reg; ret = power_pfuze100_init(i2cbus); if (ret) return NULL; p = pmic_get("PFUZE100"); ret = pmic_probe(p); if (ret) return NULL; pmic_reg_read(p, PFUZE100_DEVICEID, ®); printf("PMIC: PFUZE100 ID=0x%02x\n", reg); /* Set SW1AB stanby volage to 0.975V */ pmic_reg_read(p, PFUZE100_SW1ABSTBY, ®); reg &= ~SW1x_STBY_MASK; reg |= SW1x_0_975V; pmic_reg_write(p, PFUZE100_SW1ABSTBY, reg); /* Set SW1AB/VDDARM step ramp up time from 16us to 4us/25mV */ pmic_reg_read(p, PFUZE100_SW1ABCONF, ®); reg &= ~SW1xCONF_DVSSPEED_MASK; reg |= SW1xCONF_DVSSPEED_4US; pmic_reg_write(p, PFUZE100_SW1ABCONF, reg); /* Set SW1C standby voltage to 0.975V */ pmic_reg_read(p, PFUZE100_SW1CSTBY, ®); reg &= ~SW1x_STBY_MASK; reg |= SW1x_0_975V; pmic_reg_write(p, PFUZE100_SW1CSTBY, reg); /* Set SW1C/VDDSOC step ramp up time from 16us to 4us/25mV */ pmic_reg_read(p, PFUZE100_SW1CCONF, ®); reg &= ~SW1xCONF_DVSSPEED_MASK; reg |= SW1xCONF_DVSSPEED_4US; pmic_reg_write(p, PFUZE100_SW1CCONF, reg); return p; }
int board_late_init(void) { struct pmic *p; u32 reg; setenv("board_name", tqma6_get_boardname()); /* * configure PFUZE100 PMIC: * TODO: should go to power_init_board if bus switching is * fixed in generic power code */ power_pfuze100_init(TQMA6_PFUZE100_I2C_BUS); p = pmic_get("PFUZE100"); if (p && !pmic_probe(p)) { pmic_reg_read(p, PFUZE100_DEVICEID, ®); printf("PMIC: PFUZE100 ID=0x%02x\n", reg); } tqma6_bb_board_late_init(); return 0; }
int power_init_board(void) { struct pmic *p; int ret; unsigned int reg; ret = power_pfuze100_init(I2C_PMIC); if (ret) return -ENODEV; p = pmic_get("PFUZE100"); ret = pmic_probe(p); if (ret) return -ENODEV; pmic_reg_read(p, PFUZE100_DEVICEID, ®); printf("PMIC: PFUZE100 ID=0x%02x\n", reg); pmic_reg_read(p, PFUZE100_SW3AVOL, ®); if ((reg & 0x3f) != 0x18) { reg &= ~0x3f; reg |= 0x18; pmic_reg_write(p, PFUZE100_SW3AVOL, reg); } ret = pfuze_mode_init(p, APS_PFM); if (ret < 0) return ret; /* set SW3A standby mode to off */ pmic_reg_read(p, PFUZE100_SW3AMODE, ®); reg &= ~0xf; reg |= APS_OFF; pmic_reg_write(p, PFUZE100_SW3AMODE, reg); return 0; }
/* setup board specific PMIC */ void setup_pmic(void) { struct pmic *p; u32 reg; i2c_set_bus_num(CONFIG_I2C_PMIC); /* configure PFUZE100 PMIC */ if (!i2c_probe(CONFIG_POWER_PFUZE100_I2C_ADDR)) { debug("probed PFUZE100@0x%x\n", CONFIG_POWER_PFUZE100_I2C_ADDR); power_pfuze100_init(CONFIG_I2C_PMIC); p = pmic_get("PFUZE100"); if (p && !pmic_probe(p)) { pmic_reg_read(p, PFUZE100_DEVICEID, ®); printf("PMIC: PFUZE100 ID=0x%02x\n", reg); /* Set VGEN1 to 1.5V and enable */ pmic_reg_read(p, PFUZE100_VGEN1VOL, ®); reg &= ~(LDO_VOL_MASK); reg |= (LDOA_1_50V | LDO_EN); pmic_reg_write(p, PFUZE100_VGEN1VOL, reg); /* Set SWBST to 5.0V and enable */ pmic_reg_read(p, PFUZE100_SWBSTCON1, ®); reg &= ~(SWBST_MODE_MASK | SWBST_VOL_MASK); reg |= (SWBST_5_00V | (SWBST_MODE_AUTO << SWBST_MODE_SHIFT)); pmic_reg_write(p, PFUZE100_SWBSTCON1, reg); } } /* configure LTC3676 PMIC */ else if (!i2c_probe(CONFIG_POWER_LTC3676_I2C_ADDR)) { debug("probed LTC3676@0x%x\n", CONFIG_POWER_LTC3676_I2C_ADDR); power_ltc3676_init(CONFIG_I2C_PMIC); p = pmic_get("LTC3676_PMIC"); if (p && !pmic_probe(p)) { puts("PMIC: LTC3676\n"); /* * set board-specific scalar for max CPU frequency * per CPU based on the LDO enabled Operating Ranges * defined in the respective IMX6DQ and IMX6SDL * datasheets. The voltage resulting from the R1/R2 * feedback inputs on Ventana is 1308mV. Note that this * is a bit shy of the Vmin of 1350mV in the datasheet * for LDO enabled mode but is as high as we can go. * * We will rely on an OS kernel driver to properly * regulate these per CPU operating point and use LDO * bypass mode when using the higher frequency * operating points to compensate as LDO bypass mode * allows the rails be 125mV lower. */ /* mask PGOOD during SW1 transition */ pmic_reg_write(p, LTC3676_DVB1B, 0x1f | LTC3676_PGOOD_MASK); /* set SW1 (VDD_SOC) */ pmic_reg_write(p, LTC3676_DVB1A, 0x1f); /* mask PGOOD during SW3 transition */ pmic_reg_write(p, LTC3676_DVB3B, 0x1f | LTC3676_PGOOD_MASK); /* set SW3 (VDD_ARM) */ pmic_reg_write(p, LTC3676_DVB3A, 0x1f); } } }
int power_init_board(void) { int ret; u32 rev_id, value; ret = power_pfuze100_init(I2C_PMIC); if (ret) return ret; pfuze = pmic_get("PFUZE100"); if (!pfuze) return -ENODEV; ret = pmic_probe(pfuze); if (ret) return ret; ret = pfuze_mode_init(pfuze, APS_PFM); if (ret < 0) return ret; pmic_reg_read(pfuze, PFUZE100_DEVICEID, &value); pmic_reg_read(pfuze, PFUZE100_REVID, &rev_id); printf("PMIC: PFUZE200! DEV_ID=0x%x REV_ID=0x%x\n", value, rev_id); /* * Our PFUZE0200 is PMPF0200X0AEP, the Pre-programmed OTP * Configuration is F0. * Default VOLT: * VSNVS_VOLT | 3.0V * SW1AB | 1.375V * SW2 | 3.3V * SW3A | 1.5V * SW3B | 1.5V * VGEN1 | 1.5V * VGEN2 | 1.5V * VGEN3 | 2.5V * VGEN4 | 1.8V * VGEN5 | 2.8V * VGEN6 | 3.3V * * According to schematic, we need SW3A 1.35V, SW3B 3.3V, * VGEN1 1.2V, VGEN2 1.5V, VGEN3 2.8V, VGEN4 1.8V, * VGEN5 3.3V, VGEN6 3.0V. * * Here we just use the default VOLT, but not configure * them, when needed, configure them to our requested voltage. */ /* set SW1AB standby volatage 1.3V */ pmic_reg_read(pfuze, PFUZE100_SW1ABSTBY, &value); value &= ~0x3f; value |= PFUZE100_SW1ABC_SETP(13000); pmic_reg_write(pfuze, PFUZE100_SW1ABSTBY, value); /* set SW1AB/VDDARM step ramp up time from 16us to 4us/25mV */ pmic_reg_read(pfuze, PFUZE100_SW1ABCONF, &value); value &= ~0xc0; value |= 0x40; pmic_reg_write(pfuze, PFUZE100_SW1ABCONF, value); /* Enable power of VGEN5 3V3 */ pmic_reg_read(pfuze, PFUZE100_VGEN5VOL, &value); value &= ~0x1F; value |= 0x1F; pmic_reg_write(pfuze, PFUZE100_VGEN5VOL, value); return 0; }