lede/package/qca/qca-nss-drv/patches/0023-add-boot-delay.patch
2025-05-26 18:15:31 +08:00

61 lines
1.6 KiB
Diff

--- a/nss_core.c
+++ b/nss_core.c
@@ -92,6 +92,8 @@ static int qos_mem_size = 0;
module_param(qos_mem_size, int, S_IRUGO);
MODULE_PARM_DESC(qos_mem_size, "QoS memory size");
+static int nss_bootstate = 0;
+
/*
* Atomic variables to control jumbo_mru & paged_mode
*/
@@ -2253,6 +2255,19 @@ static inline void nss_core_handle_tx_un
nss_hal_disable_interrupt(nss_ctx, nss_ctx->int_ctx[0].shift_factor, NSS_N2H_INTR_TX_UNBLOCKED);
}
+void nss_bootwait(void)
+{
+ int dead = 10 * 10;
+#if (NSS_MAX_CORES > 1)
+ while (nss_bootstate < 2 && dead-- > 0)
+#else
+ while (!nss_bootstate && dead-- > 0)
+#endif
+ {
+ msleep(100);
+ }
+}
+
/*
* nss_core_handle_cause_nonqueue()
* Handle non-queue interrupt causes (e.g. empty buffer SOS, Tx unblocked)
@@ -2321,6 +2336,9 @@ static void nss_core_handle_cause_nonque
#endif
#endif
}
+ if (unlikely(nss_ctx->state == NSS_CORE_STATE_INITIALIZED)) {
+ nss_bootstate++;
+ }
#if defined(NSS_DRV_EDMA_LITE_ENABLE)
/*
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -850,6 +850,7 @@ int nss_hal_probe(struct platform_device
}
nss_info("%px: All resources initialized and nss core%d has been brought out of reset", nss_ctx, nss_dev->id);
+ nss_bootwait();
goto out;
err_register_irq:
--- a/nss_core.h
+++ b/nss_core.h
@@ -1082,4 +1082,6 @@ extern nss_tx_status_t nss_n2h_cfg_empty
extern nss_tx_status_t nss_n2h_paged_buf_pool_init(struct nss_ctx_instance *nss_ctx);
extern nss_tx_status_t nss_n2h_cfg_qos_mem_size(struct nss_ctx_instance *nss_ctx, uint32_t pool_sz);
+void nss_bootwait(void);
+
#endif /* __NSS_CORE_H */