2011-05-10 00:56:46 +08:00
|
|
|
#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>
|
|
|
|
|
2012-07-06 04:07:32 +08:00
|
|
|
#define bcma_err(bus, fmt, ...) \
|
|
|
|
pr_err("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
|
|
|
|
#define bcma_warn(bus, fmt, ...) \
|
|
|
|
pr_warn("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
|
|
|
|
#define bcma_info(bus, fmt, ...) \
|
|
|
|
pr_info("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
|
|
|
|
#define bcma_debug(bus, fmt, ...) \
|
|
|
|
pr_debug("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
|
|
|
|
|
2011-05-10 00:56:46 +08:00
|
|
|
struct bcma_bus;
|
|
|
|
|
|
|
|
/* main.c */
|
2013-06-26 16:02:11 +08:00
|
|
|
bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
|
|
|
|
int timeout);
|
2014-10-03 23:00:24 +08:00
|
|
|
void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
|
2015-01-17 03:59:39 +08:00
|
|
|
void bcma_init_bus(struct bcma_bus *bus);
|
2015-02-09 00:11:50 +08:00
|
|
|
void bcma_unregister_cores(struct bcma_bus *bus);
|
2012-12-22 07:12:59 +08:00
|
|
|
int bcma_bus_register(struct bcma_bus *bus);
|
2011-06-18 07:01:59 +08:00
|
|
|
void bcma_bus_unregister(struct bcma_bus *bus);
|
2015-01-19 15:30:30 +08:00
|
|
|
int __init bcma_bus_early_register(struct bcma_bus *bus);
|
2011-12-10 05:16:07 +08:00
|
|
|
#ifdef CONFIG_PM
|
2012-01-14 06:58:40 +08:00
|
|
|
int bcma_bus_suspend(struct bcma_bus *bus);
|
2011-12-10 05:16:07 +08:00
|
|
|
int bcma_bus_resume(struct bcma_bus *bus);
|
|
|
|
#endif
|
2015-08-03 02:26:52 +08:00
|
|
|
struct device *bcma_bus_get_host_dev(struct bcma_bus *bus);
|
2011-05-10 00:56:46 +08:00
|
|
|
|
|
|
|
/* scan.c */
|
2015-01-17 03:59:39 +08:00
|
|
|
void bcma_detect_chip(struct bcma_bus *bus);
|
2011-05-10 00:56:46 +08:00
|
|
|
int bcma_bus_scan(struct bcma_bus *bus);
|
|
|
|
|
2011-06-02 08:08:51 +08:00
|
|
|
/* sprom.c */
|
|
|
|
int bcma_sprom_get(struct bcma_bus *bus);
|
|
|
|
|
2011-07-23 07:20:10 +08:00
|
|
|
/* driver_chipcommon.c */
|
2015-03-04 21:24:52 +08:00
|
|
|
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);
|
2017-01-13 19:23:35 +08:00
|
|
|
#ifdef CONFIG_BCMA_DRIVER_MIPS
|
|
|
|
void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
|
|
|
|
#endif /* CONFIG_BCMA_DRIVER_MIPS */
|
2011-07-23 07:20:10 +08:00
|
|
|
|
2014-09-09 04:53:36 +08:00
|
|
|
/* 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);
|
|
|
|
|
2011-07-23 07:20:10 +08:00
|
|
|
/* driver_chipcommon_pmu.c */
|
2015-03-04 21:24:52 +08:00
|
|
|
void bcma_pmu_early_init(struct bcma_drv_cc *cc);
|
|
|
|
void bcma_pmu_init(struct bcma_drv_cc *cc);
|
2012-12-07 19:56:56 +08:00
|
|
|
u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc);
|
|
|
|
u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc);
|
2011-07-23 07:20:10 +08:00
|
|
|
|
2016-02-12 17:15:44 +08:00
|
|
|
/**************************************************
|
|
|
|
* 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\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_BCMA_PFLASH */
|
|
|
|
|
2012-07-17 22:26:41 +08:00
|
|
|
#ifdef CONFIG_BCMA_SFLASH
|
|
|
|
/* driver_chipcommon_sflash.c */
|
|
|
|
int bcma_sflash_init(struct bcma_drv_cc *cc);
|
2012-08-11 03:23:53 +08:00
|
|
|
extern struct platform_device bcma_sflash_dev;
|
2012-07-17 22:26:41 +08:00
|
|
|
#else
|
|
|
|
static inline int bcma_sflash_init(struct bcma_drv_cc *cc)
|
|
|
|
{
|
|
|
|
bcma_err(cc->core->bus, "Serial flash not supported\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_BCMA_SFLASH */
|
|
|
|
|
|
|
|
#ifdef CONFIG_BCMA_NFLASH
|
|
|
|
/* driver_chipcommon_nflash.c */
|
|
|
|
int bcma_nflash_init(struct bcma_drv_cc *cc);
|
2012-08-12 19:08:05 +08:00
|
|
|
extern struct platform_device bcma_nflash_dev;
|
2012-07-17 22:26:41 +08:00
|
|
|
#else
|
|
|
|
static inline int bcma_nflash_init(struct bcma_drv_cc *cc)
|
|
|
|
{
|
|
|
|
bcma_err(cc->core->bus, "NAND flash not supported\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_BCMA_NFLASH */
|
|
|
|
|
2011-05-10 00:56:46 +08:00
|
|
|
#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 */
|
|
|
|
|
2014-09-26 06:09:19 +08:00
|
|
|
/* 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 */
|
|
|
|
|
2012-01-31 07:03:33 +08:00
|
|
|
/* driver_pci.c */
|
2015-03-06 01:25:11 +08:00
|
|
|
#ifdef CONFIG_BCMA_DRIVER_PCI
|
2012-01-31 07:03:33 +08:00
|
|
|
u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
|
2015-03-04 21:24:52 +08:00
|
|
|
void bcma_core_pci_early_init(struct bcma_drv_pci *pc);
|
|
|
|
void bcma_core_pci_init(struct bcma_drv_pci *pc);
|
2015-02-09 00:11:47 +08:00
|
|
|
void bcma_core_pci_up(struct bcma_drv_pci *pc);
|
|
|
|
void bcma_core_pci_down(struct bcma_drv_pci *pc);
|
2015-03-06 01:25:11 +08:00
|
|
|
#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
|
2012-01-31 07:03:33 +08:00
|
|
|
|
2015-02-09 00:11:49 +08:00
|
|
|
/* driver_pcie2.c */
|
2015-03-06 01:25:11 +08:00
|
|
|
#ifdef CONFIG_BCMA_DRIVER_PCI
|
2015-03-04 21:24:52 +08:00
|
|
|
void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
|
2015-02-09 00:11:49 +08:00
|
|
|
void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2);
|
2015-03-06 01:25:11 +08:00
|
|
|
#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
|
2015-02-09 00:11:49 +08:00
|
|
|
|
2012-12-06 01:46:02 +08:00
|
|
|
extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
|
|
|
|
|
2011-07-06 01:48:26 +08:00
|
|
|
#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
|
2012-12-22 07:12:59 +08:00
|
|
|
bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc);
|
|
|
|
void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc);
|
2015-01-25 21:02:48 +08:00
|
|
|
#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)
|
|
|
|
{
|
|
|
|
}
|
2011-07-06 01:48:26 +08:00
|
|
|
#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
|
|
|
|
|
2015-03-04 21:24:52 +08:00
|
|
|
/**************************************************
|
|
|
|
* 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
|
|
|
|
|
2012-11-21 06:24:30 +08:00
|
|
|
#ifdef CONFIG_BCMA_DRIVER_GPIO
|
|
|
|
/* driver_gpio.c */
|
|
|
|
int bcma_gpio_init(struct bcma_drv_cc *cc);
|
2013-02-04 06:25:33 +08:00
|
|
|
int bcma_gpio_unregister(struct bcma_drv_cc *cc);
|
2012-11-21 06:24:30 +08:00
|
|
|
#else
|
|
|
|
static inline int bcma_gpio_init(struct bcma_drv_cc *cc)
|
|
|
|
{
|
|
|
|
return -ENOTSUPP;
|
|
|
|
}
|
2013-02-04 06:25:33 +08:00
|
|
|
static inline int bcma_gpio_unregister(struct bcma_drv_cc *cc)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2012-11-21 06:24:30 +08:00
|
|
|
#endif /* CONFIG_BCMA_DRIVER_GPIO */
|
|
|
|
|
2011-05-10 00:56:46 +08:00
|
|
|
#endif
|