linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>,
	Jon Hunter <jonathanh@nvidia.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Joseph Lo <josephl@nvidia.com>,
	linux-tegra@vger.kernel.org, devicetree@vger.kernel.org,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v6 10/14] memory: tegra: Add EMC scaling sequence code for Tegra210
Date: Tue, 14 Apr 2020 17:45:26 +0200	[thread overview]
Message-ID: <20200414154526.GP3593749@ulmo> (raw)
In-Reply-To: <682c661d-ea3a-7b9a-42f0-d5473b969aa2@gmail.com>

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

On Fri, Apr 10, 2020 at 05:18:51PM +0300, Dmitry Osipenko wrote:
> 09.04.2020 20:52, Thierry Reding пишет:
> ...
> > +static void tegra210_emc_r21021_set_clock(struct tegra210_emc *emc, u32 clksrc)
> > +{
> > +	/*
> > +	 * This is the timing table for the source frequency. It does _not_
> > +	 * necessarily correspond to the actual timing values in the EMC at the
> > +	 * moment. If the boot BCT differs from the table then this can happen.
> > +	 * However, we need it for accessing the dram_timings (which are not
> > +	 * really registers) array for the current frequency.
> > +	 */
> > +	u32 tmp, cya_allow_ref_cc = 0, ref_b4_sref_en = 0, cya_issue_pc_ref = 0;
> > +	struct tegra210_emc_timing *fake, *last = emc->last, *next = emc->next;
> > +	u32 bg_regulator_switch_complete_wait_clks, bg_regulator_mode_change;
> > +	u32 opt_zcal_en_cc, opt_do_sw_qrst = 1, opt_dvfs_mode, opt_dll_mode;
> > +	u32 emc_zcal_wait_cnt_old, emc_zcal_wait_cnt_new, emc_dbg_active;
> > +	u32 opt_cc_short_zcal = 1, opt_short_zcal = 1, opt_war_200024907;
> > +	u32 tRTM, RP_war, R2P_war, TRPab_war, deltaTWATM, W2P_war, tRPST;
> > +	u32 adel = 0, compensate_trimmer_applicable = 0, mrw_req, value;
> > +	unsigned long next_timing_rate_mhz = next->rate / 1000, delay;
> > +	u32 tZQCAL_lpddr4 = 1000000, zq_wait_long, shared_zq_resistor;
> > +	s32 zq_latch_dvfs_wait_time, tZQCAL_lpddr4_fc_adj, nRTP;
> > +	u32 tFC_lpddr4 = 1000 * next->dram_timings[T_FC_LPDDR4];
> > +	u32 emc_auto_cal_config, auto_cal_en, mr13_catr_enable;
> > +	u32 zq_op, zcal_wait_time_clocks, zcal_wait_time_ps;
> > +	u32 emc_cfg, emc_sel_dpd_ctrl, emc_zcal_interval;
> > +	int next_push, next_dq_e_ivref, next_dqs_e_ivref;
> > +	u32 mr13_flip_fspwr, mr13_flip_fspop, is_lpddr3;
> > +	u32 enable_bglp_regulator, enable_bg_regulator;
> > +	u32 emc_dbg_o, emc_cfg_pipe_clk_o, emc_pin_o;
> > +	u32 ramp_up_wait = 0, ramp_down_wait = 0;
> > +	u32 save_restore_clkstop_pd = 1, dll_out;
> > +	u32 ref_delay_mult, ref_delay, dram_type;
> > +	static u32 fsp_for_next_freq;
> > +	/* In picoseconds. */
> > +	u32 source_clock_period, destination_clock_period;
> > +	u32 zqcal_before_cc_cutoff = 2400;
> > +	unsigned int i;
> 
> What about to try to replace this massive egyptian construction with a
> single "u32 val;" ?

I actually tried that after condensing what this used to look like into
the above. The result was a huge failure because some of these temporary
values end up being reused, so I ended up writing bogus values into some
of these registers.

> > +	emc_readl(emc, EMC_CFG);
> > +	emc_auto_cal_config = emc_readl(emc, EMC_AUTO_CAL_CONFIG);
> 
> And remove all the "dummy" variable assigns in the code?
> 
> ...
> > emc_auto_cal_config = next->emc_auto_cal_config;
> ...> +	emc_zcal_interval = 0;
> 
> And replace all "constant" variables with a raw value in place in the code?

Okay, I'll give this another try, hopefully this time I won't run into
the same problems as earlier.

Thierry

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

  reply	other threads:[~2020-04-14 15:45 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 17:52 [PATCH v6 00/14] Add EMC scaling support for Tegra210 Thierry Reding
2020-04-09 17:52 ` [PATCH v6 02/14] of: reserved-memory: Support lookup of regions by name Thierry Reding
     [not found]   ` <20200409175238.3586487-3-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-15 16:24     ` Rob Herring
2020-04-15 23:35       ` Thierry Reding
2020-04-16  0:58         ` Rob Herring
2020-04-09 17:52 ` [PATCH v6 03/14] of: reserved-memory: Support multiple regions per device Thierry Reding
     [not found]   ` <20200409175238.3586487-4-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-15 16:25     ` Rob Herring
2020-04-09 17:52 ` [PATCH v6 05/14] clk: tegra: Add PLLP_UD and PLLMB_UD for Tegra210 Thierry Reding
2020-04-09 17:52 ` [PATCH v6 06/14] clk: tegra: Export functions for EMC clock scaling Thierry Reding
2020-04-09 17:52 ` [PATCH v6 08/14] dt-bindings: memory: tegra: Add external memory controller binding for Tegra210 Thierry Reding
     [not found]   ` <20200409175238.3586487-9-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-15 16:27     ` Rob Herring
2020-04-09 17:52 ` [PATCH v6 09/14] memory: tegra: Add EMC scaling support code " Thierry Reding
2020-04-09 19:00   ` Dmitry Osipenko
     [not found]     ` <7b2f8a7c-94f1-08d0-b0ce-c61f4eb0a436-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-14 14:45       ` Thierry Reding
     [not found]   ` <20200409175238.3586487-10-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-09 19:16     ` Dmitry Osipenko
     [not found]       ` <a9afb1b5-3141-4923-c7fa-194228081e1b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-14 14:54         ` Thierry Reding
2020-04-14 20:50           ` Dmitry Osipenko
2020-04-09 23:56     ` Dmitry Osipenko
     [not found]       ` <3e518dfa-cb3d-e2ce-a9b8-5e143e02fc61-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-11 20:39         ` Dmitry Osipenko
2020-04-14 15:05           ` Thierry Reding
2020-04-14 15:32             ` Dmitry Osipenko
2020-04-14 15:02         ` Thierry Reding
2020-04-10 14:25     ` Dmitry Osipenko
2020-04-14 15:08       ` Thierry Reding
2020-04-10 14:26     ` Dmitry Osipenko
     [not found]       ` <14cfd13a-5fde-f167-64cb-a61cba119a97-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-14 15:39         ` Thierry Reding
2020-04-10 20:46     ` Dmitry Osipenko
     [not found]       ` <fae8e1f5-753b-b2ce-d14f-c6e8b2061fdd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-14 15:41         ` Thierry Reding
2020-04-14 20:39     ` Dmitry Osipenko
2020-04-14 20:46     ` Dmitry Osipenko
2020-04-14 20:56       ` Dmitry Osipenko
2020-04-09 17:52 ` [PATCH v6 10/14] memory: tegra: Add EMC scaling sequence " Thierry Reding
     [not found]   ` <20200409175238.3586487-11-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-10 14:18     ` Dmitry Osipenko
2020-04-14 15:45       ` Thierry Reding [this message]
2020-04-14 16:27         ` Dmitry Osipenko
     [not found]           ` <e050baee-89cb-dba1-544e-77b1662ac6b7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-14 20:03             ` Thierry Reding
     [not found] ` <20200409175238.3586487-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-09 17:52   ` [PATCH v6 01/14] dt-bindings: reserved-memory: Introduce memory-region-names Thierry Reding
     [not found]     ` <20200409175238.3586487-2-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-15 16:23       ` Rob Herring
2020-04-09 17:52   ` [PATCH v6 04/14] clk: tegra: Rename Tegra124 EMC clock source file Thierry Reding
     [not found]     ` <20200409175238.3586487-5-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-14 16:48       ` Dmitry Osipenko
     [not found]         ` <a7209708-6e67-5885-5935-2db3d92174e8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-14 17:14           ` Thierry Reding
2020-04-09 17:52   ` [PATCH v6 07/14] clk: tegra: Implement Tegra210 EMC clock Thierry Reding
     [not found]     ` <20200409175238.3586487-8-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-09 18:24       ` Dmitry Osipenko
     [not found]         ` <8dc000fb-8867-cf8f-8204-a9e1e79a4811-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-14 14:34           ` Thierry Reding
2020-04-14 15:18             ` Dmitry Osipenko
     [not found]               ` <92eb73ba-73e4-f9f1-bb22-9b515e32cee6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-14 17:10                 ` Thierry Reding
2020-04-14 20:22                   ` Dmitry Osipenko
2020-04-10 20:49       ` Dmitry Osipenko
     [not found]         ` <0e040cf9-56cf-dd44-3523-ff4c82fb1f2c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-14 14:36           ` Thierry Reding
2020-04-09 17:52   ` [PATCH v6 11/14] memory: tegra: Support derated timings on Tegra210 Thierry Reding
     [not found]     ` <20200409175238.3586487-12-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-09 23:44       ` Dmitry Osipenko
2020-04-14 15:47         ` Thierry Reding
2020-04-14 16:25           ` Dmitry Osipenko
2020-04-10 14:28       ` Dmitry Osipenko
     [not found]         ` <937a1aa6-473a-f6c5-729a-4f34e4ee3abb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-14 16:29           ` Thierry Reding
2020-04-14 16:40     ` Dmitry Osipenko
     [not found]       ` <543bfc3b-2bb9-01d3-62da-89d1f0b18a5b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-04-14 16:48         ` Thierry Reding
2020-04-09 17:52   ` [PATCH v6 12/14] arm64: tegra: Add external memory controller node for Tegra210 Thierry Reding
2020-04-09 17:52   ` [PATCH v6 13/14] arm64: tegra: Hook up EMC cooling device Thierry Reding
2020-04-09 17:52 ` [PATCH v6 14/14] clk: tegra: Remove the old emc_mux clock for Tegra210 Thierry Reding

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=20200414154526.GP3593749@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=josephl@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.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;
as well as URLs for NNTP newsgroup(s).