[U-Boot] [PATCH v2 16/22] omap4: calculate EMIF register values

Aneesh V
2011-05-17T14:26:22Z

Hi Wolfgang,

On Monday 16 May 2011 01:35 AM, Wolfgang Denk wrote:
> Dear Aneesh V,
>
> In message<1305472900-4004-17-git-send-email-aneesh@ti.com> you wrote:
>> Calculate EMIF register values based on AC timing parameters
>> from the SDRAM datasheet and the DDR frequency rather than
>> using the hard-coded values.
>>
>> For a new board the user doen't have to go through the tedious
>> process of calculating the register values. Instead, just
>> provide the AC timings from the device data sheet as input
>> and the driver will automatically calculate the register values.
>
> Does it make sense to do this in the driver code? These parameters
> will never change, so why can we not rather perform the computation
> only once, at build time, and feed in the respective parameters to the
> driver?

Some of the parameters do change. For instance on one of the OMAP4
revisions the DDR runs at 200MHz, on another one at 380MHz and for the
rest at 400MHz. Also, on ES1 we have 512 MB of memory where as on
others we have 1GB. This driver is also doing discovery of SDRAM
geometry, type, etc.

>
> Reasons why I am concerned about such an approach are code size and
> boot time. Both suffer ...
>

I had the same concerns too. So, I have provided a CONFIG option -
CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS - by which the user can
provide the register values, so no computation will be done.

So, if somebody is concerned about the performance they can just
compute the values using this driver and print them out by enabling the
debug traces, fill it up in the structs provided for it and enable
CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS. That should work.

Also, please note that I had measured the time taken for the entire
SDRAM initialization and it was not at all significant(IIRC, it was
less than 1ms).

best regards,
Aneesh