All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
To: Marek Vasut <marex@denx.de>, <u-boot@lists.denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>,
	<nicolas.le.bayon@fos.st.com>
Subject: Re: [PATCH] ram: stm32mp1: Conditionally enable ASR
Date: Tue, 26 Apr 2022 12:49:30 +0200	[thread overview]
Message-ID: <d458905e-157e-3458-b011-af85a769e18f@foss.st.com> (raw)
In-Reply-To: <641bd43c-c2f4-d1a8-7a67-1a2f0039dcfb@denx.de>

Hi Marek,

On 4/14/22 19:34, Marek Vasut wrote:
> On 4/14/22 18:48, Marek Vasut wrote:
>> On 4/14/22 18:37, Patrick DELAUNAY wrote:
>>> Hi Marek,
>>
>> Hi,
>>
>>> on ST platform the ASR/SSR/HSR request are already provided by the 
>>> DDR settings with pwrctl register value
>>>
>>> it is managed in TF-A by
>>>
>>> arm-trusted-firmware/drivers/st/ddr/stm32mp1_ddr_helpers.c
>>
>> Sure, I don't use ATF and I have no intention of ever using ATF on 
>> this platform.


Yes i know.


>>
>>> enumstm32mp1_ddr_sr_mode ddr_read_sr_mode(void)
>>> {
>>> uint32_tpwrctl = mmio_read_32(stm32mp_ddrctrl_base() + DDRCTRL_PWRCTL);
>>> switch(pwrctl & (DDRCTRL_PWRCTL_EN_DFI_DRAM_CLK_DISABLE |
>>> DDRCTRL_PWRCTL_SELFREF_EN)) {
>>> case0U:
>>> returnDDR_SSR_MODE;
>>> caseDDRCTRL_PWRCTL_EN_DFI_DRAM_CLK_DISABLE:
>>> returnDDR_HSR_MODE;
>>> caseDDRCTRL_PWRCTL_EN_DFI_DRAM_CLK_DISABLE | DDRCTRL_PWRCTL_SELFREF_EN:
>>> returnDDR_ASR_MODE;
>>> default:
>>> returnDDR_SR_MODE_INVALID;
>>> }
>>> }
>>>
>>> no need to add an other property
>>
>> This is for U-Boot, plain, stock, without any other software 
>> partaking in it.
>
> Note that this patch just reinstates the old behavior before v2022.04 
> release, except it adds a DT property to enable the new behavior with 
> ASR and makes it non-default.


I agree that ASR can't be activated by default to avoid issue, so the 
previous shortcut

(always activate ASR in SPL) must be changed.


Today my concerns is only the binding.

The same binding for DDR sub system (control and PHY) must be shared by 
all the bootloader; It is my request.

in stm32mp1_ddr_setup() = ddr_set_sr_mode(ddr_read_sr_mode());

The ASR activation is already managed by existing binding with the 
pwrctl register value => DDR_PWRCTL in ./arch/arm/dts/stm32mp15-ddr.dtsi

as it is explained in ST Microelectronics documentation (AN5168: DDR 
configuration on STM32MP1 Series MPUs) and managed by the tool CubeMX 
and TF-A driver.


I propose to do the same, by using the same/existing binding, so the 
same DDR configuration file

generated by CubeMX tools can be used of TF-A and SPL

=> ASR deactivated by default when the

in stm32mp1_ddr_setup() = ddr_set_sr_mode(ddr_read_sr_mode());

requested pwrctl value is 0x0 (default today)

=> ASR is activated when it is request with pwrctl value

So in futur the HSR mode could be also added, as it is done today in TF-A stm32mp1_ddr_setup() =
	ddr_set_sr_mode(ddr_read_sr_mode());


> diff --git a/drivers/ram/stm32mp1/stm32mp1_ddr.c b/drivers/ram/stm32mp1/stm32mp1_ddr.c
> index 528a171b454..fd11e02aff4 100644
> --- a/drivers/ram/stm32mp1/stm32mp1_ddr.c
> +++ b/drivers/ram/stm32mp1/stm32mp1_ddr.c
> @@ -845,7 +845,8 @@ start:
>  				 config->c_reg.pwrctl);
>  
>  /* Enable auto-self-refresh, which saves a bit of power at runtime. */
> -	stm32mp1_asr_enable(priv);
> +	if (config->info.enable_asr)
> +		stm32mp1_asr_enable(priv);

I propose (based on TF-A code = ddr_read_sr_mode())


/* Enable auto-self-refresh, which saves a bit of power at runtime. */
-	stm32mp1_asr_enable(priv);

+ if (config->c_reg.pwrctl & (DDRCTRL_PWRCTL_EN_DFI_DRAM_CLK_DISABLE | 
DDRCTRL_PWRCTL_SELFREF_EN) == DDRCTRL_PWRCTL_EN_DFI_DRAM_CLK_DISABLE | 
DDRCTRL_PWRCTL_SELFREF_EN)

+ stm32mp1_asr_enable(priv);


With

#define DDRCTRL_PWRCTL_EN_DFI_DRAM_CLK_DISABLE    BIT(3)

If one board need to activate the ASR mode, the associated field in the 
DDR node need to be change, with:

#define DDR_PWRCTL 0x00000009


Regards,


Patrick


  reply	other threads:[~2022-04-26 10:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13  2:49 [PATCH] ram: stm32mp1: Conditionally enable ASR Marek Vasut
2022-04-14 16:37 ` Patrick DELAUNAY
2022-04-14 16:48   ` Marek Vasut
2022-04-14 17:34     ` Marek Vasut
2022-04-26 10:49       ` Patrick DELAUNAY [this message]
2022-04-26 11:27         ` Patrick DELAUNAY
2022-04-22  7:57 ` Patrice CHOTARD

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=d458905e-157e-3458-b011-af85a769e18f@foss.st.com \
    --to=patrick.delaunay@foss.st.com \
    --cc=marex@denx.de \
    --cc=nicolas.le.bayon@fos.st.com \
    --cc=patrice.chotard@foss.st.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 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.