projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ARM: zynq: Do not select options if SPL is not enabled
[oweals/u-boot.git]
/
common
/
miiphyutil.c
diff --git
a/common/miiphyutil.c
b/common/miiphyutil.c
index 74812e6e1b959a0edf78801e1c3dd77116b027c2..7e41957185072123a81468309081ec4586730867 100644
(file)
--- a/
common/miiphyutil.c
+++ b/
common/miiphyutil.c
@@
-11,6
+11,7
@@
*/
#include <common.h>
*/
#include <common.h>
+#include <dm.h>
#include <miiphy.h>
#include <phy.h>
#include <miiphy.h>
#include <phy.h>
@@
-113,6
+114,8
@@
void miiphy_register(const char *name,
if (new_dev == NULL || ldev == NULL) {
printf("miiphy_register: cannot allocate memory for '%s'\n",
name);
if (new_dev == NULL || ldev == NULL) {
printf("miiphy_register: cannot allocate memory for '%s'\n",
name);
+ free(ldev);
+ mdio_free(new_dev);
return;
}
return;
}
@@
-151,9
+154,14
@@
struct mii_dev *mdio_alloc(void)
return bus;
}
return bus;
}
+void mdio_free(struct mii_dev *bus)
+{
+ free(bus);
+}
+
int mdio_register(struct mii_dev *bus)
{
int mdio_register(struct mii_dev *bus)
{
- if (!bus || !bus->
name || !bus->
read || !bus->write)
+ if (!bus || !bus->read || !bus->write)
return -1;
/* check if we have unique name */
return -1;
/* check if we have unique name */
@@
-172,6
+180,20
@@
int mdio_register(struct mii_dev *bus)
return 0;
}
return 0;
}
+int mdio_unregister(struct mii_dev *bus)
+{
+ if (!bus)
+ return 0;
+
+ /* delete it from the list */
+ list_del(&bus->link);
+
+ if (current_mii == bus)
+ current_mii = NULL;
+
+ return 0;
+}
+
void mdio_list_devices(void)
{
struct list_head *entry;
void mdio_list_devices(void)
{
struct list_head *entry;