/* Initialize board. */ static void board_init(void) { init_pmu(); init_timers(); init_interrupts(); init_trng(); init_runlevel(PERMISSION_MEDIUM); /* TODO(crosbug.com/p/49959): For now, leave flash WP unlocked */ GREG32(RBOX, EC_WP_L) = 1; /* Indication that firmware is running, for debug purposes. */ GREG32(PMU, PWRDN_SCRATCH16) = 0xCAFECAFE; }
void ifx_atm_init_chip(void) { init_pmu(); reset_ppe(); init_pdma(); init_mailbox(); init_atm_tc(); clear_share_buffer(); }
static int em_setup(void) { /* * Send SCU PMU interrupts to the "owner" CPU. */ em_route_irq(IRQ_EB11MP_PMU_SCU0, 0); em_route_irq(IRQ_EB11MP_PMU_SCU1, 0); em_route_irq(IRQ_EB11MP_PMU_SCU2, 1); em_route_irq(IRQ_EB11MP_PMU_SCU3, 1); em_route_irq(IRQ_EB11MP_PMU_SCU4, 2); em_route_irq(IRQ_EB11MP_PMU_SCU5, 2); em_route_irq(IRQ_EB11MP_PMU_SCU6, 3); em_route_irq(IRQ_EB11MP_PMU_SCU7, 3); return init_pmu(); }
static int gator_event_sampling_start(void) { int cnt; event_based_sampling = false; for (cnt = CCNT; cnt < CNTMAX; cnt++) { if (pmnc_count[cnt] > 0) { event_based_sampling = true; break; } } #if LINUX_PMU_SUPPORT pmu_device = reserve_pmu(ARM_PMU_DEVICE_CPU); if (IS_ERR(pmu_device) && (unsigned int)pmu_device != -ENODEV) { pr_err("gator: unable to reserve the pmu\n"); return -1; } if (event_based_sampling) { int irq, i; if (IS_ERR(pmu_device)) { pr_err("gator: event based sampling is not supported as the kernel function reserve_pmu() failed\n"); return -1; } // init_pmu sets the irq affinity, therefore we do not care if it fails for single core if (init_pmu(ARM_PMU_DEVICE_CPU) != 0 && gator_cpu_cores > 1) { pr_err("gator: unable to initialize the pmu\n"); goto out_ebs_start; } if (pmu_device->num_resources == 0) { pr_err("gator: no irqs for PMUs defined\n"); goto out_ebs_start; } for (i = 0; i < pmu_device->num_resources; ++i) { irq = platform_get_irq(pmu_device, i); if (irq < 0) continue; if (request_irq(irq, armv7_pmnc_interrupt, IRQF_DISABLED | IRQF_NOBALANCING, "armpmu", NULL)) { pr_err("gator: unable to request IRQ%d for ARM perf counters\n", irq); // clean up and exit for (i = i - 1; i >= 0; --i) { irq = platform_get_irq(pmu_device, i); if (irq >= 0) free_irq(irq, NULL); } goto out_ebs_start; } } } #else if (event_based_sampling) { pr_err("gator: event based sampling only supported in kernel versions 2.6.35 and higher and CONFIG_CPU_HAS_PMU=y\n"); return -1; } #endif return 0; #if LINUX_PMU_SUPPORT out_ebs_start: #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) release_pmu(pmu_device); #else release_pmu(ARM_PMU_DEVICE_CPU); #endif pmu_device = NULL; return -1; #endif }