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