From 2f44df7fa3bd96f4a4a154fd0f2bbc8c6be13ceb Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Fri, 21 Jan 2022 10:52:21 +0000 Subject: [PATCH] platform: tegra: cvnas: Simplify DT support The compatible string for CVNAS devices has been updated from "nvidia,tegra-cvnas" to "nvidia,tegra194-cvnas" to conform with the upstream policy of stating the actual device it is supported on. The 'nvidia,tegra-cvnas-hv' has been left as-is because this is a special case for virtualisation. The CVNAS driver is only support for Tegra194 devices and so it is not necessary to check the actual device variant, just the device SKU. Finally, instead of populating platform data in the device-tree table we can simply use the compatible string itself to detect if the device support virtualisation. Bug 3459526 Change-Id: I9755e8277892445b3e6772b8fa0b1960a34d90f4 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2657909 Reviewed-by: Puneet Saxena Reviewed-by: Sachin Nikam --- drivers/platform/tegra/cvnas/cvnas.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/platform/tegra/cvnas/cvnas.c b/drivers/platform/tegra/cvnas/cvnas.c index 8327645c..eae224e3 100644 --- a/drivers/platform/tegra/cvnas/cvnas.c +++ b/drivers/platform/tegra/cvnas/cvnas.c @@ -526,8 +526,8 @@ static ssize_t clk_cap_show(struct device *dev, } static const struct of_device_id nvcvnas_of_ids[] = { - { .compatible = "nvidia,tegra-cvnas", .data = (void *)false, }, - { .compatible = "nvidia,tegra-cvnas-hv", .data = (void *)true, }, + { .compatible = "nvidia,tegra194-cvnas", }, + { .compatible = "nvidia,tegra-cvnas-hv", }, { } }; MODULE_DEVICE_TABLE(of, nvcvnas_of_ids); @@ -538,10 +538,8 @@ static int nvcvnas_probe(struct platform_device *pdev) int ret; u32 cvsram_slice_data[2]; u32 cvsram_reg_data[4]; - const struct of_device_id *match; - if (of_machine_is_compatible("nvidia,tegra194") && - tegra_get_sku_id() == 0x9E) { + if (tegra_get_sku_id() == 0x9E) { dev_err(&pdev->dev, "CVNAS IP is disabled in SKU.\n"); return -ENODEV; } @@ -572,9 +570,8 @@ static int nvcvnas_probe(struct platform_device *pdev) goto err_device_create_file; } - match = of_match_device(nvcvnas_of_ids, &pdev->dev); - if (match) - cvnas_dev->virt = (bool)match->data; + if (of_device_is_compatible(pdev->dev.of_node, "nvidia,tegra-cvnas-hv")) + cvnas_dev->virt = true; cvnas_dev->cvreg_iobase = of_iomap(pdev->dev.of_node, 0); if (!cvnas_dev->cvreg_iobase) {