diff options
Diffstat (limited to 'drivers/gpu/arm/midgard/platform')
11 files changed, 130 insertions, 378 deletions
diff --git a/drivers/gpu/arm/midgard/platform/devicetree/mali_kbase_config_platform.h b/drivers/gpu/arm/midgard/platform/devicetree/mali_kbase_config_platform.h index 34f6d57382e2..d4813f7f8a35 100644 --- a/drivers/gpu/arm/midgard/platform/devicetree/mali_kbase_config_platform.h +++ b/drivers/gpu/arm/midgard/platform/devicetree/mali_kbase_config_platform.h @@ -1,6 +1,6 @@ /* * - * (C) COPYRIGHT 2014-2016 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2015 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -73,8 +73,8 @@ extern struct kbase_pm_callback_conf pm_callbacks; /** - * Protected mode switch + * Secure mode switch * - * Attached value: pointer to @ref kbase_protected_ops + * Attached value: pointer to @ref kbase_secure_ops */ -#define PROTECTED_CALLBACKS (NULL) +#define SECURE_CALLBACKS (NULL) diff --git a/drivers/gpu/arm/midgard/platform/juno_soc/mali_kbase_config_juno_soc.c b/drivers/gpu/arm/midgard/platform/juno_soc/mali_kbase_config_juno_soc.c index c65481810927..3baf3d96d41a 100644 --- a/drivers/gpu/arm/midgard/platform/juno_soc/mali_kbase_config_juno_soc.c +++ b/drivers/gpu/arm/midgard/platform/juno_soc/mali_kbase_config_juno_soc.c @@ -1,6 +1,6 @@ /* * - * (C) COPYRIGHT 2011-2016 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2011-2015 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -66,76 +66,48 @@ struct kbase_pm_callback_conf pm_callbacks = { }; /* - * Juno Protected Mode integration + * Juno Secure Mode integration */ /* SMC Function Numbers */ -#define JUNO_SMC_PROTECTED_ENTER_FUNC 0xff06 -#define JUNO_SMC_PROTECTED_RESET_FUNC 0xff07 +#define JUNO_SMC_SECURE_ENABLE_FUNC 0xff06 +#define JUNO_SMC_SECURE_DISABLE_FUNC 0xff07 -static int juno_protected_mode_enter(struct kbase_device *kbdev) +static int juno_secure_mode_enable(struct kbase_device *kbdev) { - /* T62X in SoC detected */ - u64 ret = kbase_invoke_smc(SMC_OEN_SIP, - JUNO_SMC_PROTECTED_ENTER_FUNC, false, - 0, 0, 0); - return ret; -} - -/* TODO: Remove these externs, reset should should be done by the firmware */ -extern void kbase_reg_write(struct kbase_device *kbdev, u16 offset, u32 value, - struct kbase_context *kctx); - -extern u32 kbase_reg_read(struct kbase_device *kbdev, u16 offset, - struct kbase_context *kctx); - -static int juno_protected_mode_reset(struct kbase_device *kbdev) -{ - - /* T62X in SoC detected */ - u64 ret = kbase_invoke_smc(SMC_OEN_SIP, - JUNO_SMC_PROTECTED_RESET_FUNC, false, - 0, 0, 0); - - /* TODO: Remove this reset, it should be done by the firmware */ - kbase_reg_write(kbdev, GPU_CONTROL_REG(GPU_COMMAND), - GPU_COMMAND_HARD_RESET, NULL); - - while ((kbase_reg_read(kbdev, GPU_CONTROL_REG(GPU_IRQ_RAWSTAT), NULL) - & RESET_COMPLETED) != RESET_COMPLETED) - ; + u32 gpu_id = kbdev->gpu_props.props.raw_props.gpu_id; - return ret; + if (gpu_id == GPU_ID_MAKE(GPU_ID_PI_T62X, 0, 1, 0) && + kbdev->reg_start == 0x2d000000) { + /* T62X in SoC detected */ + u64 ret = kbase_invoke_smc(SMC_OEN_SIP, + JUNO_SMC_SECURE_ENABLE_FUNC, false, + 0, 0, 0); + return ret; + } + + return -EINVAL; /* Not supported */ } -static bool juno_protected_mode_supported(struct kbase_device *kbdev) +static int juno_secure_mode_disable(struct kbase_device *kbdev) { u32 gpu_id = kbdev->gpu_props.props.raw_props.gpu_id; - /* - * Protected mode is only supported for the built in GPU - * _and_ only if the right firmware is running. - * - * Given that at init time the GPU is not powered up the - * juno_protected_mode_reset function can't be used as - * is needs to access GPU registers. - * However, although we don't want the GPU to boot into - * protected mode we know a GPU reset will be done after - * this function is called so although we set the GPU to - * protected mode it will exit protected mode before the - * driver is ready to run work. - */ if (gpu_id == GPU_ID_MAKE(GPU_ID_PI_T62X, 0, 1, 0) && - (kbdev->reg_start == 0x2d000000)) - return juno_protected_mode_enter(kbdev) == 0; - - return false; + kbdev->reg_start == 0x2d000000) { + /* T62X in SoC detected */ + u64 ret = kbase_invoke_smc(SMC_OEN_SIP, + JUNO_SMC_SECURE_DISABLE_FUNC, false, + 0, 0, 0); + return ret; + } + + return -EINVAL; /* Not supported */ } -struct kbase_protected_ops juno_protected_ops = { - .protected_mode_enter = juno_protected_mode_enter, - .protected_mode_reset = juno_protected_mode_reset, - .protected_mode_supported = juno_protected_mode_supported, +struct kbase_secure_ops juno_secure_ops = { + .secure_mode_enable = juno_secure_mode_enable, + .secure_mode_disable = juno_secure_mode_disable, }; static struct kbase_platform_config versatile_platform_config = { diff --git a/drivers/gpu/arm/midgard/platform/juno_soc/mali_kbase_config_platform.h b/drivers/gpu/arm/midgard/platform/juno_soc/mali_kbase_config_platform.h index ab29e9d9c0a6..5fc6d9e1c312 100644 --- a/drivers/gpu/arm/midgard/platform/juno_soc/mali_kbase_config_platform.h +++ b/drivers/gpu/arm/midgard/platform/juno_soc/mali_kbase_config_platform.h @@ -1,6 +1,6 @@ /* * - * (C) COPYRIGHT 2014-2016 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2015 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -71,14 +71,14 @@ #define PLATFORM_FUNCS (NULL) /** - * Protected mode switch + * Secure mode switch * - * Attached value: pointer to @ref kbase_protected_ops + * Attached value: pointer to @ref kbase_secure_ops */ -#define PROTECTED_CALLBACKS (&juno_protected_ops) +#define SECURE_CALLBACKS (&juno_secure_ops) extern struct kbase_pm_callback_conf pm_callbacks; #ifdef CONFIG_DEVFREQ_THERMAL extern struct devfreq_cooling_ops juno_model_ops; #endif -extern struct kbase_protected_ops juno_protected_ops; +extern struct kbase_secure_ops juno_secure_ops; diff --git a/drivers/gpu/arm/midgard/platform/rk/mali_kbase_config_rk.c b/drivers/gpu/arm/midgard/platform/rk/mali_kbase_config_rk.c index bcf7971a5fdb..9514daf42a8a 100644..100755 --- a/drivers/gpu/arm/midgard/platform/rk/mali_kbase_config_rk.c +++ b/drivers/gpu/arm/midgard/platform/rk/mali_kbase_config_rk.c @@ -14,12 +14,9 @@ #include <mali_kbase.h> #include <mali_kbase_defs.h> #include <mali_kbase_config.h> -#include <backend/gpu/mali_kbase_pm_internal.h> #include <linux/pm_runtime.h> #include <linux/suspend.h> -#include <linux/of.h> -#include <linux/delay.h> #include "mali_kbase_rk.h" @@ -42,54 +39,18 @@ /*---------------------------------------------------------------------------*/ -#ifdef CONFIG_REGULATOR static int rk_pm_enable_regulator(struct kbase_device *kbdev); + static void rk_pm_disable_regulator(struct kbase_device *kbdev); -#else -static inline int rk_pm_enable_regulator(struct kbase_device *kbdev) -{ - return 0; -} -static inline void rk_pm_disable_regulator(struct kbase_device *kbdev) -{ -} -#endif static int rk_pm_enable_clk(struct kbase_device *kbdev); static void rk_pm_disable_clk(struct kbase_device *kbdev); -static int kbase_platform_rk_create_sysfs_files(struct device *dev); - -static void kbase_platform_rk_remove_sysfs_files(struct device *dev); - /*---------------------------------------------------------------------------*/ -static void rk_pm_power_off_delay_work(struct work_struct *work) -{ - struct rk_context *platform = - container_of(to_delayed_work(work), struct rk_context, work); - struct kbase_device *kbdev = platform->kbdev; - - if (!platform->is_powered) { - D("mali_dev is already powered off."); - return; - } - - if (pm_runtime_enabled(kbdev->dev)) { - D("to put_sync_suspend mali_dev."); - pm_runtime_put_sync_suspend(kbdev->dev); - } - - rk_pm_disable_regulator(kbdev); - - platform->is_powered = false; - KBASE_TIMELINE_GPU_POWER(kbdev, 0); -} - static int kbase_platform_rk_init(struct kbase_device *kbdev) { - int ret = 0; struct rk_context *platform; platform = kzalloc(sizeof(*platform), GFP_KERNEL); @@ -99,49 +60,14 @@ static int kbase_platform_rk_init(struct kbase_device *kbdev) } platform->is_powered = false; - platform->kbdev = kbdev; - - platform->delay_ms = 200; - if (of_property_read_u32(kbdev->dev->of_node, "power-off-delay-ms", - &platform->delay_ms)) - W("power-off-delay-ms not available."); - - platform->power_off_wq = create_freezable_workqueue("gpu_power_off_wq"); - if (!platform->power_off_wq) { - E("couldn't create workqueue"); - return -ENOMEM; - } - INIT_DEFERRABLE_WORK(&platform->work, rk_pm_power_off_delay_work); - platform->utilisation_period = DEFAULT_UTILISATION_PERIOD_IN_MS; - - ret = kbase_platform_rk_create_sysfs_files(kbdev->dev); - if (ret) { - E("fail to create sysfs_files. ret = %d.", ret); - goto EXIT; - } kbdev->platform_context = (void *)platform; - pm_runtime_enable(kbdev->dev); -EXIT: - return ret; + return 0; } static void kbase_platform_rk_term(struct kbase_device *kbdev) { - struct rk_context *platform = - (struct rk_context *)kbdev->platform_context; - - pm_runtime_disable(kbdev->dev); - kbdev->platform_context = NULL; - - if (platform) { - destroy_workqueue(platform->power_off_wq); - platform->is_powered = false; - platform->kbdev = NULL; - kfree(platform); - } - kbase_platform_rk_remove_sysfs_files(kbdev->dev); } struct kbase_platform_funcs_conf platform_funcs = { @@ -164,21 +90,16 @@ static int rk_pm_callback_power_on(struct kbase_device *kbdev) { int ret = 1; /* Assume GPU has been powered off */ int err = 0; - struct rk_context *platform = get_rk_context(kbdev); - - cancel_delayed_work_sync(&platform->work); - - err = rk_pm_enable_clk(kbdev); - if (err) { - E("failed to enable clk: %d", err); - return err; - } + struct rk_context *platform; + platform = (struct rk_context *)kbdev->platform_context; if (platform->is_powered) { - D("mali_device is already powered."); + W("mali_device is already powered."); return 0; } + D("powering on."); + /* we must enable vdd_gpu before pd_gpu_in_chip. */ err = rk_pm_enable_regulator(kbdev); if (err) { @@ -202,6 +123,12 @@ static int rk_pm_callback_power_on(struct kbase_device *kbdev) } } + err = rk_pm_enable_clk(kbdev); /* clk is not relative to pd. */ + if (err) { + E("failed to enable clk: %d", err); + return err; + } + platform->is_powered = true; KBASE_TIMELINE_GPU_POWER(kbdev, 1); @@ -210,20 +137,47 @@ static int rk_pm_callback_power_on(struct kbase_device *kbdev) static void rk_pm_callback_power_off(struct kbase_device *kbdev) { - struct rk_context *platform = get_rk_context(kbdev); + struct rk_context *platform = + (struct rk_context *)kbdev->platform_context; + + if (!platform->is_powered) { + W("mali_dev is already powered off."); + return; + } + + D("powering off."); + + platform->is_powered = false; + KBASE_TIMELINE_GPU_POWER(kbdev, 0); rk_pm_disable_clk(kbdev); - queue_delayed_work(platform->power_off_wq, &platform->work, - msecs_to_jiffies(platform->delay_ms)); + + if (pm_runtime_enabled(kbdev->dev)) { + pm_runtime_mark_last_busy(kbdev->dev); + D("to put_sync_suspend mali_dev."); + pm_runtime_put_sync_suspend(kbdev->dev); + } + + rk_pm_disable_regulator(kbdev); } int rk_kbase_device_runtime_init(struct kbase_device *kbdev) { + pm_runtime_set_autosuspend_delay(kbdev->dev, 200); + pm_runtime_use_autosuspend(kbdev->dev); + + /* no need to call pm_runtime_set_active here. */ + + D("to enable pm_runtime."); + pm_runtime_enable(kbdev->dev); + return 0; } void rk_kbase_device_runtime_disable(struct kbase_device *kbdev) { + D("to disable pm_runtime."); + pm_runtime_disable(kbdev->dev); } struct kbase_pm_callback_conf pm_callbacks = { @@ -250,15 +204,6 @@ int kbase_platform_early_init(void) /*---------------------------------------------------------------------------*/ -void kbase_platform_rk_shutdown(struct kbase_device *kbdev) -{ - I("to make vdd_gpu enabled for turning off pd_gpu in pm_framework."); - rk_pm_enable_regulator(kbdev); -} - -/*---------------------------------------------------------------------------*/ - -#ifdef CONFIG_REGULATOR static int rk_pm_enable_regulator(struct kbase_device *kbdev) { int ret = 0; @@ -289,7 +234,6 @@ static void rk_pm_disable_regulator(struct kbase_device *kbdev) D("to disable regulator."); regulator_disable(kbdev->regulator); } -#endif static int rk_pm_enable_clk(struct kbase_device *kbdev) { @@ -317,97 +261,3 @@ static void rk_pm_disable_clk(struct kbase_device *kbdev) } } -/*---------------------------------------------------------------------------*/ - -static ssize_t utilisation_period_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct kbase_device *kbdev = dev_get_drvdata(dev); - struct rk_context *platform = get_rk_context(kbdev); - ssize_t ret = 0; - - ret += snprintf(buf, PAGE_SIZE, "%u\n", platform->utilisation_period); - - return ret; -} - -static ssize_t utilisation_period_store(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t count) -{ - struct kbase_device *kbdev = dev_get_drvdata(dev); - struct rk_context *platform = get_rk_context(kbdev); - int ret = 0; - - ret = kstrtouint(buf, 0, &platform->utilisation_period); - if (ret) { - E("invalid input period : %s.", buf); - return ret; - } - D("set utilisation_period to '%d'.", platform->utilisation_period); - - return count; -} - -static ssize_t utilisation_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct kbase_device *kbdev = dev_get_drvdata(dev); - struct rk_context *platform = get_rk_context(kbdev); - ssize_t ret = 0; - unsigned long period_in_us = platform->utilisation_period * 1000; - unsigned long total_time; - unsigned long busy_time; - unsigned long utilisation; - - kbase_pm_reset_dvfs_utilisation(kbdev); - usleep_range(period_in_us, period_in_us + 100); - kbase_pm_get_dvfs_utilisation(kbdev, &total_time, &busy_time); - /* 'devfreq_dev_profile' instance registered to devfreq - * also uses kbase_pm_reset_dvfs_utilisation - * and kbase_pm_get_dvfs_utilisation. - * it's better to cat this file when DVFS is disabled. - */ - D("total_time : %lu, busy_time : %lu.", total_time, busy_time); - - utilisation = busy_time * 100 / total_time; - ret += snprintf(buf, PAGE_SIZE, "%ld\n", utilisation); - - return ret; -} - -static DEVICE_ATTR_RW(utilisation_period); -static DEVICE_ATTR_RO(utilisation); - -static int kbase_platform_rk_create_sysfs_files(struct device *dev) -{ - int ret = 0; - - ret = device_create_file(dev, &dev_attr_utilisation_period); - if (ret) { - E("fail to create sysfs file 'utilisation_period'."); - goto out; - } - - ret = device_create_file(dev, &dev_attr_utilisation); - if (ret) { - E("fail to create sysfs file 'utilisation'."); - goto remove_utilisation_period; - } - - return 0; - -remove_utilisation_period: - device_remove_file(dev, &dev_attr_utilisation_period); -out: - return ret; -} - -static void kbase_platform_rk_remove_sysfs_files(struct device *dev) -{ - device_remove_file(dev, &dev_attr_utilisation_period); - device_remove_file(dev, &dev_attr_utilisation); -} diff --git a/drivers/gpu/arm/midgard/platform/rk/mali_kbase_rk.h b/drivers/gpu/arm/midgard/platform/rk/mali_kbase_rk.h index e1623806abe8..a4ebd50415bb 100644 --- a/drivers/gpu/arm/midgard/platform/rk/mali_kbase_rk.h +++ b/drivers/gpu/arm/midgard/platform/rk/mali_kbase_rk.h @@ -17,34 +17,14 @@ /*---------------------------------------------------------------------------*/ -#define DEFAULT_UTILISATION_PERIOD_IN_MS (100) - -/*---------------------------------------------------------------------------*/ - -/* +/** * struct rk_context - work_context of platform_dependent_part_of_rk. + * @is_powered: record the status + * of common_parts calling 'power_on_callback' and 'power_off_callback'. */ struct rk_context { - /* - * record the status of common_parts calling 'power_on_callback' - * and 'power_off_callback'. - */ bool is_powered; - struct kbase_device *kbdev; - struct workqueue_struct *power_off_wq; - struct delayed_work work; - unsigned int delay_ms; - /* debug only, the period in ms to count gpu_utilisation. */ - unsigned int utilisation_period; }; -/*---------------------------------------------------------------------------*/ - -static inline struct rk_context *get_rk_context( - const struct kbase_device *kbdev) -{ - return (struct rk_context *)(kbdev->platform_context); -} - #endif /* _MALI_KBASE_RK_H_ */ diff --git a/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_config_platform.h b/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_config_platform.h index dc4471beae67..6384586371d0 100644 --- a/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_config_platform.h +++ b/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_config_platform.h @@ -1,6 +1,6 @@ /* * - * (C) COPYRIGHT 2014-2016 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2015 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -24,7 +24,7 @@ * Attached value: number in kHz * Default value: NA */ -#define GPU_FREQ_KHZ_MAX kbase_get_platform_max_freq() +#define GPU_FREQ_KHZ_MAX (5000) /** * Minimum frequency GPU will be clocked at. Given in kHz. * This must be specified as there is no default value. @@ -32,7 +32,16 @@ * Attached value: number in kHz * Default value: NA */ -#define GPU_FREQ_KHZ_MIN kbase_get_platform_min_freq() +#define GPU_FREQ_KHZ_MIN (5000) + +/** + * Values used for determining the GPU frequency based on the LogicTile type + * Used by the function kbase_get_platform_logic_tile_type + */ +#define VE_VIRTEX6_GPU_FREQ_MIN 5000 +#define VE_VIRTEX6_GPU_FREQ_MAX 5000 +#define VE_VIRTEX7_GPU_FREQ_MIN 40000 +#define VE_VIRTEX7_GPU_FREQ_MAX 40000 /** * CPU_SPEED_FUNC - A pointer to a function that calculates the CPU clock @@ -73,10 +82,10 @@ #define PLATFORM_FUNCS (NULL) /** - * Protected mode switch + * Secure mode switch * - * Attached value: pointer to @ref kbase_protected_ops + * Attached value: pointer to @ref kbase_secure_ops */ -#define PROTECTED_CALLBACKS (NULL) +#define SECURE_CALLBACKS (NULL) extern struct kbase_pm_callback_conf pm_callbacks; diff --git a/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_config_vexpress.c b/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_config_vexpress.c index 15ce2bc5eea5..687b1a8c0431 100644 --- a/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_config_vexpress.c +++ b/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_config_vexpress.c @@ -1,6 +1,6 @@ /* * - * (C) COPYRIGHT 2011-2016 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2011-2015 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software diff --git a/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_cpu_vexpress.c b/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_cpu_vexpress.c index 4665f98cbbe4..9bc51f1e2da8 100644 --- a/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_cpu_vexpress.c +++ b/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_cpu_vexpress.c @@ -1,6 +1,6 @@ /* * - * (C) COPYRIGHT 2011-2016 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2011-2015 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -52,18 +52,6 @@ #define IS_SINGLE_BIT_SET(val, pos) (val&(1<<pos)) -/** - * Values used for determining the GPU frequency based on the LogicTile type - * Used by the function kbase_get_platform_logic_tile_type - */ -#define VE_VIRTEX6_GPU_FREQ_MIN 5000 -#define VE_VIRTEX6_GPU_FREQ_MAX 5000 -#define VE_VIRTEX7_GPU_FREQ_MIN 40000 -#define VE_VIRTEX7_GPU_FREQ_MAX 40000 -#define VE_DEFAULT_GPU_FREQ_MIN 5000 -#define VE_DEFAULT_GPU_FREQ_MAX 5000 - - #define CPU_CLOCK_SPEED_UNDEFINED (0) static u32 cpu_clock_speed = CPU_CLOCK_SPEED_UNDEFINED; @@ -209,71 +197,14 @@ syscfg_reg_map_failed: return err; } -/** - * kbase_get_platform_logic_tile_type - determines which LogicTile type - * is used by Versatile Express - * - * When platform_config build parameter is specified as vexpress, i.e., - * platform_config=vexpress, GPU frequency may vary dependent on the - * particular platform. The GPU frequency depends on the LogicTile type. - * - * This function determines which LogicTile type is used by the platform by - * reading the HBI value of the daughterboard which holds the LogicTile: - * - * 0x217 HBI0217 Virtex-6 - * 0x192 HBI0192 Virtex-5 - * 0x247 HBI0247 Virtex-7 - * - * Return: HBI value of the logic tile daughterboard, zero if not accessible - */ -static u32 kbase_get_platform_logic_tile_type(void) +u32 kbase_get_platform_logic_tile_type(void) { void __iomem *syscfg_reg = NULL; u32 sys_procid1 = 0; syscfg_reg = ioremap(VE_MOTHERBOARD_PERIPHERALS_SMB_CS7 + VE_SYS_PROC_ID1_OFFSET, 4); - if (NULL != syscfg_reg) { - sys_procid1 = readl(syscfg_reg); - iounmap(syscfg_reg); - } - return sys_procid1 & VE_LOGIC_TILE_HBI_MASK; -} - -u32 kbase_get_platform_min_freq(void) -{ - u32 ve_logic_tile = kbase_get_platform_logic_tile_type(); - - switch (ve_logic_tile) { - case 0x217: - /* Virtex 6, HBI0217 */ - return VE_VIRTEX6_GPU_FREQ_MIN; - case 0x247: - /* Virtex 7, HBI0247 */ - return VE_VIRTEX7_GPU_FREQ_MIN; - default: - /* all other logic tiles, i.e., Virtex 5 HBI0192 - * or unsuccessful reading from the platform - - * fall back to some default value */ - return VE_DEFAULT_GPU_FREQ_MIN; - } -} + sys_procid1 = (NULL != syscfg_reg) ? readl(syscfg_reg) : 0; -u32 kbase_get_platform_max_freq(void) -{ - u32 ve_logic_tile = kbase_get_platform_logic_tile_type(); - - switch (ve_logic_tile) { - case 0x217: - /* Virtex 6, HBI0217 */ - return VE_VIRTEX6_GPU_FREQ_MAX; - case 0x247: - /* Virtex 7, HBI0247 */ - return VE_VIRTEX7_GPU_FREQ_MAX; - default: - /* all other logic tiles, i.e., Virtex 5 HBI0192 - * or unsuccessful reading from the platform - - * fall back to some default value */ - return VE_DEFAULT_GPU_FREQ_MAX; - } + return sys_procid1 & VE_LOGIC_TILE_HBI_MASK; } diff --git a/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_cpu_vexpress.h b/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_cpu_vexpress.h index da865698133a..ef9bfd721618 100644 --- a/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_cpu_vexpress.h +++ b/drivers/gpu/arm/midgard/platform/vexpress/mali_kbase_cpu_vexpress.h @@ -1,6 +1,6 @@ /* * - * (C) COPYRIGHT 2012-2013, 2015-2016 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2012-2013, 2015 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -26,13 +26,23 @@ int kbase_get_vexpress_cpu_clock_speed(u32 *cpu_clock); /** - * Get the minimum GPU frequency for the attached logic tile - */ -u32 kbase_get_platform_min_freq(void); - -/** - * Get the maximum GPU frequency for the attached logic tile + * kbase_get_platform_logic_tile_type - determines which LogicTile type + * is used by Versatile Express + * + * When platform_config build parameter is specified as vexpress, i.e., + * platform_config=vexpress, GPU frequency may vary dependent on the + * particular platform. The GPU frequency depends on the LogicTile type. + * + * This function is called by kbase_common_device_init to determine + * which LogicTile type is used by the platform by reading the HBI value + * of the daughterboard which holds the LogicTile: + * + * 0x192 HBI0192 Virtex-5 + * 0x217 HBI0217 Virtex-6 + * 0x247 HBI0247 Virtex-7 + * + * Return: HBI value of the logic tile daughterboard, zero if not accessible */ -u32 kbase_get_platform_max_freq(void); +u32 kbase_get_platform_logic_tile_type(void); #endif /* _KBASE_CPU_VEXPRESS_H_ */ diff --git a/drivers/gpu/arm/midgard/platform/vexpress_1xv7_a57/mali_kbase_config_platform.h b/drivers/gpu/arm/midgard/platform/vexpress_1xv7_a57/mali_kbase_config_platform.h index b0490ca331dd..2b91d72bd93c 100644 --- a/drivers/gpu/arm/midgard/platform/vexpress_1xv7_a57/mali_kbase_config_platform.h +++ b/drivers/gpu/arm/midgard/platform/vexpress_1xv7_a57/mali_kbase_config_platform.h @@ -1,6 +1,6 @@ /* * - * (C) COPYRIGHT 2014-2016 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2015 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -71,10 +71,10 @@ #define PLATFORM_FUNCS (NULL) /** - * Protected mode switch + * Secure mode switch * - * Attached value: pointer to @ref kbase_protected_ops + * Attached value: pointer to @ref kbase_secure_ops */ -#define PROTECTED_CALLBACKS (NULL) +#define SECURE_CALLBACKS (NULL) extern struct kbase_pm_callback_conf pm_callbacks; diff --git a/drivers/gpu/arm/midgard/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_platform.h b/drivers/gpu/arm/midgard/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_platform.h index 22ffccb3aaed..d269c2591490 100644 --- a/drivers/gpu/arm/midgard/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_platform.h +++ b/drivers/gpu/arm/midgard/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_platform.h @@ -1,6 +1,6 @@ /* * - * (C) COPYRIGHT 2014-2016 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2014-2015 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -73,10 +73,10 @@ #define PLATFORM_FUNCS (NULL) /** - * Protected mode switch + * Secure mode switch * - * Attached value: pointer to @ref kbase_protected_ops + * Attached value: pointer to @ref kbase_secure_ops */ -#define PROTECTED_CALLBACKS (NULL) +#define SECURE_CALLBACKS (NULL) extern struct kbase_pm_callback_conf pm_callbacks; |