From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 06/10] AVR32: macb - Search for PHY id
Date: Thu, 16 Oct 2008 23:01:01 -0700 [thread overview]
Message-ID: <48F82A1D.6060509@gmail.com> (raw)
In-Reply-To: <18376c3cf23d5128e150674daf36a3e680caf4cc.1223643536.git.olavmrk@gmail.com>
Olav Morken 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.
>
> 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 | 28 ++++++++++++++++++++++++++++
> 1 files changed, 28 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index 4fef374..561669b 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -338,6 +338,27 @@ static void macb_phy_reset(struct macb_device *macb)
> netdev->name, status);
> }
>
> +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;
> +}
> +
> static int macb_phy_init(struct macb_device *macb)
> {
> struct eth_device *netdev = &macb->netdev;
> @@ -346,6 +367,13 @@ static int macb_phy_init(struct macb_device *macb)
> int media, speed, duplex;
> int i;
>
> + if (macb->phy_addr == 0xff) {
> + /* Auto-detect phy_addr */
> + if (!macb_phy_find(macb)) {
> + return 0;
> + }
> + }
> +
> /* Check if the PHY is up to snuff... */
> phy_id = macb_mdio_read(macb, MII_PHYSID1);
> if (phy_id == 0xffff) {
>
Applied to net/testing.
regards,
Ben
next prev parent reply other threads:[~2008-10-17 6:01 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-10 13:15 [U-Boot] [PATCH 00/10] AVR32: RFC/preview - support for ATEVK1100 evaluation board Olav Morken
2008-10-10 13:15 ` [U-Boot] [PATCH 01/10] Fix IP alignement problem Olav Morken
2008-10-10 14:42 ` Haavard Skinnemoen
2008-10-10 17:01 ` Ben Warren
2008-10-10 18:56 ` Olav Morken
2008-10-10 19:13 ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-10 19:52 ` Olav Morken
[not found] ` <3b41dc450810101153h73bb0ec4s424ebbc39564e92d@mail.gmail.com>
2008-10-15 5:07 ` Ben Warren
2008-10-15 15:11 ` Olav Morken
2008-10-17 10:47 ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-17 11:24 ` Olav Morken
2008-10-17 6:00 ` Ben Warren
2008-10-10 13:15 ` [U-Boot] [PATCH 02/10] AVR32: atmel_usart - Make sure that all interrupts are disabled during startup Olav Morken
2008-10-10 13:15 ` [U-Boot] [PATCH 03/10] AVR32: Make cacheflush cpu-dependent Olav Morken
2008-11-18 23:44 ` Wolfgang Denk
2008-10-10 13:15 ` [U-Boot] [PATCH 04/10] AVR32: Move addrspace.h to arch-directory, and move some functions from io.h to addrspace.h Olav Morken
2008-11-18 23:45 ` Wolfgang Denk
2008-10-10 13:15 ` [U-Boot] [PATCH 05/10] AVR32: macb - Disable 100mbps if clock is slow Olav Morken
2008-10-17 6:00 ` Ben Warren
2008-11-18 23:49 ` Wolfgang Denk
2008-11-18 23:48 ` Wolfgang Denk
2008-10-10 13:15 ` [U-Boot] [PATCH 06/10] AVR32: macb - Search for PHY id Olav Morken
2008-10-17 6:01 ` Ben Warren [this message]
2008-10-10 13:15 ` [U-Boot] [PATCH 07/10] AVR32: Disable relocation of command table when on AT32UC3A for now Olav Morken
2008-11-18 23:51 ` Wolfgang Denk
2008-11-19 13:07 ` Haavard Skinnemoen
2008-10-10 13:15 ` [U-Boot] [PATCH 08/10] AVR32: Must add NOPs after disabling interrupts for AT32UC3A0512ES Olav Morken
2008-10-10 13:15 ` [U-Boot] [PATCH 09/10] AVR32: CPU support for AT32UC3A0xxx CPUs Olav Morken
2008-10-17 6:01 ` Ben Warren
2008-10-17 9:05 ` Wolfgang Denk
2008-10-17 16:47 ` Ben Warren
2008-10-18 11:32 ` Haavard Skinnemoen
2008-10-19 2:44 ` Ben Warren
2008-10-23 12:52 ` Haavard Skinnemoen
2008-10-28 6:57 ` Ben Warren
2008-11-18 23:59 ` Wolfgang Denk
2008-11-19 13:44 ` Haavard Skinnemoen
2008-11-19 14:06 ` Haavard Skinnemoen
2008-10-10 13:15 ` [U-Boot] [PATCH 10/10] AVR32: Board support for ATEVK1100 Olav Morken
2008-11-19 0:02 ` Wolfgang Denk
2008-11-19 15:09 ` [U-Boot] [PATCH 00/10] AVR32: RFC/preview - support for ATEVK1100 evaluation board Haavard Skinnemoen
2008-11-19 15:35 ` Wolfgang Denk
2008-11-19 15:50 ` Haavard Skinnemoen
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=48F82A1D.6060509@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