OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --- a/drivers/net/ethernet/dec/tulip/tulip_core.c |
2 | +++ b/drivers/net/ethernet/dec/tulip/tulip_core.c |
||
3 | @@ -206,6 +206,7 @@ struct tulip_chip_table tulip_tbl[] = { |
||
4 | }; |
||
5 | |||
6 | |||
7 | +#ifdef CONFIG_TULIP_PCI |
||
8 | static const struct pci_device_id tulip_pci_tbl[] = { |
||
9 | { 0x1011, 0x0009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21140 }, |
||
10 | { 0x1011, 0x0019, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21143 }, |
||
11 | @@ -249,7 +250,7 @@ static const struct pci_device_id tulip_ |
||
12 | { } /* terminate list */ |
||
13 | }; |
||
14 | MODULE_DEVICE_TABLE(pci, tulip_pci_tbl); |
||
15 | - |
||
16 | +#endif |
||
17 | |||
18 | /* A full-duplex map for media types. */ |
||
19 | const char tulip_media_cap[32] = |
||
20 | @@ -267,11 +268,14 @@ static void tulip_down(struct net_device |
||
21 | static struct net_device_stats *tulip_get_stats(struct net_device *dev); |
||
22 | static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
||
23 | static void set_rx_mode(struct net_device *dev); |
||
24 | +#ifdef CONFIG_TULIP_PCI |
||
25 | static void tulip_set_wolopts(struct pci_dev *pdev, u32 wolopts); |
||
26 | +#endif |
||
27 | #ifdef CONFIG_NET_POLL_CONTROLLER |
||
28 | static void poll_tulip(struct net_device *dev); |
||
29 | #endif |
||
30 | |||
31 | +#ifdef CONFIG_TULIP_PCI |
||
32 | static void tulip_set_power_state (struct tulip_private *tp, |
||
33 | int sleep, int snooze) |
||
34 | { |
||
35 | @@ -288,7 +292,7 @@ static void tulip_set_power_state (struc |
||
36 | } |
||
37 | |||
38 | } |
||
39 | - |
||
40 | +#endif |
||
41 | |||
42 | static void tulip_up(struct net_device *dev) |
||
43 | { |
||
44 | @@ -302,6 +306,7 @@ static void tulip_up(struct net_device * |
||
45 | napi_enable(&tp->napi); |
||
46 | #endif |
||
47 | |||
48 | +#ifdef CONFIG_TULIP_PCI |
||
49 | /* Wake the chip from sleep/snooze mode. */ |
||
50 | tulip_set_power_state (tp, 0, 0); |
||
51 | |||
52 | @@ -309,6 +314,7 @@ static void tulip_up(struct net_device * |
||
53 | pci_enable_wake(tp->pdev, PCI_D3hot, 0); |
||
54 | pci_enable_wake(tp->pdev, PCI_D3cold, 0); |
||
55 | tulip_set_wolopts(tp->pdev, 0); |
||
56 | +#endif |
||
57 | |||
58 | /* On some chip revs we must set the MII/SYM port before the reset!? */ |
||
59 | if (tp->mii_cnt || (tp->mtable && tp->mtable->has_mii)) |
||
60 | @@ -316,18 +322,22 @@ static void tulip_up(struct net_device * |
||
61 | |||
62 | /* Reset the chip, holding bit 0 set at least 50 PCI cycles. */ |
||
63 | iowrite32(0x00000001, ioaddr + CSR0); |
||
64 | +#ifdef CONFIG_TULIP_PCI |
||
65 | pci_read_config_dword(tp->pdev, PCI_COMMAND, ®); /* flush write */ |
||
66 | +#endif |
||
67 | udelay(100); |
||
68 | |||
69 | /* Deassert reset. |
||
70 | Wait the specified 50 PCI cycles after a reset by initializing |
||
71 | Tx and Rx queues and the address filter list. */ |
||
72 | iowrite32(tp->csr0, ioaddr + CSR0); |
||
73 | +#ifdef CONFIG_TULIP_PCI |
||
74 | pci_read_config_dword(tp->pdev, PCI_COMMAND, ®); /* flush write */ |
||
75 | +#endif |
||
76 | udelay(100); |
||
77 | |||
78 | if (tulip_debug > 1) |
||
79 | - netdev_dbg(dev, "tulip_up(), irq==%d\n", tp->pdev->irq); |
||
80 | + netdev_dbg(dev, "tulip_up(), irq==%d\n", tp->irq); |
||
81 | |||
82 | iowrite32(tp->rx_ring_dma, ioaddr + CSR3); |
||
83 | iowrite32(tp->tx_ring_dma, ioaddr + CSR4); |
||
84 | @@ -361,9 +371,11 @@ static void tulip_up(struct net_device * |
||
85 | *setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1]; |
||
86 | *setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2]; |
||
87 | |||
88 | +#ifdef CONFIG_TULIP_PCI |
||
89 | mapping = pci_map_single(tp->pdev, tp->setup_frame, |
||
90 | sizeof(tp->setup_frame), |
||
91 | PCI_DMA_TODEVICE); |
||
92 | +#endif |
||
93 | tp->tx_buffers[tp->cur_tx].skb = NULL; |
||
94 | tp->tx_buffers[tp->cur_tx].mapping = mapping; |
||
95 | |||
96 | @@ -519,7 +531,7 @@ tulip_open(struct net_device *dev) |
||
97 | |||
98 | tulip_init_ring (dev); |
||
99 | |||
100 | - retval = request_irq(tp->pdev->irq, tulip_interrupt, IRQF_SHARED, |
||
101 | + retval = request_irq(tp->irq, tulip_interrupt, IRQF_SHARED, |
||
102 | dev->name, dev); |
||
103 | if (retval) |
||
104 | goto free_ring; |
||
105 | @@ -643,8 +655,10 @@ static void tulip_init_ring(struct net_d |
||
106 | tp->rx_buffers[i].skb = skb; |
||
107 | if (skb == NULL) |
||
108 | break; |
||
109 | +#ifdef CONFIG_TULIP_PCI |
||
110 | mapping = pci_map_single(tp->pdev, skb->data, |
||
111 | PKT_BUF_SZ, PCI_DMA_FROMDEVICE); |
||
112 | +#endif |
||
113 | tp->rx_buffers[i].mapping = mapping; |
||
114 | tp->rx_ring[i].status = cpu_to_le32(DescOwned); /* Owned by Tulip chip */ |
||
115 | tp->rx_ring[i].buffer1 = cpu_to_le32(mapping); |
||
116 | @@ -677,8 +691,10 @@ tulip_start_xmit(struct sk_buff *skb, st |
||
117 | entry = tp->cur_tx % TX_RING_SIZE; |
||
118 | |||
119 | tp->tx_buffers[entry].skb = skb; |
||
120 | +#ifdef CONFIG_TULIP_PCI |
||
121 | mapping = pci_map_single(tp->pdev, skb->data, |
||
122 | skb->len, PCI_DMA_TODEVICE); |
||
123 | +#endif |
||
124 | tp->tx_buffers[entry].mapping = mapping; |
||
125 | tp->tx_ring[entry].buffer1 = cpu_to_le32(mapping); |
||
126 | |||
127 | @@ -729,16 +745,19 @@ static void tulip_clean_tx_ring(struct t |
||
128 | if (tp->tx_buffers[entry].skb == NULL) { |
||
129 | /* test because dummy frames not mapped */ |
||
130 | if (tp->tx_buffers[entry].mapping) |
||
131 | +#ifdef CONFIG_TULIP_PCI |
||
132 | pci_unmap_single(tp->pdev, |
||
133 | tp->tx_buffers[entry].mapping, |
||
134 | sizeof(tp->setup_frame), |
||
135 | PCI_DMA_TODEVICE); |
||
136 | +#endif |
||
137 | continue; |
||
138 | } |
||
139 | - |
||
140 | +#ifdef CONFIG_TULIP_PCI |
||
141 | pci_unmap_single(tp->pdev, tp->tx_buffers[entry].mapping, |
||
142 | tp->tx_buffers[entry].skb->len, |
||
143 | PCI_DMA_TODEVICE); |
||
144 | +#endif |
||
145 | |||
146 | /* Free the original skb. */ |
||
147 | dev_kfree_skb_irq(tp->tx_buffers[entry].skb); |
||
148 | @@ -789,7 +808,9 @@ static void tulip_down (struct net_devic |
||
149 | dev->if_port = tp->saved_if_port; |
||
150 | |||
151 | /* Leave the driver in snooze, not sleep, mode. */ |
||
152 | +#ifdef CONFIG_TULIP_PCI |
||
153 | tulip_set_power_state (tp, 0, 1); |
||
154 | +#endif |
||
155 | } |
||
156 | |||
157 | static void tulip_free_ring (struct net_device *dev) |
||
158 | @@ -810,8 +831,10 @@ static void tulip_free_ring (struct net_ |
||
159 | /* An invalid address. */ |
||
160 | tp->rx_ring[i].buffer1 = cpu_to_le32(0xBADF00D0); |
||
161 | if (skb) { |
||
162 | +#ifdef CONFIG_TULIP_PCI |
||
163 | pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ, |
||
164 | PCI_DMA_FROMDEVICE); |
||
165 | +#endif |
||
166 | dev_kfree_skb (skb); |
||
167 | } |
||
168 | } |
||
169 | @@ -820,8 +843,10 @@ static void tulip_free_ring (struct net_ |
||
170 | struct sk_buff *skb = tp->tx_buffers[i].skb; |
||
171 | |||
172 | if (skb != NULL) { |
||
173 | +#ifdef CONFIG_TULIP_PCI |
||
174 | pci_unmap_single(tp->pdev, tp->tx_buffers[i].mapping, |
||
175 | skb->len, PCI_DMA_TODEVICE); |
||
176 | +#endif |
||
177 | dev_kfree_skb (skb); |
||
178 | } |
||
179 | tp->tx_buffers[i].skb = NULL; |
||
180 | @@ -842,7 +867,7 @@ static int tulip_close (struct net_devic |
||
181 | netdev_dbg(dev, "Shutting down ethercard, status was %02x\n", |
||
182 | ioread32 (ioaddr + CSR5)); |
||
183 | |||
184 | - free_irq (tp->pdev->irq, dev); |
||
185 | + free_irq (tp->irq, dev); |
||
186 | |||
187 | tulip_free_ring (dev); |
||
188 | |||
189 | @@ -873,7 +898,9 @@ static void tulip_get_drvinfo(struct net |
||
190 | struct tulip_private *np = netdev_priv(dev); |
||
191 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
||
192 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
||
193 | +#ifdef CONFIG_TULIP_PCI |
||
194 | strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info)); |
||
195 | +#endif |
||
196 | } |
||
197 | |||
198 | |||
199 | @@ -886,7 +913,9 @@ static int tulip_ethtool_set_wol(struct |
||
200 | return -EOPNOTSUPP; |
||
201 | |||
202 | tp->wolinfo.wolopts = wolinfo->wolopts; |
||
203 | - device_set_wakeup_enable(&tp->pdev->dev, tp->wolinfo.wolopts); |
||
204 | +#ifdef CONFIG_TULIP_PCI |
||
205 | + device_set_wakeup_enable(tp->kdev, tp->wolinfo.wolopts); |
||
206 | +#endif |
||
207 | return 0; |
||
208 | } |
||
209 | |||
210 | @@ -1164,9 +1193,11 @@ static void set_rx_mode(struct net_devic |
||
211 | |||
212 | tp->tx_buffers[entry].skb = NULL; |
||
213 | tp->tx_buffers[entry].mapping = |
||
214 | +#ifdef CONFIG_TULIP_PCI |
||
215 | pci_map_single(tp->pdev, tp->setup_frame, |
||
216 | sizeof(tp->setup_frame), |
||
217 | PCI_DMA_TODEVICE); |
||
218 | +#endif |
||
219 | /* Put the setup frame on the Tx list. */ |
||
220 | if (entry == TX_RING_SIZE-1) |
||
221 | tx_flags |= DESC_RING_WRAP; /* Wrap ring. */ |
||
222 | @@ -1263,19 +1294,22 @@ out: |
||
223 | netdev_dbg(dev, "MWI config cacheline=%d, csr0=%08x\n", |
||
224 | cache, csr0); |
||
225 | } |
||
226 | -#endif |
||
227 | |||
228 | /* |
||
229 | * Chips that have the MRM/reserved bit quirk and the burst quirk. That |
||
230 | * is the DM910X and the on chip ULi devices |
||
231 | */ |
||
232 | +#endif |
||
233 | |||
234 | +#ifdef CONFIG_TULIP_PCI |
||
235 | static int tulip_uli_dm_quirk(struct pci_dev *pdev) |
||
236 | { |
||
237 | if (pdev->vendor == 0x1282 && pdev->device == 0x9102) |
||
238 | return 1; |
||
239 | return 0; |
||
240 | } |
||
241 | +#endif |
||
242 | + |
||
243 | |||
244 | static const struct net_device_ops tulip_netdev_ops = { |
||
245 | .ndo_open = tulip_open, |
||
246 | @@ -1293,6 +1327,7 @@ static const struct net_device_ops tulip |
||
247 | #endif |
||
248 | }; |
||
249 | |||
250 | +#ifdef CONFIG_TULIP_PCI |
||
251 | const struct pci_device_id early_486_chipsets[] = { |
||
252 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82424) }, |
||
253 | { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_496) }, |
||
254 | @@ -1470,6 +1505,8 @@ static int tulip_init_one(struct pci_dev |
||
255 | } |
||
256 | } |
||
257 | tp->pdev = pdev; |
||
258 | + tp->kdev = &pdev->dev; |
||
259 | + tp->irq = irq; |
||
260 | tp->base_addr = ioaddr; |
||
261 | tp->revision = pdev->revision; |
||
262 | tp->csr0 = csr0; |
||
263 | @@ -1800,6 +1837,7 @@ err_out_free_netdev: |
||
264 | } |
||
265 | |||
266 | |||
267 | +#ifdef CONFIG_TULIP_PCI |
||
268 | /* set the registers according to the given wolopts */ |
||
269 | static void tulip_set_wolopts (struct pci_dev *pdev, u32 wolopts) |
||
270 | { |
||
271 | @@ -1828,6 +1866,7 @@ static void tulip_set_wolopts (struct pc |
||
272 | iowrite32(tmp, ioaddr + CSR13); |
||
273 | } |
||
274 | } |
||
275 | +#endif |
||
276 | |||
277 | #ifdef CONFIG_PM |
||
278 | |||
279 | @@ -1942,6 +1981,7 @@ static void tulip_remove_one(struct pci_ |
||
280 | |||
281 | /* pci_power_off (pdev, -1); */ |
||
282 | } |
||
283 | +#endif /* CONFIG_TULIP_PCI */ |
||
284 | |||
285 | #ifdef CONFIG_NET_POLL_CONTROLLER |
||
286 | /* |
||
287 | @@ -1963,7 +2003,8 @@ static void poll_tulip (struct net_devic |
||
288 | } |
||
289 | #endif |
||
290 | |||
291 | -static struct pci_driver tulip_driver = { |
||
292 | +#ifdef CONFIG_TULIP_PCI |
||
293 | +static struct pci_driver tulip_pci_driver = { |
||
294 | .name = DRV_NAME, |
||
295 | .id_table = tulip_pci_tbl, |
||
296 | .probe = tulip_init_one, |
||
297 | @@ -1973,10 +2014,12 @@ static struct pci_driver tulip_driver = |
||
298 | .resume = tulip_resume, |
||
299 | #endif /* CONFIG_PM */ |
||
300 | }; |
||
301 | +#endif |
||
302 | |||
303 | |||
304 | static int __init tulip_init (void) |
||
305 | { |
||
306 | + int ret = 0; |
||
307 | #ifdef MODULE |
||
308 | pr_info("%s", version); |
||
309 | #endif |
||
310 | @@ -1992,13 +2035,18 @@ static int __init tulip_init (void) |
||
311 | tulip_max_interrupt_work = max_interrupt_work; |
||
312 | |||
313 | /* probe for and init boards */ |
||
314 | - return pci_register_driver(&tulip_driver); |
||
315 | +#ifdef CONFIG_TULIP_PCI |
||
316 | + ret = pci_register_driver(&tulip_pci_driver); |
||
317 | +#endif |
||
318 | + return ret; |
||
319 | } |
||
320 | |||
321 | |||
322 | static void __exit tulip_cleanup (void) |
||
323 | { |
||
324 | - pci_unregister_driver (&tulip_driver); |
||
325 | +#ifdef CONFIG_TULIP_PCI |
||
326 | + pci_unregister_driver (&tulip_pci_driver); |
||
327 | +#endif |
||
328 | } |
||
329 | |||
330 | |||
331 | --- a/drivers/net/ethernet/dec/tulip/interrupt.c |
||
332 | +++ b/drivers/net/ethernet/dec/tulip/interrupt.c |
||
333 | @@ -73,10 +73,11 @@ int tulip_refill_rx(struct net_device *d |
||
334 | netdev_alloc_skb(dev, PKT_BUF_SZ); |
||
335 | if (skb == NULL) |
||
336 | break; |
||
337 | - |
||
338 | +#ifdef CONFIG_TULIP_PCI |
||
339 | mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ, |
||
340 | PCI_DMA_FROMDEVICE); |
||
341 | - if (dma_mapping_error(&tp->pdev->dev, mapping)) { |
||
342 | +#endif |
||
343 | + if (dma_mapping_error(tp->kdev, mapping)) { |
||
344 | dev_kfree_skb(skb); |
||
345 | tp->rx_buffers[entry].skb = NULL; |
||
346 | break; |
||
347 | @@ -210,9 +211,11 @@ int tulip_poll(struct napi_struct *napi, |
||
348 | if (pkt_len < tulip_rx_copybreak && |
||
349 | (skb = netdev_alloc_skb(dev, pkt_len + 2)) != NULL) { |
||
350 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
||
351 | +#ifdef CONFIG_TULIP_PCI |
||
352 | pci_dma_sync_single_for_cpu(tp->pdev, |
||
353 | tp->rx_buffers[entry].mapping, |
||
354 | pkt_len, PCI_DMA_FROMDEVICE); |
||
355 | +#endif |
||
356 | #if ! defined(__alpha__) |
||
357 | skb_copy_to_linear_data(skb, tp->rx_buffers[entry].skb->data, |
||
358 | pkt_len); |
||
359 | @@ -222,9 +225,11 @@ int tulip_poll(struct napi_struct *napi, |
||
360 | tp->rx_buffers[entry].skb->data, |
||
361 | pkt_len); |
||
362 | #endif |
||
363 | +#ifdef CONFIG_TULIP_PCI |
||
364 | pci_dma_sync_single_for_device(tp->pdev, |
||
365 | tp->rx_buffers[entry].mapping, |
||
366 | pkt_len, PCI_DMA_FROMDEVICE); |
||
367 | +#endif |
||
368 | } else { /* Pass up the skb already on the Rx ring. */ |
||
369 | char *temp = skb_put(skb = tp->rx_buffers[entry].skb, |
||
370 | pkt_len); |
||
371 | @@ -239,9 +244,10 @@ int tulip_poll(struct napi_struct *napi, |
||
372 | skb->head, temp); |
||
373 | } |
||
374 | #endif |
||
375 | - |
||
376 | +#ifdef CONFIG_TULIP_PCI |
||
377 | pci_unmap_single(tp->pdev, tp->rx_buffers[entry].mapping, |
||
378 | PKT_BUF_SZ, PCI_DMA_FROMDEVICE); |
||
379 | +#endif |
||
380 | |||
381 | tp->rx_buffers[entry].skb = NULL; |
||
382 | tp->rx_buffers[entry].mapping = 0; |
||
383 | @@ -597,10 +603,12 @@ irqreturn_t tulip_interrupt(int irq, voi |
||
384 | if (tp->tx_buffers[entry].skb == NULL) { |
||
385 | /* test because dummy frames not mapped */ |
||
386 | if (tp->tx_buffers[entry].mapping) |
||
387 | +#ifdef CONFIG_TULIP_PCI |
||
388 | pci_unmap_single(tp->pdev, |
||
389 | tp->tx_buffers[entry].mapping, |
||
390 | sizeof(tp->setup_frame), |
||
391 | PCI_DMA_TODEVICE); |
||
392 | +#endif |
||
393 | continue; |
||
394 | } |
||
395 | |||
396 | @@ -628,10 +636,11 @@ irqreturn_t tulip_interrupt(int irq, voi |
||
397 | dev->stats.collisions += (status >> 3) & 15; |
||
398 | dev->stats.tx_packets++; |
||
399 | } |
||
400 | - |
||
401 | +#ifdef CONFIG_TULIP_PCI |
||
402 | pci_unmap_single(tp->pdev, tp->tx_buffers[entry].mapping, |
||
403 | tp->tx_buffers[entry].skb->len, |
||
404 | PCI_DMA_TODEVICE); |
||
405 | +#endif |
||
406 | |||
407 | /* Free the original skb. */ |
||
408 | dev_kfree_skb_irq(tp->tx_buffers[entry].skb); |
||
409 | --- a/drivers/net/ethernet/dec/tulip/Kconfig |
||
410 | +++ b/drivers/net/ethernet/dec/tulip/Kconfig |
||
411 | @@ -40,8 +40,12 @@ config DE2104X_DSL |
||
412 | Default is 0, and range is 0 to 31. |
||
413 | |||
414 | config TULIP |
||
415 | + tristate |
||
416 | + |
||
417 | +config TULIP_PCI |
||
418 | tristate "DECchip Tulip (dc2114x) PCI support" |
||
419 | depends on PCI |
||
420 | + select TULIP |
||
421 | select CRC32 |
||
422 | ---help--- |
||
423 | This driver is developed for the SMC EtherPower series Ethernet |
||
424 | @@ -58,7 +62,7 @@ config TULIP |
||
425 | |||
426 | config TULIP_MWI |
||
427 | bool "New bus configuration" |
||
428 | - depends on TULIP |
||
429 | + depends on TULIP_PCI |
||
430 | ---help--- |
||
431 | This configures your Tulip card specifically for the card and |
||
432 | system cache line size type you are using. |
||
433 | @@ -69,7 +73,7 @@ config TULIP_MWI |
||
434 | |||
435 | config TULIP_MMIO |
||
436 | bool "Use PCI shared mem for NIC registers" |
||
437 | - depends on TULIP |
||
438 | + depends on TULIP_PCI |
||
439 | ---help--- |
||
440 | Use PCI shared memory for the NIC registers, rather than going through |
||
441 | the Tulip's PIO (programmed I/O ports). Faster, but could produce |
||
442 | --- a/drivers/net/ethernet/dec/tulip/tulip.h |
||
443 | +++ b/drivers/net/ethernet/dec/tulip/tulip.h |
||
444 | @@ -447,6 +447,8 @@ struct tulip_private { |
||
445 | int cur_index; /* Current media index. */ |
||
446 | int saved_if_port; |
||
447 | struct pci_dev *pdev; |
||
448 | + struct device *kdev; |
||
449 | + int irq; |
||
450 | int ttimer; |
||
451 | int susp_rx; |
||
452 | unsigned long nir; |