0001
0002 #ifndef LINUX_SSB_PRIVATE_H_
0003 #define LINUX_SSB_PRIVATE_H_
0004
0005 #define PFX "ssb: "
0006 #define pr_fmt(fmt) PFX fmt
0007
0008 #include <linux/ssb/ssb.h>
0009 #include <linux/types.h>
0010 #include <linux/bcm47xx_wdt.h>
0011
0012
0013
0014 #ifdef CONFIG_SSB_PCIHOST
0015 extern int ssb_pci_switch_core(struct ssb_bus *bus,
0016 struct ssb_device *dev);
0017 extern int ssb_pci_switch_coreidx(struct ssb_bus *bus,
0018 u8 coreidx);
0019 extern int ssb_pci_xtal(struct ssb_bus *bus, u32 what,
0020 int turn_on);
0021 extern int ssb_pci_get_invariants(struct ssb_bus *bus,
0022 struct ssb_init_invariants *iv);
0023 extern void ssb_pci_exit(struct ssb_bus *bus);
0024 extern int ssb_pci_init(struct ssb_bus *bus);
0025 extern const struct ssb_bus_ops ssb_pci_ops;
0026
0027 #else
0028
0029 static inline int ssb_pci_switch_core(struct ssb_bus *bus,
0030 struct ssb_device *dev)
0031 {
0032 return 0;
0033 }
0034 static inline int ssb_pci_switch_coreidx(struct ssb_bus *bus,
0035 u8 coreidx)
0036 {
0037 return 0;
0038 }
0039 static inline int ssb_pci_xtal(struct ssb_bus *bus, u32 what,
0040 int turn_on)
0041 {
0042 return 0;
0043 }
0044 static inline void ssb_pci_exit(struct ssb_bus *bus)
0045 {
0046 }
0047 static inline int ssb_pci_init(struct ssb_bus *bus)
0048 {
0049 return 0;
0050 }
0051 #endif
0052
0053
0054
0055 #ifdef CONFIG_SSB_PCMCIAHOST
0056 extern int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
0057 u8 coreidx);
0058 extern int ssb_pcmcia_switch_segment(struct ssb_bus *bus,
0059 u8 seg);
0060 extern int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
0061 struct ssb_init_invariants *iv);
0062 extern int ssb_pcmcia_hardware_setup(struct ssb_bus *bus);
0063 extern void ssb_pcmcia_exit(struct ssb_bus *bus);
0064 extern int ssb_pcmcia_init(struct ssb_bus *bus);
0065 extern int ssb_host_pcmcia_init(void);
0066 extern void ssb_host_pcmcia_exit(void);
0067 extern const struct ssb_bus_ops ssb_pcmcia_ops;
0068 #else
0069 static inline int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
0070 u8 coreidx)
0071 {
0072 return 0;
0073 }
0074 static inline int ssb_pcmcia_switch_segment(struct ssb_bus *bus,
0075 u8 seg)
0076 {
0077 return 0;
0078 }
0079 static inline int ssb_pcmcia_hardware_setup(struct ssb_bus *bus)
0080 {
0081 return 0;
0082 }
0083 static inline void ssb_pcmcia_exit(struct ssb_bus *bus)
0084 {
0085 }
0086 static inline int ssb_pcmcia_init(struct ssb_bus *bus)
0087 {
0088 return 0;
0089 }
0090 static inline int ssb_host_pcmcia_init(void)
0091 {
0092 return 0;
0093 }
0094 static inline void ssb_host_pcmcia_exit(void)
0095 {
0096 }
0097 #endif
0098
0099
0100 #ifdef CONFIG_SSB_SDIOHOST
0101 extern int ssb_sdio_get_invariants(struct ssb_bus *bus,
0102 struct ssb_init_invariants *iv);
0103
0104 extern u32 ssb_sdio_scan_read32(struct ssb_bus *bus, u16 offset);
0105 extern int ssb_sdio_scan_switch_coreidx(struct ssb_bus *bus, u8 coreidx);
0106 extern void ssb_sdio_exit(struct ssb_bus *bus);
0107 extern int ssb_sdio_init(struct ssb_bus *bus);
0108
0109 extern const struct ssb_bus_ops ssb_sdio_ops;
0110 #else
0111 static inline u32 ssb_sdio_scan_read32(struct ssb_bus *bus, u16 offset)
0112 {
0113 return 0;
0114 }
0115 static inline int ssb_sdio_scan_switch_coreidx(struct ssb_bus *bus, u8 coreidx)
0116 {
0117 return 0;
0118 }
0119 static inline void ssb_sdio_exit(struct ssb_bus *bus)
0120 {
0121 }
0122 static inline int ssb_sdio_init(struct ssb_bus *bus)
0123 {
0124 return 0;
0125 }
0126 #endif
0127
0128
0129
0130
0131
0132 #ifdef CONFIG_SSB_HOST_SOC
0133 extern const struct ssb_bus_ops ssb_host_soc_ops;
0134
0135 extern int ssb_host_soc_get_invariants(struct ssb_bus *bus,
0136 struct ssb_init_invariants *iv);
0137 #endif
0138
0139
0140 extern const char *ssb_core_name(u16 coreid);
0141 extern int ssb_bus_scan(struct ssb_bus *bus,
0142 unsigned long baseaddr);
0143 extern void ssb_iounmap(struct ssb_bus *ssb);
0144
0145
0146
0147 extern
0148 ssize_t ssb_attr_sprom_show(struct ssb_bus *bus, char *buf,
0149 int (*sprom_read)(struct ssb_bus *bus, u16 *sprom));
0150 extern
0151 ssize_t ssb_attr_sprom_store(struct ssb_bus *bus,
0152 const char *buf, size_t count,
0153 int (*sprom_check_crc)(const u16 *sprom, size_t size),
0154 int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom));
0155 extern int ssb_fill_sprom_with_fallback(struct ssb_bus *bus,
0156 struct ssb_sprom *out);
0157
0158
0159
0160 extern u32 ssb_calc_clock_rate(u32 plltype, u32 n, u32 m);
0161 extern struct ssb_bus *ssb_pci_dev_to_bus(struct pci_dev *pdev);
0162 int ssb_for_each_bus_call(unsigned long data,
0163 int (*func)(struct ssb_bus *bus, unsigned long data));
0164 extern struct ssb_bus *ssb_pcmcia_dev_to_bus(struct pcmcia_device *pdev);
0165
0166 struct ssb_freeze_context {
0167
0168 struct ssb_bus *bus;
0169
0170 bool device_frozen[SSB_MAX_NR_CORES];
0171 };
0172 extern int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx);
0173 extern int ssb_devices_thaw(struct ssb_freeze_context *ctx);
0174
0175
0176
0177
0178 #ifdef CONFIG_SSB_B43_PCI_BRIDGE
0179 extern int __init b43_pci_ssb_bridge_init(void);
0180 extern void __exit b43_pci_ssb_bridge_exit(void);
0181 #else
0182 static inline int b43_pci_ssb_bridge_init(void)
0183 {
0184 return 0;
0185 }
0186 static inline void b43_pci_ssb_bridge_exit(void)
0187 {
0188 }
0189 #endif
0190
0191
0192 extern u32 ssb_pmu_get_cpu_clock(struct ssb_chipcommon *cc);
0193 extern u32 ssb_pmu_get_controlclock(struct ssb_chipcommon *cc);
0194 extern u32 ssb_pmu_get_alp_clock(struct ssb_chipcommon *cc);
0195
0196 extern u32 ssb_chipco_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt,
0197 u32 ticks);
0198 extern u32 ssb_chipco_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms);
0199
0200
0201 #ifdef CONFIG_SSB_SFLASH
0202 int ssb_sflash_init(struct ssb_chipcommon *cc);
0203 #else
0204 static inline int ssb_sflash_init(struct ssb_chipcommon *cc)
0205 {
0206 pr_err("Serial flash not supported\n");
0207 return 0;
0208 }
0209 #endif
0210
0211 #ifdef CONFIG_SSB_DRIVER_MIPS
0212 extern struct platform_device ssb_pflash_dev;
0213 #endif
0214
0215 #ifdef CONFIG_SSB_SFLASH
0216 extern struct platform_device ssb_sflash_dev;
0217 #endif
0218
0219 #ifdef CONFIG_SSB_DRIVER_EXTIF
0220 extern u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks);
0221 extern u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms);
0222 #else
0223 static inline u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt,
0224 u32 ticks)
0225 {
0226 return 0;
0227 }
0228 static inline u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt,
0229 u32 ms)
0230 {
0231 return 0;
0232 }
0233 #endif
0234
0235 #ifdef CONFIG_SSB_EMBEDDED
0236 extern int ssb_watchdog_register(struct ssb_bus *bus);
0237 #else
0238 static inline int ssb_watchdog_register(struct ssb_bus *bus)
0239 {
0240 return 0;
0241 }
0242 #endif
0243
0244 #ifdef CONFIG_SSB_DRIVER_EXTIF
0245 extern void ssb_extif_init(struct ssb_extif *extif);
0246 #else
0247 static inline void ssb_extif_init(struct ssb_extif *extif)
0248 {
0249 }
0250 #endif
0251
0252 #ifdef CONFIG_SSB_DRIVER_GPIO
0253 extern int ssb_gpio_init(struct ssb_bus *bus);
0254 extern int ssb_gpio_unregister(struct ssb_bus *bus);
0255 #else
0256 static inline int ssb_gpio_init(struct ssb_bus *bus)
0257 {
0258 return -ENOTSUPP;
0259 }
0260 static inline int ssb_gpio_unregister(struct ssb_bus *bus)
0261 {
0262 return 0;
0263 }
0264 #endif
0265
0266 #endif