]> git.sur5r.net Git - u-boot/blobdiff - arch/arm/cpu/arm926ejs/davinci/lxt972.c
mtd: nand: davinci: add header file for driver definitions
[u-boot] / arch / arm / cpu / arm926ejs / davinci / lxt972.c
index ce3e41c5517f2a94d9b0a993020e2e16ddf491df..c482fd93780247dc500cc975f71b0d764903e189 100644 (file)
@@ -6,23 +6,7 @@
  *
  * --------------------------------------------------------
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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 the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -30,6 +14,7 @@
 #include <miiphy.h>
 #include <lxt971a.h>
 #include <asm/arch/emac_defs.h>
+#include "../../../../../drivers/net/davinci_emac.h"
 
 #ifdef CONFIG_DRIVER_TI_EMAC
 
@@ -39,9 +24,9 @@ int lxt972_is_phy_connected(int phy_addr)
 {
        u_int16_t id1, id2;
 
-       if (!davinci_eth_phy_read(phy_addr, PHY_PHYIDR1, &id1))
+       if (!davinci_eth_phy_read(phy_addr, MII_PHYSID1, &id1))
                return(0);
-       if (!davinci_eth_phy_read(phy_addr, PHY_PHYIDR2, &id2))
+       if (!davinci_eth_phy_read(phy_addr, MII_PHYSID2, &id2))
                return(0);
 
        if ((id1 == (0x0013)) && ((id2  & 0xfff0) == 0x78e0))
@@ -105,19 +90,19 @@ int lxt972_auto_negotiate(int phy_addr)
 {
        u_int16_t tmp;
 
-       if (!davinci_eth_phy_read(phy_addr, PHY_BMCR, &tmp))
+       if (!davinci_eth_phy_read(phy_addr, MII_BMCR, &tmp))
                return(0);
 
        /* Restart Auto_negotiation  */
-       tmp |= PHY_BMCR_RST_NEG;
-       davinci_eth_phy_write(phy_addr, PHY_BMCR, tmp);
+       tmp |= BMCR_ANRESTART;
+       davinci_eth_phy_write(phy_addr, MII_BMCR, tmp);
 
        /*check AutoNegotiate complete */
        udelay (10000);
-       if (!davinci_eth_phy_read(phy_addr, PHY_BMSR, &tmp))
+       if (!davinci_eth_phy_read(phy_addr, MII_BMSR, &tmp))
                return(0);
 
-       if (!(tmp & PHY_BMSR_AUTN_COMP))
+       if (!(tmp & BMSR_ANEGCOMPLETE))
                return(0);
 
        return (lxt972_get_link_speed(phy_addr));