diff mbox series

[v3,7/8] memory: of: parse max-freq property

Message ID 20220206135807.211767-8-krzysztof.kozlowski@canonical.com (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series dt-bindings: memory: convert to dtschema | expand

Commit Message

Krzysztof Kozlowski Feb. 6, 2022, 1:58 p.m. UTC
Passing the memory timings maximum frequency as an unit address was
a workaround and instead 'max-freq' is preferred.  Look for 'max-freq'
first and then fallback to 'reg'.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/memory/of_memory.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Dmitry Osipenko Feb. 6, 2022, 3:33 p.m. UTC | #1
06.02.2022 16:58, Krzysztof Kozlowski пишет:
> Passing the memory timings maximum frequency as an unit address was
> a workaround and instead 'max-freq' is preferred.  Look for 'max-freq'
> first and then fallback to 'reg'.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  drivers/memory/of_memory.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/memory/of_memory.c b/drivers/memory/of_memory.c
> index b94408954d85..bac5c7f34936 100644
> --- a/drivers/memory/of_memory.c
> +++ b/drivers/memory/of_memory.c
> @@ -212,8 +212,10 @@ static int of_lpddr3_do_get_timings(struct device_node *np,
>  {
>  	int ret;
>  
> -	/* The 'reg' param required since DT has changed, used as 'max-freq' */
> -	ret = of_property_read_u32(np, "reg", &tim->max_freq);
> +	ret = of_property_read_u32(np, "max-freq", &tim->max_freq);
> +	if (ret)
> +		/* Deprecated way of passing max-freq as 'reg' */
> +		ret = of_property_read_u32(np, "reg", &tim->max_freq);
>  	ret |= of_property_read_u32(np, "min-freq", &tim->min_freq);
>  	ret |= of_property_read_u32(np, "tRFC", &tim->tRFC);
>  	ret |= of_property_read_u32(np, "tRRD", &tim->tRRD);

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Alim Akhtar Feb. 7, 2022, 4:16 a.m. UTC | #2
Hi Krzysztof

>-----Original Message-----
>From: Krzysztof Kozlowski [mailto:krzysztof.kozlowski@canonical.com]
>Sent: Sunday, February 6, 2022 7:28 PM
>To: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>; Rob Herring
><robh+dt@kernel.org>; Lukasz Luba <lukasz.luba@arm.com>; Alim Akhtar
><alim.akhtar@samsung.com>; Dmitry Osipenko <digetx@gmail.com>; linux-
>kernel@vger.kernel.org; devicetree@vger.kernel.org; linux-
>pm@vger.kernel.org; linux-samsung-soc@vger.kernel.org; linux-arm-
>kernel@lists.infradead.org
>Subject: [PATCH v3 7/8] memory: of: parse max-freq property
>
>Passing the memory timings maximum frequency as an unit address was a
>workaround and instead 'max-freq' is preferred.  Look for 'max-freq'
>first and then fallback to 'reg'.
>
>Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>---

Reviewed-by: Alim Akhtar <alim.ahtar@samsung.com>


> drivers/memory/of_memory.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/memory/of_memory.c b/drivers/memory/of_memory.c
>index b94408954d85..bac5c7f34936 100644
>--- a/drivers/memory/of_memory.c
>+++ b/drivers/memory/of_memory.c
>@@ -212,8 +212,10 @@ static int of_lpddr3_do_get_timings(struct
>device_node *np,  {
> 	int ret;
>
>-	/* The 'reg' param required since DT has changed, used as 'max-freq'
>*/
>-	ret = of_property_read_u32(np, "reg", &tim->max_freq);
>+	ret = of_property_read_u32(np, "max-freq", &tim->max_freq);
>+	if (ret)
>+		/* Deprecated way of passing max-freq as 'reg' */
>+		ret = of_property_read_u32(np, "reg", &tim->max_freq);
> 	ret |= of_property_read_u32(np, "min-freq", &tim->min_freq);
> 	ret |= of_property_read_u32(np, "tRFC", &tim->tRFC);
> 	ret |= of_property_read_u32(np, "tRRD", &tim->tRRD);
>--
>2.32.0
diff mbox series

Patch

diff --git a/drivers/memory/of_memory.c b/drivers/memory/of_memory.c
index b94408954d85..bac5c7f34936 100644
--- a/drivers/memory/of_memory.c
+++ b/drivers/memory/of_memory.c
@@ -212,8 +212,10 @@  static int of_lpddr3_do_get_timings(struct device_node *np,
 {
 	int ret;
 
-	/* The 'reg' param required since DT has changed, used as 'max-freq' */
-	ret = of_property_read_u32(np, "reg", &tim->max_freq);
+	ret = of_property_read_u32(np, "max-freq", &tim->max_freq);
+	if (ret)
+		/* Deprecated way of passing max-freq as 'reg' */
+		ret = of_property_read_u32(np, "reg", &tim->max_freq);
 	ret |= of_property_read_u32(np, "min-freq", &tim->min_freq);
 	ret |= of_property_read_u32(np, "tRFC", &tim->tRFC);
 	ret |= of_property_read_u32(np, "tRRD", &tim->tRRD);