summaryrefslogtreecommitdiff
path: root/packages/u-boot/u-boot-1.1.4/u-boot-smc91x-multi.patch
blob: 3f285e34dc64b2748dd1d57692e964306d827dd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
diff -u a/drivers/smc91111.c a/drivers/smc91111.c
--- a/drivers/smc91111.c	2005-03-31 15:43:10.000000000 -0800
+++ a/drivers/smc91111.c	2005-04-13 13:48:41.000000000 -0700
@@ -155,10 +155,14 @@
  .
  .------------------------------------------------------------------  */
 
+#ifndef CONFIG_NET_MULTI
 extern int eth_init(bd_t *bd);
 extern void eth_halt(void);
 extern int eth_rx(void);
 extern int eth_send(volatile void *packet, int length);
+#else
+extern int smc_initialize(bd_t *);
+#endif
 
 
 /*
@@ -797,6 +801,56 @@
 }
 
 
+#ifdef CONFIG_NET_MULTI
+static int smc_multi_init(struct eth_device *, bd_t *);
+static void smc_multi_halt(struct eth_device *);
+static int smc_multi_send(struct eth_device *,volatile void *,int);
+static int smc_multi_recv(struct eth_device *);
+
+extern int smc_initialize(bd_t *bd)
+{
+	struct eth_device *dev;
+
+	dev = (struct eth_device *)malloc(sizeof(struct eth_device));
+	sprintf(dev->name, "SMC91C1111-%d",0);
+	dev->priv = NULL;
+	dev->iobase = SMC_BASE_ADDRESS;
+	dev->init = smc_multi_init;
+	dev->halt = smc_multi_halt;
+	dev->send = smc_multi_send;
+	dev->recv = smc_multi_recv;
+	eth_register(dev);
+
+	return 1; // number of cards detected
+}
+
+static int smc_multi_init(struct eth_device *dev, bd_t *bis)
+{
+	if(dev->priv == NULL)
+	{
+	smc_open(bis);
+		dev->priv = (void *)1;
+	}
+	return 1;
+}
+
+static void smc_multi_halt(struct eth_device *dev)
+{
+	// Not sure when we should actually close...
+	//smc_close();
+}
+
+static int smc_multi_send(struct eth_device *dev, volatile void *packet, int length)
+{
+	return smc_send_packet(packet, length);
+}
+
+static int smc_multi_recv(struct eth_device *dev)
+{
+	return smc_rcv();
+}
+#endif
+
 /*
  * Open and Initialize the board
  *
@@ -1505,6 +1559,7 @@
 }
 #endif
 
+#ifndef CONFIG_NET_MULTI
 int eth_init(bd_t *bd) {
 	return (smc_open(bd));
 }
@@ -1520,6 +1575,7 @@
 int eth_send(volatile void *packet, int length) {
 	return smc_send_packet(packet, length);
 }
+#endif //CONFIG_NET_MULTI
 
 int smc_get_ethaddr (bd_t * bd)
 {
--- a/lib_arm/board.c	2005-03-30 16:39:47.000000000 -0800
+++ a/lib_arm/board.c	2005-03-30 14:26:08.000000000 -0800
@@ -278,6 +278,11 @@
 	/* initialize environment */
 	env_relocate ();
 
+#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI)
+	/* must do after the environment variables are set up */
+	eth_initialize (NULL);
+#endif                                                                                                                                                                                                 
+
 #ifdef CONFIG_VFD
 	/* must do this after the framebuffer is allocated */
 	drv_vfd_init();
--- a/net/eth.c	2004-12-16 09:49:38.000000000 -0800
+++ a/net/eth.c	2005-03-30 17:06:49.000000000 -0800
@@ -53,6 +53,7 @@
 extern int scc_initialize(bd_t*);
 extern int skge_initialize(bd_t*);
 extern int tsec_initialize(bd_t*, int, char *);
+extern int smc_initialize(bd_t*);
 
 static struct eth_device *eth_devices, *eth_current;
 
@@ -196,6 +197,9 @@
 #if defined(CONFIG_RTL8169)
 	rtl8169_initialize(bis);
 #endif
+#if defined(CONFIG_DRIVER_SMC91111)
+	smc_initialize(bis);
+#endif
 
 	if (!eth_devices) {
 		puts ("No ethernet found.\n");