public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] sama5d3xek: get GMAC working
@ 2014-09-18 21:46 Andreas Bießmann
  2014-09-18 21:46 ` [U-Boot] [PATCH 1/2] macb: simplify gmac initialisation Andreas Bießmann
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andreas Bießmann @ 2014-09-18 21:46 UTC (permalink / raw)
  To: u-boot


I had a strange behaviour for my sama5d34ek board which could sometimes not get
up GMAC in U-Boot. It turned out, that we missed to initialize the PHY
correctly.

Bo, could you please verify correct behaviour on 100MiB devices like
sama5d31ek?


Andreas Bie?mann (2):
  macb: simplify gmac initialisation
  sama5d3xek: run PHY's config

 board/atmel/sama5d3xek/sama5d3xek.c |   29 ++++++++++++++++++++---------
 drivers/net/macb.c                  |   25 ++++++++-----------------
 2 files changed, 28 insertions(+), 26 deletions(-)

-- 
1.7.10.4

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

* [U-Boot] [PATCH 1/2] macb: simplify gmac initialisation
  2014-09-18 21:46 [U-Boot] [PATCH 0/2] sama5d3xek: get GMAC working Andreas Bießmann
@ 2014-09-18 21:46 ` Andreas Bießmann
  2014-10-10 19:57   ` [U-Boot] [U-Boot,1/2] " Andreas Bießmann
  2014-09-18 21:46 ` [U-Boot] [PATCH 2/2] sama5d3xek: run PHY's config Andreas Bießmann
  2014-09-19  2:56 ` [U-Boot] [PATCH 0/2] sama5d3xek: get GMAC working Bo Shen
  2 siblings, 1 reply; 6+ messages in thread
From: Andreas Bießmann @ 2014-09-18 21:46 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
Cc: Joe Hershberger <joe.hershberger@gmail.com>
Cc: Bo Shen <voice.shen@atmel.com>
---

 drivers/net/macb.c |   25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 01a94a4..375c8a4 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -479,31 +479,22 @@ static int macb_phy_init(struct macb_device *macb)
 	/* First check for GMAC */
 	if (macb_is_gem(macb)) {
 		lpa = macb_mdio_read(macb, MII_STAT1000);
-		if (lpa & (1 << 11)) {
-			speed = 1000;
-			duplex = 1;
-		} else {
-		       if (lpa & (1 << 10)) {
-				speed = 1000;
-				duplex = 1;
-			} else {
-				speed = 0;
-			}
-		}
 
-		if (speed == 1000) {
-			printf("%s: link up, %dMbps %s-duplex (lpa: 0x%04x)\n",
+		if (lpa & (LPA_1000FULL | LPA_1000HALF)) {
+			duplex = ((lpa & LPA_1000FULL) ? 1 : 0);
+
+			printf("%s: link up, 1000Mbps %s-duplex (lpa: 0x%04x)\n",
 			       netdev->name,
-			       speed,
 			       duplex ? "full" : "half",
 			       lpa);
 
 			ncfgr = macb_readl(macb, NCFGR);
-			ncfgr &= ~(GEM_BIT(GBE) | MACB_BIT(SPD) | MACB_BIT(FD));
-			if (speed)
-				ncfgr |= GEM_BIT(GBE);
+			ncfgr &= ~(MACB_BIT(SPD) | MACB_BIT(FD));
+			ncfgr |= GEM_BIT(GBE);
+
 			if (duplex)
 				ncfgr |= MACB_BIT(FD);
+
 			macb_writel(macb, NCFGR, ncfgr);
 
 			return 1;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 2/2] sama5d3xek: run PHY's config
  2014-09-18 21:46 [U-Boot] [PATCH 0/2] sama5d3xek: get GMAC working Andreas Bießmann
  2014-09-18 21:46 ` [U-Boot] [PATCH 1/2] macb: simplify gmac initialisation Andreas Bießmann
@ 2014-09-18 21:46 ` Andreas Bießmann
  2014-10-10 19:57   ` [U-Boot] [U-Boot,2/2] " Andreas Bießmann
  2014-09-19  2:56 ` [U-Boot] [PATCH 0/2] sama5d3xek: get GMAC working Bo Shen
  2 siblings, 1 reply; 6+ messages in thread
From: Andreas Bießmann @ 2014-09-18 21:46 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
Cc: Bo Shen <voice.shen@atmel.com>

---

 board/atmel/sama5d3xek/sama5d3xek.c |   29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c
index f53754b..ca4f79d 100644
--- a/board/atmel/sama5d3xek/sama5d3xek.c
+++ b/board/atmel/sama5d3xek/sama5d3xek.c
@@ -17,6 +17,7 @@
 #include <lcd.h>
 #include <atmel_lcdc.h>
 #include <atmel_mci.h>
+#include <phy.h>
 #include <micrel.h>
 #include <net.h>
 #include <netdev.h>
@@ -273,15 +274,25 @@ int dram_init(void)
 
 int board_phy_config(struct phy_device *phydev)
 {
-	/* rx data delay */
-	ksz9021_phy_extended_write(phydev,
-				   MII_KSZ9021_EXT_RGMII_RX_DATA_SKEW, 0x2222);
-	/* tx data delay */
-	ksz9021_phy_extended_write(phydev,
-				   MII_KSZ9021_EXT_RGMII_TX_DATA_SKEW, 0x2222);
-	/* rx/tx clock delay */
-	ksz9021_phy_extended_write(phydev,
-				   MII_KSZ9021_EXT_RGMII_CLOCK_SKEW, 0xf2f4);
+	/* board specific timings for GMAC */
+	if (has_gmac()) {
+		/* rx data delay */
+		ksz9021_phy_extended_write(phydev,
+					   MII_KSZ9021_EXT_RGMII_RX_DATA_SKEW,
+					   0x2222);
+		/* tx data delay */
+		ksz9021_phy_extended_write(phydev,
+					   MII_KSZ9021_EXT_RGMII_TX_DATA_SKEW,
+					   0x2222);
+		/* rx/tx clock delay */
+		ksz9021_phy_extended_write(phydev,
+					   MII_KSZ9021_EXT_RGMII_CLOCK_SKEW,
+					   0xf2f4);
+	}
+
+	/* always run the PHY's config routine */
+	if (phydev->drv->config)
+		return phydev->drv->config(phydev);
 
 	return 0;
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 0/2] sama5d3xek: get GMAC working
  2014-09-18 21:46 [U-Boot] [PATCH 0/2] sama5d3xek: get GMAC working Andreas Bießmann
  2014-09-18 21:46 ` [U-Boot] [PATCH 1/2] macb: simplify gmac initialisation Andreas Bießmann
  2014-09-18 21:46 ` [U-Boot] [PATCH 2/2] sama5d3xek: run PHY's config Andreas Bießmann
@ 2014-09-19  2:56 ` Bo Shen
  2 siblings, 0 replies; 6+ messages in thread
From: Bo Shen @ 2014-09-19  2:56 UTC (permalink / raw)
  To: u-boot

Hi Andreas,

On 09/19/2014 05:46 AM, Andreas Bie?mann wrote:
>
> I had a strange behaviour for my sama5d34ek board which could sometimes not get
> up GMAC in U-Boot. It turned out, that we missed to initialize the PHY
> correctly.
>
> Bo, could you please verify correct behaviour on 100MiB devices like
> sama5d31ek?

Test OK on sama5d31ek board, you can add Tested-by tag for this patch 
series.

Tested-by: Bo Shen <voice.shen@atmel.com>

Thanks.

>
> Andreas Bie?mann (2):
>    macb: simplify gmac initialisation
>    sama5d3xek: run PHY's config
>
>   board/atmel/sama5d3xek/sama5d3xek.c |   29 ++++++++++++++++++++---------
>   drivers/net/macb.c                  |   25 ++++++++-----------------
>   2 files changed, 28 insertions(+), 26 deletions(-)
>

Best Regards,
Bo Shen

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

* [U-Boot] [U-Boot,1/2] macb: simplify gmac initialisation
  2014-09-18 21:46 ` [U-Boot] [PATCH 1/2] macb: simplify gmac initialisation Andreas Bießmann
@ 2014-10-10 19:57   ` Andreas Bießmann
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Bießmann @ 2014-10-10 19:57 UTC (permalink / raw)
  To: u-boot

Dear Andreas Devel,

Andreas Devel <andreas.devel@googlemail.com> writes:
>Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
>Cc: Joe Hershberger <joe.hershberger@gmail.com>
>Cc: Bo Shen <voice.shen@atmel.com>
>---
>
> drivers/net/macb.c |   25 ++++++++-----------------
> 1 file changed, 8 insertions(+), 17 deletions(-)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann

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

* [U-Boot] [U-Boot,2/2] sama5d3xek: run PHY's config
  2014-09-18 21:46 ` [U-Boot] [PATCH 2/2] sama5d3xek: run PHY's config Andreas Bießmann
@ 2014-10-10 19:57   ` Andreas Bießmann
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Bießmann @ 2014-10-10 19:57 UTC (permalink / raw)
  To: u-boot

Dear Andreas Devel,

Andreas Devel <andreas.devel@googlemail.com> writes:
>Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
>Cc: Bo Shen <voice.shen@atmel.com>
>---
>
> board/atmel/sama5d3xek/sama5d3xek.c |   29 ++++++++++++++++++++---------
> 1 file changed, 20 insertions(+), 9 deletions(-)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann

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

end of thread, other threads:[~2014-10-10 19:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-18 21:46 [U-Boot] [PATCH 0/2] sama5d3xek: get GMAC working Andreas Bießmann
2014-09-18 21:46 ` [U-Boot] [PATCH 1/2] macb: simplify gmac initialisation Andreas Bießmann
2014-10-10 19:57   ` [U-Boot] [U-Boot,1/2] " Andreas Bießmann
2014-09-18 21:46 ` [U-Boot] [PATCH 2/2] sama5d3xek: run PHY's config Andreas Bießmann
2014-10-10 19:57   ` [U-Boot] [U-Boot,2/2] " Andreas Bießmann
2014-09-19  2:56 ` [U-Boot] [PATCH 0/2] sama5d3xek: get GMAC working Bo Shen

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