[PATCH 8/8] board: add support for Qualcomm SA8155P-ADP board

Volodymyr Babchuk Volodymyr_Babchuk at epam.com
Thu Feb 29 15:21:09 CET 2024


SA8155P Automotive Development Platform is Qualcomm SA8155-based board
for developers. The nice thing that it has unlocked loaders with test
keys support, which means that U-Boot for this platform can be
launched at earlier stages.

This patch adds basic board support with only serial port and
networking operation. I am using U-Boot to ease up Xen porting onto
this board, so I am mostly interesting in booting U-Boot in EL2. But
more conventional setup with Android boot image is supported as well.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk at epam.com>

---

 arch/arm/dts/sa8155p-adp-u-boot.dtsi     | 30 ++++++++
 arch/arm/mach-snapdragon/Kconfig         | 14 ++++
 arch/arm/mach-snapdragon/Makefile        |  2 +
 arch/arm/mach-snapdragon/init_sa8155p.c  | 30 ++++++++
 arch/arm/mach-snapdragon/sysmap-sm8150.c | 31 ++++++++
 board/qualcomm/sa8155p-adp/Kconfig       | 12 +++
 board/qualcomm/sa8155p-adp/MAINTAINERS   |  6 ++
 configs/sa8155p_adp_defconfig            | 33 +++++++++
 doc/board/qualcomm/index.rst             |  1 +
 doc/board/qualcomm/sa8155p-adp.rst       | 94 ++++++++++++++++++++++++
 include/configs/sa8155p_adp.h            | 25 +++++++
 11 files changed, 278 insertions(+)
 create mode 100644 arch/arm/dts/sa8155p-adp-u-boot.dtsi
 create mode 100644 arch/arm/mach-snapdragon/init_sa8155p.c
 create mode 100644 arch/arm/mach-snapdragon/sysmap-sm8150.c
 create mode 100644 board/qualcomm/sa8155p-adp/Kconfig
 create mode 100644 board/qualcomm/sa8155p-adp/MAINTAINERS
 create mode 100644 configs/sa8155p_adp_defconfig
 create mode 100644 doc/board/qualcomm/sa8155p-adp.rst
 create mode 100644 include/configs/sa8155p_adp.h

diff --git a/arch/arm/dts/sa8155p-adp-u-boot.dtsi b/arch/arm/dts/sa8155p-adp-u-boot.dtsi
new file mode 100644
index 0000000000..4484ea2734
--- /dev/null
+++ b/arch/arm/dts/sa8155p-adp-u-boot.dtsi
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Qualcomm SA8155P-ADP device tree fixups for U-BOot
+ *
+ * Volodymyr Babchuk <volodymyr_babchuk at epam.com>
+ * Copyright (c) 2024 EPAM Systems.
+ */
+
+/ {
+	/* Populate memory node with actual memory configuration */
+	memory at 80000000 {
+		reg = <0x00 0x80000000 0x00 0x39900000> ,
+		      <0x02 0x0        0x1  0x7fd00000>,
+		      <0x00 0xC0000000 0x1  0x40000000>;
+	};
+};
+
+&ethernet {
+	/* Ethernet driver tries to find reset by name */
+	reset-names = "emac";
+};
+
+&tlmm {
+	/* U-Boot pinctrl driver does not understand multiple tiles */
+	reg = <0x0 0x03000000 0x0 0x1000000>;
+	/delete-property/ reg-names;
+
+	/* U-Boot ethernet driver wants to drive reset as GPIO */
+	/delete-node/ phy-reset-pins;
+};
diff --git a/arch/arm/mach-snapdragon/Kconfig b/arch/arm/mach-snapdragon/Kconfig
index ad66710819..6431b6eca0 100644
--- a/arch/arm/mach-snapdragon/Kconfig
+++ b/arch/arm/mach-snapdragon/Kconfig
@@ -19,6 +19,12 @@ config SDM845
 	imply PINCTRL_QCOM_SDM845
 	imply BUTTON_QCOM_PMIC
 
+config SM8150
+	bool "Qualcomm Snapdragon 855 SoC"
+	select LINUX_KERNEL_IMAGE_HEADER
+	imply CLK_QCOM_SM8150
+	imply PINCTRL_QCOM_SDM8150
+
 config LNX_KRNL_IMG_TEXT_OFFSET_BASE
 	default 0x80000000
 
@@ -90,6 +96,13 @@ config TARGET_QCS404EVB
 	  - 1GiB RAM
 	  - 8GiB eMMC, uSD slot
 
+config TARGET_SA8155P_ADP
+	bool "SA8155 Automotive Development Platform"
+	help
+	  Support for Lantronix/Qualcomm SA8155P Automotive Development Platform
+	  based on Snapdragon SA8155P
+	select SM8150
+
 endchoice
 
 source "board/qualcomm/dragonboard410c/Kconfig"
@@ -97,5 +110,6 @@ source "board/qualcomm/dragonboard820c/Kconfig"
 source "board/qualcomm/dragonboard845c/Kconfig"
 source "board/samsung/starqltechn/Kconfig"
 source "board/qualcomm/qcs404-evb/Kconfig"
+source "board/qualcomm/sa8155p-adp/Kconfig"
 
 endif
diff --git a/arch/arm/mach-snapdragon/Makefile b/arch/arm/mach-snapdragon/Makefile
index 3a3a297c17..ff2887e384 100644
--- a/arch/arm/mach-snapdragon/Makefile
+++ b/arch/arm/mach-snapdragon/Makefile
@@ -4,8 +4,10 @@
 
 obj-$(CONFIG_SDM845) += sysmap-sdm845.o
 obj-$(CONFIG_SDM845) += init_sdm845.o
+obj-$(CONFIG_SM8150) += sysmap-sm8150.o
 obj-$(CONFIG_TARGET_DRAGONBOARD820C) += sysmap-apq8096.o
 obj-$(CONFIG_TARGET_DRAGONBOARD410C) += sysmap-apq8016.o
 obj-y += misc.o
 obj-y += dram.o
 obj-$(CONFIG_TARGET_QCS404EVB) += sysmap-qcs404.o
+obj-$(CONFIG_TARGET_SA8155P_ADP) += init_sa8155p.o
diff --git a/arch/arm/mach-snapdragon/init_sa8155p.c b/arch/arm/mach-snapdragon/init_sa8155p.c
new file mode 100644
index 0000000000..64dd07ae92
--- /dev/null
+++ b/arch/arm/mach-snapdragon/init_sa8155p.c
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Qualcomm SM8150 initialization procedures
+ *
+ * Volodymyr Babchuk <volodymyr_babchuk at epam.com>
+ * Copyright (c) 2024 EPAM Systems.
+ */
+
+#include <init.h>
+#include <env.h>
+#include <asm/system.h>
+#include <dm.h>
+#include <asm/arch/misc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+	return fdtdec_setup_mem_size_base();
+}
+
+void reset_cpu(void)
+{
+	psci_system_reset();
+}
+
+int board_init(void)
+{
+	return 0;
+}
diff --git a/arch/arm/mach-snapdragon/sysmap-sm8150.c b/arch/arm/mach-snapdragon/sysmap-sm8150.c
new file mode 100644
index 0000000000..7250f5b398
--- /dev/null
+++ b/arch/arm/mach-snapdragon/sysmap-sm8150.c
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Qualcomm SM8150 memory map
+ *
+ * Volodymyr Babchuk <volodymyr_babchuk at epam.com>
+ * Copyright (c) 2024 EPAM Systems.
+ */
+
+#include <asm/armv8/mmu.h>
+
+static struct mm_region sm8150_mem_map[] = {
+	{
+		.virt = 0x0UL, /* Peripheral block */
+		.phys = 0x0UL, /* Peripheral block */
+		.size = 0x10000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		.virt = 0x80000000UL, /* DDR */
+		.phys = 0x80000000UL, /* DDR */
+		.size = 0x200000000UL, /* 8GiB - maximum allowed memory */
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		/* List terminator */
+		0,
+	}
+};
+
+struct mm_region *mem_map = sm8150_mem_map;
diff --git a/board/qualcomm/sa8155p-adp/Kconfig b/board/qualcomm/sa8155p-adp/Kconfig
new file mode 100644
index 0000000000..420d594e35
--- /dev/null
+++ b/board/qualcomm/sa8155p-adp/Kconfig
@@ -0,0 +1,12 @@
+if TARGET_SA8155P_ADP
+
+config SYS_BOARD
+	default "sa8155p_adp"
+
+config SYS_CONFIG_NAME
+	default "sa8155p_adp"
+
+config SYS_VENDOR
+	default "qualcomm"
+
+endif
diff --git a/board/qualcomm/sa8155p-adp/MAINTAINERS b/board/qualcomm/sa8155p-adp/MAINTAINERS
new file mode 100644
index 0000000000..28edd643da
--- /dev/null
+++ b/board/qualcomm/sa8155p-adp/MAINTAINERS
@@ -0,0 +1,6 @@
+Qualcomm Robotics RB3 Development Platform (dragonboard845c)
+M:	Volodymyr Babchuk <volodymyr_babchuk at epam.com>
+S:	Maintained
+F:	board/qualcomm/sa8155p-adp/
+F:	include/configs/sa8155p-adp.h
+F:	configs/sa8155p-adp_defconfig
diff --git a/configs/sa8155p_adp_defconfig b/configs/sa8155p_adp_defconfig
new file mode 100644
index 0000000000..40f275b2cb
--- /dev/null
+++ b/configs/sa8155p_adp_defconfig
@@ -0,0 +1,33 @@
+CONFIG_ARM=y
+CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=19000000
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK=y
+CONFIG_ARCH_SNAPDRAGON=y
+CONFIG_TEXT_BASE=0x85710000
+CONFIG_DEFAULT_DEVICE_TREE="sa8155p-adp"
+CONFIG_TARGET_SA8155P_ADP=y
+CONFIG_IDENT_STRING="\nQualcomm SA8155P-ADP"
+CONFIG_SYS_LOAD_ADDR=0x85710000
+CONFIG_BOOTDELAY=3
+CONFIG_SYS_CBSIZE=512
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_HUSH_PARSER=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_CLK=y
+CONFIG_MSM_GPIO=y
+CONFIG_QCOM_PMIC_GPIO=y
+CONFIG_PHY_MICREL=y
+CONFIG_PHY_MICREL_KSZ90X1=y
+CONFIG_DM_MDIO=y
+CONFIG_DM_ETH_PHY=y
+CONFIG_DWC_ETH_QOS=y
+CONFIG_DWC_ETH_QOS_QCOM=y
+CONFIG_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCONF=y
+CONFIG_PINCTRL_QCOM_SM8150=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MSM_GENI_SERIAL=y
+CONFIG_SPMI_MSM=y
+CONFIG_LMB_MAX_REGIONS=64
diff --git a/doc/board/qualcomm/index.rst b/doc/board/qualcomm/index.rst
index 0f9c429956..05195de905 100644
--- a/doc/board/qualcomm/index.rst
+++ b/doc/board/qualcomm/index.rst
@@ -9,3 +9,4 @@ Qualcomm
    dragonboard410c
    sdm845
    qcs404
+   sa8155p-adp
diff --git a/doc/board/qualcomm/sa8155p-adp.rst b/doc/board/qualcomm/sa8155p-adp.rst
new file mode 100644
index 0000000000..cff68cd55f
--- /dev/null
+++ b/doc/board/qualcomm/sa8155p-adp.rst
@@ -0,0 +1,94 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+.. sectionauthor:: Volodymyr Babchuk <volodymyr_babchuk at epam.com>
+
+SA8155P Automotive Development Platform
+=======================================
+
+About
+-----
+This document describes the information about SA8155P Automotive
+Development Platform aka SA8155P-ADP.
+
+Currently U-Boot can be booted either as Android boot image, or in EL2
+mode, instead of hypervisor image. In the latter case it is possible
+to use U-Boot to either boot Linux with KVM support or to boot Xen
+Hypervisor on this board.
+
+Supported HW modules
+^^^^^^^^^^^^^^^^^^^^
+Port for this board is in early development state. Right now U-Boot
+supports serial console and networking. No USB/fastboot or UFS support
+yet. So it is not possible to save environment variables as
+well. Nevertheless this is enough for development as user can download
+all required images via TFTP.
+
+Installation
+------------
+Build
+^^^^^
+Setup ``CROSS_COMPILE`` for aarch64 and build U-Boot for your board::
+
+	$ export CROSS_COMPILE=<aarch64 toolchain prefix>
+	$ make sa8155p_adp_defconfig
+	$ make
+
+This will build ``u-boot.bin`` in the configured output directory.
+
+Boot in EL1 mode instead of Android boot image
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Create a dummy ramdisk image:::
+
+	$ echo "This is not a ramdisk" > ramdisk.img
+
+Compress u-boot binary:::
+
+	$ gzip -c u-boot.bin > u-boot.bin.gz
+
+Append DTB again (binary we use already have DTB embedded in, but
+Android boot image format requires another DTB at the end of the
+archive):::
+
+	$ cat u-boot.bin.gz u-boot.dtb > u-boot.bin.gz-dtb
+
+Now we've got everything to build android boot image:::
+
+	$ mkbootimg --kernel u-boot.bin.gz-dtb \
+	--ramdisk ramdisk.img --pagesize 4096 \
+	--base 0x80000000 -o boot.img
+
+Finally you can flash new boot image with fastboot:::
+
+	$ fastboot flash boot boot.img
+
+Or just boot U-Boot without flashing anything:::
+
+	$ fastboot boot boot.img
+
+Boot in EL2 mode instead of Qualcomm's hypervisor stub
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+This approach ensures that U-Boot is booted in EL2 and it is possible
+to run virtualization software (like Xen or KVM) on the board. You
+must understand that this approach breaks Qualcomm's boot chain. You
+will not be able to call all subsequent loaders, so you will not be
+able to use fastboot for example. Use this approach only if you want
+to experiment with virtualization on SA8155P-ADP.
+
+We need to create ELF file from the u-boot binary. We can't use
+existing U-Boot ELF, because it does not include appended DTB
+file. Easiest way to do this is to use ``create_elf.py`` from the
+following repository: `qtestsign(lorc)
+<https://github.com/lorc/qtestsign/tree/create_elf>`_: ::
+
+	$ python ../qtestsign/create_elf.py u-boot.bin 0x85710000 u-boot.mbn
+
+Next, this new binary should be signed with test keys: ::
+
+	$ ../qtestsign/qtestsign.py -v6 hyp u-boot.mbn
+
+Resulting ``u-boot-test-signed.mbn`` then can be written to the
+board. Easiest way is to use ``edl`` tool: ::
+
+	$ ../edl/edl w hyp_a u-boot-test-signed.mbn --memory=ufs --lun=4
+
+Be sure to backup existing hyp_a loader before flashing U-Boot
diff --git a/include/configs/sa8155p_adp.h b/include/configs/sa8155p_adp.h
new file mode 100644
index 0000000000..e986646334
--- /dev/null
+++ b/include/configs/sa8155p_adp.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Configuration file for SA8155P Automotive development platform,
+ * based on Qualcomm SA8155P chip
+ *
+ * Volodymyr Babchuk <volodymyr_babchuk at epam.com>
+ * Copyright (c) 2024 EPAM Systems.
+ */
+
+#ifndef __CONFIGS_SA8155P_ADP_H
+#define __CONFIGS_SA8155P_ADP_H
+
+#include <linux/sizes.h>
+
+#define CFG_SYS_BAUDRATE_TABLE	{ 115200, 230400, 460800, 921600 }
+
+#define CFG_EXTRA_ENV_SETTINGS \
+	"bootm_size=0x10000000\0"	\
+	"bootm_low=0xA0000000\0"	\
+	"bootm_mapsize=0x39900000\0" \
+	"kernel_comp_add_r=0xB0000000\0" \
+	"kernel_comp_size=0x01000000\0" \
+	"" \
+
+#endif
-- 
2.43.0


More information about the U-Boot mailing list