diff options
| author | Tom Rini <[email protected]> | 2025-02-26 14:32:16 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-02-26 14:32:16 -0600 |
| commit | 05647bdf55f94decea8f2db467347a924e783861 (patch) | |
| tree | c8f1ea93f4e74592323c8fa1755c982c317106b9 /drivers/net/phy | |
| parent | 8dd7186ca7821446c6f46b6cccefab502912f2e0 (diff) | |
| parent | 4e6fed49becc7e8d9639966fd34695583192a3ee (diff) | |
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-sh into next
bbmiiphy clean up and DM alignment, finally gets rid of the static
bbmiiphy variables and plugs bbmiiphy into MDIO framework.
Diffstat (limited to 'drivers/net/phy')
| -rw-r--r-- | drivers/net/phy/miiphybb.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/net/phy/miiphybb.c b/drivers/net/phy/miiphybb.c index 9f5f9b12c9f..553af2c1032 100644 --- a/drivers/net/phy/miiphybb.c +++ b/drivers/net/phy/miiphybb.c @@ -14,31 +14,31 @@ #include <ioports.h> #include <ppc_asm.tmpl> +#include <malloc.h> #include <miiphy.h> #include <asm/global_data.h> -int bb_miiphy_init(void) +static inline struct bb_miiphy_bus *bb_miiphy_getbus(struct mii_dev *miidev) { - int i; + return container_of(miidev, struct bb_miiphy_bus, mii); +} - for (i = 0; i < bb_miiphy_buses_num; i++) - if (bb_miiphy_buses[i].init != NULL) - bb_miiphy_buses[i].init(&bb_miiphy_buses[i]); +struct bb_miiphy_bus *bb_miiphy_alloc(void) +{ + struct bb_miiphy_bus *bus; - return 0; + bus = malloc(sizeof(*bus)); + if (!bus) + return bus; + + mdio_init(&bus->mii); + + return bus; } -static inline struct bb_miiphy_bus *bb_miiphy_getbus(const char *devname) +void bb_miiphy_free(struct bb_miiphy_bus *bus) { - int i; - - /* Search the correct bus */ - for (i = 0; i < bb_miiphy_buses_num; i++) { - if (!strcmp(bb_miiphy_buses[i].name, devname)) { - return &bb_miiphy_buses[i]; - } - } - return NULL; + free(bus); } /***************************************************************************** @@ -133,7 +133,7 @@ int bb_miiphy_read(struct mii_dev *miidev, int addr, int devad, int reg) int j; /* counter */ struct bb_miiphy_bus *bus; - bus = bb_miiphy_getbus(miidev->name); + bus = bb_miiphy_getbus(miidev); if (bus == NULL) { return -1; } @@ -201,7 +201,7 @@ int bb_miiphy_write(struct mii_dev *miidev, int addr, int devad, int reg, struct bb_miiphy_bus *bus; int j; /* counter */ - bus = bb_miiphy_getbus(miidev->name); + bus = bb_miiphy_getbus(miidev); if (bus == NULL) { /* Bus not found! */ return -1; |
