Commit 20ec628e authored by Dragan Cvetic's avatar Dragan Cvetic Committed by Greg Kroah-Hartman

misc: xilinx_sdfec: Add ability to configure LDPC

Add the capability to configure LDPC mode via the ioctl
XSDFEC_ADD_LDPC_CODE_PARAMS.
Tested-by: default avatarDragan Cvetic <dragan.cvetic@xilinx.com>
Signed-off-by: default avatarDerek Kiernan <derek.kiernan@xilinx.com>
Signed-off-by: default avatarDragan Cvetic <dragan.cvetic@xilinx.com>
Link: https://lore.kernel.org/r/1564216438-322406-4-git-send-email-dragan.cvetic@xilinx.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6f86ed82
This diff is collapsed.
...@@ -13,6 +13,22 @@ ...@@ -13,6 +13,22 @@
#include <linux/types.h> #include <linux/types.h>
/* Shared LDPC Tables */
#define XSDFEC_LDPC_SC_TABLE_ADDR_BASE (0x10000)
#define XSDFEC_LDPC_SC_TABLE_ADDR_HIGH (0x10400)
#define XSDFEC_LDPC_LA_TABLE_ADDR_BASE (0x18000)
#define XSDFEC_LDPC_LA_TABLE_ADDR_HIGH (0x19000)
#define XSDFEC_LDPC_QC_TABLE_ADDR_BASE (0x20000)
#define XSDFEC_LDPC_QC_TABLE_ADDR_HIGH (0x28000)
/* LDPC tables depth */
#define XSDFEC_SC_TABLE_DEPTH \
(XSDFEC_LDPC_SC_TABLE_ADDR_HIGH - XSDFEC_LDPC_SC_TABLE_ADDR_BASE)
#define XSDFEC_LA_TABLE_DEPTH \
(XSDFEC_LDPC_LA_TABLE_ADDR_HIGH - XSDFEC_LDPC_LA_TABLE_ADDR_BASE)
#define XSDFEC_QC_TABLE_DEPTH \
(XSDFEC_LDPC_QC_TABLE_ADDR_HIGH - XSDFEC_LDPC_QC_TABLE_ADDR_BASE)
/** /**
* enum xsdfec_code - Code Type. * enum xsdfec_code - Code Type.
* @XSDFEC_TURBO_CODE: Driver is configured for Turbo mode. * @XSDFEC_TURBO_CODE: Driver is configured for Turbo mode.
...@@ -126,6 +142,53 @@ struct xsdfec_turbo { ...@@ -126,6 +142,53 @@ struct xsdfec_turbo {
__u8 scale; __u8 scale;
}; };
/**
* struct xsdfec_ldpc_params - User data for LDPC codes.
* @n: Number of code word bits
* @k: Number of information bits
* @psize: Size of sub-matrix
* @nlayers: Number of layers in code
* @nqc: Quasi Cyclic Number
* @nmqc: Number of M-sized QC operations in parity check matrix
* @nm: Number of M-size vectors in N
* @norm_type: Normalization required or not
* @no_packing: Determines if multiple QC ops should be performed
* @special_qc: Sub-Matrix property for Circulant weight > 0
* @no_final_parity: Decide if final parity check needs to be performed
* @max_schedule: Experimental code word scheduling limit
* @sc_off: SC offset
* @la_off: LA offset
* @qc_off: QC offset
* @sc_table: Pointer to SC Table which must be page aligned
* @la_table: Pointer to LA Table which must be page aligned
* @qc_table: Pointer to QC Table which must be page aligned
* @code_id: LDPC Code
*
* This structure describes the LDPC code that is passed to the driver by the
* application.
*/
struct xsdfec_ldpc_params {
__u32 n;
__u32 k;
__u32 psize;
__u32 nlayers;
__u32 nqc;
__u32 nmqc;
__u32 nm;
__u32 norm_type;
__u32 no_packing;
__u32 special_qc;
__u32 no_final_parity;
__u32 max_schedule;
__u32 sc_off;
__u32 la_off;
__u32 qc_off;
__u32 *sc_table;
__u32 *la_table;
__u32 *qc_table;
__u16 code_id;
};
/** /**
* struct xsdfec_status - Status of SD-FEC core. * struct xsdfec_status - Status of SD-FEC core.
* @state: State of the SD-FEC core * @state: State of the SD-FEC core
...@@ -170,6 +233,20 @@ struct xsdfec_config { ...@@ -170,6 +233,20 @@ struct xsdfec_config {
__s8 code_wr_protect; __s8 code_wr_protect;
}; };
/**
* struct xsdfec_ldpc_param_table_sizes - Used to store sizes of SD-FEC table
* entries for an individual LPDC code
* parameter.
* @sc_size: Size of SC table used
* @la_size: Size of LA table used
* @qc_size: Size of QC table used
*/
struct xsdfec_ldpc_param_table_sizes {
__u32 sc_size;
__u32 la_size;
__u32 qc_size;
};
/* /*
* XSDFEC IOCTL List * XSDFEC IOCTL List
*/ */
...@@ -189,6 +266,27 @@ struct xsdfec_config { ...@@ -189,6 +266,27 @@ struct xsdfec_config {
* This can only be used when the driver is in the XSDFEC_STOPPED state * This can only be used when the driver is in the XSDFEC_STOPPED state
*/ */
#define XSDFEC_SET_TURBO _IOW(XSDFEC_MAGIC, 4, struct xsdfec_turbo) #define XSDFEC_SET_TURBO _IOW(XSDFEC_MAGIC, 4, struct xsdfec_turbo)
/**
* DOC: XSDFEC_ADD_LDPC_CODE_PARAMS
* @Parameters
*
* @struct xsdfec_ldpc_params *
* Pointer to the &struct xsdfec_ldpc_params that contains the LDPC code
* parameters to be added to the SD-FEC Block
*
* @Description
* ioctl to add an LDPC code to the SD-FEC LDPC codes
*
* This can only be used when:
*
* - Driver is in the XSDFEC_STOPPED state
*
* - SD-FEC core is configured as LPDC
*
* - SD-FEC Code Write Protection is disabled
*/
#define XSDFEC_ADD_LDPC_CODE_PARAMS \
_IOW(XSDFEC_MAGIC, 5, struct xsdfec_ldpc_params)
/** /**
* DOC: XSDFEC_GET_TURBO * DOC: XSDFEC_GET_TURBO
* @Parameters * @Parameters
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment