memory: tegra124-emc: Add the SoC model prefix to functions
Replace "tegra_emc" with "tegra124_emc" in all functions to: 1. Avoid name clashing with other Tegra EMC drivers which makes it easier to jump to function definitions, 2. Decode the calltraces a bit easier, 3. Unify with other Tegra MC and EMC drivers, which use the SoC model prefixes. No functional impact. Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
This commit is contained in:
@@ -571,8 +571,8 @@ static void emc_seq_wait_clkchange(struct tegra_emc *emc)
|
|||||||
dev_err(emc->dev, "clock change timed out\n");
|
dev_err(emc->dev, "clock change timed out\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct emc_timing *tegra_emc_find_timing(struct tegra_emc *emc,
|
static struct emc_timing *tegra124_emc_find_timing(struct tegra_emc *emc,
|
||||||
unsigned long rate)
|
unsigned long rate)
|
||||||
{
|
{
|
||||||
struct emc_timing *timing = NULL;
|
struct emc_timing *timing = NULL;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@@ -592,10 +592,10 @@ static struct emc_timing *tegra_emc_find_timing(struct tegra_emc *emc,
|
|||||||
return timing;
|
return timing;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tegra_emc_prepare_timing_change(struct tegra_emc *emc,
|
static int tegra124_emc_prepare_timing_change(struct tegra_emc *emc,
|
||||||
unsigned long rate)
|
unsigned long rate)
|
||||||
{
|
{
|
||||||
struct emc_timing *timing = tegra_emc_find_timing(emc, rate);
|
struct emc_timing *timing = tegra124_emc_find_timing(emc, rate);
|
||||||
struct emc_timing *last = &emc->last_timing;
|
struct emc_timing *last = &emc->last_timing;
|
||||||
enum emc_dll_change dll_change;
|
enum emc_dll_change dll_change;
|
||||||
unsigned int pre_wait = 0;
|
unsigned int pre_wait = 0;
|
||||||
@@ -820,10 +820,10 @@ static int tegra_emc_prepare_timing_change(struct tegra_emc *emc,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tegra_emc_complete_timing_change(struct tegra_emc *emc,
|
static void tegra124_emc_complete_timing_change(struct tegra_emc *emc,
|
||||||
unsigned long rate)
|
unsigned long rate)
|
||||||
{
|
{
|
||||||
struct emc_timing *timing = tegra_emc_find_timing(emc, rate);
|
struct emc_timing *timing = tegra124_emc_find_timing(emc, rate);
|
||||||
struct emc_timing *last = &emc->last_timing;
|
struct emc_timing *last = &emc->last_timing;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
@@ -986,8 +986,8 @@ static int cmp_timings(const void *_a, const void *_b)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc,
|
static int tegra124_emc_load_timings_from_dt(struct tegra_emc *emc,
|
||||||
struct device_node *node)
|
struct device_node *node)
|
||||||
{
|
{
|
||||||
int child_count = of_get_child_count(node);
|
int child_count = of_get_child_count(node);
|
||||||
struct emc_timing *timing;
|
struct emc_timing *timing;
|
||||||
@@ -1015,15 +1015,15 @@ static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct of_device_id tegra_emc_of_match[] = {
|
static const struct of_device_id tegra124_emc_of_match[] = {
|
||||||
{ .compatible = "nvidia,tegra124-emc" },
|
{ .compatible = "nvidia,tegra124-emc" },
|
||||||
{ .compatible = "nvidia,tegra132-emc" },
|
{ .compatible = "nvidia,tegra132-emc" },
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, tegra_emc_of_match);
|
MODULE_DEVICE_TABLE(of, tegra124_emc_of_match);
|
||||||
|
|
||||||
static struct device_node *
|
static struct device_node *
|
||||||
tegra_emc_find_node_by_ram_code(struct device_node *node, u32 ram_code)
|
tegra124_emc_find_node_by_ram_code(struct device_node *node, u32 ram_code)
|
||||||
{
|
{
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
int err;
|
int err;
|
||||||
@@ -1041,7 +1041,7 @@ tegra_emc_find_node_by_ram_code(struct device_node *node, u32 ram_code)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tegra_emc_rate_requests_init(struct tegra_emc *emc)
|
static void tegra124_emc_rate_requests_init(struct tegra_emc *emc)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@@ -1143,7 +1143,7 @@ static int emc_set_max_rate(struct tegra_emc *emc, unsigned long rate,
|
|||||||
* valid range.
|
* valid range.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool tegra_emc_validate_rate(struct tegra_emc *emc, unsigned long rate)
|
static bool tegra124_emc_validate_rate(struct tegra_emc *emc, unsigned long rate)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@@ -1154,8 +1154,8 @@ static bool tegra_emc_validate_rate(struct tegra_emc *emc, unsigned long rate)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tegra_emc_debug_available_rates_show(struct seq_file *s,
|
static int tegra124_emc_debug_available_rates_show(struct seq_file *s,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct tegra_emc *emc = s->private;
|
struct tegra_emc *emc = s->private;
|
||||||
const char *prefix = "";
|
const char *prefix = "";
|
||||||
@@ -1171,9 +1171,9 @@ static int tegra_emc_debug_available_rates_show(struct seq_file *s,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_SHOW_ATTRIBUTE(tegra_emc_debug_available_rates);
|
DEFINE_SHOW_ATTRIBUTE(tegra124_emc_debug_available_rates);
|
||||||
|
|
||||||
static int tegra_emc_debug_min_rate_get(void *data, u64 *rate)
|
static int tegra124_emc_debug_min_rate_get(void *data, u64 *rate)
|
||||||
{
|
{
|
||||||
struct tegra_emc *emc = data;
|
struct tegra_emc *emc = data;
|
||||||
|
|
||||||
@@ -1182,12 +1182,12 @@ static int tegra_emc_debug_min_rate_get(void *data, u64 *rate)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tegra_emc_debug_min_rate_set(void *data, u64 rate)
|
static int tegra124_emc_debug_min_rate_set(void *data, u64 rate)
|
||||||
{
|
{
|
||||||
struct tegra_emc *emc = data;
|
struct tegra_emc *emc = data;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!tegra_emc_validate_rate(emc, rate))
|
if (!tegra124_emc_validate_rate(emc, rate))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
err = emc_set_min_rate(emc, rate, EMC_RATE_DEBUG);
|
err = emc_set_min_rate(emc, rate, EMC_RATE_DEBUG);
|
||||||
@@ -1199,11 +1199,11 @@ static int tegra_emc_debug_min_rate_set(void *data, u64 rate)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_DEBUGFS_ATTRIBUTE(tegra_emc_debug_min_rate_fops,
|
DEFINE_DEBUGFS_ATTRIBUTE(tegra124_emc_debug_min_rate_fops,
|
||||||
tegra_emc_debug_min_rate_get,
|
tegra124_emc_debug_min_rate_get,
|
||||||
tegra_emc_debug_min_rate_set, "%llu\n");
|
tegra124_emc_debug_min_rate_set, "%llu\n");
|
||||||
|
|
||||||
static int tegra_emc_debug_max_rate_get(void *data, u64 *rate)
|
static int tegra124_emc_debug_max_rate_get(void *data, u64 *rate)
|
||||||
{
|
{
|
||||||
struct tegra_emc *emc = data;
|
struct tegra_emc *emc = data;
|
||||||
|
|
||||||
@@ -1212,12 +1212,12 @@ static int tegra_emc_debug_max_rate_get(void *data, u64 *rate)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tegra_emc_debug_max_rate_set(void *data, u64 rate)
|
static int tegra124_emc_debug_max_rate_set(void *data, u64 rate)
|
||||||
{
|
{
|
||||||
struct tegra_emc *emc = data;
|
struct tegra_emc *emc = data;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!tegra_emc_validate_rate(emc, rate))
|
if (!tegra124_emc_validate_rate(emc, rate))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
err = emc_set_max_rate(emc, rate, EMC_RATE_DEBUG);
|
err = emc_set_max_rate(emc, rate, EMC_RATE_DEBUG);
|
||||||
@@ -1229,9 +1229,9 @@ static int tegra_emc_debug_max_rate_set(void *data, u64 rate)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_DEBUGFS_ATTRIBUTE(tegra_emc_debug_max_rate_fops,
|
DEFINE_DEBUGFS_ATTRIBUTE(tegra124_emc_debug_max_rate_fops,
|
||||||
tegra_emc_debug_max_rate_get,
|
tegra124_emc_debug_max_rate_get,
|
||||||
tegra_emc_debug_max_rate_set, "%llu\n");
|
tegra124_emc_debug_max_rate_set, "%llu\n");
|
||||||
|
|
||||||
static void emc_debugfs_init(struct device *dev, struct tegra_emc *emc)
|
static void emc_debugfs_init(struct device *dev, struct tegra_emc *emc)
|
||||||
{
|
{
|
||||||
@@ -1266,11 +1266,11 @@ static void emc_debugfs_init(struct device *dev, struct tegra_emc *emc)
|
|||||||
emc->debugfs.root = debugfs_create_dir("emc", NULL);
|
emc->debugfs.root = debugfs_create_dir("emc", NULL);
|
||||||
|
|
||||||
debugfs_create_file("available_rates", 0444, emc->debugfs.root, emc,
|
debugfs_create_file("available_rates", 0444, emc->debugfs.root, emc,
|
||||||
&tegra_emc_debug_available_rates_fops);
|
&tegra124_emc_debug_available_rates_fops);
|
||||||
debugfs_create_file("min_rate", 0644, emc->debugfs.root,
|
debugfs_create_file("min_rate", 0644, emc->debugfs.root,
|
||||||
emc, &tegra_emc_debug_min_rate_fops);
|
emc, &tegra124_emc_debug_min_rate_fops);
|
||||||
debugfs_create_file("max_rate", 0644, emc->debugfs.root,
|
debugfs_create_file("max_rate", 0644, emc->debugfs.root,
|
||||||
emc, &tegra_emc_debug_max_rate_fops);
|
emc, &tegra124_emc_debug_max_rate_fops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct tegra_emc *
|
static inline struct tegra_emc *
|
||||||
@@ -1334,7 +1334,7 @@ static int emc_icc_set(struct icc_node *src, struct icc_node *dst)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tegra_emc_interconnect_init(struct tegra_emc *emc)
|
static int tegra124_emc_interconnect_init(struct tegra_emc *emc)
|
||||||
{
|
{
|
||||||
const struct tegra_mc_soc *soc = emc->mc->soc;
|
const struct tegra_mc_soc *soc = emc->mc->soc;
|
||||||
struct icc_node *node;
|
struct icc_node *node;
|
||||||
@@ -1383,7 +1383,7 @@ remove_nodes:
|
|||||||
return dev_err_probe(emc->dev, err, "failed to initialize ICC\n");
|
return dev_err_probe(emc->dev, err, "failed to initialize ICC\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tegra_emc_opp_table_init(struct tegra_emc *emc)
|
static int tegra124_emc_opp_table_init(struct tegra_emc *emc)
|
||||||
{
|
{
|
||||||
u32 hw_version = BIT(tegra_sku_info.soc_speedo_id);
|
u32 hw_version = BIT(tegra_sku_info.soc_speedo_id);
|
||||||
int opp_token, err;
|
int opp_token, err;
|
||||||
@@ -1425,12 +1425,12 @@ put_hw_table:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void devm_tegra_emc_unset_callback(void *data)
|
static void devm_tegra124_emc_unset_callback(void *data)
|
||||||
{
|
{
|
||||||
tegra124_clk_set_emc_callbacks(NULL, NULL);
|
tegra124_clk_set_emc_callbacks(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tegra_emc_probe(struct platform_device *pdev)
|
static int tegra124_emc_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
struct tegra_emc *emc;
|
struct tegra_emc *emc;
|
||||||
@@ -1454,9 +1454,9 @@ static int tegra_emc_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
ram_code = tegra_read_ram_code();
|
ram_code = tegra_read_ram_code();
|
||||||
|
|
||||||
np = tegra_emc_find_node_by_ram_code(pdev->dev.of_node, ram_code);
|
np = tegra124_emc_find_node_by_ram_code(pdev->dev.of_node, ram_code);
|
||||||
if (np) {
|
if (np) {
|
||||||
err = tegra_emc_load_timings_from_dt(emc, np);
|
err = tegra124_emc_load_timings_from_dt(emc, np);
|
||||||
of_node_put(np);
|
of_node_put(np);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
@@ -1470,10 +1470,10 @@ static int tegra_emc_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
platform_set_drvdata(pdev, emc);
|
platform_set_drvdata(pdev, emc);
|
||||||
|
|
||||||
tegra124_clk_set_emc_callbacks(tegra_emc_prepare_timing_change,
|
tegra124_clk_set_emc_callbacks(tegra124_emc_prepare_timing_change,
|
||||||
tegra_emc_complete_timing_change);
|
tegra124_emc_complete_timing_change);
|
||||||
|
|
||||||
err = devm_add_action_or_reset(&pdev->dev, devm_tegra_emc_unset_callback,
|
err = devm_add_action_or_reset(&pdev->dev, devm_tegra124_emc_unset_callback,
|
||||||
NULL);
|
NULL);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
@@ -1483,16 +1483,16 @@ static int tegra_emc_probe(struct platform_device *pdev)
|
|||||||
return dev_err_probe(&pdev->dev, PTR_ERR(emc->clk),
|
return dev_err_probe(&pdev->dev, PTR_ERR(emc->clk),
|
||||||
"failed to get EMC clock\n");
|
"failed to get EMC clock\n");
|
||||||
|
|
||||||
err = tegra_emc_opp_table_init(emc);
|
err = tegra124_emc_opp_table_init(emc);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
tegra_emc_rate_requests_init(emc);
|
tegra124_emc_rate_requests_init(emc);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_DEBUG_FS))
|
if (IS_ENABLED(CONFIG_DEBUG_FS))
|
||||||
emc_debugfs_init(&pdev->dev, emc);
|
emc_debugfs_init(&pdev->dev, emc);
|
||||||
|
|
||||||
tegra_emc_interconnect_init(emc);
|
tegra124_emc_interconnect_init(emc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't allow the kernel module to be unloaded. Unloading adds some
|
* Don't allow the kernel module to be unloaded. Unloading adds some
|
||||||
@@ -1504,16 +1504,16 @@ static int tegra_emc_probe(struct platform_device *pdev)
|
|||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct platform_driver tegra_emc_driver = {
|
static struct platform_driver tegra124_emc_driver = {
|
||||||
.probe = tegra_emc_probe,
|
.probe = tegra124_emc_probe,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "tegra-emc",
|
.name = "tegra-emc",
|
||||||
.of_match_table = tegra_emc_of_match,
|
.of_match_table = tegra124_emc_of_match,
|
||||||
.suppress_bind_attrs = true,
|
.suppress_bind_attrs = true,
|
||||||
.sync_state = icc_sync_state,
|
.sync_state = icc_sync_state,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
module_platform_driver(tegra_emc_driver);
|
module_platform_driver(tegra124_emc_driver);
|
||||||
|
|
||||||
MODULE_AUTHOR("Mikko Perttunen <mperttunen@nvidia.com>");
|
MODULE_AUTHOR("Mikko Perttunen <mperttunen@nvidia.com>");
|
||||||
MODULE_DESCRIPTION("NVIDIA Tegra124 EMC driver");
|
MODULE_DESCRIPTION("NVIDIA Tegra124 EMC driver");
|
||||||
|
|||||||
Reference in New Issue
Block a user