mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-03-17 23:37:01 +00:00
i2c: designware_i2c: Use an enum for selected speed mode
Group these #defines into an enum to make it easier to understand the relationship between them. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jun Chen <ptchentw@gmail.com> Reviewed-by: Heiko Schocher <hs@denx.de>
This commit is contained in:
parent
6db7943b92
commit
65190d15ef
2 changed files with 8 additions and 4 deletions
|
@ -57,10 +57,10 @@ static unsigned int __dw_i2c_set_bus_speed(struct i2c_regs *i2c_base,
|
|||
unsigned int speed,
|
||||
unsigned int bus_mhz)
|
||||
{
|
||||
enum i2c_speed_mode i2c_spd;
|
||||
unsigned int cntl;
|
||||
unsigned int hcnt, lcnt;
|
||||
unsigned int ena;
|
||||
int i2c_spd;
|
||||
|
||||
/* Allow high speed if there is no config, or the config allows it */
|
||||
if (speed >= I2C_HIGH_SPEED &&
|
||||
|
|
|
@ -136,9 +136,13 @@ struct i2c_regs {
|
|||
#define IC_STATUS_ACT 0x0001
|
||||
|
||||
/* Speed Selection */
|
||||
#define IC_SPEED_MODE_STANDARD 1
|
||||
#define IC_SPEED_MODE_FAST 2
|
||||
#define IC_SPEED_MODE_HIGH 3
|
||||
enum i2c_speed_mode {
|
||||
IC_SPEED_MODE_STANDARD,
|
||||
IC_SPEED_MODE_FAST,
|
||||
IC_SPEED_MODE_HIGH,
|
||||
|
||||
IC_SPEED_MODE_COUNT,
|
||||
};
|
||||
|
||||
#define I2C_HIGH_SPEED 3400000
|
||||
#define I2C_FAST_SPEED 400000
|
||||
|
|
Loading…
Add table
Reference in a new issue