1/****************************************************************************
2 ****************************************************************************
3 ***
4 ***   This header was automatically generated from a Linux kernel header
5 ***   of the same name, to make information necessary for userspace to
6 ***   call into the kernel available to libc.  It contains only constants,
7 ***   structures, and macros generated from the original header, and thus,
8 ***   contains no copyrightable information.
9 ***
10 ***   To edit the content of this header, modify the corresponding
11 ***   source file (e.g. under external/kernel-headers/original/) then
12 ***   run bionic/libc/kernel/tools/update_all.py
13 ***
14 ***   Any manual change here will be lost the next time this script will
15 ***   be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef __XILINX_SDFEC_H__
20#define __XILINX_SDFEC_H__
21#include <linux/types.h>
22#define XSDFEC_LDPC_SC_TABLE_ADDR_BASE (0x10000)
23#define XSDFEC_LDPC_SC_TABLE_ADDR_HIGH (0x10400)
24#define XSDFEC_LDPC_LA_TABLE_ADDR_BASE (0x18000)
25#define XSDFEC_LDPC_LA_TABLE_ADDR_HIGH (0x19000)
26#define XSDFEC_LDPC_QC_TABLE_ADDR_BASE (0x20000)
27#define XSDFEC_LDPC_QC_TABLE_ADDR_HIGH (0x28000)
28#define XSDFEC_SC_TABLE_DEPTH (XSDFEC_LDPC_SC_TABLE_ADDR_HIGH - XSDFEC_LDPC_SC_TABLE_ADDR_BASE)
29#define XSDFEC_LA_TABLE_DEPTH (XSDFEC_LDPC_LA_TABLE_ADDR_HIGH - XSDFEC_LDPC_LA_TABLE_ADDR_BASE)
30#define XSDFEC_QC_TABLE_DEPTH (XSDFEC_LDPC_QC_TABLE_ADDR_HIGH - XSDFEC_LDPC_QC_TABLE_ADDR_BASE)
31enum xsdfec_code {
32  XSDFEC_TURBO_CODE = 0,
33  XSDFEC_LDPC_CODE,
34};
35enum xsdfec_order {
36  XSDFEC_MAINTAIN_ORDER = 0,
37  XSDFEC_OUT_OF_ORDER,
38};
39enum xsdfec_turbo_alg {
40  XSDFEC_MAX_SCALE = 0,
41  XSDFEC_MAX_STAR,
42  XSDFEC_TURBO_ALG_MAX,
43};
44enum xsdfec_state {
45  XSDFEC_INIT = 0,
46  XSDFEC_STARTED,
47  XSDFEC_STOPPED,
48  XSDFEC_NEEDS_RESET,
49  XSDFEC_PL_RECONFIGURE,
50};
51enum xsdfec_axis_width {
52  XSDFEC_1x128b = 1,
53  XSDFEC_2x128b = 2,
54  XSDFEC_4x128b = 4,
55};
56enum xsdfec_axis_word_include {
57  XSDFEC_FIXED_VALUE = 0,
58  XSDFEC_IN_BLOCK,
59  XSDFEC_PER_AXI_TRANSACTION,
60  XSDFEC_AXIS_WORDS_INCLUDE_MAX,
61};
62struct xsdfec_turbo {
63  __u32 alg;
64  __u8 scale;
65};
66struct xsdfec_ldpc_params {
67  __u32 n;
68  __u32 k;
69  __u32 psize;
70  __u32 nlayers;
71  __u32 nqc;
72  __u32 nmqc;
73  __u32 nm;
74  __u32 norm_type;
75  __u32 no_packing;
76  __u32 special_qc;
77  __u32 no_final_parity;
78  __u32 max_schedule;
79  __u32 sc_off;
80  __u32 la_off;
81  __u32 qc_off;
82  __u32 * sc_table;
83  __u32 * la_table;
84  __u32 * qc_table;
85  __u16 code_id;
86};
87struct xsdfec_status {
88  __u32 state;
89  __s8 activity;
90};
91struct xsdfec_irq {
92  __s8 enable_isr;
93  __s8 enable_ecc_isr;
94};
95struct xsdfec_config {
96  __u32 code;
97  __u32 order;
98  __u32 din_width;
99  __u32 din_word_include;
100  __u32 dout_width;
101  __u32 dout_word_include;
102  struct xsdfec_irq irq;
103  __s8 bypass;
104  __s8 code_wr_protect;
105};
106struct xsdfec_stats {
107  __u32 isr_err_count;
108  __u32 cecc_count;
109  __u32 uecc_count;
110};
111struct xsdfec_ldpc_param_table_sizes {
112  __u32 sc_size;
113  __u32 la_size;
114  __u32 qc_size;
115};
116#define XSDFEC_MAGIC 'f'
117#define XSDFEC_START_DEV _IO(XSDFEC_MAGIC, 0)
118#define XSDFEC_STOP_DEV _IO(XSDFEC_MAGIC, 1)
119#define XSDFEC_GET_STATUS _IOR(XSDFEC_MAGIC, 2, struct xsdfec_status)
120#define XSDFEC_SET_IRQ _IOW(XSDFEC_MAGIC, 3, struct xsdfec_irq)
121#define XSDFEC_SET_TURBO _IOW(XSDFEC_MAGIC, 4, struct xsdfec_turbo)
122#define XSDFEC_ADD_LDPC_CODE_PARAMS _IOW(XSDFEC_MAGIC, 5, struct xsdfec_ldpc_params)
123#define XSDFEC_GET_CONFIG _IOR(XSDFEC_MAGIC, 6, struct xsdfec_config)
124#define XSDFEC_GET_TURBO _IOR(XSDFEC_MAGIC, 7, struct xsdfec_turbo)
125#define XSDFEC_SET_ORDER _IOW(XSDFEC_MAGIC, 8, unsigned long)
126#define XSDFEC_SET_BYPASS _IOW(XSDFEC_MAGIC, 9, bool)
127#define XSDFEC_IS_ACTIVE _IOR(XSDFEC_MAGIC, 10, bool)
128#define XSDFEC_CLEAR_STATS _IO(XSDFEC_MAGIC, 11)
129#define XSDFEC_GET_STATS _IOR(XSDFEC_MAGIC, 12, struct xsdfec_stats)
130#define XSDFEC_SET_DEFAULT_CONFIG _IO(XSDFEC_MAGIC, 13)
131#endif
132