soc/mediatek/mt8195: Utilize the retry macro

Make use of the retry macro intruduced in CB:55778:

 helpers: Introduce retry macro
 (Change-Id: I421e4dcab949616bd68b3a14231da744b9f74eeb)

BUG=none
TEST=emerge-cherry coreboot
BRANCH=none

Change-Id: Ieaec95e20e5bb54fcd145007cc46f21c8b7e26d2
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55779
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Yu-Ping Wu 2021-06-22 17:46:45 +08:00 committed by Patrick Georgi
parent fc3576ab06
commit a4a160611d
1 changed files with 8 additions and 19 deletions

View File

@ -1,8 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <commonlib/bsd/helpers.h>
#include <console/console.h>
#include <device/mmio.h>
#include <delay.h>
#include <device/mmio.h>
#include <edid.h>
#include <soc/addressmap.h>
#include <soc/dptx.h>
@ -153,16 +154,10 @@ enum {
static bool dptx_auxwrite_bytes(struct mtk_dp *mtk_dp, u8 cmd,
u32 dpcd_addr, size_t length, u8 *data)
{
u8 retry = 7;
do {
if (dptx_hal_auxwrite_bytes(mtk_dp, cmd,
dpcd_addr, length, data))
if (retry(7, dptx_hal_auxwrite_bytes(mtk_dp, cmd, dpcd_addr, length, data),
mdelay(1)))
return true;
mdelay(1);
} while (--retry > 0);
printk(BIOS_ERR, "aux write fail: cmd = %d, addr = %#x, len = %ld\n",
cmd, dpcd_addr, length);
@ -188,16 +183,10 @@ static bool dptx_auxwrite_dpcd(struct mtk_dp *mtk_dp, u8 cmd,
static bool dptx_auxread_bytes(struct mtk_dp *mtk_dp, u8 cmd,
u32 dpcd_addr, size_t length, u8 *data)
{
u8 retry = 7;
do {
if (dptx_hal_auxread_bytes(mtk_dp, cmd,
dpcd_addr, length, data))
if (retry(7, dptx_hal_auxread_bytes(mtk_dp, cmd, dpcd_addr, length, data),
mdelay(1)))
return true;
mdelay(1);
} while (--retry > 0);
printk(BIOS_ERR, "aux read fail: cmd = %d, addr = %#x, len = %ld\n",
cmd, dpcd_addr, length);