Skip to content
Snippets Groups Projects
Commit a0850125 authored by Daniel Stone's avatar Daniel Stone
Browse files

ARM: Mali: Support -EPROBE_DEFER


If we don't get the clock (called g3d in upstream DT), pass through the
return code so we can handle -EPROBE_DEFER and try later on.

Signed-off-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>
parent d0fe9b03
Branches
No related tags found
No related merge requests found
...@@ -133,7 +133,7 @@ uintptr_t kbasep_get_config_value(struct kbase_device *kbdev, const struct kbase ...@@ -133,7 +133,7 @@ uintptr_t kbasep_get_config_value(struct kbase_device *kbdev, const struct kbase
KBASE_EXPORT_TEST_API(kbasep_get_config_value) KBASE_EXPORT_TEST_API(kbasep_get_config_value)
mali_bool kbasep_platform_device_init(struct kbase_device *kbdev) mali_error kbasep_platform_device_init(struct kbase_device *kbdev)
{ {
struct kbase_platform_funcs_conf *platform_funcs; struct kbase_platform_funcs_conf *platform_funcs;
...@@ -142,7 +142,7 @@ mali_bool kbasep_platform_device_init(struct kbase_device *kbdev) ...@@ -142,7 +142,7 @@ mali_bool kbasep_platform_device_init(struct kbase_device *kbdev)
if (platform_funcs->platform_init_func) if (platform_funcs->platform_init_func)
return platform_funcs->platform_init_func(kbdev); return platform_funcs->platform_init_func(kbdev);
} }
return MALI_TRUE; return MALI_ERROR_NONE;
} }
void kbasep_platform_device_term(struct kbase_device *kbdev) void kbasep_platform_device_term(struct kbase_device *kbdev)
......
...@@ -450,7 +450,7 @@ typedef struct kbase_platform_funcs_conf { ...@@ -450,7 +450,7 @@ typedef struct kbase_platform_funcs_conf {
* Power Management callbacks). * Power Management callbacks).
* The platform specific private pointer kbase_device::platform_context can be accessed (and possibly initialized) in here. * The platform specific private pointer kbase_device::platform_context can be accessed (and possibly initialized) in here.
*/ */
mali_bool(*platform_init_func) (struct kbase_device *kbdev); mali_error(*platform_init_func) (struct kbase_device *kbdev);
/** /**
* Function pointer for platform specific termination or NULL if no termination function is required. * Function pointer for platform specific termination or NULL if no termination function is required.
* This function will be called \em after any other callbacks listed in the struct kbase_attribute struct (such as * This function will be called \em after any other callbacks listed in the struct kbase_attribute struct (such as
...@@ -699,9 +699,9 @@ int kbasep_get_config_attribute_count(const struct kbase_attribute *attributes); ...@@ -699,9 +699,9 @@ int kbasep_get_config_attribute_count(const struct kbase_attribute *attributes);
* *
* @param[in] kbdev Kbase device pointer * @param[in] kbdev Kbase device pointer
* *
* @return MALI_TRUE if no errors have been found in the config. MALI_FALSE otherwise. * @return MALI_ERROR_NONE if no errors have been found in the config, or an error otherwise.
*/ */
mali_bool kbasep_platform_device_init(struct kbase_device *kbdev); mali_error kbasep_platform_device_init(struct kbase_device *kbdev);
/** /**
* @brief Platform specific call to terminate hardware * @brief Platform specific call to terminate hardware
......
...@@ -2842,9 +2842,7 @@ static int kbase_platform_device_probe(struct platform_device *pdev) ...@@ -2842,9 +2842,7 @@ static int kbase_platform_device_probe(struct platform_device *pdev)
int err; int err;
int i; int i;
struct mali_base_gpu_core_props *core_props; struct mali_base_gpu_core_props *core_props;
#ifdef CONFIG_MALI_NO_MALI
mali_error mali_err; mali_error mali_err;
#endif /* CONFIG_MALI_NO_MALI */
#ifdef CONFIG_OF #ifdef CONFIG_OF
#ifdef CONFIG_MALI_PLATFORM_FAKE #ifdef CONFIG_MALI_PLATFORM_FAKE
struct kbase_platform_config *config; struct kbase_platform_config *config;
...@@ -2938,25 +2936,18 @@ static int kbase_platform_device_probe(struct platform_device *pdev) ...@@ -2938,25 +2936,18 @@ static int kbase_platform_device_probe(struct platform_device *pdev)
if (err) if (err)
goto out_free_dev; goto out_free_dev;
kbdev->clock = clk_get(kbdev->dev, "clk_mali"); kbdev->clock = clk_get(kbdev->dev, "g3d");
if (IS_ERR_OR_NULL(kbdev->clock)) { if (IS_ERR_OR_NULL(kbdev->clock)) {
dev_info(kbdev->dev, "Continuing without Mali clock control\n"); dev_info(kbdev->dev, "Continuing without Mali clock control\n");
kbdev->clock = NULL; kbdev->clock = NULL;
/* Allow probe to continue without clock. */ /* Allow probe to continue without clock. */
} else {
err = clk_prepare_enable(kbdev->clock);
if (err) {
dev_err(kbdev->dev,
"Failed to prepare and enable clock (%d)\n", err);
goto out_clock_get;
}
} }
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
kbdev->mali_debugfs_directory = debugfs_create_dir("mali", NULL); kbdev->mali_debugfs_directory = debugfs_create_dir("mali", NULL);
if (NULL == kbdev->mali_debugfs_directory) { if (NULL == kbdev->mali_debugfs_directory) {
dev_err(kbdev->dev, "Couldn't create mali debugfs directory\n"); dev_err(kbdev->dev, "Couldn't create mali debugfs directory\n");
goto out_clock_enable; goto out_clock_get;
} }
kbdev->memory_profile_directory = debugfs_create_dir("mem", kbdev->memory_profile_directory = debugfs_create_dir("mem",
kbdev->mali_debugfs_directory); kbdev->mali_debugfs_directory);
...@@ -2971,10 +2962,11 @@ static int kbase_platform_device_probe(struct platform_device *pdev) ...@@ -2971,10 +2962,11 @@ static int kbase_platform_device_probe(struct platform_device *pdev)
#endif /* CONFIG_DEBUG_FS */ #endif /* CONFIG_DEBUG_FS */
if (MALI_ERROR_NONE != kbase_device_init(kbdev)) { mali_err = kbase_device_init(kbdev);
if (MALI_ERROR_NONE != mali_err) {
dev_err(kbdev->dev, "Can't initialize device\n"); dev_err(kbdev->dev, "Can't initialize device\n");
err = -ENOMEM; err = (mali_err == MALI_ERROR_RESOURCE_IN_USE) ? -EPROBE_DEFER : -ENOMEM;
goto out_debugfs_remove; goto out_debugfs_remove;
} }
...@@ -2984,13 +2976,24 @@ static int kbase_platform_device_probe(struct platform_device *pdev) ...@@ -2984,13 +2976,24 @@ static int kbase_platform_device_probe(struct platform_device *pdev)
core_props->gpu_freq_khz_max = GPU_FREQ_KHZ_MAX; core_props->gpu_freq_khz_max = GPU_FREQ_KHZ_MAX;
kbdev->gpu_props.irq_throttle_time_us = DEFAULT_IRQ_THROTTLE_TIME_US; kbdev->gpu_props.irq_throttle_time_us = DEFAULT_IRQ_THROTTLE_TIME_US;
if (kbdev->clock) {
err = clk_prepare_enable(kbdev->clock);
if (err) {
dev_err(kbdev->dev,
"Failed to prepare and enable clock (%d)\n", err);
goto out_term_dev;
}
}
err = kbase_common_device_init(kbdev); err = kbase_common_device_init(kbdev);
if (err) { if (err) {
dev_err(kbdev->dev, "Failed kbase_common_device_init\n"); dev_err(kbdev->dev, "Failed kbase_common_device_init\n");
goto out_term_dev; goto out_clock_enable;
} }
return 0; return 0;
out_clock_enable:
clk_disable_unprepare(kbdev->clock);
out_term_dev: out_term_dev:
kbase_device_term(kbdev); kbase_device_term(kbdev);
out_debugfs_remove: out_debugfs_remove:
...@@ -3000,10 +3003,8 @@ out_mem_profile_remove: ...@@ -3000,10 +3003,8 @@ out_mem_profile_remove:
debugfs_remove(kbdev->memory_profile_directory); debugfs_remove(kbdev->memory_profile_directory);
out_mali_debugfs_remove: out_mali_debugfs_remove:
debugfs_remove(kbdev->mali_debugfs_directory); debugfs_remove(kbdev->mali_debugfs_directory);
out_clock_enable:
#endif /* CONFIG_DEBUG_FS */
clk_disable_unprepare(kbdev->clock);
out_clock_get: out_clock_get:
#endif /* CONFIG_DEBUG_FS */
clk_put(kbdev->clock); clk_put(kbdev->clock);
kbase_common_reg_unmap(kbdev); kbase_common_reg_unmap(kbdev);
out_free_dev: out_free_dev:
......
...@@ -73,14 +73,16 @@ struct kbase_device *kbase_device_alloc(void) ...@@ -73,14 +73,16 @@ struct kbase_device *kbase_device_alloc(void)
mali_error kbase_device_init(struct kbase_device * const kbdev) mali_error kbase_device_init(struct kbase_device * const kbdev)
{ {
mali_error ret = MALI_ERROR_FUNCTION_FAILED;
int i; /* i used after the for loop, don't reuse ! */ int i; /* i used after the for loop, don't reuse ! */
spin_lock_init(&kbdev->mmu_mask_change);
/* Initialize platform specific context */ /* Initialize platform specific context */
if (MALI_FALSE == kbasep_platform_device_init(kbdev)) ret = kbasep_platform_device_init(kbdev);
if (ret != MALI_ERROR_NONE)
goto fail; goto fail;
spin_lock_init(&kbdev->mmu_mask_change);
/* Ensure we can access the GPU registers */ /* Ensure we can access the GPU registers */
kbase_pm_register_access_enable(kbdev); kbase_pm_register_access_enable(kbdev);
...@@ -245,7 +247,7 @@ dma_set_mask_failed: ...@@ -245,7 +247,7 @@ dma_set_mask_failed:
free_platform: free_platform:
kbasep_platform_device_term(kbdev); kbasep_platform_device_term(kbdev);
fail: fail:
return MALI_ERROR_FUNCTION_FAILED; return ret;
} }
void kbase_device_term(struct kbase_device *kbdev) void kbase_device_term(struct kbase_device *kbdev)
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#include "mali_kbase_gpuprops_types.h" #include "mali_kbase_gpuprops_types.h"
#define BASE_UK_VERSION_MAJOR 8 #define BASE_UK_VERSION_MAJOR 8
#define BASE_UK_VERSION_MINOR 0 #define BASE_UK_VERSION_MINOR 2
struct kbase_uk_mem_alloc { struct kbase_uk_mem_alloc {
union uk_header header; union uk_header header;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment