Commit 60f61e6d7655400bb785a2ef637581679941f6d1

Authored by Remy Bohmer
Committed by Ben Warren
1 parent 9131589ada
Exists in master and in 55 other branches 8qm-imx_v2020.04_5.4.70_2.3.0, emb_lf_v2022.04, emb_lf_v2023.04, imx_v2015.04_4.1.15_1.0.0_ga, pitx_8mp_lf_v2020.04, smarc-8m-android-10.0.0_2.6.0, smarc-8m-android-11.0.0_2.0.0, smarc-8mp-android-11.0.0_2.0.0, smarc-emmc-imx_v2014.04_3.10.53_1.1.0_ga, smarc-emmc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx-l5.0.0_1.0.0-ga, smarc-imx6_v2018.03_4.14.98_2.0.0_ga, smarc-imx7_v2017.03_4.9.11_1.0.0_ga, smarc-imx7_v2018.03_4.14.98_2.0.0_ga, smarc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx_v2015.04_4.1.15_1.0.0_ga, smarc-imx_v2017.03_4.9.11_1.0.0_ga, smarc-imx_v2017.03_4.9.88_2.0.0_ga, smarc-imx_v2017.03_o8.1.0_1.3.0_8m, smarc-imx_v2018.03_4.14.78_1.0.0_ga, smarc-m6.0.1_2.1.0-ga, smarc-n7.1.2_2.0.0-ga, smarc-rel_imx_4.1.15_2.0.0_ga, smarc_8m-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8m-imx_v2019.04_4.19.35_1.1.0, smarc_8m_00d0-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2019.04_4.19.35_1.1.0, smarc_8mm-imx_v2020.04_5.4.24_2.1.0, smarc_8mp_lf_v2020.04, smarc_8mq-imx_v2020.04_5.4.24_2.1.0, smarc_8mq_lf_v2020.04, ti-u-boot-2015.07, u-boot-2013.01.y, v2013.10, v2013.10-smarct33, v2013.10-smartmen, v2014.01, v2014.04, v2014.04-smarct33, v2014.04-smarct33-emmc, v2014.04-smartmen, v2014.07, v2014.07-smarct33, v2014.07-smartmen, v2015.07-smarct33, v2015.07-smarct33-emmc, v2015.07-smarct4x, v2016.05-dlt, v2016.05-smarct3x, v2016.05-smarct3x-emmc, v2016.05-smarct4x, v2017.01-smarct3x, v2017.01-smarct3x-emmc, v2017.01-smarct4x

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
... ... @@ -88,6 +88,7 @@
88 88 # define _IO_BASE 0
89 89 #endif
90 90  
  91 +#define CONFIG_NET_MULTI 1
91 92 #define CONFIG_DRIVER_DM9000
92 93 #ifdef CONFIG_DRIVER_DM9000
93 94 # define CONFIG_DM9000_BASE (CONFIG_SYS_CS1_BASE | 0x300)
include/configs/at91sam9261ek.h
... ... @@ -131,6 +131,7 @@
131 131 #define CONFIG_SYS_NO_FLASH 1
132 132  
133 133 /* Ethernet */
  134 +#define CONFIG_NET_MULTI 1
134 135 #define CONFIG_DRIVER_DM9000 1
135 136 #define CONFIG_DM9000_BASE 0x30000000
136 137 #define DM9000_IO CONFIG_DM9000_BASE
include/configs/scb9328.h
... ... @@ -255,6 +255,7 @@
255 255 #define CONFIG_SYS_CS5U_VAL 0x00008400
256 256 #define CONFIG_SYS_CS5L_VAL 0x00000D03
257 257  
  258 +#define CONFIG_NET_MULTI 1
258 259 #define CONFIG_DRIVER_DM9000 1
259 260 #define CONFIG_DM9000_BASE 0x16000000
260 261 #define DM9000_IO CONFIG_DM9000_BASE
include/configs/trizepsiv.h
... ... @@ -278,6 +278,7 @@
278 278 #define CONFIG_SYS_MCIO0_VAL 0x00008407
279 279 #define CONFIG_SYS_MCIO1_VAL 0x0000c108
280 280  
  281 +#define CONFIG_NET_MULTI 1
281 282 #define CONFIG_DRIVER_DM9000 1
282 283 #define CONFIG_DM9000_BASE 0x08000000
283 284 #define DM9000_IO CONFIG_DM9000_BASE
... ... @@ -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.