All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] Calculate SDRAM size for Actions OWL SoCs
@ 2020-05-09  8:15 Amit Singh Tomar
  2020-05-09  8:15 ` [PATCH v4 1/2] Actions: OWL: Calculate SDRAM size Amit Singh Tomar
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Amit Singh Tomar @ 2020-05-09  8:15 UTC (permalink / raw)
  To: u-boot

Mani pointed out that changes in previous version were not good enough
for S900 and he provide snippet that seems to work on S900.

This series v4 fixes the S900 Support by taking in changes suggested
by Mani. 

---------------------------------------------------------------------
 
Realized that sent the wrong version(v2) that has typos and didn't get
compile for S900. Just fixed this in v3.

This small series allows us to calculate SDRAM size instead
of guessing it.

Patch (1/2) is re-worked to support S900 SoC along with S700.

These changes have been tested on S700 based Cubieboard7-lite board, and
it would be great if this can be tested on S900.

Amit Singh Tomar (2):
  Actions: OWL: Calculate SDRAM size
  arm: actions: remove "CONFIG_SYS_SDRAM_SIZE" for Actions Owl Semi SoCs

 arch/arm/mach-owl/soc.c      | 22 +++++++++++++++++++++-
 include/configs/owl-common.h |  1 -
 2 files changed, 21 insertions(+), 2 deletions(-)

-- 
2.7.4

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

* [PATCH v4 1/2] Actions: OWL: Calculate SDRAM size
  2020-05-09  8:15 [PATCH v4 0/2] Calculate SDRAM size for Actions OWL SoCs Amit Singh Tomar
@ 2020-05-09  8:15 ` Amit Singh Tomar
  2020-05-09 10:11   ` Manivannan Sadhasivam
  2020-07-08  3:02   ` Tom Rini
  2020-05-09  8:15 ` [PATCH v4 2/2] arm: actions: remove "CONFIG_SYS_SDRAM_SIZE" for Actions Owl Semi SoCs Amit Singh Tomar
  2020-06-12 18:26 ` [PATCH v4 0/2] Calculate SDRAM size for Actions OWL SoCs Amit Tomer
  2 siblings, 2 replies; 9+ messages in thread
From: Amit Singh Tomar @ 2020-05-09  8:15 UTC (permalink / raw)
  To: u-boot

Calculate the SDRAM size from DDR capacity register registers instead
of using hard-coded value. This is quite useful to get correct size
on differnt boards based on Actions OWL family of SoCs (S700 and S900).

There is no documentation available that talks about DDR registers, and
this is very much taken from vendor source.

This commit lets Linux boot on Cubieboard7-lite(based on S700).

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
---
Changes since v3:
	* Fixed S900 support as suggested by Mani.
	* Changes the function name to owl_get_ddrcap.
Changes since v2:
	* Fixed the variable name so that it can compile
	  for S900.	
Changes since v1:
        * added support for S900
        * updated the commit message to reflect common OWL
          support.
---
 arch/arm/mach-owl/soc.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-owl/soc.c b/arch/arm/mach-owl/soc.c
index 409cbd319f20..fcf61d39b63a 100644
--- a/arch/arm/mach-owl/soc.c
+++ b/arch/arm/mach-owl/soc.c
@@ -13,14 +13,34 @@
 #include <asm/mach-types.h>
 #include <asm/psci.h>
 
+#define DMM_INTERLEAVE_PER_CH_CFG	0xe0290028
+
 DECLARE_GLOBAL_DATA_PTR;
 
+unsigned int owl_get_ddrcap(void)
+{
+	unsigned int val, cap;
+
+	/* ddr capacity register initialized by ddr driver
+	 * in early bootloader
+	 */
+#if defined(CONFIG_MACH_S700)
+	val = (readl(DMM_INTERLEAVE_PER_CH_CFG) >> 8) & 0x7;
+	cap =  (val + 1) * 256;
+#elif defined(CONFIG_MACH_S900)
+	val = (readl(DMM_INTERLEAVE_PER_CH_CFG) >> 8) & 0xf;
+	cap =  64 * (1 << val);
+#endif
+
+	return cap;
+}
+
 /*
  * dram_init - sets uboots idea of sdram size
  */
 int dram_init(void)
 {
-	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+	gd->ram_size = owl_get_ddrcap() * 1024 * 1024;
 	return 0;
 }
 
-- 
2.7.4

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

* [PATCH v4 2/2] arm: actions: remove "CONFIG_SYS_SDRAM_SIZE" for Actions Owl Semi SoCs
  2020-05-09  8:15 [PATCH v4 0/2] Calculate SDRAM size for Actions OWL SoCs Amit Singh Tomar
  2020-05-09  8:15 ` [PATCH v4 1/2] Actions: OWL: Calculate SDRAM size Amit Singh Tomar
@ 2020-05-09  8:15 ` Amit Singh Tomar
  2020-05-09 10:12   ` Manivannan Sadhasivam
  2020-07-08  3:02   ` Tom Rini
  2020-06-12 18:26 ` [PATCH v4 0/2] Calculate SDRAM size for Actions OWL SoCs Amit Tomer
  2 siblings, 2 replies; 9+ messages in thread
From: Amit Singh Tomar @ 2020-05-09  8:15 UTC (permalink / raw)
  To: u-boot

Now that, we calculate SDRAM size by reading DDR registers,
"CONFIG_SYS_SDRAM_SIZE" is no more needed.

This commit removes "CONFIG_SYS_SDRAM_SIZE" from common configuration
file.

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
---
* No change since previous version.
---
 include/configs/owl-common.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/configs/owl-common.h b/include/configs/owl-common.h
index f77a5fa4c114..7634578f856d 100644
--- a/include/configs/owl-common.h
+++ b/include/configs/owl-common.h
@@ -12,7 +12,6 @@
 
 /* SDRAM Definitions */
 #define CONFIG_SYS_SDRAM_BASE		0x0
-#define CONFIG_SYS_SDRAM_SIZE		0x80000000
 
 /* Generic Timer Definitions */
 #define COUNTER_FREQUENCY		(24000000)	/* 24MHz */
-- 
2.7.4

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

* [PATCH v4 1/2] Actions: OWL: Calculate SDRAM size
  2020-05-09  8:15 ` [PATCH v4 1/2] Actions: OWL: Calculate SDRAM size Amit Singh Tomar
@ 2020-05-09 10:11   ` Manivannan Sadhasivam
  2020-07-08  3:02   ` Tom Rini
  1 sibling, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2020-05-09 10:11 UTC (permalink / raw)
  To: u-boot

On Sat, May 09, 2020 at 01:45:07PM +0530, Amit Singh Tomar wrote:
> Calculate the SDRAM size from DDR capacity register registers instead
> of using hard-coded value. This is quite useful to get correct size
> on differnt boards based on Actions OWL family of SoCs (S700 and S900).
> 
> There is no documentation available that talks about DDR registers, and
> this is very much taken from vendor source.
> 
> This commit lets Linux boot on Cubieboard7-lite(based on S700).
> 
> Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thanks,
Mani

> ---
> Changes since v3:
> 	* Fixed S900 support as suggested by Mani.
> 	* Changes the function name to owl_get_ddrcap.
> Changes since v2:
> 	* Fixed the variable name so that it can compile
> 	  for S900.	
> Changes since v1:
>         * added support for S900
>         * updated the commit message to reflect common OWL
>           support.
> ---
>  arch/arm/mach-owl/soc.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-owl/soc.c b/arch/arm/mach-owl/soc.c
> index 409cbd319f20..fcf61d39b63a 100644
> --- a/arch/arm/mach-owl/soc.c
> +++ b/arch/arm/mach-owl/soc.c
> @@ -13,14 +13,34 @@
>  #include <asm/mach-types.h>
>  #include <asm/psci.h>
>  
> +#define DMM_INTERLEAVE_PER_CH_CFG	0xe0290028
> +
>  DECLARE_GLOBAL_DATA_PTR;
>  
> +unsigned int owl_get_ddrcap(void)
> +{
> +	unsigned int val, cap;
> +
> +	/* ddr capacity register initialized by ddr driver
> +	 * in early bootloader
> +	 */
> +#if defined(CONFIG_MACH_S700)
> +	val = (readl(DMM_INTERLEAVE_PER_CH_CFG) >> 8) & 0x7;
> +	cap =  (val + 1) * 256;
> +#elif defined(CONFIG_MACH_S900)
> +	val = (readl(DMM_INTERLEAVE_PER_CH_CFG) >> 8) & 0xf;
> +	cap =  64 * (1 << val);
> +#endif
> +
> +	return cap;
> +}
> +
>  /*
>   * dram_init - sets uboots idea of sdram size
>   */
>  int dram_init(void)
>  {
> -	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
> +	gd->ram_size = owl_get_ddrcap() * 1024 * 1024;
>  	return 0;
>  }
>  
> -- 
> 2.7.4
> 

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

* [PATCH v4 2/2] arm: actions: remove "CONFIG_SYS_SDRAM_SIZE" for Actions Owl Semi SoCs
  2020-05-09  8:15 ` [PATCH v4 2/2] arm: actions: remove "CONFIG_SYS_SDRAM_SIZE" for Actions Owl Semi SoCs Amit Singh Tomar
@ 2020-05-09 10:12   ` Manivannan Sadhasivam
  2020-07-08  3:02   ` Tom Rini
  1 sibling, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2020-05-09 10:12 UTC (permalink / raw)
  To: u-boot

On Sat, May 09, 2020 at 01:45:08PM +0530, Amit Singh Tomar wrote:
> Now that, we calculate SDRAM size by reading DDR registers,
> "CONFIG_SYS_SDRAM_SIZE" is no more needed.
> 
> This commit removes "CONFIG_SYS_SDRAM_SIZE" from common configuration
> file.
> 
> Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thanks,
Mani

> ---
> * No change since previous version.
> ---
>  include/configs/owl-common.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/include/configs/owl-common.h b/include/configs/owl-common.h
> index f77a5fa4c114..7634578f856d 100644
> --- a/include/configs/owl-common.h
> +++ b/include/configs/owl-common.h
> @@ -12,7 +12,6 @@
>  
>  /* SDRAM Definitions */
>  #define CONFIG_SYS_SDRAM_BASE		0x0
> -#define CONFIG_SYS_SDRAM_SIZE		0x80000000
>  
>  /* Generic Timer Definitions */
>  #define COUNTER_FREQUENCY		(24000000)	/* 24MHz */
> -- 
> 2.7.4
> 

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

* [PATCH v4 0/2] Calculate SDRAM size for Actions OWL SoCs
  2020-05-09  8:15 [PATCH v4 0/2] Calculate SDRAM size for Actions OWL SoCs Amit Singh Tomar
  2020-05-09  8:15 ` [PATCH v4 1/2] Actions: OWL: Calculate SDRAM size Amit Singh Tomar
  2020-05-09  8:15 ` [PATCH v4 2/2] arm: actions: remove "CONFIG_SYS_SDRAM_SIZE" for Actions Owl Semi SoCs Amit Singh Tomar
@ 2020-06-12 18:26 ` Amit Tomer
  2020-06-12 18:42   ` Tom Rini
  2 siblings, 1 reply; 9+ messages in thread
From: Amit Tomer @ 2020-06-12 18:26 UTC (permalink / raw)
  To: u-boot

Hi Tom

On Sat, May 9, 2020 at 1:45 PM Amit Singh Tomar <amittomer25@gmail.com> wrote:
>
> Mani pointed out that changes in previous version were not good enough
> for S900 and he provide snippet that seems to work on S900.
>
> This series v4 fixes the S900 Support by taking in changes suggested
> by Mani.
>
> ---------------------------------------------------------------------
>
> Realized that sent the wrong version(v2) that has typos and didn't get
> compile for S900. Just fixed this in v3.
>
> This small series allows us to calculate SDRAM size instead
> of guessing it.
>
> Patch (1/2) is re-worked to support S900 SoC along with S700.
>
> These changes have been tested on S700 based Cubieboard7-lite board, and
> it would be great if this can be tested on S900.
>
> Amit Singh Tomar (2):
>   Actions: OWL: Calculate SDRAM size
>   arm: actions: remove "CONFIG_SYS_SDRAM_SIZE" for Actions Owl Semi SoCs
>
>  arch/arm/mach-owl/soc.c      | 22 +++++++++++++++++++++-
>  include/configs/owl-common.h |  1 -
>  2 files changed, 21 insertions(+), 2 deletions(-)
>
> --
> 2.7.4
>

Do you have a plan to take these in ?

Thanks
-Amit.

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

* [PATCH v4 0/2] Calculate SDRAM size for Actions OWL SoCs
  2020-06-12 18:26 ` [PATCH v4 0/2] Calculate SDRAM size for Actions OWL SoCs Amit Tomer
@ 2020-06-12 18:42   ` Tom Rini
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2020-06-12 18:42 UTC (permalink / raw)
  To: u-boot

On Fri, Jun 12, 2020 at 11:56:47PM +0530, Amit Tomer wrote:
> Hi Tom
> 
> On Sat, May 9, 2020 at 1:45 PM Amit Singh Tomar <amittomer25@gmail.com> wrote:
> >
> > Mani pointed out that changes in previous version were not good enough
> > for S900 and he provide snippet that seems to work on S900.
> >
> > This series v4 fixes the S900 Support by taking in changes suggested
> > by Mani.
> >
> > ---------------------------------------------------------------------
> >
> > Realized that sent the wrong version(v2) that has typos and didn't get
> > compile for S900. Just fixed this in v3.
> >
> > This small series allows us to calculate SDRAM size instead
> > of guessing it.
> >
> > Patch (1/2) is re-worked to support S900 SoC along with S700.
> >
> > These changes have been tested on S700 based Cubieboard7-lite board, and
> > it would be great if this can be tested on S900.
> >
> > Amit Singh Tomar (2):
> >   Actions: OWL: Calculate SDRAM size
> >   arm: actions: remove "CONFIG_SYS_SDRAM_SIZE" for Actions Owl Semi SoCs
> >
> >  arch/arm/mach-owl/soc.c      | 22 +++++++++++++++++++++-
> >  include/configs/owl-common.h |  1 -
> >  2 files changed, 21 insertions(+), 2 deletions(-)
> >
> > --
> > 2.7.4
> >
> 
> Do you have a plan to take these in ?

Of what I call from the thread, it's OK for this to go in for v2020.07
so it's on my TODO list for -next but only part of the queue of
hopefully easy to grab and use things, which isn't where I start :)

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200612/82143aff/attachment.sig>

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

* [PATCH v4 1/2] Actions: OWL: Calculate SDRAM size
  2020-05-09  8:15 ` [PATCH v4 1/2] Actions: OWL: Calculate SDRAM size Amit Singh Tomar
  2020-05-09 10:11   ` Manivannan Sadhasivam
@ 2020-07-08  3:02   ` Tom Rini
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Rini @ 2020-07-08  3:02 UTC (permalink / raw)
  To: u-boot

On Sat, May 09, 2020 at 01:45:07PM +0530, Amit Singh Tomar wrote:

> Calculate the SDRAM size from DDR capacity register registers instead
> of using hard-coded value. This is quite useful to get correct size
> on differnt boards based on Actions OWL family of SoCs (S700 and S900).
> 
> There is no documentation available that talks about DDR registers, and
> this is very much taken from vendor source.
> 
> This commit lets Linux boot on Cubieboard7-lite(based on S700).
> 
> Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200707/59dfc2c9/attachment.sig>

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

* [PATCH v4 2/2] arm: actions: remove "CONFIG_SYS_SDRAM_SIZE" for Actions Owl Semi SoCs
  2020-05-09  8:15 ` [PATCH v4 2/2] arm: actions: remove "CONFIG_SYS_SDRAM_SIZE" for Actions Owl Semi SoCs Amit Singh Tomar
  2020-05-09 10:12   ` Manivannan Sadhasivam
@ 2020-07-08  3:02   ` Tom Rini
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Rini @ 2020-07-08  3:02 UTC (permalink / raw)
  To: u-boot

On Sat, May 09, 2020 at 01:45:08PM +0530, Amit Singh Tomar wrote:

> Now that, we calculate SDRAM size by reading DDR registers,
> "CONFIG_SYS_SDRAM_SIZE" is no more needed.
> 
> This commit removes "CONFIG_SYS_SDRAM_SIZE" from common configuration
> file.
> 
> Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200707/14cefda9/attachment.sig>

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

end of thread, other threads:[~2020-07-08  3:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-09  8:15 [PATCH v4 0/2] Calculate SDRAM size for Actions OWL SoCs Amit Singh Tomar
2020-05-09  8:15 ` [PATCH v4 1/2] Actions: OWL: Calculate SDRAM size Amit Singh Tomar
2020-05-09 10:11   ` Manivannan Sadhasivam
2020-07-08  3:02   ` Tom Rini
2020-05-09  8:15 ` [PATCH v4 2/2] arm: actions: remove "CONFIG_SYS_SDRAM_SIZE" for Actions Owl Semi SoCs Amit Singh Tomar
2020-05-09 10:12   ` Manivannan Sadhasivam
2020-07-08  3:02   ` Tom Rini
2020-06-12 18:26 ` [PATCH v4 0/2] Calculate SDRAM size for Actions OWL SoCs Amit Tomer
2020-06-12 18:42   ` Tom Rini

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.