From 45eab8b2ae892758c67c8b947a8d6111d75027b4 Mon Sep 17 00:00:00 2001 From: Ashish Mhetre Date: Tue, 18 Jun 2024 05:10:58 +0000 Subject: [PATCH] memory: tegra: mc-t26x: Fix ioremap on MCB aperture MCB aperture is already ioremapped in MC driver using devm_ioremap_resource(). This doesn't allow other driver to ioremap this aperture using devm_ioremap* calls. mc-t26x driver need to access MCB aperture to get carveout info. So, fix this by using just ioremap on aperture without using devm* APIs. Also, fix the carveout apertures. Bug 4707077 Change-Id: Ie7426ad3519306dd4dffdf54e4c58e81f3c8fb34 Signed-off-by: Ashish Mhetre Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3158697 Reviewed-by: Ketan Patil Reviewed-by: Sachin Nikam GVS: buildbot_gerritrpt --- drivers/memory/tegra/private-soc/mc-t26x.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/memory/tegra/private-soc/mc-t26x.c b/drivers/memory/tegra/private-soc/mc-t26x.c index f6db588d..f4cbee54 100644 --- a/drivers/memory/tegra/private-soc/mc-t26x.c +++ b/drivers/memory/tegra/private-soc/mc-t26x.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -// Copyright (C) 2023 NVIDIA CORPORATION. All rights reserved. +// Copyright (C) 2023-2024 NVIDIA CORPORATION. All rights reserved. #define pr_fmt(fmt) "mc: " fmt #include @@ -8,9 +8,9 @@ #include #include -#define MC_SECURITY_CARVEOUT_BASE 0x9404 +#define MC_SECURITY_CARVEOUT_BASE 0xa004 #define MC_CARVEOUT_NEXT 0xa0 -#define MC_SECURITY_CARVEOUT_LITE_BASE 0xa804 +#define MC_SECURITY_CARVEOUT_LITE_BASE 0xb404 #define MC_CARVEOUT_LITE_NEXT 0x60 #define MC_CARVEOUT_BASE_HI 0x4 #define MC_SECURITY_CARVEOUT_SIZE_128KB 0x8 @@ -50,7 +50,13 @@ MODULE_DEVICE_TABLE(of, tegra_mc_of_ids); static int tegra_mc_probe(struct platform_device *pdev) { - mcb_base = devm_platform_ioremap_resource(pdev, 0); + struct resource *r; + + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!r) + return PTR_ERR(r); + + mcb_base = ioremap(r->start, resource_size(r)); if (IS_ERR_OR_NULL(mcb_base)) return PTR_ERR(mcb_base); return 0; @@ -58,6 +64,7 @@ static int tegra_mc_probe(struct platform_device *pdev) static int tegra_mc_remove(struct platform_device *pdev) { + iounmap(mcb_base); return 0; }