soc/intel/xeon_sp/skx: Use Kconfig symbol
[coreboot2.git] / src / soc / amd / stoneyridge / aoac.c
blob505b2c80f6e6a25c51b0a63a21f39313d8958c46
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <amdblocks/aoac.h>
4 #include <delay.h>
5 #include <soc/aoac_defs.h>
6 #include <soc/southbridge.h>
7 #include <types.h>
9 /*
10 * Table of devices that need their AOAC registers enabled and waited
11 * upon (usually about .55 milliseconds). Instead of individual delays
12 * waiting for each device to become available, a single delay will be
13 * executed.
15 static const unsigned int aoac_devs[] = {
16 FCH_AOAC_DEV_UART0 + CONFIG_UART_FOR_CONSOLE * 2,
17 FCH_AOAC_DEV_AMBA,
18 FCH_AOAC_DEV_I2C0,
19 FCH_AOAC_DEV_I2C1,
20 FCH_AOAC_DEV_I2C2,
21 FCH_AOAC_DEV_I2C3,
24 void wait_for_aoac_enabled(unsigned int dev)
26 while (!is_aoac_device_enabled(dev))
27 udelay(100);
30 void enable_aoac_devices(void)
32 bool status;
33 int i;
35 for (i = 0; i < ARRAY_SIZE(aoac_devs); i++)
36 power_on_aoac_device(aoac_devs[i]);
38 /* Wait for AOAC devices to indicate power and clock OK */
39 do {
40 udelay(100);
41 status = true;
42 for (i = 0; i < ARRAY_SIZE(aoac_devs); i++)
43 status &= is_aoac_device_enabled(aoac_devs[i]);
44 } while (!status);