misc: xilinx_sdfec: Add stats & status ioctls

SD-FEC statistic data are:
- count of data interface errors (isr_err_count)
- count of Correctable ECC errors (cecc_count)
- count of Uncorrectable ECC errors (uecc_count)

Add support:
1. clear stats ioctl callback which clears collected
statistic data,
2. get stats ioctl callback which reads a collected
statistic data,
3. set default configuration ioctl callback,
4. start ioctl callback enables SD-FEC HW,
5. stop ioctl callback disables SD-FEC HW.

In a failed state driver enables the following ioctls:
- get status
- get statistics
- clear stats
- set default SD-FEC device configuration

Tested-by: Santhosh Dyavanapally <SDYAVANA@xilinx.com>
Tested by: Punnaiah Choudary Kalluri <punnaia@xilinx.com>
Tested-by: Derek Kiernan <derek.kiernan@xilinx.com>
Tested-by: Dragan Cvetic <dragan.cvetic@xilinx.com>
Signed-off-by: Derek Kiernan <derek.kiernan@xilinx.com>
Signed-off-by: Dragan Cvetic <dragan.cvetic@xilinx.com>
Link: https://lore.kernel.org/r/1564216438-322406-7-git-send-email-dragan.cvetic@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Dragan Cvetic
2019-07-27 09:33:56 +01:00
committed by Greg Kroah-Hartman
parent cc538f609d
commit 6bd6a690c2
2 changed files with 200 additions and 0 deletions

View File

@@ -233,6 +233,21 @@ struct xsdfec_config {
__s8 code_wr_protect;
};
/**
* struct xsdfec_stats - Stats retrived by ioctl XSDFEC_GET_STATS. Used
* to buffer atomic_t variables from struct
* xsdfec_dev. Counts are accumulated until
* the user clears them.
* @isr_err_count: Count of ISR errors
* @cecc_count: Count of Correctable ECC errors (SBE)
* @uecc_count: Count of Uncorrectable ECC errors (MBE)
*/
struct xsdfec_stats {
__u32 isr_err_count;
__u32 cecc_count;
__u32 uecc_count;
};
/**
* struct xsdfec_ldpc_param_table_sizes - Used to store sizes of SD-FEC table
* entries for an individual LPDC code
@@ -251,6 +266,32 @@ struct xsdfec_ldpc_param_table_sizes {
* XSDFEC IOCTL List
*/
#define XSDFEC_MAGIC 'f'
/**
* DOC: XSDFEC_START_DEV
*
* @Description
*
* ioctl to start SD-FEC core
*
* This fails if the XSDFEC_SET_ORDER ioctl has not been previously called
*/
#define XSDFEC_START_DEV _IO(XSDFEC_MAGIC, 0)
/**
* DOC: XSDFEC_STOP_DEV
*
* @Description
*
* ioctl to stop the SD-FEC core
*/
#define XSDFEC_STOP_DEV _IO(XSDFEC_MAGIC, 1)
/**
* DOC: XSDFEC_GET_STATUS
*
* @Description
*
* ioctl that returns status of SD-FEC core
*/
#define XSDFEC_GET_STATUS _IOR(XSDFEC_MAGIC, 2, struct xsdfec_status)
/**
* DOC: XSDFEC_SET_IRQ
* @Parameters
@@ -370,4 +411,38 @@ struct xsdfec_ldpc_param_table_sizes {
* ioctl that determines if SD-FEC is processing data
*/
#define XSDFEC_IS_ACTIVE _IOR(XSDFEC_MAGIC, 10, bool)
/**
* DOC: XSDFEC_CLEAR_STATS
*
* @Description
*
* ioctl that clears error stats collected during interrupts
*/
#define XSDFEC_CLEAR_STATS _IO(XSDFEC_MAGIC, 11)
/**
* DOC: XSDFEC_GET_STATS
* @Parameters
*
* @struct xsdfec_stats *
* Pointer to the &struct xsdfec_stats that will contain the updated stats
* values
*
* @Description
*
* ioctl that returns SD-FEC core stats
*
* This can only be used when the driver is in the XSDFEC_STOPPED state
*/
#define XSDFEC_GET_STATS _IOR(XSDFEC_MAGIC, 12, struct xsdfec_stats)
/**
* DOC: XSDFEC_SET_DEFAULT_CONFIG
*
* @Description
*
* ioctl that returns SD-FEC core to default config, use after a reset
*
* This can only be used when the driver is in the XSDFEC_STOPPED state
*/
#define XSDFEC_SET_DEFAULT_CONFIG _IO(XSDFEC_MAGIC, 13)
#endif /* __XILINX_SDFEC_H__ */