Fix remaining bug of the off-by-one error ;)
[openwrt.git] / target / linux / brcm47xx / patches-2.6.23 / 700-ssb-gigabit-ethernet-driver.patch
1 --- a/drivers/ssb/Kconfig
2 +++ b/drivers/ssb/Kconfig
3 @@ -120,4 +120,13 @@
4
5 If unsure, say N
6
7 +config SSB_DRIVER_GIGE
8 + bool "SSB Broadcom Gigabit Ethernet driver"
9 + depends on SSB_PCIHOST_POSSIBLE && SSB_EMBEDDED && MIPS
10 + help
11 + Driver for the Sonics Silicon Backplane attached
12 + Broadcom Gigabit Ethernet.
13 +
14 + If unsure, say N
15 +
16 endmenu
17 --- a/drivers/ssb/Makefile
18 +++ b/drivers/ssb/Makefile
19 @@ -11,6 +11,7 @@
20 ssb-$(CONFIG_SSB_DRIVER_MIPS) += driver_mipscore.o
21 ssb-$(CONFIG_SSB_DRIVER_EXTIF) += driver_extif.o
22 ssb-$(CONFIG_SSB_DRIVER_PCICORE) += driver_pcicore.o
23 +ssb-$(CONFIG_SSB_DRIVER_GIGE) += driver_gige.o
24
25 # b43 pci-ssb-bridge driver
26 # Not strictly a part of SSB, but kept here for convenience
27 --- /dev/null
28 +++ b/drivers/ssb/driver_gige.c
29 @@ -0,0 +1,294 @@
30 +/*
31 + * Sonics Silicon Backplane
32 + * Broadcom Gigabit Ethernet core driver
33 + *
34 + * Copyright 2008, Broadcom Corporation
35 + * Copyright 2008, Michael Buesch <mb@bu3sch.de>
36 + *
37 + * Licensed under the GNU/GPL. See COPYING for details.
38 + */
39 +
40 +#include <linux/ssb/ssb.h>
41 +#include <linux/ssb/ssb_driver_gige.h>
42 +#include <linux/pci.h>
43 +#include <linux/pci_regs.h>
44 +
45 +
46 +/*
47 +MODULE_DESCRIPTION("SSB Broadcom Gigabit Ethernet driver");
48 +MODULE_AUTHOR("Michael Buesch");
49 +MODULE_LICENSE("GPL");
50 +*/
51 +
52 +static const struct ssb_device_id ssb_gige_tbl[] = {
53 + SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_ETHERNET_GBIT, SSB_ANY_REV),
54 + SSB_DEVTABLE_END
55 +};
56 +/* MODULE_DEVICE_TABLE(ssb, ssb_gige_tbl); */
57 +
58 +
59 +static inline u8 gige_read8(struct ssb_gige *dev, u16 offset)
60 +{
61 + return ssb_read8(dev->dev, offset);
62 +}
63 +
64 +static inline u16 gige_read16(struct ssb_gige *dev, u16 offset)
65 +{
66 + return ssb_read16(dev->dev, offset);
67 +}
68 +
69 +static inline u32 gige_read32(struct ssb_gige *dev, u16 offset)
70 +{
71 + return ssb_read32(dev->dev, offset);
72 +}
73 +
74 +static inline void gige_write8(struct ssb_gige *dev,
75 + u16 offset, u8 value)
76 +{
77 + ssb_write8(dev->dev, offset, value);
78 +}
79 +
80 +static inline void gige_write16(struct ssb_gige *dev,
81 + u16 offset, u16 value)
82 +{
83 + ssb_write16(dev->dev, offset, value);
84 +}
85 +
86 +static inline void gige_write32(struct ssb_gige *dev,
87 + u16 offset, u32 value)
88 +{
89 + ssb_write32(dev->dev, offset, value);
90 +}
91 +
92 +static inline
93 +u8 gige_pcicfg_read8(struct ssb_gige *dev, unsigned int offset)
94 +{
95 + BUG_ON(offset >= 256);
96 + return gige_read8(dev, SSB_GIGE_PCICFG + offset);
97 +}
98 +
99 +static inline
100 +u16 gige_pcicfg_read16(struct ssb_gige *dev, unsigned int offset)
101 +{
102 + BUG_ON(offset >= 256);
103 + return gige_read16(dev, SSB_GIGE_PCICFG + offset);
104 +}
105 +
106 +static inline
107 +u32 gige_pcicfg_read32(struct ssb_gige *dev, unsigned int offset)
108 +{
109 + BUG_ON(offset >= 256);
110 + return gige_read32(dev, SSB_GIGE_PCICFG + offset);
111 +}
112 +
113 +static inline
114 +void gige_pcicfg_write8(struct ssb_gige *dev,
115 + unsigned int offset, u8 value)
116 +{
117 + BUG_ON(offset >= 256);
118 + gige_write8(dev, SSB_GIGE_PCICFG + offset, value);
119 +}
120 +
121 +static inline
122 +void gige_pcicfg_write16(struct ssb_gige *dev,
123 + unsigned int offset, u16 value)
124 +{
125 + BUG_ON(offset >= 256);
126 + gige_write16(dev, SSB_GIGE_PCICFG + offset, value);
127 +}
128 +
129 +static inline
130 +void gige_pcicfg_write32(struct ssb_gige *dev,
131 + unsigned int offset, u32 value)
132 +{
133 + BUG_ON(offset >= 256);
134 + gige_write32(dev, SSB_GIGE_PCICFG + offset, value);
135 +}
136 +
137 +static int ssb_gige_pci_read_config(struct pci_bus *bus, unsigned int devfn,
138 + int reg, int size, u32 *val)
139 +{
140 + struct ssb_gige *dev = container_of(bus->ops, struct ssb_gige, pci_ops);
141 + unsigned long flags;
142 +
143 + if ((PCI_SLOT(devfn) > 0) || (PCI_FUNC(devfn) > 0))
144 + return PCIBIOS_DEVICE_NOT_FOUND;
145 + if (reg >= 256)
146 + return PCIBIOS_DEVICE_NOT_FOUND;
147 +
148 + spin_lock_irqsave(&dev->lock, flags);
149 + switch (size) {
150 + case 1:
151 + *val = gige_pcicfg_read8(dev, reg);
152 + break;
153 + case 2:
154 + *val = gige_pcicfg_read16(dev, reg);
155 + break;
156 + case 4:
157 + *val = gige_pcicfg_read32(dev, reg);
158 + break;
159 + default:
160 + WARN_ON(1);
161 + }
162 + spin_unlock_irqrestore(&dev->lock, flags);
163 +
164 + return PCIBIOS_SUCCESSFUL;
165 +}
166 +
167 +static int ssb_gige_pci_write_config(struct pci_bus *bus, unsigned int devfn,
168 + int reg, int size, u32 val)
169 +{
170 + struct ssb_gige *dev = container_of(bus->ops, struct ssb_gige, pci_ops);
171 + unsigned long flags;
172 +
173 + if ((PCI_SLOT(devfn) > 0) || (PCI_FUNC(devfn) > 0))
174 + return PCIBIOS_DEVICE_NOT_FOUND;
175 + if (reg >= 256)
176 + return PCIBIOS_DEVICE_NOT_FOUND;
177 +
178 + spin_lock_irqsave(&dev->lock, flags);
179 + switch (size) {
180 + case 1:
181 + gige_pcicfg_write8(dev, reg, val);
182 + break;
183 + case 2:
184 + gige_pcicfg_write16(dev, reg, val);
185 + break;
186 + case 4:
187 + gige_pcicfg_write32(dev, reg, val);
188 + break;
189 + default:
190 + WARN_ON(1);
191 + }
192 + spin_unlock_irqrestore(&dev->lock, flags);
193 +
194 + return PCIBIOS_SUCCESSFUL;
195 +}
196 +
197 +static int ssb_gige_probe(struct ssb_device *sdev, const struct ssb_device_id *id)
198 +{
199 + struct ssb_gige *dev;
200 + u32 base, tmslow, tmshigh;
201 +
202 + dev = kzalloc(sizeof(*dev), GFP_KERNEL);
203 + if (!dev)
204 + return -ENOMEM;
205 + dev->dev = sdev;
206 +
207 + spin_lock_init(&dev->lock);
208 + dev->pci_controller.pci_ops = &dev->pci_ops;
209 + dev->pci_controller.io_resource = &dev->io_resource;
210 + dev->pci_controller.mem_resource = &dev->mem_resource;
211 + dev->pci_controller.io_map_base = 0x800;
212 + dev->pci_ops.read = ssb_gige_pci_read_config;
213 + dev->pci_ops.write = ssb_gige_pci_write_config;
214 +
215 + dev->io_resource.name = SSB_GIGE_IO_RES_NAME;
216 + dev->io_resource.start = 0x800;
217 + dev->io_resource.end = 0x8FF;
218 + dev->io_resource.flags = IORESOURCE_IO | IORESOURCE_PCI_FIXED;
219 +
220 + if (!ssb_device_is_enabled(sdev))
221 + ssb_device_enable(sdev, 0);
222 +
223 + /* Setup BAR0. This is a 64k MMIO region. */
224 + base = ssb_admatch_base(ssb_read32(sdev, SSB_ADMATCH1));
225 + gige_pcicfg_write32(dev, PCI_BASE_ADDRESS_0, base);
226 + gige_pcicfg_write32(dev, PCI_BASE_ADDRESS_1, 0);
227 +
228 + dev->mem_resource.name = SSB_GIGE_MEM_RES_NAME;
229 + dev->mem_resource.start = base;
230 + dev->mem_resource.end = base + 0x10000 - 1;
231 + dev->mem_resource.flags = IORESOURCE_MEM | IORESOURCE_PCI_FIXED;
232 +
233 + /* Enable the memory region. */
234 + gige_pcicfg_write16(dev, PCI_COMMAND,
235 + gige_pcicfg_read16(dev, PCI_COMMAND)
236 + | PCI_COMMAND_MEMORY);
237 +
238 + /* Write flushing is controlled by the Flush Status Control register.
239 + * We want to flush every register write with a timeout and we want
240 + * to disable the IRQ mask while flushing to avoid concurrency.
241 + * Note that automatic write flushing does _not_ work from
242 + * an IRQ handler. The driver must flush manually by reading a register.
243 + */
244 + gige_write32(dev, SSB_GIGE_SHIM_FLUSHSTAT, 0x00000068);
245 +
246 + /* Check if we have an RGMII or GMII PHY-bus.
247 + * On RGMII do not bypass the DLLs */
248 + tmslow = ssb_read32(sdev, SSB_TMSLOW);
249 + tmshigh = ssb_read32(sdev, SSB_TMSHIGH);
250 + if (tmshigh & SSB_GIGE_TMSHIGH_RGMII) {
251 + tmslow &= ~SSB_GIGE_TMSLOW_TXBYPASS;
252 + tmslow &= ~SSB_GIGE_TMSLOW_RXBYPASS;
253 + dev->has_rgmii = 1;
254 + } else {
255 + tmslow |= SSB_GIGE_TMSLOW_TXBYPASS;
256 + tmslow |= SSB_GIGE_TMSLOW_RXBYPASS;
257 + dev->has_rgmii = 0;
258 + }
259 + tmslow |= SSB_GIGE_TMSLOW_DLLEN;
260 + ssb_write32(sdev, SSB_TMSLOW, tmslow);
261 +
262 + ssb_set_drvdata(sdev, dev);
263 + register_pci_controller(&dev->pci_controller);
264 +
265 + return 0;
266 +}
267 +
268 +bool pdev_is_ssb_gige_core(struct pci_dev *pdev)
269 +{
270 + if (!pdev->resource[0].name)
271 + return 0;
272 + return (strcmp(pdev->resource[0].name, SSB_GIGE_MEM_RES_NAME) == 0);
273 +}
274 +EXPORT_SYMBOL(pdev_is_ssb_gige_core);
275 +
276 +int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
277 + struct pci_dev *pdev)
278 +{
279 + struct ssb_gige *dev = ssb_get_drvdata(sdev);
280 + struct resource *res;
281 +
282 + if (pdev->bus->ops != &dev->pci_ops) {
283 + /* The PCI device is not on this SSB GigE bridge device. */
284 + return -ENODEV;
285 + }
286 +
287 + /* Fixup the PCI resources. */
288 + res = &(pdev->resource[0]);
289 + res->flags = IORESOURCE_MEM | IORESOURCE_PCI_FIXED;
290 + res->name = dev->mem_resource.name;
291 + res->start = dev->mem_resource.start;
292 + res->end = dev->mem_resource.end;
293 +
294 + /* Fixup interrupt lines. */
295 + pdev->irq = ssb_mips_irq(sdev) + 2;
296 + pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, pdev->irq);
297 +
298 + return 0;
299 +}
300 +
301 +int ssb_gige_map_irq(struct ssb_device *sdev,
302 + const struct pci_dev *pdev)
303 +{
304 + struct ssb_gige *dev = ssb_get_drvdata(sdev);
305 +
306 + if (pdev->bus->ops != &dev->pci_ops) {
307 + /* The PCI device is not on this SSB GigE bridge device. */
308 + return -ENODEV;
309 + }
310 +
311 + return ssb_mips_irq(sdev) + 2;
312 +}
313 +
314 +static struct ssb_driver ssb_gige_driver = {
315 + .name = "BCM-GigE",
316 + .id_table = ssb_gige_tbl,
317 + .probe = ssb_gige_probe,
318 +};
319 +
320 +int ssb_gige_init(void)
321 +{
322 + return ssb_driver_register(&ssb_gige_driver);
323 +}
324 --- /dev/null
325 +++ b/include/linux/ssb/ssb_driver_gige.h
326 @@ -0,0 +1,174 @@
327 +#ifndef LINUX_SSB_DRIVER_GIGE_H_
328 +#define LINUX_SSB_DRIVER_GIGE_H_
329 +
330 +#include <linux/ssb/ssb.h>
331 +#include <linux/pci.h>
332 +#include <linux/spinlock.h>
333 +
334 +
335 +#ifdef CONFIG_SSB_DRIVER_GIGE
336 +
337 +
338 +#define SSB_GIGE_PCIIO 0x0000 /* PCI I/O Registers (1024 bytes) */
339 +#define SSB_GIGE_RESERVED 0x0400 /* Reserved (1024 bytes) */
340 +#define SSB_GIGE_PCICFG 0x0800 /* PCI config space (256 bytes) */
341 +#define SSB_GIGE_SHIM_FLUSHSTAT 0x0C00 /* PCI to OCP: Flush status control (32bit) */
342 +#define SSB_GIGE_SHIM_FLUSHRDA 0x0C04 /* PCI to OCP: Flush read address (32bit) */
343 +#define SSB_GIGE_SHIM_FLUSHTO 0x0C08 /* PCI to OCP: Flush timeout counter (32bit) */
344 +#define SSB_GIGE_SHIM_BARRIER 0x0C0C /* PCI to OCP: Barrier register (32bit) */
345 +#define SSB_GIGE_SHIM_MAOCPSI 0x0C10 /* PCI to OCP: MaocpSI Control (32bit) */
346 +#define SSB_GIGE_SHIM_SIOCPMA 0x0C14 /* PCI to OCP: SiocpMa Control (32bit) */
347 +
348 +/* TM Status High flags */
349 +#define SSB_GIGE_TMSHIGH_RGMII 0x00010000 /* Have an RGMII PHY-bus */
350 +/* TM Status Low flags */
351 +#define SSB_GIGE_TMSLOW_TXBYPASS 0x00080000 /* TX bypass (no delay) */
352 +#define SSB_GIGE_TMSLOW_RXBYPASS 0x00100000 /* RX bypass (no delay) */
353 +#define SSB_GIGE_TMSLOW_DLLEN 0x01000000 /* Enable DLL controls */
354 +
355 +/* Boardflags (low) */
356 +#define SSB_GIGE_BFL_ROBOSWITCH 0x0010
357 +
358 +
359 +#define SSB_GIGE_MEM_RES_NAME "SSB Broadcom 47xx GigE memory"
360 +#define SSB_GIGE_IO_RES_NAME "SSB Broadcom 47xx GigE I/O"
361 +
362 +struct ssb_gige {
363 + struct ssb_device *dev;
364 +
365 + spinlock_t lock;
366 +
367 + /* True, if the device has an RGMII bus.
368 + * False, if the device has a GMII bus. */
369 + bool has_rgmii;
370 +
371 + /* The PCI controller device. */
372 + struct pci_controller pci_controller;
373 + struct pci_ops pci_ops;
374 + struct resource mem_resource;
375 + struct resource io_resource;
376 +};
377 +
378 +/* Check whether a PCI device is a SSB Gigabit Ethernet core. */
379 +extern bool pdev_is_ssb_gige_core(struct pci_dev *pdev);
380 +
381 +/* Convert a pci_dev pointer to a ssb_gige pointer. */
382 +static inline struct ssb_gige * pdev_to_ssb_gige(struct pci_dev *pdev)
383 +{
384 + if (!pdev_is_ssb_gige_core(pdev))
385 + return NULL;
386 + return container_of(pdev->bus->ops, struct ssb_gige, pci_ops);
387 +}
388 +
389 +/* Returns whether the PHY is connected by an RGMII bus. */
390 +static inline bool ssb_gige_is_rgmii(struct pci_dev *pdev)
391 +{
392 + struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
393 + return (dev ? dev->has_rgmii : 0);
394 +}
395 +
396 +/* Returns whether we have a Roboswitch. */
397 +static inline bool ssb_gige_have_roboswitch(struct pci_dev *pdev)
398 +{
399 + struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
400 + if (dev)
401 + return !!(dev->dev->bus->sprom.boardflags_lo &
402 + SSB_GIGE_BFL_ROBOSWITCH);
403 + return 0;
404 +}
405 +
406 +/* Returns whether we can only do one DMA at once. */
407 +static inline bool ssb_gige_one_dma_at_once(struct pci_dev *pdev)
408 +{
409 + struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
410 + if (dev)
411 + return ((dev->dev->bus->chip_id == 0x4785) &&
412 + (dev->dev->bus->chip_rev < 2));
413 + return 0;
414 +}
415 +
416 +/* Returns whether we must flush posted writes. */
417 +static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
418 +{
419 + struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
420 + if (dev)
421 + return (dev->dev->bus->chip_id == 0x4785);
422 + return 0;
423 +}
424 +
425 +extern char * nvram_get(const char *name);
426 +/* Get the device MAC address */
427 +static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
428 +{
429 +#ifdef CONFIG_BCM947XX
430 + char *res = nvram_get("et0macaddr");
431 + if (res)
432 + memcpy(macaddr, res, 6);
433 +#endif
434 +}
435 +
436 +extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
437 + struct pci_dev *pdev);
438 +extern int ssb_gige_map_irq(struct ssb_device *sdev,
439 + const struct pci_dev *pdev);
440 +
441 +/* The GigE driver is not a standalone module, because we don't have support
442 + * for unregistering the driver. So we could not unload the module anyway. */
443 +extern int ssb_gige_init(void);
444 +static inline void ssb_gige_exit(void)
445 +{
446 + /* Currently we can not unregister the GigE driver,
447 + * because we can not unregister the PCI bridge. */
448 + BUG();
449 +}
450 +
451 +
452 +#else /* CONFIG_SSB_DRIVER_GIGE */
453 +/* Gigabit Ethernet driver disabled */
454 +
455 +
456 +static inline int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
457 + struct pci_dev *pdev)
458 +{
459 + return -ENOSYS;
460 +}
461 +static inline int ssb_gige_map_irq(struct ssb_device *sdev,
462 + const struct pci_dev *pdev)
463 +{
464 + return -ENOSYS;
465 +}
466 +static inline int ssb_gige_init(void)
467 +{
468 + return 0;
469 +}
470 +static inline void ssb_gige_exit(void)
471 +{
472 +}
473 +
474 +static inline bool pdev_is_ssb_gige_core(struct pci_dev *pdev)
475 +{
476 + return 0;
477 +}
478 +static inline struct ssb_gige * pdev_to_ssb_gige(struct pci_dev *pdev)
479 +{
480 + return NULL;
481 +}
482 +static inline bool ssb_gige_is_rgmii(struct pci_dev *pdev)
483 +{
484 + return 0;
485 +}
486 +static inline bool ssb_gige_have_roboswitch(struct pci_dev *pdev)
487 +{
488 + return 0;
489 +}
490 +static inline bool ssb_gige_one_dma_at_once(struct pci_dev *pdev)
491 +{
492 + return 0;
493 +}
494 +static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
495 +{
496 + return 0;
497 +}
498 +
499 +#endif /* CONFIG_SSB_DRIVER_GIGE */
500 +#endif /* LINUX_SSB_DRIVER_GIGE_H_ */
501 --- a/drivers/ssb/driver_pcicore.c
502 +++ b/drivers/ssb/driver_pcicore.c
503 @@ -60,74 +60,6 @@
504 /* Core to access the external PCI config space. Can only have one. */
505 static struct ssb_pcicore *extpci_core;
506
507 -static u32 ssb_pcicore_pcibus_iobase = 0x100;
508 -static u32 ssb_pcicore_pcibus_membase = SSB_PCI_DMA;
509 -
510 -int pcibios_plat_dev_init(struct pci_dev *d)
511 -{
512 - struct resource *res;
513 - int pos, size;
514 - u32 *base;
515 -
516 - ssb_printk(KERN_INFO "PCI: Fixing up device %s\n",
517 - pci_name(d));
518 -
519 - /* Fix up resource bases */
520 - for (pos = 0; pos < 6; pos++) {
521 - res = &d->resource[pos];
522 - if (res->flags & IORESOURCE_IO)
523 - base = &ssb_pcicore_pcibus_iobase;
524 - else
525 - base = &ssb_pcicore_pcibus_membase;
526 - res->flags |= IORESOURCE_PCI_FIXED;
527 - if (res->end) {
528 - size = res->end - res->start + 1;
529 - if (*base & (size - 1))
530 - *base = (*base + size) & ~(size - 1);
531 - res->start = *base;
532 - res->end = res->start + size - 1;
533 - *base += size;
534 - pci_write_config_dword(d, PCI_BASE_ADDRESS_0 + (pos << 2), res->start);
535 - }
536 - /* Fix up PCI bridge BAR0 only */
537 - if (d->bus->number == 0 && PCI_SLOT(d->devfn) == 0)
538 - break;
539 - }
540 - /* Fix up interrupt lines */
541 - d->irq = ssb_mips_irq(extpci_core->dev) + 2;
542 - pci_write_config_byte(d, PCI_INTERRUPT_LINE, d->irq);
543 -
544 - return 0;
545 -}
546 -
547 -static void __init ssb_fixup_pcibridge(struct pci_dev *dev)
548 -{
549 - u8 lat;
550 -
551 - if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) != 0)
552 - return;
553 -
554 - ssb_printk(KERN_INFO "PCI: Fixing up bridge %s\n", pci_name(dev));
555 -
556 - /* Enable PCI bridge bus mastering and memory space */
557 - pci_set_master(dev);
558 - pcibios_enable_device(dev, ~0);
559 -
560 - /* Enable PCI bridge BAR1 prefetch and burst */
561 - pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);
562 -
563 - /* Make sure our latency is high enough to handle the devices behind us */
564 - lat = 168;
565 - ssb_printk(KERN_INFO "PCI: Fixing latency timer of device %s to %u\n",
566 - pci_name(dev), lat);
567 - pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
568 -}
569 -DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_fixup_pcibridge);
570 -
571 -int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
572 -{
573 - return ssb_mips_irq(extpci_core->dev) + 2;
574 -}
575
576 static u32 get_cfgspace_addr(struct ssb_pcicore *pc,
577 unsigned int bus, unsigned int dev,
578 @@ -317,6 +249,92 @@
579 .mem_offset = 0x24000000,
580 };
581
582 +static u32 ssb_pcicore_pcibus_iobase = 0x100;
583 +static u32 ssb_pcicore_pcibus_membase = SSB_PCI_DMA;
584 +
585 +/* This function is called when doing a pci_enable_device().
586 + * We must first check if the device is a device on the PCI-core bridge. */
587 +int ssb_pcicore_plat_dev_init(struct pci_dev *d)
588 +{
589 + struct resource *res;
590 + int pos, size;
591 + u32 *base;
592 +
593 + if (d->bus->ops != &ssb_pcicore_pciops) {
594 + /* This is not a device on the PCI-core bridge. */
595 + return -ENODEV;
596 + }
597 +
598 + ssb_printk(KERN_INFO "PCI: Fixing up device %s\n",
599 + pci_name(d));
600 +
601 + /* Fix up resource bases */
602 + for (pos = 0; pos < 6; pos++) {
603 + res = &d->resource[pos];
604 + if (res->flags & IORESOURCE_IO)
605 + base = &ssb_pcicore_pcibus_iobase;
606 + else
607 + base = &ssb_pcicore_pcibus_membase;
608 + res->flags |= IORESOURCE_PCI_FIXED;
609 + if (res->end) {
610 + size = res->end - res->start + 1;
611 + if (*base & (size - 1))
612 + *base = (*base + size) & ~(size - 1);
613 + res->start = *base;
614 + res->end = res->start + size - 1;
615 + *base += size;
616 + pci_write_config_dword(d, PCI_BASE_ADDRESS_0 + (pos << 2), res->start);
617 + }
618 + /* Fix up PCI bridge BAR0 only */
619 + if (d->bus->number == 0 && PCI_SLOT(d->devfn) == 0)
620 + break;
621 + }
622 + /* Fix up interrupt lines */
623 + d->irq = ssb_mips_irq(extpci_core->dev) + 2;
624 + pci_write_config_byte(d, PCI_INTERRUPT_LINE, d->irq);
625 +
626 + return 0;
627 +}
628 +
629 +/* Early PCI fixup for a device on the PCI-core bridge. */
630 +static void ssb_pcicore_fixup_pcibridge(struct pci_dev *dev)
631 +{
632 + u8 lat;
633 +
634 + if (dev->bus->ops != &ssb_pcicore_pciops) {
635 + /* This is not a device on the PCI-core bridge. */
636 + return;
637 + }
638 + if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) != 0)
639 + return;
640 +
641 + ssb_printk(KERN_INFO "PCI: Fixing up bridge %s\n", pci_name(dev));
642 +
643 + /* Enable PCI bridge bus mastering and memory space */
644 + pci_set_master(dev);
645 + pcibios_enable_device(dev, ~0);
646 +
647 + /* Enable PCI bridge BAR1 prefetch and burst */
648 + pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);
649 +
650 + /* Make sure our latency is high enough to handle the devices behind us */
651 + lat = 168;
652 + ssb_printk(KERN_INFO "PCI: Fixing latency timer of device %s to %u\n",
653 + pci_name(dev), lat);
654 + pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
655 +}
656 +DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_pcicore_fixup_pcibridge);
657 +
658 +/* PCI device IRQ mapping. */
659 +int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
660 +{
661 + if (dev->bus->ops != &ssb_pcicore_pciops) {
662 + /* This is not a device on the PCI-core bridge. */
663 + return -ENODEV;
664 + }
665 + return ssb_mips_irq(extpci_core->dev) + 2;
666 +}
667 +
668 static void ssb_pcicore_init_hostmode(struct ssb_pcicore *pc)
669 {
670 u32 val;
671 --- a/drivers/ssb/embedded.c
672 +++ b/drivers/ssb/embedded.c
673 @@ -10,6 +10,9 @@
674
675 #include <linux/ssb/ssb.h>
676 #include <linux/ssb/ssb_embedded.h>
677 +#include <linux/ssb/ssb_driver_pci.h>
678 +#include <linux/ssb/ssb_driver_gige.h>
679 +#include <linux/pci.h>
680
681 #include "ssb_private.h"
682
683 @@ -130,3 +133,90 @@
684 return res;
685 }
686 EXPORT_SYMBOL(ssb_gpio_polarity);
687 +
688 +#ifdef CONFIG_SSB_DRIVER_GIGE
689 +static int gige_pci_init_callback(struct ssb_bus *bus, unsigned long data)
690 +{
691 + struct pci_dev *pdev = (struct pci_dev *)data;
692 + struct ssb_device *dev;
693 + unsigned int i;
694 + int res;
695 +
696 + for (i = 0; i < bus->nr_devices; i++) {
697 + dev = &(bus->devices[i]);
698 + if (dev->id.coreid != SSB_DEV_ETHERNET_GBIT)
699 + continue;
700 + if (!dev->dev ||
701 + !dev->dev->driver ||
702 + !device_is_registered(dev->dev))
703 + continue;
704 + res = ssb_gige_pcibios_plat_dev_init(dev, pdev);
705 + if (res >= 0)
706 + return res;
707 + }
708 +
709 + return -ENODEV;
710 +}
711 +#endif /* CONFIG_SSB_DRIVER_GIGE */
712 +
713 +int ssb_pcibios_plat_dev_init(struct pci_dev *dev)
714 +{
715 + int err;
716 +
717 + err = ssb_pcicore_plat_dev_init(dev);
718 + if (!err)
719 + return 0;
720 +#ifdef CONFIG_SSB_DRIVER_GIGE
721 + err = ssb_for_each_bus_call((unsigned long)dev, gige_pci_init_callback);
722 + if (err >= 0)
723 + return err;
724 +#endif
725 + /* This is not a PCI device on any SSB device. */
726 +
727 + return -ENODEV;
728 +}
729 +
730 +#ifdef CONFIG_SSB_DRIVER_GIGE
731 +static int gige_map_irq_callback(struct ssb_bus *bus, unsigned long data)
732 +{
733 + const struct pci_dev *pdev = (const struct pci_dev *)data;
734 + struct ssb_device *dev;
735 + unsigned int i;
736 + int res;
737 +
738 + for (i = 0; i < bus->nr_devices; i++) {
739 + dev = &(bus->devices[i]);
740 + if (dev->id.coreid != SSB_DEV_ETHERNET_GBIT)
741 + continue;
742 + if (!dev->dev ||
743 + !dev->dev->driver ||
744 + !device_is_registered(dev->dev))
745 + continue;
746 + res = ssb_gige_map_irq(dev, pdev);
747 + if (res >= 0)
748 + return res;
749 + }
750 +
751 + return -ENODEV;
752 +}
753 +#endif /* CONFIG_SSB_DRIVER_GIGE */
754 +
755 +int ssb_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
756 +{
757 + int res;
758 +
759 + /* Check if this PCI device is a device on a SSB bus or device
760 + * and return the IRQ number for it. */
761 +
762 + res = ssb_pcicore_pcibios_map_irq(dev, slot, pin);
763 + if (res >= 0)
764 + return res;
765 +#ifdef CONFIG_SSB_DRIVER_GIGE
766 + res = ssb_for_each_bus_call((unsigned long)dev, gige_map_irq_callback);
767 + if (res >= 0)
768 + return res;
769 +#endif
770 + /* This is not a PCI device on any SSB device. */
771 +
772 + return -ENODEV;
773 +}
774 --- a/include/linux/ssb/ssb.h
775 +++ b/include/linux/ssb/ssb.h
776 @@ -422,5 +422,12 @@
777 extern u32 ssb_admatch_base(u32 adm);
778 extern u32 ssb_admatch_size(u32 adm);
779
780 +/* PCI device mapping and fixup routines.
781 + * Called from the architecture pcibios init code.
782 + * These are only available on SSB_EMBEDDED configurations. */
783 +#ifdef CONFIG_SSB_EMBEDDED
784 +int ssb_pcibios_plat_dev_init(struct pci_dev *dev);
785 +int ssb_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
786 +#endif /* CONFIG_SSB_EMBEDDED */
787
788 #endif /* LINUX_SSB_H_ */
789 --- a/include/linux/ssb/ssb_driver_pci.h
790 +++ b/include/linux/ssb/ssb_driver_pci.h
791 @@ -1,6 +1,11 @@
792 #ifndef LINUX_SSB_PCICORE_H_
793 #define LINUX_SSB_PCICORE_H_
794
795 +#include <linux/types.h>
796 +
797 +struct pci_dev;
798 +
799 +
800 #ifdef CONFIG_SSB_DRIVER_PCICORE
801
802 /* PCI core registers. */
803 @@ -88,6 +93,9 @@
804 extern int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
805 struct ssb_device *dev);
806
807 +int ssb_pcicore_plat_dev_init(struct pci_dev *d);
808 +int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
809 +
810
811 #else /* CONFIG_SSB_DRIVER_PCICORE */
812
813 @@ -107,5 +115,16 @@
814 return 0;
815 }
816
817 +static inline
818 +int ssb_pcicore_plat_dev_init(struct pci_dev *d)
819 +{
820 + return -ENODEV;
821 +}
822 +static inline
823 +int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
824 +{
825 + return -ENODEV;
826 +}
827 +
828 #endif /* CONFIG_SSB_DRIVER_PCICORE */
829 #endif /* LINUX_SSB_PCICORE_H_ */
830 --- a/drivers/ssb/main.c
831 +++ b/drivers/ssb/main.c
832 @@ -14,6 +14,7 @@
833 #include <linux/io.h>
834 #include <linux/ssb/ssb.h>
835 #include <linux/ssb/ssb_regs.h>
836 +#include <linux/ssb/ssb_driver_gige.h>
837 #include <linux/dma-mapping.h>
838 #include <linux/pci.h>
839
840 @@ -68,6 +69,25 @@
841 }
842 #endif /* CONFIG_SSB_PCIHOST */
843
844 +int ssb_for_each_bus_call(unsigned long data,
845 + int (*func)(struct ssb_bus *bus, unsigned long data))
846 +{
847 + struct ssb_bus *bus;
848 + int res;
849 +
850 + ssb_buses_lock();
851 + list_for_each_entry(bus, &buses, list) {
852 + res = func(bus, data);
853 + if (res >= 0) {
854 + ssb_buses_unlock();
855 + return res;
856 + }
857 + }
858 + ssb_buses_unlock();
859 +
860 + return -ENODEV;
861 +}
862 +
863 static struct ssb_device *ssb_device_get(struct ssb_device *dev)
864 {
865 if (dev)
866 @@ -1175,7 +1195,14 @@
867 err = b43_pci_ssb_bridge_init();
868 if (err) {
869 ssb_printk(KERN_ERR "Broadcom 43xx PCI-SSB-bridge "
870 - "initialization failed");
871 + "initialization failed\n");
872 + /* don't fail SSB init because of this */
873 + err = 0;
874 + }
875 + err = ssb_gige_init();
876 + if (err) {
877 + ssb_printk(KERN_ERR "SSB Broadcom Gigabit Ethernet "
878 + "driver initialization failed\n");
879 /* don't fail SSB init because of this */
880 err = 0;
881 }
882 @@ -1189,6 +1216,7 @@
883
884 static void __exit ssb_modexit(void)
885 {
886 + ssb_gige_exit();
887 b43_pci_ssb_bridge_exit();
888 bus_unregister(&ssb_bustype);
889 }
890 --- a/drivers/ssb/ssb_private.h
891 +++ b/drivers/ssb/ssb_private.h
892 @@ -118,6 +118,8 @@
893 extern int ssb_devices_freeze(struct ssb_bus *bus);
894 extern int ssb_devices_thaw(struct ssb_bus *bus);
895 extern struct ssb_bus *ssb_pci_dev_to_bus(struct pci_dev *pdev);
896 +int ssb_for_each_bus_call(unsigned long data,
897 + int (*func)(struct ssb_bus *bus, unsigned long data));
898
899 /* b43_pci_bridge.c */
900 #ifdef CONFIG_SSB_PCIHOST
901 --- a/drivers/net/tg3.c
902 +++ b/drivers/net/tg3.c
903 @@ -38,6 +38,7 @@
904 #include <linux/workqueue.h>
905 #include <linux/prefetch.h>
906 #include <linux/dma-mapping.h>
907 +#include <linux/ssb/ssb_driver_gige.h>
908
909 #include <net/checksum.h>
910 #include <net/ip.h>
911 @@ -410,8 +411,9 @@
912 static inline void tw32_mailbox_flush(struct tg3 *tp, u32 off, u32 val)
913 {
914 tp->write32_mbox(tp, off, val);
915 - if (!(tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) &&
916 - !(tp->tg3_flags2 & TG3_FLG2_ICH_WORKAROUND))
917 + if ((tp->tg3_flags3 & TG3_FLG3_FLUSH_POSTED_WRITES) ||
918 + (!(tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) &&
919 + !(tp->tg3_flags2 & TG3_FLG2_ICH_WORKAROUND)))
920 tp->read32_mbox(tp, off);
921 }
922
923 @@ -623,7 +625,7 @@
924
925 #define PHY_BUSY_LOOPS 5000
926
927 -static int tg3_readphy(struct tg3 *tp, int reg, u32 *val)
928 +static int __tg3_readphy(struct tg3 *tp, unsigned int phy_addr, int reg, u32 *val)
929 {
930 u32 frame_val;
931 unsigned int loops;
932 @@ -637,7 +639,7 @@
933
934 *val = 0x0;
935
936 - frame_val = ((PHY_ADDR << MI_COM_PHY_ADDR_SHIFT) &
937 + frame_val = ((phy_addr << MI_COM_PHY_ADDR_SHIFT) &
938 MI_COM_PHY_ADDR_MASK);
939 frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) &
940 MI_COM_REG_ADDR_MASK);
941 @@ -672,7 +674,12 @@
942 return ret;
943 }
944
945 -static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
946 +static int tg3_readphy(struct tg3 *tp, int reg, u32 *val)
947 +{
948 + return __tg3_readphy(tp, PHY_ADDR, reg, val);
949 +}
950 +
951 +static int __tg3_writephy(struct tg3 *tp, unsigned int phy_addr, int reg, u32 val)
952 {
953 u32 frame_val;
954 unsigned int loops;
955 @@ -688,7 +695,7 @@
956 udelay(80);
957 }
958
959 - frame_val = ((PHY_ADDR << MI_COM_PHY_ADDR_SHIFT) &
960 + frame_val = ((phy_addr << MI_COM_PHY_ADDR_SHIFT) &
961 MI_COM_PHY_ADDR_MASK);
962 frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) &
963 MI_COM_REG_ADDR_MASK);
964 @@ -721,6 +728,11 @@
965 return ret;
966 }
967
968 +static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
969 +{
970 + return __tg3_writephy(tp, PHY_ADDR, reg, val);
971 +}
972 +
973 static void tg3_phy_toggle_automdix(struct tg3 *tp, int enable)
974 {
975 u32 phy;
976 @@ -1988,6 +2000,14 @@
977 tp->link_config.active_duplex = current_duplex;
978 }
979
980 + if (tp->tg3_flags3 & TG3_FLG3_ROBOSWITCH) {
981 + current_link_up = 1;
982 + current_speed = SPEED_1000; //FIXME
983 + current_duplex = DUPLEX_FULL;
984 + tp->link_config.active_speed = current_speed;
985 + tp->link_config.active_duplex = current_duplex;
986 + }
987 +
988 if (current_link_up == 1 &&
989 (tp->link_config.active_duplex == DUPLEX_FULL) &&
990 (tp->link_config.autoneg == AUTONEG_ENABLE)) {
991 @@ -4813,6 +4833,11 @@
992 int i;
993 u32 val;
994
995 + if (tp->tg3_flags3 & TG3_FLG3_IS_SSB_CORE) {
996 + /* We don't use firmware. */
997 + return 0;
998 + }
999 +
1000 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
1001 /* Wait up to 20ms for init done. */
1002 for (i = 0; i < 200; i++) {
1003 @@ -5040,6 +5065,14 @@
1004 tw32(0x5000, 0x400);
1005 }
1006
1007 + if (tp->tg3_flags3 & TG3_FLG3_IS_SSB_CORE) {
1008 + /* BCM4785: In order to avoid repercussions from using potentially
1009 + * defective internal ROM, stop the Rx RISC CPU, which is not
1010 + * required. */
1011 + tg3_stop_fw(tp);
1012 + tg3_halt_cpu(tp, RX_CPU_BASE);
1013 + }
1014 +
1015 tw32(GRC_MODE, tp->grc_mode);
1016
1017 if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A0) {
1018 @@ -5308,9 +5341,12 @@
1019 return -ENODEV;
1020 }
1021
1022 - /* Clear firmware's nvram arbitration. */
1023 - if (tp->tg3_flags & TG3_FLAG_NVRAM)
1024 - tw32(NVRAM_SWARB, SWARB_REQ_CLR0);
1025 + if (!(tp->tg3_flags3 & TG3_FLG3_IS_SSB_CORE)) {
1026 + /* Clear firmware's nvram arbitration. */
1027 + if (tp->tg3_flags & TG3_FLAG_NVRAM)
1028 + tw32(NVRAM_SWARB, SWARB_REQ_CLR0);
1029 + }
1030 +
1031 return 0;
1032 }
1033
1034 @@ -5391,6 +5427,11 @@
1035 struct fw_info info;
1036 int err, i;
1037
1038 + if (tp->tg3_flags3 & TG3_FLG3_IS_SSB_CORE) {
1039 + /* We don't use firmware. */
1040 + return 0;
1041 + }
1042 +
1043 info.text_base = TG3_FW_TEXT_ADDR;
1044 info.text_len = TG3_FW_TEXT_LEN;
1045 info.text_data = &tg3FwText[0];
1046 @@ -5949,6 +5990,11 @@
1047 unsigned long cpu_base, cpu_scratch_base, cpu_scratch_size;
1048 int err, i;
1049
1050 + if (tp->tg3_flags3 & TG3_FLG3_IS_SSB_CORE) {
1051 + /* We don't use firmware. */
1052 + return 0;
1053 + }
1054 +
1055 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO)
1056 return 0;
1057
1058 @@ -6850,6 +6896,11 @@
1059
1060 spin_lock(&tp->lock);
1061
1062 + if (tp->tg3_flags3 & TG3_FLG3_FLUSH_POSTED_WRITES) {
1063 + /* BCM4785: Flush posted writes from GbE to host memory. */
1064 + tr32(HOSTCC_MODE);
1065 + }
1066 +
1067 if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)) {
1068 /* All of this garbage is because when using non-tagged
1069 * IRQ status the mailbox/status_block protocol the chip
1070 @@ -8432,6 +8483,11 @@
1071 u32 *buf, csum, magic;
1072 int i, j, err = 0, size;
1073
1074 + if (tp->tg3_flags3 & TG3_FLG3_IS_SSB_CORE) {
1075 + /* We don't have NVRAM. */
1076 + return 0;
1077 + }
1078 +
1079 if (tg3_nvram_read_swab(tp, 0, &magic) != 0)
1080 return -EIO;
1081
1082 @@ -9154,7 +9210,7 @@
1083 return -EAGAIN;
1084
1085 spin_lock_bh(&tp->lock);
1086 - err = tg3_readphy(tp, data->reg_num & 0x1f, &mii_regval);
1087 + err = __tg3_readphy(tp, data->phy_id & 0x1f, data->reg_num & 0x1f, &mii_regval);
1088 spin_unlock_bh(&tp->lock);
1089
1090 data->val_out = mii_regval;
1091 @@ -9173,7 +9229,7 @@
1092 return -EAGAIN;
1093
1094 spin_lock_bh(&tp->lock);
1095 - err = tg3_writephy(tp, data->reg_num & 0x1f, data->val_in);
1096 + err = __tg3_writephy(tp, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
1097 spin_unlock_bh(&tp->lock);
1098
1099 return err;
1100 @@ -9571,6 +9627,12 @@
1101 /* Chips other than 5700/5701 use the NVRAM for fetching info. */
1102 static void __devinit tg3_nvram_init(struct tg3 *tp)
1103 {
1104 + if (tp->tg3_flags3 & TG3_FLG3_IS_SSB_CORE) {
1105 + /* No NVRAM and EEPROM on the SSB Broadcom GigE core. */
1106 + tp->tg3_flags &= ~(TG3_FLAG_NVRAM | TG3_FLAG_NVRAM_BUFFERED);
1107 + return;
1108 + }
1109 +
1110 tw32_f(GRC_EEPROM_ADDR,
1111 (EEPROM_ADDR_FSM_RESET |
1112 (EEPROM_DEFAULT_CLOCK_PERIOD <<
1113 @@ -9706,6 +9768,9 @@
1114 {
1115 int ret;
1116
1117 + if (tp->tg3_flags3 & TG3_FLG3_IS_SSB_CORE)
1118 + return -ENODEV;
1119 +
1120 if (!(tp->tg3_flags & TG3_FLAG_NVRAM))
1121 return tg3_nvram_read_using_eeprom(tp, offset, val);
1122
1123 @@ -9938,6 +10003,9 @@
1124 {
1125 int ret;
1126
1127 + if (tp->tg3_flags3 & TG3_FLG3_IS_SSB_CORE)
1128 + return -ENODEV;
1129 +
1130 if (tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) {
1131 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl &
1132 ~GRC_LCLCTRL_GPIO_OUTPUT1);
1133 @@ -10804,7 +10872,6 @@
1134 tp->write32 = tg3_write_flush_reg32;
1135 }
1136
1137 -
1138 if ((tp->tg3_flags & TG3_FLAG_TXD_MBOX_HWBUG) ||
1139 (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER)) {
1140 tp->write32_tx_mbox = tg3_write32_tx_mbox;
1141 @@ -10840,6 +10907,11 @@
1142 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)))
1143 tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG;
1144
1145 + if (tp->tg3_flags3 & TG3_FLG3_FLUSH_POSTED_WRITES) {
1146 + tp->write32_tx_mbox = tg3_write_flush_reg32;
1147 + tp->write32_rx_mbox = tg3_write_flush_reg32;
1148 + }
1149 +
1150 /* Get eeprom hw config before calling tg3_set_power_state().
1151 * In particular, the TG3_FLG2_IS_NIC flag must be
1152 * determined before calling tg3_set_power_state() so that
1153 @@ -11184,6 +11256,10 @@
1154 }
1155
1156 if (!is_valid_ether_addr(&dev->dev_addr[0])) {
1157 + if (tp->tg3_flags3 & TG3_FLG3_IS_SSB_CORE)
1158 + ssb_gige_get_macaddr(tp->pdev, &dev->dev_addr[0]);
1159 + }
1160 + if (!is_valid_ether_addr(&dev->dev_addr[0])) {
1161 #ifdef CONFIG_SPARC64
1162 if (!tg3_get_default_macaddr_sparc(tp))
1163 return 0;
1164 @@ -11675,6 +11751,7 @@
1165 case PHY_ID_BCM5704: return "5704";
1166 case PHY_ID_BCM5705: return "5705";
1167 case PHY_ID_BCM5750: return "5750";
1168 + case PHY_ID_BCM5750_2: return "5750-2";
1169 case PHY_ID_BCM5752: return "5752";
1170 case PHY_ID_BCM5714: return "5714";
1171 case PHY_ID_BCM5780: return "5780";
1172 @@ -11859,6 +11936,13 @@
1173 tp->msg_enable = tg3_debug;
1174 else
1175 tp->msg_enable = TG3_DEF_MSG_ENABLE;
1176 + if (pdev_is_ssb_gige_core(pdev)) {
1177 + tp->tg3_flags3 |= TG3_FLG3_IS_SSB_CORE;
1178 + if (ssb_gige_must_flush_posted_writes(pdev))
1179 + tp->tg3_flags3 |= TG3_FLG3_FLUSH_POSTED_WRITES;
1180 + if (ssb_gige_have_roboswitch(pdev))
1181 + tp->tg3_flags3 |= TG3_FLG3_ROBOSWITCH;
1182 + }
1183
1184 /* The word/byte swap controls here control register access byte
1185 * swapping. DMA data byte swapping is controlled in the GRC_MODE
1186 --- a/drivers/net/tg3.h
1187 +++ b/drivers/net/tg3.h
1188 @@ -2279,6 +2279,10 @@
1189 #define TG3_FLG2_PHY_JITTER_BUG 0x20000000
1190 #define TG3_FLG2_NO_FWARE_REPORTED 0x40000000
1191 #define TG3_FLG2_PHY_ADJUST_TRIM 0x80000000
1192 + u32 tg3_flags3;
1193 +#define TG3_FLG3_IS_SSB_CORE 0x00000001
1194 +#define TG3_FLG3_FLUSH_POSTED_WRITES 0x00000002
1195 +#define TG3_FLG3_ROBOSWITCH 0x00000004
1196
1197 struct timer_list timer;
1198 u16 timer_counter;
1199 @@ -2333,6 +2337,7 @@
1200 #define PHY_ID_BCM5714 0x60008340
1201 #define PHY_ID_BCM5780 0x60008350
1202 #define PHY_ID_BCM5755 0xbc050cc0
1203 +#define PHY_ID_BCM5750_2 0xbc050cd0
1204 #define PHY_ID_BCM5787 0xbc050ce0
1205 #define PHY_ID_BCM5756 0xbc050ed0
1206 #define PHY_ID_BCM5906 0xdc00ac40
1207 @@ -2364,7 +2369,8 @@
1208 (X) == PHY_ID_BCM5752 || (X) == PHY_ID_BCM5714 || \
1209 (X) == PHY_ID_BCM5780 || (X) == PHY_ID_BCM5787 || \
1210 (X) == PHY_ID_BCM5755 || (X) == PHY_ID_BCM5756 || \
1211 - (X) == PHY_ID_BCM5906 || (X) == PHY_ID_BCM8002)
1212 + (X) == PHY_ID_BCM5906 || (X) == PHY_ID_BCM8002 || \
1213 + (X) == PHY_ID_BCM5750_2)
1214
1215 struct tg3_hw_stats *hw_stats;
1216 dma_addr_t stats_mapping;
1217 --- a/drivers/ssb/driver_mipscore.c
1218 +++ b/drivers/ssb/driver_mipscore.c
1219 @@ -212,6 +212,7 @@
1220 /* fallthrough */
1221 case SSB_DEV_PCI:
1222 case SSB_DEV_ETHERNET:
1223 + case SSB_DEV_ETHERNET_GBIT:
1224 case SSB_DEV_80211:
1225 case SSB_DEV_USB20_HOST:
1226 /* These devices get their own IRQ line if available, the rest goes on IRQ0 */
This page took 0.100346 seconds and 5 git commands to generate.