diff options
author | Greg Ungerer <greg.ungerer@opengear.com> | 2011-09-10 18:40:34 +1000 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2011-09-10 16:10:34 +0200 |
commit | 1e8ff7145c6be51f295d8e235472a6455aee1ac3 (patch) | |
tree | 15ec96b5a54c6b985e79310b9d2ba852c4fda137 /drivers | |
parent | a00e749d5b172b69bcf84e5fee36b2d20ee67b10 (diff) | |
download | u-boot-imx-1e8ff7145c6be51f295d8e235472a6455aee1ac3.zip u-boot-imx-1e8ff7145c6be51f295d8e235472a6455aee1ac3.tar.gz u-boot-imx-1e8ff7145c6be51f295d8e235472a6455aee1ac3.tar.bz2 |
KS8695: convert KS8695 eth driver to CONFIG_MULTI_ETH
Trivial conversion of the ks8695eth driver to a CONFIG_MULTI_ETH type
driver.
Signed-off-by: Greg Ungerer <greg.ungerer@opengear.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ks8695eth.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/drivers/net/ks8695eth.c b/drivers/net/ks8695eth.c index 5ea6e7f..cd36880 100644 --- a/drivers/net/ks8695eth.c +++ b/drivers/net/ks8695eth.c @@ -99,7 +99,7 @@ void ks8695_getmac(void) /****************************************************************************/ -void eth_reset(bd_t *bd) +static int ks8695_eth_init(struct eth_device *dev, bd_t *bd) { int i; @@ -151,21 +151,12 @@ void eth_reset(bd_t *bd) ks8695_write(KS8695_LAN_DMA_RX_START, 0x1); printf("KS8695 ETHERNET: %pM\n", eth_mac); -} - -/****************************************************************************/ - -int eth_init(bd_t *bd) -{ - debug ("%s(%d): eth_init()\n", __FILE__, __LINE__); - - eth_reset(bd); return 0; } /****************************************************************************/ -void eth_halt(void) +static void ks8695_eth_halt(struct eth_device *dev) { debug ("%s(%d): eth_halt()\n", __FILE__, __LINE__); @@ -176,7 +167,7 @@ void eth_halt(void) /****************************************************************************/ -int eth_rx(void) +static int ks8695_eth_recv(struct eth_device *dev) { volatile struct ks8695_rxdesc *dp; int i, len = 0; @@ -199,7 +190,8 @@ int eth_rx(void) /****************************************************************************/ -int eth_send(volatile void *packet, int len) +static int ks8695_eth_send(struct eth_device *dev, volatile void *packet, + int len) { volatile struct ks8695_txdesc *dp; static int next = 0; @@ -224,5 +216,27 @@ int eth_send(volatile void *packet, int len) if (++next >= TXDESCS) next = 0; - return len; + return 0; +} + +/****************************************************************************/ + +int ks8695_eth_initialize(void) +{ + struct eth_device *dev; + + dev = malloc(sizeof(*dev)); + if (dev == NULL) + return -1; + memset(dev, 0, sizeof(*dev)); + + dev->iobase = KS8695_IO_BASE + KS8695_LAN_DMA_TX; + dev->init = ks8695_eth_init; + dev->halt = ks8695_eth_halt; + dev->send = ks8695_eth_send; + dev->recv = ks8695_eth_recv; + strcpy(dev->name, "ks8695eth"); + + eth_register(dev); + return 0; } |