On Tue, 26 Aug 2014 15:24:41 +0200
Paul Kocialkowski <[email protected]> wrote:

> Signed-off-by: Paul Kocialkowski <[email protected]>
> ---
>  board/sunxi/Makefile                         |    4 +++-
>  board/sunxi/dram_a13_mid.c                   |   31 
> --------------------------
>  board/sunxi/dram_sun5i_408_512_busw16_iow8.c |   31 
> ++++++++++++++++++++++++++
>  boards.cfg                                   |    2 ++
>  4 files changed, 36 insertions(+), 32 deletions(-)
>  delete mode 100644 board/sunxi/dram_a13_mid.c
>  create mode 100644 board/sunxi/dram_sun5i_408_512_busw16_iow8.c
> 
> diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
> index fe5cb25..28b0f6a 100644
> --- a/board/sunxi/Makefile
> +++ b/board/sunxi/Makefile
> @@ -15,7 +15,7 @@ obj-$(CONFIG_A10_OLINUXINO_L)       += 
> dram_a10_olinuxino_l.o
>  obj-$(CONFIG_A10S_OLINUXINO_M)       += dram_a10s_olinuxino_m.o
>  obj-$(CONFIG_A13_OLINUXINO)  += dram_a13_olinuxino.o
>  obj-$(CONFIG_A13_OLINUXINOM) += dram_a13_oli_micro.o
> -obj-$(CONFIG_A13_MID)                += dram_a13_mid.o
> +obj-$(CONFIG_A13_MID)                += dram_sun5i_408_512_busw16_iow8.o
>  obj-$(CONFIG_A20_OLINUXINO_L)        += dram_a20_olinuxino_l.o
>  obj-$(CONFIG_A20_OLINUXINO_L2)       += dram_a20_olinuxino_l2.o
>  obj-$(CONFIG_A20_OLINUXINO_M)        += dram_sun7i_384_1024_iow16.o
> @@ -85,6 +85,8 @@ obj-$(CONFIG_QT840A)                += 
> dram_sun7i_384_512_busw16_iow16.o
>  obj-$(CONFIG_R7DONGLE)               += dram_r7dongle.o
>  obj-$(CONFIG_SANEI_N90)              += dram_sanei_n90.o
>  obj-$(CONFIG_SEMITIME_G2)    += dram_semitime_g2.o
> +obj-$(CONFIG_TZX_Q8_713B6)   += dram_sun5i_408_512_busw16_iow8.o
> +obj-$(CONFIG_TZX_Q8_713B7)   += dram_sun5i_408_512_busw16_iow8.o
>  obj-$(CONFIG_UHOST_U1A)              += dram_sun4i_360_1024_iow8.o
>  obj-$(CONFIG_WEXLER_TAB_7200)        += dram_wexler_tab_7200.o
>  obj-$(CONFIG_WOBO_I5)                += dram_wobo_i5.o
> diff --git a/board/sunxi/dram_a13_mid.c b/board/sunxi/dram_a13_mid.c
> deleted file mode 100644
> index bc5cf75..0000000
> --- a/board/sunxi/dram_a13_mid.c
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -/* this file is generated, don't edit it yourself */
> -
> -#include <common.h>
> -#include <asm/arch/dram.h>
> -
> -static struct dram_para dram_para = {
> -     .clock = 408,
> -     .type = 3,
> -     .rank_num = 1,
> -     .density = 2048,
> -     .io_width = 8,
> -     .bus_width = 16,
> -     .cas = 9,
> -     .zq = 123,
> -     .odt_en = 1,
> -     .size = 512,
> -     .tpr0 = 0x42d899b7,
> -     .tpr1 = 0xa090,
> -     .tpr2 = 0x22a00,
> -     .tpr3 = 0,
> -     .tpr4 = 0,
> -     .tpr5 = 0,
> -     .emr1 = 0x4,
> -     .emr2 = 0x10,
> -     .emr3 = 0,
> -};
> -
> -unsigned long sunxi_dram_init(void)
> -{
> -     return dramc_init(&dram_para);
> -}
> diff --git a/board/sunxi/dram_sun5i_408_512_busw16_iow8.c 
> b/board/sunxi/dram_sun5i_408_512_busw16_iow8.c
> new file mode 100644
> index 0000000..bc5cf75
> --- /dev/null
> +++ b/board/sunxi/dram_sun5i_408_512_busw16_iow8.c
> @@ -0,0 +1,31 @@
> +/* this file is generated, don't edit it yourself */
> +
> +#include <common.h>
> +#include <asm/arch/dram.h>
> +
> +static struct dram_para dram_para = {
> +     .clock = 408,
> +     .type = 3,
> +     .rank_num = 1,
> +     .density = 2048,
> +     .io_width = 8,
> +     .bus_width = 16,
> +     .cas = 9,
> +     .zq = 123,
> +     .odt_en = 1,

This is not quite right. If you enable ODT, then the 'zq' settings are
taken into use to configure the impedance. And the 0x7b (or 123 in the
decimal format) is just the default reset value for the hardware
register. It does not seem to make much sense, because it is pretty far
away from the generally recommended impedance settings:
    http://www.altera.com/literature/hb/external-memory/emi_plan_board_ddr2.pdf
My understanding is that the 123 value has about the same meaning as
0xbadf00d or 0xdeadbeef, in the sense that they had to have some kind
of default and they picked a nonsensical magic constant. I think that I
have mentioned this to you in the irc chat earlier:
    http://irclog.whitequark.org/linux-sunxi/2014-08-24#9976940

More likely than not, if this configuration is really taken into use,
then the DRAM reliability will become worse.

Luckily, the .odt_en settings are inert and have no effect on the A13
hardware when used in the https://github.com/linux-sunxi/u-boot-sunxi/
bootloader, as explained in:
    https://patchwork.ozlabs.org/patch/375959/

We just need to be really careful when moving all these piles of
nonsensical junk DRAM settings to the mainline u-boot.

> +     .size = 512,
> +     .tpr0 = 0x42d899b7,
> +     .tpr1 = 0xa090,
> +     .tpr2 = 0x22a00,
> +     .tpr3 = 0,
> +     .tpr4 = 0,
> +     .tpr5 = 0,
> +     .emr1 = 0x4,
> +     .emr2 = 0x10,
> +     .emr3 = 0,
> +};
> +
> +unsigned long sunxi_dram_init(void)
> +{
> +     return dramc_init(&dram_para);
> +}
> diff --git a/boards.cfg b/boards.cfg
> index 24edeb9..1124f74 100644
> --- a/boards.cfg
> +++ b/boards.cfg
> @@ -468,6 +468,8 @@ Active  arm         armv7          sunxi       -          
>      sunxi
>  Active  arm         armv7          sunxi       -               sunxi         
>       sun5i                                sun5i:SUNXI_EMAC                   
>                                                                               
>                  -
>  Active  arm         armv7          sunxi       -               sunxi         
>       sun5i_sdcon                          sun5i:UART0_PORT_F,SUNXI_EMAC      
>                                                                               
>                  -
>  Active  arm         armv7          sunxi       -               sunxi         
>       sun5i_uart1                          sun5i:CONS_INDEX=2,SUNXI_EMAC      
>                                                                               
>                  -
> +Active  arm         armv7          sunxi       -               sunxi         
>       TZX-Q8-713B6                         
> sun5i:TZX_Q8_713B6,SPL,CONS_INDEX=2                                           
>                                                     -
> +Active  arm         armv7          sunxi       -               sunxi         
>       TZX-Q8-713B7                         
> sun5i:TZX_Q8_713B7,SPL,CONS_INDEX=2                                           
>                                                     -
>  Active  arm         armv7          sunxi       -               sunxi         
>       uhost_u1a                            sun4i:UHOST_U1A,SPL,STATUSLED=34   
>                                                                               
>                  -
>  Active  arm         armv7          sunxi       -               sunxi         
>       Wexler_TAB_7200                      sun7i:WEXLER_TAB_7200,SPL          
>                                                                               
>                  -
>  Active  arm         armv7          sunxi       -               sunxi         
>       wobo-i5                              sun5i:WOBO_I5,SPL,STATUSLED=34     
>                                                                               
>                  -



-- 
Best regards,
Siarhei Siamashka

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to