0001
0002 #ifndef LINUX_BCMA_PRIVATE_H_
0003 #define LINUX_BCMA_PRIVATE_H_
0004
0005 #ifndef pr_fmt
0006 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
0007 #endif
0008
0009 #include <linux/bcma/bcma.h>
0010 #include <linux/delay.h>
0011
0012 #define bcma_err(bus, fmt, ...) \
0013 dev_err((bus)->dev, "bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
0014 #define bcma_warn(bus, fmt, ...) \
0015 dev_warn((bus)->dev, "bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
0016 #define bcma_info(bus, fmt, ...) \
0017 dev_info((bus)->dev, "bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
0018 #define bcma_debug(bus, fmt, ...) \
0019 dev_dbg((bus)->dev, "bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
0020
0021 struct bcma_bus;
0022
0023
0024 bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
0025 int timeout);
0026 void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
0027 void bcma_init_bus(struct bcma_bus *bus);
0028 void bcma_unregister_cores(struct bcma_bus *bus);
0029 int bcma_bus_register(struct bcma_bus *bus);
0030 void bcma_bus_unregister(struct bcma_bus *bus);
0031 int __init bcma_bus_early_register(struct bcma_bus *bus);
0032 #ifdef CONFIG_PM
0033 int bcma_bus_suspend(struct bcma_bus *bus);
0034 int bcma_bus_resume(struct bcma_bus *bus);
0035 #endif
0036
0037
0038 void bcma_detect_chip(struct bcma_bus *bus);
0039 int bcma_bus_scan(struct bcma_bus *bus);
0040
0041
0042 int bcma_sprom_get(struct bcma_bus *bus);
0043
0044
0045 void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
0046 void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
0047 void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
0048 #ifdef CONFIG_BCMA_DRIVER_MIPS
0049 void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
0050 #endif
0051
0052
0053 int bcma_core_chipcommon_b_init(struct bcma_drv_cc_b *ccb);
0054 void bcma_core_chipcommon_b_free(struct bcma_drv_cc_b *ccb);
0055
0056
0057 void bcma_pmu_early_init(struct bcma_drv_cc *cc);
0058 void bcma_pmu_init(struct bcma_drv_cc *cc);
0059 u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc);
0060 u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc);
0061
0062
0063
0064
0065
0066 #ifdef CONFIG_BCMA_PFLASH
0067 extern struct platform_device bcma_pflash_dev;
0068 int bcma_pflash_init(struct bcma_drv_cc *cc);
0069 #else
0070 static inline int bcma_pflash_init(struct bcma_drv_cc *cc)
0071 {
0072 bcma_err(cc->core->bus, "Parallel flash not supported\n");
0073 return 0;
0074 }
0075 #endif
0076
0077 #ifdef CONFIG_BCMA_SFLASH
0078
0079 int bcma_sflash_init(struct bcma_drv_cc *cc);
0080 extern struct platform_device bcma_sflash_dev;
0081 #else
0082 static inline int bcma_sflash_init(struct bcma_drv_cc *cc)
0083 {
0084 bcma_err(cc->core->bus, "Serial flash not supported\n");
0085 return 0;
0086 }
0087 #endif
0088
0089 #ifdef CONFIG_BCMA_NFLASH
0090
0091 int bcma_nflash_init(struct bcma_drv_cc *cc);
0092 extern struct platform_device bcma_nflash_dev;
0093 #else
0094 static inline int bcma_nflash_init(struct bcma_drv_cc *cc)
0095 {
0096 bcma_err(cc->core->bus, "NAND flash not supported\n");
0097 return 0;
0098 }
0099 #endif
0100
0101 #ifdef CONFIG_BCMA_HOST_PCI
0102
0103 extern int __init bcma_host_pci_init(void);
0104 extern void __exit bcma_host_pci_exit(void);
0105 #endif
0106
0107
0108 #if defined(CONFIG_BCMA_HOST_SOC) && defined(CONFIG_OF)
0109 extern int __init bcma_host_soc_register_driver(void);
0110 extern void __exit bcma_host_soc_unregister_driver(void);
0111 #else
0112 static inline int __init bcma_host_soc_register_driver(void)
0113 {
0114 return 0;
0115 }
0116 static inline void __exit bcma_host_soc_unregister_driver(void)
0117 {
0118 }
0119 #endif
0120
0121
0122 #ifdef CONFIG_BCMA_DRIVER_PCI
0123 u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
0124 void bcma_core_pci_early_init(struct bcma_drv_pci *pc);
0125 void bcma_core_pci_init(struct bcma_drv_pci *pc);
0126 void bcma_core_pci_up(struct bcma_drv_pci *pc);
0127 void bcma_core_pci_down(struct bcma_drv_pci *pc);
0128 #else
0129 static inline void bcma_core_pci_early_init(struct bcma_drv_pci *pc)
0130 {
0131 WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
0132 }
0133 static inline void bcma_core_pci_init(struct bcma_drv_pci *pc)
0134 {
0135
0136 WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
0137 }
0138 #endif
0139
0140
0141 #ifdef CONFIG_BCMA_DRIVER_PCI
0142 void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
0143 void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2);
0144 #else
0145 static inline void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
0146 {
0147
0148 WARN_ON(pcie2->core->bus->hosttype == BCMA_HOSTTYPE_PCI);
0149 }
0150 #endif
0151
0152 extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
0153
0154 #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
0155 bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc);
0156 void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc);
0157 #else
0158 static inline bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc)
0159 {
0160 return false;
0161 }
0162 static inline void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc)
0163 {
0164 }
0165 #endif
0166
0167
0168
0169
0170
0171 #ifdef CONFIG_BCMA_DRIVER_MIPS
0172 unsigned int bcma_core_mips_irq(struct bcma_device *dev);
0173 void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
0174 void bcma_core_mips_init(struct bcma_drv_mips *mcore);
0175 #else
0176 static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
0177 {
0178 return 0;
0179 }
0180 static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
0181 {
0182 }
0183 static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore)
0184 {
0185 }
0186 #endif
0187
0188
0189
0190
0191
0192 #ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
0193 void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
0194 #else
0195 static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc)
0196 {
0197 }
0198 #endif
0199
0200 #ifdef CONFIG_BCMA_DRIVER_GPIO
0201
0202 int bcma_gpio_init(struct bcma_drv_cc *cc);
0203 int bcma_gpio_unregister(struct bcma_drv_cc *cc);
0204 #else
0205 static inline int bcma_gpio_init(struct bcma_drv_cc *cc)
0206 {
0207 return -ENOTSUPP;
0208 }
0209 static inline int bcma_gpio_unregister(struct bcma_drv_cc *cc)
0210 {
0211 return 0;
0212 }
0213 #endif
0214
0215 #endif