From 80768e454d548a7f7f53374a3a0ff8ec4bbae778 Mon Sep 17 00:00:00 2001 From: Jamin Lin Date: Thu, 26 Jun 2025 17:16:18 +0800 Subject: ast27x0: Initialize and enable SSP/TSP using SCU with reserved-memory from DTB This commit adds support for bringing up the SSP and TSP co-processors on AST2700. The initialization and control logic are performed via SCU register programming. Memory layout for firmware regions is retrieved from reserved-memory nodes in the SPL device tree. Features included: - Add find_fmc_image() to locate FMC v2 image and extract payload range. - Load and validate SPL DTB located after FMC payload. - Parse reserved-memory nodes for SSP, TSP, ATF, OP-TEE, and IPC regions. - Define struct mem_region and reserved_mem_info for memory layout data. - Implement ssp_init() and ssp_enable() for SSP SCU setup and launch. - Implement tsp_init() and tsp_enable() for TSP SCU setup and launch. - Extend load_other_fit_images() to detect "sspfw" and "tspfw" images. - Enable SSP/TSP after loading firmware from FIT image. - Add SCU register definitions in struct ast2700_scu0. Note: DTB is only used to retrieve memory layout for reserved regions. The SSP and TSP initialization and activation are done via SCU registers. Code adapted from: https://github.com/AspeedTech-BMC/u-boot/blob/aspeed-master-v2023.10/board/aspeed/ibex_ast2700/ssp_tsp.c Signed-off-by: Jamin Lin --- ast27x0/include/image.h | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 ast27x0/include/image.h (limited to 'ast27x0/include/image.h') diff --git a/ast27x0/include/image.h b/ast27x0/include/image.h new file mode 100644 index 0000000..4fe3316 --- /dev/null +++ b/ast27x0/include/image.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2025 ASPEED Technology Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __AST27X0_INCLUDE_IMAGE_H__ +#define __AST27X0_INCLUDE_IMAGE_H__ + +#define DRAM_ADDR 0x400000000ULL +#define FMCCS0 0x100000000ULL + +/* FMC v2 */ +/* ASTH */ +#define FMC_HDR_MAGIC 0x48545341 +#define ECC_SIGN_LEN 96 +#define LMS_SIGN_LEN 1620 +#define SHA_DGST_LEN 48 + +struct hdr_preamble { + uint32_t magic; + uint32_t version; + uint32_t ecc_key_idx; + uint32_t lms_key_idx; + uint8_t ecc_sig[ECC_SIGN_LEN]; + uint8_t lms_sig[LMS_SIGN_LEN]; + uint32_t raz[15]; +}; + +struct hdr_body { + uint32_t svn; + uint32_t size; + uint8_t dgst[SHA_DGST_LEN]; + /* 712 bytes */ + uint8_t reserved[178 * 4]; +}; + +struct ast_fmc_header { + struct hdr_preamble preamble; + struct hdr_body body; +} __attribute__((packed)); + +struct fmc_img_info { + uint64_t payload_start; + uint64_t payload_end; +}; + +#endif /* __AST27X0_INCLUDE_IMAGE_H__ */ -- cgit v1.1