1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * (C) Copyright 2008
4  * Benjamin Warren, biggerbadderben@gmail.com
5  */
6 
7 /*
8  * netdev.h - definitions an prototypes for network devices
9  */
10 
11 #ifndef _NETDEV_H_
12 #define _NETDEV_H_
13 #include <phy_interface.h>
14 
15 struct udevice;
16 
17 /*
18  * Board and CPU-specific initialization functions
19  * board_eth_init() has highest priority.  cpu_eth_init() only
20  * gets called if board_eth_init() isn't instantiated or fails.
21  * Return values:
22  *      0: success
23  *     -1: failure
24  */
25 
26 int board_eth_init(struct bd_info *bis);
27 int board_interface_eth_init(struct udevice *dev,
28 			     phy_interface_t interface_type);
29 int cpu_eth_init(struct bd_info *bis);
30 
31 /* Driver initialization prototypes */
32 int at91emac_register(struct bd_info *bis, unsigned long iobase);
33 int ax88180_initialize(struct bd_info *bis);
34 int bcm_sf2_eth_register(struct bd_info *bis, u8 dev_num);
35 int bfin_EMAC_initialize(struct bd_info *bis);
36 int cs8900_initialize(u8 dev_num, int base_addr);
37 int dc21x4x_initialize(struct bd_info *bis);
38 int designware_initialize(ulong base_addr, u32 interface);
39 int dm9000_initialize(struct bd_info *bis);
40 int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr);
41 int e1000_initialize(struct bd_info *bis);
42 int eepro100_initialize(struct bd_info *bis);
43 int ep93xx_eth_initialize(u8 dev_num, int base_addr);
44 int eth_3com_initialize (struct bd_info * bis);
45 int ethoc_initialize(u8 dev_num, int base_addr);
46 int fec_initialize (struct bd_info *bis);
47 int fecmxc_initialize(struct bd_info *bis);
48 int fecmxc_initialize_multi(struct bd_info *bis, int dev_id, int phy_id,
49 			    uint32_t addr);
50 int ftmac100_initialize(struct bd_info *bits);
51 int ftmac110_initialize(struct bd_info *bits);
52 void gt6426x_eth_initialize(struct bd_info *bis);
53 int ks8851_mll_initialize(u8 dev_num, int base_addr);
54 int lan91c96_initialize(u8 dev_num, int base_addr);
55 int lpc32xx_eth_initialize(struct bd_info *bis);
56 int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
57 int mcdmafec_initialize(struct bd_info *bis);
58 int mcffec_initialize(struct bd_info *bis);
59 int mvgbe_initialize(struct bd_info *bis);
60 int mvneta_initialize(struct bd_info *bis, int base_addr, int devnum,
61 		      int phy_addr);
62 int natsemi_initialize(struct bd_info *bis);
63 int ne2k_register(void);
64 int npe_initialize(struct bd_info *bis);
65 int ns8382x_initialize(struct bd_info *bis);
66 int pcnet_initialize(struct bd_info *bis);
67 int ppc_4xx_eth_initialize (struct bd_info *bis);
68 int rtl8139_initialize(struct bd_info *bis);
69 int rtl8169_initialize(struct bd_info *bis);
70 int scc_initialize(struct bd_info *bis);
71 int sh_eth_initialize(struct bd_info *bis);
72 int skge_initialize(struct bd_info *bis);
73 int smc91111_initialize(u8 dev_num, int base_addr);
74 int smc911x_initialize(u8 dev_num, int base_addr);
75 int uec_standard_init(struct bd_info *bis);
76 int uli526x_initialize(struct bd_info *bis);
77 int armada100_fec_register(unsigned long base_addr);
78 
79 /* Boards with PCI network controllers can call this from their board_eth_init()
80  * function to initialize whatever's on board.
81  * Return value is total # of devices found */
82 
pci_eth_init(struct bd_info * bis)83 static inline int pci_eth_init(struct bd_info *bis)
84 {
85 	int num = 0;
86 
87 #ifdef CONFIG_PCI
88 
89 #ifdef CONFIG_EEPRO100
90 	num += eepro100_initialize(bis);
91 #endif
92 #ifdef CONFIG_TULIP
93 	num += dc21x4x_initialize(bis);
94 #endif
95 #ifdef CONFIG_E1000
96 	num += e1000_initialize(bis);
97 #endif
98 #ifdef CONFIG_PCNET
99 	num += pcnet_initialize(bis);
100 #endif
101 #ifdef CONFIG_NATSEMI
102 	num += natsemi_initialize(bis);
103 #endif
104 #ifdef CONFIG_NS8382X
105 	num += ns8382x_initialize(bis);
106 #endif
107 #if defined(CONFIG_RTL8139)
108 	num += rtl8139_initialize(bis);
109 #endif
110 #if defined(CONFIG_RTL8169)
111 	num += rtl8169_initialize(bis);
112 #endif
113 #if defined(CONFIG_ULI526X)
114 	num += uli526x_initialize(bis);
115 #endif
116 
117 #endif  /* CONFIG_PCI */
118 	return num;
119 }
120 
121 struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id);
122 
123 #ifdef CONFIG_PHYLIB
124 struct phy_device;
125 int fec_probe(struct bd_info *bd, int dev_id, uint32_t base_addr,
126 		struct mii_dev *bus, struct phy_device *phydev);
127 #else
128 /*
129  * Allow FEC to fine-tune MII configuration on boards which require this.
130  */
131 struct eth_device;
132 int fecmxc_register_mii_postcall(struct eth_device *dev, int (*cb)(int));
133 #endif
134 
135 #endif /* _NETDEV_H_ */
136