From 54ceaa5e6a5a42ac2daace73d4a18af4b4d24e44 Mon Sep 17 00:00:00 2001 From: Rahul Bedarkar Date: Mon, 20 Nov 2023 09:20:05 +0000 Subject: [PATCH] NVIDIA: SAUCE: tegra-epl: Set default handshake retry count to 25 BugLink: https://bugs.launchpad.net/bugs/2072591 This patch add a DT property to set handshake retry count. Default value is set to 25. On P3898 board, Guest VM resumes quite early because PCIe controller is disabled. Handshake usually is passing with 20 but sometimes takes 21 iterations. http://nvbugs/4190302 Signed-off-by: Rahul Bedarkar Signed-off-by: Satish Seelamsetti Reviewed-by: Prathamesh Shete Reviewed-by: Laxman Dewangan Signed-off-by: Laxman Dewangan Acked-by: Jacob Martin Acked-by: Noah Wager Signed-off-by: Noah Wager --- drivers/platform/tegra/tegra-epl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/platform/tegra/tegra-epl.c b/drivers/platform/tegra/tegra-epl.c index cc900744b1f2..06b8a6a03ee8 100644 --- a/drivers/platform/tegra/tegra-epl.c +++ b/drivers/platform/tegra/tegra-epl.c @@ -75,6 +75,8 @@ static struct epl_misc_sw_err_cfg miscerr_cfg[NUM_SW_GENERIC_ERR]; /* State of FSI handshake */ static enum handshake_state hs_state = HANDSHAKE_PENDING; +static const int default_handshake_retry_count = 25; +static uint32_t handshake_retry_count; static bool enable_deinit_notify; @@ -230,7 +232,6 @@ static int epl_client_fsi_handshake(void *arg) int ret; const uint32_t handshake_data[] = {0x45504C48, 0x414E4453, 0x48414B45, 0x44415441}; - const uint8_t max_retries = 20; do { ret = mbox_send_message(epl_hsp_v->tx.chan, (void *) handshake_data); @@ -242,7 +243,7 @@ static int epl_client_fsi_handshake(void *arg) hs_state = HANDSHAKE_DONE; break; } - } while (count < max_retries); + } while (count < handshake_retry_count); } if (hs_state == HANDSHAKE_FAILED) @@ -367,6 +368,12 @@ static int epl_client_probe(struct platform_device *pdev) if (of_property_read_bool(np, "enable-deinit-notify")) enable_deinit_notify = true; + if (of_property_read_u32(np, "handshake-retry-count", &handshake_retry_count) < 0) { + handshake_retry_count = default_handshake_retry_count; + } + + dev_info(dev, "handshake-retry-count %u\n", handshake_retry_count); + mission_err_status_va = devm_platform_ioremap_resource(pdev, NUM_SW_GENERIC_ERR * 2); if (IS_ERR(mission_err_status_va)) { isAddrMappOk = false;