tests: drivers: tisci: TISCI driver test

TISCI driver test added to validate the TISCI API
functionality in Zephyr. This test is for the target
am243x_evm/am2434/r5f0_0.

Signed-off-by: Dave Joseph <d-joseph@ti.com>
This commit is contained in:
Dave Joseph 2025-06-23 11:07:23 +05:30 committed by Fabio Baltieri
parent fb3c562644
commit 7b7e747520
4 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(tisci_test)
target_sources(app PRIVATE src/main.c)

View File

@ -0,0 +1,3 @@
CONFIG_ZTEST=y
CONFIG_TISCI=y
CONFIG_ASSERT=n

View File

@ -0,0 +1,63 @@
/*
* Copyright (c) 2025 Texas Instruments Incorporated
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/ztest.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/firmware/tisci/tisci.h>
ZTEST(tisci, test_tisci_api)
{
const struct device *dmsc = DEVICE_DT_GET(DT_NODELABEL(dmsc));
zassert_not_null(dmsc, "Unable to get dev");
zassert_true(device_is_ready(dmsc), "DMSC device not ready");
struct tisci_version_info ver;
int ret = tisci_cmd_get_revision(dmsc, &ver);
zassert_ok(ret, "Failed to get TISCI revision");
uint64_t freq = 0;
ret = tisci_cmd_clk_get_freq(dmsc, 152, 0, &freq);
zassert_ok(ret, "Failed to get clock freq");
uint64_t min_freq = 96000000, target_freq = 96000000, max_freq = 96000000;
ret = tisci_cmd_clk_set_freq(dmsc, 152, 0, min_freq, target_freq, max_freq);
zassert_ok(ret, "Failed to set clock freq");
freq = 0;
ret = tisci_cmd_clk_get_freq(dmsc, 152, 0, &freq);
zassert_ok(ret, "Failed to get clock freq after set");
zassert_equal(freq, target_freq, "Clock freq after set does not match target");
ret = tisci_cmd_get_device(dmsc, 0);
zassert_ok(ret, "Failed to turn ON power domain device 0");
uint32_t clcnt = 0, resets = 0;
uint8_t p_state = 0, c_state = 0;
int state_ret = tisci_get_device_state(dmsc, 0, &clcnt, &resets, &p_state, &c_state);
zassert_ok(state_ret, "Failed to get device 0 state after ON");
ret = tisci_cmd_put_device(dmsc, 0);
zassert_ok(ret, "Failed to turn OFF power domain device 0");
clcnt = resets = 0;
p_state = c_state = 0;
state_ret = tisci_get_device_state(dmsc, 0, &clcnt, &resets, &p_state, &c_state);
zassert_ok(state_ret, "Failed to get device 0 state after OFF");
}
ZTEST_SUITE(tisci, NULL, NULL, NULL, NULL, NULL);

View File

@ -0,0 +1,13 @@
# Copyright 2025 Texas Instruments Incorporated
# SPDX-License-Identifier: Apache-2.0
tests:
drivers.tisci:
tags:
- drivers
- tisci
timeout: 500
integration_platforms:
- am243x_evm/am2434/r5f0_0
platform_allow:
- am243x_evm/am2434/r5f0_0