- 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 <[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;
        }

Signed-off-by: Giulio Benetti <[EMAIL PROTECTED]>

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to