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