i2c: added driver for Mellanox BlueField SoC
Subsystems (2)
v3 cover i2c: added driver for Mellanox BlueField SoC
Added I2C SMBus driver and device tree bindings documentation.
Changes since v2:
1) Device bindings documentation:
- Omit shared resources from the controller instance.
- Update the 'compatible' property and support the second generation of the Mellanox BlueField SoC.
- Fix file format; replace spaces with tabs.
2) Device driver source:
- Provide common register definition.
- Update the "compatible" string and add a new entry to the mlx_i2c_dt_ids array.
- Add a new entry to the mlx_i2c_acpi_ids array tosupport a new device _HID.
- Update the device probe routines to derive the device type based on the instance property described in either devicetree or ACPI.
- Define new handlers to request and release the shared resources. These handlers relies on the device type.
Khalil Blaiech (2):
i2c: i2c-mlx: I2C SMBus driver for Mellanox BlueField SoC
dt-bindings: i2c: I2C binding for Mellanox BlueField SoC
.../devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt | 71 + drivers/i2c/busses/Kconfig | 13 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-mlx.c | 2512 ++++++++++++++++++++ 4 files changed, 2597 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt create mode 100644 drivers/i2c/busses/i2c-mlx.c
Signature · 1 line
2.1.2
PATCH v3 2/2 dt-bindings: i2c: I2C binding for Mellanox BlueField SoC
Added device tree bindings documentation for Mellanox BlueField I2C SMBus controller.
--- .../devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt new file +71 -0
@@ -0,0 +1,71 @@ +Device tree configuration for the Mellanox I2C SMBus on BlueField SoCs + +Required Properties: +- reg : address offset and length of the device registers. The + registers consists of a set of dedicated and shared + resources: + + 1: Smbus block registers. + 2: Cause master registers. + 3: Cause slave registers. + + The BlueField SoCs includes three I2C bus controllers; + the set of resources <address length> must be defined + as follow: + + BlueField 1: + + * i2c bus 0: + <0x02804000 0x800> /* Smbus[0] */ + <0x02801200 0x020> /* Cause Master[0] */ + <0x02801260 0x020> /* Cause Slave[0] */ + + * i2c bus 1: + <0x02804800 0x800> /* Smbus[1] */ + <0x02801220 0x020> /* Cause Master[1] */ + <0x02801280 0x020> /* Cause Slave[1] */ + + * i2c bus 2: + <0x02805000 0x800> /* Smbus[2] */ + <0x02801240 0x020> /* Cause Master[2] */ + <0x028012a0 0x020> /* Cause Slave[2] */ + + BlueField 2: + + * i2c bus 0: + <0x02804000 0x800> /* Smbus[0] */ + <0x02801400 0x020> /* Cause Master[0] */ + <0x02801540 0x020> /* Cause Slave[0] */ + + * i2c bus 1: + <0x02804800 0x800> /* Smbus[1] */ + <0x02801420 0x020> /* Cause Master[1] */ + <0x02801560 0x020> /* Cause Slave[1] */ + + * i2c bus 2: + <0x02805000 0x800> /* Smbus[2] */ + <0x02801440 0x020> /* Cause Master[2] */ + <0x02801580 0x020> /* Cause Slave[2] */ + +- compatible : should be "mellanox,i2c-mlxbf1" or "mellanox,i2c-mlxbf2". +- interrupts : interrupt number. + +Optional Properties: +- clock-frequency : bus frequency used to configure timing registers; + allowed values are 100000, 400000 and 1000000; + those are expressed in Hz. + +Example: + +aliases { + i2c0 = &i2c_0 +}; + +i2c_0: i2c { + compatible = "mellanox,i2c-mlxbf1"; + reg = <0x02804000 0x800>, + <0x02801200 0x020>, + <0x02801260 0x020>; + interrupts = <57>; + clock-frequency = <100000>; +};
Signature · 1 line
2.1.2
Rob Herring
maintainerRe: [PATCH v3 2/2] dt-bindings: i2c: I2C binding for Mellanox BlueField SoC
Quoted 55 lines · Khalil Blaiech
Added device tree bindings documentation for Mellanox BlueField I2C SMBus controller.
Reviewed-by David Woods <[email protected]>Signed-off-by Khalil Blaiech <[email protected]>--- .../devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txtDocumentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt new file +38
-0@@ -0,0 +1,71 @@ +Device tree configuration for the Mellanox I2C SMBus on BlueField SoCs + +Required Properties: +- reg : address offset and length of the device registers. The + registers consists of a set of dedicated and shared + resources: + + 1: Smbus block registers. + 2: Cause master registers. + 3: Cause slave registers. + + The BlueField SoCs includes three I2C bus controllers; + the set of resources <address length> must be defined + as follow: + + BlueField 1: + + * i2c bus 0: + <0x02804000 0x800> /* Smbus[0] */ + <0x02801200 0x020> /* Cause Master[0] */ + <0x02801260 0x020> /* Cause Slave[0] */ + + * i2c bus 1: + <0x02804800 0x800> /* Smbus[1] */ + <0x02801220 0x020> /* Cause Master[1] */ + <0x02801280 0x020> /* Cause Slave[1] */ + + * i2c bus 2: + <0x02805000 0x800> /* Smbus[2] */ + <0x02801240 0x020> /* Cause Master[2] */ + <0x028012a0 0x020> /* Cause Slave[2] */ + + BlueField 2: + + * i2c bus 0: + <0x02804000 0x800> /* Smbus[0] */ + <0x02801400 0x020> /* Cause Master[0] */ + <0x02801540 0x020> /* Cause Slave[0] */
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt line 48
Quoted 10 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt new file +10
-0+ + * i2c bus 1: + <0x02804800 0x800> /* Smbus[1] */ + <0x02801420 0x020> /* Cause Master[1] */ + <0x02801560 0x020> /* Cause Slave[1] */ + + * i2c bus 2: + <0x02805000 0x800> /* Smbus[2] */ + <0x02801440 0x020> /* Cause Master[2] */ + <0x02801580 0x020> /* Cause Slave[2] */
You can remove all these addresses from the binding. The important part is just that it is 3 entries and what each entry is.
Quoted 2 lines
+
+- compatible : should be "mellanox,i2c-mlxbf1" or "mellanox,i2c-mlxbf2".
Usually we put this first.
Quoted 1 line
+- interrupts : interrupt number.
Some space before tab here.
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt line 56
Quoted 5 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt new file +5
-0+ +Optional Properties: +- clock-frequency : bus frequency used to configure timing registers; + allowed values are 100000, 400000 and 1000000; + those are expressed in Hz.
What's the default if not present?
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt line 62
Quoted 6 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt new file +6
-0+ +Example: + +aliases { + i2c0 = &i2c_0 +};
Don't need to show aliases in examples.
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt
Quoted 2 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt new file +2
-0+ +i2c_0: i2c {
i2c@2804000
Quoted 10 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlxbf.txt new file +7
-0+ compatible = "mellanox,i2c-mlxbf1"; + reg = <0x02804000 0x800>, + <0x02801200 0x020>, + <0x02801260 0x020>; + interrupts = <57>; + clock-frequency = <100000>; +};Signature · 1 line
2.1.2