2024-02-23 17:33:01

by Varshini Rajendran

[permalink] [raw]
Subject: [PATCH v4 18/39] ARM: at91: pm: add support for sam9x7 SoC family

Add support and pm init config for sam9x7 SoC.

Signed-off-by: Varshini Rajendran <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
arch/arm/mach-at91/generic.h | 2 ++
arch/arm/mach-at91/pm.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)

diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 0c3960a8b3eb..acf0b3c82a30 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -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) { }
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 345b91dc6627..b81556387aa3 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -233,6 +233,17 @@ static const struct of_device_id sama7g5_ws_ids[] = {
{ /* sentinel */ }
};

+static const struct of_device_id sam9x7_ws_ids[] = {
+ { .compatible = "microchip,sam9x60-rtc", .data = &ws_info[1] },
+ { .compatible = "atmel,at91rm9200-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,sam9x60-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;
@@ -1135,6 +1146,7 @@ static const struct of_device_id gmac_ids[] __initconst = {
{ .compatible = "atmel,sama5d2-gem" },
{ .compatible = "atmel,sama5d29-gem" },
{ .compatible = "microchip,sama7g5-gem" },
+ { .compatible = "microchip,sam9x7-gem" },
{ },
};

@@ -1362,6 +1374,7 @@ static const struct of_device_id atmel_pmc_ids[] __initconst = {
{ .compatible = "atmel,sama5d2-pmc", .data = &pmc_infos[1] },
{ .compatible = "microchip,sam9x60-pmc", .data = &pmc_infos[4] },
{ .compatible = "microchip,sama7g5-pmc", .data = &pmc_infos[5] },
+ { .compatible = "microchip,sam9x7-pmc", .data = &pmc_infos[4] },
{ /* sentinel */ },
};

@@ -1499,6 +1512,28 @@ 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;
--
2.25.1



2024-03-03 12:20:46

by claudiu beznea

[permalink] [raw]
Subject: Re: [PATCH v4 18/39] ARM: at91: pm: add support for sam9x7 SoC family

Hi, Varshini,

On 23.02.2024 19:27, Varshini Rajendran wrote:
> Add support and pm init config for sam9x7 SoC.
>
> Signed-off-by: Varshini Rajendran <[email protected]>
> Reviewed-by: Claudiu Beznea <[email protected]>
> ---
> arch/arm/mach-at91/generic.h | 2 ++
> arch/arm/mach-at91/pm.c | 35 +++++++++++++++++++++++++++++++++++
> 2 files changed, 37 insertions(+)
>
> diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
> index 0c3960a8b3eb..acf0b3c82a30 100644
> --- a/arch/arm/mach-at91/generic.h
> +++ b/arch/arm/mach-at91/generic.h
> @@ -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) { }
> diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
> index 345b91dc6627..b81556387aa3 100644
> --- a/arch/arm/mach-at91/pm.c
> +++ b/arch/arm/mach-at91/pm.c
> @@ -233,6 +233,17 @@ static const struct of_device_id sama7g5_ws_ids[] = {
> { /* sentinel */ }
> };
>
> +static const struct of_device_id sam9x7_ws_ids[] = {
> + { .compatible = "microchip,sam9x60-rtc", .data = &ws_info[1] },

microchip,sam9x7-rtc

> + { .compatible = "atmel,at91rm9200-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] },

These 4 are not present in the sam9x7 dtsi.

> + { .compatible = "microchip,sam9x60-rtt", .data = &ws_info[4] },

microchip,sam9x7-rtt

> + { .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;
> @@ -1135,6 +1146,7 @@ static const struct of_device_id gmac_ids[] __initconst = {
> { .compatible = "atmel,sama5d2-gem" },
> { .compatible = "atmel,sama5d29-gem" },
> { .compatible = "microchip,sama7g5-gem" },
> + { .compatible = "microchip,sam9x7-gem" },

AT91_PM_IOMAP(ETHC) is not in the list of any PM mode iomaps, thus, this is
not used at the moment. You can remove it and add (proper compatibles)
when needed, if any.

> { },
> };
>
> @@ -1362,6 +1374,7 @@ static const struct of_device_id atmel_pmc_ids[] __initconst = {
> { .compatible = "atmel,sama5d2-pmc", .data = &pmc_infos[1] },
> { .compatible = "microchip,sam9x60-pmc", .data = &pmc_infos[4] },
> { .compatible = "microchip,sama7g5-pmc", .data = &pmc_infos[5] },
> + { .compatible = "microchip,sam9x7-pmc", .data = &pmc_infos[4] },
> { /* sentinel */ },
> };
>
> @@ -1499,6 +1512,28 @@ 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,
> + };
> +

You can remove this blank line.

> + 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;