misc: xilinx_sdfec: Add ability to configure turbo

Add the capability to configure and retrieve turbo mode
via the ioctls XSDFEC_SET_TURBO and XSDFEC_GET_TURBO.
Add char device interface per DT node present and support
file operations:
- open(),
- close(),
- unlocked_ioctl(),
- compat_ioctl().

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-3-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:52 +01:00
committed by Greg Kroah-Hartman
parent 6d54e45568
commit 6f86ed8201
2 changed files with 177 additions and 0 deletions

View File

@@ -40,6 +40,22 @@ enum xsdfec_order {
XSDFEC_OUT_OF_ORDER,
};
/**
* enum xsdfec_turbo_alg - Turbo Algorithm Type.
* @XSDFEC_MAX_SCALE: Max Log-Map algorithm with extrinsic scaling. When
* scaling is set to this is equivalent to the Max Log-Map
* algorithm.
* @XSDFEC_MAX_STAR: Log-Map algorithm.
* @XSDFEC_TURBO_ALG_MAX: Used to indicate out of bound Turbo algorithms.
*
* This enum specifies which Turbo Decode algorithm is in use.
*/
enum xsdfec_turbo_alg {
XSDFEC_MAX_SCALE = 0,
XSDFEC_MAX_STAR,
XSDFEC_TURBO_ALG_MAX,
};
/**
* enum xsdfec_state - State.
* @XSDFEC_INIT: Driver is initialized.
@@ -97,6 +113,29 @@ enum xsdfec_axis_word_include {
XSDFEC_AXIS_WORDS_INCLUDE_MAX,
};
/**
* struct xsdfec_turbo - User data for Turbo codes.
* @alg: Specifies which Turbo decode algorithm to use
* @scale: Specifies the extrinsic scaling to apply when the Max Scale algorithm
* has been selected
*
* Turbo code structure to communicate parameters to XSDFEC driver.
*/
struct xsdfec_turbo {
__u32 alg;
__u8 scale;
};
/**
* struct xsdfec_status - Status of SD-FEC core.
* @state: State of the SD-FEC core
* @activity: Describes if the SD-FEC instance is Active
*/
struct xsdfec_status {
__u32 state;
__s8 activity;
};
/**
* struct xsdfec_irq - Enabling or Disabling Interrupts.
* @enable_isr: If true enables the ISR
@@ -135,4 +174,32 @@ struct xsdfec_config {
* XSDFEC IOCTL List
*/
#define XSDFEC_MAGIC 'f'
/**
* DOC: XSDFEC_SET_TURBO
* @Parameters
*
* @struct xsdfec_turbo *
* Pointer to the &struct xsdfec_turbo that contains the Turbo decode
* settings for the SD-FEC core
*
* @Description
*
* ioctl that sets the SD-FEC Turbo parameter values
*
* 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)
/**
* DOC: XSDFEC_GET_TURBO
* @Parameters
*
* @struct xsdfec_turbo *
* Pointer to the &struct xsdfec_turbo that contains the current Turbo
* decode settings of the SD-FEC Block
*
* @Description
*
* ioctl that returns SD-FEC turbo param values
*/
#define XSDFEC_GET_TURBO _IOR(XSDFEC_MAGIC, 7, struct xsdfec_turbo)
#endif /* __XILINX_SDFEC_H__ */