DSP

TI DDR3配置

2019-07-13 17:32发布

AM335X使用DDR3, 共有三大模块需要设置:
EMIF共有两个片选,DDR3接口只有一个片选,最大空间1GB

1.DDR IO Control
306 const struct ctrl_ioregs ioregs_bonelt = {
307         .cm0ioctl               = MT41K256M16HA125E_IOCTRL_VALUE,
308         .cm1ioctl               = MT41K256M16HA125E_IOCTRL_VALUE,
309         .cm2ioctl               = MT41K256M16HA125E_IOCTRL_VALUE,
310         .dt0ioctl               = MT41K256M16HA125E_IOCTRL_VALUE,
311         .dt1ioctl               = MT41K256M16HA125E_IOCTRL_VALUE,
312 };


2.DDR PHY REG(ddr_cmd_reg and ddr_data_reg)
 92 static const struct cmd_control ddr3_beagleblack_cmd_ctrl_data = {
 93         .cmd0csratio = MT41K256M16HA125E_RATIO,
 94         .cmd0iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
 95
 96         .cmd1csratio = MT41K256M16HA125E_RATIO,
 97         .cmd1iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
 98
 99         .cmd2csratio = MT41K256M16HA125E_RATIO,
100         .cmd2iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
101 };


 85 static const struct ddr_data ddr3_beagleblack_data = {
 86         .datardsratio0 = MT41K256M16HA125E_RD_DQS,
 87         .datawdsratio0 = MT41K256M16HA125E_WR_DQS,
 88         .datafwsratio0 = MT41K256M16HA125E_PHY_FIFO_WE,
 89         .datawrsratio0 = MT41K256M16HA125E_PHY_WR_DATA,
 90 };

3.EMIF interface config

103 static struct emif_regs ddr3_beagleblack_emif_reg_data = {
104         .sdram_config = MT41K256M16HA125E_EMIF_SDCFG,
105         .ref_ctrl = MT41K256M16HA125E_EMIF_SDREF,
106         .sdram_tim1 = MT41K256M16HA125E_EMIF_TIM1,
107         .sdram_tim2 = MT41K256M16HA125E_EMIF_TIM2,
108         .sdram_tim3 = MT41K256M16HA125E_EMIF_TIM3,
109         .zq_config = MT41K256M16HA125E_ZQ_CFG,
110         .emif_ddr_phy_ctlr_1 = MT41K256M16HA125E_EMIF_READ_LATENCY,
111 };
112

DDR_CONFIG
1.VTP终结电阻器配置
2.cmd_ctrl_data
主要配置cmd 0/1/2 ration /invers clkEn
3.ddr3_data
主要配置data0/1/2 rd/wd/fw/wr
4.io ctrl
cmd0/1/2 ioctl data0/1 ioctl
set CLK EN
5.config emif
CTRL+timing

关于TI EMIF接口使用说明 http://processors.wiki.ti.com/index.php/AM335x_EMIF_Configuration_tips DDR接口使用说明 http://processors.wiki.ti.com/index.php/AM335x_DDR_PHY_register_configuration_for_DDR3_using_Software_Leveling 另外一篇博客 http://blog.sina.com.cn/s/blog_5106eff1010193sl.html 最优的做法是,通过CCS下载TI提供的GET工具,进行配置然后读回寄存器值