diff mbox series

[v1,1/2] dt-bindings: net: add binding documentation for mlxsw thermal control

Message ID 1504032311-195988-2-git-send-email-vadimp@mellanox.com
State Changes Requested, archived
Delegated to: David Miller
Headers show
Series add support for the external thermal zone and cooling device binding for Mellanox network devices | expand

Commit Message

Vadim Pasternak Aug. 29, 2017, 6:45 p.m. UTC
Add binding document for Mellanox switch devices.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
---
 .../devicetree/bindings/net/mellanox,mlxsw.txt     | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/mellanox,mlxsw.txt

Comments

Andrew Lunn Aug. 29, 2017, 5:22 p.m. UTC | #1
> +- compatible		: "mellanox,mlxsw_minimal"

Interesting product name. Is there a mlxsw_maximal planned?

> +- reg			: The I2C address of the device.
> +
> +Optional properties:
> +- cooling-phandle	: phandle of the cooling device, which is to be used
> +			  for the zone thermal control.
> +			  If absent, cooling device controlled internally by
> +			  the ASIC may be used.
> +
> +- trips			: the nodes to describe a point in the temperature
> +			  domain with key temperatures at which cooling is
> +			  recommended. Each node must contain the next values:
> +			  - type: the trip type. Expected values are:
> +			    0 - a trip point to enable active cooling;
> +			    1 - a trip point to enable passive cooling;
> +			    2 - a trip point to notify emergency;
> +			  - temperature: unsigned integer indicating the trip
> +			    temperature level in millicelsius;
> +			  - minimum cooling state allowed within the trip node;
> +			  - maximum cooling state allowed within the trip node;
> +
> +Example:
> +	asic_thermal: mlxsw_minimal@48 {
> +		compatible = "mlxsw_minimal";

You missed the vendor part.

> +		reg = <0x48>;
> +		status = "disabled";

An example with it disabled?

> +		cooling-phandle = <&cooling>;
> +
> +		trips {
> +			trip@0 {
> +				trip = <0 75000 0 0>;
> +			};

I don't know much about the thermal subsystem. But looking at other
example binding documents, you seem to do something different here to
other drivers. Why do you not use what seems to be the common format:

               trips {
                        cpu_alert0: cpu-alert0 {
                                temperature = <90000>; /* millicelsius */
                                hysteresis = <2000>; /* millicelsius */
                                type = "active";
                        };
                        cpu_alert1: cpu-alert1 {
                                temperature = <100000>; /* millicelsius */
                                hysteresis = <2000>; /* millicelsius */
                                type = "passive";
                        };
                        cpu_crit: cpu-crit {
                                temperature = <125000>; /* millicelsius */
                                hysteresis = <2000>; /* millicelsius */
                                type = "critical";
                        };
                };

	Andrew
Vadim Pasternak Aug. 29, 2017, 5:57 p.m. UTC | #2
> -----Original Message-----
> From: Andrew Lunn [mailto:andrew@lunn.ch]
> Sent: Tuesday, August 29, 2017 8:23 PM
> To: Vadim Pasternak <vadimp@mellanox.com>
> Cc: robh+dt@kernel.org; davem@davemloft.net; jiri@resnulli.us;
> ivecera@redhat.com; devicetree@vger.kernel.org; netdev@vger.kernel.org
> Subject: Re: [patch v1 1/2] dt-bindings: net: add binding documentation for
> mlxsw thermal control
> 
> > +- compatible		: "mellanox,mlxsw_minimal"
> 
> Interesting product name. Is there a mlxsw_maximal planned?
> 

Hi Andrew,

Thank you very much for review.

No plans for such product. We just have fully functional drivers for different
kind of Mellanox switch devices like spectrum, switchib, switchx2. All of them
work over PCI bus. The minimal is supposed to be used for the chassis
management and we uses it at BMC side. It works over I2C bus and doesn't
depend on switch type. So it has a minaml functionality, so name "minimal".

> > +- reg			: The I2C address of the device.
> > +
> > +Optional properties:
> > +- cooling-phandle	: phandle of the cooling device, which is to be used
> > +			  for the zone thermal control.
> > +			  If absent, cooling device controlled internally by
> > +			  the ASIC may be used.
> > +
> > +- trips			: the nodes to describe a point in the
> temperature
> > +			  domain with key temperatures at which cooling is
> > +			  recommended. Each node must contain the next
> values:
> > +			  - type: the trip type. Expected values are:
> > +			    0 - a trip point to enable active cooling;
> > +			    1 - a trip point to enable passive cooling;
> > +			    2 - a trip point to notify emergency;
> > +			  - temperature: unsigned integer indicating the trip
> > +			    temperature level in millicelsius;
> > +			  - minimum cooling state allowed within the trip
> node;
> > +			  - maximum cooling state allowed within the trip
> node;
> > +
> > +Example:
> > +	asic_thermal: mlxsw_minimal@48 {
> > +		compatible = "mlxsw_minimal";
> 
> You missed the vendor part.

Acked.

> 
> > +		reg = <0x48>;
> > +		status = "disabled";
> 
> An example with it disabled?

We just use it in such way at BMC side. It's disabled by default and upon
event indicating the good health for the device the device driver is
connected. I can remove it from the example. But for BMC it's actually
the default state.

> 
> > +		cooling-phandle = <&cooling>;
> > +
> > +		trips {
> > +			trip@0 {
> > +				trip = <0 75000 0 0>;
> > +			};
> 
> I don't know much about the thermal subsystem. But looking at other
> example binding documents, you seem to do something different here to
> other drivers. Why do you not use what seems to be the common format:

In mlxsw_thermal driver we have definition for the thermal trips, which contains
the type, like  "active" of "passive", temperature  in millicelsius and min/max states
for cooling device. These vector defines thermal trip points.
The hysteresis parameter is not relevant.

For example, ASIC thermal sensor is associated with the cooling device like:
&pwm_tacho {
...
	cooling: fan@0 {
		reg = <0x00>;
		cooling-levels = /bits/ 8 <125 151 177 203 229 255>;
		aspeed,fan-tach-ch = /bits/ 8 <0x00>;
	};

And the below sub-nodes
			trip@0 {
				trip = <0 75000 0 0>;
			};
			trip@1 {
				trip = <2 85000 1 5>;
			};
			trip@3 {
				trip = <2 105000 5 5>;
			};

defines that PWM should be at default speed (125), while temperature is
below 75000, should be at max speed (255), while temperature is above 
10500, and should step according the temperate trend between.

Thanks,
Vadim.

> 
>                trips {
>                         cpu_alert0: cpu-alert0 {
>                                 temperature = <90000>; /* millicelsius */
>                                 hysteresis = <2000>; /* millicelsius */
>                                 type = "active";
>                         };
>                         cpu_alert1: cpu-alert1 {
>                                 temperature = <100000>; /* millicelsius */
>                                 hysteresis = <2000>; /* millicelsius */
>                                 type = "passive";
>                         };
>                         cpu_crit: cpu-crit {
>                                 temperature = <125000>; /* millicelsius */
>                                 hysteresis = <2000>; /* millicelsius */
>                                 type = "critical";
>                         };
>                 };
> 
> 	Andrew
Andrew Lunn Aug. 29, 2017, 7:15 p.m. UTC | #3
On Tue, Aug 29, 2017 at 05:57:01PM +0000, Vadim Pasternak wrote:
> 
> 
> > -----Original Message-----
> > From: Andrew Lunn [mailto:andrew@lunn.ch]
> > Sent: Tuesday, August 29, 2017 8:23 PM
> > To: Vadim Pasternak <vadimp@mellanox.com>
> > Cc: robh+dt@kernel.org; davem@davemloft.net; jiri@resnulli.us;
> > ivecera@redhat.com; devicetree@vger.kernel.org; netdev@vger.kernel.org
> > Subject: Re: [patch v1 1/2] dt-bindings: net: add binding documentation for
> > mlxsw thermal control
> > 
> > > +- compatible		: "mellanox,mlxsw_minimal"
> > 
> > Interesting product name. Is there a mlxsw_maximal planned?
> > 
> 
> Hi Andrew,
> 
> Thank you very much for review.
> 
> No plans for such product. We just have fully functional drivers for different
> kind of Mellanox switch devices like spectrum, switchib, switchx2. All of them
> work over PCI bus. The minimal is supposed to be used for the chassis
> management and we uses it at BMC side. It works over I2C bus and doesn't
> depend on switch type. So it has a minaml functionality, so name "minimal".

That is not really how device tree compatible names work. The
compatible should be the product name, or the first product which had
this functionality. So in this case is the product is the chassis?
What name does the chassis have?

At some point, it would be good if you made the .dts file public. That
would give people a better idea how this all fits together.

> > I don't know much about the thermal subsystem. But looking at other
> > example binding documents, you seem to do something different here to
> > other drivers. Why do you not use what seems to be the common format:
> 
> In mlxsw_thermal driver we have definition for the thermal trips, which contains
> the type, like  "active" of "passive", temperature  in millicelsius and min/max states
> for cooling device. These vector defines thermal trip points.
> The hysteresis parameter is not relevant.

As i said, i don't know much about the thermal subsystem. So i cannot
comment on if your binding is good or bad. It just seems different,
which is often bad.

You really need the thermal subsystem guys to review this. But you
didn't Cc: them.

./scripts/get_maintainer.pl drivers/thermal/thermal_core.c 
Zhang Rui <rui.zhang@intel.com> (supporter:THERMAL)
Eduardo Valentin <edubezval@gmail.com> (supporter:THERMAL)
linux-pm@vger.kernel.org (open list:THERMAL)

This driver has nothing to do with netdev. I'm wondering if it
actually belongs in drivers/thermal? Or maybe drivers/hwmon?
The pm and hwmon guys will probably tell you.

	Andrew
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/mellanox,mlxsw.txt b/Documentation/devicetree/bindings/net/mellanox,mlxsw.txt
new file mode 100644
index 0000000..55de5ff
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/mellanox,mlxsw.txt
@@ -0,0 +1,46 @@ 
+Mellanox Technologies Switch ASICs
+
+This file provides information, what the device node
+for the Switch ASIC interface contains.
+
+Required properties:
+- compatible		: "mellanox,mlxsw_minimal"
+- reg			: The I2C address of the device.
+
+Optional properties:
+- cooling-phandle	: phandle of the cooling device, which is to be used
+			  for the zone thermal control.
+			  If absent, cooling device controlled internally by
+			  the ASIC may be used.
+
+- trips			: the nodes to describe a point in the temperature
+			  domain with key temperatures at which cooling is
+			  recommended. Each node must contain the next values:
+			  - type: the trip type. Expected values are:
+			    0 - a trip point to enable active cooling;
+			    1 - a trip point to enable passive cooling;
+			    2 - a trip point to notify emergency;
+			  - temperature: unsigned integer indicating the trip
+			    temperature level in millicelsius;
+			  - minimum cooling state allowed within the trip node;
+			  - maximum cooling state allowed within the trip node;
+
+Example:
+	asic_thermal: mlxsw_minimal@48 {
+		compatible = "mlxsw_minimal";
+		reg = <0x48>;
+		status = "disabled";
+		cooling-phandle = <&cooling>;
+
+		trips {
+			trip@0 {
+				trip = <0 75000 0 0>;
+			};
+			trip@1 {
+				trip = <2 85000 1 5>;
+			};
+			trip@3 {
+				trip = <2 105000 5 5>;
+			};
+		};
+	};