Skip to content

Commit b1e0529

Browse files
committed
Merge tag 'memory-controller-drv-fixes-6.5' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl into arm/fixes
Memory controller drivers - fixes for v6.5 Two fixes are needed for Tegra194 memory controllers caused by the same Tegra PCI commit merged in v6.5-rc1. The Tegra PCI requires now interconnect from the memory controller, which was set only for Tegra234, but not for Tegra194, causing probe deferrals. Expose some dummy interconnect provider for Tegra194, to satisfy PCI driver needs. * tag 'memory-controller-drv-fixes-6.5' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl: memory: tegra: make icc_set_bw return zero if BWMGR not supported memory: tegra: Add dummy implementation on Tegra194 Link: https://lore.kernel.org/r/20230726084811.124038-1-krzysztof.kozlowski@linaro.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents c05cfd7 + faafd6c commit b1e0529

File tree

4 files changed

+44
-24
lines changed

4 files changed

+44
-24
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: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ static int tegra234_mc_icc_set(struct icc_node *src, struct icc_node *dst)
827827
return 0;
828828

829829
if (!mc->bwmgr_mrq_supported)
830-
return -EINVAL;
830+
return 0;
831831

832832
if (!mc->bpmp) {
833833
dev_err(mc->dev, "BPMP reference NULL\n");
@@ -874,7 +874,7 @@ static int tegra234_mc_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
874874
struct tegra_mc *mc = icc_provider_to_tegra_mc(p);
875875

876876
if (!mc->bwmgr_mrq_supported)
877-
return -EINVAL;
877+
return 0;
878878

879879
if (node->id == TEGRA_ICC_MC_CPU_CLUSTER0 ||
880880
node->id == TEGRA_ICC_MC_CPU_CLUSTER1 ||
@@ -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)