blob: 1b93dc86039cec434eedd4ae5c32535c03ee0d29 [file] [log] [blame]
Nishanth Menon0192f892016-10-14 01:13:34 +00001/*
Manorit Chawdhry7660cb52024-01-29 12:40:54 +05302 * Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
Dhruva Gole4861a662025-03-26 17:34:09 +05303 * Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/
4 * K3 SOC specific bl31_setup
Nishanth Menon0192f892016-10-14 01:13:34 +00005 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00009#include <common/debug.h>
Andrew F. Davisa513b2a2018-05-04 19:06:09 +000010#include <ti_sci.h>
Dhruva Gole4861a662025-03-26 17:34:09 +053011#include <ti_sci_transport.h>
Nishanth Menon0192f892016-10-14 01:13:34 +000012
Dhruva Gole4861a662025-03-26 17:34:09 +053013#include <plat_private.h>
Andrew Davis525c0b22023-10-25 16:42:27 -050014
Nishanth Menon3ed1b282016-10-14 01:13:45 +000015/* Table of regions to map using the MMU */
Andrew F. Davis02de6d92018-10-29 10:41:28 -050016const mmap_region_t plat_k3_mmap[] = {
Andrew Davis525c0b22023-10-25 16:42:27 -050017 K3_MAP_REGION_FLAT(K3_USART_BASE, K3_USART_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
18 K3_MAP_REGION_FLAT(K3_GIC_BASE, K3_GIC_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
19 K3_MAP_REGION_FLAT(K3_GTC_BASE, K3_GTC_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
20 K3_MAP_REGION_FLAT(SEC_PROXY_RT_BASE, SEC_PROXY_RT_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
21 K3_MAP_REGION_FLAT(SEC_PROXY_SCFG_BASE, SEC_PROXY_SCFG_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
22 K3_MAP_REGION_FLAT(SEC_PROXY_DATA_BASE, SEC_PROXY_DATA_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
Nishanth Menon3ed1b282016-10-14 01:13:45 +000023 { /* sentinel */ }
24};
25
Dhruva Gole4861a662025-03-26 17:34:09 +053026int ti_soc_init(void)
Nishanth Menon0192f892016-10-14 01:13:34 +000027{
Manorit Chawdhry7660cb52024-01-29 12:40:54 +053028 struct ti_sci_msg_version version;
29 int ret;
30
Manorit Chawdhry7660cb52024-01-29 12:40:54 +053031 ret = ti_sci_get_revision(&version);
32 if (ret) {
33 ERROR("Unable to communicate with the control firmware (%d)\n", ret);
Dhruva Gole4861a662025-03-26 17:34:09 +053034 return ret;
Manorit Chawdhry7660cb52024-01-29 12:40:54 +053035 }
36
37 INFO("SYSFW ABI: %d.%d (firmware rev 0x%04x '%s')\n",
38 version.abi_major, version.abi_minor,
39 version.firmware_revision,
40 version.firmware_description);
41
Manorit Chawdhry85630772024-01-29 17:36:49 +053042 /*
43 * Older firmware have a timing issue with DM that crashes few TF-A
44 * lite devices while trying to make calls to DM. Since there is no way
45 * to detect what current DM version we are running - we rely on the
46 * corresponding TIFS versioning to handle this check and ensure that
47 * the platform boots up
48 *
49 * Upgrading to TIFS version 9.1.7 along with the corresponding DM from
50 * ti-linux-firmware will enable this functionality.
51 */
52 if (version.firmware_revision > 9 ||
53 (version.firmware_revision == 9 && version.sub_version > 1) ||
54 (version.firmware_revision == 9 && version.sub_version == 1 &&
55 version.patch_version >= 7)
56 ) {
57 if (ti_sci_device_get(PLAT_BOARD_DEVICE_ID)) {
58 WARN("Unable to take system power reference\n");
59 }
60 } else {
61 NOTICE("Upgrade Firmwares for Power off functionality\n");
62 }
Dhruva Gole4861a662025-03-26 17:34:09 +053063 return 0;
Nishanth Menon0192f892016-10-14 01:13:34 +000064}