Skip to contentSkip to conversation

PATCH macb fix phy address

U-Boot Giulio Benetti 3 participants 7 messages Nov 12, 2008 Network drivers

lore
Share & tools
lore
#0 lore raw

- Fixed finding phyter address
- Added searching for other addresses if not found

diff -urpN -X macb-exclude u-boot.orig/drivers/net/macb.c u-boot/drivers/net/macb.c

drivers/net/macb.c +16 -2
@@ -1,5 +1,7 @@
 /*
  * Copyright (C) 2005-2006 Atmel Corporation
+ * Giulio Benetti <[email protected]>
+ * Micronova srl <[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -84,6 +86,8 @@ struct macb_dma_desc {
 #define TXBUF_WRAP		0x40000000
 #define TXBUF_USED		0x80000000
 
+#define MAX_PHY_ADDRESS_NUMBER	32
+
 struct macb_device {
 	void			*regs;
 
@@ -325,8 +329,18 @@ static int macb_phy_init(struct macb_dev
 	int i;
 
 	/* Check if the PHY is up to snuff... */
-	phy_id = macb_mdio_read(macb, MII_PHYSID1);
-	if (phy_id == 0xffff) {
+	printf("%s: Finding PHYs\n", netdev->name);
+
+	for(i = 0; i < MAX_PHY_ADDRESS_NUMBER; i++) {
+		lpa = macb_mdio_read(macb, MII_LPA);
+		phy_id = macb_mdio_read(macb, MII_PHYSID1);
+		if ((phy_id != 0xffff) && (lpa != 0xffff)) {
+			break;
+		}
+		macb->phy_addr++;
+	}
+
+	if(i >= MAX_PHY_ADDRESS_NUMBER) {
 		printf("%s: No PHY present\n", netdev->name);
 		return 0;
 	}
#1 lore raw

Hi,

In the past I think the same thing but:

Quoted 46 lines · Giulio Benetti

- Fixed finding phyter address
- Added searching for other addresses if not found

diff -urpN -X macb-exclude u-boot.orig/drivers/net/macb.c u-boot/drivers/net/macb.c

drivers/net/macb.c +16 -2
@@ -1,5 +1,7 @@
 /*
  * Copyright (C) 2005-2006 Atmel Corporation
+ * Giulio Benetti <[email protected]>
+ * Micronova srl <[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -84,6 +86,8 @@ struct macb_dma_desc {
 #define TXBUF_WRAP		0x40000000
 #define TXBUF_USED		0x80000000
 
+#define MAX_PHY_ADDRESS_NUMBER	32
+
 struct macb_device {
 	void			*regs;
 
@@ -325,8 +329,18 @@ static int macb_phy_init(struct macb_dev
 	int i;
 
 	/* Check if the PHY is up to snuff... */
-	phy_id = macb_mdio_read(macb, MII_PHYSID1);
-	if (phy_id == 0xffff) {
+	printf("%s: Finding PHYs\n", netdev->name);
+
+	for(i = 0; i < MAX_PHY_ADDRESS_NUMBER; i++) {
+		lpa = macb_mdio_read(macb, MII_LPA);
+		phy_id = macb_mdio_read(macb, MII_PHYSID1);
+		if ((phy_id != 0xffff) && (lpa != 0xffff)) {
+			break;
+		}
+		macb->phy_addr++;
+	}
+
+	if(i >= MAX_PHY_ADDRESS_NUMBER) {
 		printf("%s: No PHY present\n", netdev->name);
 		return 0;
 	}
Quoted 2 lines

mii info

report that information. ex (take in a past mail)
PHY 0x10: OUI = 0x5043, Model = 0x08, Rev = 0x07, 10baseT, HDX PHY 0x11: OUI = 0x5043, Model = 0x08, Rev = 0x07, 10baseT, HDX PHY 0x12: OUI = 0x5043, Model = 0x08, Rev = 0x07, 10baseT, HDX PHY 0x13: OUI = 0x5043, Model = 0x08, Rev = 0x07, 100baseT, FDX PHY 0x14: OUI = 0x5043, Model = 0x08, Rev = 0x07, 10baseT, HDX PHY 0x15: OUI = 0x0000, Model = 0x00, Rev = 0x00, 10baseT, HDX PHY 0x16: OUI = 0x0000, Model = 0x00, Rev = 0x00, 10baseT, HDX

what code autodetect code pick? And if you have ghost PHYs in the list?

Regards Michael

#2 lore raw
In reply to Giulio Benetti

drivers/net/macb.c line 4

Quoted 12 lines · Giulio Benetti

- Fixed finding phyter address
- Added searching for other addresses if not found

diff -urpN -X macb-exclude u-boot.orig/drivers/net/macb.c u-boot/drivers/net/macb.c

drivers/net/macb.c +2 -0
@@ -1,5 +1,7 @@
 /*
  * Copyright (C) 2005-2006 Atmel Corporation
+ * Giulio Benetti <[email protected]>
+ * Micronova srl <[email protected]>

please remove, you do not do enough modification to add your copyright

Quoted 20 lines
drivers/net/macb.c +4 -2
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -84,6 +86,8 @@ struct macb_dma_desc {
 #define TXBUF_WRAP		0x40000000
 #define TXBUF_USED		0x80000000
 
+#define MAX_PHY_ADDRESS_NUMBER	32
+
 struct macb_device {
 	void			*regs;
 
@@ -325,8 +329,18 @@ static int macb_phy_init(struct macb_dev
 	int i;
 
 	/* Check if the PHY is up to snuff... */
-	phy_id = macb_mdio_read(macb, MII_PHYSID1);
-	if (phy_id == 0xffff) {
+	printf("%s: Finding PHYs\n", netdev->name);
+

drivers/net/macb.c static int macb_phy_init(struct macb_dev · line 343

Quoted 10 lines
drivers/net/macb.c +10 -0
+	for(i = 0; i < MAX_PHY_ADDRESS_NUMBER; i++) {
+		lpa = macb_mdio_read(macb, MII_LPA);
+		phy_id = macb_mdio_read(macb, MII_PHYSID1);
+		if ((phy_id != 0xffff) && (lpa != 0xffff)) {
+			break;
+		}
+		macb->phy_addr++;
+	}
+
+	if(i >= MAX_PHY_ADDRESS_NUMBER) {

please make this as an option

Quoted 6 lines
drivers/net/macb.c +0 -0
 		printf("%s: No PHY present\n", netdev->name);
 		return 0;
 	}

please move to the comment

Best Regards,
J.

#3 lore raw

Il Wednesday 12 November 2008 15:42:34 Jean-Christophe PLAGNIOL-VILLARD ha scritto:

Quoted 15 lines · Giulio Benetti

drivers/net/macb.c line 4

Quoted 12 lines

- Fixed finding phyter address
- Added searching for other addresses if not found

diff -urpN -X macb-exclude u-boot.orig/drivers/net/macb.c u-boot/drivers/net/macb.c

drivers/net/macb.c +2 -0
@@ -1,5 +1,7 @@
 /*
  * Copyright (C) 2005-2006 Atmel Corporation
+ * Giulio Benetti <[email protected]>
+ * Micronova srl <[email protected]>

please remove, you do not do enough modification to add your copyright

Ok

Quoted 25 lines
Quoted 25 lines
drivers/net/macb.c +8 -2
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -84,6 +86,8 @@ struct macb_dma_desc {
 #define TXBUF_WRAP		0x40000000
 #define TXBUF_USED		0x80000000
 
+#define MAX_PHY_ADDRESS_NUMBER	32
+
 struct macb_device {
 	void			*regs;
 
@@ -325,8 +329,18 @@ static int macb_phy_init(struct macb_dev
 	int i;
 
 	/* Check if the PHY is up to snuff... */
-	phy_id = macb_mdio_read(macb, MII_PHYSID1);
-	if (phy_id == 0xffff) {
+	printf("%s: Finding PHYs\n", netdev->name);
+
+	for(i = 0; i < MAX_PHY_ADDRESS_NUMBER; i++) {
+		lpa = macb_mdio_read(macb, MII_LPA);
+		phy_id = macb_mdio_read(macb, MII_PHYSID1);
+		if ((phy_id != 0xffff) && (lpa != 0xffff)) {
Quoted 8 lines

drivers/net/macb.c static int macb_phy_init(struct macb_dev · line 343

Quoted 6 lines
drivers/net/macb.c +6 -0
+			break;
+		}
+		macb->phy_addr++;
+	}
+
+	if(i >= MAX_PHY_ADDRESS_NUMBER) {

please make this as an option

Ok, but I think that there's a bug (phy_id != 0xffff) should be (phy_id != 0x0000), i've just controlled.

Quoted 8 lines
Quoted 6 lines
drivers/net/macb.c +0 -0
 		printf("%s: No PHY present\n", netdev->name);
 		return 0;
 	}

please move to the comment

Ok

Quoted 3 lines

Best Regards,
J.

As soon as possible I send you new patch

#4 lore raw
In reply to Jean-Christophe PLAGNIOL-VILLARD

Hi,

Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 4 lines
Quoted 9 lines

please move to the comment

Best Regards,
J.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Is there another patch on testing for the avr32?

Re: [U-Boot] [PATCH 06/10] AVR32: macb - Search for PHY id

Regards Michael

#5 lore raw
Quoted 17 lines · michael

Hi,

Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 4 lines
Quoted 9 lines

please move to the comment

Best Regards,
J.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Quoted 3 lines

Is there another patch on testing for the avr32?

Re: [U-Boot] [PATCH 06/10] AVR32: macb - Search for PHY id

I still not like to increase u-boot size I steel.
I must be an option

Best Regards,
J.

#6 lore raw

Il Wednesday 12 November 2008 16:43:46 Jean-Christophe PLAGNIOL-VILLARD ha scritto:

Quoted 17 lines · michael
Quoted 16 lines

Hi,

Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line

please move to the comment

Best Regards,
J.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Is there another patch on testing for the avr32?

Quoted 7 lines
Quoted 1 line

Re: [U-Boot] [PATCH 06/10] AVR32: macb - Search for PHY id

I still not like to increase u-boot size I steel.
I must be an option

Best Regards,
J.

But it compiles with macb.c that is the same for AT91SAMx and AVR32.