bcma_private.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. #ifndef LINUX_BCMA_PRIVATE_H_
  2. #define LINUX_BCMA_PRIVATE_H_
  3. #ifndef pr_fmt
  4. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  5. #endif
  6. #include <linux/bcma/bcma.h>
  7. #include <linux/delay.h>
  8. #define bcma_err(bus, fmt, ...) \
  9. pr_err("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
  10. #define bcma_warn(bus, fmt, ...) \
  11. pr_warn("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
  12. #define bcma_info(bus, fmt, ...) \
  13. pr_info("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
  14. #define bcma_debug(bus, fmt, ...) \
  15. pr_debug("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
  16. struct bcma_bus;
  17. /* main.c */
  18. bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
  19. int timeout);
  20. void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
  21. void bcma_init_bus(struct bcma_bus *bus);
  22. void bcma_unregister_cores(struct bcma_bus *bus);
  23. int bcma_bus_register(struct bcma_bus *bus);
  24. void bcma_bus_unregister(struct bcma_bus *bus);
  25. int __init bcma_bus_early_register(struct bcma_bus *bus);
  26. #ifdef CONFIG_PM
  27. int bcma_bus_suspend(struct bcma_bus *bus);
  28. int bcma_bus_resume(struct bcma_bus *bus);
  29. #endif
  30. struct device *bcma_bus_get_host_dev(struct bcma_bus *bus);
  31. /* scan.c */
  32. void bcma_detect_chip(struct bcma_bus *bus);
  33. int bcma_bus_scan(struct bcma_bus *bus);
  34. /* sprom.c */
  35. int bcma_sprom_get(struct bcma_bus *bus);
  36. /* driver_chipcommon.c */
  37. void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
  38. void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
  39. void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
  40. /* driver_chipcommon_b.c */
  41. int bcma_core_chipcommon_b_init(struct bcma_drv_cc_b *ccb);
  42. void bcma_core_chipcommon_b_free(struct bcma_drv_cc_b *ccb);
  43. /* driver_chipcommon_pmu.c */
  44. void bcma_pmu_early_init(struct bcma_drv_cc *cc);
  45. void bcma_pmu_init(struct bcma_drv_cc *cc);
  46. u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc);
  47. u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc);
  48. /**************************************************
  49. * driver_chipcommon_sflash.c
  50. **************************************************/
  51. #ifdef CONFIG_BCMA_PFLASH
  52. extern struct platform_device bcma_pflash_dev;
  53. int bcma_pflash_init(struct bcma_drv_cc *cc);
  54. #else
  55. static inline int bcma_pflash_init(struct bcma_drv_cc *cc)
  56. {
  57. bcma_err(cc->core->bus, "Parallel flash not supported\n");
  58. return 0;
  59. }
  60. #endif /* CONFIG_BCMA_PFLASH */
  61. #ifdef CONFIG_BCMA_SFLASH
  62. /* driver_chipcommon_sflash.c */
  63. int bcma_sflash_init(struct bcma_drv_cc *cc);
  64. extern struct platform_device bcma_sflash_dev;
  65. #else
  66. static inline int bcma_sflash_init(struct bcma_drv_cc *cc)
  67. {
  68. bcma_err(cc->core->bus, "Serial flash not supported\n");
  69. return 0;
  70. }
  71. #endif /* CONFIG_BCMA_SFLASH */
  72. #ifdef CONFIG_BCMA_NFLASH
  73. /* driver_chipcommon_nflash.c */
  74. int bcma_nflash_init(struct bcma_drv_cc *cc);
  75. extern struct platform_device bcma_nflash_dev;
  76. #else
  77. static inline int bcma_nflash_init(struct bcma_drv_cc *cc)
  78. {
  79. bcma_err(cc->core->bus, "NAND flash not supported\n");
  80. return 0;
  81. }
  82. #endif /* CONFIG_BCMA_NFLASH */
  83. #ifdef CONFIG_BCMA_HOST_PCI
  84. /* host_pci.c */
  85. extern int __init bcma_host_pci_init(void);
  86. extern void __exit bcma_host_pci_exit(void);
  87. #endif /* CONFIG_BCMA_HOST_PCI */
  88. /* host_soc.c */
  89. #if defined(CONFIG_BCMA_HOST_SOC) && defined(CONFIG_OF)
  90. extern int __init bcma_host_soc_register_driver(void);
  91. extern void __exit bcma_host_soc_unregister_driver(void);
  92. #else
  93. static inline int __init bcma_host_soc_register_driver(void)
  94. {
  95. return 0;
  96. }
  97. static inline void __exit bcma_host_soc_unregister_driver(void)
  98. {
  99. }
  100. #endif /* CONFIG_BCMA_HOST_SOC && CONFIG_OF */
  101. /* driver_pci.c */
  102. #ifdef CONFIG_BCMA_DRIVER_PCI
  103. u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
  104. void bcma_core_pci_early_init(struct bcma_drv_pci *pc);
  105. void bcma_core_pci_init(struct bcma_drv_pci *pc);
  106. void bcma_core_pci_up(struct bcma_drv_pci *pc);
  107. void bcma_core_pci_down(struct bcma_drv_pci *pc);
  108. #else
  109. static inline void bcma_core_pci_early_init(struct bcma_drv_pci *pc)
  110. {
  111. WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
  112. }
  113. static inline void bcma_core_pci_init(struct bcma_drv_pci *pc)
  114. {
  115. /* Initialization is required for PCI hosted bus */
  116. WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
  117. }
  118. #endif
  119. /* driver_pcie2.c */
  120. #ifdef CONFIG_BCMA_DRIVER_PCI
  121. void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
  122. void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2);
  123. #else
  124. static inline void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
  125. {
  126. /* Initialization is required for PCI hosted bus */
  127. WARN_ON(pcie2->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
  128. }
  129. #endif
  130. extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
  131. #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
  132. bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc);
  133. void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc);
  134. #else
  135. static inline bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc)
  136. {
  137. return false;
  138. }
  139. static inline void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc)
  140. {
  141. }
  142. #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
  143. /**************************************************
  144. * driver_mips.c
  145. **************************************************/
  146. #ifdef CONFIG_BCMA_DRIVER_MIPS
  147. unsigned int bcma_core_mips_irq(struct bcma_device *dev);
  148. void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
  149. void bcma_core_mips_init(struct bcma_drv_mips *mcore);
  150. #else
  151. static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
  152. {
  153. return 0;
  154. }
  155. static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
  156. {
  157. }
  158. static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore)
  159. {
  160. }
  161. #endif
  162. /**************************************************
  163. * driver_gmac_cmn.c
  164. **************************************************/
  165. #ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
  166. void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
  167. #else
  168. static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc)
  169. {
  170. }
  171. #endif
  172. #ifdef CONFIG_BCMA_DRIVER_GPIO
  173. /* driver_gpio.c */
  174. int bcma_gpio_init(struct bcma_drv_cc *cc);
  175. int bcma_gpio_unregister(struct bcma_drv_cc *cc);
  176. #else
  177. static inline int bcma_gpio_init(struct bcma_drv_cc *cc)
  178. {
  179. return -ENOTSUPP;
  180. }
  181. static inline int bcma_gpio_unregister(struct bcma_drv_cc *cc)
  182. {
  183. return 0;
  184. }
  185. #endif /* CONFIG_BCMA_DRIVER_GPIO */
  186. #endif