dt-bindings: i2c: I2C binding for Mellanox BlueField SoC
Subsystems (2)
PATCH 2/2 dt-bindings: i2c: I2C binding for Mellanox BlueField SoC
In reply to a message not in the archiveAdded device tree bindings documentation for Mellanox BlueField I2C SMBus controller.
--- .../devicetree/bindings/i2c/mellanox,i2c-mlx.txt | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +58 -0
@@ -0,0 +1,58 @@ +Device tree configuration for the Mellanox I2C SMBus on BlueField SoCs + +Required Properties: +- reg : address offset and range of bus device registers +- compatible : should be "mellanox,i2c-mlx" +- interrupts : interrupt number +- bus : hardware bus identifier. BlueField ARM side has three bus + controllers; thus, values might be 0, 1, or 2 +- profile : device profile. This ensures compatibility between actual + driver and ACPI/DT. The most recent profile is "mlnx-bf18" + +Optional Properties: +- bus-freq : bus frequency used to configure timing registers; allowed + values are 100, 400 and 1000; those are expressed in KHz + +Examples: + +i2c0 { + compatible = "mellanox,i2c-mlx"; + reg = <0x02804000 0x800>, /* Smbus[0] */ + <0x02801200 0x020>, /* Cause Master[0] */ + <0x02801260 0x020>, /* Cause Slave[0] */ + <0x02801300 0x010>, /* Cause Coalesce */ + <0x02802000 0x100>, /* GPIO 0 */ + <0x02800358 0x008>; /* CorePll */ + interrupts = <57>; + bus = <1>; + bus-freq = <100>; + profile = "mlnx-bf18"; +}; + +i2c1 { + compatible = "mellanox,i2c-mlx"; + reg = <0x02804800 0x800>, /* Smbus[1] */ + <0x02801220 0x020>, /* Cause Master[1] */ + <0x02801280 0x020>, /* Cause Slave[1] */ + <0x02801300 0x010>, /* Cause Coalesce */ + <0x02802000 0x100>, /* GPIO 0 */ + <0x02800358 0x008>; /* CorePll */ + interrupts = <57>; + bus = <1>; + bus-freq = <100>; + profile = "mlnx-bf18"; +}; + +i2c2 { + compatible = "mellanox,i2c-mlx"; + reg = <0x02805000 0x800>, /* Smbus[2] */ + <0x02801240 0x020>, /* Cause Master[2] */ + <0x028012a0 0x020>, /* Cause Slave[1] */ + <0x02801300 0x010>, /* Cause Coalesce */ + <0x02802000 0x100>, /* GPIO 0 */ + <0x02800358 0x008>; /* CorePll */ + interrupts = <57>; + bus = <2>; + bus-freq = <400>; + profile = "mlnx-bf18"; +};
Signature · 1 line
2.1.2
Rob Herring
maintainerQuoted 16 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-mlx.txt | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txtDocumentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +0
-0
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 4
Quoted 4 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +4
-0@@ -0,0 +1,58 @@ +Device tree configuration for the Mellanox I2C SMBus on BlueField SoCs + +Required Properties: +- reg : address offset and range of bus device registers
Need to enumerate the exact list.
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 5
Quoted 1 line
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +1
-0+- compatible : should be "mellanox,i2c-mlx"
Kind of generic.
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 8
Quoted 3 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +3
-0+- interrupts : interrupt number +- bus : hardware bus identifier. BlueField ARM side has three bus + controllers; thus, values might be 0, 1, or 2
We don't do bus indexes in DT.
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 10
Quoted 2 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +2
-0+- profile : device profile. This ensures compatibility between actual + driver and ACPI/DT. The most recent profile is "mlnx-bf18"
What? compatible is what that is for.
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 14
Quoted 4 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +4
-0+ +Optional Properties: +- bus-freq : bus frequency used to configure timing registers; allowed + values are 100, 400 and 1000; those are expressed in KHz
clock-frequency (in Hz) is the standard property for this.
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 25
Quoted 12 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +11
-0+ +Examples: + +i2c0 { + compatible = "mellanox,i2c-mlx"; + reg = <0x02804000 0x800>, /* Smbus[0] */ + <0x02801200 0x020>, /* Cause Master[0] */ + <0x02801260 0x020>, /* Cause Slave[0] */ + <0x02801300 0x010>, /* Cause Coalesce */ + <0x02802000 0x100>, /* GPIO 0 */ + <0x02800358 0x008>; /* CorePll */
Are these 2 really part of the I2C block?
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 32
Quoted 7 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +7
-0+ interrupts = <57>; + bus = <1>; + bus-freq = <100>; + profile = "mlnx-bf18"; +}; + +i2c1 {
These 2 examples don't add anything. Remove them.
Quoted 29 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +26
-0+ compatible = "mellanox,i2c-mlx"; + reg = <0x02804800 0x800>, /* Smbus[1] */ + <0x02801220 0x020>, /* Cause Master[1] */ + <0x02801280 0x020>, /* Cause Slave[1] */ + <0x02801300 0x010>, /* Cause Coalesce */ + <0x02802000 0x100>, /* GPIO 0 */ + <0x02800358 0x008>; /* CorePll */ + interrupts = <57>; + bus = <1>; + bus-freq = <100>; + profile = "mlnx-bf18"; +}; + +i2c2 { + compatible = "mellanox,i2c-mlx"; + reg = <0x02805000 0x800>, /* Smbus[2] */ + <0x02801240 0x020>, /* Cause Master[2] */ + <0x028012a0 0x020>, /* Cause Slave[1] */ + <0x02801300 0x010>, /* Cause Coalesce */ + <0x02802000 0x100>, /* GPIO 0 */ + <0x02800358 0x008>; /* CorePll */ + interrupts = <57>; + bus = <2>; + bus-freq = <400>; + profile = "mlnx-bf18"; +};Signature · 1 line
2.1.2
Rob,
Thank you, for having taken the time to review this change and providing feedback.
Quoted 13 lines · Khalil Blaiech
Quoted 7 lines
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-mlx.txt | 58++++++++++++++++++++++
Quoted 4 lines
1 file changed, 58 insertions(+) create mode 100644
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt
Quoted 15 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 5
Quoted 13 lines
diff --git
a/Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txtb/Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txtnew file mode 100644
index 0000000..49c9e2fDocumentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +5
-0@@ -0,0 +1,58 @@ +Device tree configuration for the Mellanox I2C SMBus on BlueField +SoCs + +Required Properties: +- reg : address offset and range of bus device registersNeed to enumerate the exact list.
Okay.
Quoted 4 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 5
Quoted 2 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +1
-0+- compatible : should be "mellanox,i2c-mlx"Kind of generic.
Please note that we do not provide identifier/serial number for our I2C device. I can think of "mellanox,i2c-mlxbf" instead where "bf" refers to our SoC. Is this less generic?
Quoted 6 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 8
Quoted 4 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +3
-0+- interrupts : interrupt number +- bus : hardware bus identifier. BlueField ARM side has three bus + controllers; thus, values might be 0, 1, or 2We don't do bus indexes in DT.
Actually, it is critical for us to know what bus we are using and/or exposing to user space; we rely on the bus identifier to match the hardware block. On the other hand, we don't want to put complex logic in the driver because it may require hardcoding memory region addresses. And we don't want to do that, right?
So, maybe we should redefine it? And refer to with different property name...
Quoted 5 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 10
Quoted 3 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +2
-0+- profile : device profile. This ensures compatibility between actual + driver and ACPI/DT. The most recent profile is "mlnx-bf18"What? compatible is what that is for.
Sorry! Totally agree. I'll get rid of it.
Quoted 8 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt
Quoted 6 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +5
-0+ +Optional Properties: +- bus-freq : bus frequency used to configure timing registers; allowed + values are 100, 400 and 1000; those are expressed in +KHzclock-frequency (in Hz) is the standard property for this.
Okay
Quoted 11 lines
Quoted 10 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +9
-0+ +Examples: + +i2c0 { + compatible = "mellanox,i2c-mlx"; + reg = <0x02804000 0x800>, /* Smbus[0] */ + <0x02801200 0x020>, /* Cause Master[0] */ + <0x02801260 0x020>, /* Cause Slave[0] */ + <0x02801300 0x010>, /* Cause Coalesce */
Quoted 4 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 27
Quoted 2 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +2
-0+ <0x02802000 0x100>, /* GPIO 0 */ + <0x02800358 0x008>; /* CorePll */Are these 2 really part of the I2C block?
Our hardware design is quite complex, roughly, we have kind of centralized block which contains multiple sub-blocks. These regs are shared among the I2C controllers (i.e., sub-blocks). These are needed during device initialization.
You'll also notice the "Cause Coalesce" above.
Quoted 10 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 32
Quoted 8 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +7
-0+ interrupts = <57>; + bus = <1>; + bus-freq = <100>; + profile = "mlnx-bf18"; +}; + +i2c1 {These 2 examples don't add anything. Remove them.
Okay.
Quoted 22 lines
Quoted 22 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +21
-0+ compatible = "mellanox,i2c-mlx"; + reg = <0x02804800 0x800>, /* Smbus[1] */ + <0x02801220 0x020>, /* Cause Master[1] */ + <0x02801280 0x020>, /* Cause Slave[1] */ + <0x02801300 0x010>, /* Cause Coalesce */ + <0x02802000 0x100>, /* GPIO 0 */ + <0x02800358 0x008>; /* CorePll */ + interrupts = <57>; + bus = <1>; + bus-freq = <100>; + profile = "mlnx-bf18"; +}; + +i2c2 { + compatible = "mellanox,i2c-mlx"; + reg = <0x02805000 0x800>, /* Smbus[2] */ + <0x02801240 0x020>, /* Cause Master[2] */ + <0x028012a0 0x020>, /* Cause Slave[1] */ + <0x02801300 0x010>, /* Cause Coalesce */ + <0x02802000 0x100>, /* GPIO 0 */ + <0x02800358 0x008>; /* CorePll */
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +5
-1+ interrupts = <57>; + bus = <2>; + bus-freq = <400>; + profile = "mlnx-bf18"; +}; --2.1.2
Regards,
-Khalil
Rob Herring
maintainerQuoted 51 lines · Khalil Blaiech
Rob,
Thank you, for having taken the time to review this change and providing feedback.
Quoted 13 lines · Khalil Blaiech
Quoted 7 lines
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-mlx.txt | 58++++++++++++++++++++++
Quoted 4 lines
1 file changed, 58 insertions(+) create mode 100644
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txtQuoted 15 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 5
Quoted 13 lines
diff --git
a/Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txtb/Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txtnew file mode 100644
index 0000000..49c9e2fDocumentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +5
-0@@ -0,0 +1,58 @@ +Device tree configuration for the Mellanox I2C SMBus on BlueField +SoCs + +Required Properties: +- reg : address offset and range of bus device registersNeed to enumerate the exact list.
Okay.
Quoted 4 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt line 5
Quoted 2 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +1
-0+- compatible : should be "mellanox,i2c-mlx"Kind of generic.
Please note that we do not provide identifier/serial number for our I2C device. I can think of "mellanox,i2c-mlxbf" instead where "bf" refers to our SoC. Is this less generic?
Quoted 5 lines
Quoted 4 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +3
-0+- interrupts : interrupt number +- bus : hardware bus identifier. BlueField ARM side has three bus + controllers; thus, values might be 0, 1, or 2
Quoted 7 lines
Quoted 1 line
We don't do bus indexes in DT.
Actually, it is critical for us to know what bus we are using and/or exposing to user space; we rely on the bus identifier to match the hardware block. On the other hand, we don't want to put complex logic in the driver because it may require hardcoding memory region addresses. And we don't want to do that, right?
'i2cN' alias should work for you. That's what others do.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Documentation/devicetree/bindings/i2c/mellanox,i2c-mlx.txt new file +8
-0+i2c0 { + compatible = "mellanox,i2c-mlx"; + reg = <0x02804000 0x800>, /* Smbus[0] */ + <0x02801200 0x020>, /* Cause Master[0] */ + <0x02801260 0x020>, /* Cause Slave[0] */ + <0x02801300 0x010>, /* Cause Coalesce */ + <0x02802000 0x100>, /* GPIO 0 */ + <0x02800358 0x008>; /* CorePll */
Quoted 7 lines
Quoted 1 line
Are these 2 really part of the I2C block?
Our hardware design is quite complex, roughly, we have kind of centralized block which contains multiple sub-blocks. These regs are shared among the I2C controllers (i.e., sub-blocks). These are needed during device initialization.
You'll also notice the "Cause Coalesce" above.
Okay, as long as these addresses don't also appear somewhere else in the DT it is fine. It's not something we check currently, but I want to and we have to work-around the kernel's resource tracking because of that problem.
Rob