2 * Driver for SysKonnect Gigabit Ethernet Server Adapters.
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
31 #include "h/skdrv1st.h"
32 #include "h/skdrv2nd.h"
33 #include "u-boot_compat.h"
36 #define SKGE_MAX_CARDS 2
39 extern int skge_probe(struct eth_device **);
40 extern void SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs);
41 extern void SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs);
42 extern int SkGeOpen(struct eth_device *);
43 extern int SkGeClose(struct eth_device *);
44 extern int SkGeXmit(struct sk_buff *skb, struct eth_device *dev);
45 extern void ReceiveIrq(SK_AC *pAC, RX_PORT *pRxPort, SK_BOOL SlowPathLock);
47 static int skge_init(struct eth_device *dev, bd_t * bis);
48 static int skge_send(struct eth_device *dev, volatile void *packet, int length);
49 static int skge_recv(struct eth_device *dev);
50 static void skge_halt(struct eth_device *dev);
52 int skge_initialize(bd_t * bis)
55 struct eth_device *dev[SKGE_MAX_CARDS];
57 numdev = skge_probe(&dev[0]);
59 if (numdev > SKGE_MAX_CARDS)
61 printf("ERROR: numdev > SKGE_MAX_CARDS\n");
64 for (i = 0; i < numdev; i++)
66 sprintf (dev[i]->name, "SK98#%d", i);
68 dev[i]->init = skge_init;
69 dev[i]->halt = skge_halt;
70 dev[i]->send = skge_send;
71 dev[i]->recv = skge_recv;
80 static int skge_init(struct eth_device *dev, bd_t * bis)
83 SK_AC * pAC = ((DEV_NET*)dev->priv)->pAC;
88 while (pAC->Rlmt.Port[0].PortState != SK_RLMT_PS_GOING_UP)
90 SkGeIsrOnePort (0, pAC->dev[0], 0);
93 for (i = 0; i < 100; i ++)
102 static void skge_halt(struct eth_device *dev)
108 static int skge_send(struct eth_device *dev, volatile void *packet,
112 struct sk_buff * skb = alloc_skb(length, 0);
116 printf("skge_send: failed to alloc skb\n");
120 memcpy(skb->data, (void*)packet, length);
121 ret = SkGeXmit(skb, dev);
128 static int skge_recv(struct eth_device *dev)
134 pNet = (DEV_NET*) dev->priv;
137 ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE);
143 #endif /* CONFIG_SK98 */