3 * (C) COPYRIGHT 2014-2015 ARM Limited. All rights reserved.
5 * This program is free software and is provided to you under the terms of the
6 * GNU General Public License version 2 as published by the Free Software
7 * Foundation, and any use by you of this program is subject to the terms
10 * A copy of the licence is included with the program, and can also be obtained
11 * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12 * Boston, MA 02110-1301, USA.
20 * Register-based HW access backend APIs
22 #include <mali_kbase.h>
23 #include <mali_kbase_hwaccess_jm.h>
24 #include <mali_kbase_hwaccess_backend.h>
25 #include <backend/gpu/mali_kbase_irq_internal.h>
26 #include <backend/gpu/mali_kbase_jm_internal.h>
27 #include <backend/gpu/mali_kbase_js_internal.h>
28 #include <backend/gpu/mali_kbase_pm_internal.h>
30 int kbase_backend_early_init(struct kbase_device *kbdev)
34 err = kbasep_platform_device_init(kbdev);
38 /* Ensure we can access the GPU registers */
39 kbase_pm_register_access_enable(kbdev);
41 /* Find out GPU properties based on the GPU feature registers */
42 kbase_gpuprops_set(kbdev);
44 /* We're done accessing the GPU registers for now. */
45 kbase_pm_register_access_disable(kbdev);
47 err = kbase_hwaccess_pm_init(kbdev);
51 err = kbase_install_interrupts(kbdev);
58 kbase_hwaccess_pm_term(kbdev);
60 kbasep_platform_device_term(kbdev);
65 void kbase_backend_early_term(struct kbase_device *kbdev)
67 kbase_release_interrupts(kbdev);
68 kbase_hwaccess_pm_term(kbdev);
69 kbasep_platform_device_term(kbdev);
72 int kbase_backend_late_init(struct kbase_device *kbdev)
76 err = kbase_hwaccess_pm_powerup(kbdev, PM_HW_ISSUES_DETECT);
80 err = kbase_backend_timer_init(kbdev);
84 /* Currently disabled on the prototype */
85 #ifdef CONFIG_MALI_DEBUG
86 #ifndef CONFIG_MALI_NO_MALI
87 if (kbasep_common_test_interrupt_handlers(kbdev) != 0) {
88 dev_err(kbdev->dev, "Interrupt assigment check failed.\n");
90 goto fail_interrupt_test;
92 #endif /* !CONFIG_MALI_NO_MALI */
93 #endif /* CONFIG_MALI_DEBUG */
95 err = kbase_job_slot_init(kbdev);
99 init_waitqueue_head(&kbdev->hwaccess.backend.reset_wait);
104 /* Currently disabled on the prototype */
105 #ifdef CONFIG_MALI_DEBUG
106 #ifndef CONFIG_MALI_NO_MALI
108 #endif /* !CONFIG_MALI_NO_MALI */
109 #endif /* CONFIG_MALI_DEBUG */
110 kbase_backend_timer_term(kbdev);
112 kbase_hwaccess_pm_halt(kbdev);
117 void kbase_backend_late_term(struct kbase_device *kbdev)
119 kbase_job_slot_halt(kbdev);
120 kbase_job_slot_term(kbdev);
121 kbase_backend_timer_term(kbdev);
122 kbase_hwaccess_pm_halt(kbdev);