diff mbox series

[v2,15/19] i2c: designware_i2c: Update to use standard enums for speed

Message ID 20200103152643.v2.15.I11ecfba19a6dd28e3ef56df374db8c3c104cbe3d@changeid
State Superseded
Headers show
Series i2c: designware_ic2: Improvements to timing and general cleanup | expand

Commit Message

Simon Glass Jan. 3, 2020, 10:26 p.m. UTC
Update this driver to use the new standard enums for speed.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2: None

 drivers/i2c/designware_i2c.c | 10 +++++-----
 drivers/i2c/designware_i2c.h | 13 -------------
 2 files changed, 5 insertions(+), 18 deletions(-)

Comments

Heiko Schocher Jan. 16, 2020, 7:03 a.m. UTC | #1
Hello Simon,

Am 03.01.2020 um 23:26 schrieb Simon Glass:
> Update this driver to use the new standard enums for speed.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
> Changes in v2: None
> 
>   drivers/i2c/designware_i2c.c | 10 +++++-----
>   drivers/i2c/designware_i2c.h | 13 -------------
>   2 files changed, 5 insertions(+), 18 deletions(-)

Reviewed-by: Heiko Schocher <hs at denx.de>

bye,
Heiko
diff mbox series

Patch

diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c
index 4aee25c543..1f41e3eae0 100644
--- a/drivers/i2c/designware_i2c.c
+++ b/drivers/i2c/designware_i2c.c
@@ -103,21 +103,21 @@  struct i2c_mode_info {
 
 static const struct i2c_mode_info info_for_mode[] = {
 	[IC_SPEED_MODE_STANDARD] = {
-		I2C_STANDARD_SPEED,
+		I2C_SPEED_STANDARD_RATE,
 		MIN_SS_SCL_HIGHTIME,
 		MIN_SS_SCL_LOWTIME,
 		1000,
 		300,
 	},
 	[IC_SPEED_MODE_FAST] = {
-		I2C_FAST_SPEED,
+		I2C_SPEED_FAST_RATE,
 		MIN_FS_SCL_HIGHTIME,
 		MIN_FS_SCL_LOWTIME,
 		300,
 		300,
 	},
 	[IC_SPEED_MODE_HIGH] = {
-		I2C_HIGH_SPEED,
+		I2C_SPEED_HIGH_RATE,
 		MIN_HS_SCL_HIGHTIME,
 		MIN_HS_SCL_LOWTIME,
 		120,
@@ -226,10 +226,10 @@  static unsigned int __dw_i2c_set_bus_speed(struct dw_i2c *priv,
 	if (priv)
 		scl_sda_cfg = priv->scl_sda_cfg;
 	/* Allow high speed if there is no config, or the config allows it */
-	if (speed >= I2C_HIGH_SPEED &&
+	if (speed >= I2C_SPEED_HIGH_RATE &&
 	    (!scl_sda_cfg || scl_sda_cfg->has_high_speed))
 		i2c_spd = IC_SPEED_MODE_HIGH;
-	else if (speed >= I2C_FAST_SPEED)
+	else if (speed >= I2C_SPEED_FAST_RATE)
 		i2c_spd = IC_SPEED_MODE_FAST;
 	else
 		i2c_spd = IC_SPEED_MODE_STANDARD;
diff --git a/drivers/i2c/designware_i2c.h b/drivers/i2c/designware_i2c.h
index 2c572a9e1f..4738f4642d 100644
--- a/drivers/i2c/designware_i2c.h
+++ b/drivers/i2c/designware_i2c.h
@@ -134,19 +134,6 @@  struct i2c_regs {
 #define IC_STATUS_TFNF		0x0002
 #define IC_STATUS_ACT		0x0001
 
-/* Speed Selection */
-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
-#define I2C_STANDARD_SPEED	100000
-
 /**
  * struct dw_scl_sda_cfg - I2C timing configuration
  *