* [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock
@ 2022-08-23 3:02 Peng Fan (OSS)
2022-08-23 3:02 ` [PATCH V3 1/7] ARM: dts: imx7ulp: update the LPI2C clock-names Peng Fan (OSS)
` (7 more replies)
0 siblings, 8 replies; 15+ messages in thread
From: Peng Fan (OSS) @ 2022-08-23 3:02 UTC (permalink / raw)
To: wsa, aisheng.dong, robh+dt, krzysztof.kozlowski+dt, shawnguo,
s.hauer
Cc: kernel, festevam, linux-imx, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel, xiaoning.wang, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
V3:
Add R-b
Correct clk_bulk_disable to clk_bulk_disable_unprepare in patch 7
V2:
use clk bulk API in driver to support backward compatibility.
Include a new patch, patch 1.
The i.MX LPI2C needs PER and IPG clock, not just PER or IPG clock.
The current driver/dts/bindings use one CLK. Although it works with
upstream kernel, but it not match the hardware design. If IPG clock is
disabled, the LPI2C will not work.
There are changes made to ARM32 i.MX7ULP dts, ARM64 i.MX8 dts, dt-
bindings, and the lpi2c driver.
The driver is updated to use bulk clk API to avoid break backward
compatibility. But it is hard to avoid dtbs_check pass, because the dts and
binding update are in separate patches.
Peng Fan (7):
ARM: dts: imx7ulp: update the LPI2C clock-names
dt-bindings: i2c: i2c-imx-lpi2c: add ipg clk
dt-bindings: i2c: i2c-imx-lpi2c: add dmas property
dt-bindings: i2c: i2c-imx-lpi2c: add i.MX93
arm64: dts: imx8-ss-dma: add IPG clock for i2c
ARM: dts: imx7ulp: Add IPG clock for lpi2c
i2c: imx-lpi2c: use bulk clk API
.../bindings/i2c/i2c-imx-lpi2c.yaml | 20 +++++++++++++---
arch/arm/boot/dts/imx7ulp.dtsi | 10 ++++----
.../arm64/boot/dts/freescale/imx8-ss-dma.dtsi | 20 +++++++++-------
drivers/i2c/busses/i2c-imx-lpi2c.c | 24 +++++++++----------
4 files changed, 47 insertions(+), 27 deletions(-)
--
2.37.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH V3 1/7] ARM: dts: imx7ulp: update the LPI2C clock-names
2022-08-23 3:02 [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock Peng Fan (OSS)
@ 2022-08-23 3:02 ` Peng Fan (OSS)
2022-08-23 3:02 ` [PATCH V3 2/7] dt-bindings: i2c: i2c-imx-lpi2c: add ipg clk Peng Fan (OSS)
` (6 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Peng Fan (OSS) @ 2022-08-23 3:02 UTC (permalink / raw)
To: wsa, aisheng.dong, robh+dt, krzysztof.kozlowski+dt, shawnguo,
s.hauer
Cc: kernel, festevam, linux-imx, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel, xiaoning.wang, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
The clock name should be per clock, not ipg clock.
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm/boot/dts/imx7ulp.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi
index bcec98b96411..9c7abec90a89 100644
--- a/arch/arm/boot/dts/imx7ulp.dtsi
+++ b/arch/arm/boot/dts/imx7ulp.dtsi
@@ -329,7 +329,7 @@ lpi2c6: i2c@40a40000 {
reg = <0x40a40000 0x10000>;
interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&pcc3 IMX7ULP_CLK_LPI2C6>;
- clock-names = "ipg";
+ clock-names = "per";
assigned-clocks = <&pcc3 IMX7ULP_CLK_LPI2C6>;
assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC>;
assigned-clock-rates = <48000000>;
@@ -341,7 +341,7 @@ lpi2c7: i2c@40a50000 {
reg = <0x40a50000 0x10000>;
interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&pcc3 IMX7ULP_CLK_LPI2C7>;
- clock-names = "ipg";
+ clock-names = "per";
assigned-clocks = <&pcc3 IMX7ULP_CLK_LPI2C7>;
assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC>;
assigned-clock-rates = <48000000>;
--
2.37.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH V3 2/7] dt-bindings: i2c: i2c-imx-lpi2c: add ipg clk
2022-08-23 3:02 [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock Peng Fan (OSS)
2022-08-23 3:02 ` [PATCH V3 1/7] ARM: dts: imx7ulp: update the LPI2C clock-names Peng Fan (OSS)
@ 2022-08-23 3:02 ` Peng Fan (OSS)
2022-08-30 10:07 ` Wolfram Sang
2022-08-23 3:02 ` [PATCH V3 3/7] dt-bindings: i2c: i2c-imx-lpi2c: add dmas property Peng Fan (OSS)
` (5 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Peng Fan (OSS) @ 2022-08-23 3:02 UTC (permalink / raw)
To: wsa, aisheng.dong, robh+dt, krzysztof.kozlowski+dt, shawnguo,
s.hauer
Cc: kernel, festevam, linux-imx, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel, xiaoning.wang, Peng Fan,
Krzysztof Kozlowski
From: Peng Fan <peng.fan@nxp.com>
i.MX LPI2C actually requires dual clock: per clock and ipg clock, so add
both.
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml b/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml
index 529bea56d324..e42e35003eae 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml
+++ b/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml
@@ -37,10 +37,12 @@ properties:
clock-frequency: true
clock-names:
- maxItems: 1
+ items:
+ - const: per
+ - const: ipg
clocks:
- maxItems: 1
+ maxItems: 2
power-domains:
maxItems: 1
@@ -63,5 +65,6 @@ examples:
reg = <0x40A50000 0x10000>;
interrupt-parent = <&intc>;
interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&clks IMX7ULP_CLK_LPI2C7>;
+ clocks = <&clks IMX7ULP_CLK_LPI2C7>,
+ <&clks IMX7ULP_CLK_NIC1_BUS_DIV>;
};
--
2.37.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH V3 3/7] dt-bindings: i2c: i2c-imx-lpi2c: add dmas property
2022-08-23 3:02 [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock Peng Fan (OSS)
2022-08-23 3:02 ` [PATCH V3 1/7] ARM: dts: imx7ulp: update the LPI2C clock-names Peng Fan (OSS)
2022-08-23 3:02 ` [PATCH V3 2/7] dt-bindings: i2c: i2c-imx-lpi2c: add ipg clk Peng Fan (OSS)
@ 2022-08-23 3:02 ` Peng Fan (OSS)
2022-08-30 10:07 ` Wolfram Sang
2022-08-23 3:02 ` [PATCH V3 4/7] dt-bindings: i2c: i2c-imx-lpi2c: add i.MX93 Peng Fan (OSS)
` (4 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Peng Fan (OSS) @ 2022-08-23 3:02 UTC (permalink / raw)
To: wsa, aisheng.dong, robh+dt, krzysztof.kozlowski+dt, shawnguo,
s.hauer
Cc: kernel, festevam, linux-imx, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel, xiaoning.wang, Peng Fan,
Krzysztof Kozlowski
From: Peng Fan <peng.fan@nxp.com>
i.MX LPI2C has dma capability, so add dmas property
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
.../devicetree/bindings/i2c/i2c-imx-lpi2c.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml b/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml
index e42e35003eae..08b81d57d7e1 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml
+++ b/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml
@@ -44,6 +44,16 @@ properties:
clocks:
maxItems: 2
+ dmas:
+ items:
+ - description: DMA controller phandle and request line for TX
+ - description: DMA controller phandle and request line for RX
+
+ dma-names:
+ items:
+ - const: tx
+ - const: rx
+
power-domains:
maxItems: 1
--
2.37.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH V3 4/7] dt-bindings: i2c: i2c-imx-lpi2c: add i.MX93
2022-08-23 3:02 [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock Peng Fan (OSS)
` (2 preceding siblings ...)
2022-08-23 3:02 ` [PATCH V3 3/7] dt-bindings: i2c: i2c-imx-lpi2c: add dmas property Peng Fan (OSS)
@ 2022-08-23 3:02 ` Peng Fan (OSS)
2022-08-30 10:07 ` Wolfram Sang
2022-08-23 3:02 ` [PATCH V3 5/7] arm64: dts: imx8-ss-dma: add IPG clock for i2c Peng Fan (OSS)
` (3 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Peng Fan (OSS) @ 2022-08-23 3:02 UTC (permalink / raw)
To: wsa, aisheng.dong, robh+dt, krzysztof.kozlowski+dt, shawnguo,
s.hauer
Cc: kernel, festevam, linux-imx, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel, xiaoning.wang, Peng Fan,
Krzysztof Kozlowski
From: Peng Fan <peng.fan@nxp.com>
Add i.MX93 LPI2C compatible string.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml b/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml
index 08b81d57d7e1..4656f5112b84 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml
+++ b/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml
@@ -23,6 +23,7 @@ properties:
- fsl,imx8dxl-lpi2c
- fsl,imx8qm-lpi2c
- fsl,imx8ulp-lpi2c
+ - fsl,imx93-lpi2c
- const: fsl,imx7ulp-lpi2c
reg:
--
2.37.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH V3 5/7] arm64: dts: imx8-ss-dma: add IPG clock for i2c
2022-08-23 3:02 [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock Peng Fan (OSS)
` (3 preceding siblings ...)
2022-08-23 3:02 ` [PATCH V3 4/7] dt-bindings: i2c: i2c-imx-lpi2c: add i.MX93 Peng Fan (OSS)
@ 2022-08-23 3:02 ` Peng Fan (OSS)
2022-08-23 3:02 ` [PATCH V3 6/7] ARM: dts: imx7ulp: Add IPG clock for lpi2c Peng Fan (OSS)
` (2 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Peng Fan (OSS) @ 2022-08-23 3:02 UTC (permalink / raw)
To: wsa, aisheng.dong, robh+dt, krzysztof.kozlowski+dt, shawnguo,
s.hauer
Cc: kernel, festevam, linux-imx, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel, xiaoning.wang, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
i.MX8 LPI2C requires both PER and IPG clock, so add the missed IPG clk.
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
.../arm64/boot/dts/freescale/imx8-ss-dma.dtsi | 20 +++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi b/arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi
index 960a802b8b6e..d7b4229bb4a2 100644
--- a/arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi
@@ -111,8 +111,9 @@ uart3_lpcg: clock-controller@5a490000 {
i2c0: i2c@5a800000 {
reg = <0x5a800000 0x4000>;
interrupts = <GIC_SPI 220 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&i2c0_lpcg IMX_LPCG_CLK_0>;
- clock-names = "per";
+ clocks = <&i2c0_lpcg IMX_LPCG_CLK_0>,
+ <&i2c0_lpcg IMX_LPCG_CLK_4>;
+ clock-names = "per", "ipg";
assigned-clocks = <&clk IMX_SC_R_I2C_0 IMX_SC_PM_CLK_PER>;
assigned-clock-rates = <24000000>;
power-domains = <&pd IMX_SC_R_I2C_0>;
@@ -122,8 +123,9 @@ i2c0: i2c@5a800000 {
i2c1: i2c@5a810000 {
reg = <0x5a810000 0x4000>;
interrupts = <GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&i2c1_lpcg IMX_LPCG_CLK_0>;
- clock-names = "per";
+ clocks = <&i2c1_lpcg IMX_LPCG_CLK_0>,
+ <&i2c1_lpcg IMX_LPCG_CLK_4>;
+ clock-names = "per", "ipg";
assigned-clocks = <&clk IMX_SC_R_I2C_1 IMX_SC_PM_CLK_PER>;
assigned-clock-rates = <24000000>;
power-domains = <&pd IMX_SC_R_I2C_1>;
@@ -133,8 +135,9 @@ i2c1: i2c@5a810000 {
i2c2: i2c@5a820000 {
reg = <0x5a820000 0x4000>;
interrupts = <GIC_SPI 222 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&i2c2_lpcg IMX_LPCG_CLK_0>;
- clock-names = "per";
+ clocks = <&i2c2_lpcg IMX_LPCG_CLK_0>,
+ <&i2c2_lpcg IMX_LPCG_CLK_4>;
+ clock-names = "per", "ipg";
assigned-clocks = <&clk IMX_SC_R_I2C_2 IMX_SC_PM_CLK_PER>;
assigned-clock-rates = <24000000>;
power-domains = <&pd IMX_SC_R_I2C_2>;
@@ -144,8 +147,9 @@ i2c2: i2c@5a820000 {
i2c3: i2c@5a830000 {
reg = <0x5a830000 0x4000>;
interrupts = <GIC_SPI 223 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&i2c3_lpcg IMX_LPCG_CLK_0>;
- clock-names = "per";
+ clocks = <&i2c3_lpcg IMX_LPCG_CLK_0>,
+ <&i2c3_lpcg IMX_LPCG_CLK_4>;
+ clock-names = "per", "ipg";
assigned-clocks = <&clk IMX_SC_R_I2C_3 IMX_SC_PM_CLK_PER>;
assigned-clock-rates = <24000000>;
power-domains = <&pd IMX_SC_R_I2C_3>;
--
2.37.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH V3 6/7] ARM: dts: imx7ulp: Add IPG clock for lpi2c
2022-08-23 3:02 [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock Peng Fan (OSS)
` (4 preceding siblings ...)
2022-08-23 3:02 ` [PATCH V3 5/7] arm64: dts: imx8-ss-dma: add IPG clock for i2c Peng Fan (OSS)
@ 2022-08-23 3:02 ` Peng Fan (OSS)
2022-08-23 3:02 ` [PATCH V3 7/7] i2c: imx-lpi2c: use bulk clk API Peng Fan (OSS)
2022-09-03 3:38 ` [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock Shawn Guo
7 siblings, 0 replies; 15+ messages in thread
From: Peng Fan (OSS) @ 2022-08-23 3:02 UTC (permalink / raw)
To: wsa, aisheng.dong, robh+dt, krzysztof.kozlowski+dt, shawnguo,
s.hauer
Cc: kernel, festevam, linux-imx, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel, xiaoning.wang, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
LPI2C requires two clocks, add the missed IPG clock.
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm/boot/dts/imx7ulp.dtsi | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi
index 9c7abec90a89..7f7d2d5122fb 100644
--- a/arch/arm/boot/dts/imx7ulp.dtsi
+++ b/arch/arm/boot/dts/imx7ulp.dtsi
@@ -328,8 +328,9 @@ lpi2c6: i2c@40a40000 {
compatible = "fsl,imx7ulp-lpi2c";
reg = <0x40a40000 0x10000>;
interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&pcc3 IMX7ULP_CLK_LPI2C6>;
- clock-names = "per";
+ clocks = <&pcc3 IMX7ULP_CLK_LPI2C6>,
+ <&scg1 IMX7ULP_CLK_NIC1_BUS_DIV>;
+ clock-names = "per", "ipg";
assigned-clocks = <&pcc3 IMX7ULP_CLK_LPI2C6>;
assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC>;
assigned-clock-rates = <48000000>;
@@ -340,8 +341,9 @@ lpi2c7: i2c@40a50000 {
compatible = "fsl,imx7ulp-lpi2c";
reg = <0x40a50000 0x10000>;
interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&pcc3 IMX7ULP_CLK_LPI2C7>;
- clock-names = "per";
+ clocks = <&pcc3 IMX7ULP_CLK_LPI2C7>,
+ <&scg1 IMX7ULP_CLK_NIC1_BUS_DIV>;
+ clock-names = "per", "ipg";
assigned-clocks = <&pcc3 IMX7ULP_CLK_LPI2C7>;
assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC>;
assigned-clock-rates = <48000000>;
--
2.37.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH V3 7/7] i2c: imx-lpi2c: use bulk clk API
2022-08-23 3:02 [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock Peng Fan (OSS)
` (5 preceding siblings ...)
2022-08-23 3:02 ` [PATCH V3 6/7] ARM: dts: imx7ulp: Add IPG clock for lpi2c Peng Fan (OSS)
@ 2022-08-23 3:02 ` Peng Fan (OSS)
2022-08-29 20:12 ` Wolfram Sang
2022-09-03 3:38 ` [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock Shawn Guo
7 siblings, 1 reply; 15+ messages in thread
From: Peng Fan (OSS) @ 2022-08-23 3:02 UTC (permalink / raw)
To: wsa, aisheng.dong, robh+dt, krzysztof.kozlowski+dt, shawnguo,
s.hauer
Cc: kernel, festevam, linux-imx, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel, xiaoning.wang, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
The current driver only support one clock, however LPI2C requires
two clocks: PER and IPG.
To make sure old dts could work with newer kernel, use bulk clk
API.
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/i2c/busses/i2c-imx-lpi2c.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index b51ab3cad2b1..188f2a36d2fd 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -94,7 +94,8 @@ enum lpi2c_imx_pincfg {
struct lpi2c_imx_struct {
struct i2c_adapter adapter;
- struct clk *clk;
+ int num_clks;
+ struct clk_bulk_data *clks;
void __iomem *base;
__u8 *rx_buf;
__u8 *tx_buf;
@@ -207,7 +208,7 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx)
lpi2c_imx_set_mode(lpi2c_imx);
- clk_rate = clk_get_rate(lpi2c_imx->clk);
+ clk_rate = clk_get_rate(lpi2c_imx->clks[0].clk);
if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST)
filt = 0;
else
@@ -561,11 +562,12 @@ static int lpi2c_imx_probe(struct platform_device *pdev)
strscpy(lpi2c_imx->adapter.name, pdev->name,
sizeof(lpi2c_imx->adapter.name));
- lpi2c_imx->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(lpi2c_imx->clk)) {
- dev_err(&pdev->dev, "can't get I2C peripheral clock\n");
- return PTR_ERR(lpi2c_imx->clk);
+ ret = devm_clk_bulk_get_all(&pdev->dev, &lpi2c_imx->clks);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "can't get I2C peripheral clock, ret=%d\n", ret);
+ return ret;
}
+ lpi2c_imx->num_clks = ret;
ret = of_property_read_u32(pdev->dev.of_node,
"clock-frequency", &lpi2c_imx->bitrate);
@@ -582,11 +584,9 @@ static int lpi2c_imx_probe(struct platform_device *pdev)
i2c_set_adapdata(&lpi2c_imx->adapter, lpi2c_imx);
platform_set_drvdata(pdev, lpi2c_imx);
- ret = clk_prepare_enable(lpi2c_imx->clk);
- if (ret) {
- dev_err(&pdev->dev, "clk enable failed %d\n", ret);
+ ret = clk_bulk_prepare_enable(lpi2c_imx->num_clks, lpi2c_imx->clks);
+ if (ret)
return ret;
- }
pm_runtime_set_autosuspend_delay(&pdev->dev, I2C_PM_TIMEOUT);
pm_runtime_use_autosuspend(&pdev->dev);
@@ -633,7 +633,7 @@ static int __maybe_unused lpi2c_runtime_suspend(struct device *dev)
{
struct lpi2c_imx_struct *lpi2c_imx = dev_get_drvdata(dev);
- clk_disable_unprepare(lpi2c_imx->clk);
+ clk_bulk_disable_unprepare(lpi2c_imx->num_clks, lpi2c_imx->clks);
pinctrl_pm_select_sleep_state(dev);
return 0;
@@ -645,7 +645,7 @@ static int __maybe_unused lpi2c_runtime_resume(struct device *dev)
int ret;
pinctrl_pm_select_default_state(dev);
- ret = clk_prepare_enable(lpi2c_imx->clk);
+ ret = clk_bulk_prepare_enable(lpi2c_imx->num_clks, lpi2c_imx->clks);
if (ret) {
dev_err(dev, "failed to enable I2C clock, ret=%d\n", ret);
return ret;
--
2.37.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH V3 7/7] i2c: imx-lpi2c: use bulk clk API
2022-08-23 3:02 ` [PATCH V3 7/7] i2c: imx-lpi2c: use bulk clk API Peng Fan (OSS)
@ 2022-08-29 20:12 ` Wolfram Sang
2022-08-30 10:00 ` Peng Fan
0 siblings, 1 reply; 15+ messages in thread
From: Wolfram Sang @ 2022-08-29 20:12 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: aisheng.dong, robh+dt, krzysztof.kozlowski+dt, shawnguo, s.hauer,
kernel, festevam, linux-imx, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel, xiaoning.wang, Peng Fan
[-- Attachment #1: Type: text/plain, Size: 418 bytes --]
On Tue, Aug 23, 2022 at 11:02:15AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> The current driver only support one clock, however LPI2C requires
> two clocks: PER and IPG.
>
> To make sure old dts could work with newer kernel, use bulk clk
> API.
>
> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [PATCH V3 7/7] i2c: imx-lpi2c: use bulk clk API
2022-08-29 20:12 ` Wolfram Sang
@ 2022-08-30 10:00 ` Peng Fan
2022-08-30 10:04 ` Wolfram Sang
0 siblings, 1 reply; 15+ messages in thread
From: Peng Fan @ 2022-08-30 10:00 UTC (permalink / raw)
To: Wolfram Sang, Peng Fan (OSS)
Cc: Aisheng Dong, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com,
dl-linux-imx, linux-i2c@vger.kernel.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Clark Wang
Hi Wolfram,
> Subject: Re: [PATCH V3 7/7] i2c: imx-lpi2c: use bulk clk API
>
> On Tue, Aug 23, 2022 at 11:02:15AM +0800, Peng Fan (OSS) wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > The current driver only support one clock, however LPI2C requires two
> > clocks: PER and IPG.
> >
> > To make sure old dts could work with newer kernel, use bulk clk API.
> >
> > Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
>
> Applied to for-next, thanks!
Thanks, would you also pick up
Patch 2,3,4 in this patchset[1]?
[1] https://lore.kernel.org/all/20220823030215.870414-1-peng.fan@oss.nxp.com/
Thanks,
Peng.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V3 7/7] i2c: imx-lpi2c: use bulk clk API
2022-08-30 10:00 ` Peng Fan
@ 2022-08-30 10:04 ` Wolfram Sang
0 siblings, 0 replies; 15+ messages in thread
From: Wolfram Sang @ 2022-08-30 10:04 UTC (permalink / raw)
To: Peng Fan
Cc: Peng Fan (OSS), Aisheng Dong, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com,
dl-linux-imx, linux-i2c@vger.kernel.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Clark Wang
[-- Attachment #1: Type: text/plain, Size: 140 bytes --]
> Thanks, would you also pick up
> Patch 2,3,4 in this patchset[1]?
Ah, they are already reviewed. Yes, will do. Thanks for the pointer!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V3 2/7] dt-bindings: i2c: i2c-imx-lpi2c: add ipg clk
2022-08-23 3:02 ` [PATCH V3 2/7] dt-bindings: i2c: i2c-imx-lpi2c: add ipg clk Peng Fan (OSS)
@ 2022-08-30 10:07 ` Wolfram Sang
0 siblings, 0 replies; 15+ messages in thread
From: Wolfram Sang @ 2022-08-30 10:07 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: aisheng.dong, robh+dt, krzysztof.kozlowski+dt, shawnguo, s.hauer,
kernel, festevam, linux-imx, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel, xiaoning.wang, Peng Fan,
Krzysztof Kozlowski
[-- Attachment #1: Type: text/plain, Size: 396 bytes --]
On Tue, Aug 23, 2022 at 11:02:10AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> i.MX LPI2C actually requires dual clock: per clock and ipg clock, so add
> both.
>
> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V3 3/7] dt-bindings: i2c: i2c-imx-lpi2c: add dmas property
2022-08-23 3:02 ` [PATCH V3 3/7] dt-bindings: i2c: i2c-imx-lpi2c: add dmas property Peng Fan (OSS)
@ 2022-08-30 10:07 ` Wolfram Sang
0 siblings, 0 replies; 15+ messages in thread
From: Wolfram Sang @ 2022-08-30 10:07 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: aisheng.dong, robh+dt, krzysztof.kozlowski+dt, shawnguo, s.hauer,
kernel, festevam, linux-imx, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel, xiaoning.wang, Peng Fan,
Krzysztof Kozlowski
[-- Attachment #1: Type: text/plain, Size: 366 bytes --]
On Tue, Aug 23, 2022 at 11:02:11AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> i.MX LPI2C has dma capability, so add dmas property
>
> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V3 4/7] dt-bindings: i2c: i2c-imx-lpi2c: add i.MX93
2022-08-23 3:02 ` [PATCH V3 4/7] dt-bindings: i2c: i2c-imx-lpi2c: add i.MX93 Peng Fan (OSS)
@ 2022-08-30 10:07 ` Wolfram Sang
0 siblings, 0 replies; 15+ messages in thread
From: Wolfram Sang @ 2022-08-30 10:07 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: aisheng.dong, robh+dt, krzysztof.kozlowski+dt, shawnguo, s.hauer,
kernel, festevam, linux-imx, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel, xiaoning.wang, Peng Fan,
Krzysztof Kozlowski
[-- Attachment #1: Type: text/plain, Size: 347 bytes --]
On Tue, Aug 23, 2022 at 11:02:12AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Add i.MX93 LPI2C compatible string.
>
> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock
2022-08-23 3:02 [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock Peng Fan (OSS)
` (6 preceding siblings ...)
2022-08-23 3:02 ` [PATCH V3 7/7] i2c: imx-lpi2c: use bulk clk API Peng Fan (OSS)
@ 2022-09-03 3:38 ` Shawn Guo
7 siblings, 0 replies; 15+ messages in thread
From: Shawn Guo @ 2022-09-03 3:38 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: wsa, aisheng.dong, robh+dt, krzysztof.kozlowski+dt, s.hauer,
kernel, festevam, linux-imx, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel, xiaoning.wang, Peng Fan
On Tue, Aug 23, 2022 at 11:02:08AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> V3:
> Add R-b
> Correct clk_bulk_disable to clk_bulk_disable_unprepare in patch 7
>
> V2:
> use clk bulk API in driver to support backward compatibility.
> Include a new patch, patch 1.
>
> The i.MX LPI2C needs PER and IPG clock, not just PER or IPG clock.
> The current driver/dts/bindings use one CLK. Although it works with
> upstream kernel, but it not match the hardware design. If IPG clock is
> disabled, the LPI2C will not work.
>
> There are changes made to ARM32 i.MX7ULP dts, ARM64 i.MX8 dts, dt-
> bindings, and the lpi2c driver.
>
> The driver is updated to use bulk clk API to avoid break backward
> compatibility. But it is hard to avoid dtbs_check pass, because the dts and
> binding update are in separate patches.
>
> Peng Fan (7):
> ARM: dts: imx7ulp: update the LPI2C clock-names
> dt-bindings: i2c: i2c-imx-lpi2c: add ipg clk
> dt-bindings: i2c: i2c-imx-lpi2c: add dmas property
> dt-bindings: i2c: i2c-imx-lpi2c: add i.MX93
> arm64: dts: imx8-ss-dma: add IPG clock for i2c
> ARM: dts: imx7ulp: Add IPG clock for lpi2c
> i2c: imx-lpi2c: use bulk clk API
Applied 3 DTS patches, thanks!
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2022-09-03 3:39 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-23 3:02 [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock Peng Fan (OSS)
2022-08-23 3:02 ` [PATCH V3 1/7] ARM: dts: imx7ulp: update the LPI2C clock-names Peng Fan (OSS)
2022-08-23 3:02 ` [PATCH V3 2/7] dt-bindings: i2c: i2c-imx-lpi2c: add ipg clk Peng Fan (OSS)
2022-08-30 10:07 ` Wolfram Sang
2022-08-23 3:02 ` [PATCH V3 3/7] dt-bindings: i2c: i2c-imx-lpi2c: add dmas property Peng Fan (OSS)
2022-08-30 10:07 ` Wolfram Sang
2022-08-23 3:02 ` [PATCH V3 4/7] dt-bindings: i2c: i2c-imx-lpi2c: add i.MX93 Peng Fan (OSS)
2022-08-30 10:07 ` Wolfram Sang
2022-08-23 3:02 ` [PATCH V3 5/7] arm64: dts: imx8-ss-dma: add IPG clock for i2c Peng Fan (OSS)
2022-08-23 3:02 ` [PATCH V3 6/7] ARM: dts: imx7ulp: Add IPG clock for lpi2c Peng Fan (OSS)
2022-08-23 3:02 ` [PATCH V3 7/7] i2c: imx-lpi2c: use bulk clk API Peng Fan (OSS)
2022-08-29 20:12 ` Wolfram Sang
2022-08-30 10:00 ` Peng Fan
2022-08-30 10:04 ` Wolfram Sang
2022-09-03 3:38 ` [PATCH V3 0/7] i2c-imx-lpi2c: add IPG clock Shawn Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).