From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Thu, 30 Dec 2010 17:49:06 +0100 Subject: [U-Boot] [PATCH v3 6/8] fsl_pmic: add I2C interface support In-Reply-To: <1293626331-18644-9-git-send-email-r64343@freescale.com> References: <1293626331-18644-1-git-send-email-r64343@freescale.com> <1293626331-18644-9-git-send-email-r64343@freescale.com> Message-ID: <4D1CB802.6060202@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 12/29/2010 01:38 PM, Jason Liu wrote: > This patch add I2C interface for fsl_pmic driver support > > Signed-off-by: Jason Liu > > --- > Changes for v2: > - Address the comments from Stefano, > - factor out the param_check in pmic_reg for both spi/i2c > --- > drivers/misc/fsl_pmic.c | 52 ++++++++++++++++++++++++++++++++++++++++++---- > 1 files changed, 47 insertions(+), 5 deletions(-) > Hi Jason, > + > + if (init_done == 0) { > + i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); > + init_done = 1; > + } As I can see, i2c_init is called during initialization in arch/arm/lib/board.c. Why do we need to call it again ? > + if (write) { > + buf[0] = (val >> 16) & 0xff; > + buf[1] = (val >> 8) & 0xff; > + buf[2] = (val) & 0xff; > + if (i2c_write(CONFIG_SYS_FSL_PMIC_I2C_ADDR, reg, 1, buf, 3)) > + return -1; > + } else { > + if (i2c_read(CONFIG_SYS_FSL_PMIC_I2C_ADDR, reg, 1, buf, 3)) { > + return -1; > + ret_val = buf[0] << 16 | buf[1] << 8 | buf[2]; > + } I am wondering if it works. The line with ret_val is never reached. Do you tested it ? Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================