From: "Jernej Škrabec" <jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
To: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
Cc: Maxime Ripard
<maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
David Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
dri-devel
<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-arm-kernel
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
linux-kernel
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-sunxi <linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: [PATCH 16/17] drm/sun4i: tcon-top: Remove mux configuration at probe time
Date: Tue, 10 Jul 2018 18:18:43 +0200 [thread overview]
Message-ID: <1843348.gnui32CGBV@jernej-laptop> (raw)
In-Reply-To: <CAGb2v64rjUnwnXbWxTSYJyhMyCV5QmV9YSr+Jryx3nEeMP8GJg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Dne torek, 10. julij 2018 ob 18:09:26 CEST je Chen-Yu Tsai napisal(a):
> On Sat, Jul 7, 2018 at 1:51 AM, Jernej Skrabec <jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
wrote:
> > Now that R40 TCON migrated to runtime mux configuration, old code can be
> > removed.
> >
> > Signed-off-by: Jernej Skrabec <jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
> > ---
> >
> > drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 81 +++-----------------------
> > 1 file changed, 7 insertions(+), 74 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
> > b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c index c09b15b64192..78795d6cb174
> > 100644
> > --- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
> > +++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
> > @@ -87,34 +87,6 @@ int sun8i_tcon_top_de_config(struct device *dev, int
> > mixer, int tcon)>
> > }
> > EXPORT_SYMBOL(sun8i_tcon_top_de_config);
> >
> > -static int sun8i_tcon_top_get_connected_ep_id(struct device_node *node,
> > - int port_id)
> > -{
> > - struct device_node *ep, *remote, *port;
> > - struct of_endpoint endpoint;
> > -
> > - port = of_graph_get_port_by_id(node, port_id);
> > - if (!port)
> > - return -ENOENT;
> > -
> > - for_each_available_child_of_node(port, ep) {
> > - remote = of_graph_get_remote_port_parent(ep);
> > - if (!remote)
> > - continue;
> > -
> > - if (of_device_is_available(remote)) {
> > - of_graph_parse_endpoint(ep, &endpoint);
> > -
> > - of_node_put(remote);
> > -
> > - return endpoint.id;
> > - }
> > -
> > - of_node_put(remote);
> > - }
> > -
> > - return -ENOENT;
> > -}
> >
> > static struct clk_hw *sun8i_tcon_top_register_gate(struct device *dev,
> >
> > const char *parent,
> >
> > @@ -149,11 +121,9 @@ static int sun8i_tcon_top_bind(struct device *dev,
> > struct device *master,>
> > struct platform_device *pdev = to_platform_device(dev);
> > struct clk_hw_onecell_data *clk_data;
> > struct sun8i_tcon_top *tcon_top;
> >
> > - bool mixer0_unused = false;
> >
> > struct resource *res;
> > void __iomem *regs;
> >
> > - int ret, i, id;
> > - u32 val;
> > + int ret, i;
> >
> > tcon_top = devm_kzalloc(dev, sizeof(*tcon_top), GFP_KERNEL);
> > if (!tcon_top)
> >
> > @@ -198,49 +168,12 @@ static int sun8i_tcon_top_bind(struct device *dev,
> > struct device *master,>
> > goto err_assert_reset;
> >
> > }
> >
> > - val = 0;
> > -
> > - /* check if HDMI mux output is connected */
> > - if (sun8i_tcon_top_get_connected_ep_id(dev->of_node, 5) >= 0) {
> > - /* find HDMI input endpoint id, if it is connected at
> > all*/
> > - id = sun8i_tcon_top_get_connected_ep_id(dev->of_node, 4);
> > - if (id >= 0)
> > - val = FIELD_PREP(TCON_TOP_HDMI_SRC_MSK, id + 1);
> > - else
> > - DRM_DEBUG_DRIVER("TCON TOP HDMI input is not
> > connected\n"); - } else {
> > - DRM_DEBUG_DRIVER("TCON TOP HDMI output is not
> > connected\n"); - }
> > -
> > - writel(val, regs + TCON_TOP_GATE_SRC_REG);
> > -
> > - val = 0;
> > -
> > - /* process mixer0 mux output */
> > - id = sun8i_tcon_top_get_connected_ep_id(dev->of_node, 1);
> > - if (id >= 0) {
> > - val = FIELD_PREP(TCON_TOP_PORT_DE0_MSK, id);
> > - } else {
> > - DRM_DEBUG_DRIVER("TCON TOP mixer0 output is not
> > connected\n"); - mixer0_unused = true;
> > - }
> > -
> > - /* process mixer1 mux output */
> > - id = sun8i_tcon_top_get_connected_ep_id(dev->of_node, 3);
> > - if (id >= 0) {
> > - val |= FIELD_PREP(TCON_TOP_PORT_DE1_MSK, id);
> > -
> > - /*
> > - * mixer0 mux has priority over mixer1 mux. We have to
> > - * make sure mixer0 doesn't overtake TCON from mixer1.
> > - */
> > - if (mixer0_unused && id == 0)
> > - val |= FIELD_PREP(TCON_TOP_PORT_DE0_MSK, 1);
> > - } else {
> > - DRM_DEBUG_DRIVER("TCON TOP mixer1 output is not
> > connected\n"); - }
> > -
> > - writel(val, regs + TCON_TOP_PORT_SEL_REG);
> > + /*
> > + * Default register values might have some reserved bits set,
> > which
> > + * prevents TCON TOP from working properly. Set them to 0 here.
> > + */
> > + writel(0, regs + TCON_TOP_GATE_SRC_REG);
> > + writel(0, regs + TCON_TOP_PORT_SEL_REG);
>
> Would it make sense to just force a reset using the reset control?
I wrote TCON TOP driver for H6 at first. For some reason, some registers had
reserved bits set after reset line was released. TCON TOP was not used in U-
Boot, so I guess this counts as full reset.
I never tried to find out how it behaves on R40 because setting those
registers to 0 seems like simple, good enough solution, which works
everywhere.
Best regards,
Jernej
next prev parent reply other threads:[~2018-07-10 16:18 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-06 17:50 [PATCH 00/17] Allwinner R40 HDMI refactoring Jernej Skrabec
[not found] ` <20180706175113.26698-1-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-06 17:50 ` [PATCH 01/17] dt-bindings: display: sun4i-drm: Add R40 display engine compatible Jernej Skrabec
[not found] ` <20180706175113.26698-2-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 15:20 ` Chen-Yu Tsai
2018-07-06 17:50 ` [PATCH 02/17] drm/sun4i: " Jernej Skrabec
[not found] ` <20180706175113.26698-3-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 15:20 ` Chen-Yu Tsai
2018-07-06 17:50 ` [PATCH 03/17] ARM: dts: sun8i: r40: Remove fallback " Jernej Skrabec
[not found] ` <20180706175113.26698-4-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 15:21 ` Chen-Yu Tsai
2018-07-06 17:51 ` [PATCH 04/17] drm/sun4i: tcon-top: Cleanup clock handling Jernej Skrabec
[not found] ` <20180706175113.26698-5-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 15:23 ` Chen-Yu Tsai
2018-07-06 17:51 ` [PATCH 05/17] drm/sun4i: tcon: Release node when traversing of graph Jernej Skrabec
[not found] ` <20180706175113.26698-6-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 15:23 ` Chen-Yu Tsai
2018-07-06 17:51 ` [PATCH 06/17] dt-bindings: display: sun4i-drm: Add R40 TV TCON description Jernej Skrabec
[not found] ` <20180706175113.26698-7-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-06 20:40 ` Rob Herring
2018-07-06 20:44 ` Jernej Škrabec
2018-07-09 14:16 ` Rob Herring
2018-07-10 15:26 ` Chen-Yu Tsai
2018-07-06 17:51 ` [PATCH 07/17] drm/sun4i: DW HDMI: Release nodes if error happens during CRTC search Jernej Skrabec
[not found] ` <20180706175113.26698-8-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 15:31 ` Chen-Yu Tsai
2018-07-06 17:51 ` [PATCH 08/17] ARM: dts: sun8i: r40: Add mixer ids to TCON TOP Jernej Skrabec
[not found] ` <20180706175113.26698-9-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 15:35 ` Chen-Yu Tsai
2018-07-06 17:51 ` [PATCH 09/17] drm/sun4i: mixer: Read id from DT Jernej Skrabec
2018-07-10 15:40 ` Chen-Yu Tsai
2018-07-06 17:51 ` [PATCH 10/17] drm/sun4i: tcon-top: Add helpers for switching mux Jernej Skrabec
[not found] ` <20180706175113.26698-11-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 15:56 ` Chen-Yu Tsai
2018-07-06 17:51 ` [PATCH 11/17] drm/sun4i: tcon: Add another way for matching mixers with tcon Jernej Skrabec
[not found] ` <20180706175113.26698-12-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 16:12 ` Chen-Yu Tsai
2018-07-06 17:51 ` [PATCH 12/17] drm/sun4i: tcon: Add support for R40 TCON Jernej Skrabec
[not found] ` <20180706175113.26698-13-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 16:14 ` Chen-Yu Tsai
2018-07-06 17:51 ` [PATCH 13/17] ARM: dts: sun8i: r40: Remove fallback compatible for TCON TV Jernej Skrabec
[not found] ` <20180706175113.26698-14-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 15:49 ` Chen-Yu Tsai
2018-07-06 17:51 ` [PATCH 14/17] ARM: dts: sun8i: r40: Add missing TCON-TOP - TCON connections Jernej Skrabec
[not found] ` <20180706175113.26698-15-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 15:53 ` Chen-Yu Tsai
2018-07-06 17:51 ` [PATCH 15/17] ARM: dts: sun8i: r40: Disable TCONs by default Jernej Skrabec
2018-07-10 16:16 ` Chen-Yu Tsai
2018-07-06 17:51 ` [PATCH 16/17] drm/sun4i: tcon-top: Remove mux configuration at probe time Jernej Skrabec
[not found] ` <20180706175113.26698-17-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 16:09 ` Chen-Yu Tsai
[not found] ` <CAGb2v64rjUnwnXbWxTSYJyhMyCV5QmV9YSr+Jryx3nEeMP8GJg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-10 16:18 ` Jernej Škrabec [this message]
2018-07-10 19:41 ` Jernej Škrabec
2018-07-06 17:51 ` [PATCH 17/17] dt-bindings: display: sun4i-drm: Fix order of DW HDMI PHY compatibles Jernej Skrabec
[not found] ` <20180706175113.26698-18-jernej.skrabec-gGgVlfcn5nU@public.gmane.org>
2018-07-10 16:09 ` Chen-Yu Tsai
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=1843348.gnui32CGBV@jernej-laptop \
--to=jernej.skrabec-gggvlfcn5nu@public.gmane.org \
--cc=airlied-cv59FeDIM0c@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=wens-jdAy2FN1RRM@public.gmane.org \
/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