diff options
author | Jeroen Hofstee <jeroen@myspectrum.nl> | 2014-10-08 22:58:09 +0200 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-10-25 15:27:37 -0400 |
commit | c69ecd9722af22d50295eff81d0b9cd5b8adc2e0 (patch) | |
tree | 544ec82832a75bbca5c3b099b6180b30c5d294ae /drivers/i2c | |
parent | 7b8119ddf5b7bee275950b2469dc34a731e709f4 (diff) | |
download | u-boot-imx-c69ecd9722af22d50295eff81d0b9cd5b8adc2e0.zip u-boot-imx-c69ecd9722af22d50295eff81d0b9cd5b8adc2e0.tar.gz u-boot-imx-c69ecd9722af22d50295eff81d0b9cd5b8adc2e0.tar.bz2 |
i2c: designware: add an implement i2c protos
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>
[trini: Fix i2c_get_bus_num prototype]
Signed-off-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/designware_i2c.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c index c891ebd..e085a70 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; @@ -429,7 +434,7 @@ int i2c_set_bus_num(unsigned int bus) return 0; } -int i2c_get_bus_num(void) +unsigned int i2c_get_bus_num(void) { return current_bus; } |