All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 06/14] tegra: Add EMC support for optimal memory timings
Date: Fri, 13 Jan 2012 09:47:39 -0800	[thread overview]
Message-ID: <CAPnjgZ3VmBnWG05o0bRuoxKRtp+A3w83ZKojwM=M-xFUz6J6Hg@mail.gmail.com> (raw)
In-Reply-To: <CAPnjgZ15TtUxHjbf=b52hU7RmCRQTn=+-RuaUkhN24MwEspfnA@mail.gmail.com>

Hi Stephen,

On Thu, Jan 12, 2012 at 12:43 PM, Simon Glass <sjg@chromium.org> wrote:
> Hi Stephen,
>
> On Mon, Jan 9, 2012 at 3:38 PM, Stephen Warren <swarren@nvidia.com> wrote:
>> On 12/26/2011 12:32 PM, Simon Glass wrote:
>>> From: Jimmy Zhang <jimmzhang@nvidia.com>
>>>
>>> Add support for setting up the memory controller parameters. Boards
>>> can call tegra_set_emc() with a table containing the required
>>> parameters.
>> ...
>>> diff --git a/arch/arm/cpu/armv7/tegra2/emc.c b/arch/arm/cpu/armv7/tegra2/emc.c
>> ...
>>> +static const struct tegra_emc_table *tegra_emc_table;
>>> +static int tegra_emc_table_size;
>>
>> This isn't "table_size", but "number_of_tables" or "num_tables" or
>> "table_count". This sounds nit-picky, but it made me think about this
>> change more than I needed to given its simplicity.
>
> OK changed to num_emc_tables.
>
>>
>>> +static const unsigned long emc_reg_addr[TEGRA_EMC_NUM_REGS] = {
>>> + ? ? ? 0x2c, ? /* RC */
>>
>> For reference, I validated that the order or registers here matches that
>> in the DT binding that Olof published for the kernel, which is good.
>>
>> http://patchwork.ozlabs.org/patch/132928/
>
> Yes I would hope so :-) Thanks for checking. I can't see it committed,
> so will reply on that thread.
>
>>
>>> +/* The EMC registers have shadow registers. ?When the EMC clock is updated
>>> + * in the clock controller, the shadow registers are copied to the active
>>> + * registers, allowing glitchless memory bus frequency changes.
>>> + * This function updates the shadow registers for a new clock frequency,
>>> + * and relies on the clock lock on the emc clock to avoid races between
>>> + * multiple frequency changes */
>>> +#define EMC_SDRAM_RATE_T20 ? ? (333000 * 2 * 1000)
>>> +#define EMC_SDRAM_RATE_T25 ? ? (380000 * 2 * 1000)
>> ...
>>> +int tegra_set_emc(const struct tegra_emc_table *table, int table_size)
>> ...
>>> + ? ? ? switch (tegra_get_chip_type()) {
>>> + ? ? ? case TEGRA_SOC_T20:
>>> + ? ? ? ? ? ? ? rate ?= EMC_SDRAM_RATE_T20;
>>> + ? ? ? ? ? ? ? break;
>>> + ? ? ? case TEGRA_SOC_T25:
>>> + ? ? ? ? ? ? ? rate ?= EMC_SDRAM_RATE_T25;
>>> + ? ? ? ? ? ? ? break;
>>> + ? ? ? default:
>>> + ? ? ? ? ? ? ? /* unknown chip type, no clk change*/
>>> + ? ? ? ? ? ? ? return -1;
>>> + ? ? ? }
>>
>> I'm not convinced that limiting this to those two specific clocks is
>> correct. I've certainly seen BCTs that appear to run the EMC clock at
>> other frequencies. Specifically, for Seaboard, we appear to have BCTs
>> for 190, 333, 380, and 400MHz internally. I think a board should be able
>> to at least override the default rate selected by that switch statement.
>
> OK. It might be time to move this to the fdt, I will take a look.
>
>>
>> In tegra_emc_set_rate(), it's unclear to me why
>> clock_ll_set_source_divisor() is used to trigger use of the new EMC
>> register content, rather than say clock_set_rate(). I guess that's just
>> how the HW work?
>
> It should be possible to do something like:
>
> ? ? ? ?clock_adjust_periph_pll(PERIPH_ID_EMC, CLOCK_ID_MEMORY, 0,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?clock_get_rate(CLOCK_ID_MEMORY));
>
> although it is a lot less efficient. I will try it.

Yes that works. I want to reduce use of the xxx_ll() functions as much
as possible so have changed this.

Regards,
Simon

>
> Regards,
> Simon
>
>>
>> --
>> nvpublic

  reply	other threads:[~2012-01-13 17:47 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-26 19:32 [U-Boot] [PATCH 0/14] tegra: warmboot (suspend / resume) support Simon Glass
2011-12-26 19:32 ` [U-Boot] [PATCH 01/14] Add AES crypto library Simon Glass
2012-01-08  5:49   ` Mike Frysinger
2012-01-08  8:57     ` Marek Vasut
2012-01-08  9:09       ` Mike Frysinger
2012-01-08 10:40         ` Marek Vasut
2012-01-08 16:35           ` Simon Glass
2011-12-26 19:32 ` [U-Boot] [PATCH 02/14] tegra: Move ap20.h header into arch location Simon Glass
2011-12-26 19:32 ` [U-Boot] [PATCH 03/14] tegra: Add crypto library for warmboot code Simon Glass
2012-01-08  5:51   ` Mike Frysinger
2012-01-08 16:42     ` Simon Glass
2011-12-26 19:32 ` [U-Boot] [PATCH 04/14] tegra: Add flow, gp_padctl, fuse, sdram headers Simon Glass
2011-12-26 19:32 ` [U-Boot] [PATCH 05/14] tegra: Add tegra_get_chip_type() to detect SKU Simon Glass
2012-01-09 23:24   ` Stephen Warren
2012-01-12 19:35     ` Simon Glass
2012-01-12 19:48       ` Stephen Warren
2012-01-13 21:06         ` Simon Glass
2011-12-26 19:32 ` [U-Boot] [PATCH 06/14] tegra: Add EMC support for optimal memory timings Simon Glass
2012-01-09 23:38   ` Stephen Warren
2012-01-12 20:43     ` Simon Glass
2012-01-13 17:47       ` Simon Glass [this message]
2011-12-26 19:33 ` [U-Boot] [PATCH 07/14] tegra: Add PMU to manage power supplies Simon Glass
2012-01-10 17:56   ` Stephen Warren
2012-01-12 23:17     ` Simon Glass
2012-01-12 23:43       ` Stephen Warren
2012-01-12 23:55         ` Simon Glass
2011-12-26 19:33 ` [U-Boot] [PATCH 08/14] tegra: Set up PMU for Nvidia boards Simon Glass
2012-01-10 18:02   ` Stephen Warren
2012-01-12 23:42     ` Simon Glass
2011-12-26 19:33 ` [U-Boot] [PATCH 09/14] tegra: Add warmboot implementation Simon Glass
2012-01-10 18:30   ` Stephen Warren
2012-01-13 19:34     ` Simon Glass
2012-01-13 22:04       ` Yen Lin
2012-01-13 23:05         ` Simon Glass
2012-01-13 23:08           ` Stephen Warren
2012-01-14  0:04             ` Yen Lin
2011-12-26 19:33 ` [U-Boot] [PATCH 10/14] tegra: Setup PMC scratch info from ap20 setup Simon Glass
2011-12-26 19:33 ` [U-Boot] [PATCH 11/14] tegra: Set up warmboot code on Nvidia boards Simon Glass
2011-12-26 19:33 ` [U-Boot] [PATCH 12/14] tegra: Set vdd_core and vdd_cpu to high Simon Glass
2012-01-10 18:40   ` Stephen Warren
2012-01-13 17:55     ` Simon Glass
2011-12-26 19:33 ` [U-Boot] [PATCH 13/14] tegra: Add EMC settings for Seaboard, Harmony Simon Glass
2012-01-10 18:46   ` Stephen Warren
2012-01-12 23:05     ` Simon Glass
2012-01-12 23:42       ` Stephen Warren
2012-01-12 23:54         ` Simon Glass
2012-01-13  0:01           ` Stephen Warren
2012-01-13  0:05             ` Simon Glass
2012-01-13  0:10               ` Stephen Warren
2012-01-13  0:18                 ` Simon Glass
2011-12-26 19:33 ` [U-Boot] [PATCH 14/14] tegra: Enable LP0 on Seaboard Simon Glass

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='CAPnjgZ3VmBnWG05o0bRuoxKRtp+A3w83ZKojwM=M-xFUz6J6Hg@mail.gmail.com' \
    --to=sjg@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.