3 * (C) COPYRIGHT 2011-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.
18 #include <linux/ioport.h>
19 #include <linux/thermal.h>
20 #include <mali_kbase.h>
21 #include <mali_kbase_defs.h>
22 #include <mali_kbase_config.h>
23 #include <mali_kbase_smc.h>
25 /* Versatile Express (VE) Juno Development Platform */
27 #define HARD_RESET_AT_POWER_OFF 0
30 static struct kbase_io_resources io_resources = {
36 .end = 0x2D000000 + (4096 * 4) - 1}
40 static int pm_callback_power_on(struct kbase_device *kbdev)
42 /* Nothing is needed on VExpress, but we may have destroyed GPU state (if the below HARD_RESET code is active) */
46 static void pm_callback_power_off(struct kbase_device *kbdev)
48 #if HARD_RESET_AT_POWER_OFF
49 /* Cause a GPU hard reset to test whether we have actually idled the GPU
50 * and that we properly reconfigure the GPU on power up.
51 * Usually this would be dangerous, but if the GPU is working correctly it should
52 * be completely safe as the GPU should not be active at this point.
53 * However this is disabled normally because it will most likely interfere with
56 KBASE_TRACE_ADD(kbdev, CORE_GPU_HARD_RESET, NULL, NULL, 0u, 0);
57 kbase_os_reg_write(kbdev, GPU_CONTROL_REG(GPU_COMMAND), GPU_COMMAND_HARD_RESET);
61 struct kbase_pm_callback_conf pm_callbacks = {
62 .power_on_callback = pm_callback_power_on,
63 .power_off_callback = pm_callback_power_off,
64 .power_suspend_callback = NULL,
65 .power_resume_callback = NULL
69 * Juno Secure Mode integration
72 /* SMC Function Numbers */
73 #define JUNO_SMC_SECURE_ENABLE_FUNC 0xff06
74 #define JUNO_SMC_SECURE_DISABLE_FUNC 0xff07
76 static int juno_secure_mode_enable(struct kbase_device *kbdev)
78 u32 gpu_id = kbdev->gpu_props.props.raw_props.gpu_id;
80 if (gpu_id == GPU_ID_MAKE(GPU_ID_PI_T62X, 0, 1, 0) &&
81 kbdev->reg_start == 0x2d000000) {
82 /* T62X in SoC detected */
83 u64 ret = kbase_invoke_smc(SMC_OEN_SIP,
84 JUNO_SMC_SECURE_ENABLE_FUNC, false,
89 return -EINVAL; /* Not supported */
92 static int juno_secure_mode_disable(struct kbase_device *kbdev)
94 u32 gpu_id = kbdev->gpu_props.props.raw_props.gpu_id;
96 if (gpu_id == GPU_ID_MAKE(GPU_ID_PI_T62X, 0, 1, 0) &&
97 kbdev->reg_start == 0x2d000000) {
98 /* T62X in SoC detected */
99 u64 ret = kbase_invoke_smc(SMC_OEN_SIP,
100 JUNO_SMC_SECURE_DISABLE_FUNC, false,
105 return -EINVAL; /* Not supported */
108 struct kbase_secure_ops juno_secure_ops = {
109 .secure_mode_enable = juno_secure_mode_enable,
110 .secure_mode_disable = juno_secure_mode_disable,
113 static struct kbase_platform_config versatile_platform_config = {
115 .io_resources = &io_resources
119 struct kbase_platform_config *kbase_get_platform_config(void)
121 return &versatile_platform_config;
124 int kbase_platform_early_init(void)
126 /* Nothing needed at this stage */