linux/include/linux/bcma/bcma.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef LINUX_BCMA_H_
#define LINUX_BCMA_H_

#include <linux/pci.h>
#include <linux/mod_devicetable.h>

#include <linux/bcma/bcma_driver_arm_c9.h>
#include <linux/bcma/bcma_driver_chipcommon.h>
#include <linux/bcma/bcma_driver_pci.h>
#include <linux/bcma/bcma_driver_pcie2.h>
#include <linux/bcma/bcma_driver_mips.h>
#include <linux/bcma/bcma_driver_gmac_cmn.h>
#include <linux/ssb/ssb.h> /* SPROM sharing */

#include <linux/bcma/bcma_regs.h>

struct bcma_device;
struct bcma_bus;

enum bcma_hosttype {};

struct bcma_chipinfo {};

struct bcma_boardinfo {};

enum bcma_clkmode {};

struct bcma_host_ops {};

/* Core manufacturers */
#define BCMA_MANUF_ARM
#define BCMA_MANUF_MIPS
#define BCMA_MANUF_BCM

/* Core class values. */
#define BCMA_CL_SIM
#define BCMA_CL_EROM
#define BCMA_CL_CORESIGHT
#define BCMA_CL_VERIF
#define BCMA_CL_OPTIMO
#define BCMA_CL_GEN
#define BCMA_CL_PRIMECELL

/* Core-ID values. */
#define BCMA_CORE_OOB_ROUTER
#define BCMA_CORE_4706_CHIPCOMMON
#define BCMA_CORE_NS_PCIEG2
#define BCMA_CORE_NS_DMA
#define BCMA_CORE_NS_SDIO3
#define BCMA_CORE_NS_USB20
#define BCMA_CORE_NS_USB30
#define BCMA_CORE_NS_A9JTAG
#define BCMA_CORE_NS_DDR23
#define BCMA_CORE_NS_ROM
#define BCMA_CORE_NS_NAND
#define BCMA_CORE_NS_QSPI
#define BCMA_CORE_NS_CHIPCOMMON_B
#define BCMA_CORE_4706_SOC_RAM
#define BCMA_CORE_ARMCA9
#define BCMA_CORE_4706_MAC_GBIT
#define BCMA_CORE_AMEMC
#define BCMA_CORE_ALTA
#define BCMA_CORE_4706_MAC_GBIT_COMMON
#define BCMA_CORE_DDR23_PHY
#define BCMA_CORE_INVALID
#define BCMA_CORE_CHIPCOMMON
#define BCMA_CORE_ILINE20
#define BCMA_CORE_SRAM
#define BCMA_CORE_SDRAM
#define BCMA_CORE_PCI
#define BCMA_CORE_MIPS
#define BCMA_CORE_ETHERNET
#define BCMA_CORE_V90
#define BCMA_CORE_USB11_HOSTDEV
#define BCMA_CORE_ADSL
#define BCMA_CORE_ILINE100
#define BCMA_CORE_IPSEC
#define BCMA_CORE_UTOPIA
#define BCMA_CORE_PCMCIA
#define BCMA_CORE_INTERNAL_MEM
#define BCMA_CORE_MEMC_SDRAM
#define BCMA_CORE_OFDM
#define BCMA_CORE_EXTIF
#define BCMA_CORE_80211
#define BCMA_CORE_PHY_A
#define BCMA_CORE_PHY_B
#define BCMA_CORE_PHY_G
#define BCMA_CORE_MIPS_3302
#define BCMA_CORE_USB11_HOST
#define BCMA_CORE_USB11_DEV
#define BCMA_CORE_USB20_HOST
#define BCMA_CORE_USB20_DEV
#define BCMA_CORE_SDIO_HOST
#define BCMA_CORE_ROBOSWITCH
#define BCMA_CORE_PARA_ATA
#define BCMA_CORE_SATA_XORDMA
#define BCMA_CORE_ETHERNET_GBIT
#define BCMA_CORE_PCIE
#define BCMA_CORE_PHY_N
#define BCMA_CORE_SRAM_CTL
#define BCMA_CORE_MINI_MACPHY
#define BCMA_CORE_ARM_1176
#define BCMA_CORE_ARM_7TDMI
#define BCMA_CORE_PHY_LP
#define BCMA_CORE_PMU
#define BCMA_CORE_PHY_SSN
#define BCMA_CORE_SDIO_DEV
#define BCMA_CORE_ARM_CM3
#define BCMA_CORE_PHY_HT
#define BCMA_CORE_MIPS_74K
#define BCMA_CORE_MAC_GBIT
#define BCMA_CORE_DDR12_MEM_CTL
#define BCMA_CORE_PCIE_RC
#define BCMA_CORE_OCP_OCP_BRIDGE
#define BCMA_CORE_SHARED_COMMON
#define BCMA_CORE_OCP_AHB_BRIDGE
#define BCMA_CORE_SPI_HOST
#define BCMA_CORE_I2S
#define BCMA_CORE_SDR_DDR1_MEM_CTL
#define BCMA_CORE_SHIM
#define BCMA_CORE_PHY_AC
#define BCMA_CORE_PCIE2
#define BCMA_CORE_USB30_DEV
#define BCMA_CORE_ARM_CR4
#define BCMA_CORE_GCI
#define BCMA_CORE_CMEM
#define BCMA_CORE_ARM_CA7
#define BCMA_CORE_SYS_MEM
#define BCMA_CORE_DEFAULT

#define BCMA_MAX_NR_CORES
#define BCMA_CORE_SIZE

/* Chip IDs of PCIe devices */
#define BCMA_CHIP_ID_BCM4313
#define BCMA_CHIP_ID_BCM43142
#define BCMA_CHIP_ID_BCM43131
#define BCMA_CHIP_ID_BCM43217
#define BCMA_CHIP_ID_BCM43222
#define BCMA_CHIP_ID_BCM43224
#define BCMA_PKG_ID_BCM43224_FAB_CSM
#define BCMA_PKG_ID_BCM43224_FAB_SMIC
#define BCMA_CHIP_ID_BCM43225
#define BCMA_CHIP_ID_BCM43227
#define BCMA_CHIP_ID_BCM43228
#define BCMA_CHIP_ID_BCM43421
#define BCMA_CHIP_ID_BCM43428
#define BCMA_CHIP_ID_BCM43431
#define BCMA_CHIP_ID_BCM43460
#define BCMA_CHIP_ID_BCM4331
#define BCMA_CHIP_ID_BCM6362
#define BCMA_CHIP_ID_BCM4360
#define BCMA_CHIP_ID_BCM4352

/* Chip IDs of SoCs */
#define BCMA_CHIP_ID_BCM4706
#define BCMA_PKG_ID_BCM4706L
#define BCMA_CHIP_ID_BCM4716
#define BCMA_PKG_ID_BCM4716
#define BCMA_PKG_ID_BCM4717
#define BCMA_PKG_ID_BCM4718
#define BCMA_CHIP_ID_BCM47162
#define BCMA_CHIP_ID_BCM4748
#define BCMA_CHIP_ID_BCM4749
#define BCMA_CHIP_ID_BCM5356
#define BCMA_CHIP_ID_BCM5357
#define BCMA_PKG_ID_BCM5358
#define BCMA_PKG_ID_BCM47186
#define BCMA_PKG_ID_BCM5357
#define BCMA_CHIP_ID_BCM53572
#define BCMA_PKG_ID_BCM47188
#define BCMA_CHIP_ID_BCM4707
#define BCMA_PKG_ID_BCM4707
#define BCMA_PKG_ID_BCM4708
#define BCMA_PKG_ID_BCM4709
#define BCMA_CHIP_ID_BCM47094
#define BCMA_CHIP_ID_BCM53018
#define BCMA_CHIP_ID_BCM53573
#define BCMA_PKG_ID_BCM53573
#define BCMA_PKG_ID_BCM47189

/* Board types (on PCI usually equals to the subsystem dev id) */
/* BCM4313 */
#define BCMA_BOARD_TYPE_BCM94313BU
#define BCMA_BOARD_TYPE_BCM94313HM
#define BCMA_BOARD_TYPE_BCM94313EPA
#define BCMA_BOARD_TYPE_BCM94313HMG
/* BCM4716 */
#define BCMA_BOARD_TYPE_BCM94716NR2
/* BCM43224 */
#define BCMA_BOARD_TYPE_BCM943224X21
#define BCMA_BOARD_TYPE_BCM943224X21_FCC
#define BCMA_BOARD_TYPE_BCM943224X21B
#define BCMA_BOARD_TYPE_BCM943224M93
#define BCMA_BOARD_TYPE_BCM943224M93A
#define BCMA_BOARD_TYPE_BCM943224X16
#define BCMA_BOARD_TYPE_BCM94322X9
#define BCMA_BOARD_TYPE_BCM94322M35E
/* BCM43228 */
#define BCMA_BOARD_TYPE_BCM943228BU8
#define BCMA_BOARD_TYPE_BCM943228BU9
#define BCMA_BOARD_TYPE_BCM943228BU
#define BCMA_BOARD_TYPE_BCM943227HM4L
#define BCMA_BOARD_TYPE_BCM943227HMB
#define BCMA_BOARD_TYPE_BCM943228HM4L
#define BCMA_BOARD_TYPE_BCM943228SD
/* BCM4331 */
#define BCMA_BOARD_TYPE_BCM94331X19
#define BCMA_BOARD_TYPE_BCM94331X28
#define BCMA_BOARD_TYPE_BCM94331X28B
#define BCMA_BOARD_TYPE_BCM94331PCIEBT3AX
#define BCMA_BOARD_TYPE_BCM94331X12_2G
#define BCMA_BOARD_TYPE_BCM94331X12_5G
#define BCMA_BOARD_TYPE_BCM94331X29B
#define BCMA_BOARD_TYPE_BCM94331CSAX
#define BCMA_BOARD_TYPE_BCM94331X19C
#define BCMA_BOARD_TYPE_BCM94331X33
#define BCMA_BOARD_TYPE_BCM94331BU
#define BCMA_BOARD_TYPE_BCM94331S9BU
#define BCMA_BOARD_TYPE_BCM94331MC
#define BCMA_BOARD_TYPE_BCM94331MCI
#define BCMA_BOARD_TYPE_BCM94331PCIEBT4
#define BCMA_BOARD_TYPE_BCM94331HM
#define BCMA_BOARD_TYPE_BCM94331PCIEDUAL
#define BCMA_BOARD_TYPE_BCM94331MCH5
#define BCMA_BOARD_TYPE_BCM94331CS
#define BCMA_BOARD_TYPE_BCM94331CD
/* BCM53572 */
#define BCMA_BOARD_TYPE_BCM953572BU
#define BCMA_BOARD_TYPE_BCM953572NR2
#define BCMA_BOARD_TYPE_BCM947188NR2
#define BCMA_BOARD_TYPE_BCM953572SDRNR2
/* BCM43142 */
#define BCMA_BOARD_TYPE_BCM943142HM

struct bcma_device {};

static inline void *bcma_get_drvdata(struct bcma_device *core)
{}
static inline void bcma_set_drvdata(struct bcma_device *core, void *drvdata)
{}

struct bcma_driver {};
extern
int __bcma_driver_register(struct bcma_driver *drv, struct module *owner);
#define bcma_driver_register(drv)

extern void bcma_driver_unregister(struct bcma_driver *drv);

/* module_bcma_driver() - Helper macro for drivers that don't do
 * anything special in module init/exit.  This eliminates a lot of
 * boilerplate.  Each module may only use this macro once, and
 * calling it replaces module_init() and module_exit()
 */
#define module_bcma_driver(__bcma_driver)

/* Set a fallback SPROM.
 * See kdoc at the function definition for complete documentation. */
extern int bcma_arch_register_fallback_sprom(
		int (*sprom_callback)(struct bcma_bus *bus,
		struct ssb_sprom *out));

struct bcma_bus {};

static inline u32 bcma_read8(struct bcma_device *core, u16 offset)
{}
static inline u32 bcma_read16(struct bcma_device *core, u16 offset)
{}
static inline u32 bcma_read32(struct bcma_device *core, u16 offset)
{}
static inline
void bcma_write8(struct bcma_device *core, u16 offset, u32 value)
{}
static inline
void bcma_write16(struct bcma_device *core, u16 offset, u32 value)
{}
static inline
void bcma_write32(struct bcma_device *core, u16 offset, u32 value)
{}
#ifdef CONFIG_BCMA_BLOCKIO
static inline void bcma_block_read(struct bcma_device *core, void *buffer,
				   size_t count, u16 offset, u8 reg_width)
{}
static inline void bcma_block_write(struct bcma_device *core,
				    const void *buffer, size_t count,
				    u16 offset, u8 reg_width)
{}
#endif
static inline u32 bcma_aread32(struct bcma_device *core, u16 offset)
{}
static inline
void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value)
{}

static inline void bcma_mask32(struct bcma_device *cc, u16 offset, u32 mask)
{}
static inline void bcma_set32(struct bcma_device *cc, u16 offset, u32 set)
{}
static inline void bcma_maskset32(struct bcma_device *cc,
				  u16 offset, u32 mask, u32 set)
{}
static inline void bcma_mask16(struct bcma_device *cc, u16 offset, u16 mask)
{}
static inline void bcma_set16(struct bcma_device *cc, u16 offset, u16 set)
{}
static inline void bcma_maskset16(struct bcma_device *cc,
				  u16 offset, u16 mask, u16 set)
{}

extern struct bcma_device *bcma_find_core_unit(struct bcma_bus *bus, u16 coreid,
					       u8 unit);
static inline struct bcma_device *bcma_find_core(struct bcma_bus *bus,
						 u16 coreid)
{}

#ifdef CONFIG_BCMA_HOST_PCI
extern void bcma_host_pci_up(struct bcma_bus *bus);
extern void bcma_host_pci_down(struct bcma_bus *bus);
extern int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
				 struct bcma_device *core, bool enable);
#else
static inline void bcma_host_pci_up(struct bcma_bus *bus)
{
}
static inline void bcma_host_pci_down(struct bcma_bus *bus)
{
}
static inline int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
					struct bcma_device *core, bool enable)
{
	if (bus->hosttype == BCMA_HOSTTYPE_PCI)
		return -ENOTSUPP;
	return 0;
}
#endif

extern bool bcma_core_is_enabled(struct bcma_device *core);
extern void bcma_core_disable(struct bcma_device *core, u32 flags);
extern int bcma_core_enable(struct bcma_device *core, u32 flags);
extern void bcma_core_set_clockmode(struct bcma_device *core,
				    enum bcma_clkmode clkmode);
extern void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status,
			      bool on);
extern u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset);
#define BCMA_DMA_TRANSLATION_MASK
#define BCMA_DMA_TRANSLATION_NONE
#define BCMA_DMA_TRANSLATION_DMA32_CMT
#define BCMA_DMA_TRANSLATION_DMA64_CMT
extern u32 bcma_core_dma_translation(struct bcma_device *core);

extern unsigned int bcma_core_irq(struct bcma_device *core, int num);

#endif /* LINUX_BCMA_H_ */