Qualcomm IPQ5210 SoC bringup
Subsystems (11)
v7 cover Qualcomm IPQ5210 SoC bringup
Add pinctrl, clock drivers and SPL to support the IPPQ5210 SoC in U-Boot.
The relevant DT files are available in linux-next [1].
Working features, as tested on RDP504:
* Serial console
* UART
* MMC
* Boot sequence transitions from Boot ROM to U-Boot SPL, proprietary binaries (a.k.a QCLib) load and execute as appropriate and eventual jump to U-Boot.
* The QCLib handles
- DDR initialization
- Clock setup
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm64/boot/dts/qcom/ipq5210-rdp504.dts https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/include/dt-bindings/clock/qcom,ipq5210-gcc.h https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/include/dt-bindings/reset/qcom,ipq5210-gcc.h
v7: - Fix inadvertant typo in doc/board/qualcomm/rdp.rst
- Pick multiple R-b tags
- No code changes
v6: - Move binman related changes to separate series, so that the
SPL changes can move forward.
- Restore v3 build steps for now
- https://lore.kernel.org/u-boot/[email protected]/
v5: - Reorganize SPL related code into common and SoC specific functions
to allow SoCs to customize according to their boot flow
- Fix documentation related build errors
- Please see the patches for specific changes
- https://lore.kernel.org/u-boot/[email protected]/
v4: - Add binman based image creation support instead of special scripts
- Identify boot media based on PBL shared info instead of CONFIG_xxx
- Address v3 feedback (see individual patch for details)
- https://lore.kernel.org/u-boot/[email protected]/
v3: - Move stack range
- Split spl.c patch
- Move documentation towards the end of the series
- Pick couple of R-b
- https://lore.kernel.org/u-boot/[email protected]/
v2: - Add QCOM_GENI_MINICORE config option
- Move minicore register settings to separate file and include
if QCOM_GENI_MINICORE is enabled
- Remove bootph-all from override dts and moved them to kernel
DT - https://lore.kernel.org/linux-arm-msm/[email protected]/T/#u
- https://lore.kernel.org/u-boot/[email protected]/
v1: https://lore.kernel.org/u-boot/[email protected]/
Varadarajan Narayanan (11):
dts: ipq5210-rdp504-u-boot: add override dtsi clk/qcom: add initial clock driver for ipq5210
pinctrl: qcom: Add ipq5210 pinctrl driver
misc: qcom_geni: Add minicore support
mach-snapdragon: Add PBL shared data defines
spl: Include SMEM driver in SPL
mach-snapdragon: Add initial support for IPQ5210 SPL
mach-snapdragon: spl: Update SMEM with boot details
mach-snapdragon: Add commands to create wrapper ELF
configs: add qcom_ipq5210_mmc_defconfig
doc: board/qualcomm: Update RDP build instructions
arch/arm/Kconfig | 5 +- arch/arm/dts/ipq5210-rdp504-u-boot.dtsi | 15 + arch/arm/mach-snapdragon/Kconfig | 7 + arch/arm/mach-snapdragon/Makefile | 3 + arch/arm/mach-snapdragon/include/mach/pbl.h | 58 ++ arch/arm/mach-snapdragon/include/mach/spl.h | 14 + .../mach-snapdragon/ipq5210-spl-wrap-elf.lds | 18 + arch/arm/mach-snapdragon/spl.c | 615 ++++++++++++++++++ board/qualcomm/ipq5210/Makefile | 3 + board/qualcomm/ipq5210/spl-ipq5210.c | 159 +++++ common/spl/Kconfig | 8 + configs/qcom_ipq5210_mmc_defconfig | 107 +++ doc/board/qualcomm/rdp.rst | 98 ++- drivers/Makefile | 1 + drivers/clk/qcom/Kconfig | 8 + drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/clock-ipq5210.c | 98 +++ drivers/misc/Kconfig | 6 + drivers/misc/Makefile | 1 + drivers/misc/qcom_geni-minicore.c | 102 +++ drivers/misc/qcom_geni.c | 100 ++- drivers/pinctrl/qcom/Kconfig | 8 + drivers/pinctrl/qcom/Makefile | 1 + drivers/pinctrl/qcom/pinctrl-ipq5210.c | 349 ++++++++++ include/configs/ipq5210.h | 11 + include/smem.h | 3 + include/soc/qcom/geni-se.h | 5 + include/soc/qcom/qup-fw-load.h | 12 + scripts/Makefile.xpl | 24 + 29 files changed, 1821 insertions(+), 19 deletions(-) create mode 100644 arch/arm/dts/ipq5210-rdp504-u-boot.dtsi create mode 100644 arch/arm/mach-snapdragon/include/mach/pbl.h create mode 100644 arch/arm/mach-snapdragon/include/mach/spl.h create mode 100644 arch/arm/mach-snapdragon/ipq5210-spl-wrap-elf.lds create mode 100644 arch/arm/mach-snapdragon/spl.c create mode 100644 board/qualcomm/ipq5210/Makefile create mode 100644 board/qualcomm/ipq5210/spl-ipq5210.c create mode 100644 configs/qcom_ipq5210_mmc_defconfig create mode 100644 drivers/clk/qcom/clock-ipq5210.c create mode 100644 drivers/misc/qcom_geni-minicore.c create mode 100644 drivers/pinctrl/qcom/pinctrl-ipq5210.c create mode 100644 include/configs/ipq5210.h
Signature · 54 lines
2.34.1 Signed-off-by: Varadarajan Narayanan <[email protected]> --- Varadarajan Narayanan (11): dts: ipq5210-rdp504-u-boot: add override dtsi clk/qcom: add initial clock driver for ipq5210 pinctrl: qcom: Add ipq5210 pinctrl driver misc: qcom_geni: Add minicore support mach-snapdragon: Add PBL shared data defines spl: Include SMEM driver in SPL mach-snapdragon: Add initial support for IPQ5210 SPL mach-snapdragon: spl: Update SMEM with boot details mach-snapdragon: Add commands to create wrapper ELF configs: add qcom_ipq5210_mmc_defconfig doc: board/qualcomm: Update RDP build instructions arch/arm/Kconfig | 5 +- arch/arm/dts/ipq5210-rdp504-u-boot.dtsi | 15 + arch/arm/mach-snapdragon/Kconfig | 7 + arch/arm/mach-snapdragon/Makefile | 3 + arch/arm/mach-snapdragon/include/mach/pbl.h | 58 ++ arch/arm/mach-snapdragon/include/mach/spl.h | 14 + arch/arm/mach-snapdragon/ipq5210-spl-wrap-elf.lds | 18 + arch/arm/mach-snapdragon/spl.c | 615 ++++++++++++++++++++++ board/qualcomm/ipq5210/Makefile | 3 + board/qualcomm/ipq5210/spl-ipq5210.c | 159 ++++++ common/spl/Kconfig | 8 + configs/qcom_ipq5210_mmc_defconfig | 107 ++++ doc/board/qualcomm/rdp.rst | 96 +++- drivers/Makefile | 1 + drivers/clk/qcom/Kconfig | 8 + drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/clock-ipq5210.c | 98 ++++ drivers/misc/Kconfig | 6 + drivers/misc/Makefile | 1 + drivers/misc/qcom_geni-minicore.c | 102 ++++ drivers/misc/qcom_geni.c | 100 +++- drivers/pinctrl/qcom/Kconfig | 8 + drivers/pinctrl/qcom/Makefile | 1 + drivers/pinctrl/qcom/pinctrl-ipq5210.c | 349 ++++++++++++ include/configs/ipq5210.h | 11 + include/smem.h | 3 + include/soc/qcom/geni-se.h | 5 + include/soc/qcom/qup-fw-load.h | 12 + scripts/Makefile.xpl | 24 + 29 files changed, 1820 insertions(+), 18 deletions(-) --- base-commit: a3f393c02cf10f44310c6ddf3dedf354c2e877a0 change-id: 20260630-fix-edl-0307ee6e36fa Best regards, -- Varadarajan Narayanan <[email protected]>
PATCH v7 1/11 dts: ipq5210-rdp504-u-boot: add override dtsi
* Add initial support for the IPQ5210 MMC based RDP platforms.
* Define memory layout statically.
* Mark the nodes that would be needed for SPL.
--- arch/arm/dts/ipq5210-rdp504-u-boot.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/arm/dts/ipq5210-rdp504-u-boot.dtsi new file +15 -0
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * IPQ5210 RDP504 board device tree source + * + * Copyright (c) 2026 The Linux Foundation. All rights reserved. + */ + +/ { + /* Will be removed when SMEM parsing is updated */ + memory@80000000 { + bootph-all; + device_type = "memory"; + reg = <0x0 0x80000000 0x0 0x20000000>; + }; +};
Signature · 1 line
2.34.1
PATCH v7 2/11 clk/qcom: add initial clock driver for ipq5210
In reply to Varadarajan NarayananAdd initial set of clocks and resets for enabling U-Boot on ipq5210 based RDP platforms.
--- drivers/clk/qcom/Kconfig | 8 ++++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/clock-ipq5210.c | 98 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+)
drivers/clk/qcom/Kconfig +8 -0
@@ -31,6 +31,14 @@ config CLK_QCOM_IPQ4019 on the Snapdragon IPQ4019 SoC. This driver supports the clocks and resets exposed by the GCC hardware block. +config CLK_QCOM_IPQ5210 + bool "Qualcomm IPQ5210 GCC" + select CLK_QCOM + help + Say Y here to enable support for the Global Clock Controller + on the Qualcomm IPQ5210 SoC. This driver supports the clocks + and resets exposed by the GCC hardware block. + config CLK_QCOM_IPQ5424 bool "Qualcomm IPQ5424 GCC" select CLK_QCOM
drivers/clk/qcom/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_CLK_QCOM_SDM845) += clock-sdm845.o obj-$(CONFIG_CLK_QCOM_APQ8016) += clock-apq8016.o obj-$(CONFIG_CLK_QCOM_APQ8096) += clock-apq8096.o obj-$(CONFIG_CLK_QCOM_IPQ4019) += clock-ipq4019.o +obj-$(CONFIG_CLK_QCOM_IPQ5210) += clock-ipq5210.o obj-$(CONFIG_CLK_QCOM_IPQ5424) += clock-ipq5424.o obj-$(CONFIG_CLK_QCOM_IPQ9574) += clock-ipq9574.o obj-$(CONFIG_CLK_QCOM_MILOS) += clock-milos.o
drivers/clk/qcom/clock-ipq5210.c new file +98 -0
98 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v7 3/11 pinctrl: qcom: Add ipq5210 pinctrl driver
In reply to Varadarajan NarayananAdd pinctrl driver for the TLMM block found in the ipq5210 SoC.
--- drivers/pinctrl/qcom/Kconfig | 8 + drivers/pinctrl/qcom/Makefile | 1 + drivers/pinctrl/qcom/pinctrl-ipq5210.c | 349 +++++++++++++++++++++++++++++++++ 3 files changed, 358 insertions(+)
drivers/pinctrl/qcom/Kconfig +8 -0
@@ -38,6 +38,14 @@ config PINCTRL_QCOM_IPQ4019 Say Y here to enable support for pinctrl on the IPQ4019 SoC, as well as the associated GPIO driver. +config PINCTRL_QCOM_IPQ5210 + bool "Qualcomm IPQ5210 Pinctrl" + default y if PINCTRL_QCOM_GENERIC + select PINCTRL_QCOM + help + Say Y here to enable support for pinctrl on the IPQ5210 SoC, + as well as the associated GPIO driver. + config PINCTRL_QCOM_IPQ5424 bool "Qualcomm IPQ5424 Pinctrl" default y if PINCTRL_QCOM_GENERIC
drivers/pinctrl/qcom/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_PINCTRL_QCOM) += pinctrl-qcom.o obj-$(CONFIG_PINCTRL_QCOM_APQ8016) += pinctrl-apq8016.o obj-$(CONFIG_PINCTRL_QCOM_IPQ4019) += pinctrl-ipq4019.o +obj-$(CONFIG_PINCTRL_QCOM_IPQ5210) += pinctrl-ipq5210.o obj-$(CONFIG_PINCTRL_QCOM_IPQ5424) += pinctrl-ipq5424.o obj-$(CONFIG_PINCTRL_QCOM_IPQ9574) += pinctrl-ipq9574.o obj-$(CONFIG_PINCTRL_QCOM_APQ8096) += pinctrl-apq8096.o
drivers/pinctrl/qcom/pinctrl-ipq5210.c new file +349 -0
349 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v7 4/11 misc: qcom_geni: Add minicore support
In reply to Varadarajan NarayananThe qcom_geni driver reads an ELF from storage and configures a set of registers and programs the firmware to the GENI Serial Engine (GENI-SE) wrapper device for the expected functionality.
Unlike the GENI-SE wrapper found in MSM SoCs, the IPQ5210's GENI-SE wrapper is pre-configured for one of the functions defined in 'enum geni_se_protocol_type'. Hence, the firmware download is not needed. Only the register configuration part is needed.
Earlier, the boot stages before U-Boot would configure the GENI-SE (to access UART/SPI etc). Since for IPQ5210 U-Boot SPL, the previous stage (i.e. boot ROM) doesn't do that modify the driver to do the register configuration part alone without reading an ELF from the storage.
--- drivers/misc/Kconfig | 6 +++ drivers/misc/Makefile | 1 + drivers/misc/qcom_geni-minicore.c | 102 ++++++++++++++++++++++++++++++++++++++ drivers/misc/qcom_geni.c | 100 ++++++++++++++++++++++++++++++++----- include/soc/qcom/geni-se.h | 5 ++ include/soc/qcom/qup-fw-load.h | 12 +++++ 6 files changed, 214 insertions(+), 12 deletions(-)
drivers/misc/Kconfig +6 -0
@@ -93,6 +93,12 @@ config QCOM_GENI for providing a common interface for various peripherals like UART, I2C, SPI, etc. +config QCOM_GENI_MINICORE + bool "Support minicores in Qualcomm Generic Interface (GENI) driver" + depends on QCOM_GENI + help + Enable support for minicores in Qualcomm GENI and its peripherals. + config ROCKCHIP_EFUSE bool "Rockchip e-fuse support" depends on MISC
drivers/misc/Makefile +1 -0
@@ -66,6 +66,7 @@ obj-$(CONFIG_QFW_SMBIOS) += qfw_smbios.o obj-$(CONFIG_SANDBOX) += qfw_sandbox.o endif obj-$(CONFIG_QCOM_GENI) += qcom_geni.o +obj-$(CONFIG_QCOM_GENI_MINICORE) += qcom_geni-minicore.o obj-$(CONFIG_$(PHASE_)ROCKCHIP_EFUSE) += rockchip-efuse.o obj-$(CONFIG_$(PHASE_)ROCKCHIP_OTP) += rockchip-otp.o obj-$(CONFIG_$(PHASE_)ROCKCHIP_IODOMAIN) += rockchip-io-domain.o
drivers/misc/qcom_geni-minicore.c new file +102 -0
102 lines not on this page · raw message
drivers/misc/qcom_geni.c +88 -12
178 lines not on this page · raw message
include/soc/qcom/geni-se.h +5 -0
@@ -77,8 +77,12 @@ enum geni_se_protocol_type {#define SE_IRQ_EN 0xe1c#define SE_HW_PARAM_0 0xe24#define SE_HW_PARAM_1 0xe28 +#define SE_HW_PARAM_2 0xe2c#define SE_DMA_GENERAL_CFG 0xe30 +/* SE_HW_PARAM_2 fields */ +#define GENI_USE_MINICORES BIT(12) +/* GENI_DFS_IF_CFG fields */ #define DFS_IF_EN BIT(0)
@@ -248,6 +252,7 @@ enum geni_se_protocol_type {/* SE_HW_PARAM_0 fields */ #define TX_FIFO_WIDTH_MSK GENMASK(29, 24)#define TX_FIFO_WIDTH_SHFT 24 +/* * For QUP HW Version >= 3.10 Tx fifo depth support is increased * to 256bytes and corresponding bits are 16 to 23
include/soc/qcom/qup-fw-load.h +12 -0
@@ -14,6 +14,7 @@#define GENI_INIT_CFG_REVISION 0x0#define GENI_S_INIT_CFG_REVISION 0x4#define GENI_FORCE_DEFAULT_REG 0x20 +#define GENI_OUTPUT_CTRL 0x24#define GENI_CGC_CTRL 0x28#define GENI_CFG_REG0 0x100
@@ -173,6 +174,17 @@ struct elf_se_hdr {struct udevice ; +struct qup_mini_core_info { +u16 serial_protocol; +u16 fw_version; +u16 cfg_version; +u16 cfg_count; +u32 *cfg_val; +u8 *cfg_idx; +u32 *cfg_ram; +u32 cfg_ram_count; +}; +int qcom_geni_load_firmware (phys_addr_t qup_base,struct udevice *dev);#endif /* _LINUX_QCOM_QUP_FW_LOAD */
Signature · 1 line
2.34.1
PATCH v7 5/11 mach-snapdragon: Add PBL shared data defines
In reply to Varadarajan NarayananAdd structure and enum definitions to be able to parse the information that is passed from PBL. This will be used to identify the boot medium.
--- arch/arm/mach-snapdragon/include/mach/pbl.h | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
arch/arm/mach-snapdragon/include/mach/pbl.h new file +58 -0
@@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0 + +#ifndef __PBL_H__ +#define __PBL_H__ + +enum pbl_shared_data_param_id { +PSD_ID_PBL_FW_VERSION =0x0 ,/* PBL firmware version */ +PSD_ID_PBL_PATCH_VERSION =0x1 ,/* Patch version */ +PSD_ID_RMB_MBOX_BASE_ADDR =0x2 ,/* Not used */ +PSD_ID_CPU_BOOT_SPEED_HZ =0x3 ,/* CPU boot speed (Hz) */ +PSD_ID_BOOT_MEDIA_TYPE =0x4 ,/* Boot media type */ +PSD_ID_IS_EDL_MODE =0x5 ,/* Emergency Download mode */ +PSD_ID_DEV_PROG_ELF_ENTRY_ADDR =0x6 ,/* Not used */ +PSD_ID_XBL_CONFIG_ELF_ENTRY_ADDR =0x7 ,/* Not used */ +PSD_ID_XBL_SC_EXT_ELF_ENTRY_ADDR =0x8 ,/* Not used */ +PSD_ID_PBL_TIMESTAMPS_BUFFER_ADDR =0x9 ,/* PBL logs address */ +PSD_ID_PBL_TIMESTAMPS_BUFFER_SIZE =0xa ,/* PBL log size */ +PSD_ID_PBL_DEBUG_SHARED_INFO_ADDR =0xb ,/* Debug info address */ +PSD_ID_PBL_DEBUG_SHARED_INFO_SIZE =0xc ,/* Debug info size */ +PSD_ID_TME_CPU_PBL_ROM_BYPASS_FUSE =0xd ,/* Secure boot status */ +PSD_ID_XBL_SC_DEBUG_LOG_ADDR =0xe ,/* XBL SC debug log address */ +PSD_ID_XBL_SC_DEBUG_LOG_SIZE =0xf ,/* XBL SC debug log size */ +PSD_ID_CURRENT_IMAGE_SET =0x10 ,/* Booted image set */ +PSD_ID_MEDIA_DATA_INFO_ADDR =0x11 ,/* Media info pointer */ +PSD_ID_MEDIA_DATA_INFO_SIZE =0x12 ,/* Media info size */ +PBL_SHARED_DATA_PARAM_MAX , +PBL_SHARED_DATA_PARAM_SIZE =0xffffffffu ,/* to force 32 bits */ +}; + +enum pbl_boot_flash_type { +PSD_NO_FLASH =0 , +PSD_NOR_FLASH =1 , +PSD_NAND_FLASH =2 , +PSD_ONENAND_FLASH =3 , +PSD_SDC_FLASH =4 , +PSD_MMC_FLASH =5 , +PSD_SPI_FLASH =6 , +PSD_PCIE_FLASH =7 , +PSD_UFS_FLASH =8 , +PSD_RSVD_1_FLASH =9 , +PSD_USB_FLASH =10 , +PSD_SPI_NAND_FLASH =11 , +PSD_SPI_FLASH_GPT =12 , +}; + +struct pbl_shared_data_entry { +u32 param_id; +ulong value; +bool valid; +}; + +struct pbl_shared_data { +u32 version; +u32 num_of_entries; +struct pbl_shared_data_entry entry[PBL_SHARED_DATA_PARAM_MAX ]; +}; + +#endif /* __PBL_H__ */
Signature · 1 line
2.34.1
PATCH v7 6/11 spl: Include SMEM driver in SPL
In reply to Varadarajan NarayananAdd SPL_SMEM config to enable/disable SMEM driver in SPL.
--- common/spl/Kconfig | 8 ++++++++ drivers/Makefile | 1 + 2 files changed, 9 insertions(+)
common/spl/Kconfig +8 -0
@@ -1387,6 +1387,14 @@ config SPL_RAM_DEVICE be already in memory when SPL takes over, e.g. loaded by the boot ROM. +config SPL_SMEM + bool "Support SMEM (Shared Memory manager)" + depends on SMEM + help + Enable support for the Shared Memory Manager. The driver provides an + interface to items in a heap shared among all processors. This enables + the drivers in drivers/smem as part of an SPL build. + config SPL_PCI_DFU bool "PCIe boot support" depends on SPL_PCI_ENDPOINT
drivers/Makefile +1 -0
@@ -74,6 +74,7 @@ obj-$(CONFIG_SPL_SATA) += ata/ scsi/ obj-$(CONFIG_SPL_LEGACY_BLOCK) += block/ obj-$(CONFIG_SPL_THERMAL) += thermal/ obj-$(CONFIG_SPL_UFS_SUPPORT) += scsi/ ufs/ +obj-$(CONFIG_SPL_SMEM) += smem/ endif endif
Signature · 1 line
2.34.1
PATCH v7 7/11 mach-snapdragon: Add initial support for IPQ5210 SPL
In reply to Varadarajan NarayananAdd basic SPL infrastructure for IPQ5210 SoC. This handles basic serial console init, identifying the boot media, loading the additional firmware binaries to setup DDR, TFA and eventually jump to U-Boot.
--- arch/arm/Kconfig | 5 +- arch/arm/mach-snapdragon/Makefile | 3 + arch/arm/mach-snapdragon/include/mach/spl.h | 14 + arch/arm/mach-snapdragon/spl.c | 544 ++++++++++++++++++++++++++++ board/qualcomm/ipq5210/Makefile | 3 + board/qualcomm/ipq5210/spl-ipq5210.c | 159 ++++++++ include/configs/ipq5210.h | 11 + 7 files changed, 737 insertions(+), 2 deletions(-)
arch/arm/Kconfig +3 -2
@@ -1147,12 +1147,13 @@ config ARCH_SNAPDRAGON select SPMI select BOARD_LATE_INIT select OF_BOARD - select SAVE_PREV_BL_FDT_ADDR if !ENABLE_ARM_SOC_BOOT0_HOOK - select LINUX_KERNEL_IMAGE_HEADER if !ENABLE_ARM_SOC_BOOT0_HOOK + select SAVE_PREV_BL_FDT_ADDR if !ENABLE_ARM_SOC_BOOT0_HOOK && !SPL + select LINUX_KERNEL_IMAGE_HEADER if !ENABLE_ARM_SOC_BOOT0_HOOK && !SPL select SYSRESET select SYSRESET_PSCI select ANDROID_BOOT_IMAGE_IGNORE_BLOB_ADDR select MMU_PGPROT + select SUPPORT_SPL imply OF_UPSTREAM imply CMD_DM imply DM_USB_GADGET
arch/arm/mach-snapdragon/Makefile +3 -0
@@ -2,6 +2,9 @@ # # (C) Copyright 2015 Mateusz Kulikowski <[email protected]> +ifndef CONFIG_XPL_BUILD obj-y += board.o obj-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += capsule_update.o obj-$(CONFIG_OF_LIVE) += of_fixup.o +endif +obj-$(CONFIG_SPL_BUILD) += spl.o
arch/arm/mach-snapdragon/include/mach/spl.h new file +14 -0
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +*/ + +#ifndef __SPL_H__ +#define __SPL_H__ + +void qcom_spl_malloc_init_f (void ); +int qcom_spl_loader_pre_ddr (u8 boot_device); +int qclib_post_process_from_spl (void ); +void qcom_spl_error_handler (void *arg); + +#endif /* __SPL_H__ */
arch/arm/mach-snapdragon/spl.c new file +544 -0
544 lines not on this page · raw message
board/qualcomm/ipq5210/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_SPL) := spl-ipq5210.o
board/qualcomm/ipq5210/spl-ipq5210.c new file +159 -0
159 lines not on this page · raw message
include/configs/ipq5210.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +*/ + +#ifndef __CONFIGS_IPQ5210_H +#define __CONFIGS_IPQ5210_H + +#include <linux/sizes.h> + +#endif
Signature · 1 line
2.34.1
PATCH v7 8/11 mach-snapdragon: spl: Update SMEM with boot details
In reply to Varadarajan NarayananUpdate SMEM with the storage medium from which the system booted.
--- arch/arm/mach-snapdragon/spl.c | 73 +++++++++++++++++++++++++++++++++++++++++- include/smem.h | 3 ++ 2 files changed, 75 insertions(+), 1 deletion(-)
arch/arm/mach-snapdragon/spl.c +72 -1
@@ -11,6 +11,7 @@#include <asm/io.h> #include <asm/system.h> #include <asm/sections.h> +#include <smem.h> #include <atf_common.h> #include <linux/err.h> #include <dm/device-internal.h>
@@ -167,6 +168,52 @@ static int qcom_spl_get_fit_img_entry_point(void *fit, int node,return ret; } +#if IS_ENABLED (CONFIG_SPL_SMEM ) +/** +* qcom_spl_populate_smem() - Populate shared memory (SMEM) information. +* @ctx: Pointer to the global SPL context. +* +* This function initializes and populates various SMEM items with boot-related +* information, such as flash type, try-mode status, and ATF enable status. +* Return: 0 on success, or a negative error code on failure. +*/ +static int qcom_spl_populate_smem (void *ctx) +{ +int ret; +size_t size; +struct udevice *smem; +u32 *fltype; + + ret =uclass_get_device (UCLASS_SMEM ,0 , &smem); +if (ret) { +pr_err ("Failed to find SMEM node (%d)\n" , ret); +return ret; + } + + size =sizeof (u32); + ret =smem_alloc (smem,-1 ,SMEM_BOOT_FLASH_TYPE , size); +if (ret) { +pr_err ("Failed to alloc item: SMEM_BOOT_FLASH_TYPE (%d)\n" , ret); +return ret; + } + + fltype = (u32 *)smem_get (smem,-1 ,SMEM_BOOT_FLASH_TYPE , &size); +if (!fltype) { +pr_err ("Failed to get item: SMEM_BOOT_FLASH_TYPE\n" ); +return -ENOENT ; + } + +if (IS_ENABLED (CONFIG_SPL_MMC )) { + *fltype =SMEM_BOOT_MMC_FLASH ; +return 0 ; + } + +pr_err ("Boot medium not specified\n" ); + +return -ENOENT ; +} +#endif /* IS_ENABLED(CONFIG_SPL_SMEM) */ +/** * qcom_spl_get_iftbl_entry_by_name() - Get an interface table entry by name. * @if_tbl: Pointer to the QCLIB interface table.
@@ -328,6 +375,30 @@ int qclib_post_process_from_spl(void)return 0 ; } +#if IS_ENABLED (CONFIG_SPL_SMEM ) +/** +* spl_board_prepare_for_boot() - Prepare board for boot +* +* This function is called by SPL before jumping to the next stage. +* It populates SMEM during coldboot. +*/ +void spl_board_prepare_for_boot (void ) +{ +int ret; + +/* +* Populate SMEM in coldboot (Dload bit not set) +*/ +if (!QCOM_SPL_IS_DLOAD_BIT_SET ) { + ret =qcom_spl_populate_smem (NULL ); +if (ret) { +pr_err ("Failed to populate SMEM (%d)\n" , ret); +qcom_spl_error_handler (NULL ); + } + } +} +#endif /* IS_ENABLED(CONFIG_SPL_SMEM) */ +/** * spl_get_load_buffer() - Allocate a cache-aligned buffer for image loading. * @offset: Offset (unused, typically 0 for SPL).
@@ -396,7 +467,7 @@ struct bl_params *bl2_plat_get_bl31_params_v2(uintptr_t bl32_entry,/** * qcom_spl_loader_pre_ddr() - SPL loader for pre-DDR stage. -* @boot_device:Type of boot device. +* @boot_device: Type of boot device. * * Return: 0 on success, or a negative error code on failure. */
include/smem.h +3 -0
@@ -87,4 +87,7 @@ void *smem_get(struct udevice *dev, unsigned int host, unsigned int item, size_t*/ int smem_get_free_space (struct udevice *dev,unsigned int host); +#define SMEM_BOOT_FLASH_TYPE 498 +#define SMEM_BOOT_MMC_FLASH 5 +#endif /* _smem_h_ */
Signature · 1 line
2.34.1
PATCH v7 9/11 mach-snapdragon: Add commands to create wrapper ELF
In reply to Varadarajan NarayananThe IPQ5210 boot ROM expects the SPL binary image to be embedded within an ELF along with additional binaries. Hence add the relevant commands and linker script needed to convert u-boot-spl.bin to the expected format.
--- arch/arm/mach-snapdragon/Kconfig | 7 +++++++ arch/arm/mach-snapdragon/ipq5210-spl-wrap-elf.lds | 18 +++++++++++++++++ scripts/Makefile.xpl | 24 +++++++++++++++++++++++ 3 files changed, 49 insertions(+)
arch/arm/mach-snapdragon/Kconfig +7 -0
@@ -42,4 +42,11 @@ config SYS_CONFIG_NAME Based on this option include/configs/<CONFIG_SYS_CONFIG_NAME>.h header will be used for board configuration. +config SPL_WRAPPER_ELF + bool "Create wrapper ELF for applicable platforms" + depends on SPL + help + Some platforms embed the U-Boot SPL binary within an ELF as a segment. + Additional tools are used to convert this ELF into an image that is + usable for the boot ROM. endif
arch/arm/mach-snapdragon/ipq5210-spl-wrap-elf.lds new file +18 -0
@@ -0,0 +1,18 @@ +/* + * SPDX-License-Identifier: GPL-2.0 + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + */ +PHDRS { + ptype PT_LOAD FLAGS(0x7); +} + +ENTRY(_entry) + +SECTIONS { + . = IMAGE_TEXT_BASE; + _entry = . ; + data : { + *(.data) + . = ALIGN(4); + } :ptype +}
scripts/Makefile.xpl +24 -0
@@ -256,6 +256,26 @@ MKIMAGEFLAGS_boot.bin = -T zynqmpimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) \ -n "$(shell cd $(srctree); readlink -f $(CONFIG_PMUFW_INIT_FILE))" endif +ifeq ($(CONFIG_SPL_WRAPPER_ELF),y) +# Convert ELF to object file +OBJCOPYFLAGS_$(SPL_BIN).bin.o = -I binary -O elf64-littleaarch64 + +# Wrap the object file inside a ELF +QCOM_SPL_SOC = $(shell echo $(notdir "$(CONFIG_DEFAULT_DEVICE_TREE)") | cut -f1 -d-) +QCOM_SPL_WRAP_LDS = $(srctree)/arch/arm/mach-snapdragon/$(QCOM_SPL_SOC)-spl-wrap-elf.lds +LDFLAGS_$(SPL_BIN).wrap-elf = -T $(obj)/$(SPL_BIN).wrap-elf.lds + +$(obj)/$(SPL_BIN).wrap-elf.lds: $(QCOM_SPL_WRAP_LDS) FORCE + $(call if_changed_dep,cpp_lds) + +$(obj)/$(SPL_BIN).bin.o: $(obj)/$(SPL_BIN).bin $(obj)/$(SPL_BIN).wrap-elf.lds FORCE + $(call if_changed,objcopy) + +$(obj)/$(SPL_BIN).wrap-elf: $(obj)/$(SPL_BIN).bin.o FORCE + $(call if_changed,ld) + +endif + $(obj)/$(SPL_BIN)-align.bin: $(obj)/$(SPL_BIN).bin @dd if=$< of=$@ conv=sync bs=4 2>/dev/null;
@@ -302,6 +322,10 @@ INPUTS-$(CONFIG_ARCH_ZYNQMP) += $(obj)/boot.bin INPUTS-$(CONFIG_ARCH_MEDIATEK) += $(obj)/u-boot-spl-mtk.bin +ifeq ($(CONFIG_ARCH_SNAPDRAGON),y) +INPUTS-$(CONFIG_SPL_WRAPPER_ELF) += $(obj)/u-boot-spl.wrap-elf +endif + all: $(INPUTS-y) quiet_cmd_cat = CAT $@
Signature · 1 line
2.34.1
PATCH v7 10/11 configs: add qcom_ipq5210_mmc_defconfig
In reply to Varadarajan NarayananIntroduce a defconfig for the Qualcomm IPQ5210 SoC based RDPs. Presently supports eMMC.
--- configs/qcom_ipq5210_mmc_defconfig | 107 +++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)
configs/qcom_ipq5210_mmc_defconfig new file +107 -0
@@ -0,0 +1,107 @@ +CONFIG_ARM=y +CONFIG_SKIP_LOWLEVEL_INIT=y +CONFIG_POSITION_INDEPENDENT=y +CONFIG_SYS_INIT_SP_BSS_OFFSET=0x180000 +CONFIG_ARCH_SNAPDRAGON=y +CONFIG_TEXT_BASE=0x87980000 +CONFIG_NR_DRAM_BANKS=2 +CONFIG_ENV_SIZE=0x40000 +CONFIG_ENV_OFFSET=0 +CONFIG_DEFAULT_DEVICE_TREE="qcom/ipq5210-rdp504" +CONFIG_SYS_LOAD_ADDR=0x90000000 +CONFIG_REMAKE_ELF=y +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +# CONFIG_BOOTSTD is not set +CONFIG_OF_BOARD_SETUP=y +CONFIG_USE_PREBOOT=y +CONFIG_SYS_PBSIZE=1024 +# CONFIG_DISPLAY_CPUINFO is not set +CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_HUSH_PARSER=y +CONFIG_CMD_MMC=y +CONFIG_CMD_PART=y +CONFIG_EFI_PARTITION=y +CONFIG_OF_LIVE=y +CONFIG_ENV_IS_IN_MMC=y +CONFIG_CLK=y +CONFIG_CLK_QCOM_IPQ5210=y +CONFIG_MSM_GPIO=y +# CONFIG_I2C is not set +# CONFIG_INPUT is not set +CONFIG_MISC=y +CONFIG_QCOM_GENI=y +CONFIG_QCOM_GENI_MINICORE=y +CONFIG_MMC_HS200_SUPPORT=y +CONFIG_MMC_SDHCI=y +# CONFIG_MMC_SDHCI_ADMA_HELPERS is not set +# CONFIG_MMC_SDHCI_ADMA is not set +# CONFIG_MMC_SDHCI_ADMA_FORCE_32BIT is not set +# CONFIG_MMC_SDHCI_ADMA_64BIT is not set +CONFIG_MMC_SDHCI_MSM=y +CONFIG_MTD=y +CONFIG_DM_MDIO=y +CONFIG_DM_ETH_PHY=y +CONFIG_DWC_ETH_QOS=y +CONFIG_DWC_ETH_QOS_QCOM=y +CONFIG_RGMII=y +CONFIG_PHY=y +CONFIG_PHY_QCOM_QMP_UFS=y +CONFIG_PHY_QCOM_QUSB2=y +CONFIG_PINCTRL=y +CONFIG_PINCONF=y +CONFIG_PINCTRL_QCOM_IPQ5210=y +CONFIG_DEBUG_UART_MSM_GENI=y +CONFIG_DEBUG_UART_ANNOUNCE=y +CONFIG_MSM_SERIAL=y +CONFIG_MSM_GENI_SERIAL=y +CONFIG_SOC_QCOM=y +CONFIG_SPL=y +CONFIG_SPL_FRAMEWORK=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_OF_LIBFDT=y +CONFIG_SPL_DM=y +CONFIG_SPL_GPIO=y +CONFIG_SPL_DM_GPIO=y +CONFIG_SPL_DM_RESET=y +CONFIG_SPL_PINCTRL=y +CONFIG_SPL_CLK=y +CONFIG_SPL_DRIVERS_MISC=y +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y +CONFIG_SPL_SERIAL=y +CONFIG_SPL_SMEM=y +CONFIG_DM_STATS=y +CONFIG_SPL_SYS_MALLOC_F=y +CONFIG_SPL_SYS_MALLOC_F_LEN=0x20000 +CONFIG_SPL_SYS_MALLOC=y +CONFIG_SYS_MALLOC_DEFAULT_TO_INIT=y +CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y +CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80008000 +CONFIG_SPL_SYS_MALLOC_SIZE=0x20000 +# CONFIG_SPL_SEPARATE_BSS is not set +# CONFIG_SPL_USE_TINY_PRINTF is not set +CONFIG_SPL_BSS_MAX_SIZE=0x4000 +CONFIG_SPL_TEXT_BASE=0x08c24000 +CONFIG_SPL_MAX_SIZE=0x3D000 +CONFIG_SPL_MMC=y +CONFIG_SPL_MMC_SDHCI_ADMA=y +CONFIG_SPL_MMC_WRITE=y +CONFIG_SPL_SYS_MMCSD_RAW_MODE=y +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=0x00 +CONFIG_COUNTER_FREQUENCY=24000000 +CONFIG_SPL_STACKPROTECTOR=y +CONFIG_SPL_LOAD_FIT=y +CONFIG_SPL_ATF=y +CONFIG_SPL_ATF_LOAD_IMAGE_V2=y +CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y +CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y +CONFIG_SPL_LOAD_FIT_ADDRESS=0x08cbe000 +# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set +CONFIG_SPL_HAVE_INIT_STACK=y +CONFIG_SPL_STACK=0x08c24000 +# CONFIG_SAVE_PREV_BL_FDT_ADDR is not set +CONFIG_SPL_WRAPPER_ELF=y +CONFIG_SYS_BOARD="ipq5210"
Signature · 1 line
2.34.1
PATCH v7 11/11 doc: board/qualcomm: Update RDP build instructions
In reply to Varadarajan NarayananAdd details about the SPL & U-Boot proper build steps, converting to flashable images, source URLs for the needed binaries and scripts.
--- doc/board/qualcomm/rdp.rst | 96 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 4 deletions(-)
doc/board/qualcomm/rdp.rst +92 -4
@@ -24,13 +24,17 @@ This will build ``u-boot.elf`` in the configured output directory. The firmware expects the ELF images to be in MBN format. The `elftombn.py` tool can be used to convert the ELF images to MBN format. - IPQ9574: (MBN version 6) +IPQ9574: (MBN version 6) - $ python elftombn.py -f u-boot.elf -o u-boot.mbn -v6 +.. code-block:: bash - IPQ5424: (MBN version 7) + python elftombn.py -f u-boot.elf -o u-boot.mbn -v6 - $ python elftombn.py -f u-boot.elf -o u-boot.mbn -v7 +IPQ5424: (MBN version 7) + +.. code-block:: bash + + python elftombn.py -f u-boot.elf -o u-boot.mbn -v7 Then install the resulting ``u-boot.mbn`` to the ``0:APPSBL`` partition on your device with::
@@ -42,6 +46,81 @@ on your device with:: U-Boot should be running after a reboot (``reset``). +Build steps for IPQ5210 based Qualcomm Dragonwing F8 & N8 Platforms: +-------------------------------------------------------------------- + +Please refer to the following URLs for more details about the platforms. + + F8: https://www.qualcomm.com/networking-infrastructure/products/f-series/f8-platform + + N8: https://www.qualcomm.com/networking-infrastructure/products/n-series/n8-platform + +1. Since U-Boot SPL is enabled on these platforms, the build command generates + both the U-Boot SPL and U-Boot proper images. Assuming ${uboot_dir} is the + top of the U-Boot sources and ${out_dir} as the output directory, + +.. code-block:: bash + + cd ${uboot_dir} + export CROSS_COMPILE=<aarch64 toolchain prefix> + make -j8 O=${out_dir} qcom_ipq5210_mmc_defconfig + make -j8 O=${out_dir} + +U-Boot SPL image: ${out_dir}/spl/u-boot-spl.wrap-elf +U-Boot image: ${out_dir}/u-boot.elf + +2. Convert the SPL image to multi ELF + +.. code-block:: bash + + cd ${out_dir}/spl + python elftombn.py -f u-boot-spl.wrap-elf -o u-boot-spl.mbn -v7 + python `create_multielf.py` -f u-boot-spl.mbn,tmel-ipq52xx-patch.elf \ + -o u-boot-spl.melf + +This u-boot-spl.melf should be flashed into 0:SPL partition. +Please see below for the location of `tmel-ipq52xx-patch.elf` + +3. Convert the U-Boot image to bootloader image + +.. code-block:: bash + + cd ${out_dir} + python elftombn.py -f u-boot.elf -o u-boot.mbn -v7 + +The u-boot.mbn has to be combined with `qc_config.elf`, `QCLib.elf`, `TFA` +and `OPTEE`. Please see below for the location for these ELFs. TFA and OPTEE +can be built from the sources using the following commands + +TFA: + +.. code-block:: bash + + make PLAT=ipq52xx QTISECLIB_PATH=path/to/`libqtisec_dbg.a` SPD=opteed + +OPTEE: + +.. code-block:: bash + + make PLATFORM=qcom-ipq52xx -j16 + +These binaries can be combined into a flashable image using `gen_its.py`. + +.. code-block:: bash + + python gen_its.py --arch ipq5210 \ + --qclib_path `QCLib.elf` \ + --qcconfig_path `qc_config.elf` \ + --tfa_bl31_path bl31.mbn \ + --uboot_path u-boot.mbn \ + --optee_path tee-raw.mbn \ + -p qcconfig qclib \ + -P tfa_bl31 uboot optee \ + -o output/hm_503_test_uboot.img \ + --template `template.its` + +This should be flashed into 0:BOOTLDR partition. + .. WARNING Boards with newer software versions would automatically go the emergency download (EDL) mode if U-Boot is not functioning as expected. If its a
@@ -54,5 +133,14 @@ U-Boot should be running after a reboot (``reset``). Note that the support added is very basic. Restoring the original U-Boot on boards with older version of the software requires a debugger. +.. _create_multielf.py: https://raw.githubusercontent.com/coreboot/coreboot/refs/heads/main/util/qualcomm/create_multielf.py .. _elftombn.py: https://git.codelinaro.org/clo/qsdk/oss/system/tools/meta/-/tree/NHSS.QSDK.13.0.5.r2/scripts?ref_type=heads .. _edl: https://github.com/bkerler/edl +.. _gen_its.py: https://git.codelinaro.org/clo/qsdk/oss/system/tools/meta/-/tree/win.platform_tools.1.0.r34/scripts?ref_type=heads +.. _libqtisec_dbg.a: https://softwarecenter.qualcomm.com/nexus/generic/product/chip/software-product/IPQ5210.NLQ.14.0/ipq5210.nlq.14.0-qca-oem-qartifact/r00036.1/WIN.TFA.1.0.R4/apss_proc/out/proprietary/qtiseclib/output/ipq52xx/release/libqtisec_dbg.a +.. _OPTEE: https://git.codelinaro.org/clo/trusted-firmware/optee_os/optee_os/-/tree/win.optee.1.0?ref_type=heads +.. _qc_config.elf: https://softwarecenter.qualcomm.com/nexus/generic/product/chip/software-product/IPQ5210.NLQ.14.0/ipq5210.nlq.14.0-qca-oem-qartifact/r00036.1/BOOT.MXF.2.3.1.1/boot_images/boot/QcomPkg/SocPkg/Hermosa/Bin/LC/RELEASE/qc_config.elf +.. _QCLib.elf: https://softwarecenter.qualcomm.com/nexus/generic/product/chip/software-product/IPQ5210.NLQ.14.0/ipq5210.nlq.14.0-qca-oem-qartifact/r00036.1/BOOT.MXF.2.3.1.1/boot_images/boot/QcomPkg/SocPkg/Hermosa/Bin/LC/RELEASE/QCLib.elf +.. _template.its: https://git.codelinaro.org/clo/qsdk/oss/system/tools/meta/-/tree/win.platform_tools.1.0.r34/scripts?ref_type=heads +.. _TFA: https://git.codelinaro.org/clo/trusted-firmware/tf-a/trusted-firmware-a/-/tree/win.tfa.1.0.r4?ref_type=heads +.. _tmel-ipq52xx-patch.elf: https://softwarecenter.qualcomm.com/nexus/generic/product/chip/software-product/IPQ5210.NLQ.14.0/ipq5210.nlq.14.0-qca-oem-qartifact/r00036.1/TMEL.WNS.2.4/tmel-ipq52xx-patch.elf
Signature · 1 line
2.34.1