Skip to content

Commit 8d446ff

Browse files
committed
Merge tag 'memory-controller-drv-6.8' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl into soc/drivers
Memory controller drivers for v6.8 Few improvements for Tegra Memory Controller: Override the SID programming in the device, if firmware or bootloader left it in bypass mode, e.g. after resuming from suspend. Skip prorgamming the SID, if given Memory Controller client does not support it. * tag 'memory-controller-drv-6.8' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl: memory: tegra: Protect SID override call under CONFIG_IOMMU_API memory: tegra: Skip SID programming if SID registers aren't set memory: tegra: Add SID override programming for MC clients Link: https://lore.kernel.org/r/20231213061523.4803-1-krzysztof.kozlowski@linaro.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents 41ab5e1 + 4a23d0f commit 8d446ff

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

drivers/memory/tegra/tegra186.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ static void tegra186_mc_client_sid_override(struct tegra_mc *mc,
7575
{
7676
u32 value, old;
7777

78+
if (client->regs.sid.security == 0 && client->regs.sid.override == 0)
79+
return;
80+
7881
value = readl(mc->regs + client->regs.sid.security);
7982
if ((value & MC_SID_STREAMID_SECURITY_OVERRIDE) == 0) {
8083
/*
@@ -136,9 +139,25 @@ static int tegra186_mc_probe_device(struct tegra_mc *mc, struct device *dev)
136139
return 0;
137140
}
138141

142+
static int tegra186_mc_resume(struct tegra_mc *mc)
143+
{
144+
#if IS_ENABLED(CONFIG_IOMMU_API)
145+
unsigned int i;
146+
147+
for (i = 0; i < mc->soc->num_clients; i++) {
148+
const struct tegra_mc_client *client = &mc->soc->clients[i];
149+
150+
tegra186_mc_client_sid_override(mc, client, client->sid);
151+
}
152+
#endif
153+
154+
return 0;
155+
}
156+
139157
const struct tegra_mc_ops tegra186_mc_ops = {
140158
.probe = tegra186_mc_probe,
141159
.remove = tegra186_mc_remove,
160+
.resume = tegra186_mc_resume,
142161
.probe_device = tegra186_mc_probe_device,
143162
.handle_irq = tegra30_mc_handle_irq,
144163
};

include/soc/tegra/mc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ struct tegra_mc_ops {
162162
*/
163163
int (*probe)(struct tegra_mc *mc);
164164
void (*remove)(struct tegra_mc *mc);
165+
int (*resume)(struct tegra_mc *mc);
165166
irqreturn_t (*handle_irq)(int irq, void *data);
166167
int (*probe_device)(struct tegra_mc *mc, struct device *dev);
167168
};

0 commit comments

Comments
 (0)