From: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
To: u-boot@lists.denx.de
Subject: [patch v2 10/10] drivers/video/rockchip/rk_vop.c: Add reset support
Date: Tue, 27 Oct 2020 14:21:41 +0100 [thread overview]
Message-ID: <20201027132236.187863854@rtp-net.org> (raw)
In-Reply-To: 20201027132131.016984025@rtp-net.org
In order to ensure that the VOP registers are in correct state,
add missing support for the VOP reset lines found in the device-tree
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Index: u-boot/drivers/video/rockchip/rk_vop.c
===================================================================
--- u-boot.orig/drivers/video/rockchip/rk_vop.c
+++ u-boot/drivers/video/rockchip/rk_vop.c
@@ -8,9 +8,11 @@
#include <clk.h>
#include <display.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <edid.h>
#include <log.h>
#include <regmap.h>
+#include <reset.h>
#include <syscon.h>
#include <video.h>
#include <asm/gpio.h>
@@ -36,14 +38,16 @@ enum vop_pol {
DCLK_INVERT = 3
};
-static void rkvop_enable(struct rk3288_vop *regs, ulong fbbase,
+static void rkvop_enable(struct udevice *dev, struct rk3288_vop *regs, ulong fbbase,
int fb_bits_per_pixel,
- const struct display_timing *edid)
+ const struct display_timing *edid,
+ struct reset_ctl *dclk_rst)
{
u32 lb_mode;
u32 rgb_mode;
u32 hactive = edid->hactive.typ;
u32 vactive = edid->vactive.typ;
+ int ret;
writel(V_ACT_WIDTH(hactive - 1) | V_ACT_HEIGHT(vactive - 1),
®s->win0_act_info);
@@ -91,6 +95,18 @@ static void rkvop_enable(struct rk3288_v
writel(fbbase, ®s->win0_yrgb_mst);
writel(0x01, ®s->reg_cfg_done); /* enable reg config */
+
+ ret = reset_assert(dclk_rst);
+ if (ret) {
+ dev_warn(dev, "failed to assert dclk reset (ret=%d)\n", ret);
+ return;
+ }
+ udelay(20);
+
+ ret = reset_deassert(dclk_rst);
+ if (ret)
+ dev_warn(dev, "failed to deassert dclk reset (ret=%d)\n", ret);
+
}
static void rkvop_set_pin_polarity(struct udevice *dev,
@@ -238,6 +254,7 @@ static int rk_display_init(struct udevic
enum video_log2_bpp l2bpp;
ofnode remote;
const char *compat;
+ struct reset_ctl dclk_rst;
debug("%s(%s, %lx, %s)\n", __func__,
dev_read_name(dev), fbbase, ofnode_get_name(ep_node));
@@ -354,7 +371,14 @@ static int rk_display_init(struct udevic
}
rkvop_mode_set(dev, &timing, vop_id);
- rkvop_enable(regs, fbbase, 1 << l2bpp, &timing);
+
+ ret = reset_get_by_name(dev, "dclk", &dclk_rst);
+ if (ret) {
+ dev_err(dev, "failed to get dclk reset (ret=%d)\n", ret);
+ return ret;
+ }
+
+ rkvop_enable(dev, regs, fbbase, 1 << l2bpp, &timing, &dclk_rst);
ret = display_enable(disp, 1 << l2bpp, &timing);
if (ret)
@@ -391,11 +415,31 @@ int rk_vop_probe(struct udevice *dev)
struct rk_vop_priv *priv = dev_get_priv(dev);
int ret = 0;
ofnode port, node;
+ struct reset_ctl ahb_rst;
/* Before relocation we don't need to do anything */
if (!(gd->flags & GD_FLG_RELOC))
return 0;
+ ret = reset_get_by_name(dev, "ahb", &ahb_rst);
+ if (ret) {
+ dev_err(dev, "failed to get ahb reset (ret=%d)\n", ret);
+ return ret;
+ }
+
+ ret = reset_assert(&ahb_rst);
+ if (ret) {
+ dev_err(dev, "failed to assert ahb reset (ret=%d)\n", ret);
+ return ret;
+ }
+ udelay(20);
+
+ ret = reset_deassert(&ahb_rst);
+ if (ret) {
+ dev_err(dev, "failed to deassert ahb reset (ret=%d)\n", ret);
+ return ret;
+ }
+
plat->base = gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - plat->size;
#if defined(CONFIG_EFI_LOADER)
next prev parent reply other threads:[~2020-10-27 13:21 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 13:21 [patch v2 00/10] rk3399 (Pinebook pro) EDP support Arnaud Patard
2020-10-27 13:21 ` [patch v2 01/10] drivers/video/rockchip/rk_vop.c: Use endpoint compatible string to find VOP mode Arnaud Patard
2020-10-27 22:31 ` Alper Nebi Yasak
2020-10-30 15:16 ` Kever Yang
2020-10-30 18:20 ` Arnaud Patard
2020-11-13 10:32 ` Kever Yang
2020-10-27 13:21 ` [patch v2 02/10] drivers/video/rockchip/rk_edp.c: Add rk3399 support Arnaud Patard
2020-10-27 22:32 ` Alper Nebi Yasak
2020-10-27 13:21 ` [patch v2 03/10] drivers/video/rockchip/rk_edp.c: Change interrupt polarity configuration Arnaud Patard
2020-10-27 22:32 ` Alper Nebi Yasak
2020-10-27 13:21 ` [patch v2 04/10] drivers/video/rockchip/rk_vop.c: Reserve efi fb memory Arnaud Patard
2020-10-27 22:33 ` Alper Nebi Yasak
2020-10-27 13:21 ` [patch v2 05/10] rk3399-pinebook-pro-u-boot.dtsi: Enable edp Arnaud Patard
2020-10-27 14:32 ` Peter Robinson
2020-10-27 13:21 ` [patch v2 06/10] configs/pinebook-pro-rk3399_defconfig: enable SYS_USB_EVENT_POLL_VIA_INT_QUEUE Arnaud Patard
2020-10-27 13:21 ` [patch v2 07/10] drivers/pwm/rk_pwm.c: Fix default polarity Arnaud Patard
2020-10-27 22:34 ` Alper Nebi Yasak
2020-10-27 13:21 ` [patch v2 08/10] drivers/video/rockchip/rk_vop.c: Fix format of fbbase in debug string Arnaud Patard
2020-10-27 22:36 ` Alper Nebi Yasak
2020-10-27 13:21 ` [patch v2 09/10] drivers/video/rockchip/rk_edp.c: Add missing reset support Arnaud Patard
2020-10-27 22:37 ` Alper Nebi Yasak
2020-10-27 13:21 ` Arnaud Patard [this message]
2020-10-27 22:37 ` [patch v2 10/10] drivers/video/rockchip/rk_vop.c: Add " Alper Nebi Yasak
2020-10-27 22:19 ` [patch v2 00/10] rk3399 (Pinebook pro) EDP support Alper Nebi Yasak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201027132236.187863854@rtp-net.org \
--to=arnaud.patard@rtp-net.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox