ssb_private.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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_hardware_setup(struct ssb_bus *bus);
  73. extern void ssb_pcmcia_exit(struct ssb_bus *bus);
  74. extern int ssb_pcmcia_init(struct ssb_bus *bus);
  75. extern const struct ssb_bus_ops ssb_pcmcia_ops;
  76. #else /* CONFIG_SSB_PCMCIAHOST */
  77. static inline int ssb_pcmcia_switch_core(struct ssb_bus *bus,
  78. struct ssb_device *dev)
  79. {
  80. return 0;
  81. }
  82. static inline int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
  83. u8 coreidx)
  84. {
  85. return 0;
  86. }
  87. static inline int ssb_pcmcia_switch_segment(struct ssb_bus *bus,
  88. u8 seg)
  89. {
  90. return 0;
  91. }
  92. static inline int ssb_pcmcia_hardware_setup(struct ssb_bus *bus)
  93. {
  94. return 0;
  95. }
  96. static inline void ssb_pcmcia_exit(struct ssb_bus *bus)
  97. {
  98. }
  99. static inline int ssb_pcmcia_init(struct ssb_bus *bus)
  100. {
  101. return 0;
  102. }
  103. #endif /* CONFIG_SSB_PCMCIAHOST */
  104. /* scan.c */
  105. extern const char *ssb_core_name(u16 coreid);
  106. extern int ssb_bus_scan(struct ssb_bus *bus,
  107. unsigned long baseaddr);
  108. extern void ssb_iounmap(struct ssb_bus *ssb);
  109. /* sprom.c */
  110. extern
  111. ssize_t ssb_attr_sprom_show(struct ssb_bus *bus, char *buf,
  112. int (*sprom_read)(struct ssb_bus *bus, u16 *sprom));
  113. extern
  114. ssize_t ssb_attr_sprom_store(struct ssb_bus *bus,
  115. const char *buf, size_t count,
  116. int (*sprom_check_crc)(const u16 *sprom, size_t size),
  117. int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom));
  118. extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
  119. /* core.c */
  120. extern u32 ssb_calc_clock_rate(u32 plltype, u32 n, u32 m);
  121. extern int ssb_devices_freeze(struct ssb_bus *bus);
  122. extern int ssb_devices_thaw(struct ssb_bus *bus);
  123. extern struct ssb_bus *ssb_pci_dev_to_bus(struct pci_dev *pdev);
  124. int ssb_for_each_bus_call(unsigned long data,
  125. int (*func)(struct ssb_bus *bus, unsigned long data));
  126. extern struct ssb_bus *ssb_pcmcia_dev_to_bus(struct pcmcia_device *pdev);
  127. /* b43_pci_bridge.c */
  128. #ifdef CONFIG_SSB_B43_PCI_BRIDGE
  129. extern int __init b43_pci_ssb_bridge_init(void);
  130. extern void __exit b43_pci_ssb_bridge_exit(void);
  131. #else /* CONFIG_SSB_B43_PCI_BRIDGR */
  132. static inline int b43_pci_ssb_bridge_init(void)
  133. {
  134. return 0;
  135. }
  136. static inline void b43_pci_ssb_bridge_exit(void)
  137. {
  138. }
  139. #endif /* CONFIG_SSB_PCIHOST */
  140. #endif /* LINUX_SSB_PRIVATE_H_ */