summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@linux.intel.com>2018-06-19 14:23:25 +0300
committerWolfram Sang <wsa@the-dreams.de>2018-07-03 23:06:19 +0200
commitd07bdbc02cdf9930da5f4b8b502c8b33a6d29fcf (patch)
treea339a95fa298a17fdbabba5d88d4a33211588fb3 /drivers/i2c
parent1706a96b30d6011e3f6829b365ace2030a306fe3 (diff)
downloadlinux-d07bdbc02cdf9930da5f4b8b502c8b33a6d29fcf.tar.bz2
i2c: designware: Add debug print for bus speed
Trivial added debug print for dev->clk_freq doesn't necessarily tell the actual bus speed or mode the controller is operating. For instance it may indicate 1 MHz Fast Mode Plus or 3.4 MHz High Speed but driver ends up using 400 kHz Fast Mode due missing timing parameters or missing support from HW. Add a debug print that prints the bus speed based on the validated speed that gets programmed into a HW. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-designware-master.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index 2b671ca3f972..fc7c255c80af 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -48,7 +48,7 @@ static void i2c_dw_configure_fifo_master(struct dw_i2c_dev *dev)
static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev)
{
u32 ic_clk = i2c_dw_clk_rate(dev);
- const char *fp_str = "";
+ const char *mode_str, *fp_str = "";
u32 comp_param1;
u32 sda_falling_time, scl_falling_time;
int ret;
@@ -132,7 +132,24 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev)
}
}
- return i2c_dw_set_sda_hold(dev);
+ ret = i2c_dw_set_sda_hold(dev);
+ if (ret)
+ goto out;
+
+ switch (dev->master_cfg & DW_IC_CON_SPEED_MASK) {
+ case DW_IC_CON_SPEED_STD:
+ mode_str = "Standard Mode";
+ break;
+ case DW_IC_CON_SPEED_HIGH:
+ mode_str = "High Speed Mode";
+ break;
+ default:
+ mode_str = "Fast Mode";
+ }
+ dev_dbg(dev->dev, "Bus speed: %s%s\n", mode_str, fp_str);
+
+out:
+ return ret;
}
/**