Re: [PATCH v8 net-next] net: phy: Add Edge-rate driver for Microsemi PHYs.

2016-10-10 Thread Rob Herring
On Wed, Oct 05, 2016 at 05:09:38PM +0530, Raju Lakkaraju wrote:
> From: Raju Lakkaraju 
> 
> 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.
> 
> Signed-off-by: Raju Lakkaraju 
> 
> ---
> 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-slowdown)
>   added.
> v5:
> - As per review comment, Device Tree Document parameters (vddmac, 
>   edge-slowdown) real numbers added. Table number changed from 5 to 1.
> v6:
> - As per review comment, Removed Device Tree header file. Removed MACROs
>   and add ARRAYSIZE
> v7:
> - As per review comment, Removed '-'s (minus) sign in Edge rate table. 
> v8:
> - As per review comment, Added DT vddmac, slowdown value error check. 
> 
> ---
> 
>  .../devicetree/bindings/net/mscc-phy-vsc8531.txt   | 22 +++

Acked-by: Rob Herring 

>  drivers/net/phy/mscc.c | 69 
> +++---
>  include/dt-bindings/net/mscc-phy-vsc8531.h | 21 ---
>  3 files changed, 59 insertions(+), 53 deletions(-)
>  delete mode 100644 include/dt-bindings/net/mscc-phy-vsc8531.h


Re: [PATCH v8 net-next] net: phy: Add Edge-rate driver for Microsemi PHYs.

2016-10-05 Thread Andrew Lunn
> - As per review comment, Added DT vddmac, slowdown value error check. 

So i said an exact match, which this is not.

How about something like:

static u8 vsc85xx_edge_rate_magic_get(u16 vddmac, u8 slowdown)
{
u8 vdd;
u8 sd;

for (vdd = 0; vdd < ARRAY_SIZE(edge_table); vdd++)
if (edge_table[vdd].vddmac == vddmac)
for (sd = 0; sd < MSCC_SLOWDOWN_MAX; sd++)
if (edge_table[vdd].slowdown[sd] == slowdown)
return (MSCC_SLOWDOWN_MAX - sd - 1);
return -EINVAL;
}

> @@ -197,15 +203,34 @@ static int vsc8531_of_init(struct phy_device *phydev)
  
rc = of_property_read_u16(of_node, "vsc8531,vddmac",
  >vddmac);
if (rc == -EINVAL)
vddmac = MSCC_VDDMAC_3300;

rc = of_property_read_u8(of_node, "vsc8531,edge-slowdown",
 >edge_slowdown);
if (rc == -EINVAL)
edge_slowdown = 0;

vsc8531->rate_magic = edge_rate_magic_get(vddmac, edge_slowdown);
if (vsc8531->rate_magic < 0) {
   dev_err(phydev->dev, "Invalid vsc8531,vddmac or 
vsc8531,edge-slowdown");
   return vsc8531->rate_magic;
}

>  static int vsc8531_of_init(struct phy_device *phydev)
> @@ -232,8 +257,8 @@ static int vsc85xx_config_init(struct phy_device *phydev)
>   if (rc)
>   return rc;
>  
>   rc = vsc85xx_edge_rate_cntl_set(phydev, vsc8531->rate_magic);
>   if (rc)
>   return rc;

Andrew


[PATCH v8 net-next] net: phy: Add Edge-rate driver for Microsemi PHYs.

2016-10-05 Thread Raju Lakkaraju
From: Raju Lakkaraju 

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.

Signed-off-by: Raju Lakkaraju 

---
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-slowdown)
  added.
v5:
- As per review comment, Device Tree Document parameters (vddmac, 
  edge-slowdown) real numbers added. Table number changed from 5 to 1.
v6:
- As per review comment, Removed Device Tree header file. Removed MACROs
  and add ARRAYSIZE
v7:
- As per review comment, Removed '-'s (minus) sign in Edge rate table. 
v8:
- As per review comment, Added DT vddmac, slowdown value error check. 

---

 .../devicetree/bindings/net/mscc-phy-vsc8531.txt   | 22 +++
 drivers/net/phy/mscc.c | 69 +++---
 include/dt-bindings/net/mscc-phy-vsc8531.h | 21 ---
 3 files changed, 59 insertions(+), 53 deletions(-)
 delete mode 100644 include/dt-bindings/net/mscc-phy-vsc8531.h

diff --git a/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt 
b/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
index 99c7eb0..1173498 100644
--- a/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
+++ b/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
@@ -8,8 +8,7 @@ Required properties:
 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.
+ the fastest possible edge time.
  Edge rate sets the drive strength of the MAC
  interface output signals.  Changing the drive
  strength will affect the edge rate of the output
@@ -18,7 +17,8 @@ Optional properties:
  to reprogram drive strength and in effect slow
  down the edge rate if desired.  Table 1 shows the
  impact to the edge rate per VDDMAC supply for each
- drive strength setting.
+ drive strength setting. VDDMAC supply voltage
+ should be one of the value in Table-1 first row.
  Ref: Table:1 - Edge rate change below.
 
 Note: see dt-bindings/net/mscc-phy-vsc8531.h for applicable values
@@ -29,23 +29,25 @@ Table: 1 - Edge rate change
 |  |
 | 3300 mV  2500 mV 1800 mV 1500 mV |
 |---|
+| 0%   0%  0%  0%  |
+|  |
 | Default  Deafult Default Default |
 | (Fastest)(recommended)   (recommended)   |
 |---|
-| -2%  -3% -5% -6% |
+| 2%   3%  5%  6%  |
 |---|
-| -4%  -6% -9% -14%|
+| 4%   6%  9%  14% |
 |---|
-| -7%  -10%-16%-21%|
+| 7%   10% 16% 21% |
 |(recommended) (recommended)   |