[openwrt/openwrt] lantiq: Fix compile of lantiq components with kernel 6.1

LEDE Commits lede-commits at lists.infradead.org
Wed May 15 01:21:07 PDT 2024


nick pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/11baab9fac046a43cd04f18a1f107460a29fe736

commit 11baab9fac046a43cd04f18a1f107460a29fe736
Author: Hauke Mehrtens <hauke at hauke-m.de>
AuthorDate: Fri Jun 2 22:58:51 2023 +0200

    lantiq: Fix compile of lantiq components with kernel 6.1
    
    This makes the components used on the lantiq SoCs compile with kernel
    6.1.
    
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
    [also fix ifxmips_ptm_adsl.c]
    Signed-off-by: Martin Schiller <ms at dev.tdt.de>
---
 .../201-fix-compilation-warning-fallthrough.patch  |  2 +-
 ...g997_danube-dynamically-allocate-hlogdata.patch |  2 +-
 .../203-g997_danube-fix-compilation-warning.patch  |  4 +--
 .../lantiq/ltq-adsl/patches/400-kernel-6.1.patch   | 14 ++++++++
 .../101-fix-more-compilation-warning-debugfs.patch |  8 ++---
 .../kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c   | 19 +++++++----
 .../kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c   |  4 +++
 .../300-fix-simple-compilation-warning.patch       |  4 +--
 .../ltq-vdsl-vr9-mei/patches/400-kernel-6.1.patch  | 28 ++++++++++++++++
 .../lantiq/ltq-vmmc/patches/602-remove-ABS.patch   | 20 ++++++++++++
 .../ltq-vmmc/patches/603-fix-signature.patch       | 37 ++++++++++++++++++++++
 11 files changed, 126 insertions(+), 16 deletions(-)

diff --git a/package/kernel/lantiq/ltq-adsl/patches/201-fix-compilation-warning-fallthrough.patch b/package/kernel/lantiq/ltq-adsl/patches/201-fix-compilation-warning-fallthrough.patch
index dfaf29f449..17dfd0f25d 100644
--- a/package/kernel/lantiq/ltq-adsl/patches/201-fix-compilation-warning-fallthrough.patch
+++ b/package/kernel/lantiq/ltq-adsl/patches/201-fix-compilation-warning-fallthrough.patch
@@ -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*/
diff --git a/package/kernel/lantiq/ltq-adsl/patches/202-g997_danube-dynamically-allocate-hlogdata.patch b/package/kernel/lantiq/ltq-adsl/patches/202-g997_danube-dynamically-allocate-hlogdata.patch
index c3b1047a2a..1dd0f21693 100644
--- a/package/kernel/lantiq/ltq-adsl/patches/202-g997_danube-dynamically-allocate-hlogdata.patch
+++ b/package/kernel/lantiq/ltq-adsl/patches/202-g997_danube-dynamically-allocate-hlogdata.patch
@@ -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)
           {
diff --git a/package/kernel/lantiq/ltq-adsl/patches/203-g997_danube-fix-compilation-warning.patch b/package/kernel/lantiq/ltq-adsl/patches/203-g997_danube-fix-compilation-warning.patch
index c6a0e70f1f..b86ecf84a4 100644
--- a/package/kernel/lantiq/ltq-adsl/patches/203-g997_danube-fix-compilation-warning.patch
+++ b/package/kernel/lantiq/ltq-adsl/patches/203-g997_danube-fix-compilation-warning.patch
@@ -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
index 0000000000..2179f355bb
--- /dev/null
+++ b/package/kernel/lantiq/ltq-adsl/patches/400-kernel-6.1.patch
@@ -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,
diff --git a/package/kernel/lantiq/ltq-ptm/patches/101-fix-more-compilation-warning-debugfs.patch b/package/kernel/lantiq/ltq-ptm/patches/101-fix-more-compilation-warning-debugfs.patch
index f854662a07..55551ad91d 100644
--- a/package/kernel/lantiq/ltq-ptm/patches/101-fix-more-compilation-warning-debugfs.patch
+++ b/package/kernel/lantiq/ltq-ptm/patches/101-fix-more-compilation-warning-debugfs.patch
@@ -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;
  }
  
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
index 5ee966c014..91cc97617f 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
@@ -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)
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
index dfb57787b9..54d88a21ec 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
@@ -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;
diff --git a/package/kernel/lantiq/ltq-vdsl-vr9-mei/patches/300-fix-simple-compilation-warning.patch b/package/kernel/lantiq/ltq-vdsl-vr9-mei/patches/300-fix-simple-compilation-warning.patch
index e9f1931227..c1d3aa8b41 100644
--- a/package/kernel/lantiq/ltq-vdsl-vr9-mei/patches/300-fix-simple-compilation-warning.patch
+++ b/package/kernel/lantiq/ltq-vdsl-vr9-mei/patches/300-fix-simple-compilation-warning.patch
@@ -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
index 0000000000..a1efdb7b48
--- /dev/null
+++ b/package/kernel/lantiq/ltq-vdsl-vr9-mei/patches/400-kernel-6.1.patch
@@ -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
index 0000000000..e09989be8a
--- /dev/null
+++ b/package/kernel/lantiq/ltq-vmmc/patches/602-remove-ABS.patch
@@ -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
index 0000000000..b99255692b
--- /dev/null
+++ b/package/kernel/lantiq/ltq-vmmc/patches/603-fix-signature.patch
@@ -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




More information about the lede-commits mailing list