1 #ifndef LINUX_SSB_PRIVATE_H_
2 #define LINUX_SSB_PRIVATE_H_
4 #include <linux/ssb/ssb.h>
5 #include <linux/types.h>
6 #include <linux/bcm47xx_wdt.h>
11 #ifdef CONFIG_SSB_SILENT
12 # define ssb_printk(fmt, x...) do { /* nothing */ } while (0)
14 # define ssb_printk printk
15 #endif /* CONFIG_SSB_SILENT */
17 /* dprintk: Debugging printk; vanishes for non-debug compilation */
18 #ifdef CONFIG_SSB_DEBUG
19 # define ssb_dprintk(fmt, x...) ssb_printk(fmt , ##x)
21 # define ssb_dprintk(fmt, x...) do { /* nothing */ } while (0)
24 #ifdef CONFIG_SSB_DEBUG
25 # define SSB_WARN_ON(x) WARN_ON(x)
26 # define SSB_BUG_ON(x) BUG_ON(x)
28 static inline int __ssb_do_nothing(int x
) { return x
; }
29 # define SSB_WARN_ON(x) __ssb_do_nothing(unlikely(!!(x)))
30 # define SSB_BUG_ON(x) __ssb_do_nothing(unlikely(!!(x)))
35 #ifdef CONFIG_SSB_PCIHOST
36 extern int ssb_pci_switch_core(struct ssb_bus
*bus
,
37 struct ssb_device
*dev
);
38 extern int ssb_pci_switch_coreidx(struct ssb_bus
*bus
,
40 extern int ssb_pci_xtal(struct ssb_bus
*bus
, u32 what
,
42 extern int ssb_pci_get_invariants(struct ssb_bus
*bus
,
43 struct ssb_init_invariants
*iv
);
44 extern void ssb_pci_exit(struct ssb_bus
*bus
);
45 extern int ssb_pci_init(struct ssb_bus
*bus
);
46 extern const struct ssb_bus_ops ssb_pci_ops
;
48 #else /* CONFIG_SSB_PCIHOST */
50 static inline int ssb_pci_switch_core(struct ssb_bus
*bus
,
51 struct ssb_device
*dev
)
55 static inline int ssb_pci_switch_coreidx(struct ssb_bus
*bus
,
60 static inline int ssb_pci_xtal(struct ssb_bus
*bus
, u32 what
,
65 static inline void ssb_pci_exit(struct ssb_bus
*bus
)
68 static inline int ssb_pci_init(struct ssb_bus
*bus
)
72 #endif /* CONFIG_SSB_PCIHOST */
76 #ifdef CONFIG_SSB_PCMCIAHOST
77 extern int ssb_pcmcia_switch_core(struct ssb_bus
*bus
,
78 struct ssb_device
*dev
);
79 extern int ssb_pcmcia_switch_coreidx(struct ssb_bus
*bus
,
81 extern int ssb_pcmcia_switch_segment(struct ssb_bus
*bus
,
83 extern int ssb_pcmcia_get_invariants(struct ssb_bus
*bus
,
84 struct ssb_init_invariants
*iv
);
85 extern int ssb_pcmcia_hardware_setup(struct ssb_bus
*bus
);
86 extern void ssb_pcmcia_exit(struct ssb_bus
*bus
);
87 extern int ssb_pcmcia_init(struct ssb_bus
*bus
);
88 extern const struct ssb_bus_ops ssb_pcmcia_ops
;
89 #else /* CONFIG_SSB_PCMCIAHOST */
90 static inline int ssb_pcmcia_switch_core(struct ssb_bus
*bus
,
91 struct ssb_device
*dev
)
95 static inline int ssb_pcmcia_switch_coreidx(struct ssb_bus
*bus
,
100 static inline int ssb_pcmcia_switch_segment(struct ssb_bus
*bus
,
105 static inline int ssb_pcmcia_hardware_setup(struct ssb_bus
*bus
)
109 static inline void ssb_pcmcia_exit(struct ssb_bus
*bus
)
112 static inline int ssb_pcmcia_init(struct ssb_bus
*bus
)
116 #endif /* CONFIG_SSB_PCMCIAHOST */
119 #ifdef CONFIG_SSB_SDIOHOST
120 extern int ssb_sdio_get_invariants(struct ssb_bus
*bus
,
121 struct ssb_init_invariants
*iv
);
123 extern u32
ssb_sdio_scan_read32(struct ssb_bus
*bus
, u16 offset
);
124 extern int ssb_sdio_switch_core(struct ssb_bus
*bus
, struct ssb_device
*dev
);
125 extern int ssb_sdio_scan_switch_coreidx(struct ssb_bus
*bus
, u8 coreidx
);
126 extern int ssb_sdio_hardware_setup(struct ssb_bus
*bus
);
127 extern void ssb_sdio_exit(struct ssb_bus
*bus
);
128 extern int ssb_sdio_init(struct ssb_bus
*bus
);
130 extern const struct ssb_bus_ops ssb_sdio_ops
;
131 #else /* CONFIG_SSB_SDIOHOST */
132 static inline u32
ssb_sdio_scan_read32(struct ssb_bus
*bus
, u16 offset
)
136 static inline int ssb_sdio_switch_core(struct ssb_bus
*bus
,
137 struct ssb_device
*dev
)
141 static inline int ssb_sdio_scan_switch_coreidx(struct ssb_bus
*bus
, u8 coreidx
)
145 static inline int ssb_sdio_hardware_setup(struct ssb_bus
*bus
)
149 static inline void ssb_sdio_exit(struct ssb_bus
*bus
)
152 static inline int ssb_sdio_init(struct ssb_bus
*bus
)
156 #endif /* CONFIG_SSB_SDIOHOST */
160 extern const char *ssb_core_name(u16 coreid
);
161 extern int ssb_bus_scan(struct ssb_bus
*bus
,
162 unsigned long baseaddr
);
163 extern void ssb_iounmap(struct ssb_bus
*ssb
);
168 ssize_t
ssb_attr_sprom_show(struct ssb_bus
*bus
, char *buf
,
169 int (*sprom_read
)(struct ssb_bus
*bus
, u16
*sprom
));
171 ssize_t
ssb_attr_sprom_store(struct ssb_bus
*bus
,
172 const char *buf
, size_t count
,
173 int (*sprom_check_crc
)(const u16
*sprom
, size_t size
),
174 int (*sprom_write
)(struct ssb_bus
*bus
, const u16
*sprom
));
175 extern int ssb_fill_sprom_with_fallback(struct ssb_bus
*bus
,
176 struct ssb_sprom
*out
);
180 extern u32
ssb_calc_clock_rate(u32 plltype
, u32 n
, u32 m
);
181 extern struct ssb_bus
*ssb_pci_dev_to_bus(struct pci_dev
*pdev
);
182 int ssb_for_each_bus_call(unsigned long data
,
183 int (*func
)(struct ssb_bus
*bus
, unsigned long data
));
184 extern struct ssb_bus
*ssb_pcmcia_dev_to_bus(struct pcmcia_device
*pdev
);
186 struct ssb_freeze_context
{
187 /* Pointer to the bus */
189 /* Boolean list to indicate whether a device is frozen on this bus. */
190 bool device_frozen
[SSB_MAX_NR_CORES
];
192 extern int ssb_devices_freeze(struct ssb_bus
*bus
, struct ssb_freeze_context
*ctx
);
193 extern int ssb_devices_thaw(struct ssb_freeze_context
*ctx
);
197 /* b43_pci_bridge.c */
198 #ifdef CONFIG_SSB_B43_PCI_BRIDGE
199 extern int __init
b43_pci_ssb_bridge_init(void);
200 extern void __exit
b43_pci_ssb_bridge_exit(void);
201 #else /* CONFIG_SSB_B43_PCI_BRIDGE */
202 static inline int b43_pci_ssb_bridge_init(void)
206 static inline void b43_pci_ssb_bridge_exit(void)
209 #endif /* CONFIG_SSB_B43_PCI_BRIDGE */
211 /* driver_chipcommon_pmu.c */
212 extern u32
ssb_pmu_get_cpu_clock(struct ssb_chipcommon
*cc
);
213 extern u32
ssb_pmu_get_controlclock(struct ssb_chipcommon
*cc
);
214 extern u32
ssb_pmu_get_alp_clock(struct ssb_chipcommon
*cc
);
216 extern u32
ssb_chipco_watchdog_timer_set_wdt(struct bcm47xx_wdt
*wdt
,
218 extern u32
ssb_chipco_watchdog_timer_set_ms(struct bcm47xx_wdt
*wdt
, u32 ms
);
220 /* driver_chipcommon_sflash.c */
221 #ifdef CONFIG_SSB_SFLASH
222 int ssb_sflash_init(struct ssb_chipcommon
*cc
);
224 static inline int ssb_sflash_init(struct ssb_chipcommon
*cc
)
226 pr_err("Serial flash not supported\n");
229 #endif /* CONFIG_SSB_SFLASH */
231 #ifdef CONFIG_SSB_DRIVER_MIPS
232 extern struct platform_device ssb_pflash_dev
;
235 #ifdef CONFIG_SSB_DRIVER_EXTIF
236 extern u32
ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt
*wdt
, u32 ticks
);
237 extern u32
ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt
*wdt
, u32 ms
);
239 static inline u32
ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt
*wdt
,
244 static inline u32
ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt
*wdt
,
251 #ifdef CONFIG_SSB_EMBEDDED
252 extern int ssb_watchdog_register(struct ssb_bus
*bus
);
253 #else /* CONFIG_SSB_EMBEDDED */
254 static inline int ssb_watchdog_register(struct ssb_bus
*bus
)
258 #endif /* CONFIG_SSB_EMBEDDED */
260 #ifdef CONFIG_SSB_DRIVER_EXTIF
261 extern void ssb_extif_init(struct ssb_extif
*extif
);
263 static inline void ssb_extif_init(struct ssb_extif
*extif
)
268 #ifdef CONFIG_SSB_DRIVER_GPIO
269 extern int ssb_gpio_init(struct ssb_bus
*bus
);
270 #else /* CONFIG_SSB_DRIVER_GPIO */
271 static inline int ssb_gpio_init(struct ssb_bus
*bus
)
275 #endif /* CONFIG_SSB_DRIVER_GPIO */
277 #endif /* LINUX_SSB_PRIVATE_H_ */