xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/mali400/mali/Makefile (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#
2*4882a593Smuzhiyun# Copyright (C) 2010-2017 ARM Limited. All rights reserved.
3*4882a593Smuzhiyun#
4*4882a593Smuzhiyun# This program is free software and is provided to you under the terms of the GNU General Public License version 2
5*4882a593Smuzhiyun# as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
6*4882a593Smuzhiyun#
7*4882a593Smuzhiyun# A copy of the licence is included with the program, and can also be obtained from Free Software
8*4882a593Smuzhiyun# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
9*4882a593Smuzhiyun#
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunUSE_UMPV2=0
12*4882a593SmuzhiyunUSING_PROFILING ?= 1
13*4882a593SmuzhiyunUSING_INTERNAL_PROFILING ?= 0
14*4882a593SmuzhiyunUSING_DVFS ?= 1
15*4882a593SmuzhiyunUSING_DMA_BUF_FENCE ?= 0
16*4882a593SmuzhiyunMALI_HEATMAPS_ENABLED ?= 0
17*4882a593SmuzhiyunMALI_DMA_BUF_MAP_ON_ATTACH ?= 1
18*4882a593SmuzhiyunMALI_PMU_PARALLEL_POWER_UP ?= 0
19*4882a593SmuzhiyunUSING_DT ?= 0
20*4882a593SmuzhiyunMALI_MEM_SWAP_TRACKING ?= 0
21*4882a593SmuzhiyunUSING_DEVFREQ ?= 0
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun# The Makefile sets up "arch" based on the CONFIG, creates the version info
24*4882a593Smuzhiyun# string and the __malidrv_build_info.c file, and then call the Linux build
25*4882a593Smuzhiyun# system to actually build the driver. After that point the Kbuild file takes
26*4882a593Smuzhiyun# over.
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun# set up defaults if not defined by the user
29*4882a593SmuzhiyunARCH ?= arm
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunOSKOS=linux
32*4882a593SmuzhiyunFILES_PREFIX=
33*4882a593Smuzhiyun
34*4882a593Smuzhiyuncheck_cc2 = \
35*4882a593Smuzhiyun	$(shell if $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
36*4882a593Smuzhiyun	then \
37*4882a593Smuzhiyun		echo "$(2)"; \
38*4882a593Smuzhiyun	else \
39*4882a593Smuzhiyun		echo "$(3)"; \
40*4882a593Smuzhiyun	fi ;)
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun# This conditional makefile exports the global definition ARM_INTERNAL_BUILD. Customer releases will not include arm_internal.mak
43*4882a593Smuzhiyun-include ../../../arm_internal.mak
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun# Give warning of old config parameters are used
46*4882a593Smuzhiyunifneq ($(CONFIG),)
47*4882a593Smuzhiyun$(warning "You have specified the CONFIG variable which is no longer in used. Use TARGET_PLATFORM instead.")
48*4882a593Smuzhiyunendif
49*4882a593Smuzhiyun
50*4882a593Smuzhiyunifneq ($(CPU),)
51*4882a593Smuzhiyun$(warning "You have specified the CPU variable which is no longer in used. Use TARGET_PLATFORM instead.")
52*4882a593Smuzhiyunendif
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun# Include the mapping between TARGET_PLATFORM and KDIR + MALI_PLATFORM
55*4882a593Smuzhiyun-include MALI_CONFIGURATION
56*4882a593Smuzhiyunexport KDIR ?= $(KDIR-$(TARGET_PLATFORM))
57*4882a593Smuzhiyunexport MALI_PLATFORM ?= $(MALI_PLATFORM-$(TARGET_PLATFORM))
58*4882a593Smuzhiyun
59*4882a593Smuzhiyunifneq ($(TARGET_PLATFORM),)
60*4882a593Smuzhiyunifeq ($(MALI_PLATFORM),)
61*4882a593Smuzhiyun$(error "Invalid TARGET_PLATFORM: $(TARGET_PLATFORM)")
62*4882a593Smuzhiyunendif
63*4882a593Smuzhiyunendif
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun# validate lookup result
66*4882a593Smuzhiyunifeq ($(KDIR),)
67*4882a593Smuzhiyun$(error No KDIR found for platform $(TARGET_PLATFORM))
68*4882a593Smuzhiyunendif
69*4882a593Smuzhiyun
70*4882a593Smuzhiyunifeq ($(USING_GPU_UTILIZATION), 1)
71*4882a593Smuzhiyun    ifeq ($(USING_DVFS), 1)
72*4882a593Smuzhiyun        $(error USING_GPU_UTILIZATION conflict with USING_DVFS you can read the Integration Guide to choose which one do you need)
73*4882a593Smuzhiyun    endif
74*4882a593Smuzhiyunendif
75*4882a593Smuzhiyun
76*4882a593Smuzhiyunifeq ($(USING_UMP),1)
77*4882a593Smuzhiyunexport CONFIG_MALI400_UMP=y
78*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI400_UMP=1
79*4882a593Smuzhiyunifeq ($(USE_UMPV2),1)
80*4882a593SmuzhiyunUMP_SYMVERS_FILE ?= ../umpv2/Module.symvers
81*4882a593Smuzhiyunelse
82*4882a593SmuzhiyunUMP_SYMVERS_FILE ?= ../ump/Module.symvers
83*4882a593Smuzhiyunendif
84*4882a593SmuzhiyunKBUILD_EXTRA_SYMBOLS = $(realpath $(UMP_SYMVERS_FILE))
85*4882a593Smuzhiyun$(warning $(KBUILD_EXTRA_SYMBOLS))
86*4882a593Smuzhiyunendif
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun# Define host system directory
89*4882a593SmuzhiyunKDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build
90*4882a593Smuzhiyun
91*4882a593Smuzhiyuninclude $(KDIR)/.config
92*4882a593Smuzhiyun
93*4882a593Smuzhiyunifeq ($(ARCH), arm)
94*4882a593Smuzhiyun# when compiling for ARM we're cross compiling
95*4882a593Smuzhiyunexport CROSS_COMPILE ?= $(call check_cc2, arm-linux-gnueabi-gcc, arm-linux-gnueabi-, arm-none-linux-gnueabi-)
96*4882a593Smuzhiyunendif
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun# report detected/selected settings
99*4882a593Smuzhiyunifdef ARM_INTERNAL_BUILD
100*4882a593Smuzhiyun$(warning TARGET_PLATFORM $(TARGET_PLATFORM))
101*4882a593Smuzhiyun$(warning KDIR $(KDIR))
102*4882a593Smuzhiyun$(warning MALI_PLATFORM $(MALI_PLATFORM))
103*4882a593Smuzhiyunendif
104*4882a593Smuzhiyun
105*4882a593Smuzhiyun# Set up build config
106*4882a593Smuzhiyunexport CONFIG_MALI400=m
107*4882a593Smuzhiyunexport CONFIG_MALI450=y
108*4882a593Smuzhiyunexport CONFIG_MALI470=y
109*4882a593Smuzhiyun
110*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI400=1
111*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI450=1
112*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI470=1
113*4882a593Smuzhiyun
114*4882a593Smuzhiyunifneq ($(MALI_PLATFORM),)
115*4882a593Smuzhiyunexport EXTRA_DEFINES += -DMALI_FAKE_PLATFORM_DEVICE=1
116*4882a593Smuzhiyunexport MALI_PLATFORM_FILES = $(wildcard platform/$(MALI_PLATFORM)/*.c)
117*4882a593Smuzhiyunendif
118*4882a593Smuzhiyun
119*4882a593Smuzhiyunifeq ($(USING_PROFILING),1)
120*4882a593Smuzhiyunifeq ($(CONFIG_TRACEPOINTS),)
121*4882a593Smuzhiyun$(warning CONFIG_TRACEPOINTS required for profiling)
122*4882a593Smuzhiyunelse
123*4882a593Smuzhiyunexport CONFIG_MALI400_PROFILING=y
124*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI400_PROFILING=1
125*4882a593Smuzhiyunifeq ($(USING_INTERNAL_PROFILING),1)
126*4882a593Smuzhiyunexport CONFIG_MALI400_INTERNAL_PROFILING=y
127*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI400_INTERNAL_PROFILING=1
128*4882a593Smuzhiyunendif
129*4882a593Smuzhiyunifeq ($(MALI_HEATMAPS_ENABLED),1)
130*4882a593Smuzhiyunexport MALI_HEATMAPS_ENABLED=y
131*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI400_HEATMAPS_ENABLED
132*4882a593Smuzhiyunendif
133*4882a593Smuzhiyunendif
134*4882a593Smuzhiyunendif
135*4882a593Smuzhiyun
136*4882a593Smuzhiyunifeq ($(MALI_DMA_BUF_MAP_ON_ATTACH),1)
137*4882a593Smuzhiyunexport CONFIG_MALI_DMA_BUF_MAP_ON_ATTACH=y
138*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI_DMA_BUF_MAP_ON_ATTACH
139*4882a593Smuzhiyunendif
140*4882a593Smuzhiyun
141*4882a593Smuzhiyunifeq ($(MALI_SHARED_INTERRUPTS),1)
142*4882a593Smuzhiyunexport CONFIG_MALI_SHARED_INTERRUPTS=y
143*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI_SHARED_INTERRUPTS
144*4882a593Smuzhiyunendif
145*4882a593Smuzhiyun
146*4882a593Smuzhiyunifeq ($(USING_DVFS),1)
147*4882a593Smuzhiyunexport CONFIG_MALI_DVFS=y
148*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI_DVFS
149*4882a593Smuzhiyunendif
150*4882a593Smuzhiyun
151*4882a593Smuzhiyunifeq ($(USING_DMA_BUF_FENCE),1)
152*4882a593Smuzhiyunexport CONFIG_MALI_DMA_BUF_FENCE=y
153*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI_DMA_BUF_FENCE
154*4882a593Smuzhiyunendif
155*4882a593Smuzhiyun
156*4882a593Smuzhiyunifeq ($(MALI_PMU_PARALLEL_POWER_UP),1)
157*4882a593Smuzhiyunexport CONFIG_MALI_PMU_PARALLEL_POWER_UP=y
158*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI_PMU_PARALLEL_POWER_UP
159*4882a593Smuzhiyunendif
160*4882a593Smuzhiyun
161*4882a593Smuzhiyunifdef CONFIG_OF
162*4882a593Smuzhiyunifeq ($(USING_DT),1)
163*4882a593Smuzhiyunexport CONFIG_MALI_DT=y
164*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI_DT
165*4882a593Smuzhiyunendif
166*4882a593Smuzhiyunendif
167*4882a593Smuzhiyun
168*4882a593Smuzhiyunifeq ($(USING_DEVFREQ), 1)
169*4882a593Smuzhiyunifdef CONFIG_PM_DEVFREQ
170*4882a593Smuzhiyunexport CONFIG_MALI_DEVFREQ=y
171*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI_DEVFREQ=1
172*4882a593Smuzhiyunelse
173*4882a593Smuzhiyun$(warning "You want to support DEVFREQ but kernel didn't support DEVFREQ.")
174*4882a593Smuzhiyunendif
175*4882a593Smuzhiyunendif
176*4882a593Smuzhiyun
177*4882a593Smuzhiyunifneq ($(BUILD),release)
178*4882a593Smuzhiyun# Debug
179*4882a593Smuzhiyunexport CONFIG_MALI400_DEBUG=y
180*4882a593Smuzhiyunelse
181*4882a593Smuzhiyun# Release
182*4882a593Smuzhiyunifeq ($(MALI_QUIET),1)
183*4882a593Smuzhiyunexport CONFIG_MALI_QUIET=y
184*4882a593Smuzhiyunexport EXTRA_DEFINES += -DCONFIG_MALI_QUIET
185*4882a593Smuzhiyunendif
186*4882a593Smuzhiyunendif
187*4882a593Smuzhiyun
188*4882a593Smuzhiyunifeq ($(MALI_SKIP_JOBS),1)
189*4882a593SmuzhiyunEXTRA_DEFINES += -DPROFILING_SKIP_PP_JOBS=1 -DPROFILING_SKIP_GP_JOBS=1
190*4882a593Smuzhiyunendif
191*4882a593Smuzhiyun
192*4882a593Smuzhiyunifeq ($(MALI_MEM_SWAP_TRACKING),1)
193*4882a593SmuzhiyunEXTRA_DEFINES += -DMALI_MEM_SWAP_TRACKING=1
194*4882a593Smuzhiyunendif
195*4882a593Smuzhiyun
196*4882a593Smuzhiyunall: $(UMP_SYMVERS_FILE)
197*4882a593Smuzhiyun	$(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) modules
198*4882a593Smuzhiyun	@rm $(FILES_PREFIX)__malidrv_build_info.c $(FILES_PREFIX)__malidrv_build_info.o
199*4882a593Smuzhiyun
200*4882a593Smuzhiyunclean:
201*4882a593Smuzhiyun	$(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean
202*4882a593Smuzhiyun
203*4882a593Smuzhiyunkernelrelease:
204*4882a593Smuzhiyun	$(MAKE) ARCH=$(ARCH) -C $(KDIR) kernelrelease
205*4882a593Smuzhiyun
206*4882a593Smuzhiyunexport CONFIG KBUILD_EXTRA_SYMBOLS
207