static void fdt_fixup_gic(void *blob) { int offset, err; u64 reg[8]; struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); unsigned int val; struct ccsr_scfg __iomem *scfg = (void *)CONFIG_SYS_FSL_SCFG_ADDR; int align_64k = 0; val = gur_in32(&gur->svr); if (!IS_SVR_DEV(val, SVR_DEV(SVR_LS1043A))) { align_64k = 1; } else if (SVR_REV(val) != REV1_0) { val = scfg_in32(&scfg->gic_align) & (0x01 << GIC_ADDR_BIT); if (!val) align_64k = 1; } offset = fdt_subnode_offset(blob, 0, "interrupt-controller@1400000"); if (offset < 0) { printf("WARNING: fdt_subnode_offset can't find node %s: %s\n", "interrupt-controller@1400000", fdt_strerror(offset)); return; } /* Fixup gic node align with 64K */ if (align_64k) { reg[0] = cpu_to_fdt64(GICD_BASE_64K); reg[1] = cpu_to_fdt64(GICD_SIZE_64K); reg[2] = cpu_to_fdt64(GICC_BASE_64K); reg[3] = cpu_to_fdt64(GICC_SIZE_64K); reg[4] = cpu_to_fdt64(GICH_BASE_64K); reg[5] = cpu_to_fdt64(GICH_SIZE_64K); reg[6] = cpu_to_fdt64(GICV_BASE_64K); reg[7] = cpu_to_fdt64(GICV_SIZE_64K); } else { /* Fixup gic node align with default */ reg[0] = cpu_to_fdt64(GICD_BASE); reg[1] = cpu_to_fdt64(GICD_SIZE); reg[2] = cpu_to_fdt64(GICC_BASE); reg[3] = cpu_to_fdt64(GICC_SIZE); reg[4] = cpu_to_fdt64(GICH_BASE); reg[5] = cpu_to_fdt64(GICH_SIZE); reg[6] = cpu_to_fdt64(GICV_BASE); reg[7] = cpu_to_fdt64(GICV_SIZE); } err = fdt_setprop(blob, offset, "reg", reg, sizeof(reg)); if (err < 0) { printf("WARNING: fdt_setprop can't set %s from node %s: %s\n", "reg", "interrupt-controller@1400000", fdt_strerror(err)); return; } return; }
int board_early_init_r(void) { struct km_bec_fpga *base = (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE; #if defined(CONFIG_SUVD3) immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; fsl_lbc_t *lbc = &immap->im_lbc; u32 *mxmr = &lbc->mamr; #endif #if defined(CONFIG_MPC8360) unsigned short svid; /* * Because of errata in the UCCs, we have to write to the reserved * registers to slow the clocks down. */ svid = SVR_REV(mfspr(SVR)); switch (svid) { case 0x0020: /* * MPC8360ECE.pdf QE_ENET10 table 4: * IMMR + 0x14A8[4:5] = 11 (clk delay for UCC 2) * IMMR + 0x14A8[18:19] = 11 (clk delay for UCC 1) */ setbits_be32((void *)(CONFIG_SYS_IMMR + 0x14a8), 0x0c003000); break; case 0x0021: /* * MPC8360ECE.pdf QE_ENET10 table 4: * IMMR + 0x14AC[24:27] = 1010 */ clrsetbits_be32((void *)(CONFIG_SYS_IMMR + 0x14ac), 0x00000050, 0x000000a0); break; } #endif /* enable the PHY on the PIGGY */ setbits_8(&base->pgy_eth, 0x01); /* enable the Unit LED (green) */ setbits_8(&base->oprth, WRL_BOOT); /* enable Application Buffer */ setbits_8(&base->oprtl, OPRTL_XBUFENA); #if defined(CONFIG_SUVD3) /* configure UPMA for APP1 */ upmconfig(UPMA, (uint *) upma_table, sizeof(upma_table) / sizeof(uint)); out_be32(mxmr, CONFIG_SYS_MAMR); #endif return 0; }
static void fdt_fixup_msi(void *blob) { struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); unsigned int rev; rev = gur_in32(&gur->svr); if (!IS_SVR_DEV(rev, SVR_DEV(SVR_LS1043A))) return; rev = SVR_REV(rev); _fdt_fixup_msi_node(blob, "/soc/msi-controller1@1571000", 116, 111, rev); _fdt_fixup_msi_node(blob, "/soc/msi-controller2@1572000", 126, 121, rev); _fdt_fixup_msi_node(blob, "/soc/msi-controller3@1573000", 160, 155, rev); _fdt_fixup_pci_msi(blob, "/soc/pcie@3400000", rev); _fdt_fixup_pci_msi(blob, "/soc/pcie@3500000", rev); _fdt_fixup_pci_msi(blob, "/soc/pcie@3600000", rev); }
int board_early_init_r (void) { unsigned short svid; /* * Because of errata in the UCCs, we have to write to the reserved * registers to slow the clocks down. */ svid = SVR_REV(mfspr (SVR)); switch (svid) { case 0x0020: setbits_be32((void *)(CONFIG_SYS_IMMR + 0x14a8), 0x0c003000); break; case 0x0021: clrsetbits_be32((void *)(CONFIG_SYS_IMMR + 0x14ac), 0x00000050, 0x000000a0); break; } /* enable the PHY on the PIGGY */ setbits (8, (void *)(CONFIG_SYS_PIGGY_BASE + 0x10003), 0x01); return 0; }
#include <linux/stddef.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/errno.h> #include <linux/reboot.h> #include <linux/pci.h> #include <linux/kdev_t.h> #include <linux/major.h> #include <linux/console.h> #include <linux/delay.h> #include <linux/seq_file.h> #include <linux/root_dev.h> #include <linux/initrd.h> #include <linux/of_platform.h> #include <linux/of_device.h> #include <asm/system.h> #include <asm/atomic.h> #include <asm/time.h> #include <asm/io.h> #include <asm/machdep.h> #include <asm/ipic.h> #include <asm/irq.h> #include <asm/prom.h> #include <asm/udbg.h> #include <sysdev/fsl_soc.h> #include <sysdev/fsl_pci.h> #include <asm/qe.h> #include <asm/qe_ic.h> #include "mpc83xx.h" #define SVR_REV(svr) (((svr) >> 0) & 0xFFFF) /* Revision field */ static void __init kmeter1_setup_arch(void) { struct device_node *np; if (ppc_md.progress) ppc_md.progress("kmeter1_setup_arch()", 0); #ifdef CONFIG_PCI for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") mpc83xx_add_bridge(np); #endif #ifdef CONFIG_QUICC_ENGINE qe_reset(); np = of_find_node_by_name(NULL, "par_io"); if (np != NULL) { par_io_init(np); of_node_put(np); for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;) par_io_of_config(np); } np = of_find_compatible_node(NULL, "network", "ucc_geth"); if (np != NULL) { uint svid; /* handle mpc8360ea rev.2.1 erratum 2: RGMII Timing */ svid = mfspr(SPRN_SVR); if (SVR_REV(svid) == 0x0021) { struct device_node *np_par; struct resource res; void __iomem *base; int ret; np_par = of_find_node_by_name(NULL, "par_io"); if (np_par == NULL) { printk(KERN_WARNING "%s couldn;t find par_io node\n", __func__); return; } /* Map Parallel I/O ports registers */ ret = of_address_to_resource(np_par, 0, &res); if (ret) { printk(KERN_WARNING "%s couldn;t map par_io registers\n", __func__); return; } base = ioremap(res.start, res.end - res.start + 1); /* * IMMR + 0x14A8[4:5] = 11 (clk delay for UCC 2) * IMMR + 0x14A8[18:19] = 11 (clk delay for UCC 1) */ setbits32((base + 0xa8), 0x0c003000); /* * IMMR + 0x14AC[20:27] = 10101010 * (data delay for both UCC's) */ clrsetbits_be32((base + 0xac), 0xff0, 0xaa0); iounmap(base); of_node_put(np_par); } of_node_put(np); } #endif /* CONFIG_QUICC_ENGINE */ }
static void quirk_mpc8360e_qe_enet10(void) { /* * handle mpc8360E Erratum QE_ENET10: * RGMII AC values do not meet the specification */ uint svid = mfspr(SPRN_SVR); struct device_node *np_par; struct resource res; void __iomem *base; int ret; np_par = of_find_node_by_name(NULL, "par_io"); if (np_par == NULL) { pr_warn("%s couldn;t find par_io node\n", __func__); return; } /* Map Parallel I/O ports registers */ ret = of_address_to_resource(np_par, 0, &res); if (ret) { pr_warn("%s couldn;t map par_io registers\n", __func__); return; } base = ioremap(res.start, res.end - res.start + 1); /* * set output delay adjustments to default values according * table 5 in Errata Rev. 5, 9/2011: * * write 0b01 to UCC1 bits 18:19 * write 0b01 to UCC2 option 1 bits 4:5 * write 0b01 to UCC2 option 2 bits 16:17 */ clrsetbits_be32((base + 0xa8), 0x0c00f000, 0x04005000); /* * set output delay adjustments to default values according * table 3-13 in Reference Manual Rev.3 05/2010: * * write 0b01 to UCC2 option 2 bits 16:17 * write 0b0101 to UCC1 bits 20:23 * write 0b0101 to UCC2 option 1 bits 24:27 */ clrsetbits_be32((base + 0xac), 0x0000cff0, 0x00004550); if (SVR_REV(svid) == 0x0021) { /* * UCC2 option 1: write 0b1010 to bits 24:27 * at address IMMRBAR+0x14AC */ clrsetbits_be32((base + 0xac), 0x000000f0, 0x000000a0); } else if (SVR_REV(svid) == 0x0020) { /* * UCC1: write 0b11 to bits 18:19 * at address IMMRBAR+0x14A8 */ setbits32((base + 0xa8), 0x00003000); /* * UCC2 option 1: write 0b11 to bits 4:5 * at address IMMRBAR+0x14A8 */ setbits32((base + 0xa8), 0x0c000000); /* * UCC2 option 2: write 0b11 to bits 16:17 * at address IMMRBAR+0x14AC */ setbits32((base + 0xac), 0x0000c000); } iounmap(base); of_node_put(np_par); }
static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_CPU_A011 extern int enable_cpu_a011_workaround; #endif __maybe_unused u32 svr = get_svr(); #if defined(CONFIG_FSL_SATA_V2) && defined(CONFIG_FSL_SATA_ERRATUM_A001) if (IS_SVR_REV(svr, 1, 0)) { switch (SVR_SOC_VER(svr)) { case SVR_P1013: case SVR_P1022: puts("Work-around for Erratum SATA A001 enabled\n"); } } #endif #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES8) puts("Work-around for Erratum SERDES8 enabled\n"); #endif #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES9) puts("Work-around for Erratum SERDES9 enabled\n"); #endif #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES_A005) puts("Work-around for Erratum SERDES-A005 enabled\n"); #endif #if defined(CONFIG_SYS_P4080_ERRATUM_CPU22) if (SVR_MAJ(svr) < 3) puts("Work-around for Erratum CPU22 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_CPU_A011 /* * NMG_CPU_A011 applies to P4080 rev 1.0, 2.0, fixed in 3.0 * also applies to P3041 rev 1.0, 1.1, P2041 rev 1.0, 1.1 * The SVR has been checked by cpu_init_r(). */ if (enable_cpu_a011_workaround) puts("Work-around for Erratum CPU-A011 enabled\n"); #endif #if defined(CONFIG_SYS_FSL_ERRATUM_CPU_A003999) puts("Work-around for Erratum CPU-A003999 enabled\n"); #endif #if defined(CONFIG_SYS_FSL_ERRATUM_DDR_A003474) puts("Work-around for Erratum DDR-A003474 enabled\n"); #endif #if defined(CONFIG_SYS_FSL_ERRATUM_DDR_MSYNC_IN) puts("Work-around for DDR MSYNC_IN Erratum enabled\n"); #endif #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC111) puts("Work-around for Erratum ESDHC111 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A004468 puts("Work-around for Erratum A004468 enabled\n"); #endif #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC135) puts("Work-around for Erratum ESDHC135 enabled\n"); #endif #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC13) if (SVR_MAJ(svr) < 3) puts("Work-around for Erratum ESDHC13 enabled\n"); #endif #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC_A001) puts("Work-around for Erratum ESDHC-A001 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_CPC_A002 puts("Work-around for Erratum CPC-A002 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_CPC_A003 puts("Work-around for Erratum CPC-A003 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_ELBC_A001 puts("Work-around for Erratum ELBC-A001 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_DDR_A003 puts("Work-around for Erratum DDR-A003 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_DDR_115 puts("Work-around for Erratum DDR115 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_DDR111_DDR134 puts("Work-around for Erratum DDR111 enabled\n"); puts("Work-around for Erratum DDR134 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_IFC_A002769 puts("Work-around for Erratum IFC-A002769 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_P1010_A003549 puts("Work-around for Erratum P1010-A003549 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_IFC_A003399 puts("Work-around for Erratum IFC A-003399 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_DDR120 if ((SVR_MAJ(svr) == 1) || IS_SVR_REV(svr, 2, 0)) puts("Work-around for Erratum NMG DDR120 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_LBC103 puts("Work-around for Erratum NMG_LBC103 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_ETSEC129 if ((SVR_MAJ(svr) == 1) || IS_SVR_REV(svr, 2, 0)) puts("Work-around for Erratum NMG ETSEC129 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A004508 puts("Work-around for Erratum A004508 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A004510 puts("Work-around for Erratum A004510 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_SRIO_A004034 puts("Work-around for Erratum SRIO-A004034 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A_004934 puts("Work-around for Erratum A004934 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A005871 if (IS_SVR_REV(svr, 1, 0)) puts("Work-around for Erratum A005871 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A006475 if (SVR_MAJ(get_svr()) == 1) puts("Work-around for Erratum A006475 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A006384 if (SVR_MAJ(get_svr()) == 1) puts("Work-around for Erratum A006384 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A004849 /* This work-around is implemented in PBI, so just check for it */ check_erratum_a4849(svr); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A004580 /* This work-around is implemented in PBI, so just check for it */ check_erratum_a4580(svr); #endif #ifdef CONFIG_SYS_P4080_ERRATUM_PCIE_A003 puts("Work-around for Erratum PCIe-A003 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_USB14 puts("Work-around for Erratum USB14 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A007186 if (has_erratum_a007186()) puts("Work-around for Erratum A007186 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A006593 puts("Work-around for Erratum A006593 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A006379 if (has_erratum_a006379()) puts("Work-around for Erratum A006379 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_SEC_A003571 if (IS_SVR_REV(svr, 1, 0)) puts("Work-around for Erratum A003571 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A005812 puts("Work-around for Erratum A-005812 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A005125 puts("Work-around for Erratum A005125 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A007075 if (has_erratum_a007075()) puts("Work-around for Erratum A007075 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A007798 if (has_erratum_a007798()) puts("Work-around for Erratum A007798 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A004477 if (has_erratum_a004477()) puts("Work-around for Erratum A004477 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_I2C_A004447 if ((SVR_SOC_VER(svr) == SVR_8548 && IS_SVR_REV(svr, 3, 1)) || (SVR_REV(svr) <= CONFIG_SYS_FSL_A004447_SVR_REV)) puts("Work-around for Erratum I2C-A004447 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A006261 if (has_erratum_a006261()) puts("Work-around for Erratum A006261 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A007212 check_erratum_a007212(); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A005434 puts("Work-around for Erratum A-005434 enabled\n"); #endif #if defined(CONFIG_SYS_FSL_ERRATUM_A008044) && \ defined(CONFIG_A008044_WORKAROUND) if (IS_SVR_REV(svr, 1, 0)) puts("Work-around for Erratum A-008044 enabled\n"); #endif #if defined(CONFIG_SYS_FSL_B4860QDS_XFI_ERR) && defined(CONFIG_B4860QDS) puts("Work-around for Erratum XFI on B4860QDS enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A009663 puts("Work-around for Erratum A009663 enabled\n"); #endif return 0; }
static phys_size_t sdram_setup(int casl) { int i; volatile ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_MPC85xx_DDR_ADDR); #ifdef CONFIG_TQM8548 volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); #if defined(CONFIG_TQM8548_AG) || defined(CONFIG_TQM8548_BE) volatile ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR); #endif #else /* !CONFIG_TQM8548 */ unsigned long cfg_ddr_timing1; unsigned long cfg_ddr_mode; #endif /* CONFIG_TQM8548 */ /* * Disable memory controller. */ ddr->cs0_config = 0; ddr->sdram_cfg = 0; #ifdef CONFIG_TQM8548 /* Timing and refresh settings for DDR2-533 and below */ ddr->cs0_bnds = (ddr_cs_conf[0].size - 1) >> 24; ddr->cs0_config = ddr_cs_conf[0].reg; ddr->timing_cfg_3 = 0x00020000; /* TIMING CFG 1, 533MHz * PRETOACT: 4 Clocks * ACTTOPRE: 12 Clocks * ACTTORW: 4 Clocks * CASLAT: 4 Clocks * REFREC: EXT_REFREC:REFREC 53 Clocks * WRREC: 4 Clocks * ACTTOACT: 3 Clocks * WRTORD: 2 Clocks */ ddr->timing_cfg_1 = 0x4C47D432; /* TIMING CFG 2, 533MHz * ADD_LAT: 3 Clocks * CPO: READLAT + 1 * WR_LAT: 3 Clocks * RD_TO_PRE: 2 Clocks * WR_DATA_DELAY: 1/2 Clock * CKE_PLS: 3 Clock * FOUR_ACT: 14 Clocks */ ddr->timing_cfg_2 = 0x331848CE; /* DDR SDRAM Mode, 533MHz * MRS: Extended Mode Register * OUT: Outputs enabled * RDQS: no * DQS: enabled * OCD: default state * RTT: 75 Ohms * Posted CAS: 3 Clocks * ODS: reduced strength * DLL: enabled * MR: Mode Register * PD: fast exit * WR: 4 Clocks * DLL: no DLL reset * TM: normal * CAS latency: 4 Clocks * BT: sequential * Burst length: 4 */ ddr->sdram_mode = 0x439E0642; /* DDR SDRAM Interval, 533MHz * REFINT: 1040 Clocks * BSTOPRE: 256 */ ddr->sdram_interval = (1040 << 16) | 0x100; /* * Workaround for erratum DDR19 according to MPC8548 Device Errata * document, Rev. 1: DDR IO receiver must be set to an acceptable * bias point by modifying a hidden register. */ if (SVR_REV (get_svr ()) < 0x21) gur->ddrioovcr = 0x90000000; /* enable, VSEL 1.8V */ /* DDR SDRAM CFG 2 * FRC_SR: normal mode * SR_IE: no self-refresh interrupt * DLL_RST_DIS: don't care, leave at reset value * DQS_CFG: differential DQS signals * ODT_CFG: assert ODT to internal IOs only during reads to DRAM * LVWx_CFG: don't care, leave at reset value * NUM_PR: 1 refresh will be issued at a time * DM_CFG: don't care, leave at reset value * D_INIT: no data initialization */ ddr->sdram_cfg_2 = 0x04401000; /* DDR SDRAM MODE 2 * MRS: Extended Mode Register 2 */ ddr->sdram_mode_2 = 0x8000C000; /* DDR SDRAM CLK CNTL * CLK_ADJUST: 1/2 Clock 0x02000000 * CLK_ADJUST: 5/8 Clock 0x02800000 */ ddr->sdram_clk_cntl = 0x02800000; /* wait for clock stabilization */ asm ("sync;isync;msync"); udelay (1000); #if defined(CONFIG_TQM8548_AG) || defined(CONFIG_TQM8548_BE) /* * Workaround for erratum DDR20 according to MPC8548 Device Errata * document, Rev. 1: "CKE signal may not function correctly after * assertion of HRESET" */ /* 1. Configure DDR register as is done in normal DDR configuration. * Do not set DDR_SDRAM_CFG[MEM_EN]. * * 2. Set reserved bit EEBACR[3] at offset 0x1000 */ ecm->eebacr |= 0x10000000; /* * 3. Before DDR_SDRAM_CFG[MEM_EN] is set, write DDR_SDRAM_CFG_2[D_INIT] * * DDR_SDRAM_CFG_2: * FRC_SR: normal mode * SR_IE: no self-refresh interrupt * DLL_RST_DIS: don't care, leave at reset value * DQS_CFG: differential DQS signals * ODT_CFG: assert ODT to internal IOs only during reads to DRAM * LVWx_CFG: don't care, leave at reset value * NUM_PR: 1 refresh will be issued at a time * DM_CFG: don't care, leave at reset value * D_INIT: enable data initialization */ ddr->sdram_cfg_2 |= 0x00000010; /* * 4. Before DDR_SDRAM_CFG[MEM_EN] set, write D3[21] to disable data * training */ ddr->debug[2] |= 0x00000400; /* * 5. Wait 200 micro-seconds */ udelay (200); /* * 6. Set DDR_SDRAM_CFG[MEM_EN] * * BTW, initialize DDR_SDRAM_CFG: * MEM_EN: enabled * SREN: don't care, leave at reset value * ECC_EN: no error report * RD_EN: no registered DIMMs * SDRAM_TYPE: DDR2 * DYN_PWR: no power management * 32_BE: don't care, leave at reset value * 8_BE: 4 beat burst * NCAP: don't care, leave at reset value * 2T_EN: 1T Timing * BA_INTLV_CTL: no interleaving * x32_EN: x16 organization * PCHB8: MA[10] for auto-precharge * HSE: half strength for single and 2-layer stacks * (full strength for 3- and 4-layer stacks not * yet considered) * MEM_HALT: no halt * BI: automatic initialization */ ddr->sdram_cfg = 0x83000008; /* * 7. Poll DDR_SDRAM_CFG_2[D_INIT] until it is cleared by hardware */ asm ("sync;isync;msync"); while (ddr->sdram_cfg_2 & 0x00000010) asm ("eieio"); /* * 8. Clear D3[21] to re-enable data training */ ddr->debug[2] &= ~0x00000400; /* * 9. Set D2(21) to force data training to run */ ddr->debug[1] |= 0x00000400; /* * 10. Poll on D2[21] until it is cleared by hardware */ asm ("sync;isync;msync"); while (ddr->debug[1] & 0x00000400) asm ("eieio"); /* * 11. Clear reserved bit EEBACR[3] at offset 0x1000 */ ecm->eebacr &= ~0x10000000; #else /* !(CONFIG_TQM8548_AG || CONFIG_TQM8548_BE) */ /* DDR SDRAM CLK CNTL * MEM_EN: enabled * SREN: don't care, leave at reset value * ECC_EN: no error report * RD_EN: no register DIMMs * SDRAM_TYPE: DDR2 * DYN_PWR: no power management * 32_BE: don't care, leave at reset value * 8_BE: 4 beat burst * NCAP: don't care, leave at reset value * 2T_EN: 1T Timing * BA_INTLV_CTL: no interleaving * x32_EN: x16 organization * PCHB8: MA[10] for auto-precharge * HSE: half strength for single and 2-layer stacks * (full strength for 3- and 4-layer stacks no yet considered) * MEM_HALT: no halt * BI: automatic initialization */ ddr->sdram_cfg = 0x83000008; #endif /* CONFIG_TQM8548_AG || CONFIG_TQM8548_BE */ asm ("sync; isync; msync"); udelay (1000); #else /* !CONFIG_TQM8548 */ switch (casl) { case 20: cfg_ddr_timing1 = 0x47405331 | (3 << 16); cfg_ddr_mode = 0x40020002 | (2 << 4); break; case 25: cfg_ddr_timing1 = 0x47405331 | (4 << 16); cfg_ddr_mode = 0x40020002 | (6 << 4); break; case 30: default: cfg_ddr_timing1 = 0x47405331 | (5 << 16); cfg_ddr_mode = 0x40020002 | (3 << 4); break; } ddr->cs0_bnds = (ddr_cs_conf[0].size - 1) >> 24; ddr->cs0_config = ddr_cs_conf[0].reg; ddr->timing_cfg_1 = cfg_ddr_timing1; ddr->timing_cfg_2 = 0x00000800; /* P9-45,may need tuning */ ddr->sdram_mode = cfg_ddr_mode; ddr->sdram_interval = 0x05160100; /* autocharge,no open page */ ddr->err_disable = 0x0000000D; asm ("sync; isync; msync"); udelay (1000); ddr->sdram_cfg = 0xc2000000; /* unbuffered,no DYN_PWR */ asm ("sync; isync; msync"); udelay (1000); #endif /* CONFIG_TQM8548 */ for (i = 0; i < N_DDR_CS_CONF; i++) { ddr->cs0_config = ddr_cs_conf[i].reg; if (get_ram_size (0, ddr_cs_conf[i].size) == ddr_cs_conf[i].size) { /* * size detected -> set Chip Select Bounds Register */ ddr->cs0_bnds = (ddr_cs_conf[i].size - 1) >> 24; break; } }