bcma_private.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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_CORE_SIZE 0x1000
  9. #define bcma_err(bus, fmt, ...) \
  10. pr_err("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
  11. #define bcma_warn(bus, fmt, ...) \
  12. pr_warn("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
  13. #define bcma_info(bus, fmt, ...) \
  14. pr_info("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
  15. #define bcma_debug(bus, fmt, ...) \
  16. pr_debug("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
  17. struct bcma_bus;
  18. /* main.c */
  19. bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
  20. int timeout);
  21. void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
  22. int bcma_bus_register(struct bcma_bus *bus);
  23. void bcma_bus_unregister(struct bcma_bus *bus);
  24. int __init bcma_bus_early_register(struct bcma_bus *bus,
  25. struct bcma_device *core_cc,
  26. struct bcma_device *core_mips);
  27. #ifdef CONFIG_PM
  28. int bcma_bus_suspend(struct bcma_bus *bus);
  29. int bcma_bus_resume(struct bcma_bus *bus);
  30. #endif
  31. /* scan.c */
  32. int bcma_bus_scan(struct bcma_bus *bus);
  33. int __init bcma_bus_scan_early(struct bcma_bus *bus,
  34. struct bcma_device_id *match,
  35. struct bcma_device *core);
  36. void bcma_init_bus(struct bcma_bus *bus);
  37. /* sprom.c */
  38. int bcma_sprom_get(struct bcma_bus *bus);
  39. /* driver_chipcommon.c */
  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. u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc);
  49. u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc);
  50. #ifdef CONFIG_BCMA_SFLASH
  51. /* driver_chipcommon_sflash.c */
  52. int bcma_sflash_init(struct bcma_drv_cc *cc);
  53. extern struct platform_device bcma_sflash_dev;
  54. #else
  55. static inline int bcma_sflash_init(struct bcma_drv_cc *cc)
  56. {
  57. bcma_err(cc->core->bus, "Serial flash not supported\n");
  58. return 0;
  59. }
  60. #endif /* CONFIG_BCMA_SFLASH */
  61. #ifdef CONFIG_BCMA_NFLASH
  62. /* driver_chipcommon_nflash.c */
  63. int bcma_nflash_init(struct bcma_drv_cc *cc);
  64. extern struct platform_device bcma_nflash_dev;
  65. #else
  66. static inline int bcma_nflash_init(struct bcma_drv_cc *cc)
  67. {
  68. bcma_err(cc->core->bus, "NAND flash not supported\n");
  69. return 0;
  70. }
  71. #endif /* CONFIG_BCMA_NFLASH */
  72. #ifdef CONFIG_BCMA_HOST_PCI
  73. /* host_pci.c */
  74. extern int __init bcma_host_pci_init(void);
  75. extern void __exit bcma_host_pci_exit(void);
  76. #endif /* CONFIG_BCMA_HOST_PCI */
  77. /* host_soc.c */
  78. #if defined(CONFIG_BCMA_HOST_SOC) && defined(CONFIG_OF)
  79. extern int __init bcma_host_soc_register_driver(void);
  80. extern void __exit bcma_host_soc_unregister_driver(void);
  81. #else
  82. static inline int __init bcma_host_soc_register_driver(void)
  83. {
  84. return 0;
  85. }
  86. static inline void __exit bcma_host_soc_unregister_driver(void)
  87. {
  88. }
  89. #endif /* CONFIG_BCMA_HOST_SOC && CONFIG_OF */
  90. /* driver_pci.c */
  91. u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
  92. extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
  93. #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
  94. bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc);
  95. void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc);
  96. #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
  97. #ifdef CONFIG_BCMA_DRIVER_GPIO
  98. /* driver_gpio.c */
  99. int bcma_gpio_init(struct bcma_drv_cc *cc);
  100. int bcma_gpio_unregister(struct bcma_drv_cc *cc);
  101. #else
  102. static inline int bcma_gpio_init(struct bcma_drv_cc *cc)
  103. {
  104. return -ENOTSUPP;
  105. }
  106. static inline int bcma_gpio_unregister(struct bcma_drv_cc *cc)
  107. {
  108. return 0;
  109. }
  110. #endif /* CONFIG_BCMA_DRIVER_GPIO */
  111. #endif