main.c (3cecdda3f169f22f324f78fd544beee68e3cc6a4) main.c (aab547ce0d1493d400b6468c521a0137cd8c1edf)
1/*
2 * Sonics Silicon Backplane
3 * Subsystem core
4 *
5 * Copyright 2005, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de>
7 *
8 * Licensed under the GNU/GPL. See COPYING for details.
9 */
10
11#include "ssb_private.h"
12
13#include <linux/delay.h>
14#include <linux/io.h>
15#include <linux/ssb/ssb.h>
16#include <linux/ssb/ssb_regs.h>
1/*
2 * Sonics Silicon Backplane
3 * Subsystem core
4 *
5 * Copyright 2005, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de>
7 *
8 * Licensed under the GNU/GPL. See COPYING for details.
9 */
10
11#include "ssb_private.h"
12
13#include <linux/delay.h>
14#include <linux/io.h>
15#include <linux/ssb/ssb.h>
16#include <linux/ssb/ssb_regs.h>
17#include <linux/ssb/ssb_driver_gige.h>
17#include <linux/dma-mapping.h>
18#include <linux/pci.h>
19
20#include <pcmcia/cs_types.h>
21#include <pcmcia/cs.h>
22#include <pcmcia/cistpl.h>
23#include <pcmcia/ds.h>
24

--- 38 unchanged lines hidden (view full) ---

63 bus = NULL;
64found:
65 ssb_buses_unlock();
66
67 return bus;
68}
69#endif /* CONFIG_SSB_PCIHOST */
70
18#include <linux/dma-mapping.h>
19#include <linux/pci.h>
20
21#include <pcmcia/cs_types.h>
22#include <pcmcia/cs.h>
23#include <pcmcia/cistpl.h>
24#include <pcmcia/ds.h>
25

--- 38 unchanged lines hidden (view full) ---

64 bus = NULL;
65found:
66 ssb_buses_unlock();
67
68 return bus;
69}
70#endif /* CONFIG_SSB_PCIHOST */
71
72int ssb_for_each_bus_call(unsigned long data,
73 int (*func)(struct ssb_bus *bus, unsigned long data))
74{
75 struct ssb_bus *bus;
76 int res;
77
78 ssb_buses_lock();
79 list_for_each_entry(bus, &buses, list) {
80 res = func(bus, data);
81 if (res >= 0) {
82 ssb_buses_unlock();
83 return res;
84 }
85 }
86 ssb_buses_unlock();
87
88 return -ENODEV;
89}
90
71static struct ssb_device *ssb_device_get(struct ssb_device *dev)
72{
73 if (dev)
74 get_device(dev->dev);
75 return dev;
76}
77
78static void ssb_device_put(struct ssb_device *dev)

--- 421 unchanged lines hidden (view full) ---

500 continue;
501 }
502 list_move_tail(&bus->list, &buses);
503 }
504
505 return err;
506}
507
91static struct ssb_device *ssb_device_get(struct ssb_device *dev)
92{
93 if (dev)
94 get_device(dev->dev);
95 return dev;
96}
97
98static void ssb_device_put(struct ssb_device *dev)

--- 421 unchanged lines hidden (view full) ---

520 continue;
521 }
522 list_move_tail(&bus->list, &buses);
523 }
524
525 return err;
526}
527
528static u8 ssb_ssb_read8(struct ssb_device *dev, u16 offset)
529{
530 struct ssb_bus *bus = dev->bus;
531
532 offset += dev->core_index * SSB_CORE_SIZE;
533 return readb(bus->mmio + offset);
534}
535
508static u16 ssb_ssb_read16(struct ssb_device *dev, u16 offset)
509{
510 struct ssb_bus *bus = dev->bus;
511
512 offset += dev->core_index * SSB_CORE_SIZE;
513 return readw(bus->mmio + offset);
514}
515
516static u32 ssb_ssb_read32(struct ssb_device *dev, u16 offset)
517{
518 struct ssb_bus *bus = dev->bus;
519
520 offset += dev->core_index * SSB_CORE_SIZE;
521 return readl(bus->mmio + offset);
522}
523
536static u16 ssb_ssb_read16(struct ssb_device *dev, u16 offset)
537{
538 struct ssb_bus *bus = dev->bus;
539
540 offset += dev->core_index * SSB_CORE_SIZE;
541 return readw(bus->mmio + offset);
542}
543
544static u32 ssb_ssb_read32(struct ssb_device *dev, u16 offset)
545{
546 struct ssb_bus *bus = dev->bus;
547
548 offset += dev->core_index * SSB_CORE_SIZE;
549 return readl(bus->mmio + offset);
550}
551
552static void ssb_ssb_write8(struct ssb_device *dev, u16 offset, u8 value)
553{
554 struct ssb_bus *bus = dev->bus;
555
556 offset += dev->core_index * SSB_CORE_SIZE;
557 writeb(value, bus->mmio + offset);
558}
559
524static void ssb_ssb_write16(struct ssb_device *dev, u16 offset, u16 value)
525{
526 struct ssb_bus *bus = dev->bus;
527
528 offset += dev->core_index * SSB_CORE_SIZE;
529 writew(value, bus->mmio + offset);
530}
531
532static void ssb_ssb_write32(struct ssb_device *dev, u16 offset, u32 value)
533{
534 struct ssb_bus *bus = dev->bus;
535
536 offset += dev->core_index * SSB_CORE_SIZE;
537 writel(value, bus->mmio + offset);
538}
539
540/* Ops for the plain SSB bus without a host-device (no PCI or PCMCIA). */
541static const struct ssb_bus_ops ssb_ssb_ops = {
560static void ssb_ssb_write16(struct ssb_device *dev, u16 offset, u16 value)
561{
562 struct ssb_bus *bus = dev->bus;
563
564 offset += dev->core_index * SSB_CORE_SIZE;
565 writew(value, bus->mmio + offset);
566}
567
568static void ssb_ssb_write32(struct ssb_device *dev, u16 offset, u32 value)
569{
570 struct ssb_bus *bus = dev->bus;
571
572 offset += dev->core_index * SSB_CORE_SIZE;
573 writel(value, bus->mmio + offset);
574}
575
576/* Ops for the plain SSB bus without a host-device (no PCI or PCMCIA). */
577static const struct ssb_bus_ops ssb_ssb_ops = {
578 .read8 = ssb_ssb_read8,
542 .read16 = ssb_ssb_read16,
543 .read32 = ssb_ssb_read32,
579 .read16 = ssb_ssb_read16,
580 .read32 = ssb_ssb_read32,
581 .write8 = ssb_ssb_write8,
544 .write16 = ssb_ssb_write16,
545 .write32 = ssb_ssb_write32,
546};
547
548static int ssb_fetch_invariants(struct ssb_bus *bus,
549 ssb_invariants_func_t get_invariants)
550{
551 struct ssb_init_invariants iv;

--- 596 unchanged lines hidden (view full) ---

1148 err = ssb_attach_queued_buses();
1149 ssb_buses_unlock();
1150 if (err)
1151 bus_unregister(&ssb_bustype);
1152
1153 err = b43_pci_ssb_bridge_init();
1154 if (err) {
1155 ssb_printk(KERN_ERR "Broadcom 43xx PCI-SSB-bridge "
582 .write16 = ssb_ssb_write16,
583 .write32 = ssb_ssb_write32,
584};
585
586static int ssb_fetch_invariants(struct ssb_bus *bus,
587 ssb_invariants_func_t get_invariants)
588{
589 struct ssb_init_invariants iv;

--- 596 unchanged lines hidden (view full) ---

1186 err = ssb_attach_queued_buses();
1187 ssb_buses_unlock();
1188 if (err)
1189 bus_unregister(&ssb_bustype);
1190
1191 err = b43_pci_ssb_bridge_init();
1192 if (err) {
1193 ssb_printk(KERN_ERR "Broadcom 43xx PCI-SSB-bridge "
1156 "initialization failed");
1194 "initialization failed\n");
1157 /* don't fail SSB init because of this */
1158 err = 0;
1159 }
1195 /* don't fail SSB init because of this */
1196 err = 0;
1197 }
1198 err = ssb_gige_init();
1199 if (err) {
1200 ssb_printk(KERN_ERR "SSB Broadcom Gigabit Ethernet "
1201 "driver initialization failed\n");
1202 /* don't fail SSB init because of this */
1203 err = 0;
1204 }
1160
1161 return err;
1162}
1163/* ssb must be initialized after PCI but before the ssb drivers.
1164 * That means we must use some initcall between subsys_initcall
1165 * and device_initcall. */
1166fs_initcall(ssb_modinit);
1167
1168static void __exit ssb_modexit(void)
1169{
1205
1206 return err;
1207}
1208/* ssb must be initialized after PCI but before the ssb drivers.
1209 * That means we must use some initcall between subsys_initcall
1210 * and device_initcall. */
1211fs_initcall(ssb_modinit);
1212
1213static void __exit ssb_modexit(void)
1214{
1215 ssb_gige_exit();
1170 b43_pci_ssb_bridge_exit();
1171 bus_unregister(&ssb_bustype);
1172}
1173module_exit(ssb_modexit)
1216 b43_pci_ssb_bridge_exit();
1217 bus_unregister(&ssb_bustype);
1218}
1219module_exit(ssb_modexit)