forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
samples: drivers: firmware: add arm scmi sample
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
Showing
6 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} |