3232#include <linux/ethtool.h>
3333#include <linux/mii.h>
3434#include <linux/bitops.h>
35- #include <linux/workqueue.h>
3635#include <linux/of.h>
3736#include <linux/of_address.h>
3837#include <linux/of_irq.h>
@@ -96,11 +95,6 @@ MODULE_LICENSE("GPL");
9695static u32 busy_phy_map ;
9796static DEFINE_MUTEX (emac_phy_map_lock );
9897
99- /* This is the wait queue used to wait on any event related to probe, that
100- * is discovery of MALs, other EMACs, ZMII/RGMIIs, etc...
101- */
102- static DECLARE_WAIT_QUEUE_HEAD (emac_probe_wait );
103-
10498/* Having stable interface names is a doomed idea. However, it would be nice
10599 * if we didn't have completely random interface names at boot too :-) It's
106100 * just a matter of making everybody's life easier. Since we are doing
@@ -116,9 +110,6 @@ static DECLARE_WAIT_QUEUE_HEAD(emac_probe_wait);
116110#define EMAC_BOOT_LIST_SIZE 4
117111static struct device_node * emac_boot_list [EMAC_BOOT_LIST_SIZE ];
118112
119- /* How long should I wait for dependent devices ? */
120- #define EMAC_PROBE_DEP_TIMEOUT (HZ * 5)
121-
122113/* I don't want to litter system log with timeout errors
123114 * when we have brain-damaged PHY.
124115 */
@@ -973,8 +964,6 @@ static void __emac_set_multicast_list(struct emac_instance *dev)
973964 * we need is just to stop RX channel. This seems to work on all
974965 * tested SoCs. --ebs
975966 *
976- * If we need the full reset, we might just trigger the workqueue
977- * and do it async... a bit nasty but should work --BenH
978967 */
979968 dev -> mcast_pending = 0 ;
980969 emac_rx_disable (dev );
@@ -2378,7 +2367,9 @@ static int emac_check_deps(struct emac_instance *dev,
23782367 if (deps [i ].drvdata != NULL )
23792368 there ++ ;
23802369 }
2381- return there == EMAC_DEP_COUNT ;
2370+ if (there != EMAC_DEP_COUNT )
2371+ return - EPROBE_DEFER ;
2372+ return 0 ;
23822373}
23832374
23842375static void emac_put_deps (struct emac_instance * dev )
@@ -2390,19 +2381,6 @@ static void emac_put_deps(struct emac_instance *dev)
23902381 platform_device_put (dev -> tah_dev );
23912382}
23922383
2393- static int emac_of_bus_notify (struct notifier_block * nb , unsigned long action ,
2394- void * data )
2395- {
2396- /* We are only intereted in device addition */
2397- if (action == BUS_NOTIFY_BOUND_DRIVER )
2398- wake_up_all (& emac_probe_wait );
2399- return 0 ;
2400- }
2401-
2402- static struct notifier_block emac_of_bus_notifier = {
2403- .notifier_call = emac_of_bus_notify
2404- };
2405-
24062384static int emac_wait_deps (struct emac_instance * dev )
24072385{
24082386 struct emac_depentry deps [EMAC_DEP_COUNT ];
@@ -2419,18 +2397,13 @@ static int emac_wait_deps(struct emac_instance *dev)
24192397 deps [EMAC_DEP_MDIO_IDX ].phandle = dev -> mdio_ph ;
24202398 if (dev -> blist && dev -> blist > emac_boot_list )
24212399 deps [EMAC_DEP_PREV_IDX ].phandle = 0xffffffffu ;
2422- bus_register_notifier (& platform_bus_type , & emac_of_bus_notifier );
2423- wait_event_timeout (emac_probe_wait ,
2424- emac_check_deps (dev , deps ),
2425- EMAC_PROBE_DEP_TIMEOUT );
2426- bus_unregister_notifier (& platform_bus_type , & emac_of_bus_notifier );
2427- err = emac_check_deps (dev , deps ) ? 0 : - ENODEV ;
2400+ err = emac_check_deps (dev , deps );
24282401 for (i = 0 ; i < EMAC_DEP_COUNT ; i ++ ) {
24292402 of_node_put (deps [i ].node );
24302403 if (err )
24312404 platform_device_put (deps [i ].ofdev );
24322405 }
2433- if (err == 0 ) {
2406+ if (! err ) {
24342407 dev -> mal_dev = deps [EMAC_DEP_MAL_IDX ].ofdev ;
24352408 dev -> zmii_dev = deps [EMAC_DEP_ZMII_IDX ].ofdev ;
24362409 dev -> rgmii_dev = deps [EMAC_DEP_RGMII_IDX ].ofdev ;
@@ -3087,12 +3060,8 @@ static int emac_probe(struct platform_device *ofdev)
30873060
30883061 /* Wait for dependent devices */
30893062 err = emac_wait_deps (dev );
3090- if (err ) {
3091- printk (KERN_ERR
3092- "%pOF: Timeout waiting for dependent devices\n" , np );
3093- /* display more info about what's missing ? */
3063+ if (err )
30943064 goto err_irq_unmap ;
3095- }
30963065 dev -> mal = platform_get_drvdata (dev -> mal_dev );
30973066 if (dev -> mdio_dev != NULL )
30983067 dev -> mdio_instance = platform_get_drvdata (dev -> mdio_dev );
@@ -3192,10 +3161,6 @@ static int emac_probe(struct platform_device *ofdev)
31923161 wmb ();
31933162 platform_set_drvdata (ofdev , dev );
31943163
3195- /* There's a new kid in town ! Let's tell everybody */
3196- wake_up_all (& emac_probe_wait );
3197-
3198-
31993164 printk (KERN_INFO "%s: EMAC-%d %pOF, MAC %pM\n" ,
32003165 ndev -> name , dev -> cell_index , np , ndev -> dev_addr );
32013166
@@ -3228,14 +3193,8 @@ static int emac_probe(struct platform_device *ofdev)
32283193 if (dev -> wol_irq )
32293194 irq_dispose_mapping (dev -> wol_irq );
32303195 err_gone :
3231- /* if we were on the bootlist, remove us as we won't show up and
3232- * wake up all waiters to notify them in case they were waiting
3233- * on us
3234- */
3235- if (blist ) {
3196+ if (blist )
32363197 * blist = NULL ;
3237- wake_up_all (& emac_probe_wait );
3238- }
32393198 return err ;
32403199}
32413200
0 commit comments