linux/drivers/fpga/altera-cvp.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * FPGA Manager Driver for Altera Arria/Cyclone/Stratix CvP
 *
 * Copyright (C) 2017 DENX Software Engineering
 *
 * Anatolij Gustschin <[email protected]>
 *
 * Manage Altera FPGA firmware using PCIe CvP.
 * Firmware must be in binary "rbf" format.
 */

#include <linux/delay.h>
#include <linux/device.h>
#include <linux/fpga/fpga-mgr.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/sizes.h>

#define CVP_BAR
#define CVP_DUMMY_WR
#define TIMEOUT_US

/* Vendor Specific Extended Capability Registers */
#define VSE_PCIE_EXT_CAP_ID
#define VSE_PCIE_EXT_CAP_ID_VAL

#define VSE_CVP_STATUS
#define VSE_CVP_STATUS_CFG_RDY
#define VSE_CVP_STATUS_CFG_ERR
#define VSE_CVP_STATUS_CVP_EN
#define VSE_CVP_STATUS_USERMODE
#define VSE_CVP_STATUS_CFG_DONE
#define VSE_CVP_STATUS_PLD_CLK_IN_USE

#define VSE_CVP_MODE_CTRL
#define VSE_CVP_MODE_CTRL_CVP_MODE
#define VSE_CVP_MODE_CTRL_HIP_CLK_SEL
#define VSE_CVP_MODE_CTRL_NUMCLKS_OFF
#define VSE_CVP_MODE_CTRL_NUMCLKS_MASK

#define VSE_CVP_DATA
#define VSE_CVP_PROG_CTRL
#define VSE_CVP_PROG_CTRL_CONFIG
#define VSE_CVP_PROG_CTRL_START_XFER
#define VSE_CVP_PROG_CTRL_MASK

#define VSE_UNCOR_ERR_STATUS
#define VSE_UNCOR_ERR_CVP_CFG_ERR

#define V1_VSEC_OFFSET
/* V2 Defines */
#define VSE_CVP_TX_CREDITS

#define V2_CREDIT_TIMEOUT_US
#define V2_CHECK_CREDIT_US
#define V2_POLL_TIMEOUT_US
#define V2_USER_TIMEOUT_US

#define V1_POLL_TIMEOUT_US

#define DRV_NAME
#define ALTERA_CVP_MGR_NAME

/* Write block sizes */
#define ALTERA_CVP_V1_SIZE
#define ALTERA_CVP_V2_SIZE

/* Optional CvP config error status check for debugging */
static bool altera_cvp_chkcfg;

struct cvp_priv;

struct altera_cvp_conf {};

struct cvp_priv {};

static int altera_read_config_byte(struct altera_cvp_conf *conf,
				   int where, u8 *val)
{}

static int altera_read_config_dword(struct altera_cvp_conf *conf,
				    int where, u32 *val)
{}

static int altera_write_config_dword(struct altera_cvp_conf *conf,
				     int where, u32 val)
{}

static enum fpga_mgr_states altera_cvp_state(struct fpga_manager *mgr)
{}

static void altera_cvp_write_data_iomem(struct altera_cvp_conf *conf, u32 val)
{}

static void altera_cvp_write_data_config(struct altera_cvp_conf *conf, u32 val)
{}

/* switches between CvP clock and internal clock */
static void altera_cvp_dummy_write(struct altera_cvp_conf *conf)
{}

static int altera_cvp_wait_status(struct altera_cvp_conf *conf, u32 status_mask,
				  u32 status_val, int timeout_us)
{}

static int altera_cvp_chk_error(struct fpga_manager *mgr, size_t bytes)
{}

/*
 * CvP Version2 Functions
 * Recent Intel FPGAs use a credit mechanism to throttle incoming
 * bitstreams and a different method of clearing the state.
 */

static int altera_cvp_v2_clear_state(struct altera_cvp_conf *conf)
{}

static int altera_cvp_v2_wait_for_credit(struct fpga_manager *mgr,
					 u32 blocks)
{}

static int altera_cvp_send_block(struct altera_cvp_conf *conf,
				 const u32 *data, size_t len)
{}

static int altera_cvp_teardown(struct fpga_manager *mgr,
			       struct fpga_image_info *info)
{}

static int altera_cvp_write_init(struct fpga_manager *mgr,
				 struct fpga_image_info *info,
				 const char *buf, size_t count)
{}

static int altera_cvp_write(struct fpga_manager *mgr, const char *buf,
			    size_t count)
{}

static int altera_cvp_write_complete(struct fpga_manager *mgr,
				     struct fpga_image_info *info)
{}

static const struct fpga_manager_ops altera_cvp_ops =;

static const struct cvp_priv cvp_priv_v1 =;

static const struct cvp_priv cvp_priv_v2 =;

static ssize_t chkcfg_show(struct device_driver *dev, char *buf)
{}

static ssize_t chkcfg_store(struct device_driver *drv, const char *buf,
			    size_t count)
{}

static DRIVER_ATTR_RW(chkcfg);

static int altera_cvp_probe(struct pci_dev *pdev,
			    const struct pci_device_id *dev_id);
static void altera_cvp_remove(struct pci_dev *pdev);

static struct pci_device_id altera_cvp_id_tbl[] =;
MODULE_DEVICE_TABLE(pci, altera_cvp_id_tbl);

static struct pci_driver altera_cvp_driver =;

static int altera_cvp_probe(struct pci_dev *pdev,
			    const struct pci_device_id *dev_id)
{}

static void altera_cvp_remove(struct pci_dev *pdev)
{}

static int __init altera_cvp_init(void)
{}

static void __exit altera_cvp_exit(void)
{}

module_init();
module_exit(altera_cvp_exit);

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