mc-utils: Update driver so as to support multiple SOCs

Current mc-utils driver is specific to T234 without any support for
extending it to future SOCs. Add such support so that it can be easily
extended for future chips.
- Create a struct of function pointers of all present operations
- Set these function pointers as per SOCs

Bug 4090660

Change-Id: I93e9da987bce1e563eb03aeeb0ac8bcb9da48023
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2911894
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Ketan Patil
2023-05-29 08:44:48 +00:00
committed by mobile promotions
parent 0e6d4c804f
commit a56b9fc61c
2 changed files with 61 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022, NVIDIA CORPORATION, All rights reserved.
// Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
#ifndef __TEGRA_MC_UTILS_H
#define __TEGRA_MC_UTILS_H
@@ -32,6 +32,14 @@ enum dram_types {
DRAM_TYPE_LPDDR4_4CH_2RANK,
};
struct mc_utils_ops {
unsigned long (*emc_freq_to_bw)(unsigned long freq);
unsigned long (*emc_bw_to_freq)(unsigned long bw);
enum dram_types (*tegra_dram_types)(void);
u8 (*get_dram_num_channels)(void);
unsigned long (*dram_clk_to_mc_clk)(unsigned long dram_clk);
};
/*
* Utility API to convert the given frequency to Bandwidth.
*