Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

memory: tegra: Make per-SoC setup more generic

The current per-SoC setup code runs at a fairly arbitrary point during
probe, thereby making it less flexible for other SoC generations. Move
the call around slightly (after only the very basic, common setup that
applies to all SoC generations has been performed), which will allow
it to be used for other implementations.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20210602163302.120041-6-thierry.reding@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

authored by

Thierry Reding and committed by
Krzysztof Kozlowski
c64738e9 5c9016f0

+15 -12
+8 -9
drivers/memory/tegra/mc.c
··· 784 784 return PTR_ERR(mc->clk); 785 785 } 786 786 787 + mc->debugfs.root = debugfs_create_dir("mc", NULL); 788 + 789 + if (mc->soc->ops && mc->soc->ops->probe) { 790 + err = mc->soc->ops->probe(mc); 791 + if (err < 0) 792 + return err; 793 + } 794 + 787 795 #ifdef CONFIG_ARCH_TEGRA_2x_SOC 788 796 if (mc->soc == &tegra20_mc_soc) { 789 797 isr = tegra20_mc_irq; ··· 833 825 dev_err(&pdev->dev, "failed to request IRQ#%u: %d\n", mc->irq, 834 826 err); 835 827 return err; 836 - } 837 - 838 - mc->debugfs.root = debugfs_create_dir("mc", NULL); 839 - 840 - if (mc->soc->ops && mc->soc->ops->init) { 841 - err = mc->soc->ops->init(mc); 842 - if (err < 0) 843 - dev_err(&pdev->dev, "failed to initialize SoC driver: %d\n", 844 - err); 845 828 } 846 829 847 830 err = tegra_mc_reset_setup(mc);
+2 -2
drivers/memory/tegra/tegra20.c
··· 679 679 return 0; 680 680 } 681 681 682 - static int tegra20_mc_init(struct tegra_mc *mc) 682 + static int tegra20_mc_probe(struct tegra_mc *mc) 683 683 { 684 684 debugfs_create_devm_seqfile(mc->dev, "stats", mc->debugfs.root, 685 685 tegra20_mc_stats_show); ··· 714 714 } 715 715 716 716 static const struct tegra_mc_ops tegra20_mc_ops = { 717 - .init = tegra20_mc_init, 717 + .probe = tegra20_mc_probe, 718 718 .suspend = tegra20_mc_suspend, 719 719 .resume = tegra20_mc_resume, 720 720 };
+5 -1
include/soc/tegra/mc.h
··· 170 170 }; 171 171 172 172 struct tegra_mc_ops { 173 - int (*init)(struct tegra_mc *mc); 173 + /* 174 + * @probe: Callback to set up SoC-specific bits of the memory controller. This is called 175 + * after basic, common set up that is done by the SoC-agnostic bits. 176 + */ 177 + int (*probe)(struct tegra_mc *mc); 174 178 int (*suspend)(struct tegra_mc *mc); 175 179 int (*resume)(struct tegra_mc *mc); 176 180 };