|
|
@ -95,7 +95,6 @@ static uint32_t rdqdm_dly[DRAM_CH_CNT][CS_CNT][SLICE_CNT * 2][9]; |
|
|
|
static uint32_t max_density; |
|
|
|
static uint32_t ddr0800_mul; |
|
|
|
static uint32_t ddr_mul; |
|
|
|
static uint32_t ddr_mbps; |
|
|
|
static uint32_t DDR_PHY_SLICE_REGSET_OFS; |
|
|
|
static uint32_t DDR_PHY_ADR_V_REGSET_OFS; |
|
|
|
static uint32_t DDR_PHY_ADR_I_REGSET_OFS; |
|
|
@ -1136,6 +1135,7 @@ static void regif_pll_wa(void) |
|
|
|
uint32_t ch; |
|
|
|
|
|
|
|
if ((Prr_Product == PRR_PRODUCT_H3) && (Prr_Cut <= PRR_PRODUCT_11)) { |
|
|
|
// PLL setting for PHY : H3 Ver.1.x
|
|
|
|
reg_ddrphy_write_a(ddr_regdef_adr(_reg_PHY_PLL_WAIT), |
|
|
|
(0x0064U << |
|
|
|
ddr_regdef_lsb(_reg_PHY_PLL_WAIT))); |
|
|
@ -1175,6 +1175,9 @@ static void regif_pll_wa(void) |
|
|
|
_reg_PHY_LP4_BOOT_TOP_PLL_CTRL)); |
|
|
|
} |
|
|
|
|
|
|
|
reg_ddrphy_write_a(ddr_regdef_adr(_reg_PHY_LPDDR3_CS), |
|
|
|
_cnf_DDR_PHY_ADR_G_REGSET[ddr_regdef_adr(_reg_PHY_LPDDR3_CS) - DDR_PHY_ADR_G_REGSET_OFS]); |
|
|
|
|
|
|
|
/* protect register interface */ |
|
|
|
ddrphy_regif_idle(); |
|
|
|
pll3_control(0); |
|
|
@ -1902,7 +1905,14 @@ static void ddr_config(void) |
|
|
|
CACS DLY |
|
|
|
***********************************************************************/ |
|
|
|
dataL = Boardcnf->cacs_dly + _f_scale_adj(Boardcnf->cacs_dly_adj); |
|
|
|
set_dfifrequency(0x1f); |
|
|
|
|
|
|
|
if ((Prr_Product == PRR_PRODUCT_H3) && (Prr_Cut <= PRR_PRODUCT_11)) { |
|
|
|
set_dfifrequency(0x1f); |
|
|
|
} else { |
|
|
|
ddr_setval_ach(_reg_PHY_FREQ_SEL_MULTICAST_EN, 0x00); |
|
|
|
ddr_setval_ach(_reg_PHY_FREQ_SEL_INDEX, 0x01); |
|
|
|
} |
|
|
|
|
|
|
|
foreach_vch(ch) { |
|
|
|
int16_t adj; |
|
|
|
for (i = 0; i < _reg_PHY_CLK_CACS_SLAVE_DELAY_X_NUM; i++) { |
|
|
@ -1921,7 +1931,13 @@ static void ddr_config(void) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
set_dfifrequency(0x00); |
|
|
|
|
|
|
|
if ((Prr_Product == PRR_PRODUCT_H3) && (Prr_Cut <= PRR_PRODUCT_11)) { |
|
|
|
set_dfifrequency(0x00); |
|
|
|
} else { |
|
|
|
ddr_setval_ach(_reg_PHY_FREQ_SEL_MULTICAST_EN, 0x01); |
|
|
|
ddr_setval_ach(_reg_PHY_FREQ_SEL_INDEX, 0x00); |
|
|
|
} |
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
WDQDM DLY |
|
|
@ -2234,7 +2250,16 @@ static void dbsc_regset(void) |
|
|
|
+ (0x28 * 2)) * 400 * 2 * ddr_mbpsdiv / ddr_mbps + 7; |
|
|
|
if (tmp[0] < dataL) |
|
|
|
tmp[0] = dataL; |
|
|
|
mmio_write_32(DBSC_DBSCHRW1, tmp[0]); |
|
|
|
|
|
|
|
if ((Prr_Product == PRR_PRODUCT_M3) && (Prr_Cut < PRR_PRODUCT_30)) { |
|
|
|
mmio_write_32(DBSC_DBSCHRW1, tmp[0] |
|
|
|
+ ((mmio_read_32(DBSC_DBTR(22)) & 0x0000FFFF) |
|
|
|
* 400 * 2 * ddr_mbpsdiv +(ddr_mbps-1))/ddr_mbps - 3); |
|
|
|
} else { |
|
|
|
mmio_write_32(DBSC_DBSCHRW1, tmp[0] |
|
|
|
+ ((mmio_read_32(DBSC_DBTR(22)) & 0x0000FFFF) |
|
|
|
* 400 * 2 * ddr_mbpsdiv +(ddr_mbps-1))/ddr_mbps); |
|
|
|
} |
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
QOS and CAM |
|
|
@ -2378,6 +2403,38 @@ static void dbsc_regset_post(void) |
|
|
|
dataL = (get_refperiod()) * ddr_mbps / 2000 / ddr_mbpsdiv; |
|
|
|
mmio_write_32(DBSC_DBRFCNF1, 0x00080000 | (dataL & 0x0000ffff)); |
|
|
|
mmio_write_32(DBSC_DBRFCNF2, 0x00010000 | DBSC_REFINTS); |
|
|
|
|
|
|
|
#ifdef DDR_BACKUPMODE |
|
|
|
if (ddrBackup == DRAM_BOOT_STATUS_WARM) { |
|
|
|
#ifdef DDR_BACKUPMODE_HALF /* for Half channel(ch0,1 only) */ |
|
|
|
PutStr(" DEBUG_MESS : DDR_BACKUPMODE_HALF ", 1); |
|
|
|
send_dbcmd(0x08040001); |
|
|
|
wait_dbcmd(); |
|
|
|
send_dbcmd(0x0A040001); |
|
|
|
wait_dbcmd(); |
|
|
|
send_dbcmd(0x04040010); |
|
|
|
wait_dbcmd(); |
|
|
|
|
|
|
|
if (Prr_Product == PRR_PRODUCT_H3) { |
|
|
|
send_dbcmd(0x08140001); |
|
|
|
wait_dbcmd(); |
|
|
|
send_dbcmd(0x0A140001); |
|
|
|
wait_dbcmd(); |
|
|
|
send_dbcmd(0x04140010); |
|
|
|
wait_dbcmd(); |
|
|
|
} |
|
|
|
#else /* DDR_BACKUPMODE_HALF //for All channels */ |
|
|
|
send_dbcmd(0x08840001); |
|
|
|
wait_dbcmd(); |
|
|
|
send_dbcmd(0x0A840001); |
|
|
|
wait_dbcmd(); |
|
|
|
|
|
|
|
send_dbcmd(0x04840010); |
|
|
|
wait_dbcmd(); |
|
|
|
#endif /* DDR_BACKUPMODE_HALF */ |
|
|
|
} |
|
|
|
#endif /* DDR_BACKUPMODE */ |
|
|
|
|
|
|
|
#if RCAR_REWT_TRAINING != 0 |
|
|
|
/* Periodic-WriteDQ Training seeting */ |
|
|
|
if (((Prr_Product == PRR_PRODUCT_H3) && (Prr_Cut <= PRR_PRODUCT_11)) |
|
|
@ -2433,37 +2490,6 @@ static void dbsc_regset_post(void) |
|
|
|
#endif /* RCAR_DRAM_SPLIT == 2 */ |
|
|
|
} |
|
|
|
|
|
|
|
#ifdef DDR_BACKUPMODE |
|
|
|
if (ddrBackup == DRAM_BOOT_STATUS_WARM) { |
|
|
|
#ifdef DDR_BACKUPMODE_HALF /* for Half channel(ch0,1 only) */ |
|
|
|
PutStr(" DEBUG_MESS : DDR_BACKUPMODE_HALF ", 1); |
|
|
|
send_dbcmd(0x08040001); |
|
|
|
wait_dbcmd(); |
|
|
|
send_dbcmd(0x0A040001); |
|
|
|
wait_dbcmd(); |
|
|
|
send_dbcmd(0x04040010); |
|
|
|
wait_dbcmd(); |
|
|
|
|
|
|
|
if (Prr_Product == PRR_PRODUCT_H3) { |
|
|
|
send_dbcmd(0x08140001); |
|
|
|
wait_dbcmd(); |
|
|
|
send_dbcmd(0x0A140001); |
|
|
|
wait_dbcmd(); |
|
|
|
send_dbcmd(0x04140010); |
|
|
|
wait_dbcmd(); |
|
|
|
} |
|
|
|
#else /* DDR_BACKUPMODE_HALF //for All channels */ |
|
|
|
send_dbcmd(0x08840001); |
|
|
|
wait_dbcmd(); |
|
|
|
send_dbcmd(0x0A840001); |
|
|
|
wait_dbcmd(); |
|
|
|
|
|
|
|
send_dbcmd(0x04840010); |
|
|
|
wait_dbcmd(); |
|
|
|
#endif /* DDR_BACKUPMODE_HALF */ |
|
|
|
} |
|
|
|
#endif /* DDR_BACKUPMODE */ |
|
|
|
|
|
|
|
mmio_write_32(DBSC_DBRFEN, 0x00000001); |
|
|
|
/* dram access enable */ |
|
|
|
mmio_write_32(DBSC_DBACEN, 0x00000001); |
|
|
@ -3104,6 +3130,7 @@ static uint32_t init_ddr(void) |
|
|
|
/***********************************************************************
|
|
|
|
exec pi_training |
|
|
|
***********************************************************************/ |
|
|
|
ddr_setval_ach(_reg_PHY_FREQ_SEL_MULTICAST_EN, 0x00); |
|
|
|
ddr_setval_ach_as(_reg_PHY_PER_CS_TRAINING_MULTICAST_EN, 0x00); |
|
|
|
|
|
|
|
if ((Prr_Product == PRR_PRODUCT_H3) && (Prr_Cut <= PRR_PRODUCT_11)) { |
|
|
|