Linux I2C development
 help / color / mirror / Atom feed
* [PATCH v10 0/2] i2c: ls2x: Add clock- related properties and parsing
@ 2026-08-17  9:01 Hongliang Wang
  0 siblings, 0 replies; 7+ messages in thread
From: Hongliang Wang @ 2026-08-17  9:01 UTC (permalink / raw)
  To: Hongliang Wang, Binbin Zhou, Andi Shyti, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Wolfram Sang
  Cc: linux-i2c, devicetree, loongarch

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 3678 bytes --]

Hi all:

This patch set adds clock related properties and parsing in dts and acpi.

======
V10:
Patch (2/2):
- Replace '/' operator with div64_u64() to avoid __udivdi3 linker error on
  32‑bit architectures with CONFIG_COMPILE_TEST.

Link to V9:
https://lore.kernel.org/all/20260810074927.25284-1-wanghongliang@loongson.cn/

V9:
Patch (2/2):
- Rewrite the commit description
- Use 64-bit arithmetic to avoid integer overflow during the clock calculation
- Add checks to reject zero clock rates and ensure valid clock inputs
- Modify the comment for clocks and clock-div properties
- Add Tested-by tag from Xi Ruoyao, thanks

Link to V8:
https://lore.kernel.org/all/20260721122604.12717-1-wanghongliang@loongson.cn/

V8:
Patch (2/2):
Fix the potential issues from Sashiko AI review:
 - Add error checking for the pointer returned by devm_clk_get_optional_enabled();
 - Add zero-value checking for the match data to provide default div.

Link to V7:
https://lore.kernel.org/all/20260707035104.3092-1-wanghongliang@loongson.cn/

V7:
Patch (2/2):
Fix the potential issues from Sashiko AI review:
 - Move the clock property parsing process to probe function to solve the issue
   of calling `devm_clk_get_optional_enabled()` dynamically causes unbounded memory
   leaks and unbalanced clock enable counts.
 - Add non-zero checking to priv->div.

Link to V6:
https://lore.kernel.org/all/20260608024533.32419-1-wanghongliang@loongson.cn/

V6:
- Add Reviewed-by tag from Huacai, thanks. 
Patch (1/2):
 - Remove CC stable. 

Link to V5:
https://lore.kernel.org/all/20260604015848.18643-1-wanghongliang@loongson.cn/ 

V5:
Patch (1/2):
 - Adjust the position of #include <dt-bindings/clock/loongson,ls2k-clk.h>;
 - Add CC stable; 
 - Fix Signed-off-by.
Patch (2/2):
 - Replace 2K0500/2K1000/2K2000 with LS2K0500/2K1000/2K2000;
 - Replace 7A1000/7A2000 with LS7A1000/7A2000;
 - Replace if (clk && !IS_ERR(clk)) with if(!IS_ERR_OR_NULL(clk));
 - Add document that clocks and clock-div are only ACPI properties in ACPI;
 - Remove unsigned int cast in code (unsigned long)device_get_match_data(dev);
 - Add CC stable; 
 - Fix Signed-off-by.

Link to V4:
https://lore.kernel.org/all/20260526031021.32662-1-wanghongliang@loongson.cn/

V4:
- Add Acked-by tag from Conor Dooley, thanks.
Patch (2/2):
 - Adjust the position of #include <linux/clk.h>;
 - Remove struct ls2x_i2c_chip_data and use macro to describe div;
 - Use div instead of factor in ls2x_i2c_adjust_bus_speed;
 - Reverse the "if & else" code logic in ls2x_i2c_adjust_bus_speed;

Link to V2:
The PATCH v3 is incomplete, v4 is the replacement of v3, so the previous patch link is v2.

[PATCH v2] dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties
https://lore.kernel.org/all/20260507081010.12810-1-wanghongliang@loongson.cn/
[PATCH v2] i2c: ls2x: Add clocks property parsing and adjust bus speed
https://lore.kernel.org/all/20260507081010.12810-2-wanghongliang@loongson.cn/

V2:
[PATCH v2] dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties
- Remove the custom properties clock-input and clock-div, use clock framework;
[PATCH v2] i2c: ls2x: Add clocks property parsing and adjust bus speed
- Use clock framework to obtain the i2c reference clock in dts.

Link to V1:
https://lore.kernel.org/all/20260325011852.19079-1-wanghongliang@loongson.cn/

Hongliang Wang (2):
  dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties
  i2c: ls2x: Add clocks property parsing and adjust bus speed

 .../bindings/i2c/loongson,ls2x-i2c.yaml       |  3 ++
 drivers/i2c/busses/i2c-ls2x.c                 | 44 +++++++++++++++++--
 2 files changed, 44 insertions(+), 3 deletions(-)

-- 
2.47.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v10 0/2] i2c: ls2x: Add clock- related properties and parsing
@ 2026-08-17  9:07 Hongliang Wang
  2026-08-17  9:07 ` [PATCH v10 1/2] dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties Hongliang Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Hongliang Wang @ 2026-08-17  9:07 UTC (permalink / raw)
  To: Hongliang Wang, Binbin Zhou, Andi Shyti, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Wolfram Sang
  Cc: linux-i2c, devicetree, loongarch

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 3678 bytes --]

Hi all:

This patch set adds clock related properties and parsing in dts and acpi.

======
V10:
Patch (2/2):
- Replace '/' operator with div64_u64() to avoid __udivdi3 linker error on
  32‑bit architectures with CONFIG_COMPILE_TEST.

Link to V9:
https://lore.kernel.org/all/20260810074927.25284-1-wanghongliang@loongson.cn/

V9:
Patch (2/2):
- Rewrite the commit description
- Use 64-bit arithmetic to avoid integer overflow during the clock calculation
- Add checks to reject zero clock rates and ensure valid clock inputs
- Modify the comment for clocks and clock-div properties
- Add Tested-by tag from Xi Ruoyao, thanks

Link to V8:
https://lore.kernel.org/all/20260721122604.12717-1-wanghongliang@loongson.cn/

V8:
Patch (2/2):
Fix the potential issues from Sashiko AI review:
 - Add error checking for the pointer returned by devm_clk_get_optional_enabled();
 - Add zero-value checking for the match data to provide default div.

Link to V7:
https://lore.kernel.org/all/20260707035104.3092-1-wanghongliang@loongson.cn/

V7:
Patch (2/2):
Fix the potential issues from Sashiko AI review:
 - Move the clock property parsing process to probe function to solve the issue
   of calling `devm_clk_get_optional_enabled()` dynamically causes unbounded memory
   leaks and unbalanced clock enable counts.
 - Add non-zero checking to priv->div.

Link to V6:
https://lore.kernel.org/all/20260608024533.32419-1-wanghongliang@loongson.cn/

V6:
- Add Reviewed-by tag from Huacai, thanks. 
Patch (1/2):
 - Remove CC stable. 

Link to V5:
https://lore.kernel.org/all/20260604015848.18643-1-wanghongliang@loongson.cn/ 

V5:
Patch (1/2):
 - Adjust the position of #include <dt-bindings/clock/loongson,ls2k-clk.h>;
 - Add CC stable; 
 - Fix Signed-off-by.
Patch (2/2):
 - Replace 2K0500/2K1000/2K2000 with LS2K0500/2K1000/2K2000;
 - Replace 7A1000/7A2000 with LS7A1000/7A2000;
 - Replace if (clk && !IS_ERR(clk)) with if(!IS_ERR_OR_NULL(clk));
 - Add document that clocks and clock-div are only ACPI properties in ACPI;
 - Remove unsigned int cast in code (unsigned long)device_get_match_data(dev);
 - Add CC stable; 
 - Fix Signed-off-by.

Link to V4:
https://lore.kernel.org/all/20260526031021.32662-1-wanghongliang@loongson.cn/

V4:
- Add Acked-by tag from Conor Dooley, thanks.
Patch (2/2):
 - Adjust the position of #include <linux/clk.h>;
 - Remove struct ls2x_i2c_chip_data and use macro to describe div;
 - Use div instead of factor in ls2x_i2c_adjust_bus_speed;
 - Reverse the "if & else" code logic in ls2x_i2c_adjust_bus_speed;

Link to V2:
The PATCH v3 is incomplete, v4 is the replacement of v3, so the previous patch link is v2.

[PATCH v2] dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties
https://lore.kernel.org/all/20260507081010.12810-1-wanghongliang@loongson.cn/
[PATCH v2] i2c: ls2x: Add clocks property parsing and adjust bus speed
https://lore.kernel.org/all/20260507081010.12810-2-wanghongliang@loongson.cn/

V2:
[PATCH v2] dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties
- Remove the custom properties clock-input and clock-div, use clock framework;
[PATCH v2] i2c: ls2x: Add clocks property parsing and adjust bus speed
- Use clock framework to obtain the i2c reference clock in dts.

Link to V1:
https://lore.kernel.org/all/20260325011852.19079-1-wanghongliang@loongson.cn/

Hongliang Wang (2):
  dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties
  i2c: ls2x: Add clocks property parsing and adjust bus speed

 .../bindings/i2c/loongson,ls2x-i2c.yaml       |  3 ++
 drivers/i2c/busses/i2c-ls2x.c                 | 44 +++++++++++++++++--
 2 files changed, 44 insertions(+), 3 deletions(-)

-- 
2.47.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v10 1/2] dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties
  2026-08-17  9:07 [PATCH v10 0/2] i2c: ls2x: Add clock- related properties and parsing Hongliang Wang
@ 2026-08-17  9:07 ` Hongliang Wang
  2026-08-17  9:07 ` [PATCH v10 2/2] i2c: ls2x: Add clocks property parsing and adjust bus speed Hongliang Wang
  2026-08-17  9:23 ` [PATCH v10 0/2] i2c: ls2x: Add clock- related properties and parsing Hongliang Wang
  2 siblings, 0 replies; 7+ messages in thread
From: Hongliang Wang @ 2026-08-17  9:07 UTC (permalink / raw)
  To: Hongliang Wang, Binbin Zhou, Andi Shyti, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Wolfram Sang
  Cc: linux-i2c, devicetree, loongarch, Huacai Chen, Conor Dooley

Add clocks and clock-frequency properties to examples.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Hongliang Wang <wanghongliang@loongson.cn>
---
 Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml b/Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml
index ee09c6d9c5f0..0beb7f2515c8 100644
--- a/Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml
+++ b/Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml
@@ -37,11 +37,14 @@ unevaluatedProperties: false
 
 examples:
   - |
+    #include <dt-bindings/clock/loongson,ls2k-clk.h>
     #include <dt-bindings/interrupt-controller/irq.h>
 
     i2c0: i2c@1fe21000 {
         compatible = "loongson,ls2k-i2c";
         reg = <0x1fe21000 0x8>;
+        clock-frequency = <100000>;
+        clocks = <&clk LOONGSON2_APB_CLK>;
         interrupt-parent = <&extioiic>;
         interrupts = <22 IRQ_TYPE_LEVEL_LOW>;
         #address-cells = <1>;
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v10 2/2] i2c: ls2x: Add clocks property parsing and adjust bus speed
  2026-08-17  9:07 [PATCH v10 0/2] i2c: ls2x: Add clock- related properties and parsing Hongliang Wang
  2026-08-17  9:07 ` [PATCH v10 1/2] dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties Hongliang Wang
@ 2026-08-17  9:07 ` Hongliang Wang
  2026-08-17  9:23 ` [PATCH v10 0/2] i2c: ls2x: Add clock- related properties and parsing Hongliang Wang
  2 siblings, 0 replies; 7+ messages in thread
From: Hongliang Wang @ 2026-08-17  9:07 UTC (permalink / raw)
  To: Hongliang Wang, Binbin Zhou, Andi Shyti, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Wolfram Sang
  Cc: linux-i2c, devicetree, loongarch, Xi Ruoyao, Huacai Chen, stable

The original driver uses a fixed PCLK frequency(LS2X_I2C_PCLK_FREQ) and
fixed div(5) for I2C bus speed calculation. As PCLK frequency and div
vary on different SoCs and ACPI platforms, this leads to inaccurate I2C
bus speed calculation and poor adaptability across platforms.

Improve the accuracy of I2C bus speed calculation across different
platforms by parsing the real I2C bus reference clock (PCLK) and div.
Support both DTS and ACPI.

For DTS:
- Retrieve I2C bus reference clock via the common clock framework
- Fetch div from match data for LS2K/LS7A series
- Fallback to default values if clock lookup fails or the obtained
  pclk or div is zero

For ACPI:
- Parse "clocks" property to get I2C bus reference clock
- Parse "clock-div" property to get div
- Fallback to the default values if property parsing fails or the
  obtained pclk or div is zero

Calculate the I2C clock prescaler based on reference clock, div and
target bus frequency with the formula:

prescale = (pclk * 10) / (div * bus_freq_hz) - 1

Dynamically acquiring PCLK and div per platform ensures accurate I2C bus
speed calculation and reliable operation across different platforms.

Tested-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Hongliang Wang <wanghongliang@loongson.cn>
---
 drivers/i2c/busses/i2c-ls2x.c | 44 ++++++++++++++++++++++++++++++++---
 1 file changed, 41 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-ls2x.c b/drivers/i2c/busses/i2c-ls2x.c
index b475dd27b7af..57d6d38e2711 100644
--- a/drivers/i2c/busses/i2c-ls2x.c
+++ b/drivers/i2c/busses/i2c-ls2x.c
@@ -12,6 +12,7 @@
 
 #include <linux/bitfield.h>
 #include <linux/bits.h>
+#include <linux/clk.h>
 #include <linux/completion.h>
 #include <linux/device.h>
 #include <linux/iopoll.h>
@@ -63,11 +64,19 @@
 /* The default bus frequency, which is an empirical value */
 #define LS2X_I2C_FREQ_STD	(33 * HZ_PER_KHZ)
 
+/* The div of i2c reference clock on LS2K0500/2K1000/2K2000 */
+#define LS2X_I2C_2K_CLOCK_DIV	40
+
+/* The div of i2c reference clock on LS7A1000/7A2000 */
+#define LS2X_I2C_7A_CLOCK_DIV	50
+
 struct ls2x_i2c_priv {
 	struct i2c_adapter	adapter;
 	void __iomem		*base;
 	struct i2c_timings	i2c_t;
 	struct completion	cmd_complete;
+	unsigned int		div;
+	unsigned int		pclk;
 };
 
 /*
@@ -107,12 +116,14 @@ static void ls2x_i2c_adjust_bus_speed(struct ls2x_i2c_priv *priv)
 	else
 		t->bus_freq_hz = LS2X_I2C_FREQ_STD;
 
+	val = div64_u64((u64)priv->pclk * 10,
+			(u64)priv->div * t->bus_freq_hz) - 1;
+
 	/*
 	 * According to the chip manual, we can only access the registers as bytes,
 	 * otherwise the high bits will be truncated.
 	 * So set the I2C frequency with a sequential writeb() instead of writew().
 	 */
-	val = LS2X_I2C_PCLK_FREQ / (5 * t->bus_freq_hz) - 1;
 	writeb(FIELD_GET(GENMASK(7, 0), val), priv->base + I2C_LS2X_PRER_LO);
 	writeb(FIELD_GET(GENMASK(15, 8), val), priv->base + I2C_LS2X_PRER_HI);
 }
@@ -287,6 +298,7 @@ static const struct i2c_algorithm ls2x_i2c_algo = {
 static int ls2x_i2c_probe(struct platform_device *pdev)
 {
 	int ret, irq;
+	struct clk *clk;
 	struct i2c_adapter *adap;
 	struct ls2x_i2c_priv *priv;
 	struct device *dev = &pdev->dev;
@@ -304,6 +316,32 @@ static int ls2x_i2c_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
+	if (dev_of_node(dev)) {
+		clk = devm_clk_get_optional_enabled(dev, NULL);
+		if (IS_ERR(clk))
+			return PTR_ERR(clk);
+		if (clk) {
+			priv->pclk = clk_get_rate(clk);
+			if (!priv->pclk)
+				priv->pclk = LS2X_I2C_PCLK_FREQ;
+		} else {
+			priv->pclk = LS2X_I2C_PCLK_FREQ;
+		}
+
+		priv->div = (unsigned long)device_get_match_data(dev);
+		if (!priv->div)
+			priv->div = LS2X_I2C_2K_CLOCK_DIV;
+	} else {
+		/* clocks and clock-div properties are used only in ACPI path. */
+		ret = device_property_read_u32(dev, "clocks", &priv->pclk);
+		if (ret || !priv->pclk)
+			priv->pclk = LS2X_I2C_PCLK_FREQ;
+
+		ret = device_property_read_u32(dev, "clock-div", &priv->div);
+		if (ret || !priv->div)
+			priv->div = LS2X_I2C_7A_CLOCK_DIV;
+	}
+
 	/* Add the i2c adapter */
 	adap = &priv->adapter;
 	adap->retries = 5;
@@ -349,8 +387,8 @@ static DEFINE_RUNTIME_DEV_PM_OPS(ls2x_i2c_pm_ops,
 				 ls2x_i2c_suspend, ls2x_i2c_resume, NULL);
 
 static const struct of_device_id ls2x_i2c_id_table[] = {
-	{ .compatible = "loongson,ls2k-i2c" },
-	{ .compatible = "loongson,ls7a-i2c" },
+	{ .compatible = "loongson,ls2k-i2c", .data = (void *)LS2X_I2C_2K_CLOCK_DIV, },
+	{ .compatible = "loongson,ls7a-i2c", .data = (void *)LS2X_I2C_7A_CLOCK_DIV, },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, ls2x_i2c_id_table);
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v10 0/2] i2c: ls2x: Add clock- related properties and parsing
  2026-08-17  9:07 [PATCH v10 0/2] i2c: ls2x: Add clock- related properties and parsing Hongliang Wang
  2026-08-17  9:07 ` [PATCH v10 1/2] dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties Hongliang Wang
  2026-08-17  9:07 ` [PATCH v10 2/2] i2c: ls2x: Add clocks property parsing and adjust bus speed Hongliang Wang
@ 2026-08-17  9:23 ` Hongliang Wang
  2026-08-31  1:57   ` Hongliang Wang
  2 siblings, 1 reply; 7+ messages in thread
From: Hongliang Wang @ 2026-08-17  9:23 UTC (permalink / raw)
  To: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Wolfram Sang
  Cc: linux-i2c, devicetree, loongarch

Hi all,

Sorry for the duplicate 0/2 cover‑letter message in this thread.
Only the 09:07 UTC full V10 series (0/2, 1/2, 2/2) is the intended one,
please ignore the earlier 09:01 UTC standalone 0/2 cover‑letter.

The patches 1/2 and 2/2 are correct.

Thanks,
Hongliang Wang


On 2026/8/17 下午5:07, Hongliang Wang wrote:
> Hi all:
>
> This patch set adds clock related properties and parsing in dts and acpi.
>
> ======
> V10:
> Patch (2/2):
> - Replace '/' operator with div64_u64() to avoid __udivdi3 linker error on
>    32‑bit architectures with CONFIG_COMPILE_TEST.
>
> Link to V9:
> https://lore.kernel.org/all/20260810074927.25284-1-wanghongliang@loongson.cn/
>
> V9:
> Patch (2/2):
> - Rewrite the commit description
> - Use 64-bit arithmetic to avoid integer overflow during the clock calculation
> - Add checks to reject zero clock rates and ensure valid clock inputs
> - Modify the comment for clocks and clock-div properties
> - Add Tested-by tag from Xi Ruoyao, thanks
>
> Link to V8:
> https://lore.kernel.org/all/20260721122604.12717-1-wanghongliang@loongson.cn/
>
> V8:
> Patch (2/2):
> Fix the potential issues from Sashiko AI review:
>   - Add error checking for the pointer returned by devm_clk_get_optional_enabled();
>   - Add zero-value checking for the match data to provide default div.
>
> Link to V7:
> https://lore.kernel.org/all/20260707035104.3092-1-wanghongliang@loongson.cn/
>
> V7:
> Patch (2/2):
> Fix the potential issues from Sashiko AI review:
>   - Move the clock property parsing process to probe function to solve the issue
>     of calling `devm_clk_get_optional_enabled()` dynamically causes unbounded memory
>     leaks and unbalanced clock enable counts.
>   - Add non-zero checking to priv->div.
>
> Link to V6:
> https://lore.kernel.org/all/20260608024533.32419-1-wanghongliang@loongson.cn/
>
> V6:
> - Add Reviewed-by tag from Huacai, thanks.
> Patch (1/2):
>   - Remove CC stable.
>
> Link to V5:
> https://lore.kernel.org/all/20260604015848.18643-1-wanghongliang@loongson.cn/
>
> V5:
> Patch (1/2):
>   - Adjust the position of #include <dt-bindings/clock/loongson,ls2k-clk.h>;
>   - Add CC stable;
>   - Fix Signed-off-by.
> Patch (2/2):
>   - Replace 2K0500/2K1000/2K2000 with LS2K0500/2K1000/2K2000;
>   - Replace 7A1000/7A2000 with LS7A1000/7A2000;
>   - Replace if (clk && !IS_ERR(clk)) with if(!IS_ERR_OR_NULL(clk));
>   - Add document that clocks and clock-div are only ACPI properties in ACPI;
>   - Remove unsigned int cast in code (unsigned long)device_get_match_data(dev);
>   - Add CC stable;
>   - Fix Signed-off-by.
>
> Link to V4:
> https://lore.kernel.org/all/20260526031021.32662-1-wanghongliang@loongson.cn/
>
> V4:
> - Add Acked-by tag from Conor Dooley, thanks.
> Patch (2/2):
>   - Adjust the position of #include <linux/clk.h>;
>   - Remove struct ls2x_i2c_chip_data and use macro to describe div;
>   - Use div instead of factor in ls2x_i2c_adjust_bus_speed;
>   - Reverse the "if & else" code logic in ls2x_i2c_adjust_bus_speed;
>
> Link to V2:
> The PATCH v3 is incomplete, v4 is the replacement of v3, so the previous patch link is v2.
>
> [PATCH v2] dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties
> https://lore.kernel.org/all/20260507081010.12810-1-wanghongliang@loongson.cn/
> [PATCH v2] i2c: ls2x: Add clocks property parsing and adjust bus speed
> https://lore.kernel.org/all/20260507081010.12810-2-wanghongliang@loongson.cn/
>
> V2:
> [PATCH v2] dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties
> - Remove the custom properties clock-input and clock-div, use clock framework;
> [PATCH v2] i2c: ls2x: Add clocks property parsing and adjust bus speed
> - Use clock framework to obtain the i2c reference clock in dts.
>
> Link to V1:
> https://lore.kernel.org/all/20260325011852.19079-1-wanghongliang@loongson.cn/
>
> Hongliang Wang (2):
>    dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties
>    i2c: ls2x: Add clocks property parsing and adjust bus speed
>
>   .../bindings/i2c/loongson,ls2x-i2c.yaml       |  3 ++
>   drivers/i2c/busses/i2c-ls2x.c                 | 44 +++++++++++++++++--
>   2 files changed, 44 insertions(+), 3 deletions(-)
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v10 0/2] i2c: ls2x: Add clock- related properties and parsing
  2026-08-17  9:23 ` [PATCH v10 0/2] i2c: ls2x: Add clock- related properties and parsing Hongliang Wang
@ 2026-08-31  1:57   ` Hongliang Wang
  2026-09-21  3:04     ` Hongliang Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Hongliang Wang @ 2026-08-31  1:57 UTC (permalink / raw)
  To: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Wolfram Sang
  Cc: linux-i2c, devicetree, loongarch


On 2026/8/17 下午5:23, Hongliang Wang wrote:
> Hi all,
>
> Sorry for the duplicate 0/2 cover‑letter message in this thread.
> Only the 09:07 UTC full V10 series (0/2, 1/2, 2/2) is the intended one,
> please ignore the earlier 09:01 UTC standalone 0/2 cover‑letter.
>
> The patches 1/2 and 2/2 are correct.
>
> Thanks,
> Hongliang Wang
>
>
> On 2026/8/17 下午5:07, Hongliang Wang wrote:
>> Hi all:
>>
>> This patch set adds clock related properties and parsing in dts and 
>> acpi.
>>
>> ======
>> V10:
>> Patch (2/2):
>> - Replace '/' operator with div64_u64() to avoid __udivdi3 linker 
>> error on
>>    32‑bit architectures with CONFIG_COMPILE_TEST.
>>
>> Link to V9:
>> https://lore.kernel.org/all/20260810074927.25284-1-wanghongliang@loongson.cn/ 
>>
>>
>> V9:
>> Patch (2/2):
>> - Rewrite the commit description
>> - Use 64-bit arithmetic to avoid integer overflow during the clock 
>> calculation
>> - Add checks to reject zero clock rates and ensure valid clock inputs
>> - Modify the comment for clocks and clock-div properties
>> - Add Tested-by tag from Xi Ruoyao, thanks
>>
>> Link to V8:
>> https://lore.kernel.org/all/20260721122604.12717-1-wanghongliang@loongson.cn/ 
>>
>>
>> V8:
>> Patch (2/2):
>> Fix the potential issues from Sashiko AI review:
>>   - Add error checking for the pointer returned by 
>> devm_clk_get_optional_enabled();
>>   - Add zero-value checking for the match data to provide default div.
>>
>> Link to V7:
>> https://lore.kernel.org/all/20260707035104.3092-1-wanghongliang@loongson.cn/ 
>>
>>
>> V7:
>> Patch (2/2):
>> Fix the potential issues from Sashiko AI review:
>>   - Move the clock property parsing process to probe function to 
>> solve the issue
>>     of calling `devm_clk_get_optional_enabled()` dynamically causes 
>> unbounded memory
>>     leaks and unbalanced clock enable counts.
>>   - Add non-zero checking to priv->div.
>>
>> Link to V6:
>> https://lore.kernel.org/all/20260608024533.32419-1-wanghongliang@loongson.cn/ 
>>
>>
>> V6:
>> - Add Reviewed-by tag from Huacai, thanks.
>> Patch (1/2):
>>   - Remove CC stable.
>>
>> Link to V5:
>> https://lore.kernel.org/all/20260604015848.18643-1-wanghongliang@loongson.cn/ 
>>
>>
>> V5:
>> Patch (1/2):
>>   - Adjust the position of #include 
>> <dt-bindings/clock/loongson,ls2k-clk.h>;
>>   - Add CC stable;
>>   - Fix Signed-off-by.
>> Patch (2/2):
>>   - Replace 2K0500/2K1000/2K2000 with LS2K0500/2K1000/2K2000;
>>   - Replace 7A1000/7A2000 with LS7A1000/7A2000;
>>   - Replace if (clk && !IS_ERR(clk)) with if(!IS_ERR_OR_NULL(clk));
>>   - Add document that clocks and clock-div are only ACPI properties 
>> in ACPI;
>>   - Remove unsigned int cast in code (unsigned 
>> long)device_get_match_data(dev);
>>   - Add CC stable;
>>   - Fix Signed-off-by.
>>
>> Link to V4:
>> https://lore.kernel.org/all/20260526031021.32662-1-wanghongliang@loongson.cn/ 
>>
>>
>> V4:
>> - Add Acked-by tag from Conor Dooley, thanks.
>> Patch (2/2):
>>   - Adjust the position of #include <linux/clk.h>;
>>   - Remove struct ls2x_i2c_chip_data and use macro to describe div;
>>   - Use div instead of factor in ls2x_i2c_adjust_bus_speed;
>>   - Reverse the "if & else" code logic in ls2x_i2c_adjust_bus_speed;
>>
>> Link to V2:
>> The PATCH v3 is incomplete, v4 is the replacement of v3, so the 
>> previous patch link is v2.
>>
>> [PATCH v2] dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency 
>> properties
>> https://lore.kernel.org/all/20260507081010.12810-1-wanghongliang@loongson.cn/ 
>>
>> [PATCH v2] i2c: ls2x: Add clocks property parsing and adjust bus speed
>> https://lore.kernel.org/all/20260507081010.12810-2-wanghongliang@loongson.cn/ 
>>
>>
>> V2:
>> [PATCH v2] dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency 
>> properties
>> - Remove the custom properties clock-input and clock-div, use clock 
>> framework;
>> [PATCH v2] i2c: ls2x: Add clocks property parsing and adjust bus speed
>> - Use clock framework to obtain the i2c reference clock in dts.
>>
>> Link to V1:
>> https://lore.kernel.org/all/20260325011852.19079-1-wanghongliang@loongson.cn/ 
>>
>>
>> Hongliang Wang (2):
>>    dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties
>>    i2c: ls2x: Add clocks property parsing and adjust bus speed
>>
>>   .../bindings/i2c/loongson,ls2x-i2c.yaml       |  3 ++
>>   drivers/i2c/busses/i2c-ls2x.c                 | 44 +++++++++++++++++--
>>   2 files changed, 44 insertions(+), 3 deletions(-)
>>
Hi,

Gentle ping on the v10 patch series. Please let me know if there are any 
further changes needed.

Best regards,
Hongliang Wang


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v10 0/2] i2c: ls2x: Add clock- related properties and parsing
  2026-08-31  1:57   ` Hongliang Wang
@ 2026-09-21  3:04     ` Hongliang Wang
  0 siblings, 0 replies; 7+ messages in thread
From: Hongliang Wang @ 2026-09-21  3:04 UTC (permalink / raw)
  To: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Wolfram Sang
  Cc: linux-i2c, devicetree, loongarch


On 2026/8/31 上午9:57, Hongliang Wang wrote:
>
> On 2026/8/17 下午5:23, Hongliang Wang wrote:
>> Hi all,
>>
>> Sorry for the duplicate 0/2 cover‑letter message in this thread.
>> Only the 09:07 UTC full V10 series (0/2, 1/2, 2/2) is the intended one,
>> please ignore the earlier 09:01 UTC standalone 0/2 cover‑letter.
>>
>> The patches 1/2 and 2/2 are correct.
>>
>> Thanks,
>> Hongliang Wang
>>
>>
>> On 2026/8/17 下午5:07, Hongliang Wang wrote:
>>> Hi all:
>>>
>>> This patch set adds clock related properties and parsing in dts and 
>>> acpi.
>>>
>>> ======
>>> V10:
>>> Patch (2/2):
>>> - Replace '/' operator with div64_u64() to avoid __udivdi3 linker 
>>> error on
>>>    32‑bit architectures with CONFIG_COMPILE_TEST.
>>>
>>> Link to V9:
>>> https://lore.kernel.org/all/20260810074927.25284-1-wanghongliang@loongson.cn/ 
>>>
>>>
>>> V9:
>>> Patch (2/2):
>>> - Rewrite the commit description
>>> - Use 64-bit arithmetic to avoid integer overflow during the clock 
>>> calculation
>>> - Add checks to reject zero clock rates and ensure valid clock inputs
>>> - Modify the comment for clocks and clock-div properties
>>> - Add Tested-by tag from Xi Ruoyao, thanks
>>>
>>> Link to V8:
>>> https://lore.kernel.org/all/20260721122604.12717-1-wanghongliang@loongson.cn/ 
>>>
>>>
>>> V8:
>>> Patch (2/2):
>>> Fix the potential issues from Sashiko AI review:
>>>   - Add error checking for the pointer returned by 
>>> devm_clk_get_optional_enabled();
>>>   - Add zero-value checking for the match data to provide default div.
>>>
>>> Link to V7:
>>> https://lore.kernel.org/all/20260707035104.3092-1-wanghongliang@loongson.cn/ 
>>>
>>>
>>> V7:
>>> Patch (2/2):
>>> Fix the potential issues from Sashiko AI review:
>>>   - Move the clock property parsing process to probe function to 
>>> solve the issue
>>>     of calling `devm_clk_get_optional_enabled()` dynamically causes 
>>> unbounded memory
>>>     leaks and unbalanced clock enable counts.
>>>   - Add non-zero checking to priv->div.
>>>
>>> Link to V6:
>>> https://lore.kernel.org/all/20260608024533.32419-1-wanghongliang@loongson.cn/ 
>>>
>>>
>>> V6:
>>> - Add Reviewed-by tag from Huacai, thanks.
>>> Patch (1/2):
>>>   - Remove CC stable.
>>>
>>> Link to V5:
>>> https://lore.kernel.org/all/20260604015848.18643-1-wanghongliang@loongson.cn/ 
>>>
>>>
>>> V5:
>>> Patch (1/2):
>>>   - Adjust the position of #include 
>>> <dt-bindings/clock/loongson,ls2k-clk.h>;
>>>   - Add CC stable;
>>>   - Fix Signed-off-by.
>>> Patch (2/2):
>>>   - Replace 2K0500/2K1000/2K2000 with LS2K0500/2K1000/2K2000;
>>>   - Replace 7A1000/7A2000 with LS7A1000/7A2000;
>>>   - Replace if (clk && !IS_ERR(clk)) with if(!IS_ERR_OR_NULL(clk));
>>>   - Add document that clocks and clock-div are only ACPI properties 
>>> in ACPI;
>>>   - Remove unsigned int cast in code (unsigned 
>>> long)device_get_match_data(dev);
>>>   - Add CC stable;
>>>   - Fix Signed-off-by.
>>>
>>> Link to V4:
>>> https://lore.kernel.org/all/20260526031021.32662-1-wanghongliang@loongson.cn/ 
>>>
>>>
>>> V4:
>>> - Add Acked-by tag from Conor Dooley, thanks.
>>> Patch (2/2):
>>>   - Adjust the position of #include <linux/clk.h>;
>>>   - Remove struct ls2x_i2c_chip_data and use macro to describe div;
>>>   - Use div instead of factor in ls2x_i2c_adjust_bus_speed;
>>>   - Reverse the "if & else" code logic in ls2x_i2c_adjust_bus_speed;
>>>
>>> Link to V2:
>>> The PATCH v3 is incomplete, v4 is the replacement of v3, so the 
>>> previous patch link is v2.
>>>
>>> [PATCH v2] dt-bindings: i2c: ls2x-i2c: Add clocks and 
>>> clock-frequency properties
>>> https://lore.kernel.org/all/20260507081010.12810-1-wanghongliang@loongson.cn/ 
>>>
>>> [PATCH v2] i2c: ls2x: Add clocks property parsing and adjust bus speed
>>> https://lore.kernel.org/all/20260507081010.12810-2-wanghongliang@loongson.cn/ 
>>>
>>>
>>> V2:
>>> [PATCH v2] dt-bindings: i2c: ls2x-i2c: Add clocks and 
>>> clock-frequency properties
>>> - Remove the custom properties clock-input and clock-div, use clock 
>>> framework;
>>> [PATCH v2] i2c: ls2x: Add clocks property parsing and adjust bus speed
>>> - Use clock framework to obtain the i2c reference clock in dts.
>>>
>>> Link to V1:
>>> https://lore.kernel.org/all/20260325011852.19079-1-wanghongliang@loongson.cn/ 
>>>
>>>
>>> Hongliang Wang (2):
>>>    dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency 
>>> properties
>>>    i2c: ls2x: Add clocks property parsing and adjust bus speed
>>>
>>>   .../bindings/i2c/loongson,ls2x-i2c.yaml       |  3 ++
>>>   drivers/i2c/busses/i2c-ls2x.c                 | 44 
>>> +++++++++++++++++--
>>>   2 files changed, 44 insertions(+), 3 deletions(-)
>>>
> Hi,
>
> Gentle ping on the v10 patch series. Please let me know if there are 
> any further changes needed.
>
> Best regards,
> Hongliang Wang
Hi,

Gentle ping on the v10 patch series. Please let me know if there are any 
further changes needed.

Best regards,
Hongliang Wang


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-21  3:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17  9:07 [PATCH v10 0/2] i2c: ls2x: Add clock- related properties and parsing Hongliang Wang
2026-08-17  9:07 ` [PATCH v10 1/2] dt-bindings: i2c: ls2x-i2c: Add clocks and clock-frequency properties Hongliang Wang
2026-08-17  9:07 ` [PATCH v10 2/2] i2c: ls2x: Add clocks property parsing and adjust bus speed Hongliang Wang
2026-08-17  9:23 ` [PATCH v10 0/2] i2c: ls2x: Add clock- related properties and parsing Hongliang Wang
2026-08-31  1:57   ` Hongliang Wang
2026-09-21  3:04     ` Hongliang Wang
  -- strict thread matches above, loose matches on Subject: below --
2026-08-17  9:01 Hongliang Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox