Blame view

drivers/bcma/bcma_private.h 6.22 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  /* SPDX-License-Identifier: GPL-2.0 */
8369ae33b   Rafał Miłecki   bcma: add Broadco...
2
3
4
5
6
7
8
9
10
  #ifndef LINUX_BCMA_PRIVATE_H_
  #define LINUX_BCMA_PRIVATE_H_
  
  #ifndef pr_fmt
  #define pr_fmt(fmt)		KBUILD_MODNAME ": " fmt
  #endif
  
  #include <linux/bcma/bcma.h>
  #include <linux/delay.h>
3d9d8af33   Rafał Miłecki   bcma: use custom ...
11
  #define bcma_err(bus, fmt, ...) \
777bc4801   Rafał Miłecki   bcma: use dev_* p...
12
  	dev_err((bus)->dev, "bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
3d9d8af33   Rafał Miłecki   bcma: use custom ...
13
  #define bcma_warn(bus, fmt, ...) \
777bc4801   Rafał Miłecki   bcma: use dev_* p...
14
  	dev_warn((bus)->dev, "bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
3d9d8af33   Rafał Miłecki   bcma: use custom ...
15
  #define bcma_info(bus, fmt, ...) \
777bc4801   Rafał Miłecki   bcma: use dev_* p...
16
  	dev_info((bus)->dev, "bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
3d9d8af33   Rafał Miłecki   bcma: use custom ...
17
  #define bcma_debug(bus, fmt, ...) \
777bc4801   Rafał Miłecki   bcma: use dev_* p...
18
  	dev_dbg((bus)->dev, "bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
3d9d8af33   Rafał Miłecki   bcma: use custom ...
19

8369ae33b   Rafał Miłecki   bcma: add Broadco...
20
21
22
  struct bcma_bus;
  
  /* main.c */
88f9b65d4   Rafał Miłecki   bcma: add support...
23
24
  bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
  		     int timeout);
ab54bc846   Rafał Miłecki   bcma: fill core d...
25
  void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
799038ea9   Rafał Miłecki   bcma: clean bus i...
26
  void bcma_init_bus(struct bcma_bus *bus);
9b6cc9a80   Rafał Miłecki   bcma: enable supp...
27
  void bcma_unregister_cores(struct bcma_bus *bus);
0f58a01dd   Greg Kroah-Hartman   Drivers: bcma: re...
28
  int bcma_bus_register(struct bcma_bus *bus);
440ca98fe   Rafał Miłecki   bcma: clean expor...
29
  void bcma_bus_unregister(struct bcma_bus *bus);
c5ed1df78   Rafał Miłecki   bcma: use standar...
30
  int __init bcma_bus_early_register(struct bcma_bus *bus);
775ab5214   Rafał Miłecki   bcma: support for...
31
  #ifdef CONFIG_PM
685a4ef0d   Linus Torvalds   bcma: add stub fo...
32
  int bcma_bus_suspend(struct bcma_bus *bus);
775ab5214   Rafał Miłecki   bcma: support for...
33
34
  int bcma_bus_resume(struct bcma_bus *bus);
  #endif
8369ae33b   Rafał Miłecki   bcma: add Broadco...
35
36
  
  /* scan.c */
799038ea9   Rafał Miłecki   bcma: clean bus i...
37
  void bcma_detect_chip(struct bcma_bus *bus);
8369ae33b   Rafał Miłecki   bcma: add Broadco...
38
  int bcma_bus_scan(struct bcma_bus *bus);
27f18dc2d   Rafał Miłecki   bcma: read SPROM ...
39
40
  /* sprom.c */
  int bcma_sprom_get(struct bcma_bus *bus);
e3afe0e5b   Hauke Mehrtens   bcma: add serial ...
41
  /* driver_chipcommon.c */
0a4e699a4   Rafał Miłecki   bcma: move intern...
42
43
44
  void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
  void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
  void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
7195439d1   Rafał Miłecki   Revert "bcma: ini...
45
46
47
  #ifdef CONFIG_BCMA_DRIVER_MIPS
  void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
  #endif /* CONFIG_BCMA_DRIVER_MIPS */
e3afe0e5b   Hauke Mehrtens   bcma: add serial ...
48

1716bcf3f   Hauke Mehrtens   bcma: add support...
49
50
51
  /* driver_chipcommon_b.c */
  int bcma_core_chipcommon_b_init(struct bcma_drv_cc_b *ccb);
  void bcma_core_chipcommon_b_free(struct bcma_drv_cc_b *ccb);
e3afe0e5b   Hauke Mehrtens   bcma: add serial ...
52
  /* driver_chipcommon_pmu.c */
0a4e699a4   Rafał Miłecki   bcma: move intern...
53
54
  void bcma_pmu_early_init(struct bcma_drv_cc *cc);
  void bcma_pmu_init(struct bcma_drv_cc *cc);
5b5ac4144   Rafał Miłecki   bcma: unify namin...
55
56
  u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc);
  u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc);
e3afe0e5b   Hauke Mehrtens   bcma: add serial ...
57

d6a3b51ad   Rafał Miłecki   bcma: move parall...
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
  /**************************************************
   * driver_chipcommon_sflash.c
   **************************************************/
  
  #ifdef CONFIG_BCMA_PFLASH
  extern struct platform_device bcma_pflash_dev;
  int bcma_pflash_init(struct bcma_drv_cc *cc);
  #else
  static inline int bcma_pflash_init(struct bcma_drv_cc *cc)
  {
  	bcma_err(cc->core->bus, "Parallel flash not supported
  ");
  	return 0;
  }
  #endif /* CONFIG_BCMA_PFLASH */
23cb3b212   Rafał Miłecki   bcma: add place f...
73
74
75
  #ifdef CONFIG_BCMA_SFLASH
  /* driver_chipcommon_sflash.c */
  int bcma_sflash_init(struct bcma_drv_cc *cc);
d57ef3a6a   Rafał Miłecki   bcma: detect and ...
76
  extern struct platform_device bcma_sflash_dev;
23cb3b212   Rafał Miłecki   bcma: add place f...
77
78
79
80
81
82
83
84
85
86
87
88
  #else
  static inline int bcma_sflash_init(struct bcma_drv_cc *cc)
  {
  	bcma_err(cc->core->bus, "Serial flash not supported
  ");
  	return 0;
  }
  #endif /* CONFIG_BCMA_SFLASH */
  
  #ifdef CONFIG_BCMA_NFLASH
  /* driver_chipcommon_nflash.c */
  int bcma_nflash_init(struct bcma_drv_cc *cc);
371a00448   Rafał Miłecki   bcma: detect and ...
89
  extern struct platform_device bcma_nflash_dev;
23cb3b212   Rafał Miłecki   bcma: add place f...
90
91
92
93
94
95
96
97
  #else
  static inline int bcma_nflash_init(struct bcma_drv_cc *cc)
  {
  	bcma_err(cc->core->bus, "NAND flash not supported
  ");
  	return 0;
  }
  #endif /* CONFIG_BCMA_NFLASH */
8369ae33b   Rafał Miłecki   bcma: add Broadco...
98
99
100
101
102
  #ifdef CONFIG_BCMA_HOST_PCI
  /* host_pci.c */
  extern int __init bcma_host_pci_init(void);
  extern void __exit bcma_host_pci_exit(void);
  #endif /* CONFIG_BCMA_HOST_PCI */
2101e533f   Hauke Mehrtens   bcma: register bc...
103
104
105
106
107
108
109
110
111
112
113
114
115
  /* host_soc.c */
  #if defined(CONFIG_BCMA_HOST_SOC) && defined(CONFIG_OF)
  extern int __init bcma_host_soc_register_driver(void);
  extern void __exit bcma_host_soc_unregister_driver(void);
  #else
  static inline int __init bcma_host_soc_register_driver(void)
  {
  	return 0;
  }
  static inline void __exit bcma_host_soc_unregister_driver(void)
  {
  }
  #endif /* CONFIG_BCMA_HOST_SOC && CONFIG_OF */
4b259a5cc   Hauke Mehrtens   bcma: export bcma...
116
  /* driver_pci.c */
982a40f5c   Rafał Miłecki   bcma: allow disab...
117
  #ifdef CONFIG_BCMA_DRIVER_PCI
4b259a5cc   Hauke Mehrtens   bcma: export bcma...
118
  u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
0a4e699a4   Rafał Miłecki   bcma: move intern...
119
120
  void bcma_core_pci_early_init(struct bcma_drv_pci *pc);
  void bcma_core_pci_init(struct bcma_drv_pci *pc);
4186721d0   Rafał Miłecki   bcma: add helpers...
121
122
  void bcma_core_pci_up(struct bcma_drv_pci *pc);
  void bcma_core_pci_down(struct bcma_drv_pci *pc);
982a40f5c   Rafał Miłecki   bcma: allow disab...
123
124
125
126
127
128
129
130
131
132
133
  #else
  static inline void bcma_core_pci_early_init(struct bcma_drv_pci *pc)
  {
  	WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
  }
  static inline void bcma_core_pci_init(struct bcma_drv_pci *pc)
  {
  	/* Initialization is required for PCI hosted bus */
  	WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
  }
  #endif
4b259a5cc   Hauke Mehrtens   bcma: export bcma...
134

804e27dee   Rafał Miłecki   bcma: support bri...
135
  /* driver_pcie2.c */
982a40f5c   Rafał Miłecki   bcma: allow disab...
136
  #ifdef CONFIG_BCMA_DRIVER_PCI
0a4e699a4   Rafał Miłecki   bcma: move intern...
137
  void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
804e27dee   Rafał Miłecki   bcma: support bri...
138
  void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2);
982a40f5c   Rafał Miłecki   bcma: allow disab...
139
140
141
142
143
144
145
  #else
  static inline void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
  {
  	/* Initialization is required for PCI hosted bus */
  	WARN_ON(pcie2->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
  }
  #endif
804e27dee   Rafał Miłecki   bcma: support bri...
146

a4855f39d   Hauke Mehrtens   bcma: register wa...
147
  extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
9352f69c9   Rafał Miłecki   bcma: detect PCI ...
148
  #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
0f58a01dd   Greg Kroah-Hartman   Drivers: bcma: re...
149
150
  bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc);
  void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc);
ae8ce289e   Rafał Miłecki   bcma: add empty P...
151
152
153
154
155
156
157
158
  #else
  static inline bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc)
  {
  	return false;
  }
  static inline void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc)
  {
  }
9352f69c9   Rafał Miłecki   bcma: detect PCI ...
159
  #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
0a4e699a4   Rafał Miłecki   bcma: move intern...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
  /**************************************************
   * driver_mips.c
   **************************************************/
  
  #ifdef CONFIG_BCMA_DRIVER_MIPS
  unsigned int bcma_core_mips_irq(struct bcma_device *dev);
  void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
  void bcma_core_mips_init(struct bcma_drv_mips *mcore);
  #else
  static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
  {
  	return 0;
  }
  static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
  {
  }
  static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore)
  {
  }
  #endif
  
  /**************************************************
   * driver_gmac_cmn.c
   **************************************************/
  
  #ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
  void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
  #else
  static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc)
  {
  }
  #endif
cf0936b06   Hauke Mehrtens   bcma: add GPIO dr...
192
193
194
  #ifdef CONFIG_BCMA_DRIVER_GPIO
  /* driver_gpio.c */
  int bcma_gpio_init(struct bcma_drv_cc *cc);
c50ae9470   Hauke Mehrtens   bcma: unregister ...
195
  int bcma_gpio_unregister(struct bcma_drv_cc *cc);
cf0936b06   Hauke Mehrtens   bcma: add GPIO dr...
196
197
198
199
200
  #else
  static inline int bcma_gpio_init(struct bcma_drv_cc *cc)
  {
  	return -ENOTSUPP;
  }
c50ae9470   Hauke Mehrtens   bcma: unregister ...
201
202
203
204
  static inline int bcma_gpio_unregister(struct bcma_drv_cc *cc)
  {
  	return 0;
  }
cf0936b06   Hauke Mehrtens   bcma: add GPIO dr...
205
  #endif /* CONFIG_BCMA_DRIVER_GPIO */
8369ae33b   Rafał Miłecki   bcma: add Broadco...
206
  #endif