Skip to contentSkip to conversation

i2c: i2c-mlxbf.c: bug fixes and new feature support

PATCH Applied Asmaa Mnebhi 2 participants 6 messages Sep 27, 2022

Subsystems (3)
lore
Share & tools
lore

Asmaa Mnebhi

author maintainer
#0 lore raw

v7 cover i2c: i2c-mlxbf.c: bug fixes and new feature support

Support BlueField-3 SoC in the first patch of this series and remove the device tree support in the second patch.

What has changed from v6->v7:
- the following patches were applied to for-next so they are removed from this series:
1) Support lock mechanism to avoid race condition between entities using the i2c bus
2) remove IRQF_ONESHOT flag as it is no longer needed.
3) Support multi slave functionality
- Fixed the $subject tag to "i2c: mlxbf"
- added missing check for 'ret' after allocating resources
- removed the DT binding file from the MAINTAINERS file

Asmaa Mnebhi (2):
i2c: mlxbf: support BlueField-3 SoC
i2c: mlxbf: remove device tree support

 .../bindings/i2c/mellanox,i2c-mlxbf.yaml      |  77 ---
 MAINTAINERS                                   |   2 +-
 drivers/i2c/busses/i2c-mlxbf.c                | 494 ++++++++++--------
 3 files changed, 281 insertions(+), 292 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.yaml
Signature · 1 line
2.30.1
author maintainer
#1 lore raw

PATCH v7 1/2 i2c: mlxbf: support BlueField-3 SoC

BlueField-3 SoC has the same I2C IP logic as previous BlueField-1 and 2 SoCs but it has different registers' addresses. This is an effort to keep this driver generic accross all BlueField generations.
This patch breaks down the "smbus" resource into 3 separate resources to enable us to use common registers' offsets for all BlueField SoCs:
struct mlxbf_i2c_resource *timer;
struct mlxbf_i2c_resource *mst;
struct mlxbf_i2c_resource *slv;

Of course, all offsets had to be adjusted accordingly, and we took this chance to reorganize the macros depending on the register block they target.

There are only 2 registers' offsets that do not fit within this schema so their offsets are passed as SoC-specific parameters:
smbus_master_rs_bytes_off
smbus_master_fsm_off

---
 MAINTAINERS                    |   1 +
 drivers/i2c/busses/i2c-mlxbf.c | 455 ++++++++++++++++++++-------------
 2 files changed, 285 insertions(+), 171 deletions(-)
MAINTAINERS +1 -0
index f5ca4aefd184..74af5b789d45 100644
@@ -12984,6 +12984,7 @@ F:	drivers/input/touchscreen/melfas_mip4.c
 
 MELLANOX BLUEFIELD I2C DRIVER
 M:	Khalil Blaiech <[email protected]>
+M:	Asmaa Mnebhi <[email protected]>
 L:	[email protected]
 S:	Supported
 F:	Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.yaml
drivers/i2c/busses/i2c-mlxbf.c +284 -171

853 lines not on this page · raw message

Signature · 1 line
2.30.1
Applied
#2 lore raw

Re: [PATCH v7 1/2] i2c: mlxbf: support BlueField-3 SoC

Quoted 15 lines · Asmaa Mnebhi

BlueField-3 SoC has the same I2C IP logic as previous BlueField-1 and 2 SoCs but it has different registers' addresses. This is an effort to keep this driver generic accross all BlueField generations.
This patch breaks down the "smbus" resource into 3 separate resources to enable us to use common registers' offsets for all BlueField SoCs:
struct mlxbf_i2c_resource *timer;
struct mlxbf_i2c_resource *mst;
struct mlxbf_i2c_resource *slv;

Of course, all offsets had to be adjusted accordingly, and we took this chance to reorganize the macros depending on the register block they target.

Quoted 7 lines

There are only 2 registers' offsets that do not fit within this schema so their offsets are passed as SoC-specific parameters:
smbus_master_rs_bytes_off
smbus_master_fsm_off

Applied to for-next, thanks!

author maintainer Applied
#3 lore raw

RE: [PATCH v7 1/2] i2c: mlxbf: support BlueField-3 SoC

Thank you Wolfram!

-----Original Message-----
From: Wolfram Sang <[email protected]>
Sent: Tuesday, September 27, 2022 4:47 PM
To: Asmaa Mnebhi <[email protected]>
Cc: [email protected]; [email protected]; Khalil Blaiech <[email protected]>
Subject: Re: [PATCH v7 1/2] i2c: mlxbf: support BlueField-3 SoC

Quoted 14 lines · Asmaa Mnebhi

BlueField-3 SoC has the same I2C IP logic as previous BlueField-1 and 2 SoCs but it has different registers' addresses. This is an effort to keep this driver generic accross all BlueField generations.
This patch breaks down the "smbus" resource into 3 separate resources to enable us to use common registers' offsets for all BlueField SoCs:
struct mlxbf_i2c_resource *timer;
struct mlxbf_i2c_resource *mst;
struct mlxbf_i2c_resource *slv;

Of course, all offsets had to be adjusted accordingly, and we took this chance to reorganize the macros depending on the register block they target.

Quoted 7 lines

There are only 2 registers' offsets that do not fit within this schema so their offsets are passed as SoC-specific parameters:
smbus_master_rs_bytes_off
smbus_master_fsm_off

Applied to for-next, thanks!

author maintainer
#4 lore raw

PATCH v7 2/2 i2c: mlxbf: remove device tree support

In reply to Asmaa Mnebhi

BlueField customers have to use the the BlueField firmware with UEFI ACPI tables so there is no need to have device tree support in the i2c-mlxbf.c driver. Remove the device tree binding documentation as well.

---
 .../bindings/i2c/mellanox,i2c-mlxbf.yaml      | 77 -------------------
 MAINTAINERS                                   |  1 -
 drivers/i2c/busses/i2c-mlxbf.c                | 49 +-----------
 3 files changed, 1 insertion(+), 126 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.yaml
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.yaml deleted +0 -77
deleted file mode 100644
index 93198d5d43a6..000000000000
@@ -1,77 +0,0 @@
-# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
-%YAML 1.2
----
-$id: http://devicetree.org/schemas/i2c/mellanox,i2c-mlxbf.yaml#
-$schema: http://devicetree.org/meta-schemas/core.yaml#
-
-title: Mellanox I2C SMBus on BlueField SoCs
-
-maintainers:
-  - Khalil Blaiech <[email protected]>
-
-allOf:
-  - $ref: /schemas/i2c/i2c-controller.yaml#
-
-properties:
-  compatible:
-    enum:
-      - mellanox,i2c-mlxbf1
-      - mellanox,i2c-mlxbf2
-
-  reg:
-    minItems: 3
-    items:
-      - description: Smbus block registers
-      - description: Cause master registers
-      - description: Cause slave registers
-      - description: Cause coalesce registers
-
-  interrupts:
-    maxItems: 1
-
-  clock-frequency:
-    enum: [ 100000, 400000, 1000000 ]
-    description:
-      bus frequency used to configure timing registers;
-      The frequency is expressed in Hz. Default is 100000.
-
-required:
-  - compatible
-  - reg
-  - interrupts
-
-unevaluatedProperties: false
-
-if:
-  properties:
-    compatible:
-      contains:
-        enum:
-          - mellanox,i2c-mlxbf1
-
-then:
-  properties:
-    reg:
-      maxItems: 3
-
-examples:
-  - |
-    i2c@2804000 {
-        compatible = "mellanox,i2c-mlxbf1";
-        reg = <0x02804000 0x800>,
-              <0x02801200 0x020>,
-              <0x02801260 0x020>;
-        interrupts = <57>;
-        clock-frequency = <100000>;
-    };
-
-  - |
-    i2c@2808800 {
-        compatible = "mellanox,i2c-mlxbf2";
-        reg = <0x02808800 0x600>,
-              <0x02808e00 0x020>,
-              <0x02808e20 0x020>,
-              <0x02808e40 0x010>;
-        interrupts = <57>;
-        clock-frequency = <400000>;
-    };
MAINTAINERS +0 -1
index 74af5b789d45..a3f380f15ff5 100644
@@ -12987,7 +12987,6 @@ M:	Khalil Blaiech <[email protected]>
 M:	Asmaa Mnebhi <[email protected]>
 L:	[email protected]
 S:	Supported
-F:	Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.yaml
 F:	drivers/i2c/busses/i2c-mlxbf.c
 
 MELLANOX ETHERNET DRIVER (mlx4_en)
drivers/i2c/busses/i2c-mlxbf.c +1 -48

77 lines not on this page · raw message

Signature · 1 line
2.30.1
Applied
#5 lore raw

Re: [PATCH v7 2/2] i2c: mlxbf: remove device tree support

Quoted 7 lines · Asmaa Mnebhi

BlueField customers have to use the the BlueField firmware with UEFI ACPI tables so there is no need to have device tree support in the i2c-mlxbf.c driver. Remove the device tree binding documentation as well.

Applied to for-next, thanks!