azalia: Use `azalia_enter_reset` function
Also tidy up some adjacent comments. Change-Id: I2e881900a52e42ab3f43ffe96cfbdcc63ff02e23 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/48358 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
This commit is contained in:
parent
a1a317ebf6
commit
2e0053b840
|
@ -72,8 +72,7 @@ static int codec_detect(u8 *base)
|
||||||
if (!count)
|
if (!count)
|
||||||
goto no_codec;
|
goto no_codec;
|
||||||
|
|
||||||
/* Set Bit 0 to 0 to enter reset state (BAR + 0x8)[0] */
|
if (azalia_enter_reset(base) < 0)
|
||||||
if (azalia_set_bits(base + HDA_GCTL_REG, 1, 0) < 0)
|
|
||||||
goto no_codec;
|
goto no_codec;
|
||||||
|
|
||||||
if (azalia_exit_reset(base) < 0)
|
if (azalia_exit_reset(base) < 0)
|
||||||
|
|
|
@ -24,7 +24,7 @@ int hda_codec_detect(u8 *base)
|
||||||
write8(base + HDA_STATESTS_REG, 0xf);
|
write8(base + HDA_STATESTS_REG, 0xf);
|
||||||
|
|
||||||
/* Turn off the link and poll RESET# bit until it reads back as 0 */
|
/* Turn off the link and poll RESET# bit until it reads back as 0 */
|
||||||
if (azalia_set_bits(base + HDA_GCTL_REG, HDA_GCTL_CRST, 0) < 0)
|
if (azalia_enter_reset(base) < 0)
|
||||||
goto no_codec;
|
goto no_codec;
|
||||||
|
|
||||||
/* Turn on the link and poll RESET# bit until it reads back as 1 */
|
/* Turn on the link and poll RESET# bit until it reads back as 1 */
|
||||||
|
@ -40,9 +40,8 @@ int hda_codec_detect(u8 *base)
|
||||||
return reg8;
|
return reg8;
|
||||||
|
|
||||||
no_codec:
|
no_codec:
|
||||||
/* Codec Not found */
|
/* Codec not found, put HDA back in reset */
|
||||||
/* Put HDA back in reset (BAR + 0x8) [0] */
|
azalia_enter_reset(base);
|
||||||
azalia_set_bits(base + HDA_GCTL_REG, HDA_GCTL_CRST, 0);
|
|
||||||
printk(BIOS_DEBUG, "HDA: No codec!\n");
|
printk(BIOS_DEBUG, "HDA: No codec!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,8 @@ static int codec_detect(u8 *base)
|
||||||
return reg8;
|
return reg8;
|
||||||
|
|
||||||
no_codec:
|
no_codec:
|
||||||
/* Codec Not found */
|
/* Codec not found, put HDA back in reset */
|
||||||
/* Put HDA back in reset (BAR + 0x8) [0] */
|
azalia_enter_reset(base);
|
||||||
azalia_set_bits(base + HDA_GCTL_REG, 1, 0);
|
|
||||||
printk(BIOS_DEBUG, "Azalia: No codec!\n");
|
printk(BIOS_DEBUG, "Azalia: No codec!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,7 @@ static int codec_detect(u8 *base)
|
||||||
{
|
{
|
||||||
u32 reg32;
|
u32 reg32;
|
||||||
|
|
||||||
/* Set Bit 0 to 0 to enter reset state (BAR + 0x8)[0] */
|
if (azalia_enter_reset(base) < 0)
|
||||||
if (azalia_set_bits(base + HDA_GCTL_REG, HDA_GCTL_CRST, 0) < 0)
|
|
||||||
goto no_codec;
|
goto no_codec;
|
||||||
|
|
||||||
if (azalia_exit_reset(base) < 0)
|
if (azalia_exit_reset(base) < 0)
|
||||||
|
@ -31,9 +30,8 @@ static int codec_detect(u8 *base)
|
||||||
return reg32;
|
return reg32;
|
||||||
|
|
||||||
no_codec:
|
no_codec:
|
||||||
/* Codec Not found */
|
/* Codec not found, put HDA back in reset */
|
||||||
/* Put HDA back in reset (BAR + 0x8) [0] */
|
azalia_enter_reset(base);
|
||||||
azalia_set_bits(base + HDA_GCTL_REG, 1, 0);
|
|
||||||
printk(BIOS_DEBUG, "Azalia: No codec!\n");
|
printk(BIOS_DEBUG, "Azalia: No codec!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,7 @@ static int codec_detect(u8 *base)
|
||||||
{
|
{
|
||||||
u32 reg32;
|
u32 reg32;
|
||||||
|
|
||||||
/* Set Bit 0 to 0 to enter reset state (BAR + 0x8)[0] */
|
if (azalia_enter_reset(base) < 0)
|
||||||
if (azalia_set_bits(base + HDA_GCTL_REG, HDA_GCTL_CRST, 0) < 0)
|
|
||||||
goto no_codec;
|
goto no_codec;
|
||||||
|
|
||||||
if (azalia_exit_reset(base) < 0)
|
if (azalia_exit_reset(base) < 0)
|
||||||
|
@ -31,9 +30,8 @@ static int codec_detect(u8 *base)
|
||||||
return reg32;
|
return reg32;
|
||||||
|
|
||||||
no_codec:
|
no_codec:
|
||||||
/* Codec Not found */
|
/* Codec not found, put HDA back in reset */
|
||||||
/* Put HDA back in reset (BAR + 0x8) [0] */
|
azalia_enter_reset(base);
|
||||||
azalia_set_bits(base + HDA_GCTL_REG, 1, 0);
|
|
||||||
printk(BIOS_DEBUG, "Azalia: No codec!\n");
|
printk(BIOS_DEBUG, "Azalia: No codec!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,7 @@ static int codec_detect(u8 *base)
|
||||||
{
|
{
|
||||||
u32 reg32;
|
u32 reg32;
|
||||||
|
|
||||||
/* Set Bit 0 to 0 to enter reset state (BAR + 0x8)[0] */
|
if (azalia_enter_reset(base) < 0)
|
||||||
if (azalia_set_bits(base + HDA_GCTL_REG, HDA_GCTL_CRST, 0) < 0)
|
|
||||||
goto no_codec;
|
goto no_codec;
|
||||||
|
|
||||||
if (azalia_exit_reset(base) < 0)
|
if (azalia_exit_reset(base) < 0)
|
||||||
|
@ -31,9 +30,8 @@ static int codec_detect(u8 *base)
|
||||||
return reg32;
|
return reg32;
|
||||||
|
|
||||||
no_codec:
|
no_codec:
|
||||||
/* Codec Not found */
|
/* Codec not found, put HDA back in reset */
|
||||||
/* Put HDA back in reset (BAR + 0x8) [0] */
|
azalia_enter_reset(base);
|
||||||
azalia_set_bits(base + HDA_GCTL_REG, 1, 0);
|
|
||||||
printk(BIOS_DEBUG, "Azalia: No codec!\n");
|
printk(BIOS_DEBUG, "Azalia: No codec!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,8 @@ static int codec_detect(u8 *base)
|
||||||
return reg8;
|
return reg8;
|
||||||
|
|
||||||
no_codec:
|
no_codec:
|
||||||
/* Codec Not found */
|
/* Codec not found, put HDA back in reset */
|
||||||
/* Put HDA back in reset (BAR + 0x8) [0] */
|
azalia_enter_reset(base);
|
||||||
azalia_set_bits(base + HDA_GCTL_REG, 1, 0);
|
|
||||||
printk(BIOS_DEBUG, "Azalia: No codec!\n");
|
printk(BIOS_DEBUG, "Azalia: No codec!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,8 @@ int hda_codec_detect(u8 *base)
|
||||||
return reg8;
|
return reg8;
|
||||||
|
|
||||||
no_codec:
|
no_codec:
|
||||||
/* Codec Not found */
|
/* Codec not found, put HDA back in reset */
|
||||||
/* Put HDA back in reset (BAR + 0x8) [0] */
|
azalia_enter_reset(base);
|
||||||
azalia_set_bits(base + HDA_GCTL_REG, HDA_GCTL_CRST, 0);
|
|
||||||
printk(BIOS_DEBUG, "HDA: No codec!\n");
|
printk(BIOS_DEBUG, "HDA: No codec!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue