lantiq: Fix compile of lantiq components with kernel 6.1
authorHauke Mehrtens <hauke@hauke-m.de>
Fri, 2 Jun 2023 20:58:51 +0000 (22:58 +0200)
committerMartin Schiller <ms@dev.tdt.de>
Wed, 15 May 2024 06:54:58 +0000 (08:54 +0200)
This makes the components used on the lantiq SoCs compile with kernel
6.1.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
[also fix ifxmips_ptm_adsl.c]
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
package/kernel/lantiq/ltq-adsl/patches/201-fix-compilation-warning-fallthrough.patch
package/kernel/lantiq/ltq-adsl/patches/202-g997_danube-dynamically-allocate-hlogdata.patch
package/kernel/lantiq/ltq-adsl/patches/203-g997_danube-fix-compilation-warning.patch
package/kernel/lantiq/ltq-adsl/patches/400-kernel-6.1.patch [new file with mode: 0644]
package/kernel/lantiq/ltq-ptm/patches/101-fix-more-compilation-warning-debugfs.patch
package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
package/kernel/lantiq/ltq-vdsl-vr9-mei/patches/300-fix-simple-compilation-warning.patch
package/kernel/lantiq/ltq-vdsl-vr9-mei/patches/400-kernel-6.1.patch [new file with mode: 0644]
package/kernel/lantiq/ltq-vmmc/patches/602-remove-ABS.patch [new file with mode: 0644]
package/kernel/lantiq/ltq-vmmc/patches/603-fix-signature.patch [new file with mode: 0644]

index dfaf29f44981f5c1c4b4c15454c574794d130753..17dfd0f25d5019fe3c9f5819c81264f7f65c5986 100644 (file)
@@ -25,7 +25,7 @@
        nErrCode = DSL_DRV_PM_HistoryDelete(pContext, EpData.pHistShowtime );
 --- a/src/device/drv_dsl_cpe_device_danube.c
 +++ b/src/device/drv_dsl_cpe_device_danube.c
-@@ -3193,7 +3193,7 @@ DSL_Error_t DSL_DRV_DEV_AutobootHandleTraining(
+@@ -3193,7 +3193,7 @@ DSL_Error_t DSL_DRV_DEV_AutobootHandleTr
                       DSL_DEV_NUM(pContext)));
                 }
  #endif /* INCLUDE_DSL_DELT*/
index c3b1047a2ab427db43cc6c9b97c3e680ec021ee8..1dd0f21693b0e79613c9adcdffdc60ccc20300e6 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/g997/drv_dsl_cpe_api_g997_danube.c
 +++ b/src/g997/drv_dsl_cpe_api_g997_danube.c
-@@ -1984,41 +1984,53 @@ DSL_Error_t DSL_DRV_DEV_G997_DeltHlogGet(
+@@ -1984,41 +1984,53 @@ DSL_Error_t DSL_DRV_DEV_G997_DeltHlogGet
        {
           if (nDirection == DSL_DOWNSTREAM)
           {
index c6a0e70f1f922a0ba50b33c7a7bcea5654d5bbcb..b86ecf84a47affa130760b658f2d779cecd83e8c 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/g997/drv_dsl_cpe_api_g997_danube.c
 +++ b/src/g997/drv_dsl_cpe_api_g997_danube.c
-@@ -2512,6 +2524,7 @@ DSL_Error_t DSL_DRV_DEV_G997_PowerManagementStateForcedTrigger(
+@@ -2524,6 +2524,7 @@ DSL_Error_t DSL_DRV_DEV_G997_PowerManage
                    else
                    {
                       /* read L3 request failure reason */
@@ -8,7 +8,7 @@
                       nErrCode = DSL_DRV_DANUBE_CmvRead(pContext, DSL_CMV_GROUP_STAT,
                          DSL_CMV_ADDRESS_STAT_L3_FAILURE_REASON, 0, 1, &nVal);
                       DSL_DEBUG(DSL_DBG_MSG,
-@@ -2525,11 +2538,13 @@ DSL_Error_t DSL_DRV_DEV_G997_PowerManagementStateForcedTrigger(
+@@ -2537,11 +2538,13 @@ DSL_Error_t DSL_DRV_DEV_G997_PowerManage
                          nErrCode = DSL_ERR_MSG_EXCHANGE;
                          break;
                       }
diff --git a/package/kernel/lantiq/ltq-adsl/patches/400-kernel-6.1.patch b/package/kernel/lantiq/ltq-adsl/patches/400-kernel-6.1.patch
new file mode 100644 (file)
index 0000000..2179f35
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/src/common/drv_dsl_cpe_os_linux.c
++++ b/src/common/drv_dsl_cpe_os_linux.c
+@@ -556,7 +556,11 @@ static int DSL_DRV_KernelThreadStartup(v
+    retVal = pThrCntrl->pThrFct(&pThrCntrl->thrParams);
+    pThrCntrl->thrParams.bRunning = 0;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,17,0))
+    complete_and_exit(&pThrCntrl->thrCompletion, (long)retVal);
++#else
++   kthread_complete_and_exit(&pThrCntrl->thrCompletion, (long)retVal);
++#endif
+    DSL_DEBUG( DSL_DBG_MSG,
+       (DSL_NULL, "EXIT - Kernel Thread Startup <%s>" DSL_DRV_CRLF,
index f854662a07840a8439f18c6b9d1e4385958cd6e0..55551ad91dcc38c9f474cb6d3a2dca0959c86139 100644 (file)
@@ -1,6 +1,6 @@
 --- a/ifxmips_ptm_adsl.c
 +++ b/ifxmips_ptm_adsl.c
-@@ -180,7 +180,7 @@ static int proc_read_version(char *, char **, off_t, int, int *, void *);
+@@ -180,7 +180,7 @@ static int proc_read_version(char *, cha
  static int proc_read_wanmib(char *, char **, off_t, int, int *, void *);
  static int proc_write_wanmib(struct file *, const char *, unsigned long, void *);
  #endif
@@ -9,7 +9,7 @@
    static int proc_read_genconf(char *, char **, off_t, int, int *, void *);
  #endif
  #if defined(ENABLE_DBG_PROC) && ENABLE_DBG_PROC
-@@ -191,8 +191,8 @@ static int proc_write_wanmib(struct file *, const char *, unsigned long, void *)
+@@ -191,8 +191,8 @@ static int proc_write_wanmib(struct file
  /*
   *  Proc Help Functions
   */
@@ -19,7 +19,7 @@
    static INLINE int strincmp(const char *, const char *, int);
  #endif
  static INLINE int ifx_ptm_version(char *);
-@@ -1159,8 +1159,6 @@ static int proc_write_dbg(struct file *file, const char *buf, unsigned long coun
+@@ -1159,8 +1159,6 @@ static int proc_write_dbg(struct file *f
      return count;
  }
  
@@ -28,7 +28,7 @@
  static INLINE int stricmp(const char *p1, const char *p2)
  {
      int c1, c2;
-@@ -1178,7 +1176,6 @@ static INLINE int stricmp(const char *p1, const char *p2)
+@@ -1178,7 +1176,6 @@ static INLINE int stricmp(const char *p1
      return *p1 - *p2;
  }
  
index 5ee966c014175a1cedcf4618b07ae657152bdf3f..91cc97617f45305d22c0f3d3f068c78da6c8b69a 100644 (file)
@@ -277,6 +277,8 @@ static int g_showtime = 0;
 
 static void ptm_setup(struct net_device *dev, int ndev)
 {
+    u8 addr[ETH_ALEN];
+
 #if defined(CONFIG_IFXMIPS_DSL_CPE_MEI) || defined(CONFIG_IFXMIPS_DSL_CPE_MEI_MODULE)
     netif_carrier_off(dev);
 #endif
@@ -285,15 +287,20 @@ static void ptm_setup(struct net_device *dev, int ndev)
     dev->netdev_ops      = &g_ptm_netdev_ops;
     /* Allow up to 1508 bytes, for RFC4638 */
     dev->max_mtu         = ETH_DATA_LEN + 8;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,19,0))
     netif_napi_add(dev, &g_ptm_priv_data.itf[ndev].napi, ptm_napi_poll, 25);
+#else
+    netif_napi_add_weight(dev, &g_ptm_priv_data.itf[ndev].napi, ptm_napi_poll, 25);
+#endif
     dev->watchdog_timeo  = ETH_WATCHDOG_TIMEOUT;
 
-    dev->dev_addr[0] = 0x00;
-    dev->dev_addr[1] = 0x20;
-    dev->dev_addr[2] = 0xda;
-    dev->dev_addr[3] = 0x86;
-    dev->dev_addr[4] = 0x23;
-    dev->dev_addr[5] = 0x75 + ndev;
+    addr[0] = 0x00;
+    addr[1] = 0x20;
+    addr[2] = 0xda;
+    addr[3] = 0x86;
+    addr[4] = 0x23;
+    addr[5] = 0x75 + ndev;
+    eth_hw_addr_set(dev, addr);
 }
 
 static struct net_device_stats *ptm_get_stats(struct net_device *dev)
index dfb57787b9685b9280b89a64de7a71cd308c44b5..54d88a21eca3689e788b9468b8f35957f0478b81 100644 (file)
@@ -153,7 +153,11 @@ static void ptm_setup(struct net_device *dev, int ndev)
     dev->netdev_ops      = &g_ptm_netdev_ops;
     /* Allow up to 1508 bytes, for RFC4638 */
     dev->max_mtu         = ETH_DATA_LEN + 8;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,19,0))
     netif_napi_add(dev, &g_ptm_priv_data.itf[ndev].napi, ptm_napi_poll, 16);
+#else
+    netif_napi_add_weight(dev, &g_ptm_priv_data.itf[ndev].napi, ptm_napi_poll, 16);
+#endif
     dev->watchdog_timeo  = ETH_WATCHDOG_TIMEOUT;
 
     addr[0] = 0x00;
index e9f1931227f824d52ff17c787c457dedbf46f42c..c1d3aa8b411ba29c59fb09b7b71410df53c1c563 100644 (file)
@@ -9,7 +9,7 @@
  #endif
  
  /* add MEI CPE debug/printout part */
-@@ -1718,8 +1718,8 @@ static void MEI_MeminfoProcPerDevGet(struct seq_file *s)
+@@ -1718,8 +1718,8 @@ static void MEI_MeminfoProcPerDevGet(str
                       ", CRC = 0x%08X"
  #endif
                       MEI_DRV_CRLF,
@@ -22,7 +22,7 @@
  #if (MEI_SUPPORT_OPTIMIZED_FW_DL == 1)
 --- a/src/drv_mei_cpe_download_vrx.c
 +++ b/src/drv_mei_cpe_download_vrx.c
-@@ -3139,9 +3139,9 @@ IFX_int32_t MEI_DEV_IoctlFirmwareDownload(
+@@ -3139,9 +3139,9 @@ IFX_int32_t MEI_DEV_IoctlFirmwareDownloa
  {
     IFX_int32_t ret = 0;
     MEI_DEV_T *pMeiDev = pMeiDynCntrl->pMeiDev;
diff --git a/package/kernel/lantiq/ltq-vdsl-vr9-mei/patches/400-kernel-6.1.patch b/package/kernel/lantiq/ltq-vdsl-vr9-mei/patches/400-kernel-6.1.patch
new file mode 100644 (file)
index 0000000..a1efdb7
--- /dev/null
@@ -0,0 +1,28 @@
+--- a/src/drv_mei_cpe_linux.c
++++ b/src/drv_mei_cpe_linux.c
+@@ -1873,7 +1873,11 @@ static int mei_seq_single_show(struct se
+ static int mei_proc_single_open(struct inode *inode, struct file *file)
+ {
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,17,0))
+    return single_open(file, mei_seq_single_show, PDE_DATA(inode));
++#else
++   return single_open(file, mei_seq_single_show, pde_data(inode));
++#endif
+ }
+ static void mei_proc_entry_create(struct proc_dir_entry *parent_node,
+--- a/src/drv_mei_cpe_linux_proc_config.c
++++ b/src/drv_mei_cpe_linux_proc_config.c
+@@ -1036,7 +1036,11 @@ static int mei_seq_single_show(struct se
+ static int mei_proc_single_open(struct inode *inode, struct file *file)
+ {
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,17,0))
+       return single_open(file, mei_seq_single_show, PDE_DATA(inode));
++#else
++      return single_open(file, mei_seq_single_show, pde_data(inode));
++#endif
+ }
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0))
diff --git a/package/kernel/lantiq/ltq-vmmc/patches/602-remove-ABS.patch b/package/kernel/lantiq/ltq-vmmc/patches/602-remove-ABS.patch
new file mode 100644 (file)
index 0000000..e09989b
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/src/drv_vmmc_api.h
++++ b/src/drv_vmmc_api.h
+@@ -149,17 +149,6 @@ DECLARE_TRACE_GROUP(VMMC);
+       return code;                                                         \
+    }while(0)
+-/*******************************************************************************
+-Description:
+-   always returns the absolute value of argument given
+-Arguments:
+-   x  - argument
+-Return:
+-   absolute value of x
+-*******************************************************************************/
+-/* define ABS */
+-#define ABS(x) (((x) < 0) ? -(x) : (x))
+-
+ /* regular format macros */
+ /*******************************************************************************
+ Description:
diff --git a/package/kernel/lantiq/ltq-vmmc/patches/603-fix-signature.patch b/package/kernel/lantiq/ltq-vmmc/patches/603-fix-signature.patch
new file mode 100644 (file)
index 0000000..b992556
--- /dev/null
@@ -0,0 +1,37 @@
+--- a/src/drv_vmmc_init.c
++++ b/src/drv_vmmc_init.c
+@@ -202,11 +202,20 @@ IFX_int32_t VMMC_GetDevice (IFX_uint16_t
+ /**
+    Wrapper for the voice buffer get function that sets the FW as owner.
+ */
+-static IFX_void_t* vmmc_WrapperVoiceBufferGet (IFX_void_t)
++static IFX_void_t* vmmc_WrapperVoiceBufferGet (IFX_size_t size,
++                                               IFX_int32_t priority)
+ {
+    return IFX_TAPI_VoiceBufferGetWithOwnerId (IFX_TAPI_BUFFER_OWNER_FW);
+ }
++/**
++   Wrapper for the voice buffer get function that sets the FW as owner.
++*/
++static IFX_void_t vmmc_WrapperVoiceBufferPut (const IFX_void_t *ptr)
++{
++   IFX_TAPI_VoiceBufferPut ((IFX_void_t *)ptr);
++}
++
+ /**
+    Wrapper for the voice buffer free all function freeing all buffers that
+@@ -263,10 +272,8 @@ IFX_int32_t VMMC_ChipAccessInit(VMMC_DEV
+    /* Register the buffer handler. */
+ #ifdef USE_BUFFERPOOL
+-   ifx_mps_bufman_register((IFX_void_t* (*)(IFX_size_t, IFX_int32_t))
+-                           vmmc_WrapperVoiceBufferGet,
+-                           (IFX_void_t (*)(const IFX_void_t*))
+-                           IFX_TAPI_VoiceBufferPut,
++   ifx_mps_bufman_register(vmmc_WrapperVoiceBufferGet,
++                           vmmc_WrapperVoiceBufferPut,
+                            sizeof(PACKET), POBX_BUFFER_THRESHOLD);
+    ifx_mps_register_bufman_freeall_callback (vmmc_WrapperVoiceBufferFreeAll);
+ #else