From de3e3d848b88709a98efde55e90b25ce2595aaa9 Mon Sep 17 00:00:00 2001 From: Srinivas Ramana Date: Tue, 31 May 2016 11:11:52 +0530 Subject: [PATCH 1/5] mach-qcom: add support to populate dt nodes for 32-bit platforms Add support to populate device tree nodes for the new 32-bit platforms under under mach-qcom. Change-Id: I5fd747de84917c16f28f3f72d7b34b5db157637c Signed-off-by: Srinivas Ramana Signed-off-by: Tengfei Fan Signed-off-by: Jeevan Shriram --- arch/arm/mach-qcom/Makefile | 1 + arch/arm/mach-qcom/board-dt.c | 21 +++++++++++++++++++++ arch/arm/mach-qcom/board-dt.h | 8 ++++++++ 3 files changed, 30 insertions(+) create mode 100644 arch/arm/mach-qcom/board-dt.c create mode 100644 arch/arm/mach-qcom/board-dt.h diff --git a/arch/arm/mach-qcom/Makefile b/arch/arm/mach-qcom/Makefile index b839201c9802..8c3a333a46fa 100644 --- a/arch/arm/mach-qcom/Makefile +++ b/arch/arm/mach-qcom/Makefile @@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_SMP) += platsmp.o +obj-$(CONFIG_USE_OF) += board-dt.o diff --git a/arch/arm/mach-qcom/board-dt.c b/arch/arm/mach-qcom/board-dt.c new file mode 100644 index 000000000000..1e3d1468544a --- /dev/null +++ b/arch/arm/mach-qcom/board-dt.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. + */ + +#include +#include +#include + +#include "board-dt.h" + +void __init board_dt_populate(struct of_dev_auxdata *adata) +{ + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + + /* Explicitly parent the /soc devices to the root node to preserve + * the kernel ABI (sysfs structure, etc) until userspace is updated + */ + of_platform_populate(of_find_node_by_path("/soc"), + of_default_bus_match_table, adata, NULL); +} diff --git a/arch/arm/mach-qcom/board-dt.h b/arch/arm/mach-qcom/board-dt.h new file mode 100644 index 000000000000..7ca9f994c0a2 --- /dev/null +++ b/arch/arm/mach-qcom/board-dt.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. + */ + +#include + +void __init board_dt_populate(struct of_dev_auxdata *adata); From 56f0491c1ebc610f91a7e35617393c2182aead52 Mon Sep 17 00:00:00 2001 From: Jeevan Shriram Date: Wed, 15 Feb 2017 01:30:02 -0800 Subject: [PATCH 2/5] arch: arm: generalise ARCH_QCOM platform generalise ARCH_QCOM platform to support new 32-bit qcom platforms. Change-Id: I412a83a2f756b02d6b521983501de780835dc118 Signed-off-by: Srinivas Ramana [akdwived: Added "select GENERIC_IRQ_MIGRATION" with hotplug] Signed-off-by: Avaneesh Kumar Dwivedi [snaseem@codeaurora.org: Resolve merge conflict] Signed-off-by: Shadab Naseem [tengfeif@codeaurora.org: Remove duplicate config included in bengal] Signed-off-by: Tengfei Fan [jshriram: Fix merge conflicts] Signed-off-by: Jeevan Shriram --- arch/arm/Kconfig | 29 +++++++++++++++++++-- arch/arm/Kconfig.debug | 2 +- arch/arm/mach-qcom/Kconfig | 53 +++++++++++++++++++++++++++++++------- 3 files changed, 71 insertions(+), 13 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 05c9bbfe444d..38e1aa6e3f6f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -42,7 +42,7 @@ config ARM select CPU_PM if SUSPEND || CPU_IDLE select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS select DMA_DECLARE_COHERENT - select DMA_REMAP if MMU + select DMA_DIRECT_REMAP select EDAC_SUPPORT select EDAC_ATOMIC_SCRUB select GENERIC_ALLOCATOR @@ -453,6 +453,31 @@ config ARCH_PXA help Support for Intel/Marvell's PXA2xx/PXA3xx processor line. +config ARCH_QCOM + bool "Qualcomm MSM (non-multiplatform)" + select ARCH_REQUIRE_GPIOLIB + select CPU_V7 + select AUTO_ZRELADDR + select HAVE_SMP + select CLKDEV_LOOKUP + select GENERIC_CLOCKEVENTS + select GENERIC_ALLOCATOR + select ARM_PATCH_PHYS_VIRT + select ARM_HAS_SG_CHAIN + select ARCH_HAS_OPP + select SOC_BUS + select GENERIC_IRQ_MULTI_HANDLER + select PM_OPP + select SPARSE_IRQ + select USE_OF + select PINCTRL + help + Support for Qualcomm MSM/QSD based systems. This runs on the + apps processor of the MSM/QSD and depends on a shared memory + interface to the modem processor which runs the baseband + stack and controls some vital subsystems + (clock and power control, etc). + config ARCH_RPC bool "RiscPC" depends on MMU @@ -1360,7 +1385,7 @@ config ARCH_NR_GPIO int default 2048 if ARCH_SOCFPGA default 1024 if ARCH_BRCMSTB || ARCH_RENESAS || ARCH_TEGRA || \ - ARCH_ZYNQ + ARCH_ZYNQ || ARCH_QCOM default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || \ SOC_DRA7XX || ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 default 416 if ARCH_SUNXI diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 8bcbd0cd739b..b38e674f9766 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -1878,7 +1878,7 @@ config DEBUG_UNCOMPRESS config UNCOMPRESS_INCLUDE string default "debug/uncompress.h" if ARCH_MULTIPLATFORM || ARCH_MSM || \ - PLAT_SAMSUNG || ARM_SINGLE_ARMV7M + ARCH_QCOM || PLAT_SAMSUNG || ARM_SINGLE_ARMV7M default "mach/uncompress.h" config EARLY_PRINTK diff --git a/arch/arm/mach-qcom/Kconfig b/arch/arm/mach-qcom/Kconfig index ecbf3c4eb878..3667279e4f4f 100644 --- a/arch/arm/mach-qcom/Kconfig +++ b/arch/arm/mach-qcom/Kconfig @@ -1,31 +1,64 @@ # SPDX-License-Identifier: GPL-2.0-only -menuconfig ARCH_QCOM - bool "Qualcomm Support" - depends on ARCH_MULTI_V7 - select ARCH_SUPPORTS_BIG_ENDIAN - select ARM_GIC - select ARM_AMBA - select PINCTRL - select QCOM_SCM if SMP - help - Support for Qualcomm's devicetree based systems. if ARCH_QCOM +menu "QCOM SoC Type" config ARCH_MSM8X60 bool "Enable support for MSM8X60" + select ARCH_SUPPORTS_BIG_ENDIAN + select ARM_GIC + select ARM_AMBA + select QCOM_SCM if SMP select CLKSRC_QCOM + select CLKSRC_OF + select COMMON_CLK config ARCH_MSM8960 bool "Enable support for MSM8960" select CLKSRC_QCOM + select ARCH_SUPPORTS_BIG_ENDIAN + select ARM_GIC + select ARM_AMBA + select QCOM_SCM if SMP + select CLKSRC_OF + select COMMON_CLK + config ARCH_MSM8974 bool "Enable support for MSM8974" select HAVE_ARM_ARCH_TIMER + select ARCH_SUPPORTS_BIG_ENDIAN + select ARM_GIC + select ARM_AMBA + select QCOM_SCM if SMP + select CLKSRC_OF + select COMMON_CLK config ARCH_MDM9615 bool "Enable support for MDM9615" select CLKSRC_QCOM + select ARCH_SUPPORTS_BIG_ENDIAN + select ARM_GIC + select ARM_AMBA + select QCOM_SCM if SMP + select CLKSRC_OF + select COMMON_CLK +config ARCH_SDXLEMUR + bool "Enable support for SDXLEMUR" + select CPU_V7 + select ARM_GIC + select HAVE_ARM_ARCH_TIMER + select MSM_CORTEX_A7 + select PINCTRL + select PCI + select QCOM_SCM if SMP + select MSM_JTAG_MM if CORESIGHT_ETM + select PM_DEVFREQ + select COMMON_CLK + select COMMON_CLK_QCOM + select QCOM_GDSC + select GENERIC_CLOCKEVENTS_BROADCAST + +endmenu endif From 90711737ad68b35219074e681f447d64c05a11ef Mon Sep 17 00:00:00 2001 From: Jeevan Shriram Date: Wed, 15 Feb 2017 01:14:22 -0800 Subject: [PATCH 3/5] ARM: build correct dtbs to append to zImage The boot/dts/Makefile and boot/dts/*/Makefile provide DTB_LIST which is equal to dtb-y when CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE=y. Include these Makefiles to build dtbs for dtb appended zImage. Change-Id: Ib8218135dc923d1ba4098d74dbd7da159368a188 Signed-off-by: Joonwoo Park [abhimany: resolve trivial merge conflict] Signed-off-by: Abhimanyu Kapur [sramana: Fixed merge conflicts] Signed-off-by: Srinivas Ramana [jshriram: Fix trivial merge conflicts] Signed-off-by: Jeevan Shriram [akdwived: Fix trivial merge conflicts] Signed-off-by: Avaneesh Kumar Dwivedi --- arch/arm/Makefile | 11 +++++++++++ arch/arm/boot/Makefile | 6 ++++-- arch/arm/boot/dts/Makefile | 6 ++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index db857d07114f..d98f977b0162 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -318,6 +318,7 @@ endif all: $(notdir $(KBUILD_IMAGE)) +DTSSUBDIR := qcom archheaders: $(Q)$(MAKE) $(build)=arch/arm/tools uapi @@ -343,12 +344,22 @@ $(BOOT_TARGETS): vmlinux $(INSTALL_TARGETS): $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ +%.dtb: | scripts + $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ + +dtbs: scripts + $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs + $(foreach DIR, $(DTSSUBDIR), $(Q)$(MAKE) $(build)=$(boot)/dts/$(DIR) MACHINE=$(MACHINE) dtbs) + PHONY += vdso_install vdso_install: ifeq ($(CONFIG_VDSO),y) $(Q)$(MAKE) $(build)=arch/arm/vdso $@ endif +zImage-dtb: vmlinux scripts dtbs + $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) DTSSUBDIR=$(DTSSUBDIR) $(boot)/$@ + # We use MRPROPER_FILES and CLEAN_FILES now archclean: $(Q)$(MAKE) $(clean)=$(boot) diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile index 0b3cd7a33a26..9ac38e172e08 100644 --- a/arch/arm/boot/Makefile +++ b/arch/arm/boot/Makefile @@ -13,8 +13,10 @@ OBJCOPYFLAGS :=-O binary -R .comment -S -ifneq ($(MACHINE),) -include $(MACHINE)/Makefile.boot +include $(srctree)/arch/arm/boot/dts/Makefile +ifneq ($(DTSSUBDIR),) +DTSSUBDIR_INCS=$(foreach DIR, $(DTSSUBDIR), $(addsuffix /Makefile, $(addprefix $(srctree)/arch/arm/boot/dts/, $(DIR)))) +include $(DTSSUBDIR_INCS) endif # Note: the following conditions must always be true: diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index b21b3a64641a..4dbd3e340447 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -1303,3 +1303,9 @@ dtb-$(CONFIG_ARCH_ASPEED) += \ aspeed-bmc-opp-zaius.dtb \ aspeed-bmc-portwell-neptune.dtb \ aspeed-bmc-quanta-q71l.dtb + +dtstree := $(srctree)/$(src) +vendor := $(dtstree)/vendor +ifneq "$(wildcard $(vendor)/Makefile)" "" + subdir-y += vendor +endif From f1102b80271888e54ae5ef99d4b12e6f265dfa92 Mon Sep 17 00:00:00 2001 From: Erik Gilling Date: Mon, 25 Mar 2013 15:04:41 -0700 Subject: [PATCH 4/5] ANDROID: ARM: add config option to build zImage/dtb combo Allows a defconfig to set a default dtb to concatenate with a zImage to create a zImage-dtb.. Change-Id: I34b643b1c49228fbae88a56e46c93c478089620d Signed-off-by: Erik Gilling Git-commit: 23a70d4e7b8864cf405f997d3608de65a82cf87d Git-repo: https://android.googlesource.com/kernel/common [jshriram@codeaurora.org: Fixed minor merge conflicts] Signed-off-by: Jeevan Shriram --- arch/arm/Kconfig | 15 +++++++++++++++ arch/arm/Makefile | 2 ++ 2 files changed, 17 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 38e1aa6e3f6f..61109752e45a 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1766,6 +1766,21 @@ config DEPRECATED_PARAM_STRUCT This was deprecated in 2001 and announced to live on for 5 years. Some old boot loaders still use this way. +config BUILD_ARM_APPENDED_DTB_IMAGE + bool "Build a concatenated zImage/dtb by default" + depends on OF + help + Enabling this option will cause a concatenated zImage and DTB to + be built by default (instead of a standalone zImage.) The image + will built in arch/arm/boot/zImage-dtb. + +config BUILD_ARM_APPENDED_DTB_IMAGE_NAME + string "Default dtb name" + depends on BUILD_ARM_APPENDED_DTB_IMAGE + help + name of the dtb to append when building a concatenated + zImage/dtb. + # Compressed boot loader in ROM. Yes, we really want to ask about # TEXT and BSS so we preserve their values in the config files. config ZBOOT_ROM_TEXT diff --git a/arch/arm/Makefile b/arch/arm/Makefile index d98f977b0162..a2b8634aade1 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -300,6 +300,8 @@ libs-y := arch/arm/lib/ $(libs-y) boot := arch/arm/boot ifeq ($(CONFIG_XIP_KERNEL),y) KBUILD_IMAGE := $(boot)/xipImage +else ifeq ($(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE),y) +KBUILD_IMAGE := $(boot)/zImage-dtb.$(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAME) else KBUILD_IMAGE := $(boot)/zImage endif From d3cddb0cac7c250da0724612167b5e77e9fb88e7 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 21 Apr 2020 19:20:24 -0700 Subject: [PATCH 5/5] ARM: convert build of appended dtb zImage to list of dtbs Allow CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES to specify a space separated list of dtbs to append to the zImage, and name the resulting file zImage-dtb. Change-Id: Ied5d0bafbd1d01fc1f109c15c4283de7029903c9 Signed-off-by: Colin Cross Git-commit: 9bb8731d87eba59fe7f0e504f11f5dc995ae1166 Git-repo: https://android.googlesource.com/kernel/common [jshriram@codeaurora.org: Fixed minor merge conflicts] Signed-off-by: Jeevan Shriram --- arch/arm/Kconfig | 10 +++++----- arch/arm/Makefile | 2 +- arch/arm/boot/.gitignore | 1 + arch/arm/boot/Makefile | 12 ++++++++++++ arch/arm/boot/dts/Makefile | 10 ++++++++++ scripts/Makefile.lib | 4 ++++ 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 61109752e45a..377f503f3a23 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1770,16 +1770,16 @@ config BUILD_ARM_APPENDED_DTB_IMAGE bool "Build a concatenated zImage/dtb by default" depends on OF help - Enabling this option will cause a concatenated zImage and DTB to - be built by default (instead of a standalone zImage.) The image - will built in arch/arm/boot/zImage-dtb. + Enabling this option will cause a concatenated zImage and list of + DTBs to be built by default (instead of a standalone zImage.) + The image will built in arch/arm/boot/zImage-dtb config BUILD_ARM_APPENDED_DTB_IMAGE_NAME string "Default dtb name" depends on BUILD_ARM_APPENDED_DTB_IMAGE help - name of the dtb to append when building a concatenated - zImage/dtb. + Space separated list of names of dtbs to append when building a + concatenated zImage-dtb. # Compressed boot loader in ROM. Yes, we really want to ask about # TEXT and BSS so we preserve their values in the config files. diff --git a/arch/arm/Makefile b/arch/arm/Makefile index a2b8634aade1..4d15d69ee4fa 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -301,7 +301,7 @@ boot := arch/arm/boot ifeq ($(CONFIG_XIP_KERNEL),y) KBUILD_IMAGE := $(boot)/xipImage else ifeq ($(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE),y) -KBUILD_IMAGE := $(boot)/zImage-dtb.$(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAME) +KBUILD_IMAGE := $(boot)/zImage-dtb else KBUILD_IMAGE := $(boot)/zImage endif diff --git a/arch/arm/boot/.gitignore b/arch/arm/boot/.gitignore index ce1c5ff746e7..025d8aaf013d 100644 --- a/arch/arm/boot/.gitignore +++ b/arch/arm/boot/.gitignore @@ -3,3 +3,4 @@ zImage xipImage bootpImage uImage +zImage-dtb diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile index 9ac38e172e08..1072edf8ddf7 100644 --- a/arch/arm/boot/Makefile +++ b/arch/arm/boot/Makefile @@ -31,6 +31,14 @@ export ZRELADDR INITRD_PHYS PARAMS_PHYS targets := Image zImage xipImage bootpImage uImage +DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES)) +ifneq ($(DTB_NAMES),) +DTB_LIST := $(addsuffix .dtb,$(DTB_NAMES)) +else +DTB_LIST := $(dtb-y) +endif +DTB_OBJS := $(addprefix $(obj)/dts/,$(DTB_LIST)) + ifeq ($(CONFIG_XIP_KERNEL),y) cmd_deflate_xip_data = $(CONFIG_SHELL) -c \ @@ -68,6 +76,10 @@ $(obj)/compressed/vmlinux: $(obj)/Image FORCE $(obj)/zImage: $(obj)/compressed/vmlinux FORCE $(call if_changed,objcopy) +$(obj)/zImage-dtb: $(obj)/zImage $(DTB_OBJS) FORCE + $(call if_changed,cat) + @echo ' Kernel: $@ is ready' + endif ifneq ($(LOADADDR),) diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 4dbd3e340447..bba20b1c1108 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -1309,3 +1309,13 @@ vendor := $(dtstree)/vendor ifneq "$(wildcard $(vendor)/Makefile)" "" subdir-y += vendor endif + +DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES)) +ifneq ($(DTB_NAMES),) +DTB_LIST := $(addsuffix .dtb,$(DTB_NAMES)) +else +DTB_LIST := $(dtb-y) +endif + +targets += dtbs dtbs_install +targets += $(DTB_LIST) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index dfbb9165d205..eda92e3e4a19 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -310,6 +310,10 @@ $(obj)/%.dt.yaml: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) +# Concatentate multiple files together +quiet_cmd_cat = CAT $@ +cmd_cat = (cat $(filter-out FORCE,$^) > $@) || (rm -f $@; false) + # Bzip2 # ---------------------------------------------------------------------------