summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2016-11-29 10:50:52 -0700
committerMartin Roth <martinroth@google.com>2016-12-05 19:05:47 +0100
commite4b9af15d8775b602020ccadbfc138378fbc7c1e (patch)
tree49eef4035745c5f9f871ef93f43b7f60c6a3d1b9
parentfd5fa2ad1fb1f3525deab9213bed2c38e083342d (diff)
rockchip/rk3399: display: Update edp initialization retry
Follow on patch to clean up the previous retry code. Previous patches: coreboot commit 079b5c65 (rockchip/rk3399: display: Retry edp initialization if it fails) cros commit 28c57a6e (rockchip/rk3399: display: retry edp initialization if edp initial fail) - Reduce the jumping around via goto statements - Break the retry code out into a separate function that also prints the error messages. BRANCH=gru BUG=chrome-os-partner:60150 TEST=Rebuild Kevin and Gru Change-Id: I3b6cf572073e4dcac83da09621bafde179af2613 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/17642 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--src/soc/rockchip/rk3399/display.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/src/soc/rockchip/rk3399/display.c b/src/soc/rockchip/rk3399/display.c
index 4261b26399..5199bf3d34 100644
--- a/src/soc/rockchip/rk3399/display.c
+++ b/src/soc/rockchip/rk3399/display.c
@@ -36,6 +36,17 @@
#include "chip.h"
+static void reset_edp(void)
+{
+ /* rst edp */
+ write32(&cru_ptr->softrst_con[17],
+ RK_SETBITS(1 << 12 | 1 << 13));
+ udelay(1);
+ write32(&cru_ptr->softrst_con[17],
+ RK_CLRBITS(1 << 12 | 1 << 13));
+ printk(BIOS_WARNING, "Retrying epd initialization.\n");
+}
+
void rk_display_init(device_t dev)
{
struct edid edid;
@@ -65,14 +76,20 @@ void rk_display_init(device_t dev)
write32(&rk3399_grf->soc_con25, RK_SETBITS(1 << 11));
retry_edp:
- rk_edp_init();
- if (rk_edp_get_edid(&edid) == 0) {
- detected_mode = VOP_MODE_EDP;
- break;
+ while (retry_count++ < 3) {
+ rk_edp_init();
+ if (rk_edp_get_edid(&edid) == 0) {
+ detected_mode = VOP_MODE_EDP;
+ break;
+ }
+ if (retry_count == 3) {
+ printk(BIOS_WARNING, "Warning: epd initialization failed.\n");
+ return;
+ } else {
+ reset_edp();
+ }
}
- goto edp_error;
-
- /* fall thru */
+ break;
case VOP_MODE_HDMI:
printk(BIOS_WARNING, "HDMI display is NOT supported yet.\n");
return;
@@ -100,24 +117,14 @@ retry_edp:
case VOP_MODE_EDP:
default:
/* will enable edp in depthcharge */
- if (rk_edp_prepare())
- goto edp_error;
+ if (rk_edp_prepare()) {
+ reset_edp();
+ goto retry_edp; /* Rerun entire init sequence */
+ }
mainboard_power_on_backlight();
break;
}
set_vbe_mode_info_valid(&edid, (uintptr_t)0);
return;
-
-edp_error:
- if (retry_count++ < 3) {
- /* rst edp */
- write32(&cru_ptr->softrst_con[17],
- RK_SETBITS(1 << 12 | 1 << 13));
- udelay(1);
- write32(&cru_ptr->softrst_con[17],
- RK_CLRBITS(1 << 12 | 1 << 13));
- goto retry_edp;
- }
- printk(BIOS_WARNING, "epd initial error\n");
}