mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ddr: imx8m: add missing DDR clock rates
@ 2024-01-22 14:13 Ahmad Fatoum
  2024-01-23 10:04 ` Marco Felsch
  2024-02-08  7:35 ` Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2024-01-22 14:13 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

ddrphy_init_set_dfi_clk() is called to translate a scalar clock rate
as specified by board code into PLL parameters, which are configured.

enum ddr_rate describes the possible DDR rates and so far
ddrphy_init_set_dfi_clk() supported all of them, except for 2600 and
2376 MHz, rendering these two rates unusable.

Fix this by adding support for them into ddrphy_init_set_dfi_clk.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/ddr/imx/imx8m_ddr_init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/ddr/imx/imx8m_ddr_init.c b/drivers/ddr/imx/imx8m_ddr_init.c
index 8b829645c063..d9a5d589f27b 100644
--- a/drivers/ddr/imx/imx8m_ddr_init.c
+++ b/drivers/ddr/imx/imx8m_ddr_init.c
@@ -219,9 +219,9 @@ enum ddr_rate {
 	DDR_3720,
 	DDR_3200,
 	DDR_3000,
-	DDR_2600, /* Unused */
+	DDR_2600,
 	DDR_2400,
-	DDR_2376, /* Unused */
+	DDR_2376,
 	DDR_1600,
 	DDR_1000, /* Unused */
 	DDR_1066,
@@ -450,7 +450,9 @@ static void ddrphy_init_set_dfi_clk(struct dram_controller *dram, unsigned int d
 	case 3720: drate = DDR_3720; break;
 	case 3200: drate = DDR_3200; break;
 	case 3000: drate = DDR_3000; break;
+	case 2600: drate = DDR_2600; break;
 	case 2400: drate = DDR_2400; break;
+	case 2376: drate = DDR_2376; break;
 	case 1600: drate = DDR_1600; break;
 	case 1066: drate = DDR_1066; break;
 	case 667: drate = DDR_667; break;
-- 
2.39.2




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ddr: imx8m: add missing DDR clock rates
  2024-01-22 14:13 [PATCH] ddr: imx8m: add missing DDR clock rates Ahmad Fatoum
@ 2024-01-23 10:04 ` Marco Felsch
  2024-01-23 10:35   ` Ahmad Fatoum
  2024-02-08  7:35 ` Sascha Hauer
  1 sibling, 1 reply; 5+ messages in thread
From: Marco Felsch @ 2024-01-23 10:04 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On 24-01-22, Ahmad Fatoum wrote:
> ddrphy_init_set_dfi_clk() is called to translate a scalar clock rate
> as specified by board code into PLL parameters, which are configured.
> 
> enum ddr_rate describes the possible DDR rates and so far
> ddrphy_init_set_dfi_clk() supported all of them, except for 2600 and
> 2376 MHz, rendering these two rates unusable.
> 
> Fix this by adding support for them into ddrphy_init_set_dfi_clk.

Do we need to support this in TF-A as well for dvfs?

> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

The barebox change itself lgtm, therefore:

Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>

> ---
>  drivers/ddr/imx/imx8m_ddr_init.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ddr/imx/imx8m_ddr_init.c b/drivers/ddr/imx/imx8m_ddr_init.c
> index 8b829645c063..d9a5d589f27b 100644
> --- a/drivers/ddr/imx/imx8m_ddr_init.c
> +++ b/drivers/ddr/imx/imx8m_ddr_init.c
> @@ -219,9 +219,9 @@ enum ddr_rate {
>  	DDR_3720,
>  	DDR_3200,
>  	DDR_3000,
> -	DDR_2600, /* Unused */
> +	DDR_2600,
>  	DDR_2400,
> -	DDR_2376, /* Unused */
> +	DDR_2376,
>  	DDR_1600,
>  	DDR_1000, /* Unused */
>  	DDR_1066,
> @@ -450,7 +450,9 @@ static void ddrphy_init_set_dfi_clk(struct dram_controller *dram, unsigned int d
>  	case 3720: drate = DDR_3720; break;
>  	case 3200: drate = DDR_3200; break;
>  	case 3000: drate = DDR_3000; break;
> +	case 2600: drate = DDR_2600; break;
>  	case 2400: drate = DDR_2400; break;
> +	case 2376: drate = DDR_2376; break;
>  	case 1600: drate = DDR_1600; break;
>  	case 1066: drate = DDR_1066; break;
>  	case 667: drate = DDR_667; break;
> -- 
> 2.39.2
> 
> 
> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ddr: imx8m: add missing DDR clock rates
  2024-01-23 10:04 ` Marco Felsch
@ 2024-01-23 10:35   ` Ahmad Fatoum
  2024-01-23 12:15     ` Marco Felsch
  0 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2024-01-23 10:35 UTC (permalink / raw)
  To: Marco Felsch; +Cc: barebox

On 23.01.24 11:04, Marco Felsch wrote:
> On 24-01-22, Ahmad Fatoum wrote:
>> ddrphy_init_set_dfi_clk() is called to translate a scalar clock rate
>> as specified by board code into PLL parameters, which are configured.
>>
>> enum ddr_rate describes the possible DDR rates and so far
>> ddrphy_init_set_dfi_clk() supported all of them, except for 2600 and
>> 2376 MHz, rendering these two rates unusable.
>>
>> Fix this by adding support for them into ddrphy_init_set_dfi_clk.
> 
> Do we need to support this in TF-A as well for dvfs?

I don't know. I am not familiar with what needs to be done in TF-A
to support DVFS for these frequencies. Do you know?

> 
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> 
> The barebox change itself lgtm, therefore:
> 
> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> 
>> ---
>>  drivers/ddr/imx/imx8m_ddr_init.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/ddr/imx/imx8m_ddr_init.c b/drivers/ddr/imx/imx8m_ddr_init.c
>> index 8b829645c063..d9a5d589f27b 100644
>> --- a/drivers/ddr/imx/imx8m_ddr_init.c
>> +++ b/drivers/ddr/imx/imx8m_ddr_init.c
>> @@ -219,9 +219,9 @@ enum ddr_rate {
>>  	DDR_3720,
>>  	DDR_3200,
>>  	DDR_3000,
>> -	DDR_2600, /* Unused */
>> +	DDR_2600,
>>  	DDR_2400,
>> -	DDR_2376, /* Unused */
>> +	DDR_2376,
>>  	DDR_1600,
>>  	DDR_1000, /* Unused */
>>  	DDR_1066,
>> @@ -450,7 +450,9 @@ static void ddrphy_init_set_dfi_clk(struct dram_controller *dram, unsigned int d
>>  	case 3720: drate = DDR_3720; break;
>>  	case 3200: drate = DDR_3200; break;
>>  	case 3000: drate = DDR_3000; break;
>> +	case 2600: drate = DDR_2600; break;
>>  	case 2400: drate = DDR_2400; break;
>> +	case 2376: drate = DDR_2376; break;
>>  	case 1600: drate = DDR_1600; break;
>>  	case 1066: drate = DDR_1066; break;
>>  	case 667: drate = DDR_667; break;
>> -- 
>> 2.39.2
>>
>>
>>
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ddr: imx8m: add missing DDR clock rates
  2024-01-23 10:35   ` Ahmad Fatoum
@ 2024-01-23 12:15     ` Marco Felsch
  0 siblings, 0 replies; 5+ messages in thread
From: Marco Felsch @ 2024-01-23 12:15 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On 24-01-23, Ahmad Fatoum wrote:
> On 23.01.24 11:04, Marco Felsch wrote:
> > On 24-01-22, Ahmad Fatoum wrote:
> >> ddrphy_init_set_dfi_clk() is called to translate a scalar clock rate
> >> as specified by board code into PLL parameters, which are configured.
> >>
> >> enum ddr_rate describes the possible DDR rates and so far
> >> ddrphy_init_set_dfi_clk() supported all of them, except for 2600 and
> >> 2376 MHz, rendering these two rates unusable.
> >>
> >> Fix this by adding support for them into ddrphy_init_set_dfi_clk.
> > 
> > Do we need to support this in TF-A as well for dvfs?
> 
> I don't know. I am not familiar with what needs to be done in TF-A
> to support DVFS for these frequencies. Do you know?

See dram_pll_init() within the TF-A code. Marek recently added the 3600
case.

Regards,
  Marco

> >> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> > 
> > The barebox change itself lgtm, therefore:
> > 
> > Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> > 
> >> ---
> >>  drivers/ddr/imx/imx8m_ddr_init.c | 6 ++++--
> >>  1 file changed, 4 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/ddr/imx/imx8m_ddr_init.c b/drivers/ddr/imx/imx8m_ddr_init.c
> >> index 8b829645c063..d9a5d589f27b 100644
> >> --- a/drivers/ddr/imx/imx8m_ddr_init.c
> >> +++ b/drivers/ddr/imx/imx8m_ddr_init.c
> >> @@ -219,9 +219,9 @@ enum ddr_rate {
> >>  	DDR_3720,
> >>  	DDR_3200,
> >>  	DDR_3000,
> >> -	DDR_2600, /* Unused */
> >> +	DDR_2600,
> >>  	DDR_2400,
> >> -	DDR_2376, /* Unused */
> >> +	DDR_2376,
> >>  	DDR_1600,
> >>  	DDR_1000, /* Unused */
> >>  	DDR_1066,
> >> @@ -450,7 +450,9 @@ static void ddrphy_init_set_dfi_clk(struct dram_controller *dram, unsigned int d
> >>  	case 3720: drate = DDR_3720; break;
> >>  	case 3200: drate = DDR_3200; break;
> >>  	case 3000: drate = DDR_3000; break;
> >> +	case 2600: drate = DDR_2600; break;
> >>  	case 2400: drate = DDR_2400; break;
> >> +	case 2376: drate = DDR_2376; break;
> >>  	case 1600: drate = DDR_1600; break;
> >>  	case 1066: drate = DDR_1066; break;
> >>  	case 667: drate = DDR_667; break;
> >> -- 
> >> 2.39.2
> >>
> >>
> >>
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ddr: imx8m: add missing DDR clock rates
  2024-01-22 14:13 [PATCH] ddr: imx8m: add missing DDR clock rates Ahmad Fatoum
  2024-01-23 10:04 ` Marco Felsch
@ 2024-02-08  7:35 ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2024-02-08  7:35 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Mon, 22 Jan 2024 15:13:31 +0100, Ahmad Fatoum wrote:
> ddrphy_init_set_dfi_clk() is called to translate a scalar clock rate
> as specified by board code into PLL parameters, which are configured.
> 
> enum ddr_rate describes the possible DDR rates and so far
> ddrphy_init_set_dfi_clk() supported all of them, except for 2600 and
> 2376 MHz, rendering these two rates unusable.
> 
> [...]

Applied, thanks!

[1/1] ddr: imx8m: add missing DDR clock rates
      https://git.pengutronix.de/cgit/barebox/commit/?id=205a77e12cd1 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-08  7:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-22 14:13 [PATCH] ddr: imx8m: add missing DDR clock rates Ahmad Fatoum
2024-01-23 10:04 ` Marco Felsch
2024-01-23 10:35   ` Ahmad Fatoum
2024-01-23 12:15     ` Marco Felsch
2024-02-08  7:35 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox