linux/drivers/fpga/dfl-n3000-nios.c

// SPDX-License-Identifier: GPL-2.0
/*
 * DFL device driver for Nios private feature on Intel PAC (Programmable
 * Acceleration Card) N3000
 *
 * Copyright (C) 2019-2020 Intel Corporation, Inc.
 *
 * Authors:
 *   Wu Hao <[email protected]>
 *   Xu Yilun <[email protected]>
 */
#include <linux/bitfield.h>
#include <linux/dfl.h>
#include <linux/errno.h>
#include <linux/io.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/stddef.h>
#include <linux/spi/altera.h>
#include <linux/spi/spi.h>
#include <linux/types.h>

/*
 * N3000 Nios private feature registers, named as NIOS_SPI_XX on spec.
 * NS is the abbreviation of NIOS_SPI.
 */
#define N3000_NS_PARAM
#define N3000_NS_PARAM_SHIFT_MODE_MSK
#define N3000_NS_PARAM_SHIFT_MODE_MSB
#define N3000_NS_PARAM_SHIFT_MODE_LSB
#define N3000_NS_PARAM_DATA_WIDTH
#define N3000_NS_PARAM_NUM_CS
#define N3000_NS_PARAM_CLK_POL
#define N3000_NS_PARAM_CLK_PHASE
#define N3000_NS_PARAM_PERIPHERAL_ID

#define N3000_NS_CTRL
#define N3000_NS_CTRL_WR_DATA
#define N3000_NS_CTRL_ADDR
#define N3000_NS_CTRL_CMD_MSK
#define N3000_NS_CTRL_CMD_NOP
#define N3000_NS_CTRL_CMD_RD
#define N3000_NS_CTRL_CMD_WR

#define N3000_NS_STAT
#define N3000_NS_STAT_RD_DATA
#define N3000_NS_STAT_RW_VAL

/* Nios handshake registers, indirect access */
#define N3000_NIOS_INIT
#define N3000_NIOS_INIT_DONE
#define N3000_NIOS_INIT_START
/* Mode for retimer A, link 0, the same below */
#define N3000_NIOS_INIT_REQ_FEC_MODE_A0_MSK
#define N3000_NIOS_INIT_REQ_FEC_MODE_A1_MSK
#define N3000_NIOS_INIT_REQ_FEC_MODE_A2_MSK
#define N3000_NIOS_INIT_REQ_FEC_MODE_A3_MSK
#define N3000_NIOS_INIT_REQ_FEC_MODE_B0_MSK
#define N3000_NIOS_INIT_REQ_FEC_MODE_B1_MSK
#define N3000_NIOS_INIT_REQ_FEC_MODE_B2_MSK
#define N3000_NIOS_INIT_REQ_FEC_MODE_B3_MSK
#define N3000_NIOS_INIT_REQ_FEC_MODE_NO
#define N3000_NIOS_INIT_REQ_FEC_MODE_KR
#define N3000_NIOS_INIT_REQ_FEC_MODE_RS

#define N3000_NIOS_FW_VERSION
#define N3000_NIOS_FW_VERSION_PATCH
#define N3000_NIOS_FW_VERSION_MINOR
#define N3000_NIOS_FW_VERSION_MAJOR

/* The retimers we use on Intel PAC N3000 is Parkvale, abbreviated to PKVL */
#define N3000_NIOS_PKVL_A_MODE_STS
#define N3000_NIOS_PKVL_B_MODE_STS
#define N3000_NIOS_PKVL_MODE_STS_GROUP_MSK
#define N3000_NIOS_PKVL_MODE_STS_GROUP_OK
#define N3000_NIOS_PKVL_MODE_STS_ID_MSK
/* When GROUP MASK field == GROUP_OK  */
#define N3000_NIOS_PKVL_MODE_ID_RESET
#define N3000_NIOS_PKVL_MODE_ID_4X10G
#define N3000_NIOS_PKVL_MODE_ID_4X25G
#define N3000_NIOS_PKVL_MODE_ID_2X25G
#define N3000_NIOS_PKVL_MODE_ID_2X25G_2X10G
#define N3000_NIOS_PKVL_MODE_ID_1X25G

#define N3000_NIOS_REGBUS_RETRY_COUNT

#define N3000_NIOS_INIT_TIMEOUT
#define N3000_NIOS_INIT_TIME_INTV

#define N3000_NIOS_INIT_REQ_FEC_MODE_MSK_ALL

#define N3000_NIOS_INIT_REQ_FEC_MODE_NO_ALL

#define N3000_NIOS_INIT_REQ_FEC_MODE_KR_ALL

#define N3000_NIOS_INIT_REQ_FEC_MODE_RS_ALL

struct n3000_nios {};

static ssize_t nios_fw_version_show(struct device *dev,
				    struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(nios_fw_version);

#define IS_MODE_STATUS_OK(mode_stat)

#define IS_RETIMER_FEC_SUPPORTED(retimer_mode)

static int get_retimer_mode(struct n3000_nios *nn, unsigned int mode_stat_reg,
			    unsigned int *retimer_mode)
{}

static ssize_t retimer_A_mode_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(retimer_A_mode);

static ssize_t retimer_B_mode_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(retimer_B_mode);

static ssize_t fec_mode_show(struct device *dev,
			     struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(fec_mode);

static struct attribute *n3000_nios_attrs[] =;
ATTRIBUTE_GROUPS();

static int n3000_nios_init_done_check(struct n3000_nios *nn)
{}

static struct spi_board_info m10_n3000_info =;

static int create_altera_spi_controller(struct n3000_nios *nn)
{}

static void destroy_altera_spi_controller(struct n3000_nios *nn)
{}

static int n3000_nios_poll_stat_timeout(void __iomem *base, u64 *v)
{}

static int n3000_nios_reg_write(void *context, unsigned int reg, unsigned int val)
{}

static int n3000_nios_reg_read(void *context, unsigned int reg, unsigned int *val)
{}

static const struct regmap_config n3000_nios_regbus_cfg =;

static int n3000_nios_probe(struct dfl_device *ddev)
{}

static void n3000_nios_remove(struct dfl_device *ddev)
{}

#define FME_FEATURE_ID_N3000_NIOS

static const struct dfl_device_id n3000_nios_ids[] =;
MODULE_DEVICE_TABLE(dfl, n3000_nios_ids);

static struct dfl_driver n3000_nios_driver =;

module_dfl_driver();

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