ARM: at91: pm: add pmc_version member to at91_pm_data

This will be used to differentiate b/w different PLLs settings to be
applied in the final/first steps of the suspend/resume process by doing
PLL specific configurations.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/1579522208-19523-5-git-send-email-claudiu.beznea@microchip.com
This commit is contained in:
Claudiu Beznea 2020-01-20 14:10:04 +02:00 committed by Alexandre Belloni
parent 63d1a6b107
commit 0be298a939
5 changed files with 17 additions and 0 deletions

View File

@ -737,28 +737,34 @@ static void __init at91_pm_modes_init(void)
struct pmc_info { struct pmc_info {
unsigned long uhp_udp_mask; unsigned long uhp_udp_mask;
unsigned long mckr; unsigned long mckr;
unsigned long version;
}; };
static const struct pmc_info pmc_infos[] __initconst = { static const struct pmc_info pmc_infos[] __initconst = {
{ {
.uhp_udp_mask = AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP, .uhp_udp_mask = AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP,
.mckr = 0x30, .mckr = 0x30,
.version = AT91_PMC_V1,
}, },
{ {
.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP, .uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP,
.mckr = 0x30, .mckr = 0x30,
.version = AT91_PMC_V1,
}, },
{ {
.uhp_udp_mask = AT91SAM926x_PMC_UHP, .uhp_udp_mask = AT91SAM926x_PMC_UHP,
.mckr = 0x30, .mckr = 0x30,
.version = AT91_PMC_V1,
}, },
{ .uhp_udp_mask = 0, { .uhp_udp_mask = 0,
.mckr = 0x30, .mckr = 0x30,
.version = AT91_PMC_V1,
}, },
{ {
.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP, .uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP,
.mckr = 0x28, .mckr = 0x28,
.version = AT91_PMC_V2,
}, },
}; };
@ -797,6 +803,7 @@ static void __init at91_pm_init(void (*pm_idle)(void))
pmc = of_id->data; pmc = of_id->data;
soc_pm.data.uhp_udp_mask = pmc->uhp_udp_mask; soc_pm.data.uhp_udp_mask = pmc->uhp_udp_mask;
soc_pm.data.pmc_mckr_offset = pmc->mckr; soc_pm.data.pmc_mckr_offset = pmc->mckr;
soc_pm.data.pmc_version = pmc->version;
if (pm_idle) if (pm_idle)
arm_pm_idle = pm_idle; arm_pm_idle = pm_idle;

View File

@ -34,6 +34,7 @@ struct at91_pm_data {
unsigned int standby_mode; unsigned int standby_mode;
unsigned int suspend_mode; unsigned int suspend_mode;
unsigned int pmc_mckr_offset; unsigned int pmc_mckr_offset;
unsigned int pmc_version;
}; };
#endif #endif

View File

@ -14,6 +14,8 @@ int main(void)
DEFINE(PM_DATA_SFRBU, offsetof(struct at91_pm_data, sfrbu)); DEFINE(PM_DATA_SFRBU, offsetof(struct at91_pm_data, sfrbu));
DEFINE(PM_DATA_PMC_MCKR_OFFSET, offsetof(struct at91_pm_data, DEFINE(PM_DATA_PMC_MCKR_OFFSET, offsetof(struct at91_pm_data,
pmc_mckr_offset)); pmc_mckr_offset));
DEFINE(PM_DATA_PMC_VERSION, offsetof(struct at91_pm_data,
pmc_version));
return 0; return 0;
} }

View File

@ -95,6 +95,8 @@ ENTRY(at91_pm_suspend_in_sram)
str tmp1, .pm_mode str tmp1, .pm_mode
ldr tmp1, [r0, #PM_DATA_PMC_MCKR_OFFSET] ldr tmp1, [r0, #PM_DATA_PMC_MCKR_OFFSET]
str tmp1, .mckr_offset str tmp1, .mckr_offset
ldr tmp1, [r0, #PM_DATA_PMC_VERSION]
str tmp1, .pmc_version
/* Both ldrne below are here to preload their address in the TLB */ /* Both ldrne below are here to preload their address in the TLB */
ldr tmp1, [r0, #PM_DATA_SHDWC] ldr tmp1, [r0, #PM_DATA_SHDWC]
str tmp1, .shdwc str tmp1, .shdwc
@ -542,6 +544,8 @@ ENDPROC(at91_sramc_self_refresh)
.word 0 .word 0
.mckr_offset: .mckr_offset:
.word 0 .word 0
.pmc_version:
.word 0
.saved_mckr: .saved_mckr:
.word 0 .word 0
.saved_pllar: .saved_pllar:

View File

@ -12,6 +12,9 @@
#ifndef AT91_PMC_H #ifndef AT91_PMC_H
#define AT91_PMC_H #define AT91_PMC_H
#define AT91_PMC_V1 (1) /* PMC version 1 */
#define AT91_PMC_V2 (2) /* PMC version 2 [SAM9X60] */
#define AT91_PMC_SCER 0x00 /* System Clock Enable Register */ #define AT91_PMC_SCER 0x00 /* System Clock Enable Register */
#define AT91_PMC_SCDR 0x04 /* System Clock Disable Register */ #define AT91_PMC_SCDR 0x04 /* System Clock Disable Register */