diff mbox series

[4/4] i2c: designware_i2c: add 'hs_hcnt' and 'hs_lcnt' for high speed

Message ID 1583139537-65602-5-git-send-email-ptchentw@gmail.com
State Accepted
Commit 27d483bfa34c1695c2be230efc50c52d5a3d04e2
Delegated to: Heiko Schocher
Headers show
Series i2c: designware_i2c: Improvements for high speed mode | expand

Commit Message

Jun Chen March 2, 2020, 8:58 a.m. UTC
From: Jun Chen <jun.chen@vatics.com>

Add support for high speed if scl_sda_cfg exist.

Signed-off-by: Jun Chen <ptchentw@gmail.com>
Signed-off-by: Jun Chen <jun.chen@vatics.com>
---

 drivers/i2c/designware_i2c.c | 3 +++
 drivers/i2c/designware_i2c.h | 4 ++++
 2 files changed, 7 insertions(+)

Comments

Heiko Schocher March 17, 2020, 5:14 a.m. UTC | #1
Hello Jun Chen,

Am 02.03.2020 um 09:58 schrieb Jun Chen:
> From: Jun Chen <jun.chen@vatics.com>
> 
> Add support for high speed if scl_sda_cfg exist.
> 
> Signed-off-by: Jun Chen <ptchentw@gmail.com>
> Signed-off-by: Jun Chen <jun.chen@vatics.com>
> ---
> 
>   drivers/i2c/designware_i2c.c | 3 +++
>   drivers/i2c/designware_i2c.h | 4 ++++
>   2 files changed, 7 insertions(+)

Applied to u-boot-i2c next, thanks!

bye,
Heiko
diff mbox series

Patch

diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c
index 74aef77..088a6f3 100644
--- a/drivers/i2c/designware_i2c.c
+++ b/drivers/i2c/designware_i2c.c
@@ -240,6 +240,9 @@  static int calc_bus_speed(struct dw_i2c *priv, int speed, ulong bus_clk,
 		if (i2c_spd == IC_SPEED_MODE_STANDARD) {
 			config->scl_hcnt = scl_sda_cfg->ss_hcnt;
 			config->scl_lcnt = scl_sda_cfg->ss_lcnt;
+		} else if (i2c_spd == IC_SPEED_MODE_HIGH) {
+			config->scl_hcnt = scl_sda_cfg->hs_hcnt;
+			config->scl_lcnt = scl_sda_cfg->hs_lcnt;
 		} else {
 			config->scl_hcnt = scl_sda_cfg->fs_hcnt;
 			config->scl_lcnt = scl_sda_cfg->fs_lcnt;
diff --git a/drivers/i2c/designware_i2c.h b/drivers/i2c/designware_i2c.h
index 5a04ce5..7ee2361 100644
--- a/drivers/i2c/designware_i2c.h
+++ b/drivers/i2c/designware_i2c.h
@@ -146,15 +146,19 @@  struct i2c_regs {
  *
  * @ss_hcnt: Standard speed high time in ns
  * @fs_hcnt: Fast speed high time in ns
+ * @hs_hcnt: High speed high time in ns
  * @ss_lcnt: Standard speed low time in ns
  * @fs_lcnt: Fast speed low time in ns
+ * @hs_lcnt: High speed low time in ns
  * @sda_hold: SDA hold time
  */
 struct dw_scl_sda_cfg {
 	u32 ss_hcnt;
 	u32 fs_hcnt;
+	u32 hs_hcnt;
 	u32 ss_lcnt;
 	u32 fs_lcnt;
+	u32 hs_lcnt;
 	u32 sda_hold;
 };