Skip to content

Commit ccd8e76

Browse files
petlozupthierryreding
authored andcommitted
soc/tegra: pmc: Update scratch as an optional aperture
Scratch address space register is used to store reboot reason. For some Tegra234 systems, the scratch space is not available to store the reboot reason. This is because scratch region on these systems is not accessible by the kernel as restricted by the Hypervisor. Such systems would delist scratch aperture from PMC DT node. Hence this change makes scratch as optional aperture and also avoids registering reboot notifier if scratch address space isn't mapped. Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
1 parent 6f4429e commit ccd8e76

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

drivers/soc/tegra/pmc.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2903,11 +2903,16 @@ static int tegra_pmc_probe(struct platform_device *pdev)
29032903
if (IS_ERR(pmc->aotag))
29042904
return PTR_ERR(pmc->aotag);
29052905

2906+
/* "scratch" is an optional aperture */
29062907
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
29072908
"scratch");
2908-
pmc->scratch = devm_ioremap_resource(&pdev->dev, res);
2909-
if (IS_ERR(pmc->scratch))
2910-
return PTR_ERR(pmc->scratch);
2909+
if (res) {
2910+
pmc->scratch = devm_ioremap_resource(&pdev->dev, res);
2911+
if (IS_ERR(pmc->scratch))
2912+
return PTR_ERR(pmc->scratch);
2913+
} else {
2914+
pmc->scratch = NULL;
2915+
}
29112916
}
29122917

29132918
pmc->clk = devm_clk_get_optional(&pdev->dev, "pclk");
@@ -2919,12 +2924,15 @@ static int tegra_pmc_probe(struct platform_device *pdev)
29192924
* PMC should be last resort for restarting since it soft-resets
29202925
* CPU without resetting everything else.
29212926
*/
2922-
err = devm_register_reboot_notifier(&pdev->dev,
2923-
&tegra_pmc_reboot_notifier);
2924-
if (err) {
2925-
dev_err(&pdev->dev, "unable to register reboot notifier, %d\n",
2926-
err);
2927-
return err;
2927+
if (pmc->scratch) {
2928+
err = devm_register_reboot_notifier(&pdev->dev,
2929+
&tegra_pmc_reboot_notifier);
2930+
if (err) {
2931+
dev_err(&pdev->dev,
2932+
"unable to register reboot notifier, %d\n",
2933+
err);
2934+
return err;
2935+
}
29282936
}
29292937

29302938
err = devm_register_sys_off_handler(&pdev->dev,

0 commit comments

Comments
 (0)