summaryrefslogtreecommitdiff
path: root/src/soc/mediatek
diff options
context:
space:
mode:
authorYu-Ping Wu <yupingso@chromium.org>2021-06-22 17:46:45 +0800
committerPatrick Georgi <pgeorgi@google.com>2021-06-26 10:09:20 +0000
commita4a160611d3ac4f36d60c84272231a9a8760c270 (patch)
treeca30b0bc4120b6b7ab53c5ee1da98f1352aa9a76 /src/soc/mediatek
parentfc3576ab06a33bd3733ea37341fd3b0094e1298c (diff)
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>
Diffstat (limited to 'src/soc/mediatek')
-rw-r--r--src/soc/mediatek/mt8195/dptx.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/soc/mediatek/mt8195/dptx.c b/src/soc/mediatek/mt8195/dptx.c
index 9ffad274e0..8d557ba910 100644
--- a/src/soc/mediatek/mt8195/dptx.c
+++ b/src/soc/mediatek/mt8195/dptx.c
@@ -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,15 +154,9 @@ 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))
- return true;
-
- mdelay(1);
- } while (--retry > 0);
+ if (retry(7, dptx_hal_auxwrite_bytes(mtk_dp, cmd, dpcd_addr, length, data),
+ mdelay(1)))
+ return true;
printk(BIOS_ERR, "aux write fail: cmd = %d, addr = %#x, len = %ld\n",
cmd, dpcd_addr, length);
@@ -188,15 +183,9 @@ 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))
- return true;
-
- mdelay(1);
- } while (--retry > 0);
+ if (retry(7, dptx_hal_auxread_bytes(mtk_dp, cmd, dpcd_addr, length, data),
+ mdelay(1)))
+ return true;
printk(BIOS_ERR, "aux read fail: cmd = %d, addr = %#x, len = %ld\n",
cmd, dpcd_addr, length);