Skip to contentSkip to conversation

net: fix some bugs in LL TEMAC driver

PATCH Superseded Stephan Linz 3 participants 11 messages Nov 19, 2010 – Dec 3, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net: fix some bugs in LL TEMAC driver

* avoid using link variable uninitialized
* avoid using phy_addr variable with invalid value
* reorganize phy control: first looking for phy than link
* return with error (result value -1) if no phy/link was found
* fix boolean mistake in wait for link: wait as long as we got

    phy register 1 has no link indication (BMSR != 0x24)

* expand the 'first run' flag handling in ll_temac_init() in respect to possible error detection in xps_ll_temac_phy_ctrl()

---
 drivers/net/xilinx_ll_temac.c |   44 ++++++++++++++++++++++++++++++----------
 1 files changed, 33 insertions(+), 11 deletions(-)
drivers/net/xilinx_ll_temac.c +33 -11
index 72a1632..a72e072 100644
@@ -225,24 +225,21 @@ static void read_phy_reg (struct eth_device *dev, int phy_addr)
 #endif
 
 static int phy_addr = -1;
-static int link;
+static int link = 0;
 
 /* setting ll_temac and phy to proper setting */
 static int xps_ll_temac_phy_ctrl(struct eth_device *dev)
 {
-	int i;
+	int i, retries;
 	unsigned int result;
-	unsigned retries = 10;
 
+	 /* link is setup */
 	if (link == 1)
-		return 1; /* link is setup */
-
-	/* wait for link up */
-	while (retries-- &&
-		((xps_ll_temac_hostif_get(dev, 0, phy_addr, 1) & 0x24) == 0x24))
-		;
+		return 1;
 
+	/* try out if have ever found the right phy? */
 	if (phy_addr == -1) {
+		printf("Looking for phy ... ");
 		for (i = 31; i >= 0; i--) {
 			result = xps_ll_temac_hostif_get(dev, 0, i, 1);
 			if ((result & 0x0ffff) != 0x0ffff) {
@@ -251,7 +248,27 @@ static int xps_ll_temac_phy_ctrl(struct eth_device *dev)
 				break;
 			}
 		}
+
+		/* no success? -- wery bad */
+		if (phy_addr == -1) {
+			printf("ERROR\n");
+			return -1;
+		}
+		printf("OK\n");
+	}
+
+	/* wait for link up */
+	printf("Waiting for link ... ");
+	retries = 10;
+	while (retries-- &&
+		((xps_ll_temac_hostif_get(dev, 0, phy_addr, 1) & 0x24) != 0x24))
+		;
+
+	if (retries < 0) {
+		printf("ERROR\n");
+		return 0;
 	}
+	printf("OK\n");
 
 	/* get PHY id */
 	i = (xps_ll_temac_hostif_get(dev, 0, phy_addr, 2) << 16) | \
@@ -491,7 +508,6 @@ static int ll_temac_init(struct eth_device *dev, bd_t *bis)
 #endif
 	if (!first)
 		return 0;
-	first = 0;
 
 	xps_ll_temac_init(dev, bis);
 
@@ -502,7 +518,13 @@ static int ll_temac_init(struct eth_device *dev, bd_t *bis)
 	for (i = 0; i < 32; i++)
 		read_phy_reg(dev, i);
 #endif
-	xps_ll_temac_phy_ctrl(dev);
+
+	if (xps_ll_temac_phy_ctrl(dev) == 0) {
+		xps_ll_temac_halt(dev);
+		return -1;
+	}
+
+	first = 0;
 	return 1;
 }
 
Signature · 1 line
1.6.0.4
#1 lore raw

PATCH 2/2 net: Add National DP83865 PHY to LL TEMAC driver

Adding the missing phy-id for the National 10/100/1000 MBit PHY DP83865 used on the Xilinx Spartan-3A DSP evaluation board SP3ADSP1800.

---
 drivers/net/xilinx_ll_temac.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/xilinx_ll_temac.c +7 -2
index a72e072..b19a74a 100644
@@ -287,8 +287,11 @@ static int xps_ll_temac_phy_ctrl(struct eth_device *dev)
 		return 1;
 	}
 
-	/* Marwell 88e1111 id - ml50x */
-	if (i == 0x1410cc2) {
+	/*
+	 * Marwell 88e1111 id - ml50x, ml605
+	 * National DP83865 id - sp3adsp1800
+	 */
+	if (i == 0x1410cc2 || i == 0x20005c7a) {
 		result = xps_ll_temac_hostif_get(dev, 0, phy_addr, 5);
 		if ((result & 0x8000) == 0x8000) {
 			xps_ll_temac_indirect_set(dev, 0, EMMC, 0x80000000);
@@ -305,6 +308,8 @@ static int xps_ll_temac_phy_ctrl(struct eth_device *dev)
 		}
 		return 1;
 	}
+
+	printf("Unsupported PHY\n");
 	return 0;
 }
 
Signature · 1 line
1.6.0.4
#2 lore raw

PATCH 2/2 net: Add National DP83865 PHY to LL TEMAC driver

Hi Stephan,

2010/11/19 Stephan Linz <[email protected]>

Quoted 4 lines

Adding the missing phy-id for the National 10/100/1000 MBit PHY DP83865 used on the Xilinx Spartan-3A DSP evaluation board SP3ADSP1800.

I understand that you want to add support for PHY which is on xilinx development
board but here is one design problem.
Is this really way how to add support for PHYs? As you can suggest the answer is NO.

I was talking about with Ben some months ago and there is only one solution which can be acceptable. The solution is phy lib. Not sure if Ben did any basic tests with
it but this is sensible way how to do it.

The main reason is that Xilinx have several development boards and every custom board
can have different phy and I don't want to see that we will add support for it directly to driver.

In general I agree that it is necessary to support more PHYs at least all which are on
Xilinx development boards but I can't agree with adding it directly to the driver.

Regards,
Michal

Quoted 39 lines
---
 drivers/net/xilinx_ll_temac.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/xilinx_ll_temac.c +5 -2
index a72e072..b19a74a 100644
@@ -287,8 +287,11 @@ static int xps_ll_temac_phy_ctrl(struct eth_device
 *dev)
               return 1;
       }
 
-       /* Marwell 88e1111 id - ml50x */
-       if (i == 0x1410cc2) {
+       /*
+        * Marwell 88e1111 id - ml50x, ml605
+        * National DP83865 id - sp3adsp1800
+        */
+       if (i == 0x1410cc2 || i == 0x20005c7a) {
               result = xps_ll_temac_hostif_get(dev, 0, phy_addr, 5);
               if ((result & 0x8000) == 0x8000) {
                       xps_ll_temac_indirect_set(dev, 0, EMMC, 0x80000000);
drivers/net/xilinx_ll_temac.c +2 -1
@@ -305,6 +308,8 @@ static int xps_ll_temac_phy_ctrl(struct eth_device
 *dev)
               }
               return 1;
       }
+
+       printf("Unsupported PHY\n");
       return 0;
 }
 
--

1.6.0.4

#3 lore raw

PATCH 2/2 net: Add National DP83865 PHY to LL TEMAC driver

Am Samstag, 20. November 2010, um 10:23:18 schrieb Michal Simek:

Quoted 1 line

Hi Stephan,

Hi Michal,
Hi Ben (see last questen to you below),

Quoted 9 lines

2010/11/19 Stephan Linz <[email protected]>

Quoted 3 lines

Adding the missing phy-id for the National 10/100/1000 MBit PHY DP83865 used on the Xilinx Spartan-3A DSP evaluation board SP3ADSP1800.

I understand that you want to add support for PHY which is on xilinx development

right.

Quoted 3 lines

board but here is one design problem.
Is this really way how to add support for PHYs? As you can suggest the answer is NO.

Yes of course, that is my opinion too.

Quoted 5 lines

I was talking about with Ben some months ago and there is only one solution which can be acceptable. The solution is phy lib. Not sure if Ben did any basic tests with
it but this is sensible way how to do it.

@Ben: last question to you: Did you any basic tests with the new phy library? Is there any documentation?

Quoted 5 lines

The main reason is that Xilinx have several development boards and every custom board
can have different phy and I don't want to see that we will add support for it directly to driver.

Yes I know. This will be a problem if we do not use the phy library.

Quoted 5 lines

In general I agree that it is necessary to support more PHYs at least all which are on
Xilinx development boards but I can't agree with adding it directly to the driver.

I accept your decision and will maintain my own patch set until we can use the new phy library.

Other question for the transitional time to use the phy lib. Can we introduce a LL TEMAC configuration for the board specific phy id? Example:

<include/configs/microblaze-generic.h>
#define CONFIG_XILINX_LL_TEMAC_PHYID 0x1410cc2

<drivers/net/xilinx_ll_temac.c>
#ifndef CONFIG_XILINX_LL_TEMAC_PHYID
#error define phyid in configuration
#endif

xps_ll_temac_phy_ctrl():
if (i == CONFIG_XILINX_LL_TEMAC_PHYID) {
....
}

Best regards,
Stephan

Quoted 40 lines

Regards,
Michal

Quoted 36 lines
---
 drivers/net/xilinx_ll_temac.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/xilinx_ll_temac.c index a72e072..b19a74a 100644

drivers/net/xilinx_ll_temac.c +5 -2
@@ -287,8 +287,11 @@ static int xps_ll_temac_phy_ctrl(struct eth_device
 *dev)
               return 1;
       }
 
-       /* Marwell 88e1111 id - ml50x */
-       if (i == 0x1410cc2) {
+       /*
+        * Marwell 88e1111 id - ml50x, ml605
+        * National DP83865 id - sp3adsp1800
+        */
+       if (i == 0x1410cc2 || i == 0x20005c7a) {
               result = xps_ll_temac_hostif_get(dev, 0, phy_addr, 5);
               if ((result & 0x8000) == 0x8000) {

xps_ll_temac_indirect_set(dev, 0, EMMC,
0x80000000); @@ -305,6 +308,8 @@ static int xps_ll_temac_phy_ctrl(struct eth_device *dev)

               }
               return 1;
       }
drivers/net/xilinx_ll_temac.c +2 -1
+
+       printf("Unsupported PHY\n");
       return 0;
 }
 
--

1.6.0.4

Signature · 9 lines
Viele Gr??e,
Stephan Linz
______________________________________________________________________________
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
CDK4AVR: http://cdk4avr.sourceforge.net/
CDK4NIOS: http://cdk4nios.sourceforge.net/
CDK4MSP: http://cdk4msp.sourceforge.net/
CPM4L: http://download.opensuse.org/repositories/home:/rexut:/CPM4L
#4 lore raw

PATCH 1/2 net: fix some bugs in LL TEMAC driver

In reply to Stephan Linz

2010/11/19 Stephan Linz <[email protected]>

Quoted 9 lines

* avoid using link variable uninitialized
* avoid using phy_addr variable with invalid value
* reorganize phy control: first looking for phy than link
* return with error (result value -1) if no phy/link was found
* fix boolean mistake in wait for link: wait as long as we got phy register 1 has no link indication (BMSR != 0x24)
* expand the 'first run' flag handling in ll_temac_init() in respect to possible error detection in xps_ll_temac_phy_ctrl()

I will test your changes on real hw.

Some comments below.

Thanks,
Michal

Quoted 32 lines
---
 drivers/net/xilinx_ll_temac.c |   44
++++++++++++++++++++++++++++++----------
 1 files changed, 33 insertions(+), 11 deletions(-)
drivers/net/xilinx_ll_temac.c +3 -6
index 72a1632..a72e072 100644
@@ -225,24 +225,21 @@ static void read_phy_reg (struct eth_device *dev, int
 phy_addr)
 #endif
 
 static int phy_addr = -1;
-static int link;
+static int link = 0;
 
 /* setting ll_temac and phy to proper setting */
 static int xps_ll_temac_phy_ctrl(struct eth_device *dev)
 {
-       int i;
+       int i, retries;
       unsigned int result;
-       unsigned retries = 10;
 
+        /* link is setup */
       if (link == 1)
-               return 1; /* link is setup */
-
-       /* wait for link up */

drivers/net/xilinx_ll_temac.c static void read_phy_reg (struct eth_device *dev, int · line 245

Quoted 10 lines
drivers/net/xilinx_ll_temac.c +3 -3
-       while (retries-- &&
-               ((xps_ll_temac_hostif_get(dev, 0, phy_addr, 1) & 0x24) ==
 0x24))
-               ;
+               return 1;
 
+       /* try out if have ever found the right phy? */
       if (phy_addr == -1) {
+               printf("Looking for phy ... ");
 

use puts instead.

drivers/net/xilinx_ll_temac.c static int xps_ll_temac_phy_ctrl(struct eth_device · line 256

Quoted 13 lines
               for (i = 31; i >= 0; i--) {
                       result = xps_ll_temac_hostif_get(dev, 0, i, 1);
                       if ((result & 0x0ffff) != 0x0ffff) {
drivers/net/xilinx_ll_temac.c +4 -0
@@ -251,7 +248,27 @@ static int xps_ll_temac_phy_ctrl(struct eth_device
 *dev)
                               break;
                       }
               }
+
+               /* no success? -- wery bad */
+               if (phy_addr == -1) {
+                       printf("ERROR\n");
 

same here

drivers/net/xilinx_ll_temac.c static int xps_ll_temac_phy_ctrl(struct eth_device *dev) · line 272

Quoted 8 lines
drivers/net/xilinx_ll_temac.c +7 -0
+                       return -1;
+               }
+               printf("OK\n");
+       }
+
+       /* wait for link up */
+       printf("Waiting for link ... ");
 

and here.

drivers/net/xilinx_ll_temac.c static int xps_ll_temac_phy_ctrl(struct eth_device *dev) · line 268

Quoted 9 lines
drivers/net/xilinx_ll_temac.c +7 -0
+       retries = 10;
+       while (retries-- &&
+               ((xps_ll_temac_hostif_get(dev, 0, phy_addr, 1) & 0x24) !=
 0x24))
+               ;
+
+       if (retries < 0) {
+               printf("ERROR\n");

and here

drivers/net/xilinx_ll_temac.c static int xps_ll_temac_phy_ctrl(struct eth_device *dev) · line 271

Quoted 4 lines
drivers/net/xilinx_ll_temac.c +2 -0
+               return 0;
       }
+       printf("OK\n");

and here.

Quoted 32 lines
       /* get PHY id */
       i = (xps_ll_temac_hostif_get(dev, 0, phy_addr, 2) << 16) | \
drivers/net/xilinx_ll_temac.c +7 -3
@@ -491,7 +508,6 @@ static int ll_temac_init(struct eth_device *dev, bd_t
 *bis)
 #endif
       if (!first)
               return 0;
-       first = 0;
 
       xps_ll_temac_init(dev, bis);
@@ -502,7 +518,13 @@ static int ll_temac_init(struct eth_device *dev, bd_t
 *bis)
       for (i = 0; i < 32; i++)
               read_phy_reg(dev, i);
 #endif
-       xps_ll_temac_phy_ctrl(dev);
+
+       if (xps_ll_temac_phy_ctrl(dev) == 0) {
+               xps_ll_temac_halt(dev);
+               return -1;
+       }
+
+       first = 0;
       return 1;
 }
 
--

1.6.0.4

#5 lore raw

PATCH 1/2 net: fix some bugs in LL TEMAC driver

Am Samstag, 20. November 2010, um 10:27:45 schrieb Michal Simek:

Quoted 11 lines

2010/11/19 Stephan Linz <[email protected]>

Quoted 8 lines

* avoid using link variable uninitialized
* avoid using phy_addr variable with invalid value
* reorganize phy control: first looking for phy than link
* return with error (result value -1) if no phy/link was found
* fix boolean mistake in wait for link: wait as long as we got phy register 1 has no link indication (BMSR != 0x24)
* expand the 'first run' flag handling in ll_temac_init() in respect to possible error detection in xps_ll_temac_phy_ctrl()

Quoted 3 lines

I will test your changes on real hw.

Some comments below.

I do it so on Monday ... printf() --> puts()

Regards,
Stephan

Quoted 118 lines

Thanks,
Michal

Quoted 30 lines
---
 drivers/net/xilinx_ll_temac.c |   44
++++++++++++++++++++++++++++++----------
 1 files changed, 33 insertions(+), 11 deletions(-)
(quoted diff) +0 -0

b/drivers/net/xilinx_ll_temac.c index 72a1632..a72e072 100644

drivers/net/xilinx_ll_temac.c +3 -5
@@ -225,24 +225,21 @@ static void read_phy_reg (struct eth_device *dev,
 int phy_addr)
 #endif
 
 static int phy_addr = -1;
-static int link;
+static int link = 0;
 
 /* setting ll_temac and phy to proper setting */
 static int xps_ll_temac_phy_ctrl(struct eth_device *dev)
 {
-       int i;
+       int i, retries;
       unsigned int result;
-       unsigned retries = 10;
 
+        /* link is setup */
       if (link == 1)
-               return 1; /* link is setup */
-

drivers/net/xilinx_ll_temac.c static void read_phy_reg (struct eth_device *dev, · line 244

Quoted 10 lines
drivers/net/xilinx_ll_temac.c +3 -4
-       /* wait for link up */
-       while (retries-- &&
-               ((xps_ll_temac_hostif_get(dev, 0, phy_addr, 1) & 0x24) ==
 0x24))
-               ;
+               return 1;
 
+       /* try out if have ever found the right phy? */
       if (phy_addr == -1) {
+               printf("Looking for phy ... ");

use puts instead.

drivers/net/xilinx_ll_temac.c static int xps_ll_temac_phy_ctrl(struct eth_device · line 255

Quoted 12 lines
drivers/net/xilinx_ll_temac.c +0 -0
               for (i = 31; i >= 0; i--) {
                       result = xps_ll_temac_hostif_get(dev, 0, i, 1);
                       if ((result & 0x0ffff) != 0x0ffff) {
drivers/net/xilinx_ll_temac.c +4 -0
@@ -251,7 +248,27 @@ static int xps_ll_temac_phy_ctrl(struct eth_device
 *dev)
                               break;
                       }
               }
+
+               /* no success? -- wery bad */
+               if (phy_addr == -1) {
+                       printf("ERROR\n");

same here

drivers/net/xilinx_ll_temac.c static int xps_ll_temac_phy_ctrl(struct eth_device *dev) · line 261

Quoted 7 lines
drivers/net/xilinx_ll_temac.c +7 -0
+                       return -1;
+               }
+               printf("OK\n");
+       }
+
+       /* wait for link up */
+       printf("Waiting for link ... ");

and here.

drivers/net/xilinx_ll_temac.c static int xps_ll_temac_phy_ctrl(struct eth_device *dev) · line 268

Quoted 8 lines
drivers/net/xilinx_ll_temac.c +7 -0
+       retries = 10;
+       while (retries-- &&
+               ((xps_ll_temac_hostif_get(dev, 0, phy_addr, 1) & 0x24) !=
 0x24))
+               ;
+
+       if (retries < 0) {
+               printf("ERROR\n");

and here

drivers/net/xilinx_ll_temac.c static int xps_ll_temac_phy_ctrl(struct eth_device *dev) · line 271

Quoted 3 lines
drivers/net/xilinx_ll_temac.c +2 -0
+               return 0;
       }
+       printf("OK\n");

and here.

Quoted 29 lines
drivers/net/xilinx_ll_temac.c +0 -0
       /* get PHY id */
       i = (xps_ll_temac_hostif_get(dev, 0, phy_addr, 2) << 16) | \
drivers/net/xilinx_ll_temac.c +7 -3
@@ -491,7 +508,6 @@ static int ll_temac_init(struct eth_device *dev, bd_t
 *bis)
 #endif
       if (!first)
               return 0;
-       first = 0;
 
       xps_ll_temac_init(dev, bis);
@@ -502,7 +518,13 @@ static int ll_temac_init(struct eth_device *dev,
 bd_t *bis)
       for (i = 0; i < 32; i++)
               read_phy_reg(dev, i);
 #endif
-       xps_ll_temac_phy_ctrl(dev);
+
+       if (xps_ll_temac_phy_ctrl(dev) == 0) {
+               xps_ll_temac_halt(dev);
+               return -1;
+       }
+
+       first = 0;
       return 1;
 }
 
--

1.6.0.4

Signature · 9 lines
Viele Gr??e,
Stephan Linz
______________________________________________________________________________
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
CDK4AVR: http://cdk4avr.sourceforge.net/
CDK4NIOS: http://cdk4nios.sourceforge.net/
CDK4MSP: http://cdk4msp.sourceforge.net/
CPM4L: http://download.opensuse.org/repositories/home:/rexut:/CPM4L
#6 lore raw

[U-Boot] corrections for LL TEMAC bug fixing

In reply to Stephan Linz

Hi Michal,

as announced here is the correction for the LL TEMAC bugfixing. I've changed all printf() to puts(). Moreover I've corrected the wrong result code (-1) if we can't found a real phy -- my mistake ;-).

Please use the new patch for your tests on real hw.

Best regards,
Stephan Linz

#7 lore raw

PATCH v2 1/1 net: fix some bugs in LL TEMAC driver

* avoid using link variable uninitialized
* avoid using phy_addr variable with invalid value
* reorganize phy control: first looking for phy than link
* return with error (result value 0) if no phy/link was found
* fix boolean mistake in wait for link: wait as long as we got

    phy register 1 has no link indication (BMSR != 0x24)

* expand the 'first run' flag handling in ll_temac_init() in respect to possible error detection in xps_ll_temac_phy_ctrl()

---
 drivers/net/xilinx_ll_temac.c |   52 ++++++++++++++++++++++++++++++-----------
 1 files changed, 38 insertions(+), 14 deletions(-)
drivers/net/xilinx_ll_temac.c +38 -14
index 72a1632..ff93c1f 100644
@@ -225,24 +225,21 @@ static void read_phy_reg (struct eth_device *dev, int phy_addr)
 #endif
 
 static int phy_addr = -1;
-static int link;
+static int link = 0;
 
 /* setting ll_temac and phy to proper setting */
 static int xps_ll_temac_phy_ctrl(struct eth_device *dev)
 {
-	int i;
+	int i, retries;
 	unsigned int result;
-	unsigned retries = 10;
 
+	 /* link is setup */
 	if (link == 1)
-		return 1; /* link is setup */
-
-	/* wait for link up */
-	while (retries-- &&
-		((xps_ll_temac_hostif_get(dev, 0, phy_addr, 1) & 0x24) == 0x24))
-		;
+		return 1;
 
+	/* try out if have ever found the right phy? */
 	if (phy_addr == -1) {
+		puts("Looking for phy ... ");
 		for (i = 31; i >= 0; i--) {
 			result = xps_ll_temac_hostif_get(dev, 0, i, 1);
 			if ((result & 0x0ffff) != 0x0ffff) {
@@ -251,7 +248,27 @@ static int xps_ll_temac_phy_ctrl(struct eth_device *dev)
 				break;
 			}
 		}
+
+		/* no success? -- wery bad */
+		if (phy_addr == -1) {
+			puts("ERROR\n");
+			return 0;
+		}
+		puts("OK\n");
+	}
+
+	/* wait for link up */
+	puts("Waiting for link ... ");
+	retries = 10;
+	while (retries-- &&
+		((xps_ll_temac_hostif_get(dev, 0, phy_addr, 1) & 0x24) != 0x24))
+		;
+
+	if (retries < 0) {
+		puts("ERROR\n");
+		return 0;
 	}
+	puts("OK\n");
 
 	/* get PHY id */
 	i = (xps_ll_temac_hostif_get(dev, 0, phy_addr, 2) << 16) | \
@@ -275,19 +292,21 @@ static int xps_ll_temac_phy_ctrl(struct eth_device *dev)
 		result = xps_ll_temac_hostif_get(dev, 0, phy_addr, 5);
 		if ((result & 0x8000) == 0x8000) {
 			xps_ll_temac_indirect_set(dev, 0, EMMC, 0x80000000);
-			printf("1000BASE-T/FD\n");
+			puts("1000BASE-T/FD\n");
 			link = 1;
 		} else if ((result & 0x4000) == 0x4000) {
 			xps_ll_temac_indirect_set(dev, 0, EMMC, 0x40000000);
-			printf("100BASE-T/FD\n");
+			puts("100BASE-T/FD\n");
 			link = 1;
 		} else {
-			printf("Unsupported mode\n");
+			puts("Unsupported mode\n");
 			link = 0;
 			return 0;
 		}
 		return 1;
 	}
+
+	puts("Unsupported PHY\n");
 	return 0;
 }
 
@@ -491,7 +510,6 @@ static int ll_temac_init(struct eth_device *dev, bd_t *bis)
 #endif
 	if (!first)
 		return 0;
-	first = 0;
 
 	xps_ll_temac_init(dev, bis);
 
@@ -502,7 +520,13 @@ static int ll_temac_init(struct eth_device *dev, bd_t *bis)
 	for (i = 0; i < 32; i++)
 		read_phy_reg(dev, i);
 #endif
-	xps_ll_temac_phy_ctrl(dev);
+
+	if (xps_ll_temac_phy_ctrl(dev) == 0) {
+		xps_ll_temac_halt(dev);
+		return -1;
+	}
+
+	first = 0;
 	return 1;
 }
 
Signature · 1 line
1.6.0.4
#8 lore raw

PATCH v2 1/1 net: fix some bugs in LL TEMAC driver

Dear Stephan Linz,

Quoted 5 lines · In message <[email protected]> you wrote:

* avoid using link variable uninitialized
* avoid using phy_addr variable with invalid value
* reorganize phy control: first looking for phy than link
* return with error (result value 0) if no phy/link was found
* fix boolean mistake in wait for link: wait as long as we got

Quoted 8 lines
    phy register 1 has no link indication (BMSR != 0x24)

* expand the 'first run' flag handling in ll_temac_init() in respect to possible error detection in xps_ll_temac_phy_ctrl()

---
 drivers/net/xilinx_ll_temac.c |   52 ++++++++++++++++++++++++++++++-----------
 1 files changed, 38 insertions(+), 14 deletions(-)

Please merges these fixzes into the next submission of the LL TEMAC driver.

Thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
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
A committee is a life form with six or more legs and no brain.
                              -- Lazarus Long, "Time Enough For Love"
#9 lore raw

PATCH v2 1/1 net: fix some bugs in LL TEMAC driver

Am Sonntag, 28. November 2010, um 21:35:58 schrieb Wolfgang Denk:

Quoted 1 line

Dear Stephan Linz,

Hello Wolfgang Denk,

Quoted 11 lines
Quoted 9 lines · In message <[email protected]> you wrote:

* avoid using link variable uninitialized
* avoid using phy_addr variable with invalid value
* reorganize phy control: first looking for phy than link
* return with error (result value 0) if no phy/link was found
* fix boolean mistake in wait for link: wait as long as we got

    phy register 1 has no link indication (BMSR != 0x24)

* expand the 'first run' flag handling in ll_temac_init() in respect to possible error detection in xps_ll_temac_phy_ctrl()

Quoted 8 lines
Quoted 5 lines
---
 drivers/net/xilinx_ll_temac.c |   52

++++++++++++++++++++++++++++++----------- 1 files changed, 38 insertions(+), 14 deletions(-)

Please merges these fixzes into the next submission of the LL TEMAC driver.

Sure, I will maintain this patchset until I get Michal's ACK and/or he will merge the corrections into the next LL TEMAC driver submission. I'm in contact with him.

Best regards,
Stephan Linz

#10 lore raw

PATCH v2 1/1 net: fix some bugs in LL TEMAC driver

In reply to Stephan Linz
Quoted 19 lines · Stephan Linz

* avoid using link variable uninitialized
* avoid using phy_addr variable with invalid value
* reorganize phy control: first looking for phy than link
* return with error (result value 0) if no phy/link was found
* fix boolean mistake in wait for link: wait as long as we got

    phy register 1 has no link indication (BMSR != 0x24)

* expand the 'first run' flag handling in ll_temac_init() in respect to possible error detection in xps_ll_temac_phy_ctrl()

---
 drivers/net/xilinx_ll_temac.c |   52 ++++++++++++++++++++++++++++++-----------
 1 files changed, 38 insertions(+), 14 deletions(-)
drivers/net/xilinx_ll_temac.c +0 -0
index 72a1632..ff93c1f 100644

drivers/net/xilinx_ll_temac.c static void read_phy_reg (struct eth_device *dev, int phy_addr) · line 228

Quoted 5 lines
drivers/net/xilinx_ll_temac.c +1 -1
@@ -225,24 +225,21 @@ static void read_phy_reg (struct eth_device *dev, int phy_addr)
 #endif
 
 static int phy_addr = -1;
-static int link;
+static int link = 0;

Static variables are always initialized to 0. I fixed this in your patch.

Added to microblaze custodian repository.

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian