Skip to contentSkip to conversation

i2c: imx_lpi2c: add ipg clk

PATCH New Peng Fan 2 participants 4 messages Jul 24, 2019 – Jul 30, 2019

Subsystems (2)
lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 i2c: imx_lpi2c: add ipg clk

The controller needs two clk, per clk and ipg clk, so let's add ipg clk.

---
 drivers/i2c/imx_lpi2c.c | 11 +++++++++++
 include/imx_lpi2c.h     |  1 +
 2 files changed, 12 insertions(+)
drivers/i2c/imx_lpi2c.c +11 -0
index 4586d4331f..2de99d019e 100644
@@ -471,6 +471,17 @@ static int imx_lpi2c_probe(struct udevice *bus)
 			dev_err(bus, "Failed to enable per clk\n");
 			return ret;
 		}
+
+		ret = clk_get_by_name(bus, "ipg", &i2c_bus->ipg_clk);
+		if (ret) {
+			dev_err(bus, "Failed to get ipg clk\n");
+			return ret;
+		}
+		ret = clk_enable(&i2c_bus->ipg_clk);
+		if (ret) {
+			dev_err(bus, "Failed to enable ipg clk\n");
+			return ret;
+		}
 	} else {
 		/* To i.MX7ULP, only i2c4-7 can be handled by A7 core */
 		ret = enable_i2c_clk(1, bus->seq);
include/imx_lpi2c.h +1 -0
index 2700e5f876..3ce9edaf10 100644
@@ -18,6 +18,7 @@ struct imx_lpi2c_bus {
 	struct i2c_pads_info *pads_info;
 	struct udevice *bus;
 	struct clk per_clk;
+	struct clk ipg_clk;
 };
 
 struct imx_lpi2c_reg {
Signature · 1 line
2.16.4
#1 lore raw

PATCH 1/1 i2c: imx_lpi2c: add ipg clk

Hi Peng,

On Wed, 24 Jul 2019 08:54:16 +0000
Peng Fan peng.fan at nxp.com wrote:
...

drivers/i2c/imx_lpi2c.c static int imx_lpi2c_probe(struct udevice *bus) · line 479

Quoted 11 lines

+++ b/drivers/i2c/imx_lpi2c.c

drivers/i2c/imx_lpi2c.c +6 -0
@@ -471,6 +471,17 @@ static int imx_lpi2c_probe(struct udevice *bus)
 			dev_err(bus, "Failed to enable per clk\n");
 			return ret;
 		}
+
+		ret = clk_get_by_name(bus, "ipg", &i2c_bus->ipg_clk);
+		if (ret) {
+			dev_err(bus, "Failed to get ipg clk\n");
+			return ret;
+		}

imx8dx/imx8qxp device trees do not have ipg clock in I2C nodes, here probing will fail. Should we add I2C ipg clock to imx8x dts files? Or is it required only for imx8qm?

--
Anatolij

author
#2 lore raw

PATCH 1/1 i2c: imx_lpi2c: add ipg clk

Quoted 7 lines

Subject: Re: [PATCH] i2c: imx_lpi2c: add ipg clk

Hi Peng,

On Wed, 24 Jul 2019 08:54:16 +0000
Peng Fan peng.fan at nxp.com wrote:
...

Quoted 14 lines

drivers/i2c/imx_lpi2c.c static int imx_lpi2c_probe(struct udevice *bus) · line 479

Quoted 11 lines

+++ b/drivers/i2c/imx_lpi2c.c

drivers/i2c/imx_lpi2c.c +6 -0
@@ -471,6 +471,17 @@ static int imx_lpi2c_probe(struct udevice *bus)
 			dev_err(bus, "Failed to enable per clk\n");
 			return ret;
 		}
+
+		ret = clk_get_by_name(bus, "ipg", &i2c_bus->ipg_clk);
+		if (ret) {
+			dev_err(bus, "Failed to get ipg clk\n");
+			return ret;
+		}

imx8dx/imx8qxp device trees do not have ipg clock in I2C nodes, here probing will fail. Should we add I2C ipg clock to imx8x dts files?

The dts should be fixed. Seems upstream Linux also not have ipg clk, downstream has it. Let's fix Linux first.

Thanks,
Peng.

Quoted 4 lines

Or is it required only for imx8qm?

--
Anatolij

#3 lore raw

PATCH 1/1 i2c: imx_lpi2c: add ipg clk

On Tue, 30 Jul 2019 00:45:52 +0000
Peng Fan peng.fan at nxp.com wrote:
...

Quoted 2 lines

The dts should be fixed. Seems upstream Linux also not have ipg clk, downstream has it. Let's fix Linux first.

OK, thanks!

--
Anatolij