linux/include/linux/bcma/bcma_driver_pci.h

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

#include <linux/types.h>

struct pci_dev;

/** PCI core registers. **/
#define BCMA_CORE_PCI_CTL
#define BCMA_CORE_PCI_CTL_RST_OE
#define BCMA_CORE_PCI_CTL_RST
#define BCMA_CORE_PCI_CTL_CLK_OE
#define BCMA_CORE_PCI_CTL_CLK
#define BCMA_CORE_PCI_ARBCTL
#define BCMA_CORE_PCI_ARBCTL_INTERN
#define BCMA_CORE_PCI_ARBCTL_EXTERN
#define BCMA_CORE_PCI_ARBCTL_PARKID
#define BCMA_CORE_PCI_ARBCTL_PARKID_LAST
#define BCMA_CORE_PCI_ARBCTL_PARKID_4710
#define BCMA_CORE_PCI_ARBCTL_PARKID_EXT0
#define BCMA_CORE_PCI_ARBCTL_PARKID_EXT1
#define BCMA_CORE_PCI_ISTAT
#define BCMA_CORE_PCI_ISTAT_INTA
#define BCMA_CORE_PCI_ISTAT_INTB
#define BCMA_CORE_PCI_ISTAT_SERR
#define BCMA_CORE_PCI_ISTAT_PERR
#define BCMA_CORE_PCI_ISTAT_PME
#define BCMA_CORE_PCI_IMASK
#define BCMA_CORE_PCI_IMASK_INTA
#define BCMA_CORE_PCI_IMASK_INTB
#define BCMA_CORE_PCI_IMASK_SERR
#define BCMA_CORE_PCI_IMASK_PERR
#define BCMA_CORE_PCI_IMASK_PME
#define BCMA_CORE_PCI_MBOX
#define BCMA_CORE_PCI_MBOX_F0_0
#define BCMA_CORE_PCI_MBOX_F0_1
#define BCMA_CORE_PCI_MBOX_F1_0
#define BCMA_CORE_PCI_MBOX_F1_1
#define BCMA_CORE_PCI_MBOX_F2_0
#define BCMA_CORE_PCI_MBOX_F2_1
#define BCMA_CORE_PCI_MBOX_F3_0
#define BCMA_CORE_PCI_MBOX_F3_1
#define BCMA_CORE_PCI_BCAST_ADDR
#define BCMA_CORE_PCI_BCAST_ADDR_MASK
#define BCMA_CORE_PCI_BCAST_DATA
#define BCMA_CORE_PCI_GPIO_IN
#define BCMA_CORE_PCI_GPIO_OUT
#define BCMA_CORE_PCI_GPIO_ENABLE
#define BCMA_CORE_PCI_GPIO_CTL
#define BCMA_CORE_PCI_SBTOPCI0
#define BCMA_CORE_PCI_SBTOPCI0_MASK
#define BCMA_CORE_PCI_SBTOPCI1
#define BCMA_CORE_PCI_SBTOPCI1_MASK
#define BCMA_CORE_PCI_SBTOPCI2
#define BCMA_CORE_PCI_SBTOPCI2_MASK
#define BCMA_CORE_PCI_CONFIG_ADDR
#define BCMA_CORE_PCI_CONFIG_DATA
#define BCMA_CORE_PCI_MDIO_CONTROL
#define BCMA_CORE_PCI_MDIOCTL_DIVISOR_MASK
#define BCMA_CORE_PCI_MDIOCTL_DIVISOR_VAL
#define BCMA_CORE_PCI_MDIOCTL_PREAM_EN
#define BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE
#define BCMA_CORE_PCI_MDIO_DATA
#define BCMA_CORE_PCI_MDIODATA_MASK
#define BCMA_CORE_PCI_MDIODATA_TA
#define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD
#define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK_OLD
#define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF_OLD
#define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK_OLD
#define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF
#define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK
#define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF
#define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK
#define BCMA_CORE_PCI_MDIODATA_WRITE
#define BCMA_CORE_PCI_MDIODATA_READ
#define BCMA_CORE_PCI_MDIODATA_START
#define BCMA_CORE_PCI_MDIODATA_DEV_ADDR
#define BCMA_CORE_PCI_MDIODATA_BLK_ADDR
#define BCMA_CORE_PCI_MDIODATA_DEV_PLL
#define BCMA_CORE_PCI_MDIODATA_DEV_TX
#define BCMA_CORE_PCI_MDIODATA_DEV_RX
#define BCMA_CORE_PCI_PCIEIND_ADDR
#define BCMA_CORE_PCI_PCIEIND_DATA
#define BCMA_CORE_PCI_CLKREQENCTRL
#define BCMA_CORE_PCI_PCICFG0
#define BCMA_CORE_PCI_PCICFG1
#define BCMA_CORE_PCI_PCICFG2
#define BCMA_CORE_PCI_PCICFG3
#define BCMA_CORE_PCI_SPROM(wordoffset)
#define BCMA_CORE_PCI_SPROM_PI_OFFSET
#define BCMA_CORE_PCI_SPROM_PI_MASK
#define BCMA_CORE_PCI_SPROM_PI_SHIFT
#define BCMA_CORE_PCI_SPROM_MISC_CONFIG
#define BCMA_CORE_PCI_SPROM_L23READY_EXIT_NOPERST
#define BCMA_CORE_PCI_SPROM_CLKREQ_OFFSET_REV5
#define BCMA_CORE_PCI_SPROM_CLKREQ_ENB

/* SBtoPCIx */
#define BCMA_CORE_PCI_SBTOPCI_MEM
#define BCMA_CORE_PCI_SBTOPCI_IO
#define BCMA_CORE_PCI_SBTOPCI_CFG0
#define BCMA_CORE_PCI_SBTOPCI_CFG1
#define BCMA_CORE_PCI_SBTOPCI_PREF
#define BCMA_CORE_PCI_SBTOPCI_BURST
#define BCMA_CORE_PCI_SBTOPCI_MRM
#define BCMA_CORE_PCI_SBTOPCI_RC
#define BCMA_CORE_PCI_SBTOPCI_RC_READ
#define BCMA_CORE_PCI_SBTOPCI_RC_READL
#define BCMA_CORE_PCI_SBTOPCI_RC_READM

/* PCIE protocol PHY diagnostic registers */
#define BCMA_CORE_PCI_PLP_MODEREG
#define BCMA_CORE_PCI_PLP_STATUSREG
#define BCMA_CORE_PCI_PLP_POLARITYINV_STAT
#define BCMA_CORE_PCI_PLP_LTSSMCTRLREG
#define BCMA_CORE_PCI_PLP_LTLINKNUMREG
#define BCMA_CORE_PCI_PLP_LTLANENUMREG
#define BCMA_CORE_PCI_PLP_LTNFTSREG
#define BCMA_CORE_PCI_PLP_ATTNREG
#define BCMA_CORE_PCI_PLP_ATTNMASKREG
#define BCMA_CORE_PCI_PLP_RXERRCTR
#define BCMA_CORE_PCI_PLP_RXFRMERRCTR
#define BCMA_CORE_PCI_PLP_RXERRTHRESHREG
#define BCMA_CORE_PCI_PLP_TESTCTRLREG
#define BCMA_CORE_PCI_PLP_SERDESCTRLOVRDREG
#define BCMA_CORE_PCI_PLP_TIMINGOVRDREG
#define BCMA_CORE_PCI_PLP_RXTXSMDIAGREG
#define BCMA_CORE_PCI_PLP_LTSSMDIAGREG

/* PCIE protocol DLLP diagnostic registers */
#define BCMA_CORE_PCI_DLLP_LCREG
#define BCMA_CORE_PCI_DLLP_LSREG
#define BCMA_CORE_PCI_DLLP_LAREG
#define BCMA_CORE_PCI_DLLP_LSREG_LINKUP
#define BCMA_CORE_PCI_DLLP_LAMASKREG
#define BCMA_CORE_PCI_DLLP_NEXTTXSEQNUMREG
#define BCMA_CORE_PCI_DLLP_ACKEDTXSEQNUMREG
#define BCMA_CORE_PCI_DLLP_PURGEDTXSEQNUMREG
#define BCMA_CORE_PCI_DLLP_RXSEQNUMREG
#define BCMA_CORE_PCI_DLLP_LRREG
#define BCMA_CORE_PCI_DLLP_LACKTOREG
#define BCMA_CORE_PCI_DLLP_PMTHRESHREG
#define BCMA_CORE_PCI_ASPMTIMER_EXTEND
#define BCMA_CORE_PCI_DLLP_RTRYWPREG
#define BCMA_CORE_PCI_DLLP_RTRYRPREG
#define BCMA_CORE_PCI_DLLP_RTRYPPREG
#define BCMA_CORE_PCI_DLLP_RTRRWREG
#define BCMA_CORE_PCI_DLLP_ECTHRESHREG
#define BCMA_CORE_PCI_DLLP_TLPERRCTRREG
#define BCMA_CORE_PCI_DLLP_ERRCTRREG
#define BCMA_CORE_PCI_DLLP_NAKRXCTRREG
#define BCMA_CORE_PCI_DLLP_TESTREG
#define BCMA_CORE_PCI_DLLP_PKTBIST
#define BCMA_CORE_PCI_DLLP_PCIE11

/* SERDES RX registers */
#define BCMA_CORE_PCI_SERDES_RX_CTRL
#define BCMA_CORE_PCI_SERDES_RX_CTRL_FORCE
#define BCMA_CORE_PCI_SERDES_RX_CTRL_POLARITY
#define BCMA_CORE_PCI_SERDES_RX_TIMER1
#define BCMA_CORE_PCI_SERDES_RX_CDR
#define BCMA_CORE_PCI_SERDES_RX_CDRBW

/* SERDES PLL registers */
#define BCMA_CORE_PCI_SERDES_PLL_CTRL
#define BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN

/* PCIcore specific boardflags */
#define BCMA_CORE_PCI_BFL_NOPCI

/* PCIE Config space accessing MACROS */
#define BCMA_CORE_PCI_CFG_BUS_SHIFT
#define BCMA_CORE_PCI_CFG_SLOT_SHIFT
#define BCMA_CORE_PCI_CFG_FUN_SHIFT
#define BCMA_CORE_PCI_CFG_OFF_SHIFT

#define BCMA_CORE_PCI_CFG_BUS_MASK
#define BCMA_CORE_PCI_CFG_SLOT_MASK
#define BCMA_CORE_PCI_CFG_FUN_MASK
#define BCMA_CORE_PCI_CFG_OFF_MASK

#define BCMA_CORE_PCI_CFG_DEVCTRL

#define BCMA_CORE_PCI_

/* MDIO devices (SERDES modules) */
#define BCMA_CORE_PCI_MDIO_IEEE0
#define BCMA_CORE_PCI_MDIO_IEEE1
#define BCMA_CORE_PCI_MDIO_BLK0
#define BCMA_CORE_PCI_MDIO_BLK1
#define BCMA_CORE_PCI_MDIO_BLK1_MGMT0
#define BCMA_CORE_PCI_MDIO_BLK1_MGMT1
#define BCMA_CORE_PCI_MDIO_BLK1_MGMT2
#define BCMA_CORE_PCI_MDIO_BLK1_MGMT3
#define BCMA_CORE_PCI_MDIO_BLK1_MGMT4
#define BCMA_CORE_PCI_MDIO_BLK2
#define BCMA_CORE_PCI_MDIO_BLK3
#define BCMA_CORE_PCI_MDIO_BLK4
#define BCMA_CORE_PCI_MDIO_TXPLL
#define BCMA_CORE_PCI_MDIO_TXCTRL0
#define BCMA_CORE_PCI_MDIO_SERDESID
#define BCMA_CORE_PCI_MDIO_RXCTRL0

/* PCIE Root Capability Register bits (Host mode only) */
#define BCMA_CORE_PCI_RC_RRS_VISIBILITY

struct bcma_drv_pci;
struct bcma_bus;

#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
struct bcma_drv_pci_host {
	struct bcma_drv_pci *pdev;

	u32 host_cfg_addr;
	spinlock_t cfgspace_lock;

	struct pci_controller pci_controller;
	struct pci_ops pci_ops;
	struct resource mem_resource;
	struct resource io_resource;
};
#endif

struct bcma_drv_pci {};

/* Register access */
#define pcicore_read16(pc, offset)
#define pcicore_read32(pc, offset)
#define pcicore_write16(pc, offset, val)
#define pcicore_write32(pc, offset, val)

#ifdef CONFIG_BCMA_DRIVER_PCI
extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
#else
static inline void bcma_core_pci_power_save(struct bcma_bus *bus, bool up)
{
}
#endif

#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
#else
static inline int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev)
{}
static inline int bcma_core_pci_plat_dev_init(struct pci_dev *dev)
{}
#endif

#endif /* LINUX_BCMA_DRIVER_PCI_H_ */