source: rtems/bsps/powerpc/beatnik/net/support/early_link_status.c @ 031df391

5
Last change on this file since 031df391 was 031df391, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 23, 2018 at 7:53:31 AM

bsps: Move legacy network drivers to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 1015 bytes
Line 
1#include <rtems.h>
2#include <bsp/early_enet_link_status.h>
3#include <rtems/bspIo.h>
4
5/* T. Straumann, 2005; see ../../LICENSE */
6
7static const char *ename = ": rtems_em_early_check_link_status() - ";
8
9int
10BSP_early_check_link_status(int unit, rtems_bsdnet_early_link_check_ops *ops)
11{
12int status;
13
14        unit--;
15        if ( unit < 0 || unit >= ops->num_slots ) {
16                printk("%s%sinvalid unit # %i (not in %i..%i)\n",
17                                ops->name, ename, unit+1, 1, ops->num_slots);
18                return -1;
19        }
20
21        if ( !ops->initialized ) {
22                if ( ops->init(unit) ) {
23                        printk("%s%sFAILURE to init hardware\n",ops->name, ename);
24                        return -1;
25                }
26                /* Start autoneg */
27                if ( ops->write_phy(unit, 0, 0x1200) ) {
28                        printk("%s%sFAILURE to start autonegotiation\n",ops->name, ename);
29                        return -1;
30                }
31                /* Dont wait here; the caller can do this on various interfaces
32                 * and wait herself.
33                 */
34                ops->initialized = 1;
35        }
36        if ( (status = ops->read_phy(unit, 1)) < 0 ) {
37                printk("%s%sFAILURE to read phy status\n", ops->name, ename);
38        }
39        return status;
40}
Note: See TracBrowser for help on using the repository browser.