ceph: save peer feature bits in connection structure
[linux-2.6.git] / drivers / ssb / ssb_private.h
blob0331139a726fb2dd44cd30c41985cfa866b2f1f2
1 #ifndef LINUX_SSB_PRIVATE_H_
2 #define LINUX_SSB_PRIVATE_H_
4 #include <linux/ssb/ssb.h>
5 #include <linux/types.h>
8 #define PFX "ssb: "
10 #ifdef CONFIG_SSB_SILENT
11 # define ssb_printk(fmt, x...) do { /* nothing */ } while (0)
12 #else
13 # define ssb_printk printk
14 #endif /* CONFIG_SSB_SILENT */
16 /* dprintk: Debugging printk; vanishes for non-debug compilation */
17 #ifdef CONFIG_SSB_DEBUG
18 # define ssb_dprintk(fmt, x...) ssb_printk(fmt , ##x)
19 #else
20 # define ssb_dprintk(fmt, x...) do { /* nothing */ } while (0)
21 #endif
23 #ifdef CONFIG_SSB_DEBUG
24 # define SSB_WARN_ON(x) WARN_ON(x)
25 # define SSB_BUG_ON(x) BUG_ON(x)
26 #else
27 static inline int __ssb_do_nothing(int x) { return x; }
28 # define SSB_WARN_ON(x) __ssb_do_nothing(unlikely(!!(x)))
29 # define SSB_BUG_ON(x) __ssb_do_nothing(unlikely(!!(x)))
30 #endif
33 /* pci.c */
34 #ifdef CONFIG_SSB_PCIHOST
35 extern int ssb_pci_switch_core(struct ssb_bus *bus,
36 struct ssb_device *dev);
37 extern int ssb_pci_switch_coreidx(struct ssb_bus *bus,
38 u8 coreidx);
39 extern int ssb_pci_xtal(struct ssb_bus *bus, u32 what,
40 int turn_on);
41 extern int ssb_pci_get_invariants(struct ssb_bus *bus,
42 struct ssb_init_invariants *iv);
43 extern void ssb_pci_exit(struct ssb_bus *bus);
44 extern int ssb_pci_init(struct ssb_bus *bus);
45 extern const struct ssb_bus_ops ssb_pci_ops;
47 #else /* CONFIG_SSB_PCIHOST */
49 static inline int ssb_pci_switch_core(struct ssb_bus *bus,
50 struct ssb_device *dev)
52 return 0;
54 static inline int ssb_pci_switch_coreidx(struct ssb_bus *bus,
55 u8 coreidx)
57 return 0;
59 static inline int ssb_pci_xtal(struct ssb_bus *bus, u32 what,
60 int turn_on)
62 return 0;
64 static inline void ssb_pci_exit(struct ssb_bus *bus)
67 static inline int ssb_pci_init(struct ssb_bus *bus)
69 return 0;
71 #endif /* CONFIG_SSB_PCIHOST */
74 /* pcmcia.c */
75 #ifdef CONFIG_SSB_PCMCIAHOST
76 extern int ssb_pcmcia_switch_core(struct ssb_bus *bus,
77 struct ssb_device *dev);
78 extern int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
79 u8 coreidx);
80 extern int ssb_pcmcia_switch_segment(struct ssb_bus *bus,
81 u8 seg);
82 extern int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
83 struct ssb_init_invariants *iv);
84 extern int ssb_pcmcia_hardware_setup(struct ssb_bus *bus);
85 extern void ssb_pcmcia_exit(struct ssb_bus *bus);
86 extern int ssb_pcmcia_init(struct ssb_bus *bus);
87 extern const struct ssb_bus_ops ssb_pcmcia_ops;
88 #else /* CONFIG_SSB_PCMCIAHOST */
89 static inline int ssb_pcmcia_switch_core(struct ssb_bus *bus,
90 struct ssb_device *dev)
92 return 0;
94 static inline int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
95 u8 coreidx)
97 return 0;
99 static inline int ssb_pcmcia_switch_segment(struct ssb_bus *bus,
100 u8 seg)
102 return 0;
104 static inline int ssb_pcmcia_hardware_setup(struct ssb_bus *bus)
106 return 0;
108 static inline void ssb_pcmcia_exit(struct ssb_bus *bus)
111 static inline int ssb_pcmcia_init(struct ssb_bus *bus)
113 return 0;
115 #endif /* CONFIG_SSB_PCMCIAHOST */
117 /* sdio.c */
118 #ifdef CONFIG_SSB_SDIOHOST
119 extern int ssb_sdio_get_invariants(struct ssb_bus *bus,
120 struct ssb_init_invariants *iv);
122 extern u32 ssb_sdio_scan_read32(struct ssb_bus *bus, u16 offset);
123 extern int ssb_sdio_switch_core(struct ssb_bus *bus, struct ssb_device *dev);
124 extern int ssb_sdio_scan_switch_coreidx(struct ssb_bus *bus, u8 coreidx);
125 extern int ssb_sdio_hardware_setup(struct ssb_bus *bus);
126 extern void ssb_sdio_exit(struct ssb_bus *bus);
127 extern int ssb_sdio_init(struct ssb_bus *bus);
129 extern const struct ssb_bus_ops ssb_sdio_ops;
130 #else /* CONFIG_SSB_SDIOHOST */
131 static inline u32 ssb_sdio_scan_read32(struct ssb_bus *bus, u16 offset)
133 return 0;
135 static inline int ssb_sdio_switch_core(struct ssb_bus *bus,
136 struct ssb_device *dev)
138 return 0;
140 static inline int ssb_sdio_scan_switch_coreidx(struct ssb_bus *bus, u8 coreidx)
142 return 0;
144 static inline int ssb_sdio_hardware_setup(struct ssb_bus *bus)
146 return 0;
148 static inline void ssb_sdio_exit(struct ssb_bus *bus)
151 static inline int ssb_sdio_init(struct ssb_bus *bus)
153 return 0;
155 #endif /* CONFIG_SSB_SDIOHOST */
158 /* scan.c */
159 extern const char *ssb_core_name(u16 coreid);
160 extern int ssb_bus_scan(struct ssb_bus *bus,
161 unsigned long baseaddr);
162 extern void ssb_iounmap(struct ssb_bus *ssb);
165 /* sprom.c */
166 extern
167 ssize_t ssb_attr_sprom_show(struct ssb_bus *bus, char *buf,
168 int (*sprom_read)(struct ssb_bus *bus, u16 *sprom));
169 extern
170 ssize_t ssb_attr_sprom_store(struct ssb_bus *bus,
171 const char *buf, size_t count,
172 int (*sprom_check_crc)(const u16 *sprom, size_t size),
173 int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom));
174 extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
177 /* core.c */
178 extern u32 ssb_calc_clock_rate(u32 plltype, u32 n, u32 m);
179 extern struct ssb_bus *ssb_pci_dev_to_bus(struct pci_dev *pdev);
180 int ssb_for_each_bus_call(unsigned long data,
181 int (*func)(struct ssb_bus *bus, unsigned long data));
182 extern struct ssb_bus *ssb_pcmcia_dev_to_bus(struct pcmcia_device *pdev);
184 struct ssb_freeze_context {
185 /* Pointer to the bus */
186 struct ssb_bus *bus;
187 /* Boolean list to indicate whether a device is frozen on this bus. */
188 bool device_frozen[SSB_MAX_NR_CORES];
190 extern int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx);
191 extern int ssb_devices_thaw(struct ssb_freeze_context *ctx);
195 /* b43_pci_bridge.c */
196 #ifdef CONFIG_SSB_B43_PCI_BRIDGE
197 extern int __init b43_pci_ssb_bridge_init(void);
198 extern void __exit b43_pci_ssb_bridge_exit(void);
199 #else /* CONFIG_SSB_B43_PCI_BRIDGE */
200 static inline int b43_pci_ssb_bridge_init(void)
202 return 0;
204 static inline void b43_pci_ssb_bridge_exit(void)
207 #endif /* CONFIG_SSB_B43_PCI_BRIDGE */
209 #endif /* LINUX_SSB_PRIVATE_H_ */