Merge changes from topic "revert-ti-dm-workaround" into integration

* changes:
  Revert "fix(ti): do not take system power reference in bl31_platform_setup()"
  refactor(ti): remove ti_sci_init function
  fix(k3): increment while reading trail bytes
This commit is contained in:
Madhukar Pappireddy 2024-02-09 17:09:05 +01:00 committed by TrustedFirmware Code Review
commit 00f1ec6b87
4 changed files with 87 additions and 38 deletions

View file

@ -320,7 +320,7 @@ int k3_sec_proxy_recv(enum k3_sec_proxy_chan_id id, struct k3_sec_proxy_msg *msg
i = msg->len - trail_bytes;
while (trail_bytes--) {
msg->buf[i] = data_trail & 0xff;
msg->buf[i++] = data_trail & 0xff;
data_trail >>= 8;
}
}

View file

@ -2,7 +2,7 @@
* Texas Instruments System Control Interface Driver
* Based on Linux and U-Boot implementation
*
* Copyright (C) 2018-2022 Texas Instruments Incorporated - https://www.ti.com/
* Copyright (C) 2018-2024 Texas Instruments Incorporated - https://www.ti.com/
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -185,17 +185,20 @@ unlock:
*
* Updates the SCI information in the internal data structure.
*
* @version: Structure containing the version info
*
* Return: 0 if all goes well, else appropriate error message
*/
int ti_sci_get_revision(struct ti_sci_msg_resp_version *rev_info)
int ti_sci_get_revision(struct ti_sci_msg_version *version)
{
struct ti_sci_msg_resp_version rev_info;
struct ti_sci_msg_hdr hdr;
struct ti_sci_xfer xfer;
int ret;
ret = ti_sci_setup_one_xfer(TI_SCI_MSG_VERSION, 0x0,
&hdr, sizeof(hdr),
rev_info, sizeof(*rev_info),
&rev_info, sizeof(rev_info),
&xfer);
if (ret) {
ERROR("Message alloc failed (%d)\n", ret);
@ -208,6 +211,14 @@ int ti_sci_get_revision(struct ti_sci_msg_resp_version *rev_info)
return ret;
}
memcpy(version->firmware_description, rev_info.firmware_description,
sizeof(rev_info.firmware_description));
version->abi_major = rev_info.abi_major;
version->abi_minor = rev_info.abi_minor;
version->firmware_revision = rev_info.firmware_revision;
version->sub_version = rev_info.sub_version;
version->patch_version = rev_info.patch_version;
return 0;
}
@ -1729,27 +1740,3 @@ int ti_sci_enter_sleep(uint8_t proc_id,
return 0;
}
/**
* ti_sci_init() - Basic initialization
*
* Return: 0 if all goes well, else appropriate error message
*/
int ti_sci_init(void)
{
struct ti_sci_msg_resp_version rev_info;
int ret;
ret = ti_sci_get_revision(&rev_info);
if (ret) {
ERROR("Unable to communicate with control firmware (%d)\n", ret);
return ret;
}
INFO("SYSFW ABI: %d.%d (firmware rev 0x%04x '%s')\n",
rev_info.abi_major, rev_info.abi_minor,
rev_info.firmware_revision,
rev_info.firmware_description);
return 0;
}

View file

@ -2,7 +2,7 @@
* Texas Instruments System Control Interface API
* Based on Linux and U-Boot implementation
*
* Copyright (C) 2018-2022 Texas Instruments Incorporated - https://www.ti.com/
* Copyright (C) 2018-2024 Texas Instruments Incorporated - https://www.ti.com/
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -13,6 +13,41 @@
#include <stdint.h>
#include <stdbool.h>
/**
* User exported structures.
*
* The structures in ti_sci_protocol.h are used by the internal drivers.
* These are the structures that are exported for outside use and populated
* by the internal drivers.
*
* struct ti_sci_msg_version - Structure containing version info
*
* @firmware_description: String describing the firmware
* @firmware_revision: Firmware revision
* @abi_major: Major version of the ABI that firmware supports
* @abi_minor: Minor version of the ABI that firmware supports
* @sub_version: Sub-version number of the firmware
* @patch_version: Patch-version number of the firmware.
*/
struct ti_sci_msg_version {
#define FIRMWARE_DESCRIPTION_LENGTH 32
char firmware_description[FIRMWARE_DESCRIPTION_LENGTH];
uint16_t firmware_revision;
uint8_t abi_major;
uint8_t abi_minor;
uint8_t sub_version;
uint8_t patch_version;
};
/**
* General Message
*
* ti_sci_get_revision - Get the revision of the SCI entity
* @version: Structure containing the version info
*
**/
int ti_sci_get_revision(struct ti_sci_msg_version *version);
/**
* Device control operations
*
@ -225,11 +260,4 @@ int ti_sci_enter_sleep(uint8_t proc_id,
uint8_t mode,
uint64_t core_resume_addr);
/**
* ti_sci_init() - Basic initialization
*
* Return: 0 if all goes good, else appropriate error message.
*/
int ti_sci_init(void);
#endif /* TI_SCI_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -119,10 +119,44 @@ void bl31_plat_arch_setup(void)
void bl31_platform_setup(void)
{
struct ti_sci_msg_version version;
int ret;
k3_gic_driver_init(K3_GIC_BASE);
k3_gic_init();
ti_sci_init();
ret = ti_sci_get_revision(&version);
if (ret) {
ERROR("Unable to communicate with the control firmware (%d)\n", ret);
return;
}
INFO("SYSFW ABI: %d.%d (firmware rev 0x%04x '%s')\n",
version.abi_major, version.abi_minor,
version.firmware_revision,
version.firmware_description);
/*
* Older firmware have a timing issue with DM that crashes few TF-A
* lite devices while trying to make calls to DM. Since there is no way
* to detect what current DM version we are running - we rely on the
* corresponding TIFS versioning to handle this check and ensure that
* the platform boots up
*
* Upgrading to TIFS version 9.1.7 along with the corresponding DM from
* ti-linux-firmware will enable this functionality.
*/
if (version.firmware_revision > 9 ||
(version.firmware_revision == 9 && version.sub_version > 1) ||
(version.firmware_revision == 9 && version.sub_version == 1 &&
version.patch_version >= 7)
) {
if (ti_sci_device_get(PLAT_BOARD_DEVICE_ID)) {
WARN("Unable to take system power reference\n");
}
} else {
NOTICE("Upgrade Firmwares for Power off functionality\n");
}
}
void platform_mem_init(void)