ARM: at91: pm: add support for sam9x7 SoC family
authorVarshini Rajendran <varshini.rajendran@microchip.com>
Mon, 29 Jul 2024 07:06:59 +0000 (12:36 +0530)
committerClaudiu Beznea <claudiu.beznea@tuxon.dev>
Wed, 7 Aug 2024 16:24:44 +0000 (19:24 +0300)
Add support and pm init config for sam9x7 SoC.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20240729070659.1990506-1-varshini.rajendran@microchip.com
Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
arch/arm/mach-at91/generic.h
arch/arm/mach-at91/pm.c

index 0c3960a..acf0b3c 100644 (file)
@@ -12,6 +12,7 @@
 extern void __init at91rm9200_pm_init(void);
 extern void __init at91sam9_pm_init(void);
 extern void __init sam9x60_pm_init(void);
+extern void __init sam9x7_pm_init(void);
 extern void __init sama5_pm_init(void);
 extern void __init sama5d2_pm_init(void);
 extern void __init sama7_pm_init(void);
@@ -19,6 +20,7 @@ extern void __init sama7_pm_init(void);
 static inline void __init at91rm9200_pm_init(void) { }
 static inline void __init at91sam9_pm_init(void) { }
 static inline void __init sam9x60_pm_init(void) { }
+static inline void __init sam9x7_pm_init(void) { }
 static inline void __init sama5_pm_init(void) { }
 static inline void __init sama5d2_pm_init(void) { }
 static inline void __init sama7_pm_init(void) { }
index 345b91d..b9b995f 100644 (file)
@@ -233,6 +233,13 @@ static const struct of_device_id sama7g5_ws_ids[] = {
        { /* sentinel */ }
 };
 
+static const struct of_device_id sam9x7_ws_ids[] = {
+       { .compatible = "microchip,sam9x7-rtc",         .data = &ws_info[1] },
+       { .compatible = "microchip,sam9x7-rtt",         .data = &ws_info[4] },
+       { .compatible = "microchip,sam9x7-gem",         .data = &ws_info[5] },
+       { /* sentinel */ }
+};
+
 static int at91_pm_config_ws(unsigned int pm_mode, bool set)
 {
        const struct wakeup_source_info *wsi;
@@ -1361,6 +1368,7 @@ static const struct of_device_id atmel_pmc_ids[] __initconst = {
        { .compatible = "atmel,sama5d4-pmc", .data = &pmc_infos[1] },
        { .compatible = "atmel,sama5d2-pmc", .data = &pmc_infos[1] },
        { .compatible = "microchip,sam9x60-pmc", .data = &pmc_infos[4] },
+       { .compatible = "microchip,sam9x7-pmc", .data = &pmc_infos[4] },
        { .compatible = "microchip,sama7g5-pmc", .data = &pmc_infos[5] },
        { /* sentinel */ },
 };
@@ -1499,6 +1507,27 @@ void __init sam9x60_pm_init(void)
        soc_pm.config_pmc_ws = at91_sam9x60_config_pmc_ws;
 }
 
+void __init sam9x7_pm_init(void)
+{
+       static const int modes[] __initconst = {
+               AT91_PM_STANDBY, AT91_PM_ULP0,
+       };
+       int ret;
+
+       if (!IS_ENABLED(CONFIG_SOC_SAM9X7))
+               return;
+
+       at91_pm_modes_validate(modes, ARRAY_SIZE(modes));
+       ret = at91_dt_ramc(false);
+       if (ret)
+               return;
+
+       at91_pm_init(NULL);
+
+       soc_pm.ws_ids = sam9x7_ws_ids;
+       soc_pm.config_pmc_ws = at91_sam9x60_config_pmc_ws;
+}
+
 void __init at91sam9_pm_init(void)
 {
        int ret;