From e58cd453d58b20c6a6f34d3591640aa19aa14d25 Mon Sep 17 00:00:00 2001 From: Claudiu Beznea Date: Fri, 4 Feb 2022 15:57:50 +0200 Subject: at91: add kernel support for sama7g5 soc Add kernel support for SAMA7G5 by back-porting mainline kernel patches. Among SAMA7G5 features could be remembered: - ARM Cortex-A7 - double data rate multi-port dynamic RAM controller supporting DDR2, DDR3, DDR3L, LPDDR2, LPDDR3 up to 533MHz - peripherals for audio, video processing - 1 gigabit + 1 megabit Ethernet controllers - 6 CAN controllers - trust zone support - DVFS for CPU - criptography IPs Signed-off-by: Claudiu Beznea --- ...18-ARM-at91-pm-add-pm-support-for-SAMA7G5.patch | 105 +++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 target/linux/at91/patches-5.10/218-ARM-at91-pm-add-pm-support-for-SAMA7G5.patch (limited to 'target/linux/at91/patches-5.10/218-ARM-at91-pm-add-pm-support-for-SAMA7G5.patch') diff --git a/target/linux/at91/patches-5.10/218-ARM-at91-pm-add-pm-support-for-SAMA7G5.patch b/target/linux/at91/patches-5.10/218-ARM-at91-pm-add-pm-support-for-SAMA7G5.patch new file mode 100644 index 0000000000..c6dc471346 --- /dev/null +++ b/target/linux/at91/patches-5.10/218-ARM-at91-pm-add-pm-support-for-SAMA7G5.patch @@ -0,0 +1,105 @@ +From aba3984dc7a405d20b83bff603d23719d0e26bc7 Mon Sep 17 00:00:00 2001 +From: Claudiu Beznea +Date: Thu, 15 Apr 2021 13:50:09 +0300 +Subject: [PATCH 218/247] ARM: at91: pm: add pm support for SAMA7G5 + +Add support for SAMA7G5 power management modes: standby, ulp0, ulp1, backup. + +Signed-off-by: Claudiu Beznea +Signed-off-by: Nicolas Ferre +Link: https://lore.kernel.org/r/20210415105010.569620-24-claudiu.beznea@microchip.com +--- + arch/arm/mach-at91/generic.h | 2 ++ + arch/arm/mach-at91/pm.c | 37 ++++++++++++++++++++++++++++++++++++ + arch/arm/mach-at91/sama7.c | 1 + + 3 files changed, 40 insertions(+) + +diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h +index 0a4cdcb4985b..0c3960a8b3eb 100644 +--- a/arch/arm/mach-at91/generic.h ++++ b/arch/arm/mach-at91/generic.h +@@ -14,12 +14,14 @@ extern void __init at91sam9_pm_init(void); + extern void __init sam9x60_pm_init(void); + extern void __init sama5_pm_init(void); + extern void __init sama5d2_pm_init(void); ++extern void __init sama7_pm_init(void); + #else + 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 sama5_pm_init(void) { } + static inline void __init sama5d2_pm_init(void) { } ++static inline void __init sama7_pm_init(void) { } + #endif + + #endif /* _AT91_GENERIC_H */ +diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c +index 687ce8582b4f..9c8c998cf9f4 100644 +--- a/arch/arm/mach-at91/pm.c ++++ b/arch/arm/mach-at91/pm.c +@@ -152,6 +152,17 @@ static const struct of_device_id sam9x60_ws_ids[] = { + { /* sentinel */ } + }; + ++static const struct of_device_id sama7g5_ws_ids[] = { ++ { .compatible = "atmel,at91sam9x5-rtc", .data = &ws_info[1] }, ++ { .compatible = "microchip,sama7g5-ohci", .data = &ws_info[2] }, ++ { .compatible = "usb-ohci", .data = &ws_info[2] }, ++ { .compatible = "atmel,at91sam9g45-ehci", .data = &ws_info[2] }, ++ { .compatible = "usb-ehci", .data = &ws_info[2] }, ++ { .compatible = "microchip,sama7g5-sdhci", .data = &ws_info[3] }, ++ { .compatible = "atmel,at91sam9260-rtt", .data = &ws_info[4] }, ++ { /* sentinel */ } ++}; ++ + static int at91_pm_config_ws(unsigned int pm_mode, bool set) + { + const struct wakeup_source_info *wsi; +@@ -1139,6 +1150,32 @@ void __init sama5d2_pm_init(void) + soc_pm.config_pmc_ws = at91_sama5d2_config_pmc_ws; + } + ++void __init sama7_pm_init(void) ++{ ++ static const int modes[] __initconst = { ++ AT91_PM_STANDBY, AT91_PM_ULP0, AT91_PM_ULP1, AT91_PM_BACKUP, ++ }; ++ static const u32 iomaps[] __initconst = { ++ [AT91_PM_ULP0] = AT91_PM_IOMAP(SFRBU), ++ [AT91_PM_ULP1] = AT91_PM_IOMAP(SFRBU) | ++ AT91_PM_IOMAP(SHDWC), ++ [AT91_PM_BACKUP] = AT91_PM_IOMAP(SFRBU) | ++ AT91_PM_IOMAP(SHDWC), ++ }; ++ ++ if (!IS_ENABLED(CONFIG_SOC_SAMA7)) ++ return; ++ ++ at91_pm_modes_validate(modes, ARRAY_SIZE(modes)); ++ ++ at91_dt_ramc(true); ++ at91_pm_modes_init(iomaps, ARRAY_SIZE(iomaps)); ++ at91_pm_init(NULL); ++ ++ soc_pm.ws_ids = sama7g5_ws_ids; ++ soc_pm.config_pmc_ws = at91_sam9x60_config_pmc_ws; ++} ++ + static int __init at91_pm_modes_select(char *str) + { + char *s; +diff --git a/arch/arm/mach-at91/sama7.c b/arch/arm/mach-at91/sama7.c +index 19d7bcbc97f1..bd43733ede18 100644 +--- a/arch/arm/mach-at91/sama7.c ++++ b/arch/arm/mach-at91/sama7.c +@@ -17,6 +17,7 @@ + static void __init sama7_dt_device_init(void) + { + of_platform_default_populate(NULL, NULL, NULL); ++ sama7_pm_init(); + } + + static const char *const sama7_dt_board_compat[] __initconst = { +-- +2.32.0 + -- cgit v1.2.3