1# SPDX-License-Identifier: GPL-2.0+
2#
3# (C) Copyright 2014 - 2016 Xilinx, Inc.
4# Michal Simek <michal.simek@xilinx.com>
5
6obj-y	:= zynqmp.o
7
8ifneq ($(CONFIG_XILINX_PS_INIT_FILE),"")
9PS_INIT_FILE := $(shell cd $(srctree); readlink -f $(CONFIG_XILINX_PS_INIT_FILE))
10init-objs := ps_init_gpl.o
11spl/board/xilinx/zynqmp/ps_init_gpl.o board/xilinx/zynqmp/ps_init_gpl.o: $(PS_INIT_FILE)
12	$(CC) $(c_flags) -I $(srctree)/$(src) -c -o $@ $^
13endif
14
15DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
16ifeq ($(DEVICE_TREE),)
17DEVICE_TREE := unset
18endif
19
20ifeq ($(init-objs),)
21hw-platform-y :=$(shell echo $(DEVICE_TREE))
22init-objs := $(if $(wildcard $(srctree)/$(src)/$(hw-platform-y)/psu_init_gpl.c),\
23	$(hw-platform-y)/psu_init_gpl.o)
24endif
25
26ifeq ($(init-objs),)
27ifneq ($(wildcard $(srctree)/$(src)/psu_init_gpl.c),)
28init-objs := psu_init_gpl.o
29$(if $(CONFIG_SPL_BUILD),\
30$(warning Put custom psu_init_gpl.c/h to board/xilinx/zynqmp/custom_hw_platform/))
31endif
32endif
33
34ifdef_any_of = $(filter-out undefined,$(foreach v,$(1),$(origin $(v))))
35
36ifneq ($(call ifdef_any_of, CONFIG_ZYNQMP_PSU_INIT_ENABLED CONFIG_SPL_BUILD),)
37obj-y += $(init-objs)
38endif
39
40ifdef CONFIG_SPL_BUILD
41ifneq ($(CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE),"")
42obj-$(CONFIG_SPL_BUILD) += pm_cfg_obj.o
43$(obj)/pm_cfg_obj.o: $(shell cd $(srctree); readlink -f $(CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE)) FORCE
44endif
45endif
46
47obj-$(CONFIG_MMC_SDHCI_ZYNQ) += tap_delays.o
48
49ifndef CONFIG_SPL_BUILD
50obj-$(CONFIG_CMD_ZYNQMP) += cmds.o
51endif
52
53# Suppress "warning: function declaration isn't a prototype"
54CFLAGS_REMOVE_psu_init_gpl.o := -Wstrict-prototypes
55
56# To include xil_io.h
57CFLAGS_psu_init_gpl.o := -I$(srctree)/$(src)
58
59# To suppress "warning: cast to pointer from integer of different size"
60CFLAGS_psu_init_gpl.o += -Wno-int-to-pointer-cast
61