1 From bbbbf16c44f34a2d563fa7d71de64ffe3b4b82dc Mon Sep 17 00:00:00 2001
2 From: Claudiu Beznea <claudiu.beznea@microchip.com>
3 Date: Thu, 15 Apr 2021 13:50:04 +0300
4 Subject: [PATCH 213/247] ARM: at91: pm: add sama7g5 ddr phy controller
6 SAMA7G5 self-refresh procedure accesses also the DDR PHY registers.
7 Adapt the code so that the at91_dt_ramc() to look also for DDR PHYs,
8 in case it is mandatory.
10 Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
11 Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
12 Link: https://lore.kernel.org/r/20210415105010.569620-19-claudiu.beznea@microchip.com
14 arch/arm/mach-at91/pm.c | 27 +++++++++++++++++++++------
15 1 file changed, 21 insertions(+), 6 deletions(-)
17 diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
18 index 622d68724c3f..b047a1f2ddfb 100644
19 --- a/arch/arm/mach-at91/pm.c
20 +++ b/arch/arm/mach-at91/pm.c
21 @@ -552,7 +552,12 @@ static const struct of_device_id ramc_ids[] __initconst = {
25 -static __init int at91_dt_ramc(void)
26 +static const struct of_device_id ramc_phy_ids[] __initconst = {
27 + { .compatible = "microchip,sama7g5-ddr3phy", },
28 + { /* Sentinel. */ },
31 +static __init void at91_dt_ramc(bool phy_mandatory)
33 struct device_node *np;
34 const struct of_device_id *of_id;
35 @@ -585,6 +590,16 @@ static __init int at91_dt_ramc(void)
39 + /* Lookup for DDR PHY node, if any. */
40 + for_each_matching_node_and_match(np, ramc_phy_ids, &of_id) {
41 + soc_pm.data.ramc_phy = of_iomap(np, 0);
42 + if (!soc_pm.data.ramc_phy)
43 + panic(pr_fmt("unable to map ramc phy cpu registers\n"));
46 + if (phy_mandatory && !soc_pm.data.ramc_phy)
47 + panic(pr_fmt("DDR PHY is mandatory!\n"));
50 pr_warn("ramc no standby function available\n");
52 @@ -953,7 +968,7 @@ void __init at91rm9200_pm_init(void)
53 soc_pm.data.standby_mode = AT91_PM_STANDBY;
54 soc_pm.data.suspend_mode = AT91_PM_ULP0;
56 - ret = at91_dt_ramc();
57 + ret = at91_dt_ramc(false);
61 @@ -980,7 +995,7 @@ void __init sam9x60_pm_init(void)
63 at91_pm_modes_validate(modes, ARRAY_SIZE(modes));
64 at91_pm_modes_init(iomaps, ARRAY_SIZE(iomaps));
65 - ret = at91_dt_ramc();
66 + ret = at91_dt_ramc(false);
70 @@ -1005,7 +1020,7 @@ void __init at91sam9_pm_init(void)
71 soc_pm.data.standby_mode = AT91_PM_STANDBY;
72 soc_pm.data.suspend_mode = AT91_PM_ULP0;
74 - ret = at91_dt_ramc();
75 + ret = at91_dt_ramc(false);
79 @@ -1023,7 +1038,7 @@ void __init sama5_pm_init(void)
82 at91_pm_modes_validate(modes, ARRAY_SIZE(modes));
83 - ret = at91_dt_ramc();
84 + ret = at91_dt_ramc(false);
88 @@ -1048,7 +1063,7 @@ void __init sama5d2_pm_init(void)
90 at91_pm_modes_validate(modes, ARRAY_SIZE(modes));
91 at91_pm_modes_init(iomaps, ARRAY_SIZE(iomaps));
92 - ret = at91_dt_ramc();
93 + ret = at91_dt_ramc(false);