Message ID | 1412801889-14400-50-git-send-email-jeroen@myspectrum.nl |
---|---|
State | Accepted |
Delegated to: | Tom Rini |
Headers | show |
Hello Jeroen, Am 08.10.2014 22:58, schrieb Jeroen Hofstee: > Include the i2c header and change the non confirming > functions to do so. > > Cc: Heiko Schocher<hs@denx.de> > Signed-off-by: Jeroen Hofstee<jeroen@myspectrum.nl> > --- > drivers/i2c/designware_i2c.c | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) Acked-by: Heiko Schocher <hs@denx.de> (It would be nice to see this driver also moved to the CONFIG_SYS_I2C framework ... seeing a "CONFIG_I2C_MULTI_BUS" define in it is very bad ...) bye, Heiko
Hello Heiko, On 09-10-14 07:05, Heiko Schocher wrote: > Hello Jeroen, > > Am 08.10.2014 22:58, schrieb Jeroen Hofstee: >> Include the i2c header and change the non confirming >> functions to do so. >> >> Cc: Heiko Schocher<hs@denx.de> >> Signed-off-by: Jeroen Hofstee<jeroen@myspectrum.nl> >> --- >> drivers/i2c/designware_i2c.c | 17 +++++++++++------ >> 1 file changed, 11 insertions(+), 6 deletions(-) > > Acked-by: Heiko Schocher <hs@denx.de> > > (It would be nice to see this driver also moved to the > CONFIG_SYS_I2C framework ... seeing a "CONFIG_I2C_MULTI_BUS" > define in it is very bad ...) > Likely, but I happily leave that to someone who can actually test the code and has a better understanding of the (new?) i2c model ;) Regards, Jeroen
On Wed, Oct 08, 2014 at 10:58:09PM +0200, Jeroen Hofstee wrote: > Include the i2c header and change the non confirming > functions to do so. > > Cc: Heiko Schocher <hs@denx.de> > Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl> > Acked-by: Heiko Schocher <hs@denx.de> After also fixing the i2c_get_bus_num prototype, applied to u-boot/master, thanks!
diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c index c891ebd..eb43597 100644 --- a/drivers/i2c/designware_i2c.c +++ b/drivers/i2c/designware_i2c.c @@ -8,6 +8,7 @@ #include <common.h> #include <asm/io.h> #include "designware_i2c.h" +#include <i2c.h> #ifdef CONFIG_I2C_MULTI_BUS static unsigned int bus_initialized[CONFIG_SYS_I2C_BUS_MAX]; @@ -76,16 +77,20 @@ static void set_speed(int i2c_spd) * * Set the i2c speed. */ -int i2c_set_bus_speed(int speed) +int i2c_set_bus_speed(unsigned int speed) { + int i2c_spd; + if (speed >= I2C_MAX_SPEED) - set_speed(IC_SPEED_MODE_MAX); + i2c_spd = IC_SPEED_MODE_MAX; else if (speed >= I2C_FAST_SPEED) - set_speed(IC_SPEED_MODE_FAST); + i2c_spd = IC_SPEED_MODE_FAST; else - set_speed(IC_SPEED_MODE_STANDARD); + i2c_spd = IC_SPEED_MODE_STANDARD; - return 0; + set_speed(i2c_spd); + + return i2c_spd; } /* @@ -93,7 +98,7 @@ int i2c_set_bus_speed(int speed) * * Gets the i2c speed. */ -int i2c_get_bus_speed(void) +unsigned int i2c_get_bus_speed(void) { u32 cntl;
Include the i2c header and change the non confirming functions to do so. Cc: Heiko Schocher <hs@denx.de> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl> --- drivers/i2c/designware_i2c.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)