MALI: midgard: RK: add separate src dir of Midgard driver for RK Linux device
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / midgard_for_linux / platform / vexpress / mali_kbase_config_vexpress.c
1 /*
2  *
3  * (C) COPYRIGHT 2011-2015 ARM Limited. All rights reserved.
4  *
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
8  * of such GNU licence.
9  *
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.
13  *
14  */
15
16
17
18
19
20 #include <linux/ioport.h>
21 #include <mali_kbase.h>
22 #include <mali_kbase_defs.h>
23 #include <mali_kbase_config.h>
24 #include "mali_kbase_cpu_vexpress.h"
25 #include "mali_kbase_config_platform.h"
26
27 #define HARD_RESET_AT_POWER_OFF 0
28
29 #ifndef CONFIG_OF
30 static struct kbase_io_resources io_resources = {
31         .job_irq_number = 68,
32         .mmu_irq_number = 69,
33         .gpu_irq_number = 70,
34         .io_memory_region = {
35         .start = 0xFC010000,
36         .end = 0xFC010000 + (4096 * 4) - 1
37         }
38 };
39 #endif /* CONFIG_OF */
40
41 static int pm_callback_power_on(struct kbase_device *kbdev)
42 {
43         /* Nothing is needed on VExpress, but we may have destroyed GPU state (if the below HARD_RESET code is active) */
44         return 1;
45 }
46
47 static void pm_callback_power_off(struct kbase_device *kbdev)
48 {
49 #if HARD_RESET_AT_POWER_OFF
50         /* Cause a GPU hard reset to test whether we have actually idled the GPU
51          * and that we properly reconfigure the GPU on power up.
52          * Usually this would be dangerous, but if the GPU is working correctly it should
53          * be completely safe as the GPU should not be active at this point.
54          * However this is disabled normally because it will most likely interfere with
55          * bus logging etc.
56          */
57         KBASE_TRACE_ADD(kbdev, CORE_GPU_HARD_RESET, NULL, NULL, 0u, 0);
58         kbase_os_reg_write(kbdev, GPU_CONTROL_REG(GPU_COMMAND), GPU_COMMAND_HARD_RESET);
59 #endif
60 }
61
62 struct kbase_pm_callback_conf pm_callbacks = {
63         .power_on_callback = pm_callback_power_on,
64         .power_off_callback = pm_callback_power_off,
65         .power_suspend_callback  = NULL,
66         .power_resume_callback = NULL
67 };
68
69 static struct kbase_platform_config versatile_platform_config = {
70 #ifndef CONFIG_OF
71         .io_resources = &io_resources
72 #endif
73 };
74
75 struct kbase_platform_config *kbase_get_platform_config(void)
76 {
77         return &versatile_platform_config;
78 }
79
80
81 int kbase_platform_early_init(void)
82 {
83         /* Nothing needed at this stage */
84         return 0;
85 }