Lines Matching full:ddr
27 volatile ddr83xx_t *ddr = &immap->ddr; in board_add_ram_info() local
30 printf(" (DDR%d", ((ddr->sdram_cfg & SDRAM_CFG_SDRAM_TYPE_MASK) in board_add_ram_info()
34 if ((ddr->sdram_cfg & SDRAM_CFG_DBW_MASK) == SDRAM_CFG_DBW_16) in board_add_ram_info()
36 else if ((ddr->sdram_cfg & SDRAM_CFG_DBW_MASK) == SDRAM_CFG_DBW_32) in board_add_ram_info()
41 if (ddr->sdram_cfg & SDRAM_CFG_32_BE) in board_add_ram_info()
47 if (ddr->sdram_cfg & SDRAM_CFG_ECC_EN) in board_add_ram_info()
126 volatile ddr83xx_t *ddr = &immap->ddr; in spd_sdram() local
157 clrsetbits_be32(&ddr->sdram_cfg, SDRAM_CFG_MEM_EN, 0); in spd_sdram()
169 debug("DDR: Module mem type is %02X\n", spd.mem_type); in spd_sdram()
181 printf("DDR: The number of physical bank is %02X\n", n_ranks); in spd_sdram()
187 printf("DDR: Row number is out of range of DDRC, row=%02X\n", in spd_sdram()
194 printf("DDR: Col number is out of range of DDRC, col=%02X\n", in spd_sdram()
201 * Adjust DDR II IO voltage biasing. It just makes it work. in spd_sdram()
210 * ODT configuration recommendation from DDR Controller Chapter. in spd_sdram()
218 /* Setup DDR chip select register */ in spd_sdram()
220 ddr->csbnds[0].csbnds = (banksize(spd.row_dens) >> 24) - 1; in spd_sdram()
221 ddr->cs_config[0] = ( 1 << 31 in spd_sdram()
228 debug("cs0_bnds = 0x%08x\n",ddr->csbnds[0].csbnds); in spd_sdram()
229 debug("cs0_config = 0x%08x\n",ddr->cs_config[0]); in spd_sdram()
232 ddr->csbnds[1].csbnds = ( (banksize(spd.row_dens) >> 8) in spd_sdram()
234 ddr->cs_config[1] = ( 1<<31 in spd_sdram()
240 debug("cs1_bnds = 0x%08x\n",ddr->csbnds[1].csbnds); in spd_sdram()
241 debug("cs1_config = 0x%08x\n",ddr->cs_config[1]); in spd_sdram()
245 ddr->csbnds[2].csbnds = (banksize(spd.row_dens) >> 24) - 1; in spd_sdram()
246 ddr->cs_config[2] = ( 1 << 31 in spd_sdram()
253 debug("cs2_bnds = 0x%08x\n",ddr->csbnds[2].csbnds); in spd_sdram()
254 debug("cs2_config = 0x%08x\n",ddr->cs_config[2]); in spd_sdram()
257 ddr->csbnds[3].csbnds = ( (banksize(spd.row_dens) >> 8) in spd_sdram()
259 ddr->cs_config[3] = ( 1<<31 in spd_sdram()
265 debug("cs3_bnds = 0x%08x\n",ddr->csbnds[3].csbnds); in spd_sdram()
266 debug("cs3_config = 0x%08x\n",ddr->cs_config[3]); in spd_sdram()
281 * Set up LAWBAR for all of DDR. in spd_sdram()
285 debug("DDR:bar=0x%08x\n", ecm->bar); in spd_sdram()
286 debug("DDR:ar=0x%08x\n", ecm->ar); in spd_sdram()
290 * in the spd.cas_lat field. Translate it to a DDR in spd_sdram()
293 * CAS Lat DDR I DDR II Ctrl in spd_sdram()
309 printf("DDR I: Invalid SPD CAS Latency: 0x%x.\n", spd.cas_lat); in spd_sdram()
313 printf("DDR II: Invalid SPD CAS Latency: 0x%x.\n", in spd_sdram()
317 debug("DDR: caslat SPD bit is %d\n", caslat); in spd_sdram()
323 debug("DDR:Module maximum data rate is: %d MHz\n", max_data_rate); in spd_sdram()
341 } else if (max_data_rate >= 390 && max_data_rate < 460) { /* it is DDR 400 */ in spd_sdram()
343 /* DDR controller clk at 350~460 */ in spd_sdram()
347 /* DDR controller clk at 280~350 */ in spd_sdram()
354 /* DDR controller clk at 230~280 */ in spd_sdram()
363 /* DDR controller clk at 90~230 */ in spd_sdram()
372 } else if (max_data_rate >= 323) { /* it is DDR 333 */ in spd_sdram()
374 /* DDR controller clk at 280~350 */ in spd_sdram()
378 /* DDR controller clk at 230~280 */ in spd_sdram()
385 /* DDR controller clk at 90~230 */ in spd_sdram()
394 } else if (max_data_rate >= 256) { /* it is DDR 266 */ in spd_sdram()
396 /* DDR controller clk at 280~350 */ in spd_sdram()
397 printf("DDR: DDR controller freq is more than " in spd_sdram()
401 /* DDR controller clk at 230~280 */ in spd_sdram()
405 /* DDR controller clk at 90~230 */ in spd_sdram()
410 } else if (max_data_rate >= 190) { /* it is DDR 200 */ in spd_sdram()
412 /* DDR controller clk at 230~350 */ in spd_sdram()
413 printf("DDR: DDR controller freq is more than " in spd_sdram()
417 /* DDR controller clk at 90~230 */ in spd_sdram()
423 debug("DDR:Effective data rate is: %dMHz\n", effective_data_rate); in spd_sdram()
424 debug("DDR:The MSB 1 of CAS Latency is: %d\n", caslat); in spd_sdram()
432 ddr->debug_reg = 0x201c0000; /* CL=2 */ in spd_sdram()
434 ddr->debug_reg = 0x202c0000; /* CL=2.5 */ in spd_sdram()
436 ddr->debug_reg = 0x202c0000; /* CL=3.0 */ in spd_sdram()
440 debug("Errata DDR6 (debug_reg=0x%08x)\n", ddr->debug_reg); in spd_sdram()
444 * Convert caslat clocks to DDR controller value. in spd_sdram()
445 * Force caslat_ctrl to be DDR Controller field-sized. in spd_sdram()
453 debug("DDR: effective data rate is %d MHz\n", effective_data_rate); in spd_sdram()
454 debug("DDR: caslat SPD bit is %d, controller field is 0x%x\n", in spd_sdram()
459 * Avoid writing for DDR I. in spd_sdram()
467 ddr->timing_cfg_0 = (0 in spd_sdram()
473 debug("DDR: timing_cfg_0 = 0x%08x\n", ddr->timing_cfg_0); in spd_sdram()
477 * For DDR I, WRREC(Twr) and WRTORD(Twtr) are not in SPD, in spd_sdram()
479 * For DDR II, they are bytes 36 and 37, in quarter nanos. in spd_sdram()
494 * DDR I: Byte 42 straight up in ns. in spd_sdram()
495 * DDR II: Byte 40 and 42 swizzled some, in ns. in spd_sdram()
522 * Convert trfc_clk to DDR controller fields. DDR I should in spd_sdram()
530 ddr->timing_cfg_1 = in spd_sdram()
543 * For DDR I, 0. in spd_sdram()
544 * For DDR II, with ODT enabled, use "a value" less than ACTTORW, in spd_sdram()
561 * Empirically, 0x3 == 6/8 clock delay is suggested for DDR I 266. in spd_sdram()
579 * the HW will magically treat it as 1 for DDR 1. Oh Yea. in spd_sdram()
601 * Empirically set ~MCAS-to-preamble override for DDR 2. in spd_sdram()
622 ddr->timing_cfg_2 = (0 in spd_sdram()
632 debug("DDR:timing_cfg_1=0x%08x\n", ddr->timing_cfg_1); in spd_sdram()
633 debug("DDR:timing_cfg_2=0x%08x\n", ddr->timing_cfg_2); in spd_sdram()
641 debug("\n DDR DIMM: data bus width is 32 bit"); in spd_sdram()
644 debug("\n DDR DIMM: data bus width is 64 bit"); in spd_sdram()
647 /* Is this an ECC DDR chip? */ in spd_sdram()
659 ddr->sdram_mode = 0x50 | burstlen; /* CL=1.5 */ in spd_sdram()
662 ddr->sdram_mode = 0x20 | burstlen; /* CL=2.0 */ in spd_sdram()
665 ddr->sdram_mode = 0x60 | burstlen; /* CL=2.5 */ in spd_sdram()
668 ddr->sdram_mode = 0x30 | burstlen; /* CL=3.0 */ in spd_sdram()
671 printf("DDR:only CL 1.5, 2.0, 2.5, 3.0 is supported\n"); in spd_sdram()
685 ddr->sdram_mode = in spd_sdram()
698 debug("DDR:sdram_mode=0x%08x\n", ddr->sdram_mode); in spd_sdram()
703 ddr->sdram_mode2 = 0; in spd_sdram()
704 debug("DDR: sdram_mode2 = 0x%08x\n", ddr->sdram_mode2); in spd_sdram()
740 ddr->sdram_interval = ((refresh_clk & 0x3fff) << 16) | 0x100; in spd_sdram()
741 debug("DDR:sdram_interval=0x%08x\n", ddr->sdram_interval); in spd_sdram()
753 ddr->sdram_cfg2 = (0 in spd_sdram()
759 debug("DDR: sdram_cfg2 = 0x%08x\n", ddr->sdram_cfg2); in spd_sdram()
763 ddr->sdram_clk_cntl = CONFIG_SYS_DDR_SDRAM_CLK_CNTL; in spd_sdram()
765 debug("DDR:sdram_clk_cntl=0x%08x\n", ddr->sdram_clk_cntl); in spd_sdram()
777 * sdram_cfg[0] = 1 (ddr sdram logic enable) in spd_sdram()
779 * sdram_cfg[5:7] = (SDRAM type = DDR SDRAM) in spd_sdram()
780 * 010 DDR 1 SDRAM in spd_sdram()
781 * 011 DDR 2 SDRAM in spd_sdram()
791 | SDRAM_CFG_MEM_EN /* DDR enable */ in spd_sdram()
816 ddr->err_disable = ~ECC_ERROR_ENABLE; in spd_sdram()
819 ddr->err_sbe = (255 << ECC_ERROR_MAN_SBET_SHIFT) | in spd_sdram()
823 debug("DDR:err_disable=0x%08x\n", ddr->err_disable); in spd_sdram()
824 debug("DDR:err_sbe=0x%08x\n", ddr->err_sbe); in spd_sdram()
835 ddr->sdram_cfg = sdram_cfg; in spd_sdram()
839 debug("DDR:sdram_cfg=0x%08x\n", ddr->sdram_cfg); in spd_sdram()
880 volatile ddr83xx_t *ddr= &immap->ddr; in ddr_enable_ecc() local
894 debug("ddr init: CPU FP write method\n"); in ddr_enable_ecc()
906 debug("ddr init duration: %ld ms\n", t_end - t_start); in ddr_enable_ecc()
909 if ((ddr->err_detect & ECC_ERROR_DETECT_MME) == ECC_ERROR_DETECT_MME) in ddr_enable_ecc()
910 ddr->err_detect |= ECC_ERROR_DETECT_MME; in ddr_enable_ecc()
911 if ((ddr->err_detect & ECC_ERROR_DETECT_MBE) == ECC_ERROR_DETECT_MBE) in ddr_enable_ecc()
912 ddr->err_detect |= ECC_ERROR_DETECT_MBE; in ddr_enable_ecc()
913 if ((ddr->err_detect & ECC_ERROR_DETECT_SBE) == ECC_ERROR_DETECT_SBE) in ddr_enable_ecc()
914 ddr->err_detect |= ECC_ERROR_DETECT_SBE; in ddr_enable_ecc()
915 if ((ddr->err_detect & ECC_ERROR_DETECT_MSE) == ECC_ERROR_DETECT_MSE) in ddr_enable_ecc()
916 ddr->err_detect |= ECC_ERROR_DETECT_MSE; in ddr_enable_ecc()
919 ddr->err_int_en &= ECC_ERR_INT_DISABLE; in ddr_enable_ecc()
922 ddr->err_disable &= ECC_ERROR_ENABLE; in ddr_enable_ecc()