[v3,2/4] i2c: qup: Add support for Fast Mode Plus

Message ID 1525968837-13381-3-git-send-email-austinwc@codeaurora.org
State Accepted
Headers show
Series
  • Add Fast Mode Plus and other fixes
Related show

Commit Message

Christ, Austin May 10, 2018, 4:13 p.m.
Previously the QUP driver limited operation mode to I2C Fast Mode. Add
Fast Mode Plus functionality by raising SCL limit from 400kHz to 1MHz.

Signed-off-by: Austin Christ <austinwc@codeaurora.org>
Reviewed-by: Sricharan R <sricharan@codeaurora.org>
---
v1:
	- Initial
v2:
	- No changes
v3:
	- No changes
---
 drivers/i2c/busses/i2c-qup.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Andy Gross May 25, 2018, 8:29 p.m. | #1
On Thu, May 10, 2018 at 10:13:55AM -0600, Austin Christ wrote:
> Previously the QUP driver limited operation mode to I2C Fast Mode. Add
> Fast Mode Plus functionality by raising SCL limit from 400kHz to 1MHz.
> 
> Signed-off-by: Austin Christ <austinwc@codeaurora.org>
> Reviewed-by: Sricharan R <sricharan@codeaurora.org>
> ---

Looks good to me.

Reviewed-by: Andy Gross <andy.gross@linaro.org>

Patch

diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index c024f85..ce5f215 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -136,8 +136,13 @@ 
  */
 #define TOUT_MIN			2
 
+/* I2C Frequency Modes */
+#define I2C_STANDARD_FREQ		100000
+#define I2C_FAST_MODE_FREQ		400000
+#define I2C_FAST_MODE_PLUS_FREQ		1000000
+
 /* Default values. Use these if FW query fails */
-#define DEFAULT_CLK_FREQ 100000
+#define DEFAULT_CLK_FREQ I2C_STANDARD_FREQ
 #define DEFAULT_SRC_CLK 20000000
 
 /*
@@ -1745,8 +1750,8 @@  static int qup_i2c_probe(struct platform_device *pdev)
 	}
 
 nodma:
-	/* We support frequencies up to FAST Mode (400KHz) */
-	if (!clk_freq || clk_freq > 400000) {
+	/* We support frequencies up to FAST Mode Plus (1MHz) */
+	if (!clk_freq || clk_freq > I2C_FAST_MODE_PLUS_FREQ) {
 		dev_err(qup->dev, "clock frequency not supported %d\n",
 			clk_freq);
 		return -EINVAL;