]> Git Repo - u-boot.git/blobdiff - drivers/net/phy/miiphybb.c
common: Drop asm/global_data.h from common header
[u-boot.git] / drivers / net / phy / miiphybb.c
index 5cda0b84692b9a7203fd493d424b6f18fd69cfc5..24d617553e71d160ec3dcf5c31118e05de54aa8f 100644 (file)
@@ -1,11 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2009 Industrie Dial Face S.p.A.
  * Luigi 'Comio' Mantellini <[email protected]>
  *
  * (C) Copyright 2001
  * Gerald Van Baren, Custom IDEAS, [email protected].
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /*
@@ -17,6 +16,7 @@
 #include <ioports.h>
 #include <ppc_asm.tmpl>
 #include <miiphy.h>
+#include <asm/global_data.h>
 
 #define BB_MII_RELOCATE(v,off) (v += (v?off:0))
 
@@ -106,7 +106,7 @@ int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) /
                          sizeof(bb_miiphy_buses[0]);
 #endif
 
-void bb_miiphy_init(void)
+int bb_miiphy_init(void)
 {
        int i;
 
@@ -125,6 +125,8 @@ void bb_miiphy_init(void)
                        bb_miiphy_buses[i].init(&bb_miiphy_buses[i]);
                }
        }
+
+       return 0;
 }
 
 static inline struct bb_miiphy_bus *bb_miiphy_getbus(const char *devname)
@@ -230,24 +232,18 @@ static void miiphy_pre(struct bb_miiphy_bus *bus, char read,
  * Returns:
  *   0 on success
  */
-int bb_miiphy_read(const char *devname, unsigned char addr,
-                  unsigned char reg, unsigned short *value)
+int bb_miiphy_read(struct mii_dev *miidev, int addr, int devad, int reg)
 {
-       short rdreg; /* register working value */
+       unsigned short rdreg; /* register working value */
        int v;
        int j; /* counter */
        struct bb_miiphy_bus *bus;
 
-       bus = bb_miiphy_getbus(devname);
+       bus = bb_miiphy_getbus(miidev->name);
        if (bus == NULL) {
                return -1;
        }
 
-       if (value == NULL) {
-               puts("NULL value pointer\n");
-               return -1;
-       }
-
        miiphy_pre (bus, 1, addr, reg);
 
        /* tri-state our MDIO I/O pin so we can read */
@@ -267,8 +263,7 @@ int bb_miiphy_read(const char *devname, unsigned char addr,
                        bus->set_mdc(bus, 1);
                        bus->delay(bus);
                }
-               /* There is no PHY, set value to 0xFFFF and return */
-               *value = 0xFFFF;
+               /* There is no PHY, return */
                return -1;
        }
 
@@ -294,13 +289,11 @@ int bb_miiphy_read(const char *devname, unsigned char addr,
        bus->set_mdc(bus, 1);
        bus->delay(bus);
 
-       *value = rdreg;
-
 #ifdef DEBUG
-       printf ("miiphy_read(0x%x) @ 0x%x = 0x%04x\n", reg, addr, *value);
+       printf("miiphy_read(0x%x) @ 0x%x = 0x%04x\n", reg, addr, rdreg);
 #endif
 
-       return 0;
+       return rdreg;
 }
 
 
@@ -311,13 +304,13 @@ int bb_miiphy_read(const char *devname, unsigned char addr,
  * Returns:
  *   0 on success
  */
-int bb_miiphy_write (const char *devname, unsigned char addr,
-                    unsigned char reg, unsigned short value)
+int bb_miiphy_write(struct mii_dev *miidev, int addr, int devad, int reg,
+                   u16 value)
 {
        struct bb_miiphy_bus *bus;
        int j;                  /* counter */
 
-       bus = bb_miiphy_getbus(devname);
+       bus = bb_miiphy_getbus(miidev->name);
        if (bus == NULL) {
                /* Bus not found! */
                return -1;
This page took 0.030722 seconds and 4 git commands to generate.