ssb_private.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #ifndef LINUX_SSB_PRIVATE_H_
  2. #define LINUX_SSB_PRIVATE_H_
  3. #include <linux/ssb/ssb.h>
  4. #include <linux/types.h>
  5. #define PFX "ssb: "
  6. #ifdef CONFIG_SSB_SILENT
  7. # define ssb_printk(fmt, x...) do { /* nothing */ } while (0)
  8. #else
  9. # define ssb_printk printk
  10. #endif /* CONFIG_SSB_SILENT */
  11. /* dprintk: Debugging printk; vanishes for non-debug compilation */
  12. #ifdef CONFIG_SSB_DEBUG
  13. # define ssb_dprintk(fmt, x...) ssb_printk(fmt , ##x)
  14. #else
  15. # define ssb_dprintk(fmt, x...) do { /* nothing */ } while (0)
  16. #endif
  17. #ifdef CONFIG_SSB_DEBUG
  18. # define SSB_WARN_ON(x) WARN_ON(x)
  19. # define SSB_BUG_ON(x) BUG_ON(x)
  20. #else
  21. static inline int __ssb_do_nothing(int x) { return x; }
  22. # define SSB_WARN_ON(x) __ssb_do_nothing(unlikely(!!(x)))
  23. # define SSB_BUG_ON(x) __ssb_do_nothing(unlikely(!!(x)))
  24. #endif
  25. /* pci.c */
  26. #ifdef CONFIG_SSB_PCIHOST
  27. extern int ssb_pci_switch_core(struct ssb_bus *bus,
  28. struct ssb_device *dev);
  29. extern int ssb_pci_switch_coreidx(struct ssb_bus *bus,
  30. u8 coreidx);
  31. extern int ssb_pci_xtal(struct ssb_bus *bus, u32 what,
  32. int turn_on);
  33. extern int ssb_pci_get_invariants(struct ssb_bus *bus,
  34. struct ssb_init_invariants *iv);
  35. extern void ssb_pci_exit(struct ssb_bus *bus);
  36. extern int ssb_pci_init(struct ssb_bus *bus);
  37. extern const struct ssb_bus_ops ssb_pci_ops;
  38. #else /* CONFIG_SSB_PCIHOST */
  39. static inline int ssb_pci_switch_core(struct ssb_bus *bus,
  40. struct ssb_device *dev)
  41. {
  42. return 0;
  43. }
  44. static inline int ssb_pci_switch_coreidx(struct ssb_bus *bus,
  45. u8 coreidx)
  46. {
  47. return 0;
  48. }
  49. static inline int ssb_pci_xtal(struct ssb_bus *bus, u32 what,
  50. int turn_on)
  51. {
  52. return 0;
  53. }
  54. static inline void ssb_pci_exit(struct ssb_bus *bus)
  55. {
  56. }
  57. static inline int ssb_pci_init(struct ssb_bus *bus)
  58. {
  59. return 0;
  60. }
  61. #endif /* CONFIG_SSB_PCIHOST */
  62. /* pcmcia.c */
  63. #ifdef CONFIG_SSB_PCMCIAHOST
  64. extern int ssb_pcmcia_switch_core(struct ssb_bus *bus,
  65. struct ssb_device *dev);
  66. extern int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
  67. u8 coreidx);
  68. extern int ssb_pcmcia_switch_segment(struct ssb_bus *bus,
  69. u8 seg);
  70. extern int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
  71. struct ssb_init_invariants *iv);
  72. extern int ssb_pcmcia_init(struct ssb_bus *bus);
  73. extern const struct ssb_bus_ops ssb_pcmcia_ops;
  74. #else /* CONFIG_SSB_PCMCIAHOST */
  75. static inline int ssb_pcmcia_switch_core(struct ssb_bus *bus,
  76. struct ssb_device *dev)
  77. {
  78. return 0;
  79. }
  80. static inline int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
  81. u8 coreidx)
  82. {
  83. return 0;
  84. }
  85. static inline int ssb_pcmcia_switch_segment(struct ssb_bus *bus,
  86. u8 seg)
  87. {
  88. return 0;
  89. }
  90. static inline int ssb_pcmcia_init(struct ssb_bus *bus)
  91. {
  92. return 0;
  93. }
  94. #endif /* CONFIG_SSB_PCMCIAHOST */
  95. /* scan.c */
  96. extern const char *ssb_core_name(u16 coreid);
  97. extern int ssb_bus_scan(struct ssb_bus *bus,
  98. unsigned long baseaddr);
  99. extern void ssb_iounmap(struct ssb_bus *ssb);
  100. /* core.c */
  101. extern u32 ssb_calc_clock_rate(u32 plltype, u32 n, u32 m);
  102. extern int ssb_devices_freeze(struct ssb_bus *bus);
  103. extern int ssb_devices_thaw(struct ssb_bus *bus);
  104. extern struct ssb_bus *ssb_pci_dev_to_bus(struct pci_dev *pdev);
  105. /* b43_pci_bridge.c */
  106. #ifdef CONFIG_SSB_PCIHOST
  107. extern int __init b43_pci_ssb_bridge_init(void);
  108. extern void __exit b43_pci_ssb_bridge_exit(void);
  109. #else /* CONFIG_SSB_PCIHOST */
  110. static inline int b43_pci_ssb_bridge_init(void)
  111. {
  112. return 0;
  113. }
  114. static inline void b43_pci_ssb_bridge_exit(void)
  115. {
  116. }
  117. #endif /* CONFIG_SSB_PCIHOST */
  118. #endif /* LINUX_SSB_PRIVATE_H_ */