diff mbox

[U-Boot,03/16] pmic:max8997: Switch the MAX8997 PMIC to be used with multibus I2C

Message ID 1347637215-4830-4-git-send-email-l.majewski@samsung.com
State Superseded
Delegated to: Minkyu Kang
Headers show

Commit Message

Ɓukasz Majewski Sept. 14, 2012, 3:40 p.m. UTC
PMIC MAX8997 is now ready to work with single and multibus soft I2C
implementation.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/misc/pmic_max8997.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Stefano Babic Sept. 17, 2012, 9:36 a.m. UTC | #1
On 14/09/2012 17:40, Lukasz Majewski wrote:
> PMIC MAX8997 is now ready to work with single and multibus soft I2C
> implementation.
> 
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/misc/pmic_max8997.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/misc/pmic_max8997.c b/drivers/misc/pmic_max8997.c
> index 62dbc05..4943f66 100644
> --- a/drivers/misc/pmic_max8997.c
> +++ b/drivers/misc/pmic_max8997.c
> @@ -24,6 +24,7 @@
>  #include <common.h>
>  #include <pmic.h>
>  #include <max8997_pmic.h>
> +#include <i2c.h>
>  
>  int pmic_init(void)
>  {
> @@ -37,7 +38,7 @@ int pmic_init(void)
>  	p->number_of_regs = PMIC_NUM_OF_REGS;
>  	p->hw.i2c.addr = MAX8997_I2C_ADDR;
>  	p->hw.i2c.tx_num = 1;
> -	p->bus = I2C_PMIC;
> +	p->bus = I2C_0;
>  

I do not see so useful to add an enum for each instance of the I2C bus.
And we have to add it if the number of i2c busses grows. IMHO it is
better to use directly the constant, so later in another patch
pmic_init(5) instead of pmic(I2C_5).

Regards,
Stefano Babic
Lukasz Majewski Sept. 17, 2012, 8:46 p.m. UTC | #2
Hi Stefano,

> On 14/09/2012 17:40, Lukasz Majewski wrote:
> > PMIC MAX8997 is now ready to work with single and multibus soft I2C
> > implementation.
> > 
> > Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > ---
> >  drivers/misc/pmic_max8997.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/misc/pmic_max8997.c
> > b/drivers/misc/pmic_max8997.c index 62dbc05..4943f66 100644
> > --- a/drivers/misc/pmic_max8997.c
> > +++ b/drivers/misc/pmic_max8997.c
> > @@ -24,6 +24,7 @@
> >  #include <common.h>
> >  #include <pmic.h>
> >  #include <max8997_pmic.h>
> > +#include <i2c.h>
> >  
> >  int pmic_init(void)
> >  {
> > @@ -37,7 +38,7 @@ int pmic_init(void)
> >  	p->number_of_regs = PMIC_NUM_OF_REGS;
> >  	p->hw.i2c.addr = MAX8997_I2C_ADDR;
> >  	p->hw.i2c.tx_num = 1;
> > -	p->bus = I2C_PMIC;
> > +	p->bus = I2C_0;
> >  
> 
> I do not see so useful to add an enum for each instance of the I2C
> bus. And we have to add it if the number of i2c busses grows. IMHO it
> is better to use directly the constant, so later in another patch
> pmic_init(5) instead of pmic(I2C_5).
> 

This problem has been already discussed with Heiko:

http://patchwork.ozlabs.org/patch/181789/

I think, that we will have to have an enum of available I2C_x busses at
<i2c.h> header file.

In the case of Trats and PMIC framework, the I2C_0 is done on purpose
to keep the trats board working (since the PMIC is in reality connected
to I2C_5). This numbering (I2C_0) needs to be there until prerequisite
patches aren't accepted (the multibus I2C support on trats board)

Regards,
Lukasz Majewski
diff mbox

Patch

diff --git a/drivers/misc/pmic_max8997.c b/drivers/misc/pmic_max8997.c
index 62dbc05..4943f66 100644
--- a/drivers/misc/pmic_max8997.c
+++ b/drivers/misc/pmic_max8997.c
@@ -24,6 +24,7 @@ 
 #include <common.h>
 #include <pmic.h>
 #include <max8997_pmic.h>
+#include <i2c.h>
 
 int pmic_init(void)
 {
@@ -37,7 +38,7 @@  int pmic_init(void)
 	p->number_of_regs = PMIC_NUM_OF_REGS;
 	p->hw.i2c.addr = MAX8997_I2C_ADDR;
 	p->hw.i2c.tx_num = 1;
-	p->bus = I2C_PMIC;
+	p->bus = I2C_0;
 
 	return 0;
 }