1 #ifndef LINUX_BCMA_PRIVATE_H_
2 #define LINUX_BCMA_PRIVATE_H_
5 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
8 #include <linux/bcma/bcma.h>
9 #include <linux/delay.h>
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__)
23 bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
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);
32 int bcma_bus_suspend(struct bcma_bus *bus);
33 int bcma_bus_resume(struct bcma_bus *bus);
35 struct device *bcma_bus_get_host_dev(struct bcma_bus *bus);
38 void bcma_detect_chip(struct bcma_bus *bus);
39 int bcma_bus_scan(struct bcma_bus *bus);
42 int bcma_sprom_get(struct bcma_bus *bus);
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 */
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);
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);
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;
68 static inline int bcma_sflash_init(struct bcma_drv_cc *cc)
70 bcma_err(cc->core->bus, "Serial flash not supported\n");
73 #endif /* CONFIG_BCMA_SFLASH */
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;
80 static inline int bcma_nflash_init(struct bcma_drv_cc *cc)
82 bcma_err(cc->core->bus, "NAND flash not supported\n");
85 #endif /* CONFIG_BCMA_NFLASH */
87 #ifdef CONFIG_BCMA_HOST_PCI
89 extern int __init bcma_host_pci_init(void);
90 extern void __exit bcma_host_pci_exit(void);
91 #endif /* CONFIG_BCMA_HOST_PCI */
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);
98 static inline int __init bcma_host_soc_register_driver(void)
102 static inline void __exit bcma_host_soc_unregister_driver(void)
105 #endif /* CONFIG_BCMA_HOST_SOC && CONFIG_OF */
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);
115 static inline void bcma_core_pci_early_init(struct bcma_drv_pci *pc)
117 WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
119 static inline void bcma_core_pci_init(struct bcma_drv_pci *pc)
121 /* Initialization is required for PCI hosted bus */
122 WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
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);
131 static inline void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
133 /* Initialization is required for PCI hosted bus */
134 WARN_ON(pcie2->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
138 extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
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);
144 static inline bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc)
148 static inline void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc)
151 #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
153 /**************************************************
155 **************************************************/
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);
162 static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
166 static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
169 static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore)
174 /**************************************************
176 **************************************************/
178 #ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
179 void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
181 static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc)
186 #ifdef CONFIG_BCMA_DRIVER_GPIO
188 int bcma_gpio_init(struct bcma_drv_cc *cc);
189 int bcma_gpio_unregister(struct bcma_drv_cc *cc);
191 static inline int bcma_gpio_init(struct bcma_drv_cc *cc)
195 static inline int bcma_gpio_unregister(struct bcma_drv_cc *cc)
199 #endif /* CONFIG_BCMA_DRIVER_GPIO */