1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <amdblocks/acpimmio.h>
5 #include <amdblocks/aoac.h>
7 /* This initiates the power on sequence, but doesn't wait for the device to be powered on. */
8 void power_on_aoac_device(unsigned int dev
)
10 uint8_t byte
= aoac_read8(AOAC_DEV_D3_CTL(dev
));
11 byte
|= FCH_AOAC_PWR_ON_DEV
;
12 byte
&= ~FCH_AOAC_TARGET_DEVICE_STATE
;
13 byte
|= FCH_AOAC_D0_INITIALIZED
;
14 aoac_write8(AOAC_DEV_D3_CTL(dev
), byte
);
17 void power_off_aoac_device(unsigned int dev
)
19 uint8_t byte
= aoac_read8(AOAC_DEV_D3_CTL(dev
));
20 byte
&= ~FCH_AOAC_PWR_ON_DEV
;
21 aoac_write8(AOAC_DEV_D3_CTL(dev
), byte
);
24 bool is_aoac_device_enabled(unsigned int dev
)
26 uint8_t byte
= aoac_read8(AOAC_DEV_D3_STATE(dev
));
27 byte
&= (FCH_AOAC_PWR_RST_STATE
| FCH_AOAC_REF_CLK_OK_STATE
);
28 if (byte
== (FCH_AOAC_PWR_RST_STATE
| FCH_AOAC_REF_CLK_OK_STATE
))