From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Mon, 13 Jul 2015 17:56:28 +0200 Subject: [U-Boot] [PATCH 12/16] cgtqmx6eval: Add PMIC support In-Reply-To: <1436800998-21248-12-git-send-email-otavio@ossystems.com.br> References: <1436800998-21248-1-git-send-email-otavio@ossystems.com.br> <1436800998-21248-12-git-send-email-otavio@ossystems.com.br> Message-ID: <201507131756.28655.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Monday, July 13, 2015 at 05:23:14 PM, Otavio Salvador wrote: > cgtqmx6eval has a PFUZE100 FSL PMIC connected to I2C2. > > Add support for it. > > Signed-off-by: Otavio Salvador > --- [..] > +/* 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) { Please trim down the indent hell here ... if (id2 < 0x20) return 0; ... if (!lv_mipi) return 0; for (...) { if (strcmp()) continue; } > + /* set level of MIPI if specified */ > + lv_mipi = getenv("lv_mipi"); > + if (lv_mipi) { > + 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; > +} > + [...]