All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] PATCH macb fix phy address
@ 2008-11-12 12:01 Giulio Benetti
  2008-11-12 12:27 ` michael
  2008-11-12 14:42 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 7+ messages in thread
From: Giulio Benetti @ 2008-11-12 12:01 UTC (permalink / raw)
  To: u-boot

- 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
--- u-boot.orig/drivers/net/macb.c	2008-08-12 16:08:38.000000000 +0200
+++ u-boot/drivers/net/macb.c	2008-11-12 12:51:16.000000000 +0100
@@ -1,5 +1,7 @@
 /*
  * Copyright (C) 2005-2006 Atmel Corporation
+ * Giulio Benetti <giulio.benetti@micronovasrl.com>
+ * Micronova srl <info@micronovasrl.com>
  *
  * 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;
 	}

Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>

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

* [U-Boot] PATCH macb fix phy address
  2008-11-12 12:01 [U-Boot] PATCH macb fix phy address Giulio Benetti
@ 2008-11-12 12:27 ` michael
  2008-11-12 14:42 ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 7+ messages in thread
From: michael @ 2008-11-12 12:27 UTC (permalink / raw)
  To: u-boot

Hi,

In the past I think the same thing but:

Giulio Benetti wrote:
> - 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
> --- u-boot.orig/drivers/net/macb.c	2008-08-12 16:08:38.000000000 +0200
> +++ u-boot/drivers/net/macb.c	2008-11-12 12:51:16.000000000 +0100
> @@ -1,5 +1,7 @@
>  /*
>   * Copyright (C) 2005-2006 Atmel Corporation
> + * Giulio Benetti <giulio.benetti@micronovasrl.com>
> + * Micronova srl <info@micronovasrl.com>
>   *
>   * 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;
>  	}
>
> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
>   
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

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

* [U-Boot] PATCH macb fix phy address
  2008-11-12 12:01 [U-Boot] PATCH macb fix phy address Giulio Benetti
  2008-11-12 12:27 ` michael
@ 2008-11-12 14:42 ` Jean-Christophe PLAGNIOL-VILLARD
  2008-11-12 15:04   ` Giulio Benetti
  2008-11-12 15:32   ` michael
  1 sibling, 2 replies; 7+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-11-12 14:42 UTC (permalink / raw)
  To: u-boot

On 13:01 Wed 12 Nov     , Giulio Benetti wrote:
> - 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
> --- u-boot.orig/drivers/net/macb.c	2008-08-12 16:08:38.000000000 +0200
> +++ u-boot/drivers/net/macb.c	2008-11-12 12:51:16.000000000 +0100
> @@ -1,5 +1,7 @@
>  /*
>   * Copyright (C) 2005-2006 Atmel Corporation
> + * Giulio Benetti <giulio.benetti@micronovasrl.com>
> + * Micronova srl <info@micronovasrl.com>
please remove, you do not do enough modification to add your copyright
>   *
>   * 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) {

please make this as an option
>  		printf("%s: No PHY present\n", netdev->name);
>  		return 0;
>  	}
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
> 
please move to the comment

Best Regards,
J.

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

* [U-Boot] PATCH macb fix phy address
  2008-11-12 14:42 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2008-11-12 15:04   ` Giulio Benetti
  2008-11-12 15:32   ` michael
  1 sibling, 0 replies; 7+ messages in thread
From: Giulio Benetti @ 2008-11-12 15:04 UTC (permalink / raw)
  To: u-boot

Il Wednesday 12 November 2008 15:42:34 Jean-Christophe PLAGNIOL-VILLARD ha 
scritto:
> On 13:01 Wed 12 Nov     , Giulio Benetti wrote:
> > - 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
> > --- u-boot.orig/drivers/net/macb.c	2008-08-12 16:08:38.000000000 +0200
> > +++ u-boot/drivers/net/macb.c	2008-11-12 12:51:16.000000000 +0100
> > @@ -1,5 +1,7 @@
> >  /*
> >   * Copyright (C) 2005-2006 Atmel Corporation
> > + * Giulio Benetti <giulio.benetti@micronovasrl.com>
> > + * Micronova srl <info@micronovasrl.com>
>
> please remove, you do not do enough modification to add your copyright

Ok

>
> >   *
> >   * 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) {
>
> 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.

>
> >  		printf("%s: No PHY present\n", netdev->name);
> >  		return 0;
> >  	}
> >
> > Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
>
> please move to the comment

Ok

>
> Best Regards,
> J.

As soon as possible I send you new patch

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

* [U-Boot] PATCH macb fix phy address
  2008-11-12 14:42 ` Jean-Christophe PLAGNIOL-VILLARD
  2008-11-12 15:04   ` Giulio Benetti
@ 2008-11-12 15:32   ` michael
  2008-11-12 15:43     ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 7+ messages in thread
From: michael @ 2008-11-12 15:32 UTC (permalink / raw)
  To: u-boot

Hi,

Jean-Christophe PLAGNIOL-VILLARD wrote:
>
>>
>> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
>>
> 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

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

* [U-Boot] PATCH macb fix phy address
  2008-11-12 15:32   ` michael
@ 2008-11-12 15:43     ` Jean-Christophe PLAGNIOL-VILLARD
  2008-11-12 15:55       ` Giulio Benetti
  0 siblings, 1 reply; 7+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-11-12 15:43 UTC (permalink / raw)
  To: u-boot

On 16:32 Wed 12 Nov     , michael wrote:
> Hi,
>
> Jean-Christophe PLAGNIOL-VILLARD wrote:
>>
>>>
>>> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
>>>
>> 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
I still not like to increase u-boot size I steel.
I must be an option

Best Regards,
J.

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

* [U-Boot] PATCH macb fix phy address
  2008-11-12 15:43     ` Jean-Christophe PLAGNIOL-VILLARD
@ 2008-11-12 15:55       ` Giulio Benetti
  0 siblings, 0 replies; 7+ messages in thread
From: Giulio Benetti @ 2008-11-12 15:55 UTC (permalink / raw)
  To: u-boot

Il Wednesday 12 November 2008 16:43:46 Jean-Christophe PLAGNIOL-VILLARD ha 
scritto:
> On 16:32 Wed 12 Nov     , michael wrote:
> > Hi,
> >
> > Jean-Christophe PLAGNIOL-VILLARD wrote:
> >>> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
> >>
> >> 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
>
> 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.

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

end of thread, other threads:[~2008-11-12 15:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-12 12:01 [U-Boot] PATCH macb fix phy address Giulio Benetti
2008-11-12 12:27 ` michael
2008-11-12 14:42 ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-12 15:04   ` Giulio Benetti
2008-11-12 15:32   ` michael
2008-11-12 15:43     ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-12 15:55       ` Giulio Benetti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.