summaryrefslogtreecommitdiffstats
path: root/src/southbridge/intel/i82801gx/azalia.c
diff options
context:
space:
mode:
authorElyes HAOUAS <ehaouas@noos.fr>2020-08-03 15:35:16 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-08-17 06:45:39 +0000
commitf1da909dd4eaf5dfeea33c535a52faaffbf0728b (patch)
tree9a91861aa72c2dbbc8cdaf094f3621f9b4ba84b1 /src/southbridge/intel/i82801gx/azalia.c
parent11178bd30577bc94f799a28dedcc8ca90f044767 (diff)
downloadcoreboot-f1da909dd4eaf5dfeea33c535a52faaffbf0728b.tar.gz
coreboot-f1da909dd4eaf5dfeea33c535a52faaffbf0728b.tar.bz2
coreboot-f1da909dd4eaf5dfeea33c535a52faaffbf0728b.zip
sb/intel/i82801gx: Use <device/azalia_device.h> registers
Change-Id: I1a5b0b9db0cc3847693934de20b5d27605617637 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/44128 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/southbridge/intel/i82801gx/azalia.c')
-rw-r--r--src/southbridge/intel/i82801gx/azalia.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/southbridge/intel/i82801gx/azalia.c b/src/southbridge/intel/i82801gx/azalia.c
index 8d626acbb7bd..add906962b72 100644
--- a/src/southbridge/intel/i82801gx/azalia.c
+++ b/src/southbridge/intel/i82801gx/azalia.c
@@ -11,10 +11,6 @@
#include "chip.h"
#include "i82801gx.h"
-#define HDA_ICII_REG 0x68
-#define HDA_ICII_BUSY (1 << 0)
-#define HDA_ICII_VALID (1 << 1)
-
static int set_bits(void *port, u32 mask, u32 val)
{
u32 reg32;
@@ -47,15 +43,15 @@ static int codec_detect(u8 *base)
u32 reg32;
/* Set Bit0 to 0 to enter reset state (BAR + 0x8)[0] */
- if (set_bits(base + 0x08, 1, 0) == -1)
+ if (set_bits(base + HDA_GCTL_REG, 1, 0) == -1)
goto no_codec;
/* Set Bit 0 to 1 to exit reset state (BAR + 0x8)[0] */
- if (set_bits(base + 0x08, 1, 1) == -1)
+ if (set_bits(base + HDA_GCTL_REG, 1, 1) == -1)
goto no_codec;
/* Read in Codec location (BAR + 0xe)[2..0]*/
- reg32 = read32(base + 0xe);
+ reg32 = read32(base + HDA_STATESTS_REG);
reg32 &= 0x0f;
if (!reg32)
goto no_codec;
@@ -65,7 +61,7 @@ static int codec_detect(u8 *base)
no_codec:
/* Codec Not found */
/* Put HDA back in reset (BAR + 0x8) [0] */
- set_bits(base + 0x08, 1, 0);
+ set_bits(base + HDA_GCTL_REG, 1, 0);
printk(BIOS_DEBUG, "Azalia: No codec!\n");
return 0;
}
@@ -118,9 +114,9 @@ static int wait_for_valid(u8 *base)
u32 reg32;
/* Send the verb to the codec */
- reg32 = read32(base + 0x68);
- reg32 |= (1 << 0) | (1 << 1);
- write32(base + 0x68, reg32);
+ reg32 = read32(base + HDA_ICII_REG);
+ reg32 |= HDA_ICII_BUSY | HDA_ICII_VALID;
+ write32(base + HDA_ICII_REG, reg32);
/* Use a 50 usec timeout - the Linux kernel uses the same duration */
@@ -149,12 +145,12 @@ static void codec_init(struct device *dev, u8 *base, int addr)
return;
reg32 = (addr << 28) | 0x000f0000;
- write32(base + 0x60, reg32);
+ write32(base + HDA_IC_REG, reg32);
if (wait_for_valid(base) == -1)
return;
- reg32 = read32(base + 0x64);
+ reg32 = read32(base + HDA_IR_REG);
/* 2 */
printk(BIOS_DEBUG, "Azalia: codec viddid: %08x\n", reg32);
@@ -171,7 +167,7 @@ static void codec_init(struct device *dev, u8 *base, int addr)
if (wait_for_ready(base) == -1)
return;
- write32(base + 0x60, verb[i]);
+ write32(base + HDA_IC_REG, verb[i]);
if (wait_for_valid(base) == -1)
return;