public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: mugunthanvnm@ti.com (Mugunthan V N)
To: linux-arm-kernel@lists.infradead.org
Subject: [net-next PATCH 2/3] net: phy: dp83867: add support for MAC impedance configuration
Date: Wed, 20 Jul 2016 20:26:13 +0530	[thread overview]
Message-ID: <20160720145614.13132-3-mugunthanvnm@ti.com> (raw)
In-Reply-To: <20160720145614.13132-1-mugunthanvnm@ti.com>

Add support for programmable MAC impedance configuration

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 drivers/net/phy/dp83867.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index 91177a4..ace3558 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -33,6 +33,7 @@
 /* Extended Registers */
 #define DP83867_RGMIICTL	0x0032
 #define DP83867_RGMIIDCTL	0x0086
+#define DP83867_IO_MUX_CFG	0x0170
 
 #define DP83867_SW_RESET	BIT(15)
 #define DP83867_SW_RESTART	BIT(14)
@@ -62,10 +63,14 @@
 /* RGMIIDCTL bits */
 #define DP83867_RGMII_TX_CLK_DELAY_SHIFT	4
 
+/* IO_MUX_CFG bits */
+#define DP83867_IO_MUX_CFG_IO_IMPEDANCE_CTRL	0x1F
+
 struct dp83867_private {
 	int rx_id_delay;
 	int tx_id_delay;
 	int fifo_depth;
+	int io_impedance;
 };
 
 static int dp83867_ack_interrupt(struct phy_device *phydev)
@@ -111,6 +116,12 @@ static int dp83867_of_init(struct phy_device *phydev)
 	if (!of_node)
 		return -ENODEV;
 
+	dp83867->io_impedance = -EINVAL;
+
+	/* Optional configuration */
+	of_property_read_u32(of_node, "ti,impedance-control",
+			     &dp83867->io_impedance);
+
 	ret = of_property_read_u32(of_node, "ti,rx-internal-delay",
 				   &dp83867->rx_id_delay);
 	if (ret)
@@ -184,6 +195,17 @@ static int dp83867_config_init(struct phy_device *phydev)
 
 		phy_write_mmd_indirect(phydev, DP83867_RGMIIDCTL,
 				       DP83867_DEVADDR, delay);
+
+		if (dp83867->io_impedance >= 0) {
+			val = phy_read_mmd_indirect(phydev,
+						    DP83867_IO_MUX_CFG,
+						    DP83867_DEVADDR);
+			val &= ~DP83867_IO_MUX_CFG_IO_IMPEDANCE_CTRL;
+			val |= dp83867->io_impedance &
+			       DP83867_IO_MUX_CFG_IO_IMPEDANCE_CTRL;
+			phy_write_mmd_indirect(phydev, DP83867_IO_MUX_CFG,
+					       DP83867_DEVADDR, val);
+		}
 	}
 
 	return 0;
-- 
2.9.2.368.g08bb350

  parent reply	other threads:[~2016-07-20 14:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20 14:56 [net-next PATCH 0/3] add support for impedance control for TI dp83867 phy and fix 2nd ethernet on dra72 rev C evm Mugunthan V N
2016-07-20 14:56 ` [net-next PATCH 1/3] net: phy: dp83867: Add documentation for optional impedance control Mugunthan V N
2016-07-20 15:33   ` Nishanth Menon
2016-07-21  6:22     ` Sekhar Nori
2016-07-21 21:14       ` Rob Herring
2016-07-22 10:05         ` Mugunthan V N
2016-07-20 14:56 ` Mugunthan V N [this message]
2016-07-20 14:56 ` [net-next PATCH 3/3] ARM: dts: dra72-evm-revc: fix non-working cpsw second ethernet Mugunthan V N

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=20160720145614.13132-3-mugunthanvnm@ti.com \
    --to=mugunthanvnm@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox