Skip to contentSkip to conversation

net: phy: Add Edge-rate driver for Microsemi PHYs.

PATCH Superseded Raju Lakkaraju 3 participants 5 messages Sep 28, 2016 – Oct 3, 2016 2 messages not in the archive

Subsystems (4)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 net: phy: Add Edge-rate driver for Microsemi PHYs.

From: Raju Lakkaraju <[email protected]>

Edge-rate:
As system and networking speeds increase, a signal's output transition, also know as the edge rate or slew rate (V/ns), takes on greater importance because high-speed signals come with a price. That price is an assortment of interference problems like ringing on the line, signal overshoot and undershoot, extended signal settling times, crosstalk noise, transmission line reflections, false signal detection by the receiving device and electromagnetic interference (EMI) -- all of which can negate the potential gains designers are seeking when they try to increase system speeds through the use of higher performance logic devices. The fact is, faster signaling edge rates can cause a higher level of electrical noise or other type of interference that can actually lead to slower line speeds and lower maximum system frequencies. This parameter allow the board designers to change the driving strange, and thereby change the EMI behavioral.

Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.

Tested on Beaglebone Black with VSC 8531 PHY.

---

All the review comments updated and resending for review.

Change set:
v1:
- Initial version of Edge-rate driver add by using IOCTL. v2:
- Changed edge-rate parameter to Device Tree with magic number. v3:
- Added Device Tree documentati0n and edge-rate parameter table. Added probe function initialize the vsc8531 private data structure.
v4:
- As per review comment, Device Tree parameters (vddmac, edge-slowdowni) added.

---

 .../devicetree/bindings/net/mscc-phy-vsc8531.txt   |  58 ++++++++++
 drivers/net/phy/mscc.c                             | 125 +++++++++++++++++++++
 include/dt-bindings/net/mscc-phy-vsc8531.h         |  21 ++++
 3 files changed, 204 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
 create mode 100644 include/dt-bindings/net/mscc-phy-vsc8531.h
Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt new file +58 -0
new file mode 100644
index 0000000..951043e
@@ -0,0 +1,58 @@
+* Microsemi - vsc8531 Giga bit ethernet phy
+
+Required properties:
+- compatible	: Should contain phy id as "ethernet-phy-idAAAA.BBBB"
+		  The PHY device uses the binding described in
+		  Documentation/devicetree/bindings/net/phy.txt
+
+Optional properties:
+- vsc8531,vddmac	: The vddmac in mV.
+- vsc8531,edge-slowdown	: % the edge should be slowed down relative to
+			  the fastest possible edge time. Native sign
+			  need not enter.
+			  Edge rate sets the drive strength of the MAC
+			  interface output signals.  Changing the drive
+			  strength will affect the edge rate of the output
+			  signal.  The goal of this setting is to help
+			  reduce electrical emission (EMI) by being able
+			  to reprogram drive strength and in effect slow
+			  down the edge rate if desired.  Table 5 shows the
+			  impact to the edge rate per VDDMAC supply for each
+			  drive strength setting.
+			  Ref: Table:1 - Edge rate change below.
+
+Note: see dt-bindings/net/mscc-phy-vsc8531.h for applicable values
+
+Table: 1 - Edge rate change
+----------------------------------------------------------------|
+| 		Edge Rate Change (VDDMAC)			|
+|								|
+| 3300 mV	2500 mV		1800 mV		1500 mV		|
+|---------------------------------------------------------------|
+| Default	Deafult		Default		Default		|
+| (Fastest)			(recommended)	(recommended)	|
+|---------------------------------------------------------------|
+| -2%		-3%		-5%		-6%		|
+|---------------------------------------------------------------|
+| -4%		-6%		-9%		-14%		|
+|---------------------------------------------------------------|
+| -7%		-10%		-16%		-21%		|
+|(recommended)	(recommended)					|
+|---------------------------------------------------------------|
+| -10%		-14%		-23%		-29%		|
+|---------------------------------------------------------------|
+| -17%		-23%		-35%		-42%		|
+|---------------------------------------------------------------|
+| -29%		-37%		-52%		-58%		|
+|---------------------------------------------------------------|
+| -53%		-63%		-76%		-77%		|
+| (slowest)							|
+|---------------------------------------------------------------|
+
+Example:
+
+        vsc8531_0: ethernet-phy@0 {
+                compatible = "ethernet-phy-id0007.0570";
+                vsc8531,vddmac		= /bits/ 16 <MSCC_VDDMAC_3300>;
+                vsc8531,edge-slowdown	= /bits/ 8  <17>;
+        };
drivers/net/phy/mscc.c +125 -0

182 lines not on this page · raw message

include/dt-bindings/net/mscc-phy-vsc8531.h new file +21 -0
new file mode 100644
index 0000000..2383dd2
@@ -0,0 +1,21 @@
+/*
+ * Device Tree constants for Microsemi VSC8531 PHY
+ *
+ * Author: Nagaraju Lakkaraju
+ *
+ * License: Dual MIT/GPL
+ * Copyright (c) 2016 Microsemi Corporation
+ */
+
+#ifndef _DT_BINDINGS_MSCC_VSC8531_H
+#define _DT_BINDINGS_MSCC_VSC8531_H
+
+/* MAC interface Edge rate control VDDMAC in milli Volts */
+#define MSCC_VDDMAC_3300		 3300
+#define MSCC_VDDMAC_2500		 2500
+#define MSCC_VDDMAC_1800		 1800
+#define MSCC_VDDMAC_1500		 1500
+#define MSCC_VDDMAC_MAX			 4
+#define MSCC_SLOWDOWN_MAX		 8
+
+#endif
Signature · 1 line
2.7.4
maintainer
#1 lore raw

Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt line 19

Quoted 12 lines
Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt new file +12 -0
+Optional properties:
+- vsc8531,vddmac	: The vddmac in mV.
+- vsc8531,edge-slowdown	: % the edge should be slowed down relative to
+			  the fastest possible edge time. Native sign
+			  need not enter.
+			  Edge rate sets the drive strength of the MAC
+			  interface output signals.  Changing the drive
+			  strength will affect the edge rate of the output
+			  signal.  The goal of this setting is to help
+			  reduce electrical emission (EMI) by being able
+			  to reprogram drive strength and in effect slow
+			  down the edge rate if desired.  Table 5 shows the

Hi Raju

There is no table five here? Is that a reference to a data sheet table?

Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt line 57

Quoted 6 lines
Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt new file +6 -0
+Example:
+
+        vsc8531_0: ethernet-phy@0 {
+                compatible = "ethernet-phy-id0007.0570";
+                vsc8531,vddmac		= /bits/ 16 <MSCC_VDDMAC_3300>;
+                vsc8531,edge-slowdown	= /bits/ 8  <17>;

No, real values please:

                vsc8531,vddmac		= <2000>;
                vsc8531,edge-slowdown	= <21>;

The driver should then do the maths to figure out the nearest magic value to write to the register, or complain the settings are out of range with an -EINVAL.

FYI: No floating point maths are allowed in the kernel.

Andrew

#3 lore raw
In reply to a message not in the archive

Hi Andrew,

Thank you for code review and valuable comments.

Quoted 16 lines · Andrew Lunn

EXTERNAL EMAIL

Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt line 19

Quoted 12 lines
Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt new file +12 -0
+Optional properties:
+- vsc8531,vddmac     : The vddmac in mV.
+- vsc8531,edge-slowdown      : % the edge should be slowed down relative to
+                       the fastest possible edge time. Native sign
+                       need not enter.
+                       Edge rate sets the drive strength of the MAC
+                       interface output signals.  Changing the drive
+                       strength will affect the edge rate of the output
+                       signal.  The goal of this setting is to help
+                       reduce electrical emission (EMI) by being able
+                       to reprogram drive strength and in effect slow
+                       down the edge rate if desired.  Table 5 shows the
Quoted 5 lines

Hi Raju

There is no table five here? Is that a reference to a data sheet table?

I accepted your comment.
It was typo. It should be Table 1.
Yes. In datasheet Edge rate control is Table 5.

Quoted 9 lines

Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt line 57

Quoted 6 lines
Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt new file +6 -0
+Example:
+
+        vsc8531_0: ethernet-phy@0 {
+                compatible = "ethernet-phy-id0007.0570";
+                vsc8531,vddmac               = /bits/ 16 <MSCC_VDDMAC_3300>;
+                vsc8531,edge-slowdown        = /bits/ 8  <17>;

No, real values please:

Quoted 9 lines
                vsc8531,vddmac          = <2000>;
                vsc8531,edge-slowdown   = <21>;

The driver should then do the maths to figure out the nearest magic value to write to the register, or complain the settings are out of range with an -EINVAL.

FYI: No floating point maths are allowed in the kernel.

I accepted your review comment. I will change and resend again.

Quoted 1 line

Andrew

---
Thanks,
Raju.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#4 lore raw
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt new file +4 -0
+        vsc8531_0: ethernet-phy@0 {
+                compatible = "ethernet-phy-id0007.0570";
+                vsc8531,vddmac               = /bits/ 16 <MSCC_VDDMAC_3300>;
+                vsc8531,edge-slowdown        = /bits/ 8  <17>;
Quoted 8 lines
Quoted 8 lines

No, real values please:

                vsc8531,vddmac          = <2000>;
                vsc8531,edge-slowdown   = <21>;

The driver should then do the maths to figure out the nearest magic value to write to the register, or complain the settings are out of range with an -EINVAL.

I think you missed my point. Notice my example does not use values from the table. Is there a reason not to use the PHY with 2000mv? Or does it break when you don't use one of the 4 listed voltages?

I was wanting you to implement some formula, which given the voltage and percentage slowdown, returns the magic number. Hence the comment:

Quoted 1 line
Quoted 1 line

FYI: No floating point maths are allowed in the kernel.

You need to do integer arithmetic, which is why i suggested mV, not V.

Andrew

#6 lore raw
In reply to a message not in the archive

Hi Andrew,

Quoted 13 lines · Andrew Lunn

EXTERNAL EMAIL

Quoted 10 lines
Quoted 10 lines

Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt line 57

Quoted 4 lines
Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt new file +4 -0
+        vsc8531_0: ethernet-phy@0 {
+                compatible = "ethernet-phy-id0007.0570";
+                vsc8531,vddmac               = /bits/ 16 <MSCC_VDDMAC_3300>;
+                vsc8531,edge-slowdown        = /bits/ 8  <17>;

No, real values please:

                vsc8531,vddmac          = <2000>;
                vsc8531,edge-slowdown   = <21>;
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

The driver should then do the maths to figure out the nearest magic value to write to the register, or complain the settings are out of range with an -EINVAL.

I think you missed my point. Notice my example does not use values from the table. Is there a reason not to use the PHY with 2000mv? Or does it break when you don't use one of the 4 listed voltages?

As per PHY data sheet, It should use one of the voltage in list. i.e. 3.3V (3300 mV) or 2.5V (2500 mV) or 1.8V (1800 mV) or 1.5V (1500). Other voltages are not accepted. Drivr considers default as 3.3V (3300 mV).

Quoted 3 lines

I was wanting you to implement some formula, which given the voltage and percentage slowdown, returns the magic number. Hence the comment:

Based on Voltage selection and percentage slowdown, Driver pick the magic number from Edge rate table.

Quoted 4 lines
Quoted 1 line
Quoted 1 line

FYI: No floating point maths are allowed in the kernel.

You need to do integer arithmetic, which is why i suggested mV, not V.

I understood your suggestion and used voltage in milli Volts.

Quoted 1 line

Andrew

Thanks,
Raju.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html