Linux Audio

Check our new training course

In-person Linux kernel drivers training

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