linux/drivers/pci/controller/dwc/pcie-qcom.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Qualcomm PCIe root complex driver
 *
 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 * Copyright 2015 Linaro Limited.
 *
 * Author: Stanimir Varbanov <[email protected]>
 */

#include <linux/clk.h>
#include <linux/crc8.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/interconnect.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/limits.h>
#include <linux/init.h>
#include <linux/of.h>
#include <linux/pci.h>
#include <linux/pm_opp.h>
#include <linux/pm_runtime.h>
#include <linux/platform_device.h>
#include <linux/phy/pcie.h>
#include <linux/phy/phy.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/units.h>

#include "../../pci.h"
#include "pcie-designware.h"
#include "pcie-qcom-common.h"

/* PARF registers */
#define PARF_SYS_CTRL
#define PARF_PM_CTRL
#define PARF_PCS_DEEMPH
#define PARF_PCS_SWING
#define PARF_PHY_CTRL
#define PARF_PHY_REFCLK
#define PARF_CONFIG_BITS
#define PARF_DBI_BASE_ADDR
#define PARF_SLV_ADDR_SPACE_SIZE
#define PARF_MHI_CLOCK_RESET_CTRL
#define PARF_AXI_MSTR_WR_ADDR_HALT
#define PARF_AXI_MSTR_WR_ADDR_HALT_V2
#define PARF_Q2A_FLUSH
#define PARF_LTSSM
#define PARF_INT_ALL_STATUS
#define PARF_INT_ALL_CLEAR
#define PARF_INT_ALL_MASK
#define PARF_SID_OFFSET
#define PARF_BDF_TRANSLATE_CFG
#define PARF_DBI_BASE_ADDR_V2
#define PARF_DBI_BASE_ADDR_V2_HI
#define PARF_SLV_ADDR_SPACE_SIZE_V2
#define PARF_SLV_ADDR_SPACE_SIZE_V2_HI
#define PARF_NO_SNOOP_OVERIDE
#define PARF_ATU_BASE_ADDR
#define PARF_ATU_BASE_ADDR_HI
#define PARF_DEVICE_TYPE
#define PARF_BDF_TO_SID_TABLE_N
#define PARF_BDF_TO_SID_CFG

/* ELBI registers */
#define ELBI_SYS_CTRL

/* DBI registers */
#define AXI_MSTR_RESP_COMP_CTRL0
#define AXI_MSTR_RESP_COMP_CTRL1

/* MHI registers */
#define PARF_DEBUG_CNT_PM_LINKST_IN_L2
#define PARF_DEBUG_CNT_PM_LINKST_IN_L1
#define PARF_DEBUG_CNT_PM_LINKST_IN_L0S
#define PARF_DEBUG_CNT_AUX_CLK_IN_L1SUB_L1
#define PARF_DEBUG_CNT_AUX_CLK_IN_L1SUB_L2

/* PARF_SYS_CTRL register fields */
#define MAC_PHY_POWERDOWN_IN_P2_D_MUX_EN
#define MST_WAKEUP_EN
#define SLV_WAKEUP_EN
#define MSTR_ACLK_CGC_DIS
#define SLV_ACLK_CGC_DIS
#define CORE_CLK_CGC_DIS
#define AUX_PWR_DET
#define L23_CLK_RMV_DIS
#define L1_CLK_RMV_DIS

/* PARF_PM_CTRL register fields */
#define REQ_NOT_ENTR_L1

/* PARF_PCS_DEEMPH register fields */
#define PCS_DEEMPH_TX_DEEMPH_GEN1(x)
#define PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(x)
#define PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(x)

/* PARF_PCS_SWING register fields */
#define PCS_SWING_TX_SWING_FULL(x)
#define PCS_SWING_TX_SWING_LOW(x)

/* PARF_PHY_CTRL register fields */
#define PHY_CTRL_PHY_TX0_TERM_OFFSET_MASK
#define PHY_CTRL_PHY_TX0_TERM_OFFSET(x)
#define PHY_TEST_PWR_DOWN

/* PARF_PHY_REFCLK register fields */
#define PHY_REFCLK_SSP_EN
#define PHY_REFCLK_USE_PAD

/* PARF_CONFIG_BITS register fields */
#define PHY_RX0_EQ(x)

/* PARF_SLV_ADDR_SPACE_SIZE register value */
#define SLV_ADDR_SPACE_SZ

/* PARF_MHI_CLOCK_RESET_CTRL register fields */
#define AHB_CLK_EN
#define MSTR_AXI_CLK_EN
#define BYPASS

/* PARF_AXI_MSTR_WR_ADDR_HALT register fields */
#define EN

/* PARF_LTSSM register fields */
#define LTSSM_EN

/* PARF_INT_ALL_{STATUS/CLEAR/MASK} register fields */
#define PARF_INT_ALL_LINK_UP

/* PARF_NO_SNOOP_OVERIDE register fields */
#define WR_NO_SNOOP_OVERIDE_EN
#define RD_NO_SNOOP_OVERIDE_EN

/* PARF_DEVICE_TYPE register fields */
#define DEVICE_TYPE_RC

/* PARF_BDF_TO_SID_CFG fields */
#define BDF_TO_SID_BYPASS

/* ELBI_SYS_CTRL register fields */
#define ELBI_SYS_CTRL_LT_ENABLE

/* AXI_MSTR_RESP_COMP_CTRL0 register fields */
#define CFG_REMOTE_RD_REQ_BRIDGE_SIZE_2K
#define CFG_REMOTE_RD_REQ_BRIDGE_SIZE_4K

/* AXI_MSTR_RESP_COMP_CTRL1 register fields */
#define CFG_BRIDGE_SB_INIT

/* PCI_EXP_SLTCAP register fields */
#define PCIE_CAP_SLOT_POWER_LIMIT_VAL
#define PCIE_CAP_SLOT_POWER_LIMIT_SCALE
#define PCIE_CAP_SLOT_VAL

#define PERST_DELAY_US

#define QCOM_PCIE_CRC8_POLYNOMIAL

#define QCOM_PCIE_LINK_SPEED_TO_BW(speed)

struct qcom_pcie_resources_1_0_0 {};

#define QCOM_PCIE_2_1_0_MAX_RESETS
#define QCOM_PCIE_2_1_0_MAX_SUPPLY
struct qcom_pcie_resources_2_1_0 {};

#define QCOM_PCIE_2_3_2_MAX_SUPPLY
struct qcom_pcie_resources_2_3_2 {};

#define QCOM_PCIE_2_3_3_MAX_RESETS
struct qcom_pcie_resources_2_3_3 {};

#define QCOM_PCIE_2_4_0_MAX_RESETS
struct qcom_pcie_resources_2_4_0 {};

#define QCOM_PCIE_2_7_0_MAX_SUPPLIES
struct qcom_pcie_resources_2_7_0 {};

struct qcom_pcie_resources_2_9_0 {};

qcom_pcie_resources;

struct qcom_pcie;

struct qcom_pcie_ops {};

 /**
  * struct qcom_pcie_cfg - Per SoC config struct
  * @ops: qcom PCIe ops structure
  * @override_no_snoop: Override NO_SNOOP attribute in TLP to enable cache
  * snooping
  */
struct qcom_pcie_cfg {};

struct qcom_pcie {};

#define to_qcom_pcie(x)

static void qcom_ep_reset_assert(struct qcom_pcie *pcie)
{}

static void qcom_ep_reset_deassert(struct qcom_pcie *pcie)
{}

static int qcom_pcie_start_link(struct dw_pcie *pci)
{}

static void qcom_pcie_clear_aspm_l0s(struct dw_pcie *pci)
{}

static void qcom_pcie_clear_hpc(struct dw_pcie *pci)
{}

static void qcom_pcie_configure_dbi_base(struct qcom_pcie *pcie)
{}

static void qcom_pcie_configure_dbi_atu_base(struct qcom_pcie *pcie)
{}

static void qcom_pcie_2_1_0_ltssm_enable(struct qcom_pcie *pcie)
{}

static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie)
{}

static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_post_init_2_1_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_get_resources_1_0_0(struct qcom_pcie *pcie)
{}

static void qcom_pcie_deinit_1_0_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_init_1_0_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_post_init_1_0_0(struct qcom_pcie *pcie)
{}

static void qcom_pcie_2_3_2_ltssm_enable(struct qcom_pcie *pcie)
{}

static int qcom_pcie_get_resources_2_3_2(struct qcom_pcie *pcie)
{}

static void qcom_pcie_deinit_2_3_2(struct qcom_pcie *pcie)
{}

static int qcom_pcie_init_2_3_2(struct qcom_pcie *pcie)
{}

static int qcom_pcie_post_init_2_3_2(struct qcom_pcie *pcie)
{}

static int qcom_pcie_get_resources_2_4_0(struct qcom_pcie *pcie)
{}

static void qcom_pcie_deinit_2_4_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_get_resources_2_3_3(struct qcom_pcie *pcie)
{}

static void qcom_pcie_deinit_2_3_3(struct qcom_pcie *pcie)
{}

static int qcom_pcie_init_2_3_3(struct qcom_pcie *pcie)
{}

static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie)
{}

static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_post_init_2_7_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_enable_aspm(struct pci_dev *pdev, void *userdata)
{}

static void qcom_pcie_host_post_init_2_7_0(struct qcom_pcie *pcie)
{}

static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_config_sid_1_9_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_get_resources_2_9_0(struct qcom_pcie *pcie)
{}

static void qcom_pcie_deinit_2_9_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_init_2_9_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_post_init_2_9_0(struct qcom_pcie *pcie)
{}

static int qcom_pcie_link_up(struct dw_pcie *pci)
{}

static int qcom_pcie_host_init(struct dw_pcie_rp *pp)
{}

static void qcom_pcie_host_deinit(struct dw_pcie_rp *pp)
{}

static void qcom_pcie_host_post_init(struct dw_pcie_rp *pp)
{}

static const struct dw_pcie_host_ops qcom_pcie_dw_ops =;

/* Qcom IP rev.: 2.1.0	Synopsys IP rev.: 4.01a */
static const struct qcom_pcie_ops ops_2_1_0 =;

/* Qcom IP rev.: 1.0.0	Synopsys IP rev.: 4.11a */
static const struct qcom_pcie_ops ops_1_0_0 =;

/* Qcom IP rev.: 2.3.2	Synopsys IP rev.: 4.21a */
static const struct qcom_pcie_ops ops_2_3_2 =;

/* Qcom IP rev.: 2.4.0	Synopsys IP rev.: 4.20a */
static const struct qcom_pcie_ops ops_2_4_0 =;

/* Qcom IP rev.: 2.3.3	Synopsys IP rev.: 4.30a */
static const struct qcom_pcie_ops ops_2_3_3 =;

/* Qcom IP rev.: 2.7.0	Synopsys IP rev.: 4.30a */
static const struct qcom_pcie_ops ops_2_7_0 =;

/* Qcom IP rev.: 1.9.0 */
static const struct qcom_pcie_ops ops_1_9_0 =;

/* Qcom IP rev.: 2.9.0  Synopsys IP rev.: 5.00a */
static const struct qcom_pcie_ops ops_2_9_0 =;

static const struct qcom_pcie_cfg cfg_1_0_0 =;

static const struct qcom_pcie_cfg cfg_1_9_0 =;

static const struct qcom_pcie_cfg cfg_1_34_0 =;

static const struct qcom_pcie_cfg cfg_2_1_0 =;

static const struct qcom_pcie_cfg cfg_2_3_2 =;

static const struct qcom_pcie_cfg cfg_2_3_3 =;

static const struct qcom_pcie_cfg cfg_2_4_0 =;

static const struct qcom_pcie_cfg cfg_2_7_0 =;

static const struct qcom_pcie_cfg cfg_2_9_0 =;

static const struct qcom_pcie_cfg cfg_sc8280xp =;

static const struct dw_pcie_ops dw_pcie_ops =;

static int qcom_pcie_icc_init(struct qcom_pcie *pcie)
{}

static void qcom_pcie_icc_opp_update(struct qcom_pcie *pcie)
{}

static int qcom_pcie_link_transition_count(struct seq_file *s, void *data)
{}

static void qcom_pcie_init_debugfs(struct qcom_pcie *pcie)
{}

static irqreturn_t qcom_pcie_global_irq_thread(int irq, void *data)
{}

static int qcom_pcie_probe(struct platform_device *pdev)
{}

static int qcom_pcie_suspend_noirq(struct device *dev)
{}

static int qcom_pcie_resume_noirq(struct device *dev)
{}

static const struct of_device_id qcom_pcie_match[] =;

static void qcom_fixup_class(struct pci_dev *dev)
{}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x0101, qcom_fixup_class);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x0104, qcom_fixup_class);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x0106, qcom_fixup_class);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x0107, qcom_fixup_class);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x0302, qcom_fixup_class);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x1000, qcom_fixup_class);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x1001, qcom_fixup_class);

static const struct dev_pm_ops qcom_pcie_pm_ops =;

static struct platform_driver qcom_pcie_driver =;
builtin_platform_driver();