Commit 60f61e6d7655400bb785a2ef637581679941f6d1
Committed by
Ben Warren
1 parent
9131589ada
Exists in
master
and in
55 other branches
Convert DM9000 driver for CONFIG_NET_MULTI
All drivers need to be converted to CONFIG_NET_MULTI. This patch converts the dm9000 driver. Signed-off-by: Thomas Smits <ts.smits@gmail.com> Signed-off-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Showing 10 changed files with 64 additions and 17 deletions Side-by-side Diff
board/atmel/at91sam9261ek/at91sam9261ek.c
... | ... | @@ -36,6 +36,7 @@ |
36 | 36 | #include <atmel_lcdc.h> |
37 | 37 | #if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_DRIVER_DM9000) |
38 | 38 | #include <net.h> |
39 | +#include <netdev.h> | |
39 | 40 | #endif |
40 | 41 | |
41 | 42 | DECLARE_GLOBAL_DATA_PTR; |
... | ... | @@ -227,6 +228,12 @@ |
227 | 228 | return 0; |
228 | 229 | } |
229 | 230 | |
231 | +#ifdef CONFIG_DRIVER_DM9000 | |
232 | + int board_eth_init(bd_t *bis) | |
233 | + { | |
234 | + return dm9000_initialize(bis); | |
235 | + } | |
236 | + #endif | |
230 | 237 | int dram_init(void) |
231 | 238 | { |
232 | 239 | gd->bd->bi_dram[0].start = PHYS_SDRAM; |
board/freescale/m5253demo/m5253demo.c
... | ... | @@ -26,6 +26,7 @@ |
26 | 26 | |
27 | 27 | #include <common.h> |
28 | 28 | #include <asm/immap.h> |
29 | +#include <netdev.h> | |
29 | 30 | |
30 | 31 | int checkboard(void) |
31 | 32 | { |
... | ... | @@ -138,4 +139,12 @@ |
138 | 139 | } |
139 | 140 | } |
140 | 141 | #endif /* CONFIG_CMD_IDE */ |
142 | + | |
143 | + | |
144 | +#ifdef CONFIG_DRIVER_DM9000 | |
145 | +int board_eth_init(bd_t *bis) | |
146 | +{ | |
147 | + return dm9000_initialize(bis); | |
148 | +} | |
149 | +#endif |
board/scb9328/scb9328.c
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | */ |
20 | 20 | |
21 | 21 | #include <common.h> |
22 | +#include <netdev.h> | |
22 | 23 | |
23 | 24 | DECLARE_GLOBAL_DATA_PTR; |
24 | 25 | |
... | ... | @@ -70,4 +71,11 @@ |
70 | 71 | { |
71 | 72 | return; |
72 | 73 | } |
74 | + | |
75 | +#ifdef CONFIG_DRIVER_DM9000 | |
76 | +int board_eth_init(bd_t *bis) | |
77 | +{ | |
78 | + return dm9000_initialize(bis); | |
79 | +} | |
80 | +#endif |
board/trizepsiv/conxs.c
... | ... | @@ -33,6 +33,7 @@ |
33 | 33 | |
34 | 34 | #include <common.h> |
35 | 35 | #include <asm/arch/pxa-regs.h> |
36 | +#include <netdev.h> | |
36 | 37 | |
37 | 38 | DECLARE_GLOBAL_DATA_PTR; |
38 | 39 | |
... | ... | @@ -144,4 +145,11 @@ |
144 | 145 | |
145 | 146 | return 0; |
146 | 147 | } |
148 | + | |
149 | +#ifdef CONFIG_DRIVER_DM9000 | |
150 | +int board_eth_init(bd_t *bis) | |
151 | +{ | |
152 | + return dm9000_initialize(bis); | |
153 | +} | |
154 | +#endif |
drivers/net/dm9000x.c
... | ... | @@ -103,14 +103,12 @@ |
103 | 103 | void (*outblk)(volatile void *data_ptr, int count); |
104 | 104 | void (*inblk)(void *data_ptr, int count); |
105 | 105 | void (*rx_status)(u16 *RxStatus, u16 *RxLen); |
106 | + struct eth_device netdev; | |
106 | 107 | } board_info_t; |
107 | 108 | static board_info_t dm9000_info; |
108 | 109 | |
110 | + | |
109 | 111 | /* function declaration ------------------------------------- */ |
110 | -int eth_init(bd_t * bd); | |
111 | -int eth_send(volatile void *, int); | |
112 | -int eth_rx(void); | |
113 | -void eth_halt(void); | |
114 | 112 | static int dm9000_probe(void); |
115 | 113 | static u16 phy_read(int); |
116 | 114 | static void phy_write(int, u16); |
117 | 115 | |
118 | 116 | |
... | ... | @@ -279,17 +277,16 @@ |
279 | 277 | printf("ERROR: resetting DM9000 -> not responding\n"); |
280 | 278 | } |
281 | 279 | |
282 | -/* Initilize dm9000 board | |
280 | +/* Initialize dm9000 board | |
283 | 281 | */ |
284 | -int | |
285 | -eth_init(bd_t * bd) | |
282 | +static int dm9000_init(struct eth_device *dev, bd_t *bd) | |
286 | 283 | { |
287 | 284 | int i, oft, lnk; |
288 | 285 | u8 io_mode; |
289 | 286 | struct board_info *db = &dm9000_info; |
290 | 287 | uchar enetaddr[6]; |
291 | 288 | |
292 | - DM9000_DBG("eth_init()\n"); | |
289 | + DM9000_DBG("%s\n", __func__); | |
293 | 290 | |
294 | 291 | /* RESET device */ |
295 | 292 | dm9000_reset(); |
296 | 293 | |
... | ... | @@ -411,13 +408,13 @@ |
411 | 408 | Hardware start transmission. |
412 | 409 | Send a packet to media from the upper layer. |
413 | 410 | */ |
414 | -int | |
415 | -eth_send(volatile void *packet, int length) | |
411 | +static int dm9000_send(struct eth_device *netdev, volatile void *packet, | |
412 | + int length) | |
416 | 413 | { |
417 | 414 | int tmo; |
418 | 415 | struct board_info *db = &dm9000_info; |
419 | 416 | |
420 | - DM9000_DMP_PACKET("eth_send", packet, length); | |
417 | + DM9000_DMP_PACKET(__func__ , packet, length); | |
421 | 418 | |
422 | 419 | DM9000_iow(DM9000_ISR, IMR_PTM); /* Clear Tx bit in ISR */ |
423 | 420 | |
424 | 421 | |
... | ... | @@ -453,10 +450,9 @@ |
453 | 450 | Stop the interface. |
454 | 451 | The interface is stopped when it is brought. |
455 | 452 | */ |
456 | -void | |
457 | -eth_halt(void) | |
453 | +static void dm9000_halt(struct eth_device *netdev) | |
458 | 454 | { |
459 | - DM9000_DBG("eth_halt\n"); | |
455 | + DM9000_DBG("%s\n", __func__); | |
460 | 456 | |
461 | 457 | /* RESET devie */ |
462 | 458 | phy_write(0, 0x8000); /* PHY RESET */ |
... | ... | @@ -468,8 +464,7 @@ |
468 | 464 | /* |
469 | 465 | Received a packet and pass to upper layer |
470 | 466 | */ |
471 | -int | |
472 | -eth_rx(void) | |
467 | +static int dm9000_rx(struct eth_device *netdev) | |
473 | 468 | { |
474 | 469 | u8 rxbyte, *rdptr = (u8 *) NetRxPackets[0]; |
475 | 470 | u16 RxStatus, RxLen = 0; |
... | ... | @@ -529,7 +524,7 @@ |
529 | 524 | dm9000_reset(); |
530 | 525 | } |
531 | 526 | } else { |
532 | - DM9000_DMP_PACKET("eth_rx", rdptr, RxLen); | |
527 | + DM9000_DMP_PACKET(__func__ , rdptr, RxLen); | |
533 | 528 | |
534 | 529 | DM9000_DBG("passing packet to upper layer\n"); |
535 | 530 | NetReceive(NetRxPackets[0], RxLen); |
... | ... | @@ -620,5 +615,20 @@ |
620 | 615 | udelay(500); /* Wait write complete */ |
621 | 616 | DM9000_iow(DM9000_EPCR, 0x0); /* Clear phyxcer write command */ |
622 | 617 | DM9000_DBG("phy_write(reg:0x%x, value:0x%x)\n", reg, value); |
618 | +} | |
619 | + | |
620 | +int dm9000_initialize(bd_t *bis) | |
621 | +{ | |
622 | + struct eth_device *dev = &(dm9000_info.netdev); | |
623 | + | |
624 | + dev->init = dm9000_init; | |
625 | + dev->halt = dm9000_halt; | |
626 | + dev->send = dm9000_send; | |
627 | + dev->recv = dm9000_rx; | |
628 | + sprintf(dev->name, "dm9000"); | |
629 | + | |
630 | + eth_register(dev); | |
631 | + | |
632 | + return 0; | |
623 | 633 | } |
include/configs/M5253DEMO.h
include/configs/at91sam9261ek.h
include/configs/scb9328.h
include/configs/trizepsiv.h
include/netdev.h
... | ... | @@ -75,6 +75,7 @@ |
75 | 75 | int uec_initialize(int index); |
76 | 76 | int uli526x_initialize(bd_t *bis); |
77 | 77 | int sh_eth_initialize(bd_t *bis); |
78 | +int dm9000_initialize(bd_t *bis); | |
78 | 79 | |
79 | 80 | /* Boards with PCI network controllers can call this from their board_eth_init() |
80 | 81 | * function to initialize whatever's on board. |