linux/drivers/pci/controller/dwc/pcie-dw-rockchip.c

// SPDX-License-Identifier: GPL-2.0
/*
 * PCIe host controller driver for Rockchip SoCs.
 *
 * Copyright (C) 2021 Rockchip Electronics Co., Ltd.
 *		http://www.rock-chips.com
 *
 * Author: Simon Xue <[email protected]>
 */

#include <linux/clk.h>
#include <linux/gpio/consumer.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/irqdomain.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/reset.h>

#include "pcie-designware.h"

/*
 * The upper 16 bits of PCIE_CLIENT_CONFIG are a write
 * mask for the lower 16 bits.
 */
#define HIWORD_UPDATE(mask, val)
#define HIWORD_UPDATE_BIT(val)
#define HIWORD_DISABLE_BIT(val)

#define to_rockchip_pcie(x)

#define PCIE_CLIENT_RC_MODE
#define PCIE_CLIENT_EP_MODE
#define PCIE_CLIENT_ENABLE_LTSSM
#define PCIE_CLIENT_DISABLE_LTSSM
#define PCIE_CLIENT_INTR_STATUS_MISC
#define PCIE_CLIENT_INTR_MASK_MISC
#define PCIE_SMLH_LINKUP
#define PCIE_RDLH_LINKUP
#define PCIE_LINKUP
#define PCIE_RDLH_LINK_UP_CHGED
#define PCIE_LINK_REQ_RST_NOT_INT
#define PCIE_L0S_ENTRY
#define PCIE_CLIENT_GENERAL_CONTROL
#define PCIE_CLIENT_INTR_STATUS_LEGACY
#define PCIE_CLIENT_INTR_MASK_LEGACY
#define PCIE_CLIENT_GENERAL_DEBUG
#define PCIE_CLIENT_HOT_RESET_CTRL
#define PCIE_CLIENT_LTSSM_STATUS
#define PCIE_LTSSM_ENABLE_ENHANCE
#define PCIE_LTSSM_STATUS_MASK

struct rockchip_pcie {};

struct rockchip_pcie_of_data {};

static int rockchip_pcie_readl_apb(struct rockchip_pcie *rockchip, u32 reg)
{}

static void rockchip_pcie_writel_apb(struct rockchip_pcie *rockchip, u32 val,
				     u32 reg)
{}

static void rockchip_pcie_intx_handler(struct irq_desc *desc)
{}

static void rockchip_intx_mask(struct irq_data *data)
{
	rockchip_pcie_writel_apb(irq_data_get_irq_chip_data(data),
				 HIWORD_UPDATE_BIT(BIT(data->hwirq)),
				 PCIE_CLIENT_INTR_MASK_LEGACY);
};

static void rockchip_intx_unmask(struct irq_data *data)
{
	rockchip_pcie_writel_apb(irq_data_get_irq_chip_data(data),
				 HIWORD_DISABLE_BIT(BIT(data->hwirq)),
				 PCIE_CLIENT_INTR_MASK_LEGACY);
};

static struct irq_chip rockchip_intx_irq_chip =;

static int rockchip_pcie_intx_map(struct irq_domain *domain, unsigned int irq,
				  irq_hw_number_t hwirq)
{}

static const struct irq_domain_ops intx_domain_ops =;

static int rockchip_pcie_init_irq_domain(struct rockchip_pcie *rockchip)
{}

static u32 rockchip_pcie_get_ltssm(struct rockchip_pcie *rockchip)
{}

static void rockchip_pcie_enable_ltssm(struct rockchip_pcie *rockchip)
{}

static void rockchip_pcie_disable_ltssm(struct rockchip_pcie *rockchip)
{}

static int rockchip_pcie_link_up(struct dw_pcie *pci)
{}

static int rockchip_pcie_start_link(struct dw_pcie *pci)
{}

static void rockchip_pcie_stop_link(struct dw_pcie *pci)
{}

static int rockchip_pcie_host_init(struct dw_pcie_rp *pp)
{}

static const struct dw_pcie_host_ops rockchip_pcie_host_ops =;

static void rockchip_pcie_ep_init(struct dw_pcie_ep *ep)
{
	struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
	enum pci_barno bar;

	for (bar = 0; bar < PCI_STD_NUM_BARS; bar++)
		dw_pcie_ep_reset_bar(pci, bar);
};

static int rockchip_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
				   unsigned int type, u16 interrupt_num)
{}

static const struct pci_epc_features rockchip_pcie_epc_features_rk3568 =;

/*
 * BAR4 on rk3588 exposes the ATU Port Logic Structure to the host regardless of
 * iATU settings for BAR4. This means that BAR4 cannot be used by an EPF driver,
 * so mark it as RESERVED. (rockchip_pcie_ep_init() will disable all BARs by
 * default.) If the host could write to BAR4, the iATU settings (for all other
 * BARs) would be overwritten, resulting in (all other BARs) no longer working.
 */
static const struct pci_epc_features rockchip_pcie_epc_features_rk3588 =;

static const struct pci_epc_features *
rockchip_pcie_get_features(struct dw_pcie_ep *ep)
{}

static const struct dw_pcie_ep_ops rockchip_pcie_ep_ops =;

static int rockchip_pcie_clk_init(struct rockchip_pcie *rockchip)
{}

static int rockchip_pcie_resource_get(struct platform_device *pdev,
				      struct rockchip_pcie *rockchip)
{}

static int rockchip_pcie_phy_init(struct rockchip_pcie *rockchip)
{}

static void rockchip_pcie_phy_deinit(struct rockchip_pcie *rockchip)
{}

static const struct dw_pcie_ops dw_pcie_ops =;

static irqreturn_t rockchip_pcie_ep_sys_irq_thread(int irq, void *arg)
{}

static int rockchip_pcie_configure_rc(struct rockchip_pcie *rockchip)
{}

static int rockchip_pcie_configure_ep(struct platform_device *pdev,
				      struct rockchip_pcie *rockchip)
{}

static int rockchip_pcie_probe(struct platform_device *pdev)
{}

static const struct rockchip_pcie_of_data rockchip_pcie_rc_of_data_rk3568 =;

static const struct rockchip_pcie_of_data rockchip_pcie_ep_of_data_rk3568 =;

static const struct rockchip_pcie_of_data rockchip_pcie_ep_of_data_rk3588 =;

static const struct of_device_id rockchip_pcie_of_match[] =;

static struct platform_driver rockchip_pcie_driver =;
builtin_platform_driver();