18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Xilinx SD-FEC
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2019 Xilinx, Inc.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Description:
88c2ecf20Sopenharmony_ci * This driver is developed for SDFEC16 IP. It provides a char device
98c2ecf20Sopenharmony_ci * in sysfs and supports file operations like open(), close() and ioctl().
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci#ifndef __XILINX_SDFEC_H__
128c2ecf20Sopenharmony_ci#define __XILINX_SDFEC_H__
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/types.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* Shared LDPC Tables */
178c2ecf20Sopenharmony_ci#define XSDFEC_LDPC_SC_TABLE_ADDR_BASE (0x10000)
188c2ecf20Sopenharmony_ci#define XSDFEC_LDPC_SC_TABLE_ADDR_HIGH (0x10400)
198c2ecf20Sopenharmony_ci#define XSDFEC_LDPC_LA_TABLE_ADDR_BASE (0x18000)
208c2ecf20Sopenharmony_ci#define XSDFEC_LDPC_LA_TABLE_ADDR_HIGH (0x19000)
218c2ecf20Sopenharmony_ci#define XSDFEC_LDPC_QC_TABLE_ADDR_BASE (0x20000)
228c2ecf20Sopenharmony_ci#define XSDFEC_LDPC_QC_TABLE_ADDR_HIGH (0x28000)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/* LDPC tables depth */
258c2ecf20Sopenharmony_ci#define XSDFEC_SC_TABLE_DEPTH                                                  \
268c2ecf20Sopenharmony_ci	(XSDFEC_LDPC_SC_TABLE_ADDR_HIGH - XSDFEC_LDPC_SC_TABLE_ADDR_BASE)
278c2ecf20Sopenharmony_ci#define XSDFEC_LA_TABLE_DEPTH                                                  \
288c2ecf20Sopenharmony_ci	(XSDFEC_LDPC_LA_TABLE_ADDR_HIGH - XSDFEC_LDPC_LA_TABLE_ADDR_BASE)
298c2ecf20Sopenharmony_ci#define XSDFEC_QC_TABLE_DEPTH                                                  \
308c2ecf20Sopenharmony_ci	(XSDFEC_LDPC_QC_TABLE_ADDR_HIGH - XSDFEC_LDPC_QC_TABLE_ADDR_BASE)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/**
338c2ecf20Sopenharmony_ci * enum xsdfec_code - Code Type.
348c2ecf20Sopenharmony_ci * @XSDFEC_TURBO_CODE: Driver is configured for Turbo mode.
358c2ecf20Sopenharmony_ci * @XSDFEC_LDPC_CODE: Driver is configured for LDPC mode.
368c2ecf20Sopenharmony_ci *
378c2ecf20Sopenharmony_ci * This enum is used to indicate the mode of the driver. The mode is determined
388c2ecf20Sopenharmony_ci * by checking which codes are set in the driver. Note that the mode cannot be
398c2ecf20Sopenharmony_ci * changed by the driver.
408c2ecf20Sopenharmony_ci */
418c2ecf20Sopenharmony_cienum xsdfec_code {
428c2ecf20Sopenharmony_ci	XSDFEC_TURBO_CODE = 0,
438c2ecf20Sopenharmony_ci	XSDFEC_LDPC_CODE,
448c2ecf20Sopenharmony_ci};
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/**
478c2ecf20Sopenharmony_ci * enum xsdfec_order - Order
488c2ecf20Sopenharmony_ci * @XSDFEC_MAINTAIN_ORDER: Maintain order execution of blocks.
498c2ecf20Sopenharmony_ci * @XSDFEC_OUT_OF_ORDER: Out-of-order execution of blocks.
508c2ecf20Sopenharmony_ci *
518c2ecf20Sopenharmony_ci * This enum is used to indicate whether the order of blocks can change from
528c2ecf20Sopenharmony_ci * input to output.
538c2ecf20Sopenharmony_ci */
548c2ecf20Sopenharmony_cienum xsdfec_order {
558c2ecf20Sopenharmony_ci	XSDFEC_MAINTAIN_ORDER = 0,
568c2ecf20Sopenharmony_ci	XSDFEC_OUT_OF_ORDER,
578c2ecf20Sopenharmony_ci};
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/**
608c2ecf20Sopenharmony_ci * enum xsdfec_turbo_alg - Turbo Algorithm Type.
618c2ecf20Sopenharmony_ci * @XSDFEC_MAX_SCALE: Max Log-Map algorithm with extrinsic scaling. When
628c2ecf20Sopenharmony_ci *		      scaling is set to this is equivalent to the Max Log-Map
638c2ecf20Sopenharmony_ci *		      algorithm.
648c2ecf20Sopenharmony_ci * @XSDFEC_MAX_STAR: Log-Map algorithm.
658c2ecf20Sopenharmony_ci * @XSDFEC_TURBO_ALG_MAX: Used to indicate out of bound Turbo algorithms.
668c2ecf20Sopenharmony_ci *
678c2ecf20Sopenharmony_ci * This enum specifies which Turbo Decode algorithm is in use.
688c2ecf20Sopenharmony_ci */
698c2ecf20Sopenharmony_cienum xsdfec_turbo_alg {
708c2ecf20Sopenharmony_ci	XSDFEC_MAX_SCALE = 0,
718c2ecf20Sopenharmony_ci	XSDFEC_MAX_STAR,
728c2ecf20Sopenharmony_ci	XSDFEC_TURBO_ALG_MAX,
738c2ecf20Sopenharmony_ci};
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/**
768c2ecf20Sopenharmony_ci * enum xsdfec_state - State.
778c2ecf20Sopenharmony_ci * @XSDFEC_INIT: Driver is initialized.
788c2ecf20Sopenharmony_ci * @XSDFEC_STARTED: Driver is started.
798c2ecf20Sopenharmony_ci * @XSDFEC_STOPPED: Driver is stopped.
808c2ecf20Sopenharmony_ci * @XSDFEC_NEEDS_RESET: Driver needs to be reset.
818c2ecf20Sopenharmony_ci * @XSDFEC_PL_RECONFIGURE: Programmable Logic needs to be recofigured.
828c2ecf20Sopenharmony_ci *
838c2ecf20Sopenharmony_ci * This enum is used to indicate the state of the driver.
848c2ecf20Sopenharmony_ci */
858c2ecf20Sopenharmony_cienum xsdfec_state {
868c2ecf20Sopenharmony_ci	XSDFEC_INIT = 0,
878c2ecf20Sopenharmony_ci	XSDFEC_STARTED,
888c2ecf20Sopenharmony_ci	XSDFEC_STOPPED,
898c2ecf20Sopenharmony_ci	XSDFEC_NEEDS_RESET,
908c2ecf20Sopenharmony_ci	XSDFEC_PL_RECONFIGURE,
918c2ecf20Sopenharmony_ci};
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci/**
948c2ecf20Sopenharmony_ci * enum xsdfec_axis_width - AXIS_WIDTH.DIN Setting for 128-bit width.
958c2ecf20Sopenharmony_ci * @XSDFEC_1x128b: DIN data input stream consists of a 128-bit lane
968c2ecf20Sopenharmony_ci * @XSDFEC_2x128b: DIN data input stream consists of two 128-bit lanes
978c2ecf20Sopenharmony_ci * @XSDFEC_4x128b: DIN data input stream consists of four 128-bit lanes
988c2ecf20Sopenharmony_ci *
998c2ecf20Sopenharmony_ci * This enum is used to indicate the AXIS_WIDTH.DIN setting for 128-bit width.
1008c2ecf20Sopenharmony_ci * The number of lanes of the DIN data input stream depends upon the
1018c2ecf20Sopenharmony_ci * AXIS_WIDTH.DIN parameter.
1028c2ecf20Sopenharmony_ci */
1038c2ecf20Sopenharmony_cienum xsdfec_axis_width {
1048c2ecf20Sopenharmony_ci	XSDFEC_1x128b = 1,
1058c2ecf20Sopenharmony_ci	XSDFEC_2x128b = 2,
1068c2ecf20Sopenharmony_ci	XSDFEC_4x128b = 4,
1078c2ecf20Sopenharmony_ci};
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci/**
1108c2ecf20Sopenharmony_ci * enum xsdfec_axis_word_include - Words Configuration.
1118c2ecf20Sopenharmony_ci * @XSDFEC_FIXED_VALUE: Fixed, the DIN_WORDS AXI4-Stream interface is removed
1128c2ecf20Sopenharmony_ci *			from the IP instance and is driven with the specified
1138c2ecf20Sopenharmony_ci *			number of words.
1148c2ecf20Sopenharmony_ci * @XSDFEC_IN_BLOCK: In Block, configures the IP instance to expect a single
1158c2ecf20Sopenharmony_ci *		     DIN_WORDS value per input code block. The DIN_WORDS
1168c2ecf20Sopenharmony_ci *		     interface is present.
1178c2ecf20Sopenharmony_ci * @XSDFEC_PER_AXI_TRANSACTION: Per Transaction, configures the IP instance to
1188c2ecf20Sopenharmony_ci * expect one DIN_WORDS value per input transaction on the DIN interface. The
1198c2ecf20Sopenharmony_ci * DIN_WORDS interface is present.
1208c2ecf20Sopenharmony_ci * @XSDFEC_AXIS_WORDS_INCLUDE_MAX: Used to indicate out of bound Words
1218c2ecf20Sopenharmony_ci *				   Configurations.
1228c2ecf20Sopenharmony_ci *
1238c2ecf20Sopenharmony_ci * This enum is used to specify the DIN_WORDS configuration.
1248c2ecf20Sopenharmony_ci */
1258c2ecf20Sopenharmony_cienum xsdfec_axis_word_include {
1268c2ecf20Sopenharmony_ci	XSDFEC_FIXED_VALUE = 0,
1278c2ecf20Sopenharmony_ci	XSDFEC_IN_BLOCK,
1288c2ecf20Sopenharmony_ci	XSDFEC_PER_AXI_TRANSACTION,
1298c2ecf20Sopenharmony_ci	XSDFEC_AXIS_WORDS_INCLUDE_MAX,
1308c2ecf20Sopenharmony_ci};
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci/**
1338c2ecf20Sopenharmony_ci * struct xsdfec_turbo - User data for Turbo codes.
1348c2ecf20Sopenharmony_ci * @alg: Specifies which Turbo decode algorithm to use
1358c2ecf20Sopenharmony_ci * @scale: Specifies the extrinsic scaling to apply when the Max Scale algorithm
1368c2ecf20Sopenharmony_ci *	   has been selected
1378c2ecf20Sopenharmony_ci *
1388c2ecf20Sopenharmony_ci * Turbo code structure to communicate parameters to XSDFEC driver.
1398c2ecf20Sopenharmony_ci */
1408c2ecf20Sopenharmony_cistruct xsdfec_turbo {
1418c2ecf20Sopenharmony_ci	__u32 alg;
1428c2ecf20Sopenharmony_ci	__u8 scale;
1438c2ecf20Sopenharmony_ci};
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci/**
1468c2ecf20Sopenharmony_ci * struct xsdfec_ldpc_params - User data for LDPC codes.
1478c2ecf20Sopenharmony_ci * @n: Number of code word bits
1488c2ecf20Sopenharmony_ci * @k: Number of information bits
1498c2ecf20Sopenharmony_ci * @psize: Size of sub-matrix
1508c2ecf20Sopenharmony_ci * @nlayers: Number of layers in code
1518c2ecf20Sopenharmony_ci * @nqc: Quasi Cyclic Number
1528c2ecf20Sopenharmony_ci * @nmqc: Number of M-sized QC operations in parity check matrix
1538c2ecf20Sopenharmony_ci * @nm: Number of M-size vectors in N
1548c2ecf20Sopenharmony_ci * @norm_type: Normalization required or not
1558c2ecf20Sopenharmony_ci * @no_packing: Determines if multiple QC ops should be performed
1568c2ecf20Sopenharmony_ci * @special_qc: Sub-Matrix property for Circulant weight > 0
1578c2ecf20Sopenharmony_ci * @no_final_parity: Decide if final parity check needs to be performed
1588c2ecf20Sopenharmony_ci * @max_schedule: Experimental code word scheduling limit
1598c2ecf20Sopenharmony_ci * @sc_off: SC offset
1608c2ecf20Sopenharmony_ci * @la_off: LA offset
1618c2ecf20Sopenharmony_ci * @qc_off: QC offset
1628c2ecf20Sopenharmony_ci * @sc_table: Pointer to SC Table which must be page aligned
1638c2ecf20Sopenharmony_ci * @la_table: Pointer to LA Table which must be page aligned
1648c2ecf20Sopenharmony_ci * @qc_table: Pointer to QC Table which must be page aligned
1658c2ecf20Sopenharmony_ci * @code_id: LDPC Code
1668c2ecf20Sopenharmony_ci *
1678c2ecf20Sopenharmony_ci * This structure describes the LDPC code that is passed to the driver by the
1688c2ecf20Sopenharmony_ci * application.
1698c2ecf20Sopenharmony_ci */
1708c2ecf20Sopenharmony_cistruct xsdfec_ldpc_params {
1718c2ecf20Sopenharmony_ci	__u32 n;
1728c2ecf20Sopenharmony_ci	__u32 k;
1738c2ecf20Sopenharmony_ci	__u32 psize;
1748c2ecf20Sopenharmony_ci	__u32 nlayers;
1758c2ecf20Sopenharmony_ci	__u32 nqc;
1768c2ecf20Sopenharmony_ci	__u32 nmqc;
1778c2ecf20Sopenharmony_ci	__u32 nm;
1788c2ecf20Sopenharmony_ci	__u32 norm_type;
1798c2ecf20Sopenharmony_ci	__u32 no_packing;
1808c2ecf20Sopenharmony_ci	__u32 special_qc;
1818c2ecf20Sopenharmony_ci	__u32 no_final_parity;
1828c2ecf20Sopenharmony_ci	__u32 max_schedule;
1838c2ecf20Sopenharmony_ci	__u32 sc_off;
1848c2ecf20Sopenharmony_ci	__u32 la_off;
1858c2ecf20Sopenharmony_ci	__u32 qc_off;
1868c2ecf20Sopenharmony_ci	__u32 *sc_table;
1878c2ecf20Sopenharmony_ci	__u32 *la_table;
1888c2ecf20Sopenharmony_ci	__u32 *qc_table;
1898c2ecf20Sopenharmony_ci	__u16 code_id;
1908c2ecf20Sopenharmony_ci};
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci/**
1938c2ecf20Sopenharmony_ci * struct xsdfec_status - Status of SD-FEC core.
1948c2ecf20Sopenharmony_ci * @state: State of the SD-FEC core
1958c2ecf20Sopenharmony_ci * @activity: Describes if the SD-FEC instance is Active
1968c2ecf20Sopenharmony_ci */
1978c2ecf20Sopenharmony_cistruct xsdfec_status {
1988c2ecf20Sopenharmony_ci	__u32 state;
1998c2ecf20Sopenharmony_ci	__s8 activity;
2008c2ecf20Sopenharmony_ci};
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci/**
2038c2ecf20Sopenharmony_ci * struct xsdfec_irq - Enabling or Disabling Interrupts.
2048c2ecf20Sopenharmony_ci * @enable_isr: If true enables the ISR
2058c2ecf20Sopenharmony_ci * @enable_ecc_isr: If true enables the ECC ISR
2068c2ecf20Sopenharmony_ci */
2078c2ecf20Sopenharmony_cistruct xsdfec_irq {
2088c2ecf20Sopenharmony_ci	__s8 enable_isr;
2098c2ecf20Sopenharmony_ci	__s8 enable_ecc_isr;
2108c2ecf20Sopenharmony_ci};
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci/**
2138c2ecf20Sopenharmony_ci * struct xsdfec_config - Configuration of SD-FEC core.
2148c2ecf20Sopenharmony_ci * @code: The codes being used by the SD-FEC instance
2158c2ecf20Sopenharmony_ci * @order: Order of Operation
2168c2ecf20Sopenharmony_ci * @din_width: Width of the DIN AXI4-Stream
2178c2ecf20Sopenharmony_ci * @din_word_include: How DIN_WORDS are inputted
2188c2ecf20Sopenharmony_ci * @dout_width: Width of the DOUT AXI4-Stream
2198c2ecf20Sopenharmony_ci * @dout_word_include: HOW DOUT_WORDS are outputted
2208c2ecf20Sopenharmony_ci * @irq: Enabling or disabling interrupts
2218c2ecf20Sopenharmony_ci * @bypass: Is the core being bypassed
2228c2ecf20Sopenharmony_ci * @code_wr_protect: Is write protection of LDPC codes enabled
2238c2ecf20Sopenharmony_ci */
2248c2ecf20Sopenharmony_cistruct xsdfec_config {
2258c2ecf20Sopenharmony_ci	__u32 code;
2268c2ecf20Sopenharmony_ci	__u32 order;
2278c2ecf20Sopenharmony_ci	__u32 din_width;
2288c2ecf20Sopenharmony_ci	__u32 din_word_include;
2298c2ecf20Sopenharmony_ci	__u32 dout_width;
2308c2ecf20Sopenharmony_ci	__u32 dout_word_include;
2318c2ecf20Sopenharmony_ci	struct xsdfec_irq irq;
2328c2ecf20Sopenharmony_ci	__s8 bypass;
2338c2ecf20Sopenharmony_ci	__s8 code_wr_protect;
2348c2ecf20Sopenharmony_ci};
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci/**
2378c2ecf20Sopenharmony_ci * struct xsdfec_stats - Stats retrived by ioctl XSDFEC_GET_STATS. Used
2388c2ecf20Sopenharmony_ci *			 to buffer atomic_t variables from struct
2398c2ecf20Sopenharmony_ci *			 xsdfec_dev. Counts are accumulated until
2408c2ecf20Sopenharmony_ci *			 the user clears them.
2418c2ecf20Sopenharmony_ci * @isr_err_count: Count of ISR errors
2428c2ecf20Sopenharmony_ci * @cecc_count: Count of Correctable ECC errors (SBE)
2438c2ecf20Sopenharmony_ci * @uecc_count: Count of Uncorrectable ECC errors (MBE)
2448c2ecf20Sopenharmony_ci */
2458c2ecf20Sopenharmony_cistruct xsdfec_stats {
2468c2ecf20Sopenharmony_ci	__u32 isr_err_count;
2478c2ecf20Sopenharmony_ci	__u32 cecc_count;
2488c2ecf20Sopenharmony_ci	__u32 uecc_count;
2498c2ecf20Sopenharmony_ci};
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci/**
2528c2ecf20Sopenharmony_ci * struct xsdfec_ldpc_param_table_sizes - Used to store sizes of SD-FEC table
2538c2ecf20Sopenharmony_ci *					  entries for an individual LPDC code
2548c2ecf20Sopenharmony_ci *					  parameter.
2558c2ecf20Sopenharmony_ci * @sc_size: Size of SC table used
2568c2ecf20Sopenharmony_ci * @la_size: Size of LA table used
2578c2ecf20Sopenharmony_ci * @qc_size: Size of QC table used
2588c2ecf20Sopenharmony_ci */
2598c2ecf20Sopenharmony_cistruct xsdfec_ldpc_param_table_sizes {
2608c2ecf20Sopenharmony_ci	__u32 sc_size;
2618c2ecf20Sopenharmony_ci	__u32 la_size;
2628c2ecf20Sopenharmony_ci	__u32 qc_size;
2638c2ecf20Sopenharmony_ci};
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci/*
2668c2ecf20Sopenharmony_ci * XSDFEC IOCTL List
2678c2ecf20Sopenharmony_ci */
2688c2ecf20Sopenharmony_ci#define XSDFEC_MAGIC 'f'
2698c2ecf20Sopenharmony_ci/**
2708c2ecf20Sopenharmony_ci * DOC: XSDFEC_START_DEV
2718c2ecf20Sopenharmony_ci *
2728c2ecf20Sopenharmony_ci * @Description
2738c2ecf20Sopenharmony_ci *
2748c2ecf20Sopenharmony_ci * ioctl to start SD-FEC core
2758c2ecf20Sopenharmony_ci *
2768c2ecf20Sopenharmony_ci * This fails if the XSDFEC_SET_ORDER ioctl has not been previously called
2778c2ecf20Sopenharmony_ci */
2788c2ecf20Sopenharmony_ci#define XSDFEC_START_DEV _IO(XSDFEC_MAGIC, 0)
2798c2ecf20Sopenharmony_ci/**
2808c2ecf20Sopenharmony_ci * DOC: XSDFEC_STOP_DEV
2818c2ecf20Sopenharmony_ci *
2828c2ecf20Sopenharmony_ci * @Description
2838c2ecf20Sopenharmony_ci *
2848c2ecf20Sopenharmony_ci * ioctl to stop the SD-FEC core
2858c2ecf20Sopenharmony_ci */
2868c2ecf20Sopenharmony_ci#define XSDFEC_STOP_DEV _IO(XSDFEC_MAGIC, 1)
2878c2ecf20Sopenharmony_ci/**
2888c2ecf20Sopenharmony_ci * DOC: XSDFEC_GET_STATUS
2898c2ecf20Sopenharmony_ci *
2908c2ecf20Sopenharmony_ci * @Description
2918c2ecf20Sopenharmony_ci *
2928c2ecf20Sopenharmony_ci * ioctl that returns status of SD-FEC core
2938c2ecf20Sopenharmony_ci */
2948c2ecf20Sopenharmony_ci#define XSDFEC_GET_STATUS _IOR(XSDFEC_MAGIC, 2, struct xsdfec_status)
2958c2ecf20Sopenharmony_ci/**
2968c2ecf20Sopenharmony_ci * DOC: XSDFEC_SET_IRQ
2978c2ecf20Sopenharmony_ci * @Parameters
2988c2ecf20Sopenharmony_ci *
2998c2ecf20Sopenharmony_ci * @struct xsdfec_irq *
3008c2ecf20Sopenharmony_ci *	Pointer to the &struct xsdfec_irq that contains the interrupt settings
3018c2ecf20Sopenharmony_ci *	for the SD-FEC core
3028c2ecf20Sopenharmony_ci *
3038c2ecf20Sopenharmony_ci * @Description
3048c2ecf20Sopenharmony_ci *
3058c2ecf20Sopenharmony_ci * ioctl to enable or disable irq
3068c2ecf20Sopenharmony_ci */
3078c2ecf20Sopenharmony_ci#define XSDFEC_SET_IRQ _IOW(XSDFEC_MAGIC, 3, struct xsdfec_irq)
3088c2ecf20Sopenharmony_ci/**
3098c2ecf20Sopenharmony_ci * DOC: XSDFEC_SET_TURBO
3108c2ecf20Sopenharmony_ci * @Parameters
3118c2ecf20Sopenharmony_ci *
3128c2ecf20Sopenharmony_ci * @struct xsdfec_turbo *
3138c2ecf20Sopenharmony_ci *	Pointer to the &struct xsdfec_turbo that contains the Turbo decode
3148c2ecf20Sopenharmony_ci *	settings for the SD-FEC core
3158c2ecf20Sopenharmony_ci *
3168c2ecf20Sopenharmony_ci * @Description
3178c2ecf20Sopenharmony_ci *
3188c2ecf20Sopenharmony_ci * ioctl that sets the SD-FEC Turbo parameter values
3198c2ecf20Sopenharmony_ci *
3208c2ecf20Sopenharmony_ci * This can only be used when the driver is in the XSDFEC_STOPPED state
3218c2ecf20Sopenharmony_ci */
3228c2ecf20Sopenharmony_ci#define XSDFEC_SET_TURBO _IOW(XSDFEC_MAGIC, 4, struct xsdfec_turbo)
3238c2ecf20Sopenharmony_ci/**
3248c2ecf20Sopenharmony_ci * DOC: XSDFEC_ADD_LDPC_CODE_PARAMS
3258c2ecf20Sopenharmony_ci * @Parameters
3268c2ecf20Sopenharmony_ci *
3278c2ecf20Sopenharmony_ci * @struct xsdfec_ldpc_params *
3288c2ecf20Sopenharmony_ci *	Pointer to the &struct xsdfec_ldpc_params that contains the LDPC code
3298c2ecf20Sopenharmony_ci *	parameters to be added to the SD-FEC Block
3308c2ecf20Sopenharmony_ci *
3318c2ecf20Sopenharmony_ci * @Description
3328c2ecf20Sopenharmony_ci * ioctl to add an LDPC code to the SD-FEC LDPC codes
3338c2ecf20Sopenharmony_ci *
3348c2ecf20Sopenharmony_ci * This can only be used when:
3358c2ecf20Sopenharmony_ci *
3368c2ecf20Sopenharmony_ci * - Driver is in the XSDFEC_STOPPED state
3378c2ecf20Sopenharmony_ci *
3388c2ecf20Sopenharmony_ci * - SD-FEC core is configured as LPDC
3398c2ecf20Sopenharmony_ci *
3408c2ecf20Sopenharmony_ci * - SD-FEC Code Write Protection is disabled
3418c2ecf20Sopenharmony_ci */
3428c2ecf20Sopenharmony_ci#define XSDFEC_ADD_LDPC_CODE_PARAMS                                            \
3438c2ecf20Sopenharmony_ci	_IOW(XSDFEC_MAGIC, 5, struct xsdfec_ldpc_params)
3448c2ecf20Sopenharmony_ci/**
3458c2ecf20Sopenharmony_ci * DOC: XSDFEC_GET_CONFIG
3468c2ecf20Sopenharmony_ci * @Parameters
3478c2ecf20Sopenharmony_ci *
3488c2ecf20Sopenharmony_ci * @struct xsdfec_config *
3498c2ecf20Sopenharmony_ci *	Pointer to the &struct xsdfec_config that contains the current
3508c2ecf20Sopenharmony_ci *	configuration settings of the SD-FEC Block
3518c2ecf20Sopenharmony_ci *
3528c2ecf20Sopenharmony_ci * @Description
3538c2ecf20Sopenharmony_ci *
3548c2ecf20Sopenharmony_ci * ioctl that returns SD-FEC core configuration
3558c2ecf20Sopenharmony_ci */
3568c2ecf20Sopenharmony_ci#define XSDFEC_GET_CONFIG _IOR(XSDFEC_MAGIC, 6, struct xsdfec_config)
3578c2ecf20Sopenharmony_ci/**
3588c2ecf20Sopenharmony_ci * DOC: XSDFEC_GET_TURBO
3598c2ecf20Sopenharmony_ci * @Parameters
3608c2ecf20Sopenharmony_ci *
3618c2ecf20Sopenharmony_ci * @struct xsdfec_turbo *
3628c2ecf20Sopenharmony_ci *	Pointer to the &struct xsdfec_turbo that contains the current Turbo
3638c2ecf20Sopenharmony_ci *	decode settings of the SD-FEC Block
3648c2ecf20Sopenharmony_ci *
3658c2ecf20Sopenharmony_ci * @Description
3668c2ecf20Sopenharmony_ci *
3678c2ecf20Sopenharmony_ci * ioctl that returns SD-FEC turbo param values
3688c2ecf20Sopenharmony_ci */
3698c2ecf20Sopenharmony_ci#define XSDFEC_GET_TURBO _IOR(XSDFEC_MAGIC, 7, struct xsdfec_turbo)
3708c2ecf20Sopenharmony_ci/**
3718c2ecf20Sopenharmony_ci * DOC: XSDFEC_SET_ORDER
3728c2ecf20Sopenharmony_ci * @Parameters
3738c2ecf20Sopenharmony_ci *
3748c2ecf20Sopenharmony_ci * @struct unsigned long *
3758c2ecf20Sopenharmony_ci *	Pointer to the unsigned long that contains a value from the
3768c2ecf20Sopenharmony_ci *	@enum xsdfec_order
3778c2ecf20Sopenharmony_ci *
3788c2ecf20Sopenharmony_ci * @Description
3798c2ecf20Sopenharmony_ci *
3808c2ecf20Sopenharmony_ci * ioctl that sets order, if order of blocks can change from input to output
3818c2ecf20Sopenharmony_ci *
3828c2ecf20Sopenharmony_ci * This can only be used when the driver is in the XSDFEC_STOPPED state
3838c2ecf20Sopenharmony_ci */
3848c2ecf20Sopenharmony_ci#define XSDFEC_SET_ORDER _IOW(XSDFEC_MAGIC, 8, unsigned long)
3858c2ecf20Sopenharmony_ci/**
3868c2ecf20Sopenharmony_ci * DOC: XSDFEC_SET_BYPASS
3878c2ecf20Sopenharmony_ci * @Parameters
3888c2ecf20Sopenharmony_ci *
3898c2ecf20Sopenharmony_ci * @struct bool *
3908c2ecf20Sopenharmony_ci *	Pointer to bool that sets the bypass value, where false results in
3918c2ecf20Sopenharmony_ci *	normal operation and false results in the SD-FEC performing the
3928c2ecf20Sopenharmony_ci *	configured operations (same number of cycles) but output data matches
3938c2ecf20Sopenharmony_ci *	the input data
3948c2ecf20Sopenharmony_ci *
3958c2ecf20Sopenharmony_ci * @Description
3968c2ecf20Sopenharmony_ci *
3978c2ecf20Sopenharmony_ci * ioctl that sets bypass.
3988c2ecf20Sopenharmony_ci *
3998c2ecf20Sopenharmony_ci * This can only be used when the driver is in the XSDFEC_STOPPED state
4008c2ecf20Sopenharmony_ci */
4018c2ecf20Sopenharmony_ci#define XSDFEC_SET_BYPASS _IOW(XSDFEC_MAGIC, 9, bool)
4028c2ecf20Sopenharmony_ci/**
4038c2ecf20Sopenharmony_ci * DOC: XSDFEC_IS_ACTIVE
4048c2ecf20Sopenharmony_ci * @Parameters
4058c2ecf20Sopenharmony_ci *
4068c2ecf20Sopenharmony_ci * @struct bool *
4078c2ecf20Sopenharmony_ci *	Pointer to bool that returns true if the SD-FEC is processing data
4088c2ecf20Sopenharmony_ci *
4098c2ecf20Sopenharmony_ci * @Description
4108c2ecf20Sopenharmony_ci *
4118c2ecf20Sopenharmony_ci * ioctl that determines if SD-FEC is processing data
4128c2ecf20Sopenharmony_ci */
4138c2ecf20Sopenharmony_ci#define XSDFEC_IS_ACTIVE _IOR(XSDFEC_MAGIC, 10, bool)
4148c2ecf20Sopenharmony_ci/**
4158c2ecf20Sopenharmony_ci * DOC: XSDFEC_CLEAR_STATS
4168c2ecf20Sopenharmony_ci *
4178c2ecf20Sopenharmony_ci * @Description
4188c2ecf20Sopenharmony_ci *
4198c2ecf20Sopenharmony_ci * ioctl that clears error stats collected during interrupts
4208c2ecf20Sopenharmony_ci */
4218c2ecf20Sopenharmony_ci#define XSDFEC_CLEAR_STATS _IO(XSDFEC_MAGIC, 11)
4228c2ecf20Sopenharmony_ci/**
4238c2ecf20Sopenharmony_ci * DOC: XSDFEC_GET_STATS
4248c2ecf20Sopenharmony_ci * @Parameters
4258c2ecf20Sopenharmony_ci *
4268c2ecf20Sopenharmony_ci * @struct xsdfec_stats *
4278c2ecf20Sopenharmony_ci *	Pointer to the &struct xsdfec_stats that will contain the updated stats
4288c2ecf20Sopenharmony_ci *	values
4298c2ecf20Sopenharmony_ci *
4308c2ecf20Sopenharmony_ci * @Description
4318c2ecf20Sopenharmony_ci *
4328c2ecf20Sopenharmony_ci * ioctl that returns SD-FEC core stats
4338c2ecf20Sopenharmony_ci *
4348c2ecf20Sopenharmony_ci * This can only be used when the driver is in the XSDFEC_STOPPED state
4358c2ecf20Sopenharmony_ci */
4368c2ecf20Sopenharmony_ci#define XSDFEC_GET_STATS _IOR(XSDFEC_MAGIC, 12, struct xsdfec_stats)
4378c2ecf20Sopenharmony_ci/**
4388c2ecf20Sopenharmony_ci * DOC: XSDFEC_SET_DEFAULT_CONFIG
4398c2ecf20Sopenharmony_ci *
4408c2ecf20Sopenharmony_ci * @Description
4418c2ecf20Sopenharmony_ci *
4428c2ecf20Sopenharmony_ci * ioctl that returns SD-FEC core to default config, use after a reset
4438c2ecf20Sopenharmony_ci *
4448c2ecf20Sopenharmony_ci * This can only be used when the driver is in the XSDFEC_STOPPED state
4458c2ecf20Sopenharmony_ci */
4468c2ecf20Sopenharmony_ci#define XSDFEC_SET_DEFAULT_CONFIG _IO(XSDFEC_MAGIC, 13)
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_ci#endif /* __XILINX_SDFEC_H__ */
449