memory: tegra: Add SID override programming for MC clients
authorAshish Mhetre <amhetre@nvidia.com>
Tue, 7 Nov 2023 11:27:12 +0000 (16:57 +0530)
committerKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tue, 21 Nov 2023 09:09:28 +0000 (10:09 +0100)
For some devices the bootloader/firmware may set up the device in
bypass. Memory clients like display needs kernel to program SID after
resume because bootloader/firmware programs the SID of display device to
bypass. In order to make sure that kernel IOMMU mappings for these
devices work after resume, add SID override programming support for all
memory clients on memory controller resume.

This partially reverts 'commit ef86b2c2807f ("memory: tegra: Remove
clients SID override programming")'

Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
Link: https://lore.kernel.org/r/20231107112713.21399-1-amhetre@nvidia.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
drivers/memory/tegra/tegra186.c
include/soc/tegra/mc.h

index 533f85a4b2bdb7ee24175d0b4be3be9e560cb029..8203f0db1350bd2a6fe7080cfb9c4e888a7da494 100644 (file)
@@ -136,9 +136,23 @@ static int tegra186_mc_probe_device(struct tegra_mc *mc, struct device *dev)
        return 0;
 }
 
+static int tegra186_mc_resume(struct tegra_mc *mc)
+{
+       unsigned int i;
+
+       for (i = 0; i < mc->soc->num_clients; i++) {
+               const struct tegra_mc_client *client = &mc->soc->clients[i];
+
+               tegra186_mc_client_sid_override(mc, client, client->sid);
+       }
+
+       return 0;
+}
+
 const struct tegra_mc_ops tegra186_mc_ops = {
        .probe = tegra186_mc_probe,
        .remove = tegra186_mc_remove,
+       .resume = tegra186_mc_resume,
        .probe_device = tegra186_mc_probe_device,
        .handle_irq = tegra30_mc_handle_irq,
 };
index 71ae37d3bedd76e38297be9bad03c26e896ddbba..af1d73a7f0cd10736e2e403be2f3e3942f1687a7 100644 (file)
@@ -162,6 +162,7 @@ struct tegra_mc_ops {
         */
        int (*probe)(struct tegra_mc *mc);
        void (*remove)(struct tegra_mc *mc);
+       int (*resume)(struct tegra_mc *mc);
        irqreturn_t (*handle_irq)(int irq, void *data);
        int (*probe_device)(struct tegra_mc *mc, struct device *dev);
 };