]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/ssb/ssb_private.h
ssb: make ssb_sdio_switch_core static
[karo-tx-linux.git] / drivers / ssb / ssb_private.h
1 #ifndef LINUX_SSB_PRIVATE_H_
2 #define LINUX_SSB_PRIVATE_H_
3
4 #include <linux/ssb/ssb.h>
5 #include <linux/types.h>
6 #include <linux/bcm47xx_wdt.h>
7
8
9 #define PFX     "ssb: "
10
11 #ifdef CONFIG_SSB_SILENT
12 # define ssb_printk(fmt, ...)                                   \
13         do { if (0) printk(fmt, ##__VA_ARGS__); } while (0)
14 #else
15 # define ssb_printk(fmt, ...)                                   \
16         printk(fmt, ##__VA_ARGS__)
17 #endif /* CONFIG_SSB_SILENT */
18
19 #define ssb_emerg(fmt, ...)     ssb_printk(KERN_EMERG PFX fmt, ##__VA_ARGS__)
20 #define ssb_err(fmt, ...)       ssb_printk(KERN_ERR PFX fmt, ##__VA_ARGS__)
21 #define ssb_warn(fmt, ...)      ssb_printk(KERN_WARNING PFX fmt, ##__VA_ARGS__)
22 #define ssb_notice(fmt, ...)    ssb_printk(KERN_NOTICE PFX fmt, ##__VA_ARGS__)
23 #define ssb_info(fmt, ...)      ssb_printk(KERN_INFO PFX fmt, ##__VA_ARGS__)
24 #define ssb_cont(fmt, ...)      ssb_printk(KERN_CONT fmt, ##__VA_ARGS__)
25
26 /* dprintk: Debugging printk; vanishes for non-debug compilation */
27 #ifdef CONFIG_SSB_DEBUG
28 # define ssb_dbg(fmt, ...)                                      \
29         ssb_printk(KERN_DEBUG PFX fmt, ##__VA_ARGS__)
30 #else
31 # define ssb_dbg(fmt, ...)                                      \
32         do { if (0) printk(KERN_DEBUG PFX fmt, ##__VA_ARGS__); } while (0)
33 #endif
34
35 #ifdef CONFIG_SSB_DEBUG
36 # define SSB_WARN_ON(x)         WARN_ON(x)
37 # define SSB_BUG_ON(x)          BUG_ON(x)
38 #else
39 static inline int __ssb_do_nothing(int x) { return x; }
40 # define SSB_WARN_ON(x)         __ssb_do_nothing(unlikely(!!(x)))
41 # define SSB_BUG_ON(x)          __ssb_do_nothing(unlikely(!!(x)))
42 #endif
43
44
45 /* pci.c */
46 #ifdef CONFIG_SSB_PCIHOST
47 extern int ssb_pci_switch_core(struct ssb_bus *bus,
48                                struct ssb_device *dev);
49 extern int ssb_pci_switch_coreidx(struct ssb_bus *bus,
50                                   u8 coreidx);
51 extern int ssb_pci_xtal(struct ssb_bus *bus, u32 what,
52                         int turn_on);
53 extern int ssb_pci_get_invariants(struct ssb_bus *bus,
54                                   struct ssb_init_invariants *iv);
55 extern void ssb_pci_exit(struct ssb_bus *bus);
56 extern int ssb_pci_init(struct ssb_bus *bus);
57 extern const struct ssb_bus_ops ssb_pci_ops;
58
59 #else /* CONFIG_SSB_PCIHOST */
60
61 static inline int ssb_pci_switch_core(struct ssb_bus *bus,
62                                       struct ssb_device *dev)
63 {
64         return 0;
65 }
66 static inline int ssb_pci_switch_coreidx(struct ssb_bus *bus,
67                                          u8 coreidx)
68 {
69         return 0;
70 }
71 static inline int ssb_pci_xtal(struct ssb_bus *bus, u32 what,
72                                int turn_on)
73 {
74         return 0;
75 }
76 static inline void ssb_pci_exit(struct ssb_bus *bus)
77 {
78 }
79 static inline int ssb_pci_init(struct ssb_bus *bus)
80 {
81         return 0;
82 }
83 #endif /* CONFIG_SSB_PCIHOST */
84
85
86 /* pcmcia.c */
87 #ifdef CONFIG_SSB_PCMCIAHOST
88 extern int ssb_pcmcia_switch_core(struct ssb_bus *bus,
89                                   struct ssb_device *dev);
90 extern int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
91                                      u8 coreidx);
92 extern int ssb_pcmcia_switch_segment(struct ssb_bus *bus,
93                                      u8 seg);
94 extern int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
95                                      struct ssb_init_invariants *iv);
96 extern int ssb_pcmcia_hardware_setup(struct ssb_bus *bus);
97 extern void ssb_pcmcia_exit(struct ssb_bus *bus);
98 extern int ssb_pcmcia_init(struct ssb_bus *bus);
99 extern const struct ssb_bus_ops ssb_pcmcia_ops;
100 #else /* CONFIG_SSB_PCMCIAHOST */
101 static inline int ssb_pcmcia_switch_core(struct ssb_bus *bus,
102                                          struct ssb_device *dev)
103 {
104         return 0;
105 }
106 static inline int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
107                                             u8 coreidx)
108 {
109         return 0;
110 }
111 static inline int ssb_pcmcia_switch_segment(struct ssb_bus *bus,
112                                             u8 seg)
113 {
114         return 0;
115 }
116 static inline int ssb_pcmcia_hardware_setup(struct ssb_bus *bus)
117 {
118         return 0;
119 }
120 static inline void ssb_pcmcia_exit(struct ssb_bus *bus)
121 {
122 }
123 static inline int ssb_pcmcia_init(struct ssb_bus *bus)
124 {
125         return 0;
126 }
127 #endif /* CONFIG_SSB_PCMCIAHOST */
128
129 /* sdio.c */
130 #ifdef CONFIG_SSB_SDIOHOST
131 extern int ssb_sdio_get_invariants(struct ssb_bus *bus,
132                                      struct ssb_init_invariants *iv);
133
134 extern u32 ssb_sdio_scan_read32(struct ssb_bus *bus, u16 offset);
135 extern int ssb_sdio_scan_switch_coreidx(struct ssb_bus *bus, u8 coreidx);
136 extern int ssb_sdio_hardware_setup(struct ssb_bus *bus);
137 extern void ssb_sdio_exit(struct ssb_bus *bus);
138 extern int ssb_sdio_init(struct ssb_bus *bus);
139
140 extern const struct ssb_bus_ops ssb_sdio_ops;
141 #else /* CONFIG_SSB_SDIOHOST */
142 static inline u32 ssb_sdio_scan_read32(struct ssb_bus *bus, u16 offset)
143 {
144         return 0;
145 }
146 static inline int ssb_sdio_scan_switch_coreidx(struct ssb_bus *bus, u8 coreidx)
147 {
148         return 0;
149 }
150 static inline int ssb_sdio_hardware_setup(struct ssb_bus *bus)
151 {
152         return 0;
153 }
154 static inline void ssb_sdio_exit(struct ssb_bus *bus)
155 {
156 }
157 static inline int ssb_sdio_init(struct ssb_bus *bus)
158 {
159         return 0;
160 }
161 #endif /* CONFIG_SSB_SDIOHOST */
162
163
164 /* scan.c */
165 extern const char *ssb_core_name(u16 coreid);
166 extern int ssb_bus_scan(struct ssb_bus *bus,
167                         unsigned long baseaddr);
168 extern void ssb_iounmap(struct ssb_bus *ssb);
169
170
171 /* sprom.c */
172 extern
173 ssize_t ssb_attr_sprom_show(struct ssb_bus *bus, char *buf,
174                             int (*sprom_read)(struct ssb_bus *bus, u16 *sprom));
175 extern
176 ssize_t ssb_attr_sprom_store(struct ssb_bus *bus,
177                              const char *buf, size_t count,
178                              int (*sprom_check_crc)(const u16 *sprom, size_t size),
179                              int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom));
180 extern int ssb_fill_sprom_with_fallback(struct ssb_bus *bus,
181                                         struct ssb_sprom *out);
182
183
184 /* core.c */
185 extern u32 ssb_calc_clock_rate(u32 plltype, u32 n, u32 m);
186 extern struct ssb_bus *ssb_pci_dev_to_bus(struct pci_dev *pdev);
187 int ssb_for_each_bus_call(unsigned long data,
188                           int (*func)(struct ssb_bus *bus, unsigned long data));
189 extern struct ssb_bus *ssb_pcmcia_dev_to_bus(struct pcmcia_device *pdev);
190
191 struct ssb_freeze_context {
192         /* Pointer to the bus */
193         struct ssb_bus *bus;
194         /* Boolean list to indicate whether a device is frozen on this bus. */
195         bool device_frozen[SSB_MAX_NR_CORES];
196 };
197 extern int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx);
198 extern int ssb_devices_thaw(struct ssb_freeze_context *ctx);
199
200
201
202 /* b43_pci_bridge.c */
203 #ifdef CONFIG_SSB_B43_PCI_BRIDGE
204 extern int __init b43_pci_ssb_bridge_init(void);
205 extern void __exit b43_pci_ssb_bridge_exit(void);
206 #else /* CONFIG_SSB_B43_PCI_BRIDGE */
207 static inline int b43_pci_ssb_bridge_init(void)
208 {
209         return 0;
210 }
211 static inline void b43_pci_ssb_bridge_exit(void)
212 {
213 }
214 #endif /* CONFIG_SSB_B43_PCI_BRIDGE */
215
216 /* driver_chipcommon_pmu.c */
217 extern u32 ssb_pmu_get_cpu_clock(struct ssb_chipcommon *cc);
218 extern u32 ssb_pmu_get_controlclock(struct ssb_chipcommon *cc);
219 extern u32 ssb_pmu_get_alp_clock(struct ssb_chipcommon *cc);
220
221 extern u32 ssb_chipco_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt,
222                                              u32 ticks);
223 extern u32 ssb_chipco_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms);
224
225 /* driver_chipcommon_sflash.c */
226 #ifdef CONFIG_SSB_SFLASH
227 int ssb_sflash_init(struct ssb_chipcommon *cc);
228 #else
229 static inline int ssb_sflash_init(struct ssb_chipcommon *cc)
230 {
231         pr_err("Serial flash not supported\n");
232         return 0;
233 }
234 #endif /* CONFIG_SSB_SFLASH */
235
236 #ifdef CONFIG_SSB_DRIVER_MIPS
237 extern struct platform_device ssb_pflash_dev;
238 #endif
239
240 #ifdef CONFIG_SSB_SFLASH
241 extern struct platform_device ssb_sflash_dev;
242 #endif
243
244 #ifdef CONFIG_SSB_DRIVER_EXTIF
245 extern u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks);
246 extern u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms);
247 #else
248 static inline u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt,
249                                                    u32 ticks)
250 {
251         return 0;
252 }
253 static inline u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt,
254                                                   u32 ms)
255 {
256         return 0;
257 }
258 #endif
259
260 #ifdef CONFIG_SSB_EMBEDDED
261 extern int ssb_watchdog_register(struct ssb_bus *bus);
262 #else /* CONFIG_SSB_EMBEDDED */
263 static inline int ssb_watchdog_register(struct ssb_bus *bus)
264 {
265         return 0;
266 }
267 #endif /* CONFIG_SSB_EMBEDDED */
268
269 #ifdef CONFIG_SSB_DRIVER_EXTIF
270 extern void ssb_extif_init(struct ssb_extif *extif);
271 #else
272 static inline void ssb_extif_init(struct ssb_extif *extif)
273 {
274 }
275 #endif
276
277 #ifdef CONFIG_SSB_DRIVER_GPIO
278 extern int ssb_gpio_init(struct ssb_bus *bus);
279 extern int ssb_gpio_unregister(struct ssb_bus *bus);
280 #else /* CONFIG_SSB_DRIVER_GPIO */
281 static inline int ssb_gpio_init(struct ssb_bus *bus)
282 {
283         return -ENOTSUPP;
284 }
285 static inline int ssb_gpio_unregister(struct ssb_bus *bus)
286 {
287         return 0;
288 }
289 #endif /* CONFIG_SSB_DRIVER_GPIO */
290
291 #endif /* LINUX_SSB_PRIVATE_H_ */