public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Thierry Reding" <thierry.reding@gmail.com>
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: "Thierry Reding" <treding@nvidia.com>,
	"Anatolij Gustschin" <agust@denx.de>,
	"Simon Glass" <sjg@chromium.org>, <u-boot@lists.denx.de>
Subject: Re: [PATCH v6 06/18] video: tegra20: dc: add reset support
Date: Fri, 19 Apr 2024 18:46:22 +0200	[thread overview]
Message-ID: <D0O92LGLWMLP.34AR1F3WJZQCV@gmail.com> (raw)
In-Reply-To: <CAPVz0n0UX1JOxyGbBgd430oMGUb7vDb5td3oZ2beMTVRa3tktQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3548 bytes --]

On Fri Apr 19, 2024 at 6:37 PM CEST, Svyatoslav Ryhel wrote:
> пт, 19 квіт. 2024 р. о 19:05 Thierry Reding <thierry.reding@gmail.com> пише:
> >
> > On Tue Jan 23, 2024 at 6:16 PM CET, Svyatoslav Ryhel wrote:
> > > Implement reset use to discard any changes which could have been
> > > applied to DC before and can interfere with current configuration.
> > >
> > > Tested-by: Agneli <poczt@protonmail.ch> # Toshiba AC100 T20
> > > Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101
> > > Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS Grouper E1565
> > > Tested-by: Ion Agorria <ion@agorria.com> # HTC One X
> > > Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # Nvidia Tegratab T114
> > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > > ---
> > >  drivers/video/tegra20/tegra-dc.c | 17 +++++++++++++++++
> > >  1 file changed, 17 insertions(+)
> > >
> > > diff --git a/drivers/video/tegra20/tegra-dc.c b/drivers/video/tegra20/tegra-dc.c
> > > index 56a23b3c97..35abb6fe46 100644
> > > --- a/drivers/video/tegra20/tegra-dc.c
> > > +++ b/drivers/video/tegra20/tegra-dc.c
> > > @@ -10,7 +10,9 @@
> > >  #include <panel.h>
> > >  #include <part.h>
> > >  #include <pwm.h>
> > > +#include <reset.h>
> > >  #include <video.h>
> > > +#include <linux/delay.h>
> > >  #include <asm/cache.h>
> > >  #include <asm/global_data.h>
> > >  #include <asm/system.h>
> > > @@ -342,6 +344,7 @@ static int tegra_lcd_probe(struct udevice *dev)
> > >       struct video_uc_plat *plat = dev_get_uclass_plat(dev);
> > >       struct video_priv *uc_priv = dev_get_uclass_priv(dev);
> > >       struct tegra_lcd_priv *priv = dev_get_priv(dev);
> > > +     struct reset_ctl reset_ctl;
> > >       int ret;
> > >
> > >       /* Initialize the Tegra display controller */
> > > @@ -349,6 +352,20 @@ static int tegra_lcd_probe(struct udevice *dev)
> > >       funcmux_select(PERIPH_ID_DISP1, FUNCMUX_DEFAULT);
> > >  #endif
> > >
> > > +     ret = reset_get_by_name(dev, "dc", &reset_ctl);
> > > +     if (ret) {
> > > +             log_err("reset_get_by_name() failed: %d\n", ret);
> > > +             return ret;
> > > +     }
> > > +
> > > +     clock_disable(priv->dc_clk[0]);
> > > +
> > > +     /* Reset everything set before */
> > > +     reset_assert(&reset_ctl);
> > > +     mdelay(4);
> > > +     reset_deassert(&reset_ctl);
> > > +     mdelay(4);
> >
> > Are you sure this works as intended? It's been a long time since I
> > worked on this, but I seem to recall that most of these resets are
> > actually synchronous, so in order for them to do what they're supposed
> > to the clock needs to be kept running.
> >
> > The Linux driver certainly does this differently.
>
> You have point, but I have tried to mostly adapt Linux tegra dc driver,
> which has same logic in probe. Maybe I have not understood it properly.
> Testing on T20, T30 and T114 passed without issues so far.

Maybe look again. What it does is (basically):

	clock_enable();
	mdelay(4);
	reset_assert();
	mdelay(4);
	clock_disable();

That should ensure that it's completely reset at that point. Now before
any subsequent register accesses happen it will do this:

	clock_enable();
	reset_deassert();

to take it out of reset again. Perhaps that's something you want to keep
doing in probe() in U-Boot. In that case maybe you want something like
this instead:

	clock_enable();
	mdelay(4);
	reset_assert();
	mdelay(4);
	reset_deassert();

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-04-19 16:46 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 17:16 [PATCH v6 00/18] Add T114 video support Svyatoslav Ryhel
2024-01-23 17:16 ` [PATCH v6 01/18] video: tegra20: dc: diverge DC per-SOC Svyatoslav Ryhel
2024-04-19 16:26   ` Thierry Reding
2024-04-19 16:34     ` Thierry Reding
2024-04-19 17:16     ` Svyatoslav Ryhel
2024-01-23 17:16 ` [PATCH v6 02/18] video: tegra20: dc: fix image shift on rotated panels Svyatoslav Ryhel
2024-04-19 16:33   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 03/18] video: tegra20: consolidate DC header Svyatoslav Ryhel
2024-04-19 15:56   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 04/18] video: tegra20: dc: pass DC id to internal devices Svyatoslav Ryhel
2024-04-19 16:38   ` Thierry Reding
2024-04-19 16:44     ` Svyatoslav Ryhel
2024-04-19 16:58       ` Thierry Reding
2024-04-19 17:02         ` Svyatoslav Ryhel
2024-01-23 17:16 ` [PATCH v6 05/18] video: tegra20: dc: add PLLD2 parent support Svyatoslav Ryhel
2024-04-19 16:50   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 06/18] video: tegra20: dc: add reset support Svyatoslav Ryhel
2024-04-19 16:05   ` Thierry Reding
2024-04-19 16:37     ` Svyatoslav Ryhel
2024-04-19 16:46       ` Thierry Reding [this message]
2024-04-19 16:53         ` Svyatoslav Ryhel
2024-01-23 17:16 ` [PATCH v6 07/18] video: tegra20: dc: add powergate Svyatoslav Ryhel
2024-04-19 16:55   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 08/18] video: tegra20: dc: configure behavior if PLLD/D2 is used Svyatoslav Ryhel
2024-04-19 16:48   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 09/18] video: tegra20: dc: fix printing of framebuffer address Svyatoslav Ryhel
2024-04-19 17:03   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 10/18] video: tegra20: dc: enable backlight after DC is configured Svyatoslav Ryhel
2024-04-19 16:35   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 11/18] video: tegra20: dc: clean framebuffer memory block Svyatoslav Ryhel
2024-04-19 16:54   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 12/18] video: tegra20: dc: parameterize V- and H-sync polarities Svyatoslav Ryhel
2024-04-19 17:00   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 13/18] video: tegra20: add MIPI calibration driver Svyatoslav Ryhel
2024-04-19 16:10   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 14/18] video: tegra20: dsi: add T114 support Svyatoslav Ryhel
2024-04-19 16:29   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 15/18] video: tegra20: dsi: add reset support Svyatoslav Ryhel
2024-04-19 16:52   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 16/18] video: tegra20: dsi: remove pre-configuration Svyatoslav Ryhel
2024-04-19 16:41   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 17/18] video: tegra20: dsi: set correct fifo depth Svyatoslav Ryhel
2024-04-19 16:30   ` Thierry Reding
2024-01-23 17:16 ` [PATCH v6 18/18] video: tegra20: dsi: use set_backlight for backlight only Svyatoslav Ryhel
2024-04-19 16:00   ` Thierry Reding
2024-04-19 11:30 ` [PATCH v6 00/18] Add T114 video support Svyatoslav Ryhel
2024-04-20 23:02 ` Anatolij Gustschin

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=D0O92LGLWMLP.34AR1F3WJZQCV@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=agust@denx.de \
    --cc=clamor95@gmail.com \
    --cc=sjg@chromium.org \
    --cc=treding@nvidia.com \
    --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