public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] patch to support Xilinx 1000BASE-X phy (GTX)
       [not found] <CACw6+C43vSxswLS8xbCnVWcQmuekLe1OAeELa9shuheziegxuQ@mail.gmail.com>
@ 2013-02-19 13:36 ` Charles Coldwell
  2013-02-19 19:04   ` Wolfgang Denk
  0 siblings, 1 reply; 3+ messages in thread
From: Charles Coldwell @ 2013-02-19 13:36 UTC (permalink / raw)
  To: u-boot

and here it is again, in-line

commit 39695029bc15041c809df3db4ba19bd729c447fa
Author: Charles Coldwell <coldwell@ll.mit.edu>
Date:   Tue Feb 19 08:27:33 2013 -0500

    Changes to support the Xilinx 1000BASE-X phy (GTX/MGT)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d0ed766..8a38ccb 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -75,6 +75,10 @@ static int genphy_config_advert(struct phy_device *phydev)
  adv |= ADVERTISE_PAUSE_CAP;
  if (advertise & ADVERTISED_Asym_Pause)
  adv |= ADVERTISE_PAUSE_ASYM;
+ if (advertise & ADVERTISED_1000baseX_Half)
+ adv |= ADVERTISE_1000XHALF;
+ if (advertise & ADVERTISED_1000baseX_Full)
+ adv |= ADVERTISE_1000XFULL;

  if (adv != oldadv) {
  err = phy_write(phydev, MDIO_DEVAD_NONE, MII_ADVERTISE, adv);
@@ -288,6 +292,7 @@ static int genphy_parse_link(struct phy_device *phydev)
  if (mii_reg & BMSR_ANEGCAPABLE) {
  u32 lpa = 0;
  u32 gblpa = 0;
+ u32 estatus = 0;

  /* Check for gigabit capability */
  if (mii_reg & BMSR_ERCAP) {
@@ -327,6 +332,17 @@ static int genphy_parse_link(struct phy_device *phydev)

  } else if (lpa & LPA_10FULL)
  phydev->duplex = DUPLEX_FULL;
+
+ if (mii_reg & BMSR_ESTATEN)
+ estatus = phy_read(phydev, MDIO_DEVAD_NONE, MII_ESTATUS);
+
+ if (estatus & (ESTATUS_1000_XFULL | ESTATUS_1000_XHALF |
+ ESTATUS_1000_TFULL | ESTATUS_1000_THALF)) {
+ phydev->speed = SPEED_1000;
+ if (estatus & (ESTATUS_1000_XFULL | ESTATUS_1000_TFULL))
+ phydev->duplex = DUPLEX_FULL;
+ }
+
  } else {
  u32 bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);

@@ -384,6 +400,10 @@ int genphy_config(struct phy_device *phydev)
  features |= SUPPORTED_1000baseT_Full;
  if (val & ESTATUS_1000_THALF)
  features |= SUPPORTED_1000baseT_Half;
+ if (val & ESTATUS_1000_XFULL)
+ features |= SUPPORTED_1000baseX_Full;
+ if (val & ESTATUS_1000_XHALF)
+ features |= SUPPORTED_1000baseX_Full;
  }

  phydev->supported = features;
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index fcb20fe..f6dbdb0 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -580,6 +580,8 @@ enum ethtool_sfeatures_retval_bits {
 #define SUPPORTED_10000baseKX4_Full (1 << 18)
 #define SUPPORTED_10000baseKR_Full (1 << 19)
 #define SUPPORTED_10000baseR_FEC (1 << 20)
+#define SUPPORTED_1000baseX_Half (1 << 21)
+#define SUPPORTED_1000baseX_Full (1 << 22)

 /* Indicates what features are advertised by the interface. */
 #define ADVERTISED_10baseT_Half (1 << 0)
@@ -603,6 +605,8 @@ enum ethtool_sfeatures_retval_bits {
 #define ADVERTISED_10000baseKX4_Full (1 << 18)
 #define ADVERTISED_10000baseKR_Full (1 << 19)
 #define ADVERTISED_10000baseR_FEC (1 << 20)
+#define ADVERTISED_1000baseX_Half (1 << 21)
+#define ADVERTISED_1000baseX_Full (1 << 22)

 /* The following are all involved in forcing a particular link
  * mode for the device for setting things.  When getting the
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 8b92692..66b83d8 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -115,6 +115,8 @@
 #define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected    */
 #define EXPANSION_RESV 0xffe0 /* Unused...       */

+#define ESTATUS_1000_XFULL 0x8000 /* Can do 1000BX Full */
+#define ESTATUS_1000_XHALF 0x4000 /* Can do 1000BX Half */
 #define ESTATUS_1000_TFULL 0x2000 /* Can do 1000BT Full */
 #define ESTATUS_1000_THALF 0x1000 /* Can do 1000BT Half */


On Tue, Feb 19, 2013 at 8:35 AM, Charles Coldwell <coldwell@gmail.com> wrote:
> Attached is a (small) patch that enabled me to use the 1000BASE-X phy
> on the Xilinx Virtex-6 hard TEMAC (i.e. the one that uses the GTX
> transceivers).
>
> --
> Charles M. Coldwell, W1CMC
> Belmont, Massachusetts, New England
> "Turn on, log in, tune out"



--
Charles M. Coldwell, W1CMC
Belmont, Massachusetts, New England
"Turn on, log in, tune out"

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] patch to support Xilinx 1000BASE-X phy (GTX)
  2013-02-19 13:36 ` [U-Boot] patch to support Xilinx 1000BASE-X phy (GTX) Charles Coldwell
@ 2013-02-19 19:04   ` Wolfgang Denk
  2013-02-19 19:20     ` [U-Boot] [PATCH] " Charles Coldwell
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Denk @ 2013-02-19 19:04 UTC (permalink / raw)
  To: u-boot

Dear Charles Coldwell,

In message <CACw6+C5mO7bLUUhMcKDzUtK+CPjzmR0JMJgGxmnyPvzGtLGfmw@mail.gmail.com> you wrote:
> and here it is again, in-line
> 
> commit 39695029bc15041c809df3db4ba19bd729c447fa
> Author: Charles Coldwell <coldwell@ll.mit.edu>
> Date:   Tue Feb 19 08:27:33 2013 -0500
> 
>     Changes to support the Xilinx 1000BASE-X phy (GTX/MGT)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index d0ed766..8a38ccb 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -75,6 +75,10 @@ static int genphy_config_advert(struct phy_device *phydev)
>   adv |= ADVERTISE_PAUSE_CAP;
>   if (advertise & ADVERTISED_Asym_Pause)
>   adv |= ADVERTISE_PAUSE_ASYM;
> + if (advertise & ADVERTISED_1000baseX_Half)
> + adv |= ADVERTISE_1000XHALF;
> + if (advertise & ADVERTISED_1000baseX_Full)
> + adv |= ADVERTISE_1000XFULL;

Your patch is white space corrupted.  Please fix your mailer.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Documentation is like sex: when it is good, it is  very,  very  good;
and when it is bad, it is better than nothing.         - Dick Brandon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] to support Xilinx 1000BASE-X phy (GTX)
  2013-02-19 19:04   ` Wolfgang Denk
@ 2013-02-19 19:20     ` Charles Coldwell
  0 siblings, 0 replies; 3+ messages in thread
From: Charles Coldwell @ 2013-02-19 19:20 UTC (permalink / raw)
  To: u-boot

On Tue, 19 Feb 2013, Wolfgang Denk wrote:

> 
> Your patch is white space corrupted.  Please fix your mailer.

commit 39695029bc15041c809df3db4ba19bd729c447fa
Author: Charles Coldwell <coldwell@ll.mit.edu>
Date:   Tue Feb 19 08:27:33 2013 -0500

    Changes to support the Xilinx 1000BASE-X phy (GTX/MGT)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d0ed766..8a38ccb 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -75,6 +75,10 @@ static int genphy_config_advert(struct phy_device *phydev)
 		adv |= ADVERTISE_PAUSE_CAP;
 	if (advertise & ADVERTISED_Asym_Pause)
 		adv |= ADVERTISE_PAUSE_ASYM;
+	if (advertise & ADVERTISED_1000baseX_Half)
+		adv |= ADVERTISE_1000XHALF;
+	if (advertise & ADVERTISED_1000baseX_Full)
+		adv |= ADVERTISE_1000XFULL;
 
 	if (adv != oldadv) {
 		err = phy_write(phydev, MDIO_DEVAD_NONE, MII_ADVERTISE, adv);
@@ -288,6 +292,7 @@ static int genphy_parse_link(struct phy_device *phydev)
 	if (mii_reg & BMSR_ANEGCAPABLE) {
 		u32 lpa = 0;
 		u32 gblpa = 0;
+		u32 estatus = 0;
 
 		/* Check for gigabit capability */
 		if (mii_reg & BMSR_ERCAP) {
@@ -327,6 +332,17 @@ static int genphy_parse_link(struct phy_device *phydev)
 
 		} else if (lpa & LPA_10FULL)
 			phydev->duplex = DUPLEX_FULL;
+
+		if (mii_reg & BMSR_ESTATEN)
+			estatus = phy_read(phydev, MDIO_DEVAD_NONE, MII_ESTATUS);
+
+		if (estatus & (ESTATUS_1000_XFULL | ESTATUS_1000_XHALF |
+				ESTATUS_1000_TFULL | ESTATUS_1000_THALF)) {
+			phydev->speed = SPEED_1000;
+			if (estatus & (ESTATUS_1000_XFULL | ESTATUS_1000_TFULL))
+				phydev->duplex = DUPLEX_FULL;
+		}
+
 	} else {
 		u32 bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
 
@@ -384,6 +400,10 @@ int genphy_config(struct phy_device *phydev)
 			features |= SUPPORTED_1000baseT_Full;
 		if (val & ESTATUS_1000_THALF)
 			features |= SUPPORTED_1000baseT_Half;
+		if (val & ESTATUS_1000_XFULL)
+			features |= SUPPORTED_1000baseX_Full;
+		if (val & ESTATUS_1000_XHALF)
+			features |= SUPPORTED_1000baseX_Full;
 	}
 
 	phydev->supported = features;
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index fcb20fe..f6dbdb0 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -580,6 +580,8 @@ enum ethtool_sfeatures_retval_bits {
 #define SUPPORTED_10000baseKX4_Full	(1 << 18)
 #define SUPPORTED_10000baseKR_Full	(1 << 19)
 #define SUPPORTED_10000baseR_FEC	(1 << 20)
+#define SUPPORTED_1000baseX_Half	(1 << 21)
+#define SUPPORTED_1000baseX_Full	(1 << 22)
 
 /* Indicates what features are advertised by the interface. */
 #define ADVERTISED_10baseT_Half		(1 << 0)
@@ -603,6 +605,8 @@ enum ethtool_sfeatures_retval_bits {
 #define ADVERTISED_10000baseKX4_Full	(1 << 18)
 #define ADVERTISED_10000baseKR_Full	(1 << 19)
 #define ADVERTISED_10000baseR_FEC	(1 << 20)
+#define ADVERTISED_1000baseX_Half	(1 << 21)
+#define ADVERTISED_1000baseX_Full	(1 << 22)
 
 /* The following are all involved in forcing a particular link
  * mode for the device for setting things.  When getting the
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 8b92692..66b83d8 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -115,6 +115,8 @@
 #define EXPANSION_MFAULTS	0x0010	/* Multiple faults detected    */
 #define EXPANSION_RESV		0xffe0	/* Unused...		       */
 
+#define ESTATUS_1000_XFULL	0x8000	/* Can do 1000BX Full */
+#define ESTATUS_1000_XHALF	0x4000	/* Can do 1000BX Half */
 #define ESTATUS_1000_TFULL	0x2000	/* Can do 1000BT Full */
 #define ESTATUS_1000_THALF	0x1000	/* Can do 1000BT Half */
 

-- 
Charles M. Coldwell, W1CMC
"Turn on, log in, tune out"
Somerville, Massachusetts, New England (FN42kj)

GPG ID:  852E052F
GPG FPR: 77E5 2B51 4907 F08A 7E92  DE80 AFA9 9A8F 852E 052F

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-19 19:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CACw6+C43vSxswLS8xbCnVWcQmuekLe1OAeELa9shuheziegxuQ@mail.gmail.com>
2013-02-19 13:36 ` [U-Boot] patch to support Xilinx 1000BASE-X phy (GTX) Charles Coldwell
2013-02-19 19:04   ` Wolfgang Denk
2013-02-19 19:20     ` [U-Boot] [PATCH] " Charles Coldwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox