32
32
#include <linux/ethtool.h>
33
33
#include <linux/mii.h>
34
34
#include <linux/bitops.h>
35
- #include <linux/workqueue.h>
36
35
#include <linux/of.h>
37
36
#include <linux/of_address.h>
38
37
#include <linux/of_irq.h>
@@ -96,11 +95,6 @@ MODULE_LICENSE("GPL");
96
95
static u32 busy_phy_map ;
97
96
static DEFINE_MUTEX (emac_phy_map_lock );
98
97
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
-
104
98
/* Having stable interface names is a doomed idea. However, it would be nice
105
99
* if we didn't have completely random interface names at boot too :-) It's
106
100
* 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);
116
110
#define EMAC_BOOT_LIST_SIZE 4
117
111
static struct device_node * emac_boot_list [EMAC_BOOT_LIST_SIZE ];
118
112
119
- /* How long should I wait for dependent devices ? */
120
- #define EMAC_PROBE_DEP_TIMEOUT (HZ * 5)
121
-
122
113
/* I don't want to litter system log with timeout errors
123
114
* when we have brain-damaged PHY.
124
115
*/
@@ -973,8 +964,6 @@ static void __emac_set_multicast_list(struct emac_instance *dev)
973
964
* we need is just to stop RX channel. This seems to work on all
974
965
* tested SoCs. --ebs
975
966
*
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
978
967
*/
979
968
dev -> mcast_pending = 0 ;
980
969
emac_rx_disable (dev );
@@ -2378,7 +2367,9 @@ static int emac_check_deps(struct emac_instance *dev,
2378
2367
if (deps [i ].drvdata != NULL )
2379
2368
there ++ ;
2380
2369
}
2381
- return there == EMAC_DEP_COUNT ;
2370
+ if (there != EMAC_DEP_COUNT )
2371
+ return - EPROBE_DEFER ;
2372
+ return 0 ;
2382
2373
}
2383
2374
2384
2375
static void emac_put_deps (struct emac_instance * dev )
@@ -2390,19 +2381,6 @@ static void emac_put_deps(struct emac_instance *dev)
2390
2381
platform_device_put (dev -> tah_dev );
2391
2382
}
2392
2383
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
-
2406
2384
static int emac_wait_deps (struct emac_instance * dev )
2407
2385
{
2408
2386
struct emac_depentry deps [EMAC_DEP_COUNT ];
@@ -2419,18 +2397,13 @@ static int emac_wait_deps(struct emac_instance *dev)
2419
2397
deps [EMAC_DEP_MDIO_IDX ].phandle = dev -> mdio_ph ;
2420
2398
if (dev -> blist && dev -> blist > emac_boot_list )
2421
2399
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 );
2428
2401
for (i = 0 ; i < EMAC_DEP_COUNT ; i ++ ) {
2429
2402
of_node_put (deps [i ].node );
2430
2403
if (err )
2431
2404
platform_device_put (deps [i ].ofdev );
2432
2405
}
2433
- if (err == 0 ) {
2406
+ if (! err ) {
2434
2407
dev -> mal_dev = deps [EMAC_DEP_MAL_IDX ].ofdev ;
2435
2408
dev -> zmii_dev = deps [EMAC_DEP_ZMII_IDX ].ofdev ;
2436
2409
dev -> rgmii_dev = deps [EMAC_DEP_RGMII_IDX ].ofdev ;
@@ -3087,12 +3060,8 @@ static int emac_probe(struct platform_device *ofdev)
3087
3060
3088
3061
/* Wait for dependent devices */
3089
3062
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 )
3094
3064
goto err_irq_unmap ;
3095
- }
3096
3065
dev -> mal = platform_get_drvdata (dev -> mal_dev );
3097
3066
if (dev -> mdio_dev != NULL )
3098
3067
dev -> mdio_instance = platform_get_drvdata (dev -> mdio_dev );
@@ -3192,10 +3161,6 @@ static int emac_probe(struct platform_device *ofdev)
3192
3161
wmb ();
3193
3162
platform_set_drvdata (ofdev , dev );
3194
3163
3195
- /* There's a new kid in town ! Let's tell everybody */
3196
- wake_up_all (& emac_probe_wait );
3197
-
3198
-
3199
3164
printk (KERN_INFO "%s: EMAC-%d %pOF, MAC %pM\n" ,
3200
3165
ndev -> name , dev -> cell_index , np , ndev -> dev_addr );
3201
3166
@@ -3228,14 +3193,8 @@ static int emac_probe(struct platform_device *ofdev)
3228
3193
if (dev -> wol_irq )
3229
3194
irq_dispose_mapping (dev -> wol_irq );
3230
3195
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 )
3236
3197
* blist = NULL ;
3237
- wake_up_all (& emac_probe_wait );
3238
- }
3239
3198
return err ;
3240
3199
}
3241
3200
0 commit comments