Skip to content

Commit d1478ae

Browse files
thierryredingkrzk
authored andcommitted
memory: tegra: Add dummy implementation on Tegra194
With the introduction of commit 9365bf0 ("PCI: tegra194: Add interconnect support in Tegra234"), the PCI driver on Tegra194 and later requires an interconnect provider. However, a provider is currently only exposed on Tegra234 and this causes PCI on Tegra194 to defer probe indefinitely. Fix this by adding a dummy implementation on Tegra194. This allows nodes to be provided to interconnect consumers, but doesn't do any bandwidth accounting or frequency scaling. Fixes: 9365bf0 ("PCI: tegra194: Add interconnect support in Tegra234") Reported-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Sumit Gupta <sumitg@nvidia.com> Tested-by: Sumit Gupta <sumitg@nvidia.com> Link: https://lore.kernel.org/r/20230629160132.768940-1-thierry.reding@gmail.com Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
1 parent 06c2afb commit d1478ae

File tree

4 files changed

+42
-22
lines changed

4 files changed

+42
-22
lines changed

drivers/memory/tegra/mc.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,43 @@ const char *const tegra_mc_error_names[8] = {
755755
[6] = "SMMU translation error",
756756
};
757757

758+
struct icc_node *tegra_mc_icc_xlate(struct of_phandle_args *spec, void *data)
759+
{
760+
struct tegra_mc *mc = icc_provider_to_tegra_mc(data);
761+
struct icc_node *node;
762+
763+
list_for_each_entry(node, &mc->provider.nodes, node_list) {
764+
if (node->id == spec->args[0])
765+
return node;
766+
}
767+
768+
/*
769+
* If a client driver calls devm_of_icc_get() before the MC driver
770+
* is probed, then return EPROBE_DEFER to the client driver.
771+
*/
772+
return ERR_PTR(-EPROBE_DEFER);
773+
}
774+
775+
static int tegra_mc_icc_get(struct icc_node *node, u32 *average, u32 *peak)
776+
{
777+
*average = 0;
778+
*peak = 0;
779+
780+
return 0;
781+
}
782+
783+
static int tegra_mc_icc_set(struct icc_node *src, struct icc_node *dst)
784+
{
785+
return 0;
786+
}
787+
788+
const struct tegra_mc_icc_ops tegra_mc_icc_ops = {
789+
.xlate = tegra_mc_icc_xlate,
790+
.aggregate = icc_std_aggregate,
791+
.get_bw = tegra_mc_icc_get,
792+
.set = tegra_mc_icc_set,
793+
};
794+
758795
/*
759796
* Memory Controller (MC) has few Memory Clients that are issuing memory
760797
* bandwidth allocation requests to the MC interconnect provider. The MC

drivers/memory/tegra/tegra194.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,7 @@ const struct tegra_mc_soc tegra194_mc_soc = {
13551355
MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
13561356
.has_addr_hi_reg = true,
13571357
.ops = &tegra186_mc_ops,
1358+
.icc_ops = &tegra_mc_icc_ops,
13581359
.ch_intmask = 0x00000f00,
13591360
.global_intstatus_channel_shift = 8,
13601361
};

drivers/memory/tegra/tegra234.c

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -889,27 +889,6 @@ static int tegra234_mc_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
889889
return 0;
890890
}
891891

892-
static struct icc_node*
893-
tegra234_mc_of_icc_xlate(struct of_phandle_args *spec, void *data)
894-
{
895-
struct tegra_mc *mc = icc_provider_to_tegra_mc(data);
896-
unsigned int cl_id = spec->args[0];
897-
struct icc_node *node;
898-
899-
list_for_each_entry(node, &mc->provider.nodes, node_list) {
900-
if (node->id != cl_id)
901-
continue;
902-
903-
return node;
904-
}
905-
906-
/*
907-
* If a client driver calls devm_of_icc_get() before the MC driver
908-
* is probed, then return EPROBE_DEFER to the client driver.
909-
*/
910-
return ERR_PTR(-EPROBE_DEFER);
911-
}
912-
913892
static int tegra234_mc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *peak)
914893
{
915894
*avg = 0;
@@ -919,7 +898,7 @@ static int tegra234_mc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *pea
919898
}
920899

921900
static const struct tegra_mc_icc_ops tegra234_mc_icc_ops = {
922-
.xlate = tegra234_mc_of_icc_xlate,
901+
.xlate = tegra_mc_icc_xlate,
923902
.aggregate = tegra234_mc_icc_aggregate,
924903
.get_bw = tegra234_mc_icc_get_init_bw,
925904
.set = tegra234_mc_icc_set,

include/soc/tegra/mc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ struct tegra_mc_icc_ops {
175175
int (*get_bw)(struct icc_node *node, u32 *avg, u32 *peak);
176176
};
177177

178+
struct icc_node *tegra_mc_icc_xlate(struct of_phandle_args *spec, void *data);
179+
extern const struct tegra_mc_icc_ops tegra_mc_icc_ops;
180+
178181
struct tegra_mc_ops {
179182
/*
180183
* @probe: Callback to set up SoC-specific bits of the memory controller. This is called

0 commit comments

Comments
 (0)