Files
linux-nv-oot/drivers/memory/tegra/private-soc/mc-t26x.c
Jon Hunter 5f0c2eed41 memory: tegra: Fix build for Linux v6.10+
In Linux v6.11, the 'platform_driver' structure 'remove' callback was
updated to return void instead of 'int'. Update the Tegra264 memory
drivers as necessary to ensure that they can be built for Linux v6.11+
kernels.

The mem-qual driver is missing the vmalloc.h header file and this also
causes the build to fail for Linux v6.10+ kernels to fail.

Finally, remove the version.h file from the mem-qual driver as this is
not needed.

Bug 4749580

Change-Id: I2f6273dff68fddf0d4eff4c2f4d57c445b3de291
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3235930
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
2025-07-24 10:19:09 +00:00

100 lines
2.4 KiB
C

// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION. All rights reserved.
#define pr_fmt(fmt) "mc: " fmt
#include <nvidia/conftest.h>
#include <linux/module.h>
#include <linux/export.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <soc/tegra/mc-t26x.h>
#define MC_SECURITY_CARVEOUT_BASE 0xa004
#define MC_CARVEOUT_NEXT 0xa0
#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
static void __iomem *mcb_base;
static inline u32 mc_readl(unsigned long offset)
{
return readl_relaxed(mcb_base + offset);
}
int tegra264_mc_get_carveout_info(unsigned int id, phys_addr_t *base, u64 *size)
{
u32 offset;
if (id < 1 || id > 42)
return -EINVAL;
if (id < 32)
offset = MC_SECURITY_CARVEOUT_BASE + MC_CARVEOUT_NEXT * (id - 1);
else
offset = MC_SECURITY_CARVEOUT_LITE_BASE + MC_CARVEOUT_LITE_NEXT * (id - 32);
*base = mc_readl(offset + 0x0);
#ifdef CONFIG_PHYS_ADDR_T_64BIT
*base |= (phys_addr_t)mc_readl(offset + MC_CARVEOUT_BASE_HI) << 32;
#endif
if (size)
*size = (u64)mc_readl(offset + MC_SECURITY_CARVEOUT_SIZE_128KB) << 17;
return 0;
}
EXPORT_SYMBOL(tegra264_mc_get_carveout_info);
const struct of_device_id tegra_mc_of_ids[] = {
{ .compatible = "nvidia,tegra-t26x-mc" },
{ }
};
MODULE_DEVICE_TABLE(of, tegra_mc_of_ids);
static int tegra_mc_probe(struct platform_device *pdev)
{
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;
}
static void tegra_mc_remove(struct platform_device *pdev)
{
iounmap(mcb_base);
}
#if defined(NV_PLATFORM_DRIVER_STRUCT_REMOVE_RETURNS_VOID) /* Linux v6.11 */
static void tegra_mc_remove_wrapper(struct platform_device *pdev)
{
tegra_mc_remove(pdev);
}
#else
static int tegra_mc_remove_wrapper(struct platform_device *pdev)
{
tegra_mc_remove(pdev);
return 0;
}
#endif
static struct platform_driver mc_driver = {
.driver = {
.name = "nv-tegra-t26x-mc",
.of_match_table = tegra_mc_of_ids,
.owner = THIS_MODULE,
},
.remove = tegra_mc_remove_wrapper,
};
module_platform_driver_probe(mc_driver, tegra_mc_probe);
MODULE_AUTHOR("Ashish Mhetre <amhetre@nvidia.com>");
MODULE_DESCRIPTION("NVIDIA Tegra Memory Controller driver");
MODULE_LICENSE("GPL v2");