Lines Matching refs:drvdata
115 static void debug_os_unlock(struct debug_drvdata *drvdata) in debug_os_unlock() argument
118 writel_relaxed(0x0, drvdata->base + EDOSLAR); in debug_os_unlock()
135 static bool debug_access_permitted(struct debug_drvdata *drvdata) in debug_access_permitted() argument
138 if (!(drvdata->edprsr & EDPRSR_PU)) in debug_access_permitted()
142 if (drvdata->edprsr & EDPRSR_DLK) in debug_access_permitted()
148 static void debug_force_cpu_powered_up(struct debug_drvdata *drvdata) in debug_force_cpu_powered_up() argument
160 edprcr = readl_relaxed(drvdata->base + EDPRCR); in debug_force_cpu_powered_up()
162 writel_relaxed(edprcr, drvdata->base + EDPRCR); in debug_force_cpu_powered_up()
165 if (readx_poll_timeout_atomic(readl_relaxed, drvdata->base + EDPRSR, in debug_force_cpu_powered_up()
166 drvdata->edprsr, (drvdata->edprsr & EDPRSR_PU), in debug_force_cpu_powered_up()
174 dev_err(drvdata->dev, "%s: power up request for CPU%d failed\n", in debug_force_cpu_powered_up()
175 __func__, drvdata->cpu); in debug_force_cpu_powered_up()
183 edprcr = readl_relaxed(drvdata->base + EDPRCR); in debug_force_cpu_powered_up()
185 writel_relaxed(edprcr, drvdata->base + EDPRCR); in debug_force_cpu_powered_up()
187 drvdata->edprsr = readl_relaxed(drvdata->base + EDPRSR); in debug_force_cpu_powered_up()
190 if (unlikely(!(drvdata->edprsr & EDPRSR_PU))) in debug_force_cpu_powered_up()
194 static void debug_read_regs(struct debug_drvdata *drvdata) in debug_read_regs() argument
198 CS_UNLOCK(drvdata->base); in debug_read_regs()
201 debug_os_unlock(drvdata); in debug_read_regs()
204 save_edprcr = readl_relaxed(drvdata->base + EDPRCR); in debug_read_regs()
210 debug_force_cpu_powered_up(drvdata); in debug_read_regs()
212 if (!debug_access_permitted(drvdata)) in debug_read_regs()
215 drvdata->edpcsr = readl_relaxed(drvdata->base + EDPCSR); in debug_read_regs()
224 if (drvdata->edpcsr == EDPCSR_PROHIBITED) in debug_read_regs()
233 drvdata->edpcsr_hi = readl_relaxed(drvdata->base + EDPCSR_HI); in debug_read_regs()
235 if (drvdata->edcidsr_present) in debug_read_regs()
236 drvdata->edcidsr = readl_relaxed(drvdata->base + EDCIDSR); in debug_read_regs()
238 if (drvdata->edvidsr_present) in debug_read_regs()
239 drvdata->edvidsr = readl_relaxed(drvdata->base + EDVIDSR); in debug_read_regs()
243 writel_relaxed(save_edprcr, drvdata->base + EDPRCR); in debug_read_regs()
245 CS_LOCK(drvdata->base); in debug_read_regs()
249 static unsigned long debug_adjust_pc(struct debug_drvdata *drvdata) in debug_adjust_pc() argument
251 return (unsigned long)drvdata->edpcsr_hi << 32 | in debug_adjust_pc()
252 (unsigned long)drvdata->edpcsr; in debug_adjust_pc()
255 static unsigned long debug_adjust_pc(struct debug_drvdata *drvdata) in debug_adjust_pc() argument
260 pc = (unsigned long)drvdata->edpcsr; in debug_adjust_pc()
262 if (drvdata->pc_has_offset) { in debug_adjust_pc()
280 dev_emerg(drvdata->dev, in debug_adjust_pc()
289 static void debug_dump_regs(struct debug_drvdata *drvdata) in debug_dump_regs() argument
291 struct device *dev = drvdata->dev; in debug_dump_regs()
295 drvdata->edprsr, in debug_dump_regs()
296 drvdata->edprsr & EDPRSR_PU ? "On" : "Off", in debug_dump_regs()
297 drvdata->edprsr & EDPRSR_DLK ? "Lock" : "Unlock"); in debug_dump_regs()
299 if (!debug_access_permitted(drvdata)) { in debug_dump_regs()
304 if (drvdata->edpcsr == EDPCSR_PROHIBITED) { in debug_dump_regs()
309 pc = debug_adjust_pc(drvdata); in debug_dump_regs()
312 if (drvdata->edcidsr_present) in debug_dump_regs()
313 dev_emerg(dev, " EDCIDSR: %08x\n", drvdata->edcidsr); in debug_dump_regs()
315 if (drvdata->edvidsr_present) in debug_dump_regs()
317 drvdata->edvidsr, in debug_dump_regs()
318 drvdata->edvidsr & EDVIDSR_NS ? in debug_dump_regs()
320 drvdata->edvidsr & EDVIDSR_E3 ? "EL3" : in debug_dump_regs()
321 (drvdata->edvidsr & EDVIDSR_E2 ? in debug_dump_regs()
323 drvdata->edvidsr & EDVIDSR_HV ? 64 : 32, in debug_dump_regs()
324 drvdata->edvidsr & (u32)EDVIDSR_VMID); in debug_dump_regs()
329 struct debug_drvdata *drvdata = info; in debug_init_arch_data() local
333 CS_UNLOCK(drvdata->base); in debug_init_arch_data()
336 eddevid = readl_relaxed(drvdata->base + EDDEVID); in debug_init_arch_data()
337 eddevid1 = readl_relaxed(drvdata->base + EDDEVID1); in debug_init_arch_data()
339 CS_LOCK(drvdata->base); in debug_init_arch_data()
345 drvdata->edpcsr_present = false; in debug_init_arch_data()
346 drvdata->edcidsr_present = false; in debug_init_arch_data()
347 drvdata->edvidsr_present = false; in debug_init_arch_data()
348 drvdata->pc_has_offset = false; in debug_init_arch_data()
352 drvdata->edvidsr_present = true; in debug_init_arch_data()
355 drvdata->edcidsr_present = true; in debug_init_arch_data()
365 drvdata->edpcsr_present = in debug_init_arch_data()
369 drvdata->pc_has_offset = in debug_init_arch_data()
384 struct debug_drvdata *drvdata; in debug_notifier_call() local
396 drvdata = per_cpu(debug_drvdata, cpu); in debug_notifier_call()
397 if (!drvdata) in debug_notifier_call()
400 dev_emerg(drvdata->dev, "CPU[%d]:\n", drvdata->cpu); in debug_notifier_call()
402 debug_read_regs(drvdata); in debug_notifier_call()
403 debug_dump_regs(drvdata); in debug_notifier_call()
417 struct debug_drvdata *drvdata; in debug_enable_func() local
428 drvdata = per_cpu(debug_drvdata, cpu); in debug_enable_func()
429 if (!drvdata) in debug_enable_func()
432 ret = pm_runtime_get_sync(drvdata->dev); in debug_enable_func()
447 drvdata = per_cpu(debug_drvdata, cpu); in debug_enable_func()
448 pm_runtime_put_noidle(drvdata->dev); in debug_enable_func()
456 struct debug_drvdata *drvdata; in debug_disable_func() local
465 drvdata = per_cpu(debug_drvdata, cpu); in debug_disable_func()
466 if (!drvdata) in debug_disable_func()
469 ret = pm_runtime_put(drvdata->dev); in debug_disable_func()
565 struct debug_drvdata *drvdata = dev_get_drvdata(dev); in __debug_probe() local
569 drvdata->cpu = coresight_get_cpu(dev); in __debug_probe()
570 if (drvdata->cpu < 0) in __debug_probe()
571 return drvdata->cpu; in __debug_probe()
573 if (per_cpu(debug_drvdata, drvdata->cpu)) { in __debug_probe()
575 drvdata->cpu); in __debug_probe()
579 drvdata->dev = dev; in __debug_probe()
584 drvdata->base = base; in __debug_probe()
587 per_cpu(debug_drvdata, drvdata->cpu) = drvdata; in __debug_probe()
588 ret = smp_call_function_single(drvdata->cpu, debug_init_arch_data, in __debug_probe()
589 drvdata, 1); in __debug_probe()
593 dev_err(dev, "CPU%d debug arch init failed\n", drvdata->cpu); in __debug_probe()
597 if (!drvdata->edpcsr_present) { in __debug_probe()
599 drvdata->cpu); in __debug_probe()
616 dev_info(dev, "Coresight debug-CPU%d initialized\n", drvdata->cpu); in __debug_probe()
622 per_cpu(debug_drvdata, drvdata->cpu) = NULL; in __debug_probe()
628 struct debug_drvdata *drvdata; in debug_probe() local
630 drvdata = devm_kzalloc(&adev->dev, sizeof(*drvdata), GFP_KERNEL); in debug_probe()
631 if (!drvdata) in debug_probe()
634 amba_set_drvdata(adev, drvdata); in debug_probe()
640 struct debug_drvdata *drvdata = dev_get_drvdata(dev); in __debug_remove() local
642 per_cpu(debug_drvdata, drvdata->cpu) = NULL; in __debug_remove()
693 struct debug_drvdata *drvdata; in debug_platform_probe() local
696 drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); in debug_platform_probe()
697 if (!drvdata) in debug_platform_probe()
700 drvdata->pclk = coresight_get_enable_apb_pclk(&pdev->dev); in debug_platform_probe()
701 if (IS_ERR(drvdata->pclk)) in debug_platform_probe()
704 dev_set_drvdata(&pdev->dev, drvdata); in debug_platform_probe()
713 if (!IS_ERR_OR_NULL(drvdata->pclk)) in debug_platform_probe()
714 clk_put(drvdata->pclk); in debug_platform_probe()
721 struct debug_drvdata *drvdata = dev_get_drvdata(&pdev->dev); in debug_platform_remove() local
723 if (WARN_ON(!drvdata)) in debug_platform_remove()
728 if (!IS_ERR_OR_NULL(drvdata->pclk)) in debug_platform_remove()
729 clk_put(drvdata->pclk); in debug_platform_remove()
743 struct debug_drvdata *drvdata = dev_get_drvdata(dev); in debug_runtime_suspend() local
745 if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk)) in debug_runtime_suspend()
746 clk_disable_unprepare(drvdata->pclk); in debug_runtime_suspend()
752 struct debug_drvdata *drvdata = dev_get_drvdata(dev); in debug_runtime_resume() local
754 if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk)) in debug_runtime_resume()
755 clk_prepare_enable(drvdata->pclk); in debug_runtime_resume()