1a47a12beSStefan Roese /* 2a09b9b68SKumar Gala * Copyright 2007-2011 Freescale Semiconductor, Inc. 3a47a12beSStefan Roese * 4a47a12beSStefan Roese * (C) Copyright 2003 Motorola Inc. 5a47a12beSStefan Roese * Modified by Xianghua Xiao, X.Xiao@motorola.com 6a47a12beSStefan Roese * 7a47a12beSStefan Roese * (C) Copyright 2000 8a47a12beSStefan Roese * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 9a47a12beSStefan Roese * 101a459660SWolfgang Denk * SPDX-License-Identifier: GPL-2.0+ 11a47a12beSStefan Roese */ 12a47a12beSStefan Roese 13a47a12beSStefan Roese #include <common.h> 14a47a12beSStefan Roese #include <watchdog.h> 15a47a12beSStefan Roese #include <asm/processor.h> 16a47a12beSStefan Roese #include <ioports.h> 17f54fe87aSKumar Gala #include <sata.h> 18c916d7c9SKumar Gala #include <fm_eth.h> 19a47a12beSStefan Roese #include <asm/io.h> 20fd3c9befSKumar Gala #include <asm/cache.h> 21a47a12beSStefan Roese #include <asm/mmu.h> 22a47a12beSStefan Roese #include <asm/fsl_law.h> 23f54fe87aSKumar Gala #include <asm/fsl_serdes.h> 245ffa88ecSLiu Gang #include <asm/fsl_srio.h> 259dee205dSramneek mehresh #include <fsl_usb.h> 2657125f22SYork Sun #include <hwconfig.h> 27fbc20aabSTimur Tabi #include <linux/compiler.h> 28a47a12beSStefan Roese #include "mp.h" 29f2717b47STimur Tabi #ifdef CONFIG_SYS_QE_FMAN_FW_IN_NAND 30a7b1e1b7SHaiying Wang #include <nand.h> 31a7b1e1b7SHaiying Wang #include <errno.h> 32a7b1e1b7SHaiying Wang #endif 33a47a12beSStefan Roese 34fbc20aabSTimur Tabi #include "../../../../drivers/block/fsl_sata.h" 35fbc20aabSTimur Tabi 36a47a12beSStefan Roese DECLARE_GLOBAL_DATA_PTR; 37a47a12beSStefan Roese 38a47a12beSStefan Roese #ifdef CONFIG_QE 39a47a12beSStefan Roese extern qe_iop_conf_t qe_iop_conf_tab[]; 40a47a12beSStefan Roese extern void qe_config_iopin(u8 port, u8 pin, int dir, 41a47a12beSStefan Roese int open_drain, int assign); 42a47a12beSStefan Roese extern void qe_init(uint qe_base); 43a47a12beSStefan Roese extern void qe_reset(void); 44a47a12beSStefan Roese 45a47a12beSStefan Roese static void config_qe_ioports(void) 46a47a12beSStefan Roese { 47a47a12beSStefan Roese u8 port, pin; 48a47a12beSStefan Roese int dir, open_drain, assign; 49a47a12beSStefan Roese int i; 50a47a12beSStefan Roese 51a47a12beSStefan Roese for (i = 0; qe_iop_conf_tab[i].assign != QE_IOP_TAB_END; i++) { 52a47a12beSStefan Roese port = qe_iop_conf_tab[i].port; 53a47a12beSStefan Roese pin = qe_iop_conf_tab[i].pin; 54a47a12beSStefan Roese dir = qe_iop_conf_tab[i].dir; 55a47a12beSStefan Roese open_drain = qe_iop_conf_tab[i].open_drain; 56a47a12beSStefan Roese assign = qe_iop_conf_tab[i].assign; 57a47a12beSStefan Roese qe_config_iopin(port, pin, dir, open_drain, assign); 58a47a12beSStefan Roese } 59a47a12beSStefan Roese } 60a47a12beSStefan Roese #endif 61a47a12beSStefan Roese 62a47a12beSStefan Roese #ifdef CONFIG_CPM2 63a47a12beSStefan Roese void config_8560_ioports (volatile ccsr_cpm_t * cpm) 64a47a12beSStefan Roese { 65a47a12beSStefan Roese int portnum; 66a47a12beSStefan Roese 67a47a12beSStefan Roese for (portnum = 0; portnum < 4; portnum++) { 68a47a12beSStefan Roese uint pmsk = 0, 69a47a12beSStefan Roese ppar = 0, 70a47a12beSStefan Roese psor = 0, 71a47a12beSStefan Roese pdir = 0, 72a47a12beSStefan Roese podr = 0, 73a47a12beSStefan Roese pdat = 0; 74a47a12beSStefan Roese iop_conf_t *iopc = (iop_conf_t *) & iop_conf_tab[portnum][0]; 75a47a12beSStefan Roese iop_conf_t *eiopc = iopc + 32; 76a47a12beSStefan Roese uint msk = 1; 77a47a12beSStefan Roese 78a47a12beSStefan Roese /* 79a47a12beSStefan Roese * NOTE: 80a47a12beSStefan Roese * index 0 refers to pin 31, 81a47a12beSStefan Roese * index 31 refers to pin 0 82a47a12beSStefan Roese */ 83a47a12beSStefan Roese while (iopc < eiopc) { 84a47a12beSStefan Roese if (iopc->conf) { 85a47a12beSStefan Roese pmsk |= msk; 86a47a12beSStefan Roese if (iopc->ppar) 87a47a12beSStefan Roese ppar |= msk; 88a47a12beSStefan Roese if (iopc->psor) 89a47a12beSStefan Roese psor |= msk; 90a47a12beSStefan Roese if (iopc->pdir) 91a47a12beSStefan Roese pdir |= msk; 92a47a12beSStefan Roese if (iopc->podr) 93a47a12beSStefan Roese podr |= msk; 94a47a12beSStefan Roese if (iopc->pdat) 95a47a12beSStefan Roese pdat |= msk; 96a47a12beSStefan Roese } 97a47a12beSStefan Roese 98a47a12beSStefan Roese msk <<= 1; 99a47a12beSStefan Roese iopc++; 100a47a12beSStefan Roese } 101a47a12beSStefan Roese 102a47a12beSStefan Roese if (pmsk != 0) { 103a47a12beSStefan Roese volatile ioport_t *iop = ioport_addr (cpm, portnum); 104a47a12beSStefan Roese uint tpmsk = ~pmsk; 105a47a12beSStefan Roese 106a47a12beSStefan Roese /* 107a47a12beSStefan Roese * the (somewhat confused) paragraph at the 108a47a12beSStefan Roese * bottom of page 35-5 warns that there might 109a47a12beSStefan Roese * be "unknown behaviour" when programming 110a47a12beSStefan Roese * PSORx and PDIRx, if PPARx = 1, so I 111a47a12beSStefan Roese * decided this meant I had to disable the 112a47a12beSStefan Roese * dedicated function first, and enable it 113a47a12beSStefan Roese * last. 114a47a12beSStefan Roese */ 115a47a12beSStefan Roese iop->ppar &= tpmsk; 116a47a12beSStefan Roese iop->psor = (iop->psor & tpmsk) | psor; 117a47a12beSStefan Roese iop->podr = (iop->podr & tpmsk) | podr; 118a47a12beSStefan Roese iop->pdat = (iop->pdat & tpmsk) | pdat; 119a47a12beSStefan Roese iop->pdir = (iop->pdir & tpmsk) | pdir; 120a47a12beSStefan Roese iop->ppar |= ppar; 121a47a12beSStefan Roese } 122a47a12beSStefan Roese } 123a47a12beSStefan Roese } 124a47a12beSStefan Roese #endif 125a47a12beSStefan Roese 1266aba33e9SKumar Gala #ifdef CONFIG_SYS_FSL_CPC 1276aba33e9SKumar Gala static void enable_cpc(void) 1286aba33e9SKumar Gala { 1296aba33e9SKumar Gala int i; 1306aba33e9SKumar Gala u32 size = 0; 1316aba33e9SKumar Gala 1326aba33e9SKumar Gala cpc_corenet_t *cpc = (cpc_corenet_t *)CONFIG_SYS_FSL_CPC_ADDR; 1336aba33e9SKumar Gala 1346aba33e9SKumar Gala for (i = 0; i < CONFIG_SYS_NUM_CPC; i++, cpc++) { 1356aba33e9SKumar Gala u32 cpccfg0 = in_be32(&cpc->cpccfg0); 1366aba33e9SKumar Gala size += CPC_CFG0_SZ_K(cpccfg0); 1372a9fab82SShaohui Xie #ifdef CONFIG_RAMBOOT_PBL 1382a9fab82SShaohui Xie if (in_be32(&cpc->cpcsrcr0) & CPC_SRCR0_SRAMEN) { 1392a9fab82SShaohui Xie /* find and disable LAW of SRAM */ 1402a9fab82SShaohui Xie struct law_entry law = find_law(CONFIG_SYS_INIT_L3_ADDR); 1412a9fab82SShaohui Xie 1422a9fab82SShaohui Xie if (law.index == -1) { 1432a9fab82SShaohui Xie printf("\nFatal error happened\n"); 1442a9fab82SShaohui Xie return; 1452a9fab82SShaohui Xie } 1462a9fab82SShaohui Xie disable_law(law.index); 1472a9fab82SShaohui Xie 1482a9fab82SShaohui Xie clrbits_be32(&cpc->cpchdbcr0, CPC_HDBCR0_CDQ_SPEC_DIS); 1492a9fab82SShaohui Xie out_be32(&cpc->cpccsr0, 0); 1502a9fab82SShaohui Xie out_be32(&cpc->cpcsrcr0, 0); 1512a9fab82SShaohui Xie } 1522a9fab82SShaohui Xie #endif 1536aba33e9SKumar Gala 1541d2c2a62SKumar Gala #ifdef CONFIG_SYS_FSL_ERRATUM_CPC_A002 1551d2c2a62SKumar Gala setbits_be32(&cpc->cpchdbcr0, CPC_HDBCR0_TAG_ECC_SCRUB_DIS); 1561d2c2a62SKumar Gala #endif 157868da593SKumar Gala #ifdef CONFIG_SYS_FSL_ERRATUM_CPC_A003 158868da593SKumar Gala setbits_be32(&cpc->cpchdbcr0, CPC_HDBCR0_DATA_ECC_SCRUB_DIS); 159868da593SKumar Gala #endif 16082125192SScott Wood #ifdef CONFIG_SYS_FSL_ERRATUM_A006593 16182125192SScott Wood setbits_be32(&cpc->cpchdbcr0, 1 << (31 - 21)); 16282125192SScott Wood #endif 1631d2c2a62SKumar Gala 1646aba33e9SKumar Gala out_be32(&cpc->cpccsr0, CPC_CSR0_CE | CPC_CSR0_PE); 1656aba33e9SKumar Gala /* Read back to sync write */ 1666aba33e9SKumar Gala in_be32(&cpc->cpccsr0); 1676aba33e9SKumar Gala 1686aba33e9SKumar Gala } 1696aba33e9SKumar Gala 1702f848f97SShruti Kanetkar puts("Corenet Platform Cache: "); 1712f848f97SShruti Kanetkar print_size(size * 1024, " enabled\n"); 1726aba33e9SKumar Gala } 1736aba33e9SKumar Gala 174e56143e5SKim Phillips static void invalidate_cpc(void) 1756aba33e9SKumar Gala { 1766aba33e9SKumar Gala int i; 1776aba33e9SKumar Gala cpc_corenet_t *cpc = (cpc_corenet_t *)CONFIG_SYS_FSL_CPC_ADDR; 1786aba33e9SKumar Gala 1796aba33e9SKumar Gala for (i = 0; i < CONFIG_SYS_NUM_CPC; i++, cpc++) { 1802a9fab82SShaohui Xie /* skip CPC when it used as all SRAM */ 1812a9fab82SShaohui Xie if (in_be32(&cpc->cpcsrcr0) & CPC_SRCR0_SRAMEN) 1822a9fab82SShaohui Xie continue; 1836aba33e9SKumar Gala /* Flash invalidate the CPC and clear all the locks */ 1846aba33e9SKumar Gala out_be32(&cpc->cpccsr0, CPC_CSR0_FI | CPC_CSR0_LFC); 1856aba33e9SKumar Gala while (in_be32(&cpc->cpccsr0) & (CPC_CSR0_FI | CPC_CSR0_LFC)) 1866aba33e9SKumar Gala ; 1876aba33e9SKumar Gala } 1886aba33e9SKumar Gala } 1896aba33e9SKumar Gala #else 1906aba33e9SKumar Gala #define enable_cpc() 1916aba33e9SKumar Gala #define invalidate_cpc() 1926aba33e9SKumar Gala #endif /* CONFIG_SYS_FSL_CPC */ 1936aba33e9SKumar Gala 194a47a12beSStefan Roese /* 195a47a12beSStefan Roese * Breathe some life into the CPU... 196a47a12beSStefan Roese * 197a47a12beSStefan Roese * Set up the memory map 198a47a12beSStefan Roese * initialize a bunch of registers 199a47a12beSStefan Roese */ 200a47a12beSStefan Roese 201a47a12beSStefan Roese #ifdef CONFIG_FSL_CORENET 202a47a12beSStefan Roese static void corenet_tb_init(void) 203a47a12beSStefan Roese { 204a47a12beSStefan Roese volatile ccsr_rcpm_t *rcpm = 205a47a12beSStefan Roese (void *)(CONFIG_SYS_FSL_CORENET_RCPM_ADDR); 206a47a12beSStefan Roese volatile ccsr_pic_t *pic = 207680c613aSKim Phillips (void *)(CONFIG_SYS_MPC8xxx_PIC_ADDR); 208a47a12beSStefan Roese u32 whoami = in_be32(&pic->whoami); 209a47a12beSStefan Roese 210a47a12beSStefan Roese /* Enable the timebase register for this core */ 211a47a12beSStefan Roese out_be32(&rcpm->ctbenrl, (1 << whoami)); 212a47a12beSStefan Roese } 213a47a12beSStefan Roese #endif 214a47a12beSStefan Roese 215a47a12beSStefan Roese void cpu_init_f (void) 216a47a12beSStefan Roese { 217a47a12beSStefan Roese extern void m8560_cpm_reset (void); 218f110fe94SStephen George #ifdef CONFIG_SYS_DCSRBAR_PHYS 219f110fe94SStephen George ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); 220f110fe94SStephen George #endif 2217065b7d4SRuchika Gupta #if defined(CONFIG_SECURE_BOOT) 2227065b7d4SRuchika Gupta struct law_entry law; 2237065b7d4SRuchika Gupta #endif 224a47a12beSStefan Roese #ifdef CONFIG_MPC8548 225a47a12beSStefan Roese ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR); 226a47a12beSStefan Roese uint svr = get_svr(); 227a47a12beSStefan Roese 228a47a12beSStefan Roese /* 229a47a12beSStefan Roese * CPU2 errata workaround: A core hang possible while executing 230a47a12beSStefan Roese * a msync instruction and a snoopable transaction from an I/O 231a47a12beSStefan Roese * master tagged to make quick forward progress is present. 232a47a12beSStefan Roese * Fixed in silicon rev 2.1. 233a47a12beSStefan Roese */ 234a47a12beSStefan Roese if ((SVR_MAJ(svr) == 1) || ((SVR_MAJ(svr) == 2 && SVR_MIN(svr) == 0x0))) 235a47a12beSStefan Roese out_be32(&ecm->eebpcr, in_be32(&ecm->eebpcr) | (1 << 16)); 236a47a12beSStefan Roese #endif 237a47a12beSStefan Roese 238a47a12beSStefan Roese disable_tlb(14); 239a47a12beSStefan Roese disable_tlb(15); 240a47a12beSStefan Roese 2417065b7d4SRuchika Gupta #if defined(CONFIG_SECURE_BOOT) 2427065b7d4SRuchika Gupta /* Disable the LAW created for NOR flash by the PBI commands */ 2437065b7d4SRuchika Gupta law = find_law(CONFIG_SYS_PBI_FLASH_BASE); 2447065b7d4SRuchika Gupta if (law.index != -1) 2457065b7d4SRuchika Gupta disable_law(law.index); 2467065b7d4SRuchika Gupta #endif 2477065b7d4SRuchika Gupta 248a47a12beSStefan Roese #ifdef CONFIG_CPM2 249a47a12beSStefan Roese config_8560_ioports((ccsr_cpm_t *)CONFIG_SYS_MPC85xx_CPM_ADDR); 250a47a12beSStefan Roese #endif 251a47a12beSStefan Roese 252f51cdaf1SBecky Bruce init_early_memctl_regs(); 253a47a12beSStefan Roese 254a47a12beSStefan Roese #if defined(CONFIG_CPM2) 255a47a12beSStefan Roese m8560_cpm_reset(); 256a47a12beSStefan Roese #endif 257a47a12beSStefan Roese #ifdef CONFIG_QE 258a47a12beSStefan Roese /* Config QE ioports */ 259a47a12beSStefan Roese config_qe_ioports(); 260a47a12beSStefan Roese #endif 261a47a12beSStefan Roese #if defined(CONFIG_FSL_DMA) 262a47a12beSStefan Roese dma_init(); 263a47a12beSStefan Roese #endif 264a47a12beSStefan Roese #ifdef CONFIG_FSL_CORENET 265a47a12beSStefan Roese corenet_tb_init(); 266a47a12beSStefan Roese #endif 267a47a12beSStefan Roese init_used_tlb_cams(); 2686aba33e9SKumar Gala 2696aba33e9SKumar Gala /* Invalidate the CPC before DDR gets enabled */ 2706aba33e9SKumar Gala invalidate_cpc(); 271f110fe94SStephen George 272f110fe94SStephen George #ifdef CONFIG_SYS_DCSRBAR_PHYS 273f110fe94SStephen George /* set DCSRCR so that DCSR space is 1G */ 274f110fe94SStephen George setbits_be32(&gur->dcsrcr, FSL_CORENET_DCSR_SZ_1G); 275f110fe94SStephen George in_be32(&gur->dcsrcr); 276f110fe94SStephen George #endif 277f110fe94SStephen George 278a47a12beSStefan Roese } 279a47a12beSStefan Roese 28035079aa9SKumar Gala /* Implement a dummy function for those platforms w/o SERDES */ 28135079aa9SKumar Gala static void __fsl_serdes__init(void) 28235079aa9SKumar Gala { 28335079aa9SKumar Gala return ; 28435079aa9SKumar Gala } 28535079aa9SKumar Gala __attribute__((weak, alias("__fsl_serdes__init"))) void fsl_serdes_init(void); 286a47a12beSStefan Roese 2876d2b9da1SYork Sun #ifdef CONFIG_SYS_FSL_QORIQ_CHASSIS2 2886d2b9da1SYork Sun int enable_cluster_l2(void) 2896d2b9da1SYork Sun { 2906d2b9da1SYork Sun int i = 0; 2916d2b9da1SYork Sun u32 cluster; 2926d2b9da1SYork Sun ccsr_gur_t *gur = (void __iomem *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); 2936d2b9da1SYork Sun struct ccsr_cluster_l2 __iomem *l2cache; 2946d2b9da1SYork Sun 2956d2b9da1SYork Sun cluster = in_be32(&gur->tp_cluster[i].lower); 2966d2b9da1SYork Sun if (cluster & TP_CLUSTER_EOC) 2976d2b9da1SYork Sun return 0; 2986d2b9da1SYork Sun 2996d2b9da1SYork Sun /* The first cache has already been set up, so skip it */ 3006d2b9da1SYork Sun i++; 3016d2b9da1SYork Sun 3026d2b9da1SYork Sun /* Look through the remaining clusters, and set up their caches */ 3036d2b9da1SYork Sun do { 304db9a8070SPrabhakar Kushwaha int j, cluster_valid = 0; 305db9a8070SPrabhakar Kushwaha 3066d2b9da1SYork Sun l2cache = (void __iomem *)(CONFIG_SYS_FSL_CLUSTER_1_L2 + i * 0x40000); 307db9a8070SPrabhakar Kushwaha 3086d2b9da1SYork Sun cluster = in_be32(&gur->tp_cluster[i].lower); 3096d2b9da1SYork Sun 310db9a8070SPrabhakar Kushwaha /* check that at least one core/accel is enabled in cluster */ 311db9a8070SPrabhakar Kushwaha for (j = 0; j < 4; j++) { 312db9a8070SPrabhakar Kushwaha u32 idx = (cluster >> (j*8)) & TP_CLUSTER_INIT_MASK; 313db9a8070SPrabhakar Kushwaha u32 type = in_be32(&gur->tp_ityp[idx]); 314db9a8070SPrabhakar Kushwaha 315db9a8070SPrabhakar Kushwaha if (type & TP_ITYP_AV) 316db9a8070SPrabhakar Kushwaha cluster_valid = 1; 317db9a8070SPrabhakar Kushwaha } 318db9a8070SPrabhakar Kushwaha 319db9a8070SPrabhakar Kushwaha if (cluster_valid) { 3206d2b9da1SYork Sun /* set stash ID to (cluster) * 2 + 32 + 1 */ 3216d2b9da1SYork Sun clrsetbits_be32(&l2cache->l2csr1, 0xff, 32 + i * 2 + 1); 3226d2b9da1SYork Sun 3236d2b9da1SYork Sun printf("enable l2 for cluster %d %p\n", i, l2cache); 3246d2b9da1SYork Sun 3256d2b9da1SYork Sun out_be32(&l2cache->l2csr0, L2CSR0_L2FI|L2CSR0_L2LFC); 326db9a8070SPrabhakar Kushwaha while ((in_be32(&l2cache->l2csr0) 327db9a8070SPrabhakar Kushwaha & (L2CSR0_L2FI|L2CSR0_L2LFC)) != 0) 3286d2b9da1SYork Sun ; 3299cd95ac7SJames Yang out_be32(&l2cache->l2csr0, L2CSR0_L2E|L2CSR0_L2PE|L2CSR0_L2REP_MODE); 330db9a8070SPrabhakar Kushwaha } 3316d2b9da1SYork Sun i++; 3326d2b9da1SYork Sun } while (!(cluster & TP_CLUSTER_EOC)); 3336d2b9da1SYork Sun 3346d2b9da1SYork Sun return 0; 3356d2b9da1SYork Sun } 3366d2b9da1SYork Sun #endif 3376d2b9da1SYork Sun 338a47a12beSStefan Roese /* 339a47a12beSStefan Roese * Initialize L2 as cache. 340a47a12beSStefan Roese * 341a47a12beSStefan Roese * The newer 8548, etc, parts have twice as much cache, but 342a47a12beSStefan Roese * use the same bit-encoding as the older 8555, etc, parts. 343a47a12beSStefan Roese * 344a47a12beSStefan Roese */ 345a47a12beSStefan Roese int cpu_init_r(void) 346a47a12beSStefan Roese { 347fbc20aabSTimur Tabi __maybe_unused u32 svr = get_svr(); 3483f0202edSLan Chunhe #ifdef CONFIG_SYS_LBC_LCRR 3496d2b9da1SYork Sun fsl_lbc_t *lbc = (void __iomem *)LBC_BASE_ADDR; 3506d2b9da1SYork Sun #endif 3516d2b9da1SYork Sun #ifdef CONFIG_L2_CACHE 3526d2b9da1SYork Sun ccsr_l2cache_t *l2cache = (void __iomem *)CONFIG_SYS_MPC85xx_L2_ADDR; 3536d2b9da1SYork Sun #elif defined(CONFIG_SYS_FSL_QORIQ_CHASSIS2) 3546d2b9da1SYork Sun struct ccsr_cluster_l2 * l2cache = (void __iomem *)CONFIG_SYS_FSL_CLUSTER_1_L2; 3553f0202edSLan Chunhe #endif 356afbfdf54SYork Sun #if defined(CONFIG_PPC_SPINTABLE_COMPATIBLE) && defined(CONFIG_MP) 3572a5fcb83SYork Sun extern int spin_table_compat; 3582a5fcb83SYork Sun const char *spin; 3592a5fcb83SYork Sun #endif 360*424bf942SShengzhou Liu #ifdef CONFIG_SYS_FSL_ERRATUM_SEC_A003571 361*424bf942SShengzhou Liu ccsr_sec_t __iomem *sec = (void *)CONFIG_SYS_FSL_SEC_ADDR; 362*424bf942SShengzhou Liu #endif 3635e23ab0aSYork Sun #if defined(CONFIG_SYS_P4080_ERRATUM_CPU22) || \ 3645e23ab0aSYork Sun defined(CONFIG_SYS_FSL_ERRATUM_NMG_CPU_A011) 3655e23ab0aSYork Sun /* 36657125f22SYork Sun * CPU22 and NMG_CPU_A011 share the same workaround. 3675e23ab0aSYork Sun * CPU22 applies to P4080 rev 1.0, 2.0, fixed in 3.0 3685e23ab0aSYork Sun * NMG_CPU_A011 applies to P4080 rev 1.0, 2.0, fixed in 3.0 36957125f22SYork Sun * also applies to P3041 rev 1.0, 1.1, P2041 rev 1.0, 1.1, both 37057125f22SYork Sun * fixed in 2.0. NMG_CPU_A011 is activated by default and can 37157125f22SYork Sun * be disabled by hwconfig with syntax: 37257125f22SYork Sun * 37357125f22SYork Sun * fsl_cpu_a011:disable 3745e23ab0aSYork Sun */ 37557125f22SYork Sun extern int enable_cpu_a011_workaround; 37657125f22SYork Sun #ifdef CONFIG_SYS_P4080_ERRATUM_CPU22 37757125f22SYork Sun enable_cpu_a011_workaround = (SVR_MAJ(svr) < 3); 37857125f22SYork Sun #else 37957125f22SYork Sun char buffer[HWCONFIG_BUFFER_SIZE]; 38057125f22SYork Sun char *buf = NULL; 38157125f22SYork Sun int n, res; 38257125f22SYork Sun 38357125f22SYork Sun n = getenv_f("hwconfig", buffer, sizeof(buffer)); 38457125f22SYork Sun if (n > 0) 38557125f22SYork Sun buf = buffer; 38657125f22SYork Sun 38757125f22SYork Sun res = hwconfig_arg_cmp_f("fsl_cpu_a011", "disable", buf); 38857125f22SYork Sun if (res > 0) 38957125f22SYork Sun enable_cpu_a011_workaround = 0; 39057125f22SYork Sun else { 39157125f22SYork Sun if (n >= HWCONFIG_BUFFER_SIZE) { 39257125f22SYork Sun printf("fsl_cpu_a011 was not found. hwconfig variable " 39357125f22SYork Sun "may be too long\n"); 39457125f22SYork Sun } 39557125f22SYork Sun enable_cpu_a011_workaround = 39657125f22SYork Sun (SVR_SOC_VER(svr) == SVR_P4080 && SVR_MAJ(svr) < 3) || 39757125f22SYork Sun (SVR_SOC_VER(svr) != SVR_P4080 && SVR_MAJ(svr) < 2); 39857125f22SYork Sun } 39957125f22SYork Sun #endif 40057125f22SYork Sun if (enable_cpu_a011_workaround) { 401fd3c9befSKumar Gala flush_dcache(); 402fd3c9befSKumar Gala mtspr(L1CSR2, (mfspr(L1CSR2) | L1CSR2_DCWS)); 403fd3c9befSKumar Gala sync(); 4041e9ea85fSYork Sun } 405fd3c9befSKumar Gala #endif 406d217a9adSYork Sun #ifdef CONFIG_SYS_FSL_ERRATUM_A005812 407d217a9adSYork Sun /* 408d217a9adSYork Sun * A-005812 workaround sets bit 32 of SPR 976 for SoCs running 409d217a9adSYork Sun * in write shadow mode. Checking DCWS before setting SPR 976. 410d217a9adSYork Sun */ 411d217a9adSYork Sun if (mfspr(L1CSR2) & L1CSR2_DCWS) 412d217a9adSYork Sun mtspr(SPRN_HDBCR0, (mfspr(SPRN_HDBCR0) | 0x80000000)); 413d217a9adSYork Sun #endif 414fd3c9befSKumar Gala 415afbfdf54SYork Sun #if defined(CONFIG_PPC_SPINTABLE_COMPATIBLE) && defined(CONFIG_MP) 4162a5fcb83SYork Sun spin = getenv("spin_table_compat"); 4172a5fcb83SYork Sun if (spin && (*spin == 'n')) 4182a5fcb83SYork Sun spin_table_compat = 0; 4192a5fcb83SYork Sun else 4202a5fcb83SYork Sun spin_table_compat = 1; 4212a5fcb83SYork Sun #endif 4222a5fcb83SYork Sun 423a47a12beSStefan Roese puts ("L2: "); 424a47a12beSStefan Roese 425a47a12beSStefan Roese #if defined(CONFIG_L2_CACHE) 426a47a12beSStefan Roese volatile uint cache_ctl; 427fbc20aabSTimur Tabi uint ver; 428a47a12beSStefan Roese u32 l2siz_field; 429a47a12beSStefan Roese 430a47a12beSStefan Roese ver = SVR_SOC_VER(svr); 431a47a12beSStefan Roese 432a47a12beSStefan Roese asm("msync;isync"); 433a47a12beSStefan Roese cache_ctl = l2cache->l2ctl; 434a47a12beSStefan Roese 435a47a12beSStefan Roese #if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L2_ADDR) 436a47a12beSStefan Roese if (cache_ctl & MPC85xx_L2CTL_L2E) { 437a47a12beSStefan Roese /* Clear L2 SRAM memory-mapped base address */ 438a47a12beSStefan Roese out_be32(&l2cache->l2srbar0, 0x0); 439a47a12beSStefan Roese out_be32(&l2cache->l2srbar1, 0x0); 440a47a12beSStefan Roese 441a47a12beSStefan Roese /* set MBECCDIS=0, SBECCDIS=0 */ 442a47a12beSStefan Roese clrbits_be32(&l2cache->l2errdis, 443a47a12beSStefan Roese (MPC85xx_L2ERRDIS_MBECC | 444a47a12beSStefan Roese MPC85xx_L2ERRDIS_SBECC)); 445a47a12beSStefan Roese 446a47a12beSStefan Roese /* set L2E=0, L2SRAM=0 */ 447a47a12beSStefan Roese clrbits_be32(&l2cache->l2ctl, 448a47a12beSStefan Roese (MPC85xx_L2CTL_L2E | 449a47a12beSStefan Roese MPC85xx_L2CTL_L2SRAM_ENTIRE)); 450a47a12beSStefan Roese } 451a47a12beSStefan Roese #endif 452a47a12beSStefan Roese 453a47a12beSStefan Roese l2siz_field = (cache_ctl >> 28) & 0x3; 454a47a12beSStefan Roese 455a47a12beSStefan Roese switch (l2siz_field) { 456a47a12beSStefan Roese case 0x0: 457a47a12beSStefan Roese printf(" unknown size (0x%08x)\n", cache_ctl); 458a47a12beSStefan Roese return -1; 459a47a12beSStefan Roese break; 460a47a12beSStefan Roese case 0x1: 461a47a12beSStefan Roese if (ver == SVR_8540 || ver == SVR_8560 || 46248f6a5c3SYork Sun ver == SVR_8541 || ver == SVR_8555) { 4636b44d9e5SShruti Kanetkar puts("128 KiB "); 4646b44d9e5SShruti Kanetkar /* set L2E=1, L2I=1, & L2BLKSZ=1 (128 KiBibyte) */ 465a47a12beSStefan Roese cache_ctl = 0xc4000000; 466a47a12beSStefan Roese } else { 4676b44d9e5SShruti Kanetkar puts("256 KiB "); 468a47a12beSStefan Roese cache_ctl = 0xc0000000; /* set L2E=1, L2I=1, & L2SRAM=0 */ 469a47a12beSStefan Roese } 470a47a12beSStefan Roese break; 471a47a12beSStefan Roese case 0x2: 472a47a12beSStefan Roese if (ver == SVR_8540 || ver == SVR_8560 || 47348f6a5c3SYork Sun ver == SVR_8541 || ver == SVR_8555) { 4746b44d9e5SShruti Kanetkar puts("256 KiB "); 4756b44d9e5SShruti Kanetkar /* set L2E=1, L2I=1, & L2BLKSZ=2 (256 KiBibyte) */ 476a47a12beSStefan Roese cache_ctl = 0xc8000000; 477a47a12beSStefan Roese } else { 4786b44d9e5SShruti Kanetkar puts("512 KiB "); 479a47a12beSStefan Roese /* set L2E=1, L2I=1, & L2SRAM=0 */ 480a47a12beSStefan Roese cache_ctl = 0xc0000000; 481a47a12beSStefan Roese } 482a47a12beSStefan Roese break; 483a47a12beSStefan Roese case 0x3: 4846b44d9e5SShruti Kanetkar puts("1024 KiB "); 485a47a12beSStefan Roese /* set L2E=1, L2I=1, & L2SRAM=0 */ 486a47a12beSStefan Roese cache_ctl = 0xc0000000; 487a47a12beSStefan Roese break; 488a47a12beSStefan Roese } 489a47a12beSStefan Roese 490a47a12beSStefan Roese if (l2cache->l2ctl & MPC85xx_L2CTL_L2E) { 491a47a12beSStefan Roese puts("already enabled"); 492888279b5SHaiying Wang #if defined(CONFIG_SYS_INIT_L2_ADDR) && defined(CONFIG_SYS_FLASH_BASE) 493e4c9a35dSKumar Gala u32 l2srbar = l2cache->l2srbar0; 494a47a12beSStefan Roese if (l2cache->l2ctl & MPC85xx_L2CTL_L2SRAM_ENTIRE 495a47a12beSStefan Roese && l2srbar >= CONFIG_SYS_FLASH_BASE) { 496a47a12beSStefan Roese l2srbar = CONFIG_SYS_INIT_L2_ADDR; 497a47a12beSStefan Roese l2cache->l2srbar0 = l2srbar; 4989a511bd6SScott Wood printf(", moving to 0x%08x", CONFIG_SYS_INIT_L2_ADDR); 499a47a12beSStefan Roese } 500a47a12beSStefan Roese #endif /* CONFIG_SYS_INIT_L2_ADDR */ 501a47a12beSStefan Roese puts("\n"); 502a47a12beSStefan Roese } else { 503a47a12beSStefan Roese asm("msync;isync"); 504a47a12beSStefan Roese l2cache->l2ctl = cache_ctl; /* invalidate & enable */ 505a47a12beSStefan Roese asm("msync;isync"); 506a47a12beSStefan Roese puts("enabled\n"); 507a47a12beSStefan Roese } 508a47a12beSStefan Roese #elif defined(CONFIG_BACKSIDE_L2_CACHE) 50948f6a5c3SYork Sun if (SVR_SOC_VER(svr) == SVR_P2040) { 510acf3f8daSKumar Gala puts("N/A\n"); 511acf3f8daSKumar Gala goto skip_l2; 512acf3f8daSKumar Gala } 513acf3f8daSKumar Gala 514a47a12beSStefan Roese u32 l2cfg0 = mfspr(SPRN_L2CFG0); 515a47a12beSStefan Roese 516a47a12beSStefan Roese /* invalidate the L2 cache */ 517a47a12beSStefan Roese mtspr(SPRN_L2CSR0, (L2CSR0_L2FI|L2CSR0_L2LFC)); 518a47a12beSStefan Roese while (mfspr(SPRN_L2CSR0) & (L2CSR0_L2FI|L2CSR0_L2LFC)) 519a47a12beSStefan Roese ; 520a47a12beSStefan Roese 521a47a12beSStefan Roese #ifdef CONFIG_SYS_CACHE_STASHING 522a47a12beSStefan Roese /* set stash id to (coreID) * 2 + 32 + L2 (1) */ 523a47a12beSStefan Roese mtspr(SPRN_L2CSR1, (32 + 1)); 524a47a12beSStefan Roese #endif 525a47a12beSStefan Roese 526a47a12beSStefan Roese /* enable the cache */ 527a47a12beSStefan Roese mtspr(SPRN_L2CSR0, CONFIG_SYS_INIT_L2CSR0); 528a47a12beSStefan Roese 529a47a12beSStefan Roese if (CONFIG_SYS_INIT_L2CSR0 & L2CSR0_L2E) { 530a47a12beSStefan Roese while (!(mfspr(SPRN_L2CSR0) & L2CSR0_L2E)) 531a47a12beSStefan Roese ; 5322f848f97SShruti Kanetkar print_size((l2cfg0 & 0x3fff) * 64 * 1024, " enabled\n"); 533a47a12beSStefan Roese } 534acf3f8daSKumar Gala 535acf3f8daSKumar Gala skip_l2: 5366d2b9da1SYork Sun #elif defined(CONFIG_SYS_FSL_QORIQ_CHASSIS2) 5376d2b9da1SYork Sun if (l2cache->l2csr0 & L2CSR0_L2E) 5382f848f97SShruti Kanetkar print_size((l2cache->l2cfg0 & 0x3fff) * 64 * 1024, 5392f848f97SShruti Kanetkar " enabled\n"); 5406d2b9da1SYork Sun 5416d2b9da1SYork Sun enable_cluster_l2(); 542a47a12beSStefan Roese #else 543a47a12beSStefan Roese puts("disabled\n"); 544a47a12beSStefan Roese #endif 5456aba33e9SKumar Gala 5466aba33e9SKumar Gala enable_cpc(); 5476aba33e9SKumar Gala 548cb93071bSYork Sun #ifndef CONFIG_SYS_FSL_NO_SERDES 549af025065SKumar Gala /* needs to be in ram since code uses global static vars */ 550af025065SKumar Gala fsl_serdes_init(); 551cb93071bSYork Sun #endif 552af025065SKumar Gala 553*424bf942SShengzhou Liu #ifdef CONFIG_SYS_FSL_ERRATUM_SEC_A003571 554*424bf942SShengzhou Liu #define MCFGR_AXIPIPE 0x000000f0 555*424bf942SShengzhou Liu if (IS_SVR_REV(svr, 1, 0)) 556*424bf942SShengzhou Liu clrbits_be32(&sec->mcfgr, MCFGR_AXIPIPE); 557*424bf942SShengzhou Liu #endif 558*424bf942SShengzhou Liu 55972bd83cdSShengzhou Liu #ifdef CONFIG_SYS_FSL_ERRATUM_A005871 56072bd83cdSShengzhou Liu if (IS_SVR_REV(svr, 1, 0)) { 56172bd83cdSShengzhou Liu int i; 56272bd83cdSShengzhou Liu __be32 *p = (void __iomem *)CONFIG_SYS_DCSRBAR + 0xb004c; 56372bd83cdSShengzhou Liu 56472bd83cdSShengzhou Liu for (i = 0; i < 12; i++) { 56572bd83cdSShengzhou Liu p += i + (i > 5 ? 11 : 0); 56672bd83cdSShengzhou Liu out_be32(p, 0x2); 56772bd83cdSShengzhou Liu } 56872bd83cdSShengzhou Liu p = (void __iomem *)CONFIG_SYS_DCSRBAR + 0xb0108; 56972bd83cdSShengzhou Liu out_be32(p, 0x34); 57072bd83cdSShengzhou Liu } 57172bd83cdSShengzhou Liu #endif 57272bd83cdSShengzhou Liu 573a09b9b68SKumar Gala #ifdef CONFIG_SYS_SRIO 574a09b9b68SKumar Gala srio_init(); 575c8b28152SLiu Gang #ifdef CONFIG_SRIO_PCIE_BOOT_MASTER 576ff65f126SLiu Gang char *s = getenv("bootmaster"); 577ff65f126SLiu Gang if (s) { 578ff65f126SLiu Gang if (!strcmp(s, "SRIO1")) { 579ff65f126SLiu Gang srio_boot_master(1); 580ff65f126SLiu Gang srio_boot_master_release_slave(1); 581ff65f126SLiu Gang } 582ff65f126SLiu Gang if (!strcmp(s, "SRIO2")) { 583ff65f126SLiu Gang srio_boot_master(2); 584ff65f126SLiu Gang srio_boot_master_release_slave(2); 585ff65f126SLiu Gang } 586ff65f126SLiu Gang } 5875ffa88ecSLiu Gang #endif 588a09b9b68SKumar Gala #endif 589a09b9b68SKumar Gala 590a47a12beSStefan Roese #if defined(CONFIG_MP) 591a47a12beSStefan Roese setup_mp(); 592a47a12beSStefan Roese #endif 5933f0202edSLan Chunhe 5944e0be34aSZang Roy-R61911 #ifdef CONFIG_SYS_FSL_ERRATUM_ESDHC13 595ae026ffdSRoy Zang { 5964e0be34aSZang Roy-R61911 if (SVR_MAJ(svr) < 3) { 597ae026ffdSRoy Zang void *p; 598ae026ffdSRoy Zang p = (void *)CONFIG_SYS_DCSRBAR + 0x20520; 599ae026ffdSRoy Zang setbits_be32(p, 1 << (31 - 14)); 600ae026ffdSRoy Zang } 6014e0be34aSZang Roy-R61911 } 602ae026ffdSRoy Zang #endif 603ae026ffdSRoy Zang 6043f0202edSLan Chunhe #ifdef CONFIG_SYS_LBC_LCRR 6053f0202edSLan Chunhe /* 6063f0202edSLan Chunhe * Modify the CLKDIV field of LCRR register to improve the writing 6073f0202edSLan Chunhe * speed for NOR flash. 6083f0202edSLan Chunhe */ 6093f0202edSLan Chunhe clrsetbits_be32(&lbc->lcrr, LCRR_CLKDIV, CONFIG_SYS_LBC_LCRR); 6103f0202edSLan Chunhe __raw_readl(&lbc->lcrr); 6113f0202edSLan Chunhe isync(); 6122b3a1cddSKumar Gala #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_LBC103 6132b3a1cddSKumar Gala udelay(100); 6142b3a1cddSKumar Gala #endif 6153f0202edSLan Chunhe #endif 6163f0202edSLan Chunhe 61786221f09SRoy Zang #ifdef CONFIG_SYS_FSL_USB1_PHY_ENABLE 61886221f09SRoy Zang { 6199dee205dSramneek mehresh struct ccsr_usb_phy __iomem *usb_phy1 = 62086221f09SRoy Zang (void *)CONFIG_SYS_MPC85xx_USB1_PHY_ADDR; 62186221f09SRoy Zang out_be32(&usb_phy1->usb_enable_override, 62286221f09SRoy Zang CONFIG_SYS_FSL_USB_ENABLE_OVERRIDE); 62386221f09SRoy Zang } 62486221f09SRoy Zang #endif 62586221f09SRoy Zang #ifdef CONFIG_SYS_FSL_USB2_PHY_ENABLE 62686221f09SRoy Zang { 6279dee205dSramneek mehresh struct ccsr_usb_phy __iomem *usb_phy2 = 62886221f09SRoy Zang (void *)CONFIG_SYS_MPC85xx_USB2_PHY_ADDR; 62986221f09SRoy Zang out_be32(&usb_phy2->usb_enable_override, 63086221f09SRoy Zang CONFIG_SYS_FSL_USB_ENABLE_OVERRIDE); 63186221f09SRoy Zang } 63286221f09SRoy Zang #endif 63386221f09SRoy Zang 63499d7b0a4SXulei #ifdef CONFIG_SYS_FSL_ERRATUM_USB14 63599d7b0a4SXulei /* On P204x/P304x/P50x0 Rev1.0, USB transmit will result internal 63699d7b0a4SXulei * multi-bit ECC errors which has impact on performance, so software 63799d7b0a4SXulei * should disable all ECC reporting from USB1 and USB2. 63899d7b0a4SXulei */ 63999d7b0a4SXulei if (IS_SVR_REV(get_svr(), 1, 0)) { 64099d7b0a4SXulei struct dcsr_dcfg_regs *dcfg = (struct dcsr_dcfg_regs *) 64199d7b0a4SXulei (CONFIG_SYS_DCSRBAR + CONFIG_SYS_DCSR_DCFG_OFFSET); 64299d7b0a4SXulei setbits_be32(&dcfg->ecccr1, 64399d7b0a4SXulei (DCSR_DCFG_ECC_DISABLE_USB1 | 64499d7b0a4SXulei DCSR_DCFG_ECC_DISABLE_USB2)); 64599d7b0a4SXulei } 64699d7b0a4SXulei #endif 64799d7b0a4SXulei 6483fa75c87SRoy Zang #if defined(CONFIG_SYS_FSL_USB_DUAL_PHY_ENABLE) 6499dee205dSramneek mehresh struct ccsr_usb_phy __iomem *usb_phy = 6503fa75c87SRoy Zang (void *)CONFIG_SYS_MPC85xx_USB1_PHY_ADDR; 6513fa75c87SRoy Zang setbits_be32(&usb_phy->pllprg[1], 6523fa75c87SRoy Zang CONFIG_SYS_FSL_USB_PLLPRG2_PHY2_CLK_EN | 6533fa75c87SRoy Zang CONFIG_SYS_FSL_USB_PLLPRG2_PHY1_CLK_EN | 6543fa75c87SRoy Zang CONFIG_SYS_FSL_USB_PLLPRG2_MFI | 6553fa75c87SRoy Zang CONFIG_SYS_FSL_USB_PLLPRG2_PLL_EN); 6563fa75c87SRoy Zang setbits_be32(&usb_phy->port1.ctrl, 6573fa75c87SRoy Zang CONFIG_SYS_FSL_USB_CTRL_PHY_EN); 6583fa75c87SRoy Zang setbits_be32(&usb_phy->port1.drvvbuscfg, 6593fa75c87SRoy Zang CONFIG_SYS_FSL_USB_DRVVBUS_CR_EN); 6603fa75c87SRoy Zang setbits_be32(&usb_phy->port1.pwrfltcfg, 6613fa75c87SRoy Zang CONFIG_SYS_FSL_USB_PWRFLT_CR_EN); 6623fa75c87SRoy Zang setbits_be32(&usb_phy->port2.ctrl, 6633fa75c87SRoy Zang CONFIG_SYS_FSL_USB_CTRL_PHY_EN); 6643fa75c87SRoy Zang setbits_be32(&usb_phy->port2.drvvbuscfg, 6653fa75c87SRoy Zang CONFIG_SYS_FSL_USB_DRVVBUS_CR_EN); 6663fa75c87SRoy Zang setbits_be32(&usb_phy->port2.pwrfltcfg, 6673fa75c87SRoy Zang CONFIG_SYS_FSL_USB_PWRFLT_CR_EN); 6683fa75c87SRoy Zang #endif 6693fa75c87SRoy Zang 670c916d7c9SKumar Gala #ifdef CONFIG_FMAN_ENET 671c916d7c9SKumar Gala fman_enet_init(); 672c916d7c9SKumar Gala #endif 673c916d7c9SKumar Gala 674fbc20aabSTimur Tabi #if defined(CONFIG_FSL_SATA_V2) && defined(CONFIG_FSL_SATA_ERRATUM_A001) 675fbc20aabSTimur Tabi /* 676fbc20aabSTimur Tabi * For P1022/1013 Rev1.0 silicon, after power on SATA host 677fbc20aabSTimur Tabi * controller is configured in legacy mode instead of the 678fbc20aabSTimur Tabi * expected enterprise mode. Software needs to clear bit[28] 679fbc20aabSTimur Tabi * of HControl register to change to enterprise mode from 680fbc20aabSTimur Tabi * legacy mode. We assume that the controller is offline. 681fbc20aabSTimur Tabi */ 682fbc20aabSTimur Tabi if (IS_SVR_REV(svr, 1, 0) && 683fbc20aabSTimur Tabi ((SVR_SOC_VER(svr) == SVR_P1022) || 68448f6a5c3SYork Sun (SVR_SOC_VER(svr) == SVR_P1013))) { 685fbc20aabSTimur Tabi fsl_sata_reg_t *reg; 686fbc20aabSTimur Tabi 687fbc20aabSTimur Tabi /* first SATA controller */ 688fbc20aabSTimur Tabi reg = (void *)CONFIG_SYS_MPC85xx_SATA1_ADDR; 689fbc20aabSTimur Tabi clrbits_le32(®->hcontrol, HCONTROL_ENTERPRISE_EN); 690fbc20aabSTimur Tabi 691fbc20aabSTimur Tabi /* second SATA controller */ 692fbc20aabSTimur Tabi reg = (void *)CONFIG_SYS_MPC85xx_SATA2_ADDR; 693fbc20aabSTimur Tabi clrbits_le32(®->hcontrol, HCONTROL_ENTERPRISE_EN); 694fbc20aabSTimur Tabi } 695fbc20aabSTimur Tabi #endif 696fbc20aabSTimur Tabi 697fbc20aabSTimur Tabi 698a47a12beSStefan Roese return 0; 699a47a12beSStefan Roese } 700a47a12beSStefan Roese 701a47a12beSStefan Roese extern void setup_ivors(void); 702a47a12beSStefan Roese 703a47a12beSStefan Roese void arch_preboot_os(void) 704a47a12beSStefan Roese { 705a47a12beSStefan Roese u32 msr; 706a47a12beSStefan Roese 707a47a12beSStefan Roese /* 708a47a12beSStefan Roese * We are changing interrupt offsets and are about to boot the OS so 709a47a12beSStefan Roese * we need to make sure we disable all async interrupts. EE is already 710a47a12beSStefan Roese * disabled by the time we get called. 711a47a12beSStefan Roese */ 712a47a12beSStefan Roese msr = mfmsr(); 7135344f7a2SPrabhakar Kushwaha msr &= ~(MSR_ME|MSR_CE); 714a47a12beSStefan Roese mtmsr(msr); 715a47a12beSStefan Roese 716a47a12beSStefan Roese setup_ivors(); 717a47a12beSStefan Roese } 718f54fe87aSKumar Gala 719f54fe87aSKumar Gala #if defined(CONFIG_CMD_SATA) && defined(CONFIG_FSL_SATA) 720f54fe87aSKumar Gala int sata_initialize(void) 721f54fe87aSKumar Gala { 722f54fe87aSKumar Gala if (is_serdes_configured(SATA1) || is_serdes_configured(SATA2)) 723f54fe87aSKumar Gala return __sata_initialize(); 724f54fe87aSKumar Gala 725f54fe87aSKumar Gala return 1; 726f54fe87aSKumar Gala } 727f54fe87aSKumar Gala #endif 728f9a33f1cSKumar Gala 729f9a33f1cSKumar Gala void cpu_secondary_init_r(void) 730f9a33f1cSKumar Gala { 731f9a33f1cSKumar Gala #ifdef CONFIG_QE 732f9a33f1cSKumar Gala uint qe_base = CONFIG_SYS_IMMR + 0x00080000; /* QE immr base */ 733f2717b47STimur Tabi #ifdef CONFIG_SYS_QE_FMAN_FW_IN_NAND 734a7b1e1b7SHaiying Wang int ret; 735f2717b47STimur Tabi size_t fw_length = CONFIG_SYS_QE_FMAN_FW_LENGTH; 736a7b1e1b7SHaiying Wang 737a7b1e1b7SHaiying Wang /* load QE firmware from NAND flash to DDR first */ 738f2717b47STimur Tabi ret = nand_read(&nand_info[0], (loff_t)CONFIG_SYS_QE_FMAN_FW_IN_NAND, 739f2717b47STimur Tabi &fw_length, (u_char *)CONFIG_SYS_QE_FMAN_FW_ADDR); 740a7b1e1b7SHaiying Wang 741a7b1e1b7SHaiying Wang if (ret && ret == -EUCLEAN) { 742a7b1e1b7SHaiying Wang printf ("NAND read for QE firmware at offset %x failed %d\n", 743f2717b47STimur Tabi CONFIG_SYS_QE_FMAN_FW_IN_NAND, ret); 744a7b1e1b7SHaiying Wang } 745a7b1e1b7SHaiying Wang #endif 746f9a33f1cSKumar Gala qe_init(qe_base); 747f9a33f1cSKumar Gala qe_reset(); 748f9a33f1cSKumar Gala #endif 749f9a33f1cSKumar Gala } 750