blob: 7c1d12ddc1cae115c0d9180b4199059bab53f496 [file] [log] [blame]
Felix Heldfbfb9062021-12-15 19:35:00 +01001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#include <amdblocks/aoac.h>
4#include <delay.h>
5#include <soc/aoac_defs.h>
6#include <soc/southbridge.h>
7#include <types.h>
8
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.
14 */
15static 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,
22};
23
24void enable_aoac_devices(void)
25{
26 bool status;
27 int i;
28
29 for (i = 0; i < ARRAY_SIZE(aoac_devs); i++)
30 power_on_aoac_device(aoac_devs[i]);
31
32 /* Wait for AOAC devices to indicate power and clock OK */
33 do {
34 udelay(100);
35 status = true;
36 for (i = 0; i < ARRAY_SIZE(aoac_devs); i++)
37 status &= is_aoac_device_enabled(aoac_devs[i]);
38 } while (!status);
39}