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

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2021 BAIKAL ELECTRONICS, JSC
 *
 * Authors:
 *   Vadim Vlasov <[email protected]>
 *   Serge Semin <[email protected]>
 *
 * Baikal-T1 PCIe controller driver
 */

#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/reset.h>
#include <linux/types.h>

#include "pcie-designware.h"

/* Baikal-T1 System CCU control registers */
#define BT1_CCU_PCIE_CLKC
#define BT1_CCU_PCIE_REQ_PCS_CLK
#define BT1_CCU_PCIE_REQ_MAC_CLK
#define BT1_CCU_PCIE_REQ_PIPE_CLK

#define BT1_CCU_PCIE_RSTC
#define BT1_CCU_PCIE_REQ_LINK_RST
#define BT1_CCU_PCIE_REQ_SMLH_RST
#define BT1_CCU_PCIE_REQ_PHY_RST
#define BT1_CCU_PCIE_REQ_CORE_RST
#define BT1_CCU_PCIE_REQ_STICKY_RST
#define BT1_CCU_PCIE_REQ_NSTICKY_RST

#define BT1_CCU_PCIE_PMSC
#define BT1_CCU_PCIE_LTSSM_STATE_MASK
#define BT1_CCU_PCIE_LTSSM_DET_QUIET
#define BT1_CCU_PCIE_LTSSM_DET_ACT
#define BT1_CCU_PCIE_LTSSM_POLL_ACT
#define BT1_CCU_PCIE_LTSSM_POLL_COMP
#define BT1_CCU_PCIE_LTSSM_POLL_CONF
#define BT1_CCU_PCIE_LTSSM_PRE_DET_QUIET
#define BT1_CCU_PCIE_LTSSM_DET_WAIT
#define BT1_CCU_PCIE_LTSSM_CFG_LNKWD_START
#define BT1_CCU_PCIE_LTSSM_CFG_LNKWD_ACEPT
#define BT1_CCU_PCIE_LTSSM_CFG_LNNUM_WAIT
#define BT1_CCU_PCIE_LTSSM_CFG_LNNUM_ACEPT
#define BT1_CCU_PCIE_LTSSM_CFG_COMPLETE
#define BT1_CCU_PCIE_LTSSM_CFG_IDLE
#define BT1_CCU_PCIE_LTSSM_RCVR_LOCK
#define BT1_CCU_PCIE_LTSSM_RCVR_SPEED
#define BT1_CCU_PCIE_LTSSM_RCVR_RCVRCFG
#define BT1_CCU_PCIE_LTSSM_RCVR_IDLE
#define BT1_CCU_PCIE_LTSSM_L0
#define BT1_CCU_PCIE_LTSSM_L0S
#define BT1_CCU_PCIE_LTSSM_L123_SEND_IDLE
#define BT1_CCU_PCIE_LTSSM_L1_IDLE
#define BT1_CCU_PCIE_LTSSM_L2_IDLE
#define BT1_CCU_PCIE_LTSSM_L2_WAKE
#define BT1_CCU_PCIE_LTSSM_DIS_ENTRY
#define BT1_CCU_PCIE_LTSSM_DIS_IDLE
#define BT1_CCU_PCIE_LTSSM_DISABLE
#define BT1_CCU_PCIE_LTSSM_LPBK_ENTRY
#define BT1_CCU_PCIE_LTSSM_LPBK_ACTIVE
#define BT1_CCU_PCIE_LTSSM_LPBK_EXIT
#define BT1_CCU_PCIE_LTSSM_LPBK_EXIT_TOUT
#define BT1_CCU_PCIE_LTSSM_HOT_RST_ENTRY
#define BT1_CCU_PCIE_LTSSM_HOT_RST
#define BT1_CCU_PCIE_LTSSM_RCVR_EQ0
#define BT1_CCU_PCIE_LTSSM_RCVR_EQ1
#define BT1_CCU_PCIE_LTSSM_RCVR_EQ2
#define BT1_CCU_PCIE_LTSSM_RCVR_EQ3
#define BT1_CCU_PCIE_SMLH_LINKUP
#define BT1_CCU_PCIE_RDLH_LINKUP
#define BT1_CCU_PCIE_PM_LINKSTATE_L0S
#define BT1_CCU_PCIE_PM_LINKSTATE_L1
#define BT1_CCU_PCIE_PM_LINKSTATE_L2
#define BT1_CCU_PCIE_L1_PENDING
#define BT1_CCU_PCIE_REQ_EXIT_L1
#define BT1_CCU_PCIE_LTSSM_RCVR_EQ
#define BT1_CCU_PCIE_PM_DSTAT_MASK
#define BT1_CCU_PCIE_PM_PME_EN
#define BT1_CCU_PCIE_PM_PME_STATUS
#define BT1_CCU_PCIE_AUX_PM_EN
#define BT1_CCU_PCIE_AUX_PWR_DET
#define BT1_CCU_PCIE_WAKE_DET
#define BT1_CCU_PCIE_TURNOFF_REQ
#define BT1_CCU_PCIE_TURNOFF_ACK

#define BT1_CCU_PCIE_GENC
#define BT1_CCU_PCIE_LTSSM_EN
#define BT1_CCU_PCIE_DBI2_MODE
#define BT1_CCU_PCIE_MGMT_EN
#define BT1_CCU_PCIE_RXLANE_FLIP_EN
#define BT1_CCU_PCIE_TXLANE_FLIP_EN
#define BT1_CCU_PCIE_SLV_XFER_PEND
#define BT1_CCU_PCIE_RCV_XFER_PEND
#define BT1_CCU_PCIE_DBI_XFER_PEND
#define BT1_CCU_PCIE_DMA_XFER_PEND

#define BT1_CCU_PCIE_LTSSM_LINKUP(_pmsc)

/* Baikal-T1 PCIe specific control registers */
#define BT1_PCIE_AXI2MGM_LANENUM
#define BT1_PCIE_AXI2MGM_LANESEL_MASK

#define BT1_PCIE_AXI2MGM_ADDRCTL
#define BT1_PCIE_AXI2MGM_PHYREG_ADDR_MASK
#define BT1_PCIE_AXI2MGM_READ_FLAG
#define BT1_PCIE_AXI2MGM_DONE
#define BT1_PCIE_AXI2MGM_BUSY

#define BT1_PCIE_AXI2MGM_WRITEDATA
#define BT1_PCIE_AXI2MGM_WDATA

#define BT1_PCIE_AXI2MGM_READDATA
#define BT1_PCIE_AXI2MGM_RDATA

/* Generic Baikal-T1 PCIe interface resources */
#define BT1_PCIE_NUM_APP_CLKS
#define BT1_PCIE_NUM_CORE_CLKS
#define BT1_PCIE_NUM_APP_RSTS
#define BT1_PCIE_NUM_CORE_RSTS

/* PCIe bus setup delays and timeouts */
#define BT1_PCIE_RST_DELAY_MS
#define BT1_PCIE_RUN_DELAY_US
#define BT1_PCIE_REQ_DELAY_US
#define BT1_PCIE_REQ_TIMEOUT_US
#define BT1_PCIE_LNK_DELAY_US
#define BT1_PCIE_LNK_TIMEOUT_US

static const enum dw_pcie_app_clk bt1_pcie_app_clks[] =;

static const enum dw_pcie_core_clk bt1_pcie_core_clks[] =;

static const enum dw_pcie_app_rst bt1_pcie_app_rsts[] =;

static const enum dw_pcie_core_rst bt1_pcie_core_rsts[] =;

struct bt1_pcie {};
#define to_bt1_pcie(_dw)

/*
 * Baikal-T1 MMIO space must be read/written by the dword-aligned
 * instructions. Note the methods are optimized to have the dword operations
 * performed with minimum overhead as the most frequently used ones.
 */
static int bt1_pcie_read_mmio(void __iomem *addr, int size, u32 *val)
{}

static int bt1_pcie_write_mmio(void __iomem *addr, int size, u32 val)
{}

static u32 bt1_pcie_read_dbi(struct dw_pcie *pci, void __iomem *base, u32 reg,
			     size_t size)
{}

static void bt1_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base, u32 reg,
			       size_t size, u32 val)
{}

static void bt1_pcie_write_dbi2(struct dw_pcie *pci, void __iomem *base, u32 reg,
				size_t size, u32 val)
{}

static int bt1_pcie_start_link(struct dw_pcie *pci)
{}

static void bt1_pcie_stop_link(struct dw_pcie *pci)
{}

static const struct dw_pcie_ops bt1_pcie_ops =;

static struct pci_ops bt1_pci_ops =;

static int bt1_pcie_get_resources(struct bt1_pcie *btpci)
{}

static void bt1_pcie_full_stop_bus(struct bt1_pcie *btpci, bool init)
{}

/*
 * Implements the cold reset procedure in accordance with the reference manual
 * and available PM signals.
 */
static int bt1_pcie_cold_start_bus(struct bt1_pcie *btpci)
{}

static int bt1_pcie_host_init(struct dw_pcie_rp *pp)
{}

static void bt1_pcie_host_deinit(struct dw_pcie_rp *pp)
{}

static const struct dw_pcie_host_ops bt1_pcie_host_ops =;

static struct bt1_pcie *bt1_pcie_create_data(struct platform_device *pdev)
{}

static int bt1_pcie_add_port(struct bt1_pcie *btpci)
{}

static void bt1_pcie_del_port(struct bt1_pcie *btpci)
{}

static int bt1_pcie_probe(struct platform_device *pdev)
{}

static void bt1_pcie_remove(struct platform_device *pdev)
{}

static const struct of_device_id bt1_pcie_of_match[] =;
MODULE_DEVICE_TABLE(of, bt1_pcie_of_match);

static struct platform_driver bt1_pcie_driver =;
module_platform_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();