Martin L Roth has submitted this change. ( https://review.coreboot.org/c/coreboot/+/83592?usp=email )
Change subject: device/azalia: Clear busy bit after failed verb command ......................................................................
device/azalia: Clear busy bit after failed verb command
The spec tells us to clear the busy bit manually after a timeout. Do that and wait immediately, to detect further issues early. Also fix some related comments and prints: Failures shouldn't be debug messa- ges. And we are talking to the PIO interface of the controller, not the codec. So this was never about the codec being ready.
Change-Id: I4b737f8259157c01bfcd9e6631cc15d39c653d06 Signed-off-by: Nico Huber nico.h@gmx.de Reviewed-on: https://review.coreboot.org/c/coreboot/+/83592 Reviewed-by: Nicholas Sudsgaard devel+coreboot@nsudsgaard.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/device/azalia_device.c 1 file changed, 13 insertions(+), 6 deletions(-)
Approvals: build bot (Jenkins): Verified Nicholas Sudsgaard: Looks good to me, approved
diff --git a/src/device/azalia_device.c b/src/device/azalia_device.c index c167373..dadcda9 100644 --- a/src/device/azalia_device.c +++ b/src/device/azalia_device.c @@ -155,10 +155,8 @@ }
/* - * Wait 50usec for the codec to indicate it is ready. - * No response would imply that the codec is non-operative. + * Wait 50usec for the controller to indicate it is ready. */ - static int wait_for_ready(u8 *base) { struct stopwatch sw; @@ -179,7 +177,6 @@ * Wait for the codec to indicate that it accepted the previous command. * No response would imply that the codec is non-operative. */ - static int wait_for_valid(u8 *base) { struct stopwatch sw; @@ -206,6 +203,16 @@ udelay(1); }
+ /* + * HDA spec 1.0a "3.4.3 Offset 68h: Immediate Command Status" + * tells us to clear the busy bit explicitly, then poll until + * the controller is ready. + */ + write32(base + HDA_ICII_REG, 0); + if (wait_for_ready(base) < 0) { + printk(BIOS_WARNING, "azalia_audio: controller is unresponsive.\n"); + return -2; + } return -1; }
@@ -238,7 +245,7 @@ static bool codec_is_operative(u8 *base, const int addr) { if (wait_for_ready(base) < 0) { - printk(BIOS_DEBUG, "azalia_audio: codec #%d not ready\n", addr); + printk(BIOS_WARNING, "azalia_audio: controller not ready\n"); return false; }
@@ -246,7 +253,7 @@ write32(base + HDA_IC_REG, reg32);
if (wait_for_valid(base) < 0) { - printk(BIOS_DEBUG, "azalia_audio: codec #%d not valid\n", addr); + printk(BIOS_NOTICE, "azalia_audio: codec #%d doesn't respond\n", addr); return false; } return true;