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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEE3dJiKD0RGyM7briowTdm5oaLg9cFAmTA3VAQHGtyemtAa2Vy
 bmVsLm9yZwAKCRDBN2bmhouD1zj9D/4peXLyTUWFArNLAaq3PbOHQRuPbC1MMdWN
 VRCqjDVGNXEYPnbh1b2kMhi2iwoBk9HeAt6HFYHgABdNZBK5VBUMDuJnT1ocNExD
 8OBV3qAM+ia3TqOlhE5PVGiMudhd1R020/tIrzHB+YaiT2JpqKXo8nlXVfhwti1c
 yyZmIAmi9uQkC3Zn7R+5I0A5atNLa7BXAmpy8A/l7K8ojwnAxiJLXAI/+YHs0moW
 GPB9Nk4oYzEJDyQESKNK0ddvggwaZNCbK+wIBcEBFXXvybVr72pMYSeIG+UNpTf+
 uwc5nxgHwhqNTxO4WtGYpVuAA8uPelJ4YIbcEdoJoNn5/dfzdiBYhetWPquOBMxN
 p1BIVx/pFujzAAjY2VvPAEbSxctMUKmLmRRAbJC3II633JxjwKahVMTOCslvtuSr
 /jbChJ4Ih2RL15qMmj2O/mP2qjivG/HoywtG3Rp4w5E6CfWXs3b6ytEKdifW9IEk
 GjctklZm1E8Jz+nVhmPfm1A+pLxG80RMEgV9kp5bEjdeNjE/SQByTlhCxP/1SSHA
 yT4RO3GFdBFKjpfl2xK1f74ml/ZA9KOu8WO+laD0gZVfMzX68wQWc2jIpJYtPhtO
 p8n8zzC2fEbzvY1Adth7XR79P1e/3yp2NZv1vTRIP6T4y+d8e2v2mqNxZxH/SFRj
 PS2KDX7VMw==
 =1ARR
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmTCc+YACgkQYKtH/8kJ
 UifQjQ//bIgDWLc6LsU0wnF8CEScqAxvTmXMXq0tp8o55uvUjdCjdNHRkrxQuPff
 /vfXJAhzvLlsovR/DghTeex8V1O1285TDt20J0UXXA7PdGTzvpjjW/+qH8OmmRDV
 IvP8WUWHHbgazJZaayYMLn5uAf1Ofz8ZzTkbrdYKQ9eORhwdMWC6bDNJHZF2cxEa
 X82FGvYL270x4IhIQpt5yg5aDFKCX6n/SEYb8H3kX61qb1TIQ1Yo3Fsr0Wr7L/1Y
 6esl0zmMo7k0Jv9+9wA3u6AhYoYq6F9EvaQk9MdizG2h44o7MiO7SrSoEHuFbMbp
 NAyah59WSSiFV3GL9oKchgKFVqXwqiF0YZJyNTetbg70AK3Q9Yu0CDVuQFKvLtkN
 jh3t3XxBkX8YizDQQCCkxULEaqR2UpamoHXnnt84L4g92hYRLv0wXGWLQrAxKzIP
 jU+foYfkAfglfpdGI9pvz0gqdsvTfmFKKoLdlkCwgckWkydq9ZuVkAmuYFN17v2o
 /ihwqgZHFBZeXbLGmplb0uAHOJ7NymyNjVOSK+1C7m1WOcX4k43/MGk8KVYTuWXF
 V7PwiG2miUbUwkqRTUTsu+S4G7rF5MM8NoT8jLWHvlVqdig8Z5hbyvV2jPaLgEbT
 Z0lpoRNhBa5UP1Wgu0LNkuHPPCA7J0VVqnTCf1Wj7HrS7/rn57M=
 =NC+w
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Arnd Bergmann 2023-07-27 15:40:53 +02:00
commit b1e052903c
4 changed files with 44 additions and 24 deletions

View File

@ -755,6 +755,43 @@ const char *const tegra_mc_error_names[8] = {
[6] = "SMMU translation error",
};
struct icc_node *tegra_mc_icc_xlate(struct of_phandle_args *spec, void *data)
{
struct tegra_mc *mc = icc_provider_to_tegra_mc(data);
struct icc_node *node;
list_for_each_entry(node, &mc->provider.nodes, node_list) {
if (node->id == spec->args[0])
return node;
}
/*
* If a client driver calls devm_of_icc_get() before the MC driver
* is probed, then return EPROBE_DEFER to the client driver.
*/
return ERR_PTR(-EPROBE_DEFER);
}
static int tegra_mc_icc_get(struct icc_node *node, u32 *average, u32 *peak)
{
*average = 0;
*peak = 0;
return 0;
}
static int tegra_mc_icc_set(struct icc_node *src, struct icc_node *dst)
{
return 0;
}
const struct tegra_mc_icc_ops tegra_mc_icc_ops = {
.xlate = tegra_mc_icc_xlate,
.aggregate = icc_std_aggregate,
.get_bw = tegra_mc_icc_get,
.set = tegra_mc_icc_set,
};
/*
* Memory Controller (MC) has few Memory Clients that are issuing memory
* bandwidth allocation requests to the MC interconnect provider. The MC

View File

@ -1355,6 +1355,7 @@ const struct tegra_mc_soc tegra194_mc_soc = {
MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
.has_addr_hi_reg = true,
.ops = &tegra186_mc_ops,
.icc_ops = &tegra_mc_icc_ops,
.ch_intmask = 0x00000f00,
.global_intstatus_channel_shift = 8,
};

View File

@ -827,7 +827,7 @@ static int tegra234_mc_icc_set(struct icc_node *src, struct icc_node *dst)
return 0;
if (!mc->bwmgr_mrq_supported)
return -EINVAL;
return 0;
if (!mc->bpmp) {
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,
struct tegra_mc *mc = icc_provider_to_tegra_mc(p);
if (!mc->bwmgr_mrq_supported)
return -EINVAL;
return 0;
if (node->id == TEGRA_ICC_MC_CPU_CLUSTER0 ||
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,
return 0;
}
static struct icc_node*
tegra234_mc_of_icc_xlate(struct of_phandle_args *spec, void *data)
{
struct tegra_mc *mc = icc_provider_to_tegra_mc(data);
unsigned int cl_id = spec->args[0];
struct icc_node *node;
list_for_each_entry(node, &mc->provider.nodes, node_list) {
if (node->id != cl_id)
continue;
return node;
}
/*
* If a client driver calls devm_of_icc_get() before the MC driver
* is probed, then return EPROBE_DEFER to the client driver.
*/
return ERR_PTR(-EPROBE_DEFER);
}
static int tegra234_mc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *peak)
{
*avg = 0;
@ -919,7 +898,7 @@ static int tegra234_mc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *pea
}
static const struct tegra_mc_icc_ops tegra234_mc_icc_ops = {
.xlate = tegra234_mc_of_icc_xlate,
.xlate = tegra_mc_icc_xlate,
.aggregate = tegra234_mc_icc_aggregate,
.get_bw = tegra234_mc_icc_get_init_bw,
.set = tegra234_mc_icc_set,

View File

@ -175,6 +175,9 @@ struct tegra_mc_icc_ops {
int (*get_bw)(struct icc_node *node, u32 *avg, u32 *peak);
};
struct icc_node *tegra_mc_icc_xlate(struct of_phandle_args *spec, void *data);
extern const struct tegra_mc_icc_ops tegra_mc_icc_ops;
struct tegra_mc_ops {
/*
* @probe: Callback to set up SoC-specific bits of the memory controller. This is called