7 :caption: Table of Contents
14 This driver supports SD-FEC core for Zynq |Ultrascale+ (TM)| RFSoC devices.
16 .. |Ultrascale+ (TM)| unicode:: Ultrascale+ U+2122
17 .. with trademark sign
20 For a full description of SD-FEC features, see the `SD-FEC Product Guide (PG256
21 v1.1) <https://www.xilinx.com/support/documentation/ip_documentation/sd_fec/v1_1/pg256-sdfec-integrated-block.pdf>`_
23 This driver supports the following features:
25 - Supports retrieval of the Integrated Block Configuration and Status
27 - Supports configuration of LDPC Codes.
28 - Supports configuration of Turbo Decoding.
29 - Supports monitoring errors
31 Missing features, known issues and limitations of the SD-FEC driver are as
34 - Only allows a single open file handler to any instance of the driver at any time.
35 - Reset of the SD-FEC Integrated Block is not controlled by this driver.
36 - Does not support shared LDPC code table wraparound.
38 The device tree entry is described in:
39 `linux-xlnx/Documentation/devicetree/bindings/misc/xlnx,sd-fec.txt <https://github.com/Xilinx/linux-xlnx/blob/master/Documentation/devicetree/bindings/misc/xlnx%2Csd-fec.txt>`_
45 The Driver works with the SD-FEC block in two modes of operation:
47 - Run-time Configuration
48 - Programmable Logic(PL) Initialization
51 Run-time Configuration
52 ~~~~~~~~~~~~~~~~~~~~~~
54 For Run-time configuration the role of driver is to allow the software application to do the following:
56 - loads the configuration parameters for either Turbo decode or LDPC encode or decode parameters
57 - activate the SD-FEC block
58 - monitors the SD-FEC block for errors
59 - retrieve the status and configuration of the SD-FEC block
61 Programmable Logic(PL) Initialization
62 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64 For PL Initialization supporting logic loads configuration parameters for either
65 the Turbo decode or LDPC encode or encode parameters. The role of the driver
66 is to allow the software application to do the following
68 - activate the SD-FEC block
69 - monitor the SD-FEC block for errors
70 - retrieve the status and configuration of the SD-FEC block
76 The driver provides a platform device where the "probe" and "remove"
77 operations are provided.
79 - probe: Updates configuration register with device-tree entries plus determines the current activate state of the core, e.g. is the core bypassed or has the core been started.
82 The driver defines the following driver file operations to provide user
83 application interfaces:
85 - open: Implements restriction that only a single file descriptor can be open per SD-FEC instance at any time.
86 - release: Allows another file descriptor to be open, i.e. after current file descriptor is closed.
87 - poll: provides a method to monitor for SD-FEC Error events
88 - unlocked_ioctl: provides the the following ioctl commands that allows the application configure the SD-FEC block
90 - :c:macro:`XSDFEC_START_DEV`
91 - :c:macro:`XSDFEC_STOP_DEV`
92 - :c:macro:`XSDFEC_GET_STATUS`
93 - :c:macro:`XSDFEC_SET_IRQ`
94 - :c:macro:`XSDFEC_SET_TURBO`
95 - :c:macro:`XSDFEC_ADD_LDPC_CODE_PARAMS`
96 - :c:macro:`XSDFEC_GET_CONFIG`
97 - :c:macro:`XSDFEC_SET_ORDER`
98 - :c:macro:`XSDFEC_SET_BYPASS`
99 - :c:macro:`XSDFEC_IS_ACTIVE`
100 - :c:macro:`XSDFEC_CLEAR_STATS`
101 - :c:macro:`XSDFEC_SET_DEFAULT_CONFIG`
111 After opening the driver, the user should find out what operations needs to
112 be preformed to configure and activate the SD-FEC block and determine the
113 configuration of the driver.
114 The following outlines the flow the user should perform:
116 - Determine Configuration
117 - Set the Order if not already configured as desired
118 - Set Turbo decode, LPDC encode or decode parameters, depending on how the
119 SD-FEC block is configured plus if the SD-FEC has not been configured for PL
121 - Enable interrupts, if not already enabled
122 - Bypass the SD-FEC block to bypass if required
123 - Start the SD-FEC block if not already started
124 - Get the SD-FEC block status
125 - Monitor for interrupts
126 - Stop the SD-FEC block
129 Note: When monitoring for interrupts if a critical error is detected where a Reset is required. The driver will be required to load the default configuration.
132 Determine Configuration
133 -----------------------
135 Determine the configuration of the SD-FEC block by using the ioctl
136 :c:macro:`XSDFEC_GET_CONFIG`.
141 Setting the order determines how the order of blocks can change from input to output.
143 Setting the order is done by using the ioctl :c:macro:`XSDFEC_SET_ORDER`
145 Setting the order can only be done if the following restrictions are met:
147 - The "state" member of struct :c:type:`xsdfec_status <xsdfec_status>` filled by the ioctl :c:macro:`XSDFEC_GET_STATUS` indicates the SD-FEC Block has not STARTED
153 The following steps indicate how to add LDPC Codes to the SD-FEC Block:
155 - Use the auto-generated parameters to fill the :c:type:`struct xsdfec_ldpc_params <xsdfec_ldpc_params>` for the desired LDPC code.
156 - Set the SC, QA and LA table offsets for the LPDC parameters and the parameters in the structure :c:type:`struct xsdfec_ldpc_params <xsdfec_ldpc_params>`
157 - Set the desired Code Id value in the structure :c:type:`struct xsdfec_ldpc_params <xsdfec_ldpc_params>`
158 - Add the LPDC Code Parameters using the ioctl :c:macro:`XSDFEC_ADD_LDPC_CODE_PARAMS`
159 - For the applied LPDC Code Parameter use the function :c:func:`xsdfec_calculate_shared_ldpc_table_entry_size` to calculate the size of shared LPDC code tables. This allows the user to determine what the shared table usage and select an unused area when determining the table offsets for the next LDPC code parameters.
160 - Repeat for each LDPC code parameter.
162 Adding LDPC Codes can only be done if the following restrictions are met:
164 - The "code" member of :c:type:`struct xsdfec_config <xsdfec_config>` filled by the ioctl :c:macro:`XSDFEC_GET_CONFIG` indicates the SD-FEC Block is configured as LDPC
165 - The "code_wr_protect" of :c:type:`struct xsdfec_config <xsdfec_config>` filled by the ioctl :c:macro:`XSDFEC_GET_CONFIG` indicates that Write Protection is not enabled
166 - The "state" member of struct :c:type:`xsdfec_status <xsdfec_status>` filled by the ioctl :c:macro:`XSDFEC_GET_STATUS` indicates the SD-FEC Block has not started
171 Setting the order is done by using the ioctl :c:macro:`XSDFEC_SET_TURBO` where using auto-generated parameters to fill the :c:type:`struct xsdfec_turbo <xsdfec_turbo>` for the desired Turbo code.
173 Adding Turbo decode can only be done if the following restrictions are met:
175 - The "code" member of :c:type:`struct xsdfec_config <xsdfec_config>` filled by the ioctl :c:macro:`XSDFEC_GET_CONFIG` indicates the SD-FEC Block is configured as TURBO
176 - The "state" member of struct :c:type:`xsdfec_status <xsdfec_status>` filled by the ioctl :c:macro:`XSDFEC_GET_STATUS` indicates the SD-FEC Block has not STARTED
181 Enabling or disabling is done by using the ioctl XSDFEC_SET_IRQ. The members of the parameter passed, struct xsdfec_irq, to the ioctl are used to set and clear different categories of interrupts. The category of interrupt is controlled as following:
183 - "enable_isr" controls the "tlast" interrupts
184 - "enable_ecc_isr" controls the ECC interrupts
186 If the "code" member of :c:type:`struct xsdfec_config <xsdfec_config>` filled by the ioctl :c:macro:`XSDFEC_GET_CONFIG` indicates the SD-FEC Block is configured as TURBO then the enabling ECC errors is not required.
191 Bypassing the SD-FEC is done by using the ioctl :c:macro:`XSDFEC_SET_BYPASS`
193 Bypassing the SD-FEC can only be done if the following restrictions are met:
195 - The "state" member of :c:type:`struct xsdfec_status <xsdfec_status>` filled by the ioctl :c:macro:`XSDFEC_GET_STATUS` indicates the SD-FEC Block has not STARTED
200 Start the SD-FEC by using the ioctl :c:macro:`XSDFEC_START_DEV`
205 Get the SD-FEC status of the device by using the ioctl :c:macro:`XSDFEC_GET` which will fill the :c:type:`struct xsdfec_status <xsdfec_status>`
207 Monitor for interrupts
208 ----------------------
210 - Use the poll system call to monitor for an interrupt. the poll system call waits for an interrupt to wake it up or times out if no interrupt occurs.
211 - On return Poll "revents" will indicate whether stats and/or state have been updated
212 - POLLPRI indicates a critical error and and user should use :c:macro:`XSDFEC_GET_STATUS` and :c:macro:`XSDFEC_GET_STATS` to confirm.
213 - POLLRDNORM indicates a non-critical error has occurred and the user should use :c:macro:`XSDFEC_GET_STATS` to confirm
214 - Get stats by using the ioctl :c:macro:`XSDFEC_GET_STATS`
215 - For critical error the "isr_err_count" or "uecc_count" member of :c:type:`struct xsdfec_stats <xsdfec_stats>` will be non-zero
216 - For non-critical errors the "cecc_count" member of :c:type:`struct xsdfec_stats <xsdfec_stats>` will be non-zero
217 - Get state by using the ioctl :c:macro:`XSDFEC_GET_STATUS`
218 - For a critical error the "state" of :c:type:`xsdfec_status <xsdfec_status>` will indicate a Reset Is Required
219 - Clear stats by using the ioctl :c:macro:`XSDFEC_CLEAR_STATS`
221 If a critical error is detected where a Reset is required. The application is required to call the ioctl :c:macro:`XSDFEC_SET_DEFAULT_CONFIG` after the reset and it is not required to call the ioctl :c:macro:`XSDFEC_STOP_DEV`
223 Note: Using poll system call prevents busy looping using :c:macro:`XSDFEC_GET_STATS` and :c:macro:`XSDFEC_GET_STATUS`
225 Stop the SD-FEC block
226 ---------------------
228 Stop the device by using the ioctl :c:macro:`XSDFEC_STOP_DEV`
230 Set the Default Configuration
231 -----------------------------
233 Load default configuration by using the ioctl :c:macro:`XSDFEC_SET_DEFAULT_CONFIG` to restore the driver.
238 .. c:macro:: XSDFEC_START_DEV
239 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
240 :doc: XSDFEC_START_DEV
242 .. c:macro:: XSDFEC_STOP_DEV
243 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
244 :doc: XSDFEC_STOP_DEV
246 .. c:macro:: XSDFEC_GET_STATUS
247 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
248 :doc: XSDFEC_GET_STATUS
250 .. c:macro:: XSDFEC_SET_IRQ
251 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
254 .. c:macro:: XSDFEC_SET_TURBO
255 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
256 :doc: XSDFEC_SET_TURBO
258 .. c:macro:: XSDFEC_ADD_LDPC_CODE_PARAMS
259 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
260 :doc: XSDFEC_ADD_LDPC_CODE_PARAMS
262 .. c:macro:: XSDFEC_GET_CONFIG
263 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
264 :doc: XSDFEC_GET_CONFIG
266 .. c:macro:: XSDFEC_SET_ORDER
267 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
268 :doc: XSDFEC_SET_ORDER
270 .. c:macro:: XSDFEC_SET_BYPASS
271 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
272 :doc: XSDFEC_SET_BYPASS
274 .. c:macro:: XSDFEC_IS_ACTIVE
275 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
276 :doc: XSDFEC_IS_ACTIVE
278 .. c:macro:: XSDFEC_CLEAR_STATS
279 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
280 :doc: XSDFEC_CLEAR_STATS
282 .. c:macro:: XSDFEC_GET_STATS
283 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
284 :doc: XSDFEC_GET_STATS
286 .. c:macro:: XSDFEC_SET_DEFAULT_CONFIG
287 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
288 :doc: XSDFEC_SET_DEFAULT_CONFIG
290 Driver Type Definitions
291 =======================
293 .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h