From 4919028e6207e011f93488732ebaaf70b8377cd5 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Sat, 5 Dec 2020 18:52:38 +0100 Subject: device/azalia_device.c: Add codec reset helpers Many uses of `azalia_set_bits` are used to toggle the reset bit. To avoid having to repeat the register operations and the corresponding comment, create two helpers with self-explanatory names. They will be put to use in subsequent commits, with one change for each function. Change-Id: If0594fdaf99319f08a2e272cd37958f0f216e654 Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/48355 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph --- src/device/azalia_device.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/device') diff --git a/src/device/azalia_device.c b/src/device/azalia_device.c index ab370f95d7..9306e2ac37 100644 --- a/src/device/azalia_device.c +++ b/src/device/azalia_device.c @@ -34,6 +34,18 @@ int azalia_set_bits(void *port, u32 mask, u32 val) return 0; } +int azalia_enter_reset(u8 *base) +{ + /* Set bit 0 to 0 to enter reset state (BAR + 0x8)[0] */ + return azalia_set_bits(base + HDA_GCTL_REG, HDA_GCTL_CRST, 0); +} + +int azalia_exit_reset(u8 *base) +{ + /* Set bit 0 to 1 to exit reset state (BAR + 0x8)[0] */ + return azalia_set_bits(base + HDA_GCTL_REG, HDA_GCTL_CRST, HDA_GCTL_CRST); +} + static int codec_detect(u8 *base) { u32 reg32; -- cgit v1.2.3