OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --- a/drivers/net/phy/mdio-boardinfo.c |
2 | +++ b/drivers/net/phy/mdio-boardinfo.c |
||
3 | @@ -15,8 +15,11 @@ |
||
4 | |||
5 | #include "mdio-boardinfo.h" |
||
6 | |||
7 | -static LIST_HEAD(mdio_board_list); |
||
8 | -static DEFINE_MUTEX(mdio_board_lock); |
||
9 | +LIST_HEAD(mdio_board_list); |
||
10 | +EXPORT_SYMBOL_GPL(mdio_board_list); |
||
11 | + |
||
12 | +DEFINE_MUTEX(mdio_board_lock); |
||
13 | +EXPORT_SYMBOL_GPL(mdio_board_lock); |
||
14 | |||
15 | /** |
||
16 | * mdiobus_setup_mdiodev_from_board_info - create and setup MDIO devices |
||
17 | --- a/drivers/net/phy/mdio-boardinfo.h |
||
18 | +++ b/drivers/net/phy/mdio-boardinfo.h |
||
19 | @@ -20,4 +20,7 @@ void mdiobus_setup_mdiodev_from_board_in |
||
20 | (struct mii_bus *bus, |
||
21 | struct mdio_board_info *bi)); |
||
22 | |||
23 | +extern struct mutex mdio_board_lock; |
||
24 | +extern struct list_head mdio_board_list; |
||
25 | + |
||
26 | #endif /* __MDIO_BOARD_INFO_H */ |
||
27 | --- a/drivers/net/phy/mdio_bus.c |
||
28 | +++ b/drivers/net/phy/mdio_bus.c |
||
29 | @@ -456,6 +456,17 @@ void mdiobus_free(struct mii_bus *bus) |
||
30 | } |
||
31 | EXPORT_SYMBOL(mdiobus_free); |
||
32 | |||
33 | +static void mdiobus_setup_phydev_from_boardinfo(struct mii_bus *bus, |
||
34 | + struct phy_device *phydev, |
||
35 | + struct mdio_board_info *bi) |
||
36 | +{ |
||
37 | + if (strcmp(bus->id, bi->bus_id) || |
||
38 | + bi->mdio_addr != phydev->mdio.addr) |
||
39 | + return; |
||
40 | + |
||
41 | + phydev->mdio.dev.platform_data = (void *) bi->platform_data; |
||
42 | +} |
||
43 | + |
||
44 | /** |
||
45 | * mdiobus_scan - scan a bus for MDIO devices. |
||
46 | * @bus: mii_bus to scan |
||
47 | @@ -471,6 +482,7 @@ EXPORT_SYMBOL(mdiobus_free); |
||
48 | struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) |
||
49 | { |
||
50 | struct phy_device *phydev; |
||
51 | + struct mdio_board_entry *be; |
||
52 | int err; |
||
53 | |||
54 | phydev = get_phy_device(bus, addr, false); |
||
55 | @@ -483,6 +495,12 @@ struct phy_device *mdiobus_scan(struct m |
||
56 | */ |
||
57 | of_mdiobus_link_mdiodev(bus, &phydev->mdio); |
||
58 | |||
59 | + mutex_lock(&mdio_board_lock); |
||
60 | + list_for_each_entry(be, &mdio_board_list, list) |
||
61 | + mdiobus_setup_phydev_from_boardinfo(bus, phydev, |
||
62 | + &be->board_info); |
||
63 | + mutex_unlock(&mdio_board_lock); |
||
64 | + |
||
65 | err = phy_device_register(phydev); |
||
66 | if (err) { |
||
67 | phy_device_free(phydev); |