static void erratum_a009929(void) { #ifdef CONFIG_SYS_FSL_ERRATUM_A009929 struct ccsr_gur *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR; u32 __iomem *dcsr_cop_ccp = (void *)CONFIG_SYS_DCSR_COP_CCP_ADDR; u32 rstrqmr1 = gur_in32(&gur->rstrqmr1); rstrqmr1 |= 0x00000400; gur_out32(&gur->rstrqmr1, rstrqmr1); writel(0x01000000, dcsr_cop_ccp); #endif }
int fsl_layerscape_wake_seconday_cores(void) { struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); #ifdef CONFIG_FSL_LSCH3 struct ccsr_reset __iomem *rst = (void *)(CONFIG_SYS_FSL_RST_ADDR); #elif defined(CONFIG_FSL_LSCH2) struct ccsr_scfg __iomem *scfg = (void *)(CONFIG_SYS_FSL_SCFG_ADDR); #endif u32 cores, cpu_up_mask = 1; int i, timeout = 10; u64 *table = get_spin_tbl_addr(); #ifdef COUNTER_FREQUENCY_REAL /* update for secondary cores */ __real_cntfrq = COUNTER_FREQUENCY_REAL; flush_dcache_range((unsigned long)&__real_cntfrq, (unsigned long)&__real_cntfrq + 8); #endif cores = cpu_mask(); /* Clear spin table so that secondary processors * observe the correct value after waking up from wfe. */ memset(table, 0, CONFIG_MAX_CPUS*SPIN_TABLE_ELEM_SIZE); flush_dcache_range((unsigned long)table, (unsigned long)table + (CONFIG_MAX_CPUS*SPIN_TABLE_ELEM_SIZE)); printf("Waking secondary cores to start from %lx\n", gd->relocaddr); #ifdef CONFIG_FSL_LSCH3 gur_out32(&gur->bootlocptrh, (u32)(gd->relocaddr >> 32)); gur_out32(&gur->bootlocptrl, (u32)gd->relocaddr); gur_out32(&gur->scratchrw[6], 1); asm volatile("dsb st" : : : "memory"); rst->brrl = cores; asm volatile("dsb st" : : : "memory"); #elif defined(CONFIG_FSL_LSCH2) scfg_out32(&scfg->scratchrw[0], (u32)(gd->relocaddr >> 32)); scfg_out32(&scfg->scratchrw[1], (u32)gd->relocaddr); asm volatile("dsb st" : : : "memory"); gur_out32(&gur->brrl, cores); asm volatile("dsb st" : : : "memory"); /* Bootup online cores */ scfg_out32(&scfg->corebcr, cores); #endif /* This is needed as a precautionary measure. * If some code before this has accidentally released the secondary * cores then the pre-bootloader code will trap them in a "wfe" unless * the scratchrw[6] is set. In this case we need a sev here to get these * cores moving again. */ asm volatile("sev"); while (timeout--) { flush_dcache_range((unsigned long)table, (unsigned long)table + CONFIG_MAX_CPUS * 64); for (i = 1; i < CONFIG_MAX_CPUS; i++) { if (table[i * WORDS_PER_SPIN_TABLE_ENTRY + SPIN_TABLE_ELEM_STATUS_IDX]) cpu_up_mask |= 1 << i; } if (hweight32(cpu_up_mask) == hweight32(cores)) break; udelay(10); } if (timeout <= 0) { printf("Not all cores (0x%x) are up (0x%x)\n", cores, cpu_up_mask); return 1; } printf("All (%d) cores are up.\n", hweight32(cores)); return 0; }