From 295f98c971e6d6d9a1a01078f5a7ea49e160d0cf Mon Sep 17 00:00:00 2001 From: Dhaval Khandla Date: Mon, 18 Dec 2023 11:21:56 +0530 Subject: [PATCH] am243x/am64x: hdsl: Load only required PRU firmware - Firmware for RTU and PRU cores are always being loaded - This leads to unnecessary protocol resets in beginning, because of global PRU-ICSS peripheral reinitialization in both cores Fixes: PINDSW-7126 Signed-off-by: Dhaval Khandla --- .../hdsl_diagnostic/hdsl_diagnostic.c | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/examples/position_sense/hdsl_diagnostic/hdsl_diagnostic.c b/examples/position_sense/hdsl_diagnostic/hdsl_diagnostic.c index 40dd1e5..769108d 100644 --- a/examples/position_sense/hdsl_diagnostic/hdsl_diagnostic.c +++ b/examples/position_sense/hdsl_diagnostic/hdsl_diagnostic.c @@ -776,29 +776,46 @@ void hdsl_pruss_load_run_fw_300m(HDSL_Handle hdslHandle) if(HDSL_get_sync_ctrl(hdslHandle) == 0) { /*free run*/ +#if (CONFIG_HDSL0_CHANNEL0 == 1) PRUICSS_writeMemory(gPruIcss0Handle, PRUICSS_IRAM_RTU_PRU(1), 0, (uint32_t *) Hiperface_DSL2_0_RTU_0, sizeof(Hiperface_DSL2_0_RTU_0)); +#endif +#if (CONFIG_HDSL0_CHANNEL1 == 1) PRUICSS_writeMemory(gPruIcss0Handle, PRUICSS_IRAM_PRU(1), 0, (uint32_t *) Hiperface_DSL2_0_PRU_0, sizeof(Hiperface_DSL2_0_PRU_0)); +#endif } else { /*Sync mode*/ +#if (CONFIG_HDSL0_CHANNEL0 == 1) PRUICSS_writeMemory(gPruIcss0Handle, PRUICSS_IRAM_RTU_PRU(1), 0, (uint32_t *) Hiperface_DSL_SYNC2_0_RTU_0, sizeof(Hiperface_DSL_SYNC2_0_RTU_0)); +#endif +#if (CONFIG_HDSL0_CHANNEL1 == 1) PRUICSS_writeMemory(gPruIcss0Handle, PRUICSS_IRAM_PRU(1), 0, (uint32_t *) Hiperface_DSL_SYNC2_0_PRU_0, sizeof(Hiperface_DSL_SYNC2_0_PRU_0)); +#endif } - PRUICSS_resetCore(gPruIcss0Handle, PRUICSS_RTU_PRU1); - PRUICSS_resetCore(gPruIcss0Handle, PRUICSS_PRU1); + /*Run firmware*/ +#if (CONFIG_HDSL0_CHANNEL0 == 1) + PRUICSS_resetCore(gPruIcss0Handle, PRUICSS_RTU_PRU1); +#endif +#if (CONFIG_HDSL0_CHANNEL1 == 1) + PRUICSS_resetCore(gPruIcss0Handle, PRUICSS_PRU1); +#endif +#if (CONFIG_HDSL0_CHANNEL0 == 1) PRUICSS_enableCore(gPruIcss0Handle, PRUICSS_RTU_PRU1); +#endif +#if (CONFIG_HDSL0_CHANNEL1 == 1) PRUICSS_enableCore(gPruIcss0Handle, PRUICSS_PRU1); #endif +#endif } void hdsl_init(void)