Message ID | 20210420165237.3523732-5-thierry.reding@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | memory: tegra: Driver unification | expand |
On 20/04/2021 18:52, Thierry Reding wrote: > From: Thierry Reding <treding@nvidia.com> > > 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, which will allow it to be used for other > implementations. You moved from one arbitrary point to another - please therefore explain the rationale of new arbitrary point a little bit more (e.g. after clock initialization? before HW access?) and put it next to struct tegra_mc_ops. Best regards, Krzysztof
On Mon, Apr 26, 2021 at 10:49:52AM +0200, Krzysztof Kozlowski wrote: > On 20/04/2021 18:52, Thierry Reding wrote: > > From: Thierry Reding <treding@nvidia.com> > > > > 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, which will allow it to be used for other > > implementations. > > You moved from one arbitrary point to another - please therefore explain > the rationale of new arbitrary point a little bit more (e.g. after clock > initialization? before HW access?) and put it next to struct tegra_mc_ops. Okay, will do. Thierry
diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c index 2b21131d779c..a800982f4a94 100644 --- a/drivers/memory/tegra/mc.c +++ b/drivers/memory/tegra/mc.c @@ -784,6 +784,14 @@ static int tegra_mc_probe(struct platform_device *pdev) return PTR_ERR(mc->clk); } + mc->debugfs.root = debugfs_create_dir("mc", NULL); + + if (mc->soc->ops && mc->soc->ops->probe) { + err = mc->soc->ops->probe(mc); + if (err < 0) + return err; + } + #ifdef CONFIG_ARCH_TEGRA_2x_SOC if (mc->soc == &tegra20_mc_soc) { isr = tegra20_mc_irq; @@ -827,15 +835,6 @@ static int tegra_mc_probe(struct platform_device *pdev) return err; } - mc->debugfs.root = debugfs_create_dir("mc", NULL); - - if (mc->soc->ops && mc->soc->ops->init) { - err = mc->soc->ops->init(mc); - if (err < 0) - dev_err(&pdev->dev, "failed to initialize SoC driver: %d\n", - err); - } - err = tegra_mc_reset_setup(mc); if (err < 0) dev_err(&pdev->dev, "failed to register reset controller: %d\n", diff --git a/drivers/memory/tegra/tegra20.c b/drivers/memory/tegra/tegra20.c index a3335ad20f4d..2c86c0d70d59 100644 --- a/drivers/memory/tegra/tegra20.c +++ b/drivers/memory/tegra/tegra20.c @@ -679,7 +679,7 @@ static int tegra20_mc_stats_show(struct seq_file *s, void *unused) return 0; } -static int tegra20_mc_init(struct tegra_mc *mc) +static int tegra20_mc_probe(struct tegra_mc *mc) { debugfs_create_devm_seqfile(mc->dev, "stats", mc->debugfs.root, tegra20_mc_stats_show); @@ -714,7 +714,7 @@ static int tegra20_mc_resume(struct tegra_mc *mc) } static const struct tegra_mc_ops tegra20_mc_ops = { - .init = tegra20_mc_init, + .probe = tegra20_mc_probe, .suspend = tegra20_mc_suspend, .resume = tegra20_mc_resume, }; diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h index 7c49f75087c3..fd19df3eb529 100644 --- a/include/soc/tegra/mc.h +++ b/include/soc/tegra/mc.h @@ -170,7 +170,7 @@ struct tegra_mc_icc_ops { }; struct tegra_mc_ops { - int (*init)(struct tegra_mc *mc); + int (*probe)(struct tegra_mc *mc); int (*suspend)(struct tegra_mc *mc); int (*resume)(struct tegra_mc *mc); };