video: tegra: nvmap: Remove dependency of cvnas

Handle dependencies between nvmap and cvnas driver:
- nvmap_register_cvsram_carveout function is called by cvnas driver
(builtin driver for 5.10) and it's definition is present in nvmap driver
(builtin driver for 5.10, but we are trying to make LKM). This is
resulting into build issues while making nvmap as LKM for 5.10
- One option to resolve this is by making cvnas driver as LKM for 5.10
But nvhost, nvdla, cbb are not LKM for 5.10 and are calling functions
defined in cvnas driver e.g. nvcvnas_get_cvsram_base, hence we can't
make cvnas as LKM for 5.10
- Second option is to get rid of the call nvmap_register_cvsram_carveout
from cvnas driver. This approach is implemented in this patch.
- Export cvnas_dev from cvnas driver, do not call the above function
from cvnas driver. During nvmap probe, nvmap itself would call the above
function, as cvnas_dev is exported , it's being used in nvmap driver to
get base, size etc. information, which is needed as argument to above
function, which will register the cvnas carveout in case of 5.10

Bug 200722684

Change-Id: I32e5694386de4a7fef65c3f67ffb9b5066f62ab3
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2678685
This commit is contained in:
Ketan Patil
2022-03-09 07:11:19 +00:00
committed by Laxman Dewangan
parent 584a58b4b1
commit 3a87281353
3 changed files with 38 additions and 27 deletions

View File

@@ -13,3 +13,6 @@ ccflags-y += -DCONFIG_TEGRA_FUSE_UPSTREAM
endif
obj-$(CONFIG_TEGRA_CVNAS) += cvnas.o
ifeq ($(CONFIG_TEGRA_CVNAS),m)
ccflags-y += -DCVNAS_MODULE
endif

View File

@@ -80,31 +80,10 @@ static bool cvnas_rail;
#define HSM_CVSRAM_ECC_DED_MASK_0 0x80000000
#define HSM_CVSRAM_ECC_DED_MASK_1 0x00000007
struct cvnas_device {
struct dentry *debugfs_root;
void __iomem *cvsram_iobase;
void __iomem *cvreg_iobase;
void __iomem *hsm_iobase;
struct device dma_dev;
int nslices;
int slice_size;
phys_addr_t cvsram_base;
size_t cvsram_size;
struct clk *clk;
struct device_attribute *attr;
struct reset_control *rst;
struct reset_control *rst_fcm;
bool virt;
int (*pmops_busy)(void);
int (*pmops_idle)(void);
};
struct cvnas_device *cvnas_dev;
#ifndef CVNAS_MODULE
EXPORT_SYMBOL(cvnas_dev);
#endif /* !CVNAS_MODULE */
static struct platform_device *cvnas_plat_dev;
@@ -542,7 +521,6 @@ MODULE_DEVICE_TABLE(of, nvcvnas_of_ids);
static int nvcvnas_probe(struct platform_device *pdev)
{
struct cvnas_device *cvnas_dev;
int ret;
u32 cvsram_slice_data[2];
u32 cvsram_reg_data[4];
@@ -654,6 +632,7 @@ static int nvcvnas_probe(struct platform_device *pdev)
cvnas_dev->pmops_busy = nvcvnas_busy;
cvnas_dev->pmops_idle = nvcvnas_idle;
#ifdef CVNAS_MODULE
ret = nvmap_register_cvsram_carveout(&cvnas_dev->dma_dev,
cvnas_dev->cvsram_base, cvnas_dev->cvsram_size,
cvnas_dev->pmops_busy, cvnas_dev->pmops_idle);
@@ -662,14 +641,16 @@ static int nvcvnas_probe(struct platform_device *pdev)
"nvmap cvsram register failed. ret=%d\n", ret);
goto err_cvsram_nvmap_heap_register;
}
#endif /* CVNAS_MODULE */
dev_set_drvdata(&pdev->dev, cvnas_dev);
/* TODO: Add interrupt handler */
return 0;
#ifdef CVNAS_MODULE
err_cvsram_nvmap_heap_register:
debugfs_remove(cvnas_dev->debugfs_root);
#endif /* CVNAS_MODULE */
err_cvnas_debugfs_init:
err_get_reset_fcm:
err_get_reset:

View File

@@ -21,6 +21,33 @@
#define __LINUX_CVNAS_H
#include <linux/types.h>
#include <linux/device.h>
struct cvnas_device {
struct dentry *debugfs_root;
void __iomem *cvsram_iobase;
void __iomem *cvreg_iobase;
void __iomem *hsm_iobase;
struct device dma_dev;
int nslices;
int slice_size;
phys_addr_t cvsram_base;
size_t cvsram_size;
struct clk *clk;
struct device_attribute *attr;
struct reset_control *rst;
struct reset_control *rst_fcm;
bool virt;
int (*pmops_busy)(void);
int (*pmops_idle)(void);
};
int nvcvnas_busy(void);
int nvcvnas_busy_no_rpm(void);