diff mbox series

[v2,04/19] i2c: designware_i2c: Rename 'max' speed to 'high' speed

Message ID 20200103222650.32592-3-sjg@chromium.org
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
Some SoCs support a higher speed than what is currently called 'max' in
this driver. Rename it to 'high' speed, which is the official name of the
3.4MHz 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 |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

Comments

Jun Chen Jan. 6, 2020, 10:24 a.m. UTC | #1
Reviewed-by: Jun Chen <ptchentw at gmail.com>

Simon Glass <sjg at chromium.org> 於 2020年1月4日 週六 上午6:27寫道:

> Some SoCs support a higher speed than what is currently called 'max' in
> this driver. Rename it to 'high' speed, which is the official name of the
> 3.4MHz 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 |  8 ++++----
>  2 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c
> index 138fc72561..dd1cc0b823 100644
> --- a/drivers/i2c/designware_i2c.c
> +++ b/drivers/i2c/designware_i2c.c
> @@ -62,10 +62,10 @@ static unsigned int __dw_i2c_set_bus_speed(struct
> i2c_regs *i2c_base,
>         unsigned int ena;
>         int i2c_spd;
>
> -       /* Allow max speed if there is no config, or the config allows it
> */
> -       if (speed >= I2C_MAX_SPEED &&
> -           (!scl_sda_cfg || scl_sda_cfg->has_max_speed))
> -               i2c_spd = IC_SPEED_MODE_MAX;
> +       /* Allow high speed if there is no config, or the config allows it
> */
> +       if (speed >= I2C_HIGH_SPEED &&
> +           (!scl_sda_cfg || scl_sda_cfg->has_high_speed))
> +               i2c_spd = IC_SPEED_MODE_HIGH;
>         else if (speed >= I2C_FAST_SPEED)
>                 i2c_spd = IC_SPEED_MODE_FAST;
>         else
> @@ -80,7 +80,7 @@ static unsigned int __dw_i2c_set_bus_speed(struct
> i2c_regs *i2c_base,
>         cntl = (readl(&i2c_base->ic_con) & (~IC_CON_SPD_MSK));
>
>         switch (i2c_spd) {
> -       case IC_SPEED_MODE_MAX:
> +       case IC_SPEED_MODE_HIGH:
>                 cntl |= IC_CON_SPD_SS;
>                 if (scl_sda_cfg) {
>                         hcnt = scl_sda_cfg->fs_hcnt;
> diff --git a/drivers/i2c/designware_i2c.h b/drivers/i2c/designware_i2c.h
> index 39e62bcf51..fcb7dde83a 100644
> --- a/drivers/i2c/designware_i2c.h
> +++ b/drivers/i2c/designware_i2c.h
> @@ -137,16 +137,16 @@ struct i2c_regs {
>  /* Speed Selection */
>  #define IC_SPEED_MODE_STANDARD 1
>  #define IC_SPEED_MODE_FAST     2
> -#define IC_SPEED_MODE_MAX      3
> +#define IC_SPEED_MODE_HIGH     3
>
> -#define I2C_MAX_SPEED          3400000
> +#define I2C_HIGH_SPEED         3400000
>  #define I2C_FAST_SPEED         400000
>  #define I2C_STANDARD_SPEED     100000
>
>  /**
>   * struct dw_scl_sda_cfg - I2C timing configuration
>   *
> - * @has_max_speed: Support maximum speed (1Mbps)
> + * @has_high_speed: Support high speed (3.4Mbps)
>   * @ss_hcnt: Standard speed high time in ns
>   * @fs_hcnt: Fast speed high time in ns
>   * @ss_lcnt: Standard speed low time in ns
> @@ -154,7 +154,7 @@ struct i2c_regs {
>   * @sda_hold: SDA hold time
>   */
>  struct dw_scl_sda_cfg {
> -       bool has_max_speed;
> +       bool has_high_speed;
>         u32 ss_hcnt;
>         u32 fs_hcnt;
>         u32 ss_lcnt;
> --
> 2.24.1.735.g03f4e72817-goog
>
>
Heiko Schocher Jan. 16, 2020, 6:42 a.m. UTC | #2
Hello Simon,

Am 03.01.2020 um 23:26 schrieb Simon Glass:
> Some SoCs support a higher speed than what is currently called 'max' in
> this driver. Rename it to 'high' speed, which is the official name of the
> 3.4MHz 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 |  8 ++++----
>   2 files changed, 9 insertions(+), 9 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 138fc72561..dd1cc0b823 100644
--- a/drivers/i2c/designware_i2c.c
+++ b/drivers/i2c/designware_i2c.c
@@ -62,10 +62,10 @@  static unsigned int __dw_i2c_set_bus_speed(struct i2c_regs *i2c_base,
 	unsigned int ena;
 	int i2c_spd;
 
-	/* Allow max speed if there is no config, or the config allows it */
-	if (speed >= I2C_MAX_SPEED &&
-	    (!scl_sda_cfg || scl_sda_cfg->has_max_speed))
-		i2c_spd = IC_SPEED_MODE_MAX;
+	/* Allow high speed if there is no config, or the config allows it */
+	if (speed >= I2C_HIGH_SPEED &&
+	    (!scl_sda_cfg || scl_sda_cfg->has_high_speed))
+		i2c_spd = IC_SPEED_MODE_HIGH;
 	else if (speed >= I2C_FAST_SPEED)
 		i2c_spd = IC_SPEED_MODE_FAST;
 	else
@@ -80,7 +80,7 @@  static unsigned int __dw_i2c_set_bus_speed(struct i2c_regs *i2c_base,
 	cntl = (readl(&i2c_base->ic_con) & (~IC_CON_SPD_MSK));
 
 	switch (i2c_spd) {
-	case IC_SPEED_MODE_MAX:
+	case IC_SPEED_MODE_HIGH:
 		cntl |= IC_CON_SPD_SS;
 		if (scl_sda_cfg) {
 			hcnt = scl_sda_cfg->fs_hcnt;
diff --git a/drivers/i2c/designware_i2c.h b/drivers/i2c/designware_i2c.h
index 39e62bcf51..fcb7dde83a 100644
--- a/drivers/i2c/designware_i2c.h
+++ b/drivers/i2c/designware_i2c.h
@@ -137,16 +137,16 @@  struct i2c_regs {
 /* Speed Selection */
 #define IC_SPEED_MODE_STANDARD	1
 #define IC_SPEED_MODE_FAST	2
-#define IC_SPEED_MODE_MAX	3
+#define IC_SPEED_MODE_HIGH	3
 
-#define I2C_MAX_SPEED		3400000
+#define I2C_HIGH_SPEED		3400000
 #define I2C_FAST_SPEED		400000
 #define I2C_STANDARD_SPEED	100000
 
 /**
  * struct dw_scl_sda_cfg - I2C timing configuration
  *
- * @has_max_speed: Support maximum speed (1Mbps)
+ * @has_high_speed: Support high speed (3.4Mbps)
  * @ss_hcnt: Standard speed high time in ns
  * @fs_hcnt: Fast speed high time in ns
  * @ss_lcnt: Standard speed low time in ns
@@ -154,7 +154,7 @@  struct i2c_regs {
  * @sda_hold: SDA hold time
  */
 struct dw_scl_sda_cfg {
-	bool has_max_speed;
+	bool has_high_speed;
 	u32 ss_hcnt;
 	u32 fs_hcnt;
 	u32 ss_lcnt;