All of lore.kernel.org
 help / color / mirror / Atom feed
From: jon.mason@broadcom.com (Jon Mason)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 1/7] net: phy: broadcom: add bcm54xx_auxctl_read
Date: Fri,  4 Nov 2016 01:10:56 -0400	[thread overview]
Message-ID: <1478236262-3351-2-git-send-email-jon.mason@broadcom.com> (raw)
In-Reply-To: <1478236262-3351-1-git-send-email-jon.mason@broadcom.com>

Add a helper function to read the AUXCTL register for the BCM54xx.  This
mirrors the bcm54xx_auxctl_write function already present in the code.

Signed-off-by: Jon Mason <jon.mason@broadcom.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/broadcom.c | 10 ++++++++++
 include/linux/brcmphy.h    |  1 +
 2 files changed, 11 insertions(+)

diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 583ef8a..3a64b3d 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -30,6 +30,16 @@ MODULE_DESCRIPTION("Broadcom PHY driver");
 MODULE_AUTHOR("Maciej W. Rozycki");
 MODULE_LICENSE("GPL");
 
+static int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum)
+{
+	/* The register must be written to both the Shadow Register Select and
+	 * the Shadow Read Register Selector
+	 */
+	phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum |
+		  regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT);
+	return phy_read(phydev, MII_BCM54XX_AUX_CTL);
+}
+
 static int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val)
 {
 	return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val);
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 60def78..0ed6691 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -110,6 +110,7 @@
 #define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX	0x0200
 #define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC	0x7000
 #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC	0x0007
+#define MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT	12
 
 #define MII_BCM54XX_AUXCTL_SHDWSEL_MASK	0x0007
 
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: Jon Mason <jon.mason@broadcom.com>
To: David Miller <davem@davemloft.net>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Cc: rafal@milecki.pl, bcm-kernel-feedback-list@broadcom.com,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v6 1/7] net: phy: broadcom: add bcm54xx_auxctl_read
Date: Fri,  4 Nov 2016 01:10:56 -0400	[thread overview]
Message-ID: <1478236262-3351-2-git-send-email-jon.mason@broadcom.com> (raw)
In-Reply-To: <1478236262-3351-1-git-send-email-jon.mason@broadcom.com>

Add a helper function to read the AUXCTL register for the BCM54xx.  This
mirrors the bcm54xx_auxctl_write function already present in the code.

Signed-off-by: Jon Mason <jon.mason@broadcom.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/broadcom.c | 10 ++++++++++
 include/linux/brcmphy.h    |  1 +
 2 files changed, 11 insertions(+)

diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 583ef8a..3a64b3d 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -30,6 +30,16 @@ MODULE_DESCRIPTION("Broadcom PHY driver");
 MODULE_AUTHOR("Maciej W. Rozycki");
 MODULE_LICENSE("GPL");
 
+static int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum)
+{
+	/* The register must be written to both the Shadow Register Select and
+	 * the Shadow Read Register Selector
+	 */
+	phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum |
+		  regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT);
+	return phy_read(phydev, MII_BCM54XX_AUX_CTL);
+}
+
 static int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val)
 {
 	return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val);
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 60def78..0ed6691 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -110,6 +110,7 @@
 #define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX	0x0200
 #define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC	0x7000
 #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC	0x0007
+#define MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT	12
 
 #define MII_BCM54XX_AUXCTL_SHDWSEL_MASK	0x0007
 
-- 
2.7.4

  reply	other threads:[~2016-11-04  5:10 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-04  5:10 [PATCH v6 0/7] add NS2 support to bgmac Jon Mason
2016-11-04  5:10 ` Jon Mason
2016-11-04  5:10 ` Jon Mason
2016-11-04  5:10 ` Jon Mason [this message]
2016-11-04  5:10   ` [PATCH v6 1/7] net: phy: broadcom: add bcm54xx_auxctl_read Jon Mason
2016-11-04  5:10 ` [PATCH v6 2/7] Documentation: devicetree: add PHY lane swap binding Jon Mason
2016-11-04  5:10   ` Jon Mason
2016-11-04  5:10   ` Jon Mason
2016-11-04  5:10 ` [PATCH v6 3/7] net: phy: broadcom: Add BCM54810 PHY entry Jon Mason
2016-11-04  5:10   ` Jon Mason
2016-11-04  5:10   ` Jon Mason
2016-11-04  5:10 ` [PATCH v6 4/7] Documentation: devicetree: net: add NS2 bindings to amac Jon Mason
2016-11-04  5:10   ` Jon Mason
2016-11-04  5:10   ` Jon Mason
2016-11-04  5:11 ` [PATCH v6 5/7] net: ethernet: bgmac: device tree phy enablement Jon Mason
2016-11-04  5:11   ` Jon Mason
2016-11-04  6:43   ` Rafal Milecki
2016-11-04  6:43     ` Rafal Milecki
2016-11-04  7:06   ` Rafał Miłecki
2016-11-04  7:06     ` Rafał Miłecki
2016-11-04  7:06     ` Rafał Miłecki
2016-11-04  5:11 ` [PATCH v6 6/7] net: ethernet: bgmac: add NS2 support Jon Mason
2016-11-04  5:11   ` Jon Mason
2016-11-04  5:11   ` Jon Mason
2016-11-04  6:48   ` Rafal Milecki
2016-11-04  6:48     ` Rafal Milecki
2016-11-04  7:07   ` Rafał Miłecki
2016-11-04  7:07     ` Rafał Miłecki
2016-11-04  7:07     ` Rafał Miłecki
2016-11-04  5:11 ` [PATCH v6 7/7] arm64: dts: NS2: add AMAC ethernet support Jon Mason
2016-11-04  5:11   ` Jon Mason
2016-11-04 13:31   ` Sergei Shtylyov
2016-11-04 13:31     ` Sergei Shtylyov
2016-11-04 13:31     ` Sergei Shtylyov
2016-11-04 16:30     ` Jon Mason
2016-11-04 16:30       ` Jon Mason
2016-11-05 10:33       ` Sergei Shtylyov
2016-11-05 10:33         ` Sergei Shtylyov
2016-11-07 18:11 ` [PATCH v6 0/7] add NS2 support to bgmac David Miller
2016-11-07 18:11   ` David Miller

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=1478236262-3351-2-git-send-email-jon.mason@broadcom.com \
    --to=jon.mason@broadcom.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 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.