1 The U-Boot Driver Model Project
2 ===============================
5 Marek Vasut <marek.vasut@gmail.com>
11 The networking subsystem already supports multiple devices. Therefore the
12 conversion shall not be very hard.
14 The network subsystem is operated from net/eth.c, which tracks all registered
15 ethernet interfaces and calls their particular functions registered via
18 The eth_register() is called from the network driver initialization function,
19 which in turn is called most often either from "board_net_init()" or
20 "cpu_net_init()". This function has one important argument, which is the
21 "struct eth_device", defined at include/net.h:
24 /* DRIVER: Name of the device */
26 /* DRIVER: MAC address */
27 unsigned char enetaddr[6];
28 /* DRIVER: Register base address */
30 /* CORE: state of the device */
33 /* DRIVER: Device initialization function */
34 int (*init) (struct eth_device*, bd_t*);
35 /* DRIVER: Function for sending packets */
36 int (*send) (struct eth_device*, volatile void* packet, int length);
37 /* DRIVER: Function for receiving packets */
38 int (*recv) (struct eth_device*);
39 /* DRIVER: Function to cease operation of the device */
40 void (*halt) (struct eth_device*);
41 /* DRIVER: Function to send multicast packet (OPTIONAL) */
42 int (*mcast) (struct eth_device*, u32 ip, u8 set);
43 /* DRIVER: Function to change ethernet MAC address */
44 int (*write_hwaddr) (struct eth_device*);
45 /* CORE: Next device in the linked list of devices managed by net core */
46 struct eth_device *next;
47 /* CORE: Device index */
49 /* DRIVER: Driver's private data */
53 This structure defines the particular driver, though also contains elements that
54 should not be exposed to the driver, like core state.
56 Small, but important part of the networking subsystem is the PHY management
57 layer, whose drivers are contained in drivers/net/phy. These drivers register in
58 a very similar manner to network drivers, by calling "phy_register()" with the
59 argument of "struct phy_driver":
62 /* DRIVER: Name of the PHY driver */
64 /* DRIVER: UID of the PHY driver */
66 /* DRIVER: Mask for UID of the PHY driver */
68 /* DRIVER: MMDS of the PHY driver */
70 /* DRIVER: Features the PHY driver supports */
72 /* DRIVER: Initialize the PHY hardware */
73 int (*probe)(struct phy_device *phydev);
74 /* DRIVER: Reconfigure the PHY hardware */
75 int (*config)(struct phy_device *phydev);
76 /* DRIVER: Turn on the PHY hardware, allow it to send/receive */
77 int (*startup)(struct phy_device *phydev);
78 /* DRIVER: Turn off the PHY hardware */
79 int (*shutdown)(struct phy_device *phydev);
80 /* CORE: Allows this driver to be part of list of drivers */
81 struct list_head list;
87 To convert the elements of network subsystem to proper driver model method, the
88 "struct eth_device" will have to be split into multiple components. The first
89 will be a structure defining the driver operations:
91 struct eth_driver_ops {
92 int (*init)(struct instance*, bd_t*);
93 int (*send)(struct instance*, void *packet, int length);
94 int (*recv)(struct instance*);
95 void (*halt)(struct instance*);
96 int (*mcast)(struct instance*, u32 ip, u8 set);
97 int (*write_hwaddr)(struct instance*);
100 Next, there'll be platform data which will be per-driver and will replace the
101 "priv" part of "struct eth_device". Last part will be the per-device core state.
103 With regards to the PHY part of the API, the "struct phy_driver" is almost ready
104 to be used with the new driver model approach. The only change will be the
105 replacement of per-driver initialization functions and removal of
106 "phy_register()" function in favor or driver model approach.
108 III) Analysis of in-tree drivers
109 --------------------------------
111 drivers/net/4xx_enet.c
112 ----------------------
114 This driver uses the standard new networking API, therefore there should be no
115 obstacles throughout the conversion process.
117 drivers/net/altera_tse.c
118 ------------------------
120 This driver uses the standard new networking API, therefore there should be no
121 obstacles throughout the conversion process.
123 drivers/net/armada100_fec.c
124 ---------------------------
126 This driver uses the standard new networking API, therefore there should be no
127 obstacles throughout the conversion process.
129 drivers/net/at91_emac.c
130 -----------------------
132 This driver uses the standard new networking API, therefore there should be no
133 obstacles throughout the conversion process.
135 drivers/net/ax88180.c
136 ---------------------
138 This driver uses the standard new networking API, therefore there should be no
139 obstacles throughout the conversion process.
141 drivers/net/ax88796.c
142 ---------------------
144 This file contains a components of the NE2000 driver, implementing only
145 different parts on the NE2000 clone AX88796. This being no standalone driver,
146 no conversion will be done here.
148 drivers/net/bfin_mac.c
149 ----------------------
151 This driver uses the standard new networking API, therefore there should be no
152 obstacles throughout the conversion process.
154 drivers/net/calxedaxgmac.c
155 --------------------------
157 This driver uses the standard new networking API, therefore there should be no
158 obstacles throughout the conversion process.
163 This driver uses the standard new networking API, therefore there should be no
164 obstacles throughout the conversion process.
166 drivers/net/davinci_emac.c
167 --------------------------
169 This driver uses the standard new networking API, therefore there should be no
170 obstacles throughout the conversion process.
172 drivers/net/dc2114x.c
173 ---------------------
175 This driver uses the standard new networking API, therefore there should be no
176 obstacles throughout the conversion process.
178 drivers/net/designware.c
179 ------------------------
181 This driver uses the standard new networking API, therefore there should be no
182 obstacles throughout the conversion process.
184 drivers/net/dm9000x.c
185 ---------------------
187 This driver uses the standard new networking API, therefore there should be no
188 obstacles throughout the conversion process.
193 This driver uses the standard new networking API, therefore there should be no
194 obstacles throughout the conversion process.
199 This driver uses the standard new networking API, therefore there should be no
200 obstacles throughout the conversion process.
202 drivers/net/e1000_spi.c
203 -----------------------
205 Driver for the SPI bus integrated on the Intel E1000. This is not part of the
208 drivers/net/eepro100.c
209 ----------------------
211 This driver uses the standard new networking API, therefore there should be no
212 obstacles throughout the conversion process.
214 drivers/net/enc28j60.c
215 ----------------------
217 This driver uses the standard new networking API, therefore there should be no
218 obstacles throughout the conversion process.
220 drivers/net/ep93xx_eth.c
221 ------------------------
223 This driver uses the standard new networking API, therefore there should be no
224 obstacles throughout the conversion process.
229 This driver uses the standard new networking API, therefore there should be no
230 obstacles throughout the conversion process.
232 drivers/net/fec_mxc.c
233 ---------------------
235 This driver uses the standard new networking API, therefore there should be no
236 obstacles throughout the conversion process.
238 drivers/net/fsl_mcdmafec.c
239 --------------------------
241 This driver uses the standard new networking API, therefore there should be no
242 obstacles throughout the conversion process.
244 drivers/net/fsl_mdio.c
245 ----------------------
247 This file contains driver for FSL MDIO interface, which is not part of the
250 drivers/net/ftgmac100.c
251 -----------------------
253 This driver uses the standard new networking API, therefore there should be no
254 obstacles throughout the conversion process.
256 drivers/net/ftmac100.c
257 ----------------------
259 This driver uses the standard new networking API, therefore there should be no
260 obstacles throughout the conversion process.
265 This driver uses the standard new networking API, therefore there should be no
266 obstacles throughout the conversion process.
268 drivers/net/inca-ip_sw.c
269 ------------------------
271 This driver uses the standard new networking API, therefore there should be no
272 obstacles throughout the conversion process.
274 drivers/net/ks8695eth.c
275 -----------------------
277 This driver uses the standard new networking API, therefore there should be no
278 obstacles throughout the conversion process.
280 drivers/net/lan91c96.c
281 ----------------------
283 This driver uses the standard new networking API, therefore there should be no
284 obstacles throughout the conversion process.
289 This driver uses the standard new networking API, therefore there should be no
290 obstacles throughout the conversion process.
295 This driver uses the standard new networking API, therefore there should be no
296 obstacles throughout the conversion process.
301 This file contains MII interface driver for MCF FEC.
303 drivers/net/mpc512x_fec.c
304 -------------------------
306 This driver uses the standard new networking API, therefore there should be no
307 obstacles throughout the conversion process.
309 drivers/net/mpc5xxx_fec.c
310 -------------------------
312 This driver uses the standard new networking API, therefore there should be no
313 obstacles throughout the conversion process.
318 This driver uses the standard new networking API, therefore there should be no
319 obstacles throughout the conversion process.
321 drivers/net/natsemi.c
322 ---------------------
324 This driver uses the standard new networking API, therefore there should be no
325 obstacles throughout the conversion process.
327 drivers/net/ne2000_base.c
328 -------------------------
330 This driver uses the standard new networking API, therefore there should be no
331 obstacles throughout the conversion process. This driver contains the core
332 implementation of NE2000, which needs a few external functions, implemented by
338 This file implements external functions necessary for native NE2000 compatible
339 networking card to work.
341 drivers/net/netconsole.c
342 ------------------------
344 This is actually an STDIO driver.
346 drivers/net/ns8382x.c
347 ---------------------
349 This driver uses the standard new networking API, therefore there should be no
350 obstacles throughout the conversion process.
355 This driver uses the standard new networking API, therefore there should be no
356 obstacles throughout the conversion process.
358 drivers/net/plb2800_eth.c
359 -------------------------
361 This driver uses the standard new networking API, therefore there should be no
362 obstacles throughout the conversion process.
364 drivers/net/rtl8139.c
365 ---------------------
367 This driver uses the standard new networking API, therefore there should be no
368 obstacles throughout the conversion process.
370 drivers/net/rtl8169.c
371 ---------------------
373 This driver uses the standard new networking API, therefore there should be no
374 obstacles throughout the conversion process.
379 This driver uses the standard new networking API, therefore there should be no
380 obstacles throughout the conversion process.
382 drivers/net/smc91111.c
383 ----------------------
385 This driver uses the standard new networking API, therefore there should be no
386 obstacles throughout the conversion process.
388 drivers/net/smc911x.c
389 ---------------------
391 This driver uses the standard new networking API, therefore there should be no
392 obstacles throughout the conversion process.
397 This driver uses the standard new networking API, therefore there should be no
398 obstacles throughout the conversion process.
400 drivers/net/tsi108_eth.c
401 ------------------------
403 This driver uses the standard new networking API, therefore there should be no
404 obstacles throughout the conversion process.
406 drivers/net/uli526x.c
407 ---------------------
409 This driver uses the standard new networking API, therefore there should be no
410 obstacles throughout the conversion process.
412 drivers/net/vsc7385.c
413 ---------------------
415 This is a driver that only uploads firmware to a switch. This is not subject
418 drivers/net/xilinx_axi_emac.c
419 -----------------------------
421 This driver uses the standard new networking API, therefore there should be no
422 obstacles throughout the conversion process.
424 drivers/net/xilinx_emaclite.c
425 -----------------------------
427 This driver uses the standard new networking API, therefore there should be no
428 obstacles throughout the conversion process.