[U-Boot] [PATCH 04/10] power: Explicitly select pmic device's bus

Lukasz Majewski l.majewski at samsung.com
Mon Mar 31 08:17:23 CEST 2014


Hi Heiko,

> Hello Simon, Lukasz,
> 
> Am 30.03.2014 01:17, schrieb Simon Glass:
> > Hi Lukasz,
> >
> > On 27 March 2014 11:33, Lukasz Majewski<l.majewski at samsung.com>
> > wrote:
> >
> >> Hi Simon, Heiko
> >>
> >>> From: Aaron Durbin<adurbin at chromium.org>
> >>>
> >>> 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<adurbin at chromium.org>
> >>> Signed-off-by: Simon Glass<sjg at chromium.org>
> >>> Reviewed-by: Simon Glass<sjg at chromium.org>
> >>> ---
> >>>
> >>>   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?
> >>
> >
> > Agreed that would be ideal, but we would have to pass the bus
> > number of the i2c_read/write() functions. I don't believe the i2c
> > code has got that far yet.
> 
> Yes, thats the plan, but first, all i2c driver must be converted to
> the new framework. After that we could start with such an approach
> (or device model is ready and we can switch to it ...)

I know that there is a time line for introducing device model, but is
there any for switching I2C to the new approach? 

I think about deleting obsolete/unmaintained boards, which will not
switch to new I2C approach.

> 
> > Unfortunately it doesn't work without this patch.
> 
> Yes ...
> 
> If we have all i2c driver running with the new framework, we can get
> rid of I2C_SET_BUS defines, and simply use i2c_set_bus_num() which
> is a simple cleanup patch.

Ok, I see.

> 
> bye,
> Heiko



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group


More information about the U-Boot mailing list