1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 3 #include <stdint.h> 4 #include <amdblocks/acpimmio.h> 5 #include <amdblocks/aoac.h> 6 #include <soc/aoac_defs.h> 7 #include <soc/southbridge.h> 8 #include <delay.h> 9 10 #define FCH_AOAC_UART_FOR_CONSOLE \ 11 (CONFIG_UART_FOR_CONSOLE == 0 ? FCH_AOAC_DEV_UART0 \ 12 : CONFIG_UART_FOR_CONSOLE == 1 ? FCH_AOAC_DEV_UART1 \ 13 : CONFIG_UART_FOR_CONSOLE == 2 ? FCH_AOAC_DEV_UART2 \ 14 : -1) 15 #if CONFIG(AMD_SOC_CONSOLE_UART) && FCH_AOAC_UART_FOR_CONSOLE == -1 16 # error Unsupported UART_FOR_CONSOLE chosen 17 #endif 18 wait_for_aoac_enabled(unsigned int dev)19void wait_for_aoac_enabled(unsigned int dev) 20 { 21 while (!is_aoac_device_enabled(dev)) 22 udelay(100); 23 } 24 enable_aoac_devices(void)25void enable_aoac_devices(void) 26 { 27 if (CONFIG(AMD_SOC_CONSOLE_UART)) 28 power_on_aoac_device(FCH_AOAC_UART_FOR_CONSOLE); 29 30 if (CONFIG(AMD_SOC_CONSOLE_UART)) 31 wait_for_aoac_enabled(FCH_AOAC_UART_FOR_CONSOLE); 32 } 33