Blame view

net/eth-uclass.c 13.1 KB
83d290c56   Tom Rini   SPDX: Convert all...
1
  // SPDX-License-Identifier: GPL-2.0+
db9391e16   Simon Glass   net: Move driver-...
2
3
4
5
  /*
   * (C) Copyright 2001-2015
   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
   * Joe Hershberger, National Instruments
2588057af   Peng Fan   MLK-14862 net: et...
6
7
   * Copyright 2017 NXP
   *
db9391e16   Simon Glass   net: Move driver-...
8
9
10
11
   */
  
  #include <common.h>
  #include <dm.h>
9fb625ce0   Simon Glass   env: Move env_set...
12
  #include <env.h>
db9391e16   Simon Glass   net: Move driver-...
13
14
15
  #include <net.h>
  #include <dm/device-internal.h>
  #include <dm/uclass-internal.h>
3eaac6307   Ramon Fried   net: introduce pa...
16
  #include <net/pcap.h>
db9391e16   Simon Glass   net: Move driver-...
17
  #include "eth_internal.h"
b7cbfa5f8   Ye Li   MLK-23574-28 net:...
18
  #include <eth_phy.h>
db9391e16   Simon Glass   net: Move driver-...
19

a7c45ec4d   Simon Glass   microblaze: Corre...
20
  DECLARE_GLOBAL_DATA_PTR;
db9391e16   Simon Glass   net: Move driver-...
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  /**
   * struct eth_device_priv - private structure for each Ethernet device
   *
   * @state: The state of the Ethernet MAC driver (defined by enum eth_state_t)
   */
  struct eth_device_priv {
  	enum eth_state_t state;
  };
  
  /**
   * struct eth_uclass_priv - The structure attached to the uclass itself
   *
   * @current: The Ethernet device that the network functions are using
   */
  struct eth_uclass_priv {
  	struct udevice *current;
  };
  
  /* eth_errno - This stores the most recent failure code from DM functions */
  static int eth_errno;
  
  static struct eth_uclass_priv *eth_get_uclass_priv(void)
  {
  	struct uclass *uc;
2588057af   Peng Fan   MLK-14862 net: et...
45
46
47
48
49
  	int ret;
  
  	ret = uclass_get(UCLASS_ETH, &uc);
  	if (ret)
  		return NULL;
db9391e16   Simon Glass   net: Move driver-...
50

db9391e16   Simon Glass   net: Move driver-...
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
  	assert(uc);
  	return uc->priv;
  }
  
  void eth_set_current_to_next(void)
  {
  	struct eth_uclass_priv *uc_priv;
  
  	uc_priv = eth_get_uclass_priv();
  	if (uc_priv->current)
  		uclass_next_device(&uc_priv->current);
  	if (!uc_priv->current)
  		uclass_first_device(UCLASS_ETH, &uc_priv->current);
  }
  
  /*
   * Typically this will simply return the active device.
   * In the case where the most recent active device was unset, this will attempt
   * to return the first device. If that device doesn't exist or fails to probe,
   * this function will return NULL.
   */
  struct udevice *eth_get_dev(void)
  {
  	struct eth_uclass_priv *uc_priv;
  
  	uc_priv = eth_get_uclass_priv();
  	if (!uc_priv->current)
  		eth_errno = uclass_first_device(UCLASS_ETH,
  				    &uc_priv->current);
  	return uc_priv->current;
  }
  
  /*
   * Typically this will just store a device pointer.
   * In case it was not probed, we will attempt to do so.
   * dev may be NULL to unset the active device.
   */
  void eth_set_dev(struct udevice *dev)
  {
  	if (dev && !device_active(dev)) {
  		eth_errno = device_probe(dev);
  		if (eth_errno)
  			dev = NULL;
  	}
  
  	eth_get_uclass_priv()->current = dev;
  }
  
  /*
   * Find the udevice that either has the name passed in as devname or has an
   * alias named devname.
   */
  struct udevice *eth_get_dev_by_name(const char *devname)
  {
  	int seq = -1;
  	char *endp = NULL;
  	const char *startp = NULL;
  	struct udevice *it;
  	struct uclass *uc;
  	int len = strlen("eth");
2588057af   Peng Fan   MLK-14862 net: et...
111
  	int ret;
db9391e16   Simon Glass   net: Move driver-...
112
113
114
115
116
117
  
  	/* Must be longer than 3 to be an alias */
  	if (!strncmp(devname, "eth", len) && strlen(devname) > len) {
  		startp = devname + len;
  		seq = simple_strtoul(startp, &endp, 10);
  	}
2588057af   Peng Fan   MLK-14862 net: et...
118
119
120
  	ret = uclass_get(UCLASS_ETH, &uc);
  	if (ret)
  		return NULL;
db9391e16   Simon Glass   net: Move driver-...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
  	uclass_foreach_dev(it, uc) {
  		/*
  		 * We need the seq to be valid, so try to probe it.
  		 * If the probe fails, the seq will not match since it will be
  		 * -1 instead of what we are looking for.
  		 * We don't care about errors from probe here. Either they won't
  		 * match an alias or it will match a literal name and we'll pick
  		 * up the error when we try to probe again in eth_set_dev().
  		 */
  		if (device_probe(it))
  			continue;
  		/* Check for the name or the sequence number to match */
  		if (strcmp(it->name, devname) == 0 ||
  		    (endp > startp && it->seq == seq))
  			return it;
  	}
  
  	return NULL;
  }
  
  unsigned char *eth_get_ethaddr(void)
  {
  	struct eth_pdata *pdata;
  
  	if (eth_get_dev()) {
  		pdata = eth_get_dev()->platdata;
  		return pdata->enetaddr;
  	}
  
  	return NULL;
  }
  
  /* Set active state without calling start on the driver */
  int eth_init_state_only(void)
  {
  	struct udevice *current;
  	struct eth_device_priv *priv;
  
  	current = eth_get_dev();
  	if (!current || !device_active(current))
  		return -EINVAL;
  
  	priv = current->uclass_priv;
  	priv->state = ETH_STATE_ACTIVE;
  
  	return 0;
  }
  
  /* Set passive state without calling stop on the driver */
  void eth_halt_state_only(void)
  {
  	struct udevice *current;
  	struct eth_device_priv *priv;
  
  	current = eth_get_dev();
  	if (!current || !device_active(current))
  		return;
  
  	priv = current->uclass_priv;
  	priv->state = ETH_STATE_PASSIVE;
  }
  
  int eth_get_dev_index(void)
  {
  	if (eth_get_dev())
  		return eth_get_dev()->seq;
  	return -1;
  }
  
  static int eth_write_hwaddr(struct udevice *dev)
  {
c08248d60   xypron.glpk@gmx.de   net: core: avoid ...
192
  	struct eth_pdata *pdata;
db9391e16   Simon Glass   net: Move driver-...
193
194
195
196
197
198
199
  	int ret = 0;
  
  	if (!dev || !device_active(dev))
  		return -EINVAL;
  
  	/* seq is valid since the device is active */
  	if (eth_get_ops(dev)->write_hwaddr && !eth_mac_skip(dev->seq)) {
c08248d60   xypron.glpk@gmx.de   net: core: avoid ...
200
  		pdata = dev->platdata;
db9391e16   Simon Glass   net: Move driver-...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
  		if (!is_valid_ethaddr(pdata->enetaddr)) {
  			printf("
  Error: %s address %pM illegal value
  ",
  			       dev->name, pdata->enetaddr);
  			return -EINVAL;
  		}
  
  		/*
  		 * Drivers are allowed to decide not to implement this at
  		 * run-time. E.g. Some devices may use it and some may not.
  		 */
  		ret = eth_get_ops(dev)->write_hwaddr(dev);
  		if (ret == -ENOSYS)
  			ret = 0;
  		if (ret)
  			printf("
  Warning: %s failed to set MAC address
  ",
  			       dev->name);
  	}
  
  	return ret;
  }
  
  static int on_ethaddr(const char *name, const char *value, enum env_op op,
  	int flags)
  {
  	int index;
  	int retval;
  	struct udevice *dev;
  
  	/* look for an index after "eth" */
  	index = simple_strtoul(name + 3, NULL, 10);
  
  	retval = uclass_find_device_by_seq(UCLASS_ETH, index, false, &dev);
  	if (!retval) {
  		struct eth_pdata *pdata = dev->platdata;
  		switch (op) {
  		case env_op_create:
  		case env_op_overwrite:
fb8977c5b   Joe Hershberger   net: Always build...
242
  			string_to_enetaddr(value, pdata->enetaddr);
c86ff7fdb   Hannes Schmelzer   net: write enetad...
243
  			eth_write_hwaddr(dev);
db9391e16   Simon Glass   net: Move driver-...
244
245
  			break;
  		case env_op_delete:
a40db6d51   oliver@schinagl.nl   net: cosmetic: Do...
246
  			memset(pdata->enetaddr, 0, ARP_HLEN);
db9391e16   Simon Glass   net: Move driver-...
247
248
249
250
251
252
253
254
255
  		}
  	}
  
  	return 0;
  }
  U_BOOT_ENV_CALLBACK(ethaddr, on_ethaddr);
  
  int eth_init(void)
  {
00caae6d4   Simon Glass   env: Rename geten...
256
257
  	char *ethact = env_get("ethact");
  	char *ethrotate = env_get("ethrotate");
db9391e16   Simon Glass   net: Move driver-...
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
  	struct udevice *current = NULL;
  	struct udevice *old_current;
  	int ret = -ENODEV;
  
  	/*
  	 * When 'ethrotate' variable is set to 'no' and 'ethact' variable
  	 * is already set to an ethernet device, we should stick to 'ethact'.
  	 */
  	if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0)) {
  		if (ethact) {
  			current = eth_get_dev_by_name(ethact);
  			if (!current)
  				return -EINVAL;
  		}
  	}
  
  	if (!current) {
  		current = eth_get_dev();
  		if (!current) {
  			printf("No ethernet found.
  ");
  			return -ENODEV;
  		}
  	}
  
  	old_current = current;
  	do {
  		if (current) {
  			debug("Trying %s
  ", current->name);
  
  			if (device_active(current)) {
  				ret = eth_get_ops(current)->start(current);
  				if (ret >= 0) {
  					struct eth_device_priv *priv =
  						current->uclass_priv;
  
  					priv->state = ETH_STATE_ACTIVE;
  					return 0;
  				}
  			} else {
  				ret = eth_errno;
  			}
  
  			debug("FAIL
  ");
  		} else {
  			debug("PROBE FAIL
  ");
  		}
  
  		/*
  		 * If ethrotate is enabled, this will change "current",
  		 * otherwise we will drop out of this while loop immediately
  		 */
  		eth_try_another(0);
  		/* This will ensure the new "current" attempted to probe */
  		current = eth_get_dev();
  	} while (old_current != current);
  
  	return ret;
  }
  
  void eth_halt(void)
  {
  	struct udevice *current;
  	struct eth_device_priv *priv;
  
  	current = eth_get_dev();
68acb51f4   Joe Hershberger   net: Only call ha...
327
  	if (!current || !eth_is_active(current))
db9391e16   Simon Glass   net: Move driver-...
328
329
330
331
  		return;
  
  	eth_get_ops(current)->stop(current);
  	priv = current->uclass_priv;
c3211708c   Jean-Jacques Hiblot   net: eth-uclass: ...
332
333
  	if (priv)
  		priv->state = ETH_STATE_PASSIVE;
db9391e16   Simon Glass   net: Move driver-...
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
  }
  
  int eth_is_active(struct udevice *dev)
  {
  	struct eth_device_priv *priv;
  
  	if (!dev || !device_active(dev))
  		return 0;
  
  	priv = dev_get_uclass_priv(dev);
  	return priv->state == ETH_STATE_ACTIVE;
  }
  
  int eth_send(void *packet, int length)
  {
  	struct udevice *current;
  	int ret;
  
  	current = eth_get_dev();
  	if (!current)
  		return -ENODEV;
a532e2f2e   Alexander Graf   net: Only access ...
355
  	if (!eth_is_active(current))
db9391e16   Simon Glass   net: Move driver-...
356
357
358
359
360
361
362
363
  		return -EINVAL;
  
  	ret = eth_get_ops(current)->send(current, packet, length);
  	if (ret < 0) {
  		/* We cannot completely return the error at present */
  		debug("%s: send() returned error %d
  ", __func__, ret);
  	}
3eaac6307   Ramon Fried   net: introduce pa...
364
365
366
367
  #if defined(CONFIG_CMD_PCAP)
  	if (ret >= 0)
  		pcap_post(packet, length, true);
  #endif
db9391e16   Simon Glass   net: Move driver-...
368
369
370
371
372
373
374
375
376
377
378
379
380
381
  	return ret;
  }
  
  int eth_rx(void)
  {
  	struct udevice *current;
  	uchar *packet;
  	int flags;
  	int ret;
  	int i;
  
  	current = eth_get_dev();
  	if (!current)
  		return -ENODEV;
a532e2f2e   Alexander Graf   net: Only access ...
382
  	if (!eth_is_active(current))
db9391e16   Simon Glass   net: Move driver-...
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
  		return -EINVAL;
  
  	/* Process up to 32 packets at one time */
  	flags = ETH_RECV_CHECK_DEVICE;
  	for (i = 0; i < 32; i++) {
  		ret = eth_get_ops(current)->recv(current, flags, &packet);
  		flags = 0;
  		if (ret > 0)
  			net_process_received_packet(packet, ret);
  		if (ret >= 0 && eth_get_ops(current)->free_pkt)
  			eth_get_ops(current)->free_pkt(current, packet, ret);
  		if (ret <= 0)
  			break;
  	}
  	if (ret == -EAGAIN)
  		ret = 0;
  	if (ret < 0) {
  		/* We cannot completely return the error at present */
  		debug("%s: recv() returned error %d
  ", __func__, ret);
  	}
  	return ret;
  }
  
  int eth_initialize(void)
  {
  	int num_devices = 0;
  	struct udevice *dev;
  
  	eth_common_init();
  
  	/*
  	 * Devices need to write the hwaddr even if not started so that Linux
  	 * will have access to the hwaddr that u-boot stored for the device.
  	 * This is accomplished by attempting to probe each device and calling
  	 * their write_hwaddr() operation.
  	 */
3ce430420   Mario Six   net: Initialize a...
420
  	uclass_first_device_check(UCLASS_ETH, &dev);
db9391e16   Simon Glass   net: Move driver-...
421
422
423
424
425
  	if (!dev) {
  		printf("No ethernet found.
  ");
  		bootstage_error(BOOTSTAGE_ID_NET_ETH_START);
  	} else {
00caae6d4   Simon Glass   env: Rename geten...
426
  		char *ethprime = env_get("ethprime");
db9391e16   Simon Glass   net: Move driver-...
427
428
429
430
431
432
433
434
435
436
437
438
439
  		struct udevice *prime_dev = NULL;
  
  		if (ethprime)
  			prime_dev = eth_get_dev_by_name(ethprime);
  		if (prime_dev) {
  			eth_set_dev(prime_dev);
  			eth_current_changed();
  		} else {
  			eth_set_dev(NULL);
  		}
  
  		bootstage_mark(BOOTSTAGE_ID_NET_ETH_INIT);
  		do {
19820db0b   Michael Walle   net: eth-uclass: ...
440
441
442
  			if (dev->seq != -1) {
  				if (num_devices)
  					printf(", ");
db9391e16   Simon Glass   net: Move driver-...
443

19820db0b   Michael Walle   net: eth-uclass: ...
444
  				printf("eth%d: %s", dev->seq, dev->name);
db9391e16   Simon Glass   net: Move driver-...
445

19820db0b   Michael Walle   net: eth-uclass: ...
446
447
448
  				if (ethprime && dev == prime_dev)
  					printf(" [PRIME]");
  			}
db9391e16   Simon Glass   net: Move driver-...
449
450
  
  			eth_write_hwaddr(dev);
19820db0b   Michael Walle   net: eth-uclass: ...
451
452
  			if (dev->seq != -1)
  				num_devices++;
3ce430420   Mario Six   net: Initialize a...
453
  			uclass_next_device_check(&dev);
db9391e16   Simon Glass   net: Move driver-...
454
  		} while (dev);
19820db0b   Michael Walle   net: eth-uclass: ...
455
456
457
  		if (!num_devices)
  			printf("No ethernet found.
  ");
db9391e16   Simon Glass   net: Move driver-...
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
  		putc('
  ');
  	}
  
  	return num_devices;
  }
  
  static int eth_post_bind(struct udevice *dev)
  {
  	if (strchr(dev->name, ' ')) {
  		printf("
  Error: eth device name \"%s\" has a space!
  ",
  		       dev->name);
  		return -EINVAL;
  	}
b7cbfa5f8   Ye Li   MLK-23574-28 net:...
474
475
476
  #ifdef CONFIG_DM_ETH_PHY
  	eth_phy_binds_nodes(dev);
  #endif
db9391e16   Simon Glass   net: Move driver-...
477
478
479
480
481
482
483
484
485
486
487
  	return 0;
  }
  
  static int eth_pre_unbind(struct udevice *dev)
  {
  	/* Don't hang onto a pointer that is going away */
  	if (dev == eth_get_uclass_priv()->current)
  		eth_set_dev(NULL);
  
  	return 0;
  }
379af67ab   Thierry Reding   net: eth-uclass: ...
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
  static bool eth_dev_get_mac_address(struct udevice *dev, u8 mac[ARP_HLEN])
  {
  #if IS_ENABLED(CONFIG_OF_CONTROL)
  	const uint8_t *p;
  
  	p = dev_read_u8_array_ptr(dev, "mac-address", ARP_HLEN);
  	if (!p)
  		p = dev_read_u8_array_ptr(dev, "local-mac-address", ARP_HLEN);
  
  	if (!p)
  		return false;
  
  	memcpy(mac, p, ARP_HLEN);
  
  	return true;
  #else
  	return false;
  #endif
  }
db9391e16   Simon Glass   net: Move driver-...
507
508
509
510
  static int eth_post_probe(struct udevice *dev)
  {
  	struct eth_device_priv *priv = dev->uclass_priv;
  	struct eth_pdata *pdata = dev->platdata;
a40db6d51   oliver@schinagl.nl   net: cosmetic: Do...
511
  	unsigned char env_enetaddr[ARP_HLEN];
db9391e16   Simon Glass   net: Move driver-...
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
  
  #if defined(CONFIG_NEEDS_MANUAL_RELOC)
  	struct eth_ops *ops = eth_get_ops(dev);
  	static int reloc_done;
  
  	if (!reloc_done) {
  		if (ops->start)
  			ops->start += gd->reloc_off;
  		if (ops->send)
  			ops->send += gd->reloc_off;
  		if (ops->recv)
  			ops->recv += gd->reloc_off;
  		if (ops->free_pkt)
  			ops->free_pkt += gd->reloc_off;
  		if (ops->stop)
  			ops->stop += gd->reloc_off;
db9391e16   Simon Glass   net: Move driver-...
528
529
  		if (ops->mcast)
  			ops->mcast += gd->reloc_off;
db9391e16   Simon Glass   net: Move driver-...
530
531
532
533
534
535
536
537
538
539
  		if (ops->write_hwaddr)
  			ops->write_hwaddr += gd->reloc_off;
  		if (ops->read_rom_hwaddr)
  			ops->read_rom_hwaddr += gd->reloc_off;
  
  		reloc_done++;
  	}
  #endif
  
  	priv->state = ETH_STATE_INIT;
379af67ab   Thierry Reding   net: eth-uclass: ...
540
541
542
543
544
545
546
  	/* Check if the device has a valid MAC address in device tree */
  	if (!eth_dev_get_mac_address(dev, pdata->enetaddr) ||
  	    !is_valid_ethaddr(pdata->enetaddr)) {
  		/* Check if the device has a MAC address in ROM */
  		if (eth_get_ops(dev)->read_rom_hwaddr)
  			eth_get_ops(dev)->read_rom_hwaddr(dev);
  	}
db9391e16   Simon Glass   net: Move driver-...
547

35affd7a2   Simon Glass   env: Rename eth_g...
548
  	eth_env_get_enetaddr_by_index("eth", dev->seq, env_enetaddr);
db9391e16   Simon Glass   net: Move driver-...
549
550
  	if (!is_zero_ethaddr(env_enetaddr)) {
  		if (!is_zero_ethaddr(pdata->enetaddr) &&
a40db6d51   oliver@schinagl.nl   net: cosmetic: Do...
551
  		    memcmp(pdata->enetaddr, env_enetaddr, ARP_HLEN)) {
db9391e16   Simon Glass   net: Move driver-...
552
553
554
555
  			printf("
  Warning: %s MAC addresses don't match:
  ",
  			       dev->name);
26d40b0a1   oliver@schinagl.nl   net: core: cosmet...
556
557
  			printf("Address in ROM is          %pM
  ",
db9391e16   Simon Glass   net: Move driver-...
558
559
560
561
562
563
564
  			       pdata->enetaddr);
  			printf("Address in environment is  %pM
  ",
  			       env_enetaddr);
  		}
  
  		/* Override the ROM MAC address */
a40db6d51   oliver@schinagl.nl   net: cosmetic: Do...
565
  		memcpy(pdata->enetaddr, env_enetaddr, ARP_HLEN);
db9391e16   Simon Glass   net: Move driver-...
566
  	} else if (is_valid_ethaddr(pdata->enetaddr)) {
fd1e959e9   Simon Glass   env: Rename eth_s...
567
  		eth_env_set_enetaddr_by_index("eth", dev->seq, pdata->enetaddr);
db9391e16   Simon Glass   net: Move driver-...
568
569
570
571
  		printf("
  Warning: %s using MAC address from ROM
  ",
  		       dev->name);
aa555fe9f   Siva Durga Prasad Paladugu   net: use random e...
572
573
  	} else if (is_zero_ethaddr(pdata->enetaddr) ||
  		   !is_valid_ethaddr(pdata->enetaddr)) {
db9391e16   Simon Glass   net: Move driver-...
574
575
576
577
578
579
580
581
582
583
584
585
586
587
  #ifdef CONFIG_NET_RANDOM_ETHADDR
  		net_random_ethaddr(pdata->enetaddr);
  		printf("
  Warning: %s (eth%d) using random MAC address - %pM
  ",
  		       dev->name, dev->seq, pdata->enetaddr);
  #else
  		printf("
  Error: %s address not set.
  ",
  		       dev->name);
  		return -EINVAL;
  #endif
  	}
b743bbd2e   Thierry Reding   net: eth-uclass: ...
588
  	eth_write_hwaddr(dev);
db9391e16   Simon Glass   net: Move driver-...
589
590
591
592
593
594
595
596
597
598
  	return 0;
  }
  
  static int eth_pre_remove(struct udevice *dev)
  {
  	struct eth_pdata *pdata = dev->platdata;
  
  	eth_get_ops(dev)->stop(dev);
  
  	/* clear the MAC address */
a40db6d51   oliver@schinagl.nl   net: cosmetic: Do...
599
  	memset(pdata->enetaddr, 0, ARP_HLEN);
db9391e16   Simon Glass   net: Move driver-...
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
  
  	return 0;
  }
  
  UCLASS_DRIVER(eth) = {
  	.name		= "eth",
  	.id		= UCLASS_ETH,
  	.post_bind	= eth_post_bind,
  	.pre_unbind	= eth_pre_unbind,
  	.post_probe	= eth_post_probe,
  	.pre_remove	= eth_pre_remove,
  	.priv_auto_alloc_size = sizeof(struct eth_uclass_priv),
  	.per_device_auto_alloc_size = sizeof(struct eth_device_priv),
  	.flags		= DM_UC_FLAG_SEQ_ALIAS,
  };