Linux Audio

Check our new training course

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