diff --git a/samples/drivers/firmware/arm_scmi/CMakeLists.txt b/samples/drivers/firmware/arm_scmi/CMakeLists.txt new file mode 100644 index 000000000000000..613e43fe072807e --- /dev/null +++ b/samples/drivers/firmware/arm_scmi/CMakeLists.txt @@ -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) diff --git a/samples/drivers/firmware/arm_scmi/README.rst b/samples/drivers/firmware/arm_scmi/README.rst new file mode 100644 index 000000000000000..7185ab8faaa15fc --- /dev/null +++ b/samples/drivers/firmware/arm_scmi/README.rst @@ -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 diff --git a/samples/drivers/firmware/arm_scmi/boards/rpi_5.overlay b/samples/drivers/firmware/arm_scmi/boards/rpi_5.overlay new file mode 100644 index 000000000000000..0651760e36d8f9f --- /dev/null +++ b/samples/drivers/firmware/arm_scmi/boards/rpi_5.overlay @@ -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"; + }; + }; +}; diff --git a/samples/drivers/firmware/arm_scmi/prj.conf b/samples/drivers/firmware/arm_scmi/prj.conf new file mode 100644 index 000000000000000..f7fac7e225743c7 --- /dev/null +++ b/samples/drivers/firmware/arm_scmi/prj.conf @@ -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 diff --git a/samples/drivers/firmware/arm_scmi/sample.yml b/samples/drivers/firmware/arm_scmi/sample.yml new file mode 100644 index 000000000000000..3a9254bcf6d6297 --- /dev/null +++ b/samples/drivers/firmware/arm_scmi/sample.yml @@ -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 diff --git a/samples/drivers/firmware/arm_scmi/src/main.c b/samples/drivers/firmware/arm_scmi/src/main.c new file mode 100644 index 000000000000000..1347c81fd3fa5dc --- /dev/null +++ b/samples/drivers/firmware/arm_scmi/src/main.c @@ -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 + +int main(void) +{ + printk("ARM SCMI shell sample\n"); +}