1 --- a/src/drv_mei_cpe_common.c
2 +++ b/src/drv_mei_cpe_common.c
4 /* get at first the driver configuration */
5 #include "drv_mei_cpe_config.h"
7 -#include "ifx_types.h"
8 #include "drv_mei_cpe_os.h"
9 #include "drv_mei_cpe_dbg.h"
11 --- a/src/drv_mei_cpe_linux.h
12 +++ b/src/drv_mei_cpe_linux.h
14 #include <linux/poll.h>
15 #include <linux/types.h>
17 -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
18 - #include <asm/ifx/ifx_types.h>
20 - #include <ifx_types.h>
23 #endif /* #if (MEI_DRV_IFXOS_ENABLE == 0)*/
25 #include <linux/dma-mapping.h>
26 --- a/src/drv_mei_cpe_linux.c
27 +++ b/src/drv_mei_cpe_linux.c
30 #include "drv_mei_cpe_api_atm_ptm_intern.h"
32 +#include <lantiq_soc.h>
34 /* ===================================
35 extern function declarations
36 =================================== */
37 @@ -220,6 +222,8 @@ static void MEI_NlSendMsg(IFX_char_t* pM
38 /* Local variables (LINUX) */
39 /* =================================== */
40 static IFX_uint8_t major_number = 0;
41 +static struct class *mei_class;
42 +static dev_t mei_devt;
44 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
45 MODULE_PARM(major_number, "b");
46 @@ -1479,7 +1483,11 @@ struct proc_entry {
48 proc_rd_callback_t rd;
49 proc_wr_callback_t wr;
50 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0))
51 struct file_operations ops;
53 + struct proc_ops ops;
58 @@ -1869,6 +1877,7 @@ static int mei_proc_single_open(struct i
59 static void mei_proc_entry_create(struct proc_dir_entry *parent_node,
60 struct proc_entry *proc_entry)
62 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0))
63 memset(&proc_entry->ops, 0, sizeof(struct file_operations));
64 proc_entry->ops.owner = THIS_MODULE;
66 @@ -1879,6 +1888,17 @@ static void mei_proc_entry_create(struct
67 proc_entry->ops.llseek = seq_lseek;
69 proc_entry->ops.write = proc_entry->wr;
71 + memset(&proc_entry->ops, 0, sizeof(struct proc_ops));
73 + proc_entry->ops.proc_open = mei_proc_single_open;
74 + proc_entry->ops.proc_release = single_release;
76 + proc_entry->ops.proc_read = seq_read;
77 + proc_entry->ops.proc_lseek = seq_lseek;
79 + proc_entry->ops.proc_write = proc_entry->wr;
82 proc_create_data(proc_entry->name,
84 @@ -2174,9 +2194,11 @@ static int MEI_module_init (void)
89 #if (MEI_DRV_ATM_PTM_INTERFACE_ENABLE == 1)
90 ppa_callback_set(LTQ_MEI_SHOWTIME_CHECK, (void *)ltq_mei_showtime_check);
91 #endif /* #if (MEI_DRV_ATM_PTM_INTERFACE_ENABLE == 1) */
96 @@ -2304,6 +2326,10 @@ static void MEI_module_exit (void)
99 unregister_chrdev ( major_number , DRV_MEI_NAME );
100 + device_destroy(mei_class, mei_devt);
102 + class_destroy(mei_class);
107 @@ -2388,9 +2414,11 @@ static void MEI_module_exit (void)
108 ("MEI_DRV: Chipset Basic Exit failed" MEI_DRV_CRLF));
112 #if (MEI_DRV_ATM_PTM_INTERFACE_ENABLE == 1)
113 ppa_callback_set(LTQ_MEI_SHOWTIME_CHECK, (void *)NULL);
114 #endif /* #if (MEI_DRV_ATM_PTM_INTERFACE_ENABLE == 1) */
117 #if (MEI_SUPPORT_DEBUG_LOGGER == 1)
119 @@ -2514,6 +2542,10 @@ static int MEI_InitModuleRegCharDev(cons
120 ("Using major number %d" MEI_DRV_CRLF, major_number));
123 + mei_class = class_create(THIS_MODULE, devName);
124 + mei_devt = MKDEV(major_number, 0);
125 + device_create(mei_class, NULL, mei_devt, NULL, "%s/%i", devName, 0);
128 #endif /* CONFIG_DEVFS_FS */
130 @@ -2563,21 +2595,32 @@ static int MEI_InitModuleBasics(void)
133 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
135 +#define PMU_DFE BIT(9)
137 static int MEI_SysClkEnable(struct clk *clk)
144 + ltq_pmu_enable(PMU_DFE);
150 static int MEI_SysClkDisable(struct clk *clk)
158 + ltq_pmu_disable(PMU_DFE);
163 @@ -2905,11 +2948,15 @@ IFX_int32_t MEI_IoctlInitDevice(
164 pMeiDev->eModePoll = e_MEI_DEV_ACCESS_MODE_IRQ;
165 pMeiDev->intMask = ME_ARC2ME_INTERRUPT_UNMASK_ALL;
168 + virq = (IFX_uint32_t)pInitDev->usedIRQ;
170 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
171 virq = (IFX_uint32_t)pInitDev->usedIRQ;
173 virq = irq_create_mapping(NULL, (IFX_uint32_t)pInitDev->usedIRQ);
177 pTmpXCntrl = MEI_VrxXDevToIrqListAdd(
178 MEI_DRV_LINENUM_GET(pMeiDev),
179 --- a/src/drv_mei_cpe_api_atm_ptm_intern.c
180 +++ b/src/drv_mei_cpe_api_atm_ptm_intern.c
181 @@ -147,6 +147,7 @@ IFX_int32_t MEI_InternalXtmSwhowtimeExit
186 IFX_int32_t MEI_InternalTcRequest(
187 MEI_DYN_CNTRL_T *pMeiDynCntrl,
188 MEI_TC_Request_t *pArgTcRequest)
189 @@ -232,6 +233,7 @@ IFX_int32_t MEI_InternalTcReset(
196 Function that is used by the PP subsystem to get some showtime relevant data
197 @@ -311,10 +313,57 @@ int ifx_mei_atm_led_blink(void)
201 +#if MEI_MAX_DFE_CHAN_DEVICES > 1
202 +#error "Compat functions do not support MEI_MAX_DFE_CHAN_DEVICES > 1 yet"
204 +int (*ifx_mei_atm_showtime_enter)(struct port_cell_info *, void *) = NULL;
205 +int (*ifx_mei_atm_showtime_exit)(void) = NULL;
207 +int ltq_ifx_mei_atm_showtime_enter_compat(IFX_uint8_t dslLineNum,
208 + struct port_cell_info *cellInfo,
210 + if (ifx_mei_atm_showtime_enter)
211 + return ifx_mei_atm_showtime_enter(cellInfo, xdata);
213 + return -e_MEI_ERR_OP_FAILED;
216 +int ltq_ifx_mei_atm_showtime_exit_compat(IFX_uint8_t dslLineNum) {
217 + if (ifx_mei_atm_showtime_exit)
218 + return ifx_mei_atm_showtime_exit();
220 + return -e_MEI_ERR_OP_FAILED;
223 +void* ppa_callback_get(e_ltq_mei_cb_type type) {
225 + case LTQ_MEI_SHOWTIME_ENTER:
226 + return <q_ifx_mei_atm_showtime_enter_compat;
227 + case LTQ_MEI_SHOWTIME_EXIT:
228 + return <q_ifx_mei_atm_showtime_exit_compat;
235 +int ifx_mei_atm_showtime_check(int *is_showtime,
236 + struct port_cell_info *port_cell,
237 + void **xdata_addr) {
238 + return ltq_mei_showtime_check(0, is_showtime, port_cell, xdata_addr);
241 +EXPORT_SYMBOL(ifx_mei_atm_showtime_enter);
242 +EXPORT_SYMBOL(ifx_mei_atm_showtime_exit);
243 +EXPORT_SYMBOL(ifx_mei_atm_showtime_check);
246 EXPORT_SYMBOL (MEI_InternalXtmSwhowtimeEntrySignal);
247 EXPORT_SYMBOL (MEI_InternalXtmSwhowtimeExitSignal);
249 EXPORT_SYMBOL (MEI_InternalTcRequest);
250 EXPORT_SYMBOL (MEI_InternalTcReset);
252 EXPORT_SYMBOL(ifx_mei_atm_led_blink);
254 #endif /* #if (MEI_EXPORT_INTERNAL_API == 1) && (MEI_DRV_ATM_PTM_INTERFACE_ENABLE == 1) */
255 --- a/src/drv_mei_cpe_api_atm_ptm_intern.h
256 +++ b/src/drv_mei_cpe_api_atm_ptm_intern.h
259 #include "drv_mei_cpe_config.h"
260 #include "drv_mei_cpe_interface.h"
261 -#include <net/ppa_stack_al.h>
263 #if (MEI_EXPORT_INTERNAL_API == 1) && (MEI_DRV_ATM_PTM_INTERFACE_ENABLE == 1)
265 @@ -59,8 +58,21 @@ extern IFX_int32_t MEI_InternalTcReset(
266 MEI_DYN_CNTRL_T *pMeiDynCntrl,
267 MEI_TC_Reset_t *pArgTcReset);
270 +#include <lantiq_atm.h>
272 + LTQ_MEI_SHOWTIME_ENTER,
273 + LTQ_MEI_SHOWTIME_EXIT
274 +} e_ltq_mei_cb_type;
276 +typedef void (*ltq_mei_atm_showtime_enter_t)(IFX_uint8_t, struct port_cell_info *, void *);
277 +typedef void (*ltq_mei_atm_showtime_exit_t)(IFX_uint8_t);
279 +void* ppa_callback_get(e_ltq_mei_cb_type type);
281 extern int ppa_callback_set(e_ltq_mei_cb_type type, void *func);
282 extern void* ppa_callback_get(e_ltq_mei_cb_type type);
285 int ltq_mei_showtime_check(
286 const unsigned char line_idx,
287 --- a/src/drv_mei_cpe_device_vrx.c
288 +++ b/src/drv_mei_cpe_device_vrx.c
290 #include "drv_mei_cpe_api.h"
291 #include "drv_mei_cpe_mei_vrx.h"
294 -# if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
295 -# if (MEI_SUPPORT_DEVICE_VR10_320 != 1)
296 -# include "ifx_pcie.h"
298 -# include "../drivers/net/ethernet/lantiq/lantiq_pcie.h"
301 -# include "lantiq_pcie.h"
303 -#endif /* #if defined(LINUX)*/
305 IFX_int32_t MEI_GPIntProcess(MEI_MeiRegVal_t processInt, MEI_DEV_T *pMeiDev)
307 @@ -86,6 +75,7 @@ IFX_int32_t MEI_GetChipInfo(MEI_DEV_T *p
309 IFX_int32_t MEI_VR10_PcieEntitiesCheck(IFX_uint8_t nEntityNum)
312 IFX_uint32_t pcie_entitiesNum;
314 /* get information from pcie driver */
315 @@ -110,6 +100,9 @@ IFX_int32_t MEI_VR10_PcieEntitiesCheck(I
325 @@ -124,6 +117,7 @@ IFX_int32_t MEI_VR10_PcieEntitiesCheck(I
327 IFX_int32_t MEI_VR10_PcieEntityInit(MEI_MEI_DRV_CNTRL_T *pMeiDrvCntrl)
330 IFX_uint8_t entityNum;
331 #if (MEI_SUPPORT_DEVICE_VR10_320 != 1)
332 ifx_pcie_ep_dev_t MEI_pcie_ep_dev;
333 @@ -156,6 +150,9 @@ IFX_int32_t MEI_VR10_PcieEntityInit(MEI_
334 pMeiDrvCntrl->MEI_pcie_irq = 99;
343 @@ -170,6 +167,7 @@ IFX_int32_t MEI_VR10_PcieEntityInit(MEI_
345 IFX_int32_t MEI_VR10_PcieEntityFree(IFX_uint8_t entityNum)
348 #if (MEI_SUPPORT_DEVICE_VR10_320 != 1)
349 if (ifx_pcie_ep_dev_info_release(entityNum))
351 @@ -183,6 +181,9 @@ IFX_int32_t MEI_VR10_PcieEntityFree(IFX_
361 @@ -197,6 +198,7 @@ IFX_int32_t MEI_VR10_PcieEntityFree(IFX_
363 IFX_int32_t MEI_VR10_InternalInitDevice(MEI_DYN_CNTRL_T *pMeiDynCntrl)
367 IOCTL_MEI_devInit_t InitDev;
368 MEI_DEV_T *pMeiDev = pMeiDynCntrl->pMeiDev;
369 @@ -221,6 +223,9 @@ IFX_int32_t MEI_VR10_InternalInitDevice(
370 *MEI_GPIO_U32REG(GPIO_P0_ALSEL1) &= ~((1 << 0) | (1 << 3) | (1 << 8));
378 IFX_int32_t MEI_PLL_ConfigInit(MEI_DEV_T *pMeiDev)
379 --- a/src/drv_mei_cpe_download_vrx.c
380 +++ b/src/drv_mei_cpe_download_vrx.c
381 @@ -3281,12 +3281,14 @@ IFX_int32_t MEI_DEV_IoctlFirmwareDownloa
386 if (MEI_InternalTcReset(pMeiDynCntrl, &tc_reset) != 0)
388 PRN_ERR_USR_NL( MEI_DRV, MEI_DRV_PRN_LEVEL_WRN,
389 ("MEI_DRV[%02d]: Could not perform reset of TC-Layer!"
390 MEI_DRV_CRLF, MEI_DRV_LINENUM_GET(pMeiDev)));
396 --- a/src/drv_mei_cpe_linux_proc_config.c
397 +++ b/src/drv_mei_cpe_linux_proc_config.c
398 @@ -1039,6 +1039,7 @@ static int mei_proc_single_open(struct i
399 return single_open(file, mei_seq_single_show, PDE_DATA(inode));
402 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0))
403 static struct file_operations proc_ops = {
404 .owner = THIS_MODULE,
405 .open = mei_proc_single_open,
406 @@ -1047,6 +1048,15 @@ static struct file_operations proc_ops =
408 .write = MEI_ProcWriteConfig
411 +static struct proc_ops proc_ops = {
412 + .proc_open = mei_proc_single_open,
413 + .proc_release = single_release,
414 + .proc_read = seq_read,
415 + .proc_lseek = seq_lseek,
416 + .proc_write = MEI_ProcWriteConfig
421 Create an read/write proc entry for configuration.