public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 6/9] AVR32: macb - Search for PHY id
Date: Thu, 29 Jan 2009 00:27:46 -0800	[thread overview]
Message-ID: <49816882.1080807@gmail.com> (raw)
In-Reply-To: <90cf8dc35c3d1df4f7ab0c0fbdac2f3fa14df761.1232710611.git.gunnar@rangoy.com>

Gunnar Rangoy wrote:
> This patch adds support for searching through available PHY-addresses in
> the macb-driver. This is needed for the ATEVK1100 evaluation board,
> where the PHY-address will be initialized to either 1 or 7.
>
> This patch adds a config option, CONFIG_MACB_SEARCH_PHY, which when
> enabled tells the driver to search for the PHY address.
>
> Signed-off-by: Gunnar Rangoy <gunnar@rangoy.com>
> Signed-off-by: Paul Driveklepp <pauldriveklepp@gmail.com>
> Signed-off-by: Olav Morken <olavmrk@gmail.com>
> ---
>  drivers/net/macb.c |   31 +++++++++++++++++++++++++++++++
>  1 files changed, 31 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index d47a052..c8beb82 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -327,6 +327,30 @@ static void macb_phy_reset(struct macb_device *macb)
>  		       netdev->name, status);
>  }
>  
> +#ifdef CONFIG_MACB_SEARCH_PHY
> +static int macb_phy_find(struct macb_device *macb)
> +{
> +	int i;
> +	u16 phy_id;
> +
> +	/* Search for PHY... */
> +	for (i = 0; i < 32; i++) {
> +		macb->phy_addr = i;
> +		phy_id = macb_mdio_read(macb, MII_PHYSID1);
> +		if (phy_id != 0xffff) {
> +			printf("%s: PHY present at %d\n", macb->netdev.name, i);
> +			return 1;
> +		}
> +	}
> +
> +	/* PHY isn't up to snuff */
> +	printf("%s: PHY not found", macb->netdev.name);
> +
> +	return 0;
> +}
> +#endif /* CONFIG_MACB_SEARCH_PHY */
> +
> +
>  static int macb_phy_init(struct macb_device *macb)
>  {
>  	struct eth_device *netdev = &macb->netdev;
> @@ -335,6 +359,13 @@ static int macb_phy_init(struct macb_device *macb)
>  	int media, speed, duplex;
>  	int i;
>  
> +#ifdef CONFIG_MACB_SEARCH_PHY
> +	/* Auto-detect phy_addr */
> +	if (!macb_phy_find(macb)) {
> +		return 0;
> +	}
> +#endif /* CONFIG_MACB_SEARCH_PHY */
> +
>  	/* Check if the PHY is up to snuff... */
>  	phy_id = macb_mdio_read(macb, MII_PHYSID1);
>  	if (phy_id == 0xffff) {
>   
Added to net repo.

thanks,
Ben

  parent reply	other threads:[~2009-01-29  8:27 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-23 11:56 [U-Boot] [PATCH v2 0/9] Support for ATEVK1100 evaluation board Gunnar Rangoy
2009-01-23 11:56 ` [U-Boot] [PATCH v2 1/9] Fix IP alignement problem Gunnar Rangoy
2009-01-23 11:56   ` [U-Boot] [PATCH v2 2/9] AVR32: Make cacheflush cpu-dependent Gunnar Rangoy
2009-01-23 11:56     ` [U-Boot] [PATCH v2 3/9] AVR32: Move addrspace.h to arch-directory, and move some functions from io.h to addrspace.h Gunnar Rangoy
2009-01-23 11:56       ` [U-Boot] [PATCH v2 4/9] AVR32: Make GPIO implmentation cpu dependent Gunnar Rangoy
2009-01-23 11:56         ` [U-Boot] [PATCH v2 5/9] AVR32: macb - Disable 100mbps if clock is slow Gunnar Rangoy
2009-01-23 11:56           ` [U-Boot] [PATCH v2 6/9] AVR32: macb - Search for PHY id Gunnar Rangoy
2009-01-23 11:56             ` [U-Boot] [PATCH v2 7/9] AVR32: Must add NOPs after disabling interrupts for AT32UC3A0512ES Gunnar Rangoy
2009-01-23 11:56               ` [U-Boot] [PATCH v2 8/9] AVR32: CPU support for AT32UC3A0xxx CPUs Gunnar Rangoy
2009-01-23 11:56                 ` [U-Boot] [PATCH v2 9/9] AVR32: Board support for ATEVK1100 Gunnar Rangoy
2009-01-23 15:37                   ` Wolfgang Denk
2009-01-26 14:35                     ` Gunnar Rangøy
2009-01-26 19:50                       ` Wolfgang Denk
2009-01-27 11:59                         ` Gunnar Rangøy
2009-01-23 16:00                 ` [U-Boot] [PATCH v2 8/9] AVR32: CPU support for AT32UC3A0xxx CPUs Wolfgang Denk
2009-01-26 15:26                   ` Gunnar Rangøy
2009-01-26 20:03                     ` Wolfgang Denk
2009-01-29 11:32                       ` Olav Morken
2009-01-29 12:05                         ` Haavard Skinnemoen
2009-02-23 10:04               ` [U-Boot] [PATCH v2 7/9] AVR32: Must add NOPs after disabling interrupts for AT32UC3A0512ES Haavard Skinnemoen
2009-01-29  8:27             ` Ben Warren [this message]
2009-01-29 11:39               ` [U-Boot] [PATCH v2 6/9] AVR32: macb - Search for PHY id Olav Morken
2009-01-29 18:03                 ` Ben Warren
2009-01-23 15:38           ` [U-Boot] [PATCH v2 5/9] AVR32: macb - Disable 100mbps if clock is slow Jean-Christophe PLAGNIOL-VILLARD
2009-01-26 14:15             ` Gunnar Rangøy
2009-01-28  6:13               ` Ben Warren
2009-01-28 17:23               ` Jean-Christophe PLAGNIOL-VILLARD
2009-01-28 21:42                 ` Haavard Skinnemoen
2009-01-28 23:13                   ` Jean-Christophe PLAGNIOL-VILLARD
2009-01-28 23:40                     ` Ben Warren
2009-01-28 23:34                       ` Jean-Christophe PLAGNIOL-VILLARD
2009-01-29  6:28                       ` Hans-Christian Egtvedt
2009-01-29 10:06                         ` Olav Morken
2009-01-29 10:17                           ` Haavard Skinnemoen
2009-01-29  9:45                       ` Haavard Skinnemoen
2009-02-23 10:04         ` [U-Boot] [PATCH v2 4/9] AVR32: Make GPIO implmentation cpu dependent Haavard Skinnemoen
2009-02-23 10:04       ` [U-Boot] [PATCH v2 3/9] AVR32: Move addrspace.h to arch-directory, and move some functions from io.h to addrspace.h Haavard Skinnemoen
2009-02-23 10:03     ` [U-Boot] [PATCH v2 2/9] AVR32: Make cacheflush cpu-dependent Haavard Skinnemoen
2009-01-28  6:22   ` [U-Boot] [PATCH v2 1/9] Fix IP alignement problem Ben Warren
2009-01-29  8:26   ` Ben Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49816882.1080807@gmail.com \
    --to=biggerbadderben@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox