Skip to content

Commit

Permalink
samples: drivers: firmware: add arm scmi sample
Browse files Browse the repository at this point in the history
Add ARM SCMI shell sample application.

Signed-off-by: Grygorii Strashko <[email protected]>
  • Loading branch information
Grygorii Strashko committed Aug 22, 2024
1 parent 2703aa8 commit 8dfde74
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 0 deletions.
9 changes: 9 additions & 0 deletions samples/drivers/firmware/arm_scmi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2024 EPAM Systems
#
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(arm_scmi_shell)

target_sources(app PRIVATE src/main.c)
77 changes: 77 additions & 0 deletions samples/drivers/firmware/arm_scmi/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
.. _arm_scmi_shell:

ARM SCMI shell sample
#####################

Overview
********

This sample demonstrates the usage of ARM SCMI. This sample
provides access to the ARM SCMI shell interface for demo and testing purposes
of different ARM SCMI protocols:

* Base protocol
* Reset domain management protocol

Caveats
*******

Zephyr ARM SCMI relies on the firmware running in EL3 layer to be compatible
with Arm System Control and Management Interface Platform Design Document
and ARM SCMI driver used by the sample.

Building and Running
********************
For building the application:

.. zephyr-app-commands::
:zephyr-app: samples/drivers/firmware/arm_scmi
:board: rpi_5
:goals: build

Running on RPI5
^^^^^^^^^^^^^^^

* The Trusted Firmware-A (TF-A) binary should be placed at RPI5 rootfs
as `armstub8-2712.bin`.
* The Zephyr application binary should be placed at RPI5 rootfs
as `zephyr.bin`.
* Modify config.txt parameter `kernel=zephyr.bin`

Sample Output
*************

.. code-block:: console
I: scmi base protocol v0002.0000
I: scmi base revision info vendor 'EPAM:' fw version 0x0 protocols:2 agents:0
I: scmi calling method:smc
I: scmi reset rotocol version 0x0001.0000 num_domains:4
*** Booting Zephyr OS build v3.6.0-99-g75fb2f9016d3 ***
ARM SCMI shell sample
uart:~$ arm_scmi base revision \
I: scmi base protocol v0002.0000
I: scmi base revision info vendor 'EPAM:' fw version 0x0 protocols:2 agents:0
ARM SCMI base protocol v0002.0000
vendor :EPAM
subvendor :
fw version :0x0
protocols :2
num_agents :0
uart:~$ arm_scmi reset list
domain_id,name,latency,attributes
0,swinit_pcie1,0x7fffffff,0x00000000
1,bridge_pcie1,0x7fffffff,0x00000000
2,swinit_pcie2,0x7fffffff,0x00000000
3,bridge_pcie2,0x7fffffff,0x00000000
uart:~$ arm_scmi reset info 1
ARM SCMI reset domain: 1
name : bridge_pcie1
latency : unk
attr : 0x00000000
uart:~$ arm_scmi reset a
assert autoreset
uart:~$ arm_scmi reset assert 1
uart:~$ arm_scmi reset deassert 1
35 changes: 35 additions & 0 deletions samples/drivers/firmware/arm_scmi/boards/rpi_5.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2024 EPAM Systems
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
firmware {
scmi {
compatible = "arm,scmi-smc";
arm,smc-id = <0x82000002>;
#address-cells = <1>;
#size-cells = <0>;
shmem = <&scmi_buf>;

scmi_reset: protocol@16 {
compatible = "arm,scmi-reset";
reg = <0x16>;
#reset-cells = <1>;
};
};
};

reserved-memory {
#address-cells = <2>;
#size-cells = <1>;
ranges;

scmi_buf: scmi@3ff00000 {
compatible = "zephyr,memory-region";
reg = <0x0 0x3ff00000 4096>;
zephyr,memory-region = "scmi";
};
};
};
11 changes: 11 additions & 0 deletions samples/drivers/firmware/arm_scmi/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2024 EPAM Systems
# SPDX-License-Identifier: Apache-2.0

CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y
CONFIG_PRINTK=y
CONFIG_SHELL=y

CONFIG_ARM_SCMI=y
CONFIG_RESET=y
CONFIG_ARM_SCMI_SHELL=y
14 changes: 14 additions & 0 deletions samples/drivers/firmware/arm_scmi/sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sample:
name: ARM SCMI shell sample
common:
filter: dt_compat_enabled("arm,scmi-smc") and dt_compat_enabled("arm,scmi-smc-param")
integration_platforms:
- rpi_5
tests:
sample.firmware.arm_scmi_shell:
tags:
- drivers
- firmware
- arm_scmi
- shell
harness: console
14 changes: 14 additions & 0 deletions samples/drivers/firmware/arm_scmi/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 EPAM Systems
*
* SPDX-License-Identifier: Apache-2.0
*
* A sample application for demonstrating ARM SCMI Platform interface access using shell commands.
*/

#include <zephyr/kernel.h>

int main(void)
{
printk("ARM SCMI shell sample\n");
}

0 comments on commit 8dfde74

Please sign in to comment.