Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) .. SPDX-License-Identifier: GPL-2.0+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) ====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) Xilinx SD-FEC Driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) ====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) Overview
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) This driver supports SD-FEC Integrated Block for Zynq |Ultrascale+ (TM)| RFSoCs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) .. |Ultrascale+ (TM)| unicode:: Ultrascale+ U+2122
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)    .. with trademark sign
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) For a full description of SD-FEC core features, see the `SD-FEC Product Guide (PG256) <https://www.xilinx.com/cgi-bin/docs/ipdoc?c=sd_fec;v=latest;d=pg256-sdfec-integrated-block.pdf>`_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) This driver supports the following features:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)   - Retrieval of the Integrated Block configuration and status information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)   - Configuration of LDPC codes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)   - Configuration of Turbo decoding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)   - Monitoring errors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) Missing features, known issues, and limitations of the SD-FEC driver are as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) follows:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)   - Only allows a single open file handler to any instance of the driver at any time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)   - Reset of the SD-FEC Integrated Block is not controlled by this driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)   - Does not support shared LDPC code table wraparound
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) The device tree entry is described in:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) `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>`_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) Modes of Operation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) ------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) The driver works with the SD-FEC core in two modes of operation:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)   - Run-time configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)   - Programmable Logic (PL) initialization
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) Run-time Configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) ~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) For Run-time configuration the role of driver is to allow the software application to do the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	- Load the configuration parameters for either Turbo decode or LDPC encode or decode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	- Activate the SD-FEC core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	- Monitor the SD-FEC core for errors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	- Retrieve the status and configuration of the SD-FEC core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) Programmable Logic (PL) Initialization
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) For PL initialization, supporting logic loads configuration parameters for either
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) the Turbo decode or LDPC encode or decode.  The role of the driver is to allow
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) the software application to do the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	- Activate the SD-FEC core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	- Monitor the SD-FEC core for errors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	- Retrieve the status and configuration of the SD-FEC core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) Driver Structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) The driver provides a platform device where the ``probe`` and ``remove``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) operations are provided.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)   - probe: Updates configuration register with device-tree entries plus determines the current activate state of the core, for example, is the core bypassed or has the core been started.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) The driver defines the following driver file operations to provide user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) application interfaces:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)   - open: Implements restriction that only a single file descriptor can be open per SD-FEC instance at any time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)   - release: Allows another file descriptor to be open, that is after current file descriptor is closed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)   - poll: Provides a method to monitor for SD-FEC Error events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)   - unlocked_ioctl: Provides the following ioctl commands that allows the application configure the SD-FEC core:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		- :c:macro:`XSDFEC_START_DEV`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		- :c:macro:`XSDFEC_STOP_DEV`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		- :c:macro:`XSDFEC_GET_STATUS`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		- :c:macro:`XSDFEC_SET_IRQ`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		- :c:macro:`XSDFEC_SET_TURBO`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		- :c:macro:`XSDFEC_ADD_LDPC_CODE_PARAMS`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 		- :c:macro:`XSDFEC_GET_CONFIG`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		- :c:macro:`XSDFEC_SET_ORDER`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		- :c:macro:`XSDFEC_SET_BYPASS`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		- :c:macro:`XSDFEC_IS_ACTIVE`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		- :c:macro:`XSDFEC_CLEAR_STATS`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		- :c:macro:`XSDFEC_SET_DEFAULT_CONFIG`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) Driver Usage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) Overview
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) After opening the driver, the user should find out what operations need to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) performed to configure and activate the SD-FEC core and determine the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) configuration of the driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) The following outlines the flow the user should perform:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)   - Determine Configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)   - Set the order, if not already configured as desired
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)   - Set Turbo decode, LPDC encode or decode parameters, depending on how the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)     SD-FEC core is configured plus if the SD-FEC has not been configured for PL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)     initialization
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)   - Enable interrupts, if not already enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)   - Bypass the SD-FEC core, if required
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)   - Start the SD-FEC core if not already started
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)   - Get the SD-FEC core status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)   - Monitor for interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)   - Stop the SD-FEC core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 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.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) Determine Configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) -----------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) Determine the configuration of the SD-FEC core by using the ioctl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) :c:macro:`XSDFEC_GET_CONFIG`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) Set the Order
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) -------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) Setting the order determines how the order of Blocks can change from input to output.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) Setting the order is done by using the ioctl :c:macro:`XSDFEC_SET_ORDER`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) Setting the order can only be done if the following restrictions are met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	- The ``state`` member of struct :c:type:`xsdfec_status <xsdfec_status>` filled by the ioctl :c:macro:`XSDFEC_GET_STATUS` indicates the SD-FEC core has not STARTED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) Add LDPC Codes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) --------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) The following steps indicate how to add LDPC codes to the SD-FEC core:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	- Use the auto-generated parameters to fill the :c:type:`struct xsdfec_ldpc_params <xsdfec_ldpc_params>` for the desired LDPC code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	- 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>`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	- Set the desired Code Id value in the structure :c:type:`struct xsdfec_ldpc_params <xsdfec_ldpc_params>`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	- Add the LPDC Code Parameters using the ioctl :c:macro:`XSDFEC_ADD_LDPC_CODE_PARAMS`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	- 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 the shared table usage so when selecting the table offsets for the next LDPC code parameters unused table areas can be selected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	- Repeat for each LDPC code parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) Adding LDPC codes can only be done if the following restrictions are met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	- The ``code`` member of :c:type:`struct xsdfec_config <xsdfec_config>` filled by the ioctl :c:macro:`XSDFEC_GET_CONFIG` indicates the SD-FEC core is configured as LDPC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	- 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
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	- The ``state`` member of struct :c:type:`xsdfec_status <xsdfec_status>` filled by the ioctl :c:macro:`XSDFEC_GET_STATUS` indicates the SD-FEC core has not started
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) Set Turbo Decode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) ----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) Configuring the Turbo decode parameters is done by using the ioctl :c:macro:`XSDFEC_SET_TURBO` using auto-generated parameters to fill the :c:type:`struct xsdfec_turbo <xsdfec_turbo>` for the desired Turbo code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) Adding Turbo decode can only be done if the following restrictions are met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	- The ``code`` member of :c:type:`struct xsdfec_config <xsdfec_config>` filled by the ioctl :c:macro:`XSDFEC_GET_CONFIG` indicates the SD-FEC core is configured as TURBO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	- The ``state`` member of struct :c:type:`xsdfec_status <xsdfec_status>` filled by the ioctl :c:macro:`XSDFEC_GET_STATUS` indicates the SD-FEC core has not STARTED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) Enable Interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) Enabling or disabling interrupts is done by using the ioctl :c:macro:`XSDFEC_SET_IRQ`. The members of the parameter passed, :c:type:`struct xsdfec_irq <xsdfec_irq>`, to the ioctl are used to set and clear different categories of interrupts. The category of interrupt is controlled as following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)   - ``enable_isr`` controls the ``tlast`` interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)   - ``enable_ecc_isr`` controls the ECC interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 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 core is configured as TURBO then the enabling ECC errors is not required.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) Bypass the SD-FEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) Bypassing the SD-FEC is done by using the ioctl :c:macro:`XSDFEC_SET_BYPASS`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) Bypassing the SD-FEC can only be done if the following restrictions are met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	- The ``state`` member of :c:type:`struct xsdfec_status <xsdfec_status>` filled by the ioctl :c:macro:`XSDFEC_GET_STATUS` indicates the SD-FEC core has not STARTED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) Start the SD-FEC core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) ---------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) Start the SD-FEC core by using the ioctl :c:macro:`XSDFEC_START_DEV`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) Get SD-FEC Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) Get the SD-FEC status of the device by using the ioctl :c:macro:`XSDFEC_GET_STATUS`, which will fill the :c:type:`struct xsdfec_status <xsdfec_status>`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) Monitor for Interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) ----------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	- 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.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	- On return Poll ``revents`` will indicate whether stats and/or state have been updated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		- ``POLLPRI`` indicates a critical error and the user should use :c:macro:`XSDFEC_GET_STATUS` and :c:macro:`XSDFEC_GET_STATS` to confirm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		- ``POLLRDNORM`` indicates a non-critical error has occurred and the user should use  :c:macro:`XSDFEC_GET_STATS` to confirm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	- Get stats by using the ioctl :c:macro:`XSDFEC_GET_STATS`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 		- For critical error the ``isr_err_count`` or ``uecc_count`` member  of :c:type:`struct xsdfec_stats <xsdfec_stats>` is non-zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 		- For non-critical errors the ``cecc_count`` member of :c:type:`struct xsdfec_stats <xsdfec_stats>` is non-zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	- Get state by using the ioctl :c:macro:`XSDFEC_GET_STATUS`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		- For a critical error the ``state`` of :c:type:`xsdfec_status <xsdfec_status>` will indicate a Reset Is Required
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	- Clear stats by using the ioctl :c:macro:`XSDFEC_CLEAR_STATS`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 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`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) Note: Using poll system call prevents busy looping using :c:macro:`XSDFEC_GET_STATS` and :c:macro:`XSDFEC_GET_STATUS`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) Stop the SD-FEC Core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) ---------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) Stop the device by using the ioctl :c:macro:`XSDFEC_STOP_DEV`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) Set the Default Configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) -----------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) Load default configuration by using the ioctl :c:macro:`XSDFEC_SET_DEFAULT_CONFIG` to restore the driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) Limitations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) Users should not duplicate SD-FEC device file handlers, for example fork() or dup() a process that has a created an SD-FEC file handler.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) Driver IOCTLs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) ==============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) .. c:macro:: XSDFEC_START_DEV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)    :doc: XSDFEC_START_DEV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) .. c:macro:: XSDFEC_STOP_DEV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)    :doc: XSDFEC_STOP_DEV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) .. c:macro:: XSDFEC_GET_STATUS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)    :doc: XSDFEC_GET_STATUS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) .. c:macro:: XSDFEC_SET_IRQ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)    :doc: XSDFEC_SET_IRQ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) .. c:macro:: XSDFEC_SET_TURBO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)    :doc: XSDFEC_SET_TURBO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) .. c:macro:: XSDFEC_ADD_LDPC_CODE_PARAMS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)    :doc: XSDFEC_ADD_LDPC_CODE_PARAMS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) .. c:macro:: XSDFEC_GET_CONFIG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)    :doc: XSDFEC_GET_CONFIG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) .. c:macro:: XSDFEC_SET_ORDER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)    :doc: XSDFEC_SET_ORDER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) .. c:macro:: XSDFEC_SET_BYPASS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)    :doc: XSDFEC_SET_BYPASS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) .. c:macro:: XSDFEC_IS_ACTIVE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)    :doc: XSDFEC_IS_ACTIVE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) .. c:macro:: XSDFEC_CLEAR_STATS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)    :doc: XSDFEC_CLEAR_STATS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) .. c:macro:: XSDFEC_GET_STATS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)    :doc: XSDFEC_GET_STATS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) .. c:macro:: XSDFEC_SET_DEFAULT_CONFIG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)    :doc: XSDFEC_SET_DEFAULT_CONFIG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) Driver Type Definitions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) =======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) .. kernel-doc:: include/uapi/misc/xilinx_sdfec.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)    :internal: