From df9e50c808d8555293560cef925fca7fae9ceb75 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Thu, 21 Dec 2023 17:43:34 +0000 Subject: [PATCH] rtcpu: Port IVC bus driver to use iosys-map utils The IVC driver in core kernel has been changed to accept VADDR via iosys_map structure. Use the proper iosys map utils to pass address when doing the tegra_ivc_init(). Bug 4346767 Change-Id: I416f6fbbea7605da9ae729e2076d10fb6360525d Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3039534 (cherry picked from commit 0679fc19d6f8101390d6736b4541d66b60d7d2f4) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3161024 Reviewed-by: Ankur Pawar Reviewed-by: Jon Hunter Tested-by: Paritosh Dixit Tested-by: Jon Hunter Reviewed-by: Paritosh Dixit GVS: buildbot_gerritrpt --- drivers/platform/tegra/rtcpu/ivc-bus.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/platform/tegra/rtcpu/ivc-bus.c b/drivers/platform/tegra/rtcpu/ivc-bus.c index 2ed87cba..84fc7747 100644 --- a/drivers/platform/tegra/rtcpu/ivc-bus.c +++ b/drivers/platform/tegra/rtcpu/ivc-bus.c @@ -15,6 +15,10 @@ #include #include "soc/tegra/camrtc-channels.h" +#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) +#include +#endif + #define NV(p) "nvidia," #p #define CAMRTC_IVC_CONFIG_SIZE 4096 @@ -79,6 +83,9 @@ static struct tegra_ivc_channel *tegra_ivc_channel_create( struct camrtc_hsp *camhsp) { struct camrtc_tlv_ivc_setup *tlv; +#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) + struct iosys_map rx_map, tx_map; +#endif struct { u32 rx; u32 tx; @@ -161,6 +168,21 @@ static struct tegra_ivc_channel *tegra_ivc_channel_create( region->ivc_size += queue_size; end.tx = region->ivc_size; +#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) + iosys_map_set_vaddr(&rx_map, (void *)(region->base + start.rx)); + iosys_map_set_vaddr(&tx_map, (void *)(region->base + start.tx)); + + /* Init IVC */ + ret = tegra_ivc_init(&chan->ivc, + NULL, + &rx_map, + region->iova + start.rx, + &tx_map, + region->iova + start.tx, + nframes, frame_size, + tegra_ivc_channel_ring, + (void *)camhsp); +#else /* Init IVC */ ret = tegra_ivc_init(&chan->ivc, NULL, @@ -171,6 +193,7 @@ static struct tegra_ivc_channel *tegra_ivc_channel_create( nframes, frame_size, tegra_ivc_channel_ring, (void *)camhsp); +#endif if (ret) { dev_err(&chan->dev, "IVC initialization error: %d\n", ret); goto error;