Skip to contentSkip to conversation

net: macb: Not all the GEM are gigabit capable

PATCH Superseded Gregory CLEMENT 2 participants 3 messages Dec 16, 2015 Network drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: macb: Not all the GEM are gigabit capable

During the initialization of PHY the gigabit bit capable is set if the controller is a GEM. However, for sama5d2 and sama5d4, the GEM is configured to support only 10/100.

Improperly setting the GBE capability leads to an unresponsive MAC controller. This patch fix this behavior allowing to use the gmac with these SoCs.

fix gem

---
 drivers/net/macb.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/net/macb.c +11 -2
index a5c1880..ab38f48 100644
@@ -109,6 +109,15 @@ static int macb_is_gem(struct macb_device *macb)
 	return MACB_BFEXT(IDNUM, macb_readl(macb, MID)) == 0x2;
 }
 
+static int gem_is_gigabit_capable(struct macb_device *macb)
+{
+	/*
+	 * The GEM controllers embeded in SAMA5D2 and SAMA5D4 are
+	 * configured to support only 10/100.
+	 */
+	return macb_is_gem(macb) && !cpu_is_sama5d2() && !cpu_is_sama5d2();
+}
+
 static void macb_mdio_write(struct macb_device *macb, u8 reg, u16 value)
 {
 	unsigned long netctl;
@@ -480,8 +489,8 @@ static int macb_phy_init(struct macb_device *macb)
 		return 0;
 	}
 
-	/* First check for GMAC */
-	if (macb_is_gem(macb)) {
+	/* First check for GMAC and that it is GiB capable */
+	if (gem_is_gigabit_capable(macb))
 		lpa = macb_mdio_read(macb, MII_STAT1000);
 
 		if (lpa & (LPA_1000FULL | LPA_1000HALF)) {
Signature · 1 line
2.5.0
#1 lore raw

PATCH v2 1/1 net: macb: Not all the GEM are gigabit capable

Le 16/12/2015 11:27, Gregory CLEMENT a ?crit :

Quoted 21 lines

During the initialization of PHY the gigabit bit capable is set if the controller is a GEM. However, for sama5d2 and sama5d4, the GEM is configured to support only 10/100.

Improperly setting the GBE capability leads to an unresponsive MAC controller. This patch fix this behavior allowing to use the gmac with these SoCs.

fix gem

---
 drivers/net/macb.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/net/macb.c +0 -0
index a5c1880..ab38f48 100644

drivers/net/macb.c static int macb_is_gem(struct macb_device *macb) · line 118

Quoted 10 lines
drivers/net/macb.c +7 -0
@@ -109,6 +109,15 @@ static int macb_is_gem(struct macb_device *macb)
 	return MACB_BFEXT(IDNUM, macb_readl(macb, MID)) == 0x2;
 }
 
+static int gem_is_gigabit_capable(struct macb_device *macb)
+{
+	/*
+	 * The GEM controllers embeded in SAMA5D2 and SAMA5D4 are
+	 * configured to support only 10/100.
+	 */
+	return macb_is_gem(macb) && !cpu_is_sama5d2() && !cpu_is_sama5d2();

Typo here: sama5d2 twice!
;-)

Quoted 17 lines
drivers/net/macb.c +4 -2
+}
+
 static void macb_mdio_write(struct macb_device *macb, u8 reg, u16 value)
 {
 	unsigned long netctl;
@@ -480,8 +489,8 @@ static int macb_phy_init(struct macb_device *macb)
 		return 0;
 	}
 
-	/* First check for GMAC */
-	if (macb_is_gem(macb)) {
+	/* First check for GMAC and that it is GiB capable */
+	if (gem_is_gigabit_capable(macb))
 		lpa = macb_mdio_read(macb, MII_STAT1000);
 
 		if (lpa & (LPA_1000FULL | LPA_1000HALF)) {
Signature · 1 line
Nicolas Ferre
#2 lore raw

PATCH v2 1/1 net: macb: Not all the GEM are gigabit capable

Hi Nicolas,

Quoted 46 lines · Nicolas Ferre

Le 16/12/2015 11:27, Gregory CLEMENT a ?crit :

Quoted 21 lines

During the initialization of PHY the gigabit bit capable is set if the controller is a GEM. However, for sama5d2 and sama5d4, the GEM is configured to support only 10/100.

Improperly setting the GBE capability leads to an unresponsive MAC controller. This patch fix this behavior allowing to use the gmac with these SoCs.

fix gem

---
 drivers/net/macb.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/net/macb.c +0 -0
index a5c1880..ab38f48 100644

drivers/net/macb.c static int macb_is_gem(struct macb_device *macb) · line 118

Quoted 10 lines
drivers/net/macb.c +7 -0
@@ -109,6 +109,15 @@ static int macb_is_gem(struct macb_device *macb)
 	return MACB_BFEXT(IDNUM, macb_readl(macb, MID)) == 0x2;
 }
 
+static int gem_is_gigabit_capable(struct macb_device *macb)
+{
+	/*
+	 * The GEM controllers embeded in SAMA5D2 and SAMA5D4 are
+	 * configured to support only 10/100.
+	 */
+	return macb_is_gem(macb) && !cpu_is_sama5d2() && !cpu_is_sama5d2();

Typo here: sama5d2 twice!
;-)

Quoted 9 lines
drivers/net/macb.c +2 -0
+}
+
 static void macb_mdio_write(struct macb_device *macb, u8 reg, u16 value)
 {
 	unsigned long netctl;
@@ -480,8 +489,8 @@ static int macb_phy_init(struct macb_device *macb)
 		return 0;
 	}
 
Quoted 4 lines

drivers/net/macb.c static int macb_phy_init(struct macb_device *macb) · line 493

Quoted 4 lines
drivers/net/macb.c +2 -2
-	/* First check for GMAC */
-	if (macb_is_gem(macb)) {
+	/* First check for GMAC and that it is GiB capable */
+	if (gem_is_gigabit_capable(macb))

And here a { was missing!

Sorry for the nois a v3 will come.

Gregory

Quoted 8 lines
Quoted 4 lines
drivers/net/macb.c +0 -0
 		lpa = macb_mdio_read(macb, MII_STAT1000);
 
 		if (lpa & (LPA_1000FULL | LPA_1000HALF)) {
Signature · 1 line
Nicolas Ferre
Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com