From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Date: Thu, 27 Mar 2014 18:33:58 +0100 Subject: [U-Boot] [PATCH 04/10] power: Explicitly select pmic device's bus In-Reply-To: <1395856590-21917-5-git-send-email-sjg@chromium.org> References: <1395856590-21917-1-git-send-email-sjg@chromium.org> <1395856590-21917-5-git-send-email-sjg@chromium.org> Message-ID: <20140327183358.081efba4@amdc2363> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Simon, Heiko > From: Aaron Durbin > > The current pmic i2c code assumes the current i2c bus is > the same as the pmic device's bus. There is nothing ensuring > that to be true. Therefore, select the proper bus before performing > a transaction. > > Signed-off-by: Aaron Durbin > Signed-off-by: Simon Glass > Reviewed-by: Simon Glass > --- > > drivers/power/power_i2c.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/power/power_i2c.c b/drivers/power/power_i2c.c > index ac76870..594cd11 100644 > --- a/drivers/power/power_i2c.c > +++ b/drivers/power/power_i2c.c > @@ -23,6 +23,8 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val) > if (check_reg(p, reg)) > return -1; > > + I2C_SET_BUS(p->bus); > + Hadn't we had a discussion about this explicit setting of I2C some time ago? I thought that this problem was solved within the I2C rework. Also I might be wrong, so please correct me if I'm wrong. Isn't the I2C_SET_BUS() macro regarded as a obsolete after the I2C rework? > switch (pmic_i2c_tx_num) { > case 3: > if (p->sensor_byte_order == > PMIC_SENSOR_BYTE_ORDER_BIG) { @@ -66,6 +68,8 @@ int > pmic_reg_read(struct pmic *p, u32 reg, u32 *val) if (check_reg(p, > reg)) return -1; > > + I2C_SET_BUS(p->bus); > + > if (i2c_read(pmic_i2c_addr, reg, 1, buf, pmic_i2c_tx_num)) > return -1; > -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group