public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] i2c: ls2x: Add clock- related properties and parsing
@ 2026-03-25  1:18 Hongliang Wang
  2026-03-25  1:18 ` [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties Hongliang Wang
  2026-03-25  1:18 ` [PATCH v1 2/2] i2c: ls2x: Add clock-input and clock-div properties parsing Hongliang Wang
  0 siblings, 2 replies; 15+ messages in thread
From: Hongliang Wang @ 2026-03-25  1:18 UTC (permalink / raw)
  To: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Hongliang Wang
  Cc: linux-i2c, devicetree, loongarch

From: wanghongliang <wanghongliang@loongson.cn>

Hi all,

On 3A/7A/2K platform, the input clock of i2c controller and the divisor of
input clock maybe different, so define the clock-input and clock-div properties
in i2c controller node description of dts or acpi. clock-input describes the
input clock of i2c controller and clock-div describes the clock divisor of the
input clock.

Compared to v1, v2 modified the following content:
1. Add dt-bindings
2. In i2c-ls2x driver, the definition of pclk and div variables is placed on
one line
3. list the different value of clock-input and clock-div on different platforms

Thanks.

wanghongliang (2):
  dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  i2c: ls2x: Add clock-input and clock-div properties parsing

 .../devicetree/bindings/i2c/loongson,ls2x-i2c.yaml  | 13 +++++++++++++
 drivers/i2c/busses/i2c-ls2x.c                       |  7 ++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

-- 
2.47.2


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

* [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  2026-03-25  1:18 [PATCH v2 0/2] i2c: ls2x: Add clock- related properties and parsing Hongliang Wang
@ 2026-03-25  1:18 ` Hongliang Wang
  2026-03-25 11:42   ` Krzysztof Kozlowski
  2026-03-25 11:43   ` Krzysztof Kozlowski
  2026-03-25  1:18 ` [PATCH v1 2/2] i2c: ls2x: Add clock-input and clock-div properties parsing Hongliang Wang
  1 sibling, 2 replies; 15+ messages in thread
From: Hongliang Wang @ 2026-03-25  1:18 UTC (permalink / raw)
  To: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Hongliang Wang
  Cc: linux-i2c, devicetree, loongarch

From: wanghongliang <wanghongliang@loongson.cn>

Add clock-input and clock-div properties.

clock-input describes the input clock of i2c controller.
clock-div describes the clock divisor of the input clock
of i2c controller.

Prcescale = (clock-input * 10) / (clock-div * t->bus_freq_hz) - 1

Signed-off-by: wanghongliang <wanghongliang@loongson.cn>
---
 .../devicetree/bindings/i2c/loongson,ls2x-i2c.yaml  | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml b/Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml
index 67882ec6e06a..4659d7012bce 100644
--- a/Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml
+++ b/Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml
@@ -24,6 +24,16 @@ properties:
   interrupts:
     maxItems: 1
 
+  clock-input:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Describes the input clock of i2c controller in HZ.
+
+  clock-div:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Describes the divisor of the input clock of i2c controller.
+
 required:
   - compatible
   - reg
@@ -40,6 +50,9 @@ examples:
         reg = <0x1fe21000 0x8>;
         interrupt-parent = <&extioiic>;
         interrupts = <22 IRQ_TYPE_LEVEL_LOW>;
+        clock-frequency = <100000>;
+        clock-input = <100000000>;
+        clock-div = <40>;
         #address-cells = <1>;
         #size-cells = <0>;
 
-- 
2.47.2


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

* [PATCH v1 2/2] i2c: ls2x: Add clock-input and clock-div properties parsing
  2026-03-25  1:18 [PATCH v2 0/2] i2c: ls2x: Add clock- related properties and parsing Hongliang Wang
  2026-03-25  1:18 ` [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties Hongliang Wang
@ 2026-03-25  1:18 ` Hongliang Wang
  1 sibling, 0 replies; 15+ messages in thread
From: Hongliang Wang @ 2026-03-25  1:18 UTC (permalink / raw)
  To: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Hongliang Wang
  Cc: linux-i2c, devicetree, loongarch

From: wanghongliang <wanghongliang@loongson.cn>

On 3A/7A/2K platform, the input clock of i2c controller and
the divisor of input clock maybe different, so define the
clock-input and clock-div properties in i2c controller node
description of dts or acpi. clock-input describes the input
clock of i2c controller and clock-div describes the clock
divisor of the input clock.

The formulas is
Prcescale = (clock-input * 10) / (clock-div * t->bus_freq_hz) - 1

The value of clock-input and clock-div on different platforms are
listed below:

1.7A1000/7A2000:
clock-input = 80MHZ
clock-div = 50

2.3A5000/3C5000/3A6000/3C6000:
clock-input = 100MHZ
clock-div = 40

3.2K0500/2K1000LA/2K2000:
clock-input = 100MHZ
clock-div = 40

4.2K3000:
clock-input = 100MHZ
clock-div = 55

Signed-off-by: wanghongliang <wanghongliang@loongson.cn>
---
 drivers/i2c/busses/i2c-ls2x.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-ls2x.c b/drivers/i2c/busses/i2c-ls2x.c
index b475dd27b7af..08c242e5fd75 100644
--- a/drivers/i2c/busses/i2c-ls2x.c
+++ b/drivers/i2c/busses/i2c-ls2x.c
@@ -96,6 +96,7 @@ static irqreturn_t ls2x_i2c_isr(int this_irq, void *dev_id)
 static void ls2x_i2c_adjust_bus_speed(struct ls2x_i2c_priv *priv)
 {
 	u16 val;
+	u32 pclk, div;
 	struct i2c_timings *t = &priv->i2c_t;
 	struct device *dev = priv->adapter.dev.parent;
 	u32 acpi_speed = i2c_acpi_find_bus_speed(dev);
@@ -107,12 +108,16 @@ static void ls2x_i2c_adjust_bus_speed(struct ls2x_i2c_priv *priv)
 	else
 		t->bus_freq_hz = LS2X_I2C_FREQ_STD;
 
+	if (!device_property_read_u32(dev, "clock-input", &pclk) &&
+	    !device_property_read_u32(dev, "clock-div", &div) && div != 0)
+		val = (pclk * 10) / (div * t->bus_freq_hz) - 1;
+	else
+		val = LS2X_I2C_PCLK_FREQ / (5 * 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);
 }
-- 
2.47.2


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

* Re: [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  2026-03-25  1:18 ` [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties Hongliang Wang
@ 2026-03-25 11:42   ` Krzysztof Kozlowski
  2026-03-25 11:43   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-25 11:42 UTC (permalink / raw)
  To: Hongliang Wang
  Cc: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-i2c, devicetree, loongarch

On Wed, Mar 25, 2026 at 09:18:51AM +0800, Hongliang Wang wrote:
> From: wanghongliang <wanghongliang@loongson.cn>
> 
> Add clock-input and clock-div properties.
> 
> clock-input describes the input clock of i2c controller.

No, it does not.


> clock-div describes the clock divisor of the input clock
> of i2c controller.

No, it does not.

Write proper explanations, instead of justyfing your code with
tautology.

> 
> Prcescale = (clock-input * 10) / (clock-div * t->bus_freq_hz) - 1
> 
> Signed-off-by: wanghongliang <wanghongliang@loongson.cn>
> ---
>  .../devicetree/bindings/i2c/loongson,ls2x-i2c.yaml  | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml b/Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml
> index 67882ec6e06a..4659d7012bce 100644
> --- a/Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml
> +++ b/Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml
> @@ -24,6 +24,16 @@ properties:
>    interrupts:
>      maxItems: 1
>  
> +  clock-input:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description:
> +      Describes the input clock of i2c controller in HZ.

"clocks" property describes the clock input. And it is not in Hz (not
HZ! It is coming from a person's name) but phandle already defined.

> +
> +  clock-div:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description:
> +      Describes the divisor of the input clock of i2c controller.

Use clock framework.

> +
>  required:
>    - compatible
>    - reg
> @@ -40,6 +50,9 @@ examples:
>          reg = <0x1fe21000 0x8>;
>          interrupt-parent = <&extioiic>;
>          interrupts = <22 IRQ_TYPE_LEVEL_LOW>;
> +        clock-frequency = <100000>;
> +        clock-input = <100000000>;
> +        clock-div = <40>;
>          #address-cells = <1>;
>          #size-cells = <0>;
>  
> -- 
> 2.47.2
> 

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

* Re: [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  2026-03-25  1:18 ` [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties Hongliang Wang
  2026-03-25 11:42   ` Krzysztof Kozlowski
@ 2026-03-25 11:43   ` Krzysztof Kozlowski
  2026-03-26  2:12     ` Hongliang Wang
  1 sibling, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-25 11:43 UTC (permalink / raw)
  To: Hongliang Wang
  Cc: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-i2c, devicetree, loongarch

On Wed, Mar 25, 2026 at 09:18:51AM +0800, Hongliang Wang wrote:
> From: wanghongliang <wanghongliang@loongson.cn>
> 
> Add clock-input and clock-div properties.
> 
> clock-input describes the input clock of i2c controller.
> clock-div describes the clock divisor of the input clock
> of i2c controller.
> 
> Prcescale = (clock-input * 10) / (clock-div * t->bus_freq_hz) - 1
> 
> Signed-off-by: wanghongliang <wanghongliang@loongson.cn>

Also, why are you using inconsistent identities?

Best regards,
Krzysztof


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

* Re: [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  2026-03-25 11:43   ` Krzysztof Kozlowski
@ 2026-03-26  2:12     ` Hongliang Wang
  2026-03-26  7:02       ` Krzysztof Kozlowski
  2026-03-26  7:21       ` Andi Shyti
  0 siblings, 2 replies; 15+ messages in thread
From: Hongliang Wang @ 2026-03-26  2:12 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-i2c, devicetree, loongarch

Hi Krzysztof,

Consider the clock framework relies on the device tree, and can only be 
used on
Loongson 2K platform with dts parameter mechanism, It cannot be used on 
Loongson
3A+7A platform with the acpi parameter mechanism.
The i2c-ls2x driver is compatible with both Loongson 2K and 3A+7A 
platform, parse
the same parameters regardless of dts or acpi parameter passing, So 
clock-input
and clock-div attributes are defined to describe input clock of i2c 
controller and
divisor of input clock. It can be used on both 2K and 3A+7A platform.

Thanks

Hongliang Wang

On 2026/3/25 下午7:43, Krzysztof Kozlowski wrote:
> On Wed, Mar 25, 2026 at 09:18:51AM +0800, Hongliang Wang wrote:
>> From: wanghongliang <wanghongliang@loongson.cn>
>>
>> Add clock-input and clock-div properties.
>>
>> clock-input describes the input clock of i2c controller.
>> clock-div describes the clock divisor of the input clock
>> of i2c controller.
>>
>> Prcescale = (clock-input * 10) / (clock-div * t->bus_freq_hz) - 1
>>
>> Signed-off-by: wanghongliang <wanghongliang@loongson.cn>
> Also, why are you using inconsistent identities?
>
> Best regards,
> Krzysztof


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

* Re: [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  2026-03-26  2:12     ` Hongliang Wang
@ 2026-03-26  7:02       ` Krzysztof Kozlowski
  2026-03-26  7:49         ` Krzysztof Kozlowski
  2026-03-26  7:21       ` Andi Shyti
  1 sibling, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-26  7:02 UTC (permalink / raw)
  To: Hongliang Wang
  Cc: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-i2c, devicetree, loongarch

On 26/03/2026 03:12, Hongliang Wang wrote:
> Hi Krzysztof,
> 
> Consider the clock framework relies on the device tree, and can only be 
> used on
> Loongson 2K platform with dts parameter mechanism, It cannot be used on 
> Loongson

Don't top post or request read receipts.

> 3A+7A platform with the acpi parameter mechanism.

And this patch is for ACPI? Then we finish discussion here, because
dt-bindings is not for ACPI.

> The i2c-ls2x driver is compatible with both Loongson 2K and 3A+7A 
> platform, parse
> the same parameters regardless of dts or acpi parameter passing, So 
> clock-input
> and clock-div attributes are defined to describe input clock of i2c 
> controller and
> divisor of input clock. It can be used on both 2K and 3A+7A platform.

And you cannot use them in DTS.

Best regards,
Krzysztof

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

* Re: [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  2026-03-26  2:12     ` Hongliang Wang
  2026-03-26  7:02       ` Krzysztof Kozlowski
@ 2026-03-26  7:21       ` Andi Shyti
  2026-03-27  2:08         ` Hongliang Wang
  1 sibling, 1 reply; 15+ messages in thread
From: Andi Shyti @ 2026-03-26  7:21 UTC (permalink / raw)
  To: Hongliang Wang
  Cc: Krzysztof Kozlowski, Binbin Zhou, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-i2c, devicetree,
	loongarch

Hi Hongliang,

> Consider the clock framework relies on the device tree, and can only be used
> on
> Loongson 2K platform with dts parameter mechanism, It cannot be used on
> Loongson
> 3A+7A platform with the acpi parameter mechanism.
> The i2c-ls2x driver is compatible with both Loongson 2K and 3A+7A platform,
> parse
> the same parameters regardless of dts or acpi parameter passing, So
> clock-input
> and clock-div attributes are defined to describe input clock of i2c
> controller and
> divisor of input clock. It can be used on both 2K and 3A+7A platform.

Thanks for the explanation, but please do consider Krzysztof's
review. Without him agreeing on the change I can't take your
patch.

If you have questions, please ask.

Andi

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

* Re: [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  2026-03-26  7:02       ` Krzysztof Kozlowski
@ 2026-03-26  7:49         ` Krzysztof Kozlowski
  2026-03-26 11:48           ` Hongliang Wang
  2026-03-27  3:09           ` Hongliang Wang
  0 siblings, 2 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-26  7:49 UTC (permalink / raw)
  To: Hongliang Wang
  Cc: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-i2c, devicetree, loongarch

On 26/03/2026 08:02, Krzysztof Kozlowski wrote:
> On 26/03/2026 03:12, Hongliang Wang wrote:
>> Hi Krzysztof,
>>
>> Consider the clock framework relies on the device tree, and can only be 
>> used on
>> Loongson 2K platform with dts parameter mechanism, It cannot be used on 
>> Loongson
> 
> Don't top post or request read receipts.
> 
>> 3A+7A platform with the acpi parameter mechanism.
> 
> And this patch is for ACPI? Then we finish discussion here, because
> dt-bindings is not for ACPI.
> 
>> The i2c-ls2x driver is compatible with both Loongson 2K and 3A+7A 
>> platform, parse
>> the same parameters regardless of dts or acpi parameter passing, So 
>> clock-input
>> and clock-div attributes are defined to describe input clock of i2c 
>> controller and
>> divisor of input clock. It can be used on both 2K and 3A+7A platform.
> 
> And you cannot use them in DTS.

I need to keep guessing what you want to achieve, because neither your
message nor commit text was explicit - if you need properties for ACPI
and you want to be sure that DTS does not have them, then you could
define them as "foo:false" with a comment why (you always explain WHY
you are doing things). We don't have such convention so far, but I think
it will be useful when Rob finishes the ABI checker.

*Otherwise* minimum would be a comment in the driver that these are not
allowed in DTS.

Best regards,
Krzysztof

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

* Re: [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  2026-03-26  7:49         ` Krzysztof Kozlowski
@ 2026-03-26 11:48           ` Hongliang Wang
  2026-03-26 12:23             ` Krzysztof Kozlowski
  2026-03-27  3:09           ` Hongliang Wang
  1 sibling, 1 reply; 15+ messages in thread
From: Hongliang Wang @ 2026-03-26 11:48 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-i2c, devicetree, loongarch

Hi Krzysztof and Andi,

Sorry, I didn't express myself clearly. The purpose of defining clock-input and
clock-div properties is to use them in both acpi and dts. If these properties
cannot be used in dts, can I first use them in acpi? and second, use clock
framework in dts.
if these properties can be used in acpi, use clocks property describes the
clock input may be appropriate.

the [PATCH v2] i2c: ls2x: Add clocks and clock-div properties parsing for ACPI
as follows:

 From 40bdf5588594d2b51f50682fb841c6cbe87c4297 Mon Sep 17 00:00:00 2001
From: wanghongliang <wanghongliang@loongson.cn>
Date: Sun, 12 Apr 2026 03:13:09 +0800
Subject: [PATCH v2] i2c: ls2x: Add clocks and clock-div properties parsing for
  ACPI

On 3A/7A/2K3000 platform, the input clock of i2c controller
and the divisor of input clock maybe different, so define
the clocks and clock-div properties in Device (I2Cx) in acpi
parameter passing. clocks describes the input clock of i2c
controller and clock-div describes the clock divisor of the
input clock.

  Device (I2C1)
  {
    Name (_HID, "LOON0004" /* AT Real-Time Clock */)  // _HID: Hardware ID
    Name (_UID, 0x1)  // _UID: Unique ID
    Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
    {
      ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301")
      Package (0x03)
      {
        Package (0x02)
        {
          "clock-frequency",
          100000
        }
        Package (0x02)
        {
          "clocks",
          100000000
        }
        Package (0x02)
        {
          "clock-div",
          40
        }
      }
    })

The formulas is
Prcescale = (clock-input * 10) / (clock-div * t->bus_freq_hz) - 1

The value of clocks and clock-div on different platforms are
listed below:

1.7A1000/7A2000:
clock-input = 80MHZ
clock-div = 50

2.3A5000/3C5000/3A6000/3C6000:
clock-input = 100MHZ
clock-div = 40

3.2K3000:
clock-input = 100MHZ
clock-div = 55

Signed-off-by: wanghongliang <wanghongliang@loongson.cn>
---
  drivers/i2c/busses/i2c-ls2x.c | 13 ++++++++++++-
  1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-ls2x.c b/drivers/i2c/busses/i2c-ls2x.c
index b475dd27b7af..4d1d461d065a 100644
--- a/drivers/i2c/busses/i2c-ls2x.c
+++ b/drivers/i2c/busses/i2c-ls2x.c
@@ -96,6 +96,7 @@ static irqreturn_t ls2x_i2c_isr(int this_irq, void *dev_id)
  static void ls2x_i2c_adjust_bus_speed(struct ls2x_i2c_priv *priv)
  {
  	u16 val;
+	u32 pclk, div;
  	struct i2c_timings *t = &priv->i2c_t;
  	struct device *dev = priv->adapter.dev.parent;
  	u32 acpi_speed = i2c_acpi_find_bus_speed(dev);
@@ -107,12 +108,22 @@ static void ls2x_i2c_adjust_bus_speed(struct ls2x_i2c_priv *priv)
  	else
  		t->bus_freq_hz = LS2X_I2C_FREQ_STD;
  
+	if (has_acpi_companion(dev)) {
+		if (!device_property_read_u32(dev, "clock-input", &pclk) &&
+		    !device_property_read_u32(dev, "clock-div", &div) &&
+		    div != 0)
+			val = (pclk * 10) / (div * t->bus_freq_hz) - 1;
+		else
+			val = LS2X_I2C_PCLK_FREQ / (5 * t->bus_freq_hz) - 1;
+	} else {
+		val = LS2X_I2C_PCLK_FREQ / (5 * 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);
  }
-- 
2.47.2

Best regards,
Hongliang Wang

On 2026/3/26 下午3:49, Krzysztof Kozlowski wrote:
> On 26/03/2026 08:02, Krzysztof Kozlowski wrote:
>> On 26/03/2026 03:12, Hongliang Wang wrote:
>>> Hi Krzysztof,
>>>
>>> Consider the clock framework relies on the device tree, and can only be
>>> used on
>>> Loongson 2K platform with dts parameter mechanism, It cannot be used on
>>> Loongson
>> Don't top post or request read receipts.
>>
>>> 3A+7A platform with the acpi parameter mechanism.
>> And this patch is for ACPI? Then we finish discussion here, because
>> dt-bindings is not for ACPI.
>>
>>> The i2c-ls2x driver is compatible with both Loongson 2K and 3A+7A
>>> platform, parse
>>> the same parameters regardless of dts or acpi parameter passing, So
>>> clock-input
>>> and clock-div attributes are defined to describe input clock of i2c
>>> controller and
>>> divisor of input clock. It can be used on both 2K and 3A+7A platform.
>> And you cannot use them in DTS.
> I need to keep guessing what you want to achieve, because neither your
> message nor commit text was explicit - if you need properties for ACPI
> and you want to be sure that DTS does not have them, then you could
> define them as "foo:false" with a comment why (you always explain WHY
> you are doing things). We don't have such convention so far, but I think
> it will be useful when Rob finishes the ABI checker.
>
> *Otherwise* minimum would be a comment in the driver that these are not
> allowed in DTS.
>
> Best regards,
> Krzysztof


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

* Re: [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  2026-03-26 11:48           ` Hongliang Wang
@ 2026-03-26 12:23             ` Krzysztof Kozlowski
  2026-03-27  2:06               ` Hongliang Wang
  0 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-26 12:23 UTC (permalink / raw)
  To: Hongliang Wang
  Cc: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-i2c, devicetree, loongarch

On 26/03/2026 12:48, Hongliang Wang wrote:
> Hi Krzysztof and Andi,
> 
> Sorry, I didn't express myself clearly. The purpose of defining clock-input and
> clock-div properties is to use them in both acpi and dts. If these properties
> cannot be used in dts, can I first use them in acpi? and second, use clock
> framework in dts.

I already asked you:
1. Stop requesting read receipts on your email
2. Don't top post.

I already told you also why these cannot be in DTS. Respond to technical
arguments, not top-post of what you want.

Best regards,
Krzysztof

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

* Re: [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  2026-03-26 12:23             ` Krzysztof Kozlowski
@ 2026-03-27  2:06               ` Hongliang Wang
  0 siblings, 0 replies; 15+ messages in thread
From: Hongliang Wang @ 2026-03-27  2:06 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-i2c, devicetree, loongarch


On 2026/3/26 下午8:23, Krzysztof Kozlowski wrote:
> On 26/03/2026 12:48, Hongliang Wang wrote:
>> Hi Krzysztof and Andi,
>>
>> Sorry, I didn't express myself clearly. The purpose of defining clock-input and
>> clock-div properties is to use them in both acpi and dts. If these properties
>> cannot be used in dts, can I first use them in acpi? and second, use clock
>> framework in dts.
> I already asked you:
> 1. Stop requesting read receipts on your email
OK, I have set my email and removed the read receipts.
> 2. Don't top post.
OK
>
> I already told you also why these cannot be in DTS. Respond to technical
> arguments, not top-post of what you want.
OK
>
> Best regards,
> Krzysztof
Best regards,
Hongliang Wang



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

* Re: [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  2026-03-26  7:21       ` Andi Shyti
@ 2026-03-27  2:08         ` Hongliang Wang
  0 siblings, 0 replies; 15+ messages in thread
From: Hongliang Wang @ 2026-03-27  2:08 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Krzysztof Kozlowski, Binbin Zhou, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-i2c, devicetree,
	loongarch


On 2026/3/26 下午3:21, Andi Shyti wrote:
> Hi Hongliang,
>
>> Consider the clock framework relies on the device tree, and can only be used
>> on
>> Loongson 2K platform with dts parameter mechanism, It cannot be used on
>> Loongson
>> 3A+7A platform with the acpi parameter mechanism.
>> The i2c-ls2x driver is compatible with both Loongson 2K and 3A+7A platform,
>> parse
>> the same parameters regardless of dts or acpi parameter passing, So
>> clock-input
>> and clock-div attributes are defined to describe input clock of i2c
>> controller and
>> divisor of input clock. It can be used on both 2K and 3A+7A platform.
> Thanks for the explanation, but please do consider Krzysztof's
> review. Without him agreeing on the change I can't take your
> patch.
>
> If you have questions, please ask.
OK, thank you
> Andi


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

* Re: [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  2026-03-26  7:49         ` Krzysztof Kozlowski
  2026-03-26 11:48           ` Hongliang Wang
@ 2026-03-27  3:09           ` Hongliang Wang
  2026-03-27  6:39             ` Krzysztof Kozlowski
  1 sibling, 1 reply; 15+ messages in thread
From: Hongliang Wang @ 2026-03-27  3:09 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-i2c, devicetree, loongarch


On 2026/3/26 下午3:49, Krzysztof Kozlowski wrote:
> On 26/03/2026 08:02, Krzysztof Kozlowski wrote:
>> On 26/03/2026 03:12, Hongliang Wang wrote:
>>> Hi Krzysztof,
>>>
>>> Consider the clock framework relies on the device tree, and can only be
>>> used on
>>> Loongson 2K platform with dts parameter mechanism, It cannot be used on
>>> Loongson
>> Don't top post or request read receipts.
OK
>>> 3A+7A platform with the acpi parameter mechanism.
>> And this patch is for ACPI? Then we finish discussion here, because
>> dt-bindings is not for ACPI.
>>
The initial idea was that this patch could be used for both ACPI and DTS.
>>> The i2c-ls2x driver is compatible with both Loongson 2K and 3A+7A
>>> platform, parse
>>> the same parameters regardless of dts or acpi parameter passing, So
>>> clock-input
>>> and clock-div attributes are defined to describe input clock of i2c
>>> controller and
>>> divisor of input clock. It can be used on both 2K and 3A+7A platform.
>> And you cannot use them in DTS.
OK
> I need to keep guessing what you want to achieve, because neither your
> message nor commit text was explicit
What I want to achieve is to describe the input clock and divisor of I2C 
controller
through parameters passing, and the parameters can be used in both ACPI 
and DTS.
because clock framework cannot be used for ACPI, So I defined two new 
properties.
>   - if you need properties for ACPI
> and you want to be sure that DTS does not have them, then you could
> define them as "foo:false" with a comment why (you always explain WHY
> you are doing things). We don't have such convention so far, but I think
> it will be useful when Rob finishes the ABI checker.
>
> *Otherwise* minimum would be a comment in the driver that these are not
> allowed in DTS.
>
> Best regards,
> Krzysztof

Best regards,
Hongliang Wang


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

* Re: [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties
  2026-03-27  3:09           ` Hongliang Wang
@ 2026-03-27  6:39             ` Krzysztof Kozlowski
  0 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-27  6:39 UTC (permalink / raw)
  To: Hongliang Wang
  Cc: Binbin Zhou, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-i2c, devicetree, loongarch

On 27/03/2026 04:09, Hongliang Wang wrote:
> The initial idea was that this patch could be used for both ACPI and DTS.
>>>> The i2c-ls2x driver is compatible with both Loongson 2K and 3A+7A
>>>> platform, parse
>>>> the same parameters regardless of dts or acpi parameter passing, So
>>>> clock-input
>>>> and clock-div attributes are defined to describe input clock of i2c
>>>> controller and
>>>> divisor of input clock. It can be used on both 2K and 3A+7A platform.
>>> And you cannot use them in DTS.
> OK
>> I need to keep guessing what you want to achieve, because neither your
>> message nor commit text was explicit
> What I want to achieve is to describe the input clock and divisor of I2C 
> controller

Input clocks are defined as clock inputs obviously in DT, not as
integers. Bindings need to describe the hardware, so start with that.


Best regards,
Krzysztof

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

end of thread, other threads:[~2026-03-27  6:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25  1:18 [PATCH v2 0/2] i2c: ls2x: Add clock- related properties and parsing Hongliang Wang
2026-03-25  1:18 ` [PATCH v1 1/2] dt-bindings: i2c: ls2x-i2c: Add clock- related properties Hongliang Wang
2026-03-25 11:42   ` Krzysztof Kozlowski
2026-03-25 11:43   ` Krzysztof Kozlowski
2026-03-26  2:12     ` Hongliang Wang
2026-03-26  7:02       ` Krzysztof Kozlowski
2026-03-26  7:49         ` Krzysztof Kozlowski
2026-03-26 11:48           ` Hongliang Wang
2026-03-26 12:23             ` Krzysztof Kozlowski
2026-03-27  2:06               ` Hongliang Wang
2026-03-27  3:09           ` Hongliang Wang
2026-03-27  6:39             ` Krzysztof Kozlowski
2026-03-26  7:21       ` Andi Shyti
2026-03-27  2:08         ` Hongliang Wang
2026-03-25  1:18 ` [PATCH v1 2/2] i2c: ls2x: Add clock-input and clock-div properties parsing Hongliang Wang

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