diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/soc/amd/common/block/include/amdblocks/reset.h | 10 | ||||
-rw-r--r-- | src/soc/amd/common/block/pm/Kconfig | 11 | ||||
-rw-r--r-- | src/soc/amd/common/block/pm/Makefile.inc | 8 | ||||
-rw-r--r-- | src/soc/amd/common/block/pm/reset.c | 28 |
4 files changed, 56 insertions, 1 deletions
diff --git a/src/soc/amd/common/block/include/amdblocks/reset.h b/src/soc/amd/common/block/include/amdblocks/reset.h index 353720c1e0..3706d08d6b 100644 --- a/src/soc/amd/common/block/include/amdblocks/reset.h +++ b/src/soc/amd/common/block/include/amdblocks/reset.h @@ -3,9 +3,11 @@ #ifndef AMD_BLOCK_RESET_H #define AMD_BLOCK_RESET_H -#include <console/console.h> +#include <amdblocks/acpimmio.h> #include <arch/cache.h> +#include <console/console.h> #include <halt.h> +#include <soc/southbridge.h> void do_warm_reset(void); void do_cold_reset(void); @@ -28,4 +30,10 @@ static inline __noreturn void cold_reset(void) halt(); } +static inline void set_resets_to_cold(void) +{ + /* De-assert and then assert all PwrGood signals on CF9 reset. */ + pm_write16(PWR_RESET_CFG, pm_read16(PWR_RESET_CFG) | TOGGLE_ALL_PWR_GOOD); +} + #endif /* AMD_BLOCK_RESET_H */ diff --git a/src/soc/amd/common/block/pm/Kconfig b/src/soc/amd/common/block/pm/Kconfig index 538301de32..7d2513ef97 100644 --- a/src/soc/amd/common/block/pm/Kconfig +++ b/src/soc/amd/common/block/pm/Kconfig @@ -15,3 +15,14 @@ config SOC_AMD_COMMON_BLOCK_PM_CHIPSET_STATE_SAVE platforms that use FSP for hardware initialization. endif # SOC_AMD_COMMON_BLOCK_PM + +config SOC_AMD_COMMON_BLOCK_RESET + bool + help + Select this option to use AMD common reset driver support. + +config SOC_AMD_SUPPORTS_WARM_RESET + bool + depends on SOC_AMD_COMMON_BLOCK_RESET + help + Select this option if the chip supports warm reset. diff --git a/src/soc/amd/common/block/pm/Makefile.inc b/src/soc/amd/common/block/pm/Makefile.inc index 27d9bb5fe8..de1809a45b 100644 --- a/src/soc/amd/common/block/pm/Makefile.inc +++ b/src/soc/amd/common/block/pm/Makefile.inc @@ -1,5 +1,13 @@ ## SPDX-License-Identifier: GPL-2.0-only + bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_PM) += pmlib.c +bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_RESET) += reset.c + +verstage_x86-$(CONFIG_SOC_AMD_COMMON_BLOCK_RESET) += reset.c romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_PM_CHIPSET_STATE_SAVE) += chipset_state.c +romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_RESET) += reset.c + +ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_RESET) += reset.c + smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_PM_CHIPSET_STATE_SAVE) += chipset_state.c diff --git a/src/soc/amd/common/block/pm/reset.c b/src/soc/amd/common/block/pm/reset.c new file mode 100644 index 0000000000..52c6334b53 --- /dev/null +++ b/src/soc/amd/common/block/pm/reset.c @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <arch/io.h> +#include <cf9_reset.h> +#include <reset.h> +#include <soc/southbridge.h> +#include <amdblocks/acpimmio.h> +#include <amdblocks/reset.h> + +void do_cold_reset(void) +{ + set_resets_to_cold(); + outb(RST_CPU | SYS_RST, RST_CNT); +} + +void do_warm_reset(void) +{ + /* If warm resets are not supported, executed a cold reset */ + if (!CONFIG(SOC_AMD_SUPPORTS_WARM_RESET)) + do_cold_reset(); /* Does not return */ + + outb(RST_CPU | SYS_RST, RST_CNT); +} + +void do_board_reset(void) +{ + do_cold_reset(); +} |