forked from coolsnowwolf/lede
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72e44c8
commit 35fe259
Showing
5 changed files
with
69 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
target/linux/ar71xx/patches-4.14/950-add-boardinfo-platform-data.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- a/drivers/net/phy/mdio-boardinfo.c | ||
+++ b/drivers/net/phy/mdio-boardinfo.c | ||
@@ -15,8 +15,11 @@ | ||
|
||
#include "mdio-boardinfo.h" | ||
|
||
-static LIST_HEAD(mdio_board_list); | ||
-static DEFINE_MUTEX(mdio_board_lock); | ||
+LIST_HEAD(mdio_board_list); | ||
+EXPORT_SYMBOL_GPL(mdio_board_list); | ||
+ | ||
+DEFINE_MUTEX(mdio_board_lock); | ||
+EXPORT_SYMBOL_GPL(mdio_board_lock); | ||
|
||
/** | ||
* mdiobus_setup_mdiodev_from_board_info - create and setup MDIO devices | ||
--- a/drivers/net/phy/mdio-boardinfo.h | ||
+++ b/drivers/net/phy/mdio-boardinfo.h | ||
@@ -20,4 +20,7 @@ void mdiobus_setup_mdiodev_from_board_in | ||
(struct mii_bus *bus, | ||
struct mdio_board_info *bi)); | ||
|
||
+extern struct mutex mdio_board_lock; | ||
+extern struct list_head mdio_board_list; | ||
+ | ||
#endif /* __MDIO_BOARD_INFO_H */ | ||
--- a/drivers/net/phy/mdio_bus.c | ||
+++ b/drivers/net/phy/mdio_bus.c | ||
@@ -455,6 +455,17 @@ void mdiobus_free(struct mii_bus *bus) | ||
} | ||
EXPORT_SYMBOL(mdiobus_free); | ||
|
||
+static void mdiobus_setup_phydev_from_boardinfo(struct mii_bus *bus, | ||
+ struct phy_device *phydev, | ||
+ struct mdio_board_info *bi) | ||
+{ | ||
+ if (strcmp(bus->id, bi->bus_id) || | ||
+ bi->mdio_addr != phydev->mdio.addr) | ||
+ return; | ||
+ | ||
+ phydev->mdio.dev.platform_data = (void *) bi->platform_data; | ||
+} | ||
+ | ||
/** | ||
* mdiobus_scan - scan a bus for MDIO devices. | ||
* @bus: mii_bus to scan | ||
@@ -470,6 +481,7 @@ EXPORT_SYMBOL(mdiobus_free); | ||
struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) | ||
{ | ||
struct phy_device *phydev; | ||
+ struct mdio_board_entry *be; | ||
int err; | ||
|
||
phydev = get_phy_device(bus, addr, false); | ||
@@ -482,6 +494,12 @@ struct phy_device *mdiobus_scan(struct m | ||
*/ | ||
of_mdiobus_link_mdiodev(bus, &phydev->mdio); | ||
|
||
+ mutex_lock(&mdio_board_lock); | ||
+ list_for_each_entry(be, &mdio_board_list, list) | ||
+ mdiobus_setup_phydev_from_boardinfo(bus, phydev, | ||
+ &be->board_info); | ||
+ mutex_unlock(&mdio_board_lock); | ||
+ | ||
err = phy_device_register(phydev); | ||
if (err) { | ||
phy_device_free(phydev); |