mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* problems with am335x_sdram_size()
@ 2018-03-01 14:23 Giorgio Dal Molin
  2018-03-02  7:26 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Giorgio Dal Molin @ 2018-03-01 14:23 UTC (permalink / raw)
  To: barebox

Hi,

working with the TI AM335x Evaluation Module I noticed that the function
am335x_sdram_size() always returns 0 instead of the computed sdram size.

I could trace back the problem to the fact that the function does its 
computation based on the value of the register CM_EMIF_SDRAM_CONFIG
(addr. 0x44e10110), but this register is not written to by the function
am33xx_config_sdram() and just returns its initial value (0).
The datasheet says CM_EMIF_SDRAM_CONFIG should have the same value as
AM33XX_EMIF4_0_REG(SDRAM_CONFIG) (addr. 0x4c000008)

To conclude, to fix the problem with am335x_sdram_size() you can either
use AM33XX_EMIF4_0_REG(SDRAM_CONFIG) instead of CM_EMIF_SDRAM_CONFIG
in am335x_sdram_size()

 or

initialize CM_EMIF_SDRAM_CONFIG in am33xx_config_sdram() with the same value
as AM33XX_EMIF4_0_REG(SDRAM_CONFIG) (regs->sdram_config)

giorgio

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: problems with am335x_sdram_size()
  2018-03-01 14:23 problems with am335x_sdram_size() Giorgio Dal Molin
@ 2018-03-02  7:26 ` Sascha Hauer
  2018-03-02 14:11   ` Giorgio Dal Molin
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2018-03-02  7:26 UTC (permalink / raw)
  To: Giorgio Dal Molin; +Cc: barebox

On Thu, Mar 01, 2018 at 03:23:33PM +0100, Giorgio Dal Molin wrote:
> Hi,
> 
> working with the TI AM335x Evaluation Module I noticed that the function
> am335x_sdram_size() always returns 0 instead of the computed sdram size.
> 
> I could trace back the problem to the fact that the function does its 
> computation based on the value of the register CM_EMIF_SDRAM_CONFIG
> (addr. 0x44e10110), but this register is not written to by the function
> am33xx_config_sdram() and just returns its initial value (0).
> The datasheet says CM_EMIF_SDRAM_CONFIG should have the same value as
> AM33XX_EMIF4_0_REG(SDRAM_CONFIG) (addr. 0x4c000008)

CM_EMIF_SDRAM_CONFIG is written when regs->zq_config is set and if it's
set then indeed the same value is written there as also written to
AM33XX_EMIF4_0_REG(SDRAM_CONFIG).

> 
> To conclude, to fix the problem with am335x_sdram_size() you can either
> use AM33XX_EMIF4_0_REG(SDRAM_CONFIG) instead of CM_EMIF_SDRAM_CONFIG
> in am335x_sdram_size().
> 
>  or
> 
> initialize CM_EMIF_SDRAM_CONFIG in am33xx_config_sdram() with the same value
> as AM33XX_EMIF4_0_REG(SDRAM_CONFIG) (regs->sdram_config)

I'm fine with either way. Maybe the datasheet gives us a hint which way
to choose? Why is CM_EMIF_SDRAM_CONFIG only written when regs->zq_config
is set? Is this correct?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: problems with am335x_sdram_size()
  2018-03-02  7:26 ` Sascha Hauer
@ 2018-03-02 14:11   ` Giorgio Dal Molin
  0 siblings, 0 replies; 3+ messages in thread
From: Giorgio Dal Molin @ 2018-03-02 14:11 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi,

> On March 2, 2018 at 8:26 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
> 
> 
> On Thu, Mar 01, 2018 at 03:23:33PM +0100, Giorgio Dal Molin wrote:
> > Hi,
> > 
> > working with the TI AM335x Evaluation Module I noticed that the function
> > am335x_sdram_size() always returns 0 instead of the computed sdram size.
> > 
> > I could trace back the problem to the fact that the function does its 
> > computation based on the value of the register CM_EMIF_SDRAM_CONFIG
> > (addr. 0x44e10110), but this register is not written to by the function
> > am33xx_config_sdram() and just returns its initial value (0).
> > The datasheet says CM_EMIF_SDRAM_CONFIG should have the same value as
> > AM33XX_EMIF4_0_REG(SDRAM_CONFIG) (addr. 0x4c000008)
> 
> CM_EMIF_SDRAM_CONFIG is written when regs->zq_config is set and if it's
> set then indeed the same value is written there as also written to
> AM33XX_EMIF4_0_REG(SDRAM_CONFIG).
> 

aaah, I'm blind !

I've added a line at the end of am33xx_config_sdram() that's
exactly the same as the one a couple of lines before.
I was so happy to have solved my problem that I've no more
double checked if the register was already configured somewhere else.

So, now I've also defined regs->zq_config in my lowlevel.c and everything works.

The datasheet says:

The CONTROL_EMIF_SDRAM_CONFIG register exports SDRAM configuration information
to the EMIF after resuming from low power scenarios.
This register should be loaded with the same value as SDRAM_CONFIG during DDR
initialization.

so I think we should initialize it unconditionally, not only if !regs->zq_config.
Doing this it should be the same which one we use in am335x_sdram_size() to
compute the sdram size even if I would prefer to use AM33XX_EMIF4_0_REG(SDRAM_CONFIG)
for clarity.

giorgio

> > 
> > To conclude, to fix the problem with am335x_sdram_size() you can either
> > use AM33XX_EMIF4_0_REG(SDRAM_CONFIG) instead of CM_EMIF_SDRAM_CONFIG
> > in am335x_sdram_size().
> > 
> >  or
> > 
> > initialize CM_EMIF_SDRAM_CONFIG in am33xx_config_sdram() with the same value
> > as AM33XX_EMIF4_0_REG(SDRAM_CONFIG) (regs->sdram_config)
> 
> I'm fine with either way. Maybe the datasheet gives us a hint which way
> to choose? Why is CM_EMIF_SDRAM_CONFIG only written when regs->zq_config
> is set? Is this correct?
> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2018-03-02 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-01 14:23 problems with am335x_sdram_size() Giorgio Dal Molin
2018-03-02  7:26 ` Sascha Hauer
2018-03-02 14:11   ` Giorgio Dal Molin

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