bcma_private.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. #ifdef CONFIG_BCMA_DRIVER_MIPS
  41. void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
  42. extern struct platform_device bcma_pflash_dev;
  43. #endif /* CONFIG_BCMA_DRIVER_MIPS */
  44. /* driver_chipcommon_b.c */
  45. int bcma_core_chipcommon_b_init(struct bcma_drv_cc_b *ccb);
  46. void bcma_core_chipcommon_b_free(struct bcma_drv_cc_b *ccb);
  47. /* driver_chipcommon_pmu.c */
  48. void bcma_pmu_early_init(struct bcma_drv_cc *cc);
  49. void bcma_pmu_init(struct bcma_drv_cc *cc);
  50. u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc);
  51. u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc);
  52. #ifdef CONFIG_BCMA_SFLASH
  53. /* driver_chipcommon_sflash.c */
  54. int bcma_sflash_init(struct bcma_drv_cc *cc);
  55. extern struct platform_device bcma_sflash_dev;
  56. #else
  57. static inline int bcma_sflash_init(struct bcma_drv_cc *cc)
  58. {
  59. bcma_err(cc->core->bus, "Serial flash not supported\n");
  60. return 0;
  61. }
  62. #endif /* CONFIG_BCMA_SFLASH */
  63. #ifdef CONFIG_BCMA_NFLASH
  64. /* driver_chipcommon_nflash.c */
  65. int bcma_nflash_init(struct bcma_drv_cc *cc);
  66. extern struct platform_device bcma_nflash_dev;
  67. #else
  68. static inline int bcma_nflash_init(struct bcma_drv_cc *cc)
  69. {
  70. bcma_err(cc->core->bus, "NAND flash not supported\n");
  71. return 0;
  72. }
  73. #endif /* CONFIG_BCMA_NFLASH */
  74. #ifdef CONFIG_BCMA_HOST_PCI
  75. /* host_pci.c */
  76. extern int __init bcma_host_pci_init(void);
  77. extern void __exit bcma_host_pci_exit(void);
  78. #endif /* CONFIG_BCMA_HOST_PCI */
  79. /* host_soc.c */
  80. #if defined(CONFIG_BCMA_HOST_SOC) && defined(CONFIG_OF)
  81. extern int __init bcma_host_soc_register_driver(void);
  82. extern void __exit bcma_host_soc_unregister_driver(void);
  83. #else
  84. static inline int __init bcma_host_soc_register_driver(void)
  85. {
  86. return 0;
  87. }
  88. static inline void __exit bcma_host_soc_unregister_driver(void)
  89. {
  90. }
  91. #endif /* CONFIG_BCMA_HOST_SOC && CONFIG_OF */
  92. /* driver_pci.c */
  93. #ifdef CONFIG_BCMA_DRIVER_PCI
  94. u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
  95. void bcma_core_pci_early_init(struct bcma_drv_pci *pc);
  96. void bcma_core_pci_init(struct bcma_drv_pci *pc);
  97. void bcma_core_pci_up(struct bcma_drv_pci *pc);
  98. void bcma_core_pci_down(struct bcma_drv_pci *pc);
  99. #else
  100. static inline void bcma_core_pci_early_init(struct bcma_drv_pci *pc)
  101. {
  102. WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
  103. }
  104. static inline void bcma_core_pci_init(struct bcma_drv_pci *pc)
  105. {
  106. /* Initialization is required for PCI hosted bus */
  107. WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
  108. }
  109. #endif
  110. /* driver_pcie2.c */
  111. #ifdef CONFIG_BCMA_DRIVER_PCI
  112. void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
  113. void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2);
  114. #else
  115. static inline void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
  116. {
  117. /* Initialization is required for PCI hosted bus */
  118. WARN_ON(pcie2->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
  119. }
  120. #endif
  121. extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
  122. #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
  123. bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc);
  124. void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc);
  125. #else
  126. static inline bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc)
  127. {
  128. return false;
  129. }
  130. static inline void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc)
  131. {
  132. }
  133. #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
  134. /**************************************************
  135. * driver_mips.c
  136. **************************************************/
  137. #ifdef CONFIG_BCMA_DRIVER_MIPS
  138. unsigned int bcma_core_mips_irq(struct bcma_device *dev);
  139. void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
  140. void bcma_core_mips_init(struct bcma_drv_mips *mcore);
  141. #else
  142. static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
  143. {
  144. return 0;
  145. }
  146. static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
  147. {
  148. }
  149. static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore)
  150. {
  151. }
  152. #endif
  153. /**************************************************
  154. * driver_gmac_cmn.c
  155. **************************************************/
  156. #ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
  157. void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
  158. #else
  159. static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc)
  160. {
  161. }
  162. #endif
  163. #ifdef CONFIG_BCMA_DRIVER_GPIO
  164. /* driver_gpio.c */
  165. int bcma_gpio_init(struct bcma_drv_cc *cc);
  166. int bcma_gpio_unregister(struct bcma_drv_cc *cc);
  167. #else
  168. static inline int bcma_gpio_init(struct bcma_drv_cc *cc)
  169. {
  170. return -ENOTSUPP;
  171. }
  172. static inline int bcma_gpio_unregister(struct bcma_drv_cc *cc)
  173. {
  174. return 0;
  175. }
  176. #endif /* CONFIG_BCMA_DRIVER_GPIO */
  177. #endif