Skip to content
This repository was archived by the owner on Oct 5, 2018. It is now read-only.

Hikey: Mali 450 kernel driver support #23

Merged
merged 8 commits into from
Mar 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions arch/arm64/boot/dts/hi6220.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,23 @@
};
};

mali:mali@f4080000 {
compatible = "arm,mali-450", "arm,mali-utgard";
reg = <0x0 0x3f100000 0x0 0x00708000>;
clocks = <&clock_media HI6220_G3D_CLK>,
<&clock_media HI6220_G3D_PCLK>;
clock-names = "clk_g3d", "pclk_g3d";
G3D_PD_VDD-supply = <&mtcmos1>;
mali_def_freq = <500>;
pclk_freq = <144>;
dfs_steps = <2>;
dfs_lockprf = <1>;
dfs_limit_max_prf = <1>;
dfs_profile_num = <2>;
dfs_profiles = <250 3 0>, <500 1 0>;
mali_type = <2>;
};

dwmmc_0: dwmmc0@f723d000 {
compatible = "hisilicon,hisi-dw-mshc";
num-slots = <0x1>;
Expand Down Expand Up @@ -1038,11 +1055,13 @@

mtcmos1: regulator@a1{
regulator-name = "G3D_PD_VDD";
regulator-compatible = "mtcmos1";
hisilicon,ctrl-regs = <0x830 0x834 0x83c>;
hisilicon,ctrl-data = <1 0x1>;
};
mtcmos2: regulator@a2{
regulator-name = "SOC_MED";
regulator-compatible = "mtcmos2";
hisilicon,ctrl-regs = <0x830 0x834 0x83c>;
hisilicon,ctrl-data = <2 0x1>;
};
Expand Down
13 changes: 8 additions & 5 deletions arch/arm64/configs/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,6 @@ CONFIG_SPI_PL022=y
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_XGENE=y
CONFIG_THERMAL=y
CONFIG_THERMAL_HWMON=y
CONFIG_THERMAL_OF=y
CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
CONFIG_THERMAL_GOV_STEP_WISE=y
CONFIG_THERMAL_GOV_USER_SPACE=y
CONFIG_CPU_THERMAL=y
CONFIG_HISI_THERMAL=y
Expand All @@ -263,9 +259,16 @@ CONFIG_REGULATOR_HI6220=y
CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_ANALOG_TV_SUPPORT=y
# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
CONFIG_MALI400=m
CONFIG_MALI450=y
# CONFIG_MALI400_PROFILING is not set
# CONFIG_MALI_DVFS is not set
CONFIG_MALI_SHARED_INTERRUPTS=y
CONFIG_MALI_DT=y
CONFIG_MALI_PLAT_SPECIFIC_DT=y
CONFIG_DRM=y
CONFIG_DRM_HISI=y
CONFIG_DRM_I2C_ADV7533=y
CONFIG_DRM_HISI=y
CONFIG_FB_ARMCLCD=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_LOGO=y
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
obj-y += drm/ vga/
obj-y += drm/ vga/ arm/
obj-$(CONFIG_TEGRA_HOST1X) += host1x/
obj-$(CONFIG_IMX_IPUV3_CORE) += ipu-v3/
1 change: 1 addition & 0 deletions drivers/gpu/arm/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source "drivers/gpu/arm/utgard/Kconfig"
1 change: 1 addition & 0 deletions drivers/gpu/arm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obj-y += utgard/
214 changes: 214 additions & 0 deletions drivers/gpu/arm/utgard/Kbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
#
# Copyright (C) 2010-2011 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 Foundation, and any use by you of this program is subject to the terms of such GNU licence.
#
# A copy of the licence is included with the program, and can also be obtained from Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#

# This file is called by the Linux build system.

# set up defaults if not defined by the user
TIMESTAMP ?= default
OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB ?= 16
USING_GPU_UTILIZATION ?= 0
PROFILING_SKIP_PP_JOBS ?= 0
PROFILING_SKIP_PP_AND_GP_JOBS ?= 0
MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP ?= 0
MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED ?= 0
MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS ?= 0
MALI_UPPER_HALF_SCHEDULING ?= 1
MALI_ENABLE_CPU_CYCLES ?= 0

# For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases:
# The ARM proprietary product will only include the license/proprietary directory
# The GPL product will only include the license/gpl directory
ifeq ($(wildcard $(src)/linux/license/gpl/*),)
ccflags-y += -I$(src)/linux/license/proprietary
ifeq ($(CONFIG_MALI400_PROFILING),y)
$(error Profiling is incompatible with non-GPL license)
endif
ifeq ($(CONFIG_PM_RUNTIME),y)
$(error Runtime PM is incompatible with non-GPL license)
endif
ifeq ($(CONFIG_DMA_SHARED_BUFFER),y)
$(error DMA-BUF is incompatible with non-GPL license)
endif
$(error Linux Device integration is incompatible with non-GPL license)
else
ccflags-y += -I$(src)/linux/license/gpl
endif

ifeq ($(USING_GPU_UTILIZATION), 1)
ifeq ($(USING_DVFS), 1)
$(error USING_GPU_UTILIZATION conflict with USING_DVFS you can read the Integration Guide to choose which one do you need)
endif
endif

mali-y += \
linux/mali_osk_atomics.o \
linux/mali_osk_irq.o \
linux/mali_osk_wq.o \
linux/mali_osk_locks.o \
linux/mali_osk_wait_queue.o \
linux/mali_osk_low_level_mem.o \
linux/mali_osk_math.o \
linux/mali_osk_memory.o \
linux/mali_osk_misc.o \
linux/mali_osk_mali.o \
linux/mali_osk_notification.o \
linux/mali_osk_time.o \
linux/mali_osk_timers.o

mali-y += linux/mali_memory.o linux/mali_memory_os_alloc.o
mali-y += linux/mali_memory_external.o
mali-y += linux/mali_memory_block_alloc.o

mali-y += \
linux/mali_ukk_mem.o \
linux/mali_ukk_gp.o \
linux/mali_ukk_pp.o \
linux/mali_ukk_core.o \
linux/mali_ukk_soft_job.o \
linux/mali_ukk_timeline.o

# Source files which always are included in a build
mali-y += \
common/mali_kernel_core.o \
linux/mali_kernel_linux.o \
common/mali_kernel_descriptor_mapping.o \
common/mali_session.o \
linux/mali_device_pause_resume.o \
common/mali_kernel_vsync.o \
linux/mali_ukk_vsync.o \
linux/mali_kernel_sysfs.o \
common/mali_mmu.o \
common/mali_mmu_page_directory.o \
common/mali_mem_validation.o \
common/mali_hw_core.o \
common/mali_gp.o \
common/mali_pp.o \
common/mali_pp_job.o \
common/mali_gp_job.o \
common/mali_soft_job.o \
common/mali_scheduler.o \
common/mali_executor.o \
common/mali_group.o \
common/mali_dlbu.o \
common/mali_broadcast.o \
common/mali_pm.o \
common/mali_pmu.o \
common/mali_user_settings_db.o \
common/mali_kernel_utilization.o \
common/mali_control_timer.o \
common/mali_l2_cache.o \
common/mali_timeline.o \
common/mali_timeline_fence_wait.o \
common/mali_timeline_sync_fence.o \
common/mali_spinlock_reentrant.o \
common/mali_pm_domain.o \
linux/mali_osk_pm.o \
linux/mali_pmu_power_up_down.o \
__malidrv_build_info.o

EXTRA_DEFINES += -DMALI_FAKE_PLATFORM_DEVICE=1
mali-y += platform/hikey/mali_hikey.o

mali-$(CONFIG_MALI400_PROFILING) += linux/mali_ukk_profiling.o
mali-$(CONFIG_MALI400_PROFILING) += linux/mali_osk_profiling.o

mali-$(CONFIG_MALI400_INTERNAL_PROFILING) += linux/mali_profiling_internal.o timestamp-$(TIMESTAMP)/mali_timestamp.o
ccflags-$(CONFIG_MALI400_INTERNAL_PROFILING) += -I$(src)/timestamp-$(TIMESTAMP)

mali-$(CONFIG_DMA_SHARED_BUFFER) += linux/mali_memory_dma_buf.o
mali-$(CONFIG_SYNC) += linux/mali_sync.o
ccflags-$(CONFIG_SYNC) += -Idrivers/staging/android

mali-$(CONFIG_MALI400_UMP) += linux/mali_memory_ump.o

mali-$(CONFIG_MALI_DVFS) += common/mali_dvfs_policy.o

# Tell the Linux build system from which .o file to create the kernel module
obj-$(CONFIG_MALI400) := mali.o

ccflags-y += $(EXTRA_DEFINES)

# Set up our defines, which will be passed to gcc
ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP)
ccflags-y += -DMALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED=$(MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED)
ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS)
ccflags-y += -DMALI_STATE_TRACKING=1
ccflags-y += -DMALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
ccflags-y += -DUSING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
ccflags-y += -DMALI_ENABLE_CPU_CYCLES=$(MALI_ENABLE_CPU_CYCLES)

ifeq ($(MALI_UPPER_HALF_SCHEDULING),1)
ccflags-y += -DMALI_UPPER_HALF_SCHEDULING
endif

ccflags-$(CONFIG_MALI400_UMP) += -I$(src)/../../ump/include/ump
ccflags-$(CONFIG_MALI400_DEBUG) += -DDEBUG

# Use our defines when compiling
ccflags-y += -I$(src) -I$(src)/include -I$(src)/common -I$(src)/linux -I$(src)/platform

# Get subversion revision number, fall back to only ${MALI_RELEASE_NAME} if no svn info is available
MALI_RELEASE_NAME=$(shell cat $(src)/.version 2> /dev/null)

SVN_INFO = (cd $(src); svn info 2>/dev/null)

ifneq ($(shell $(SVN_INFO) 2>/dev/null),)
# SVN detected
SVN_REV := $(shell $(SVN_INFO) | grep '^Revision: '| sed -e 's/^Revision: //' 2>/dev/null)
DRIVER_REV := $(MALI_RELEASE_NAME)-r$(SVN_REV)
CHANGE_DATE := $(shell $(SVN_INFO) | grep '^Last Changed Date: ' | cut -d: -f2- | cut -b2-)
CHANGED_REVISION := $(shell $(SVN_INFO) | grep '^Last Changed Rev: ' | cut -d: -f2- | cut -b2-)
REPO_URL := $(shell $(SVN_INFO) | grep '^URL: ' | cut -d: -f2- | cut -b2-)

else # SVN
GIT_REV := $(shell cd $(src); git describe --always 2>/dev/null)
ifneq ($(GIT_REV),)
# Git detected
DRIVER_REV := $(MALI_RELEASE_NAME)-$(GIT_REV)
CHANGE_DATE := $(shell cd $(src); git log -1 --format="%ci")
CHANGED_REVISION := $(GIT_REV)
REPO_URL := $(shell cd $(src); git describe --all --always 2>/dev/null)

else # Git
# No Git or SVN detected
DRIVER_REV := $(MALI_RELEASE_NAME)
CHANGE_DATE := $(MALI_RELEASE_NAME)
CHANGED_REVISION := $(MALI_RELEASE_NAME)
endif
endif

ccflags-y += -DSVN_REV_STRING=\"$(DRIVER_REV)\"

VERSION_STRINGS :=
VERSION_STRINGS += API_VERSION=$(shell cd $(src); grep "\#define _MALI_API_VERSION" $(FILES_PREFIX)include/linux/mali/mali_utgard_uk_types.h | cut -d' ' -f 3 )
VERSION_STRINGS += REPO_URL=$(REPO_URL)
VERSION_STRINGS += REVISION=$(DRIVER_REV)
VERSION_STRINGS += CHANGED_REVISION=$(CHANGED_REVISION)
VERSION_STRINGS += CHANGE_DATE=$(CHANGE_DATE)
VERSION_STRINGS += BUILD_DATE=$(shell date)
ifdef CONFIG_MALI400_DEBUG
VERSION_STRINGS += BUILD=debug
else
VERSION_STRINGS += BUILD=release
endif
VERSION_STRINGS += TARGET_PLATFORM=$(TARGET_PLATFORM)
VERSION_STRINGS += MALI_PLATFORM=$(MALI_PLATFORM)
VERSION_STRINGS += KDIR=$(KDIR)
VERSION_STRINGS += OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
VERSION_STRINGS += USING_UMP=$(CONFIG_MALI400_UMP)
VERSION_STRINGS += USING_PROFILING=$(CONFIG_MALI400_PROFILING)
VERSION_STRINGS += USING_INTERNAL_PROFILING=$(CONFIG_MALI400_INTERNAL_PROFILING)
VERSION_STRINGS += USING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
VERSION_STRINGS += USING_DVFS=$(CONFIG_MALI_DVFS)
VERSION_STRINGS += MALI_UPPER_HALF_SCHEDULING=$(MALI_UPPER_HALF_SCHEDULING)

# Create file with Mali driver configuration
$(src)/__malidrv_build_info.c:
@echo 'const char *__malidrv_build_info(void) { return "malidrv: $(VERSION_STRINGS)";}' > $(src)/__malidrv_build_info.c
Loading