All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
To: Raju Lakkaraju <Raju.Lakkaraju-dzo6w/eZyo2tG0bUXCXiUA@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	Allan.Nielsen-dzo6w/eZyo2tG0bUXCXiUA@public.gmane.org
Subject: Re: [PATCH v8 net-next] net: phy: Add Edge-rate driver for Microsemi PHYs.
Date: Wed, 5 Oct 2016 14:07:02 +0200	[thread overview]
Message-ID: <20161005120702.GO5575@lunn.ch> (raw)
In-Reply-To: <1475667578-20799-1-git-send-email-Raju.Lakkaraju-dzo6w/eZyo2tG0bUXCXiUA@public.gmane.org>

> - 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",
  				  &vsc8531->vddmac);
 	if (rc == -EINVAL)
 		vddmac = MSCC_VDDMAC_3300;

  	rc = of_property_read_u8(of_node, "vsc8531,edge-slowdown",
  				 &vsc8531->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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-10-05 12:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-05 11:39 [PATCH v8 net-next] net: phy: Add Edge-rate driver for Microsemi PHYs Raju Lakkaraju
2016-10-05 11:39 ` Raju Lakkaraju
     [not found] ` <1475667578-20799-1-git-send-email-Raju.Lakkaraju-dzo6w/eZyo2tG0bUXCXiUA@public.gmane.org>
2016-10-05 12:07   ` Andrew Lunn [this message]
2016-10-10 12:50   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161005120702.GO5575@lunn.ch \
    --to=andrew-g2dyl2zd6by@public.gmane.org \
    --cc=Allan.Nielsen-dzo6w/eZyo2tG0bUXCXiUA@public.gmane.org \
    --cc=Raju.Lakkaraju-dzo6w/eZyo2tG0bUXCXiUA@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.