Hi all,
I'm getting the following errors when trying to use the STM2 driver as shown in Chapter 14: SoC Level Time Source in the Linux BSP 30.0 user manual.
Init driver
root@s32g274ardb2:~# echo 1 > /sys/devices/platform/40124000.stm/init
-sh: /sys/devices/platform/40124000.stm/init: Permission denied
Reading Timer Value
root@s32g274ardb2:~# cat /sys/devices/platform/40124000.stm/value
cat: /sys/devices/platform/40124000.stm/value: No such file or directory
The kernel has been patched successfully and bitbake virtual/kernel generated Image and dtb without any errors. This is confirmed by looking at the runtime kernel config:
root@s32g274ardb2:~# zcat /proc/config.gz | grep GLOBAL
CONFIG_FSL_GLOBAL_TIME_STM=m
Kernel Config
In fsl-s32-gen1.dtsi (tmp/work/s32g274ardb2-fsl-linux/linux-s32/5.10.41-r0/git/arch/arm64/boot/dts/freescale/fsl-s32-gen1.dtsi), I changed the status of the STM2 device node to "okay":
stm2: stm@40124000{
compatible = "fsl,s32gen1-stm-global";
reg = <0x0 0x40124000 0x0 0x3000>;
clocks = <&clks S32GEN1_SCMI_CLK_STM_MODULE>;
clock-names = "stm";
status = "okay";
};
In s32gen1_defconfig (tmp/work/s32g274ardb2-fsl-linux/linux-s32/5.10.41-r0/git/arch/arm64/configs/s32gen1_defconfig) CONFIG_FSL_GLOBAL_TIME_STM=m was appended to the end like so:
...
# CONFIG_RUNTIME_TESTING_MENU is not set
CONFIG_FSL_GLOBAL_TIME_STM=m
I then created a patch and copied it to sources/meta-alb/recipes-kernel/linux/linux-s32, which get append to the end of linux-s32_5.10.bb file like so:
...
SRC_URI += " file://0001-Enable-Global-Time-Source-and-STM2-device-tree.patch"
After this, kernel is cleaned and build with the following commands:
bitbake -c cleansstate virtual/kernel
bitbake virtual/kernel
The output Image and DTS file is transferred to SD card FAT partition and everything booted up successfully.