Permission denied when accessing STM2 SoC Level Time Source

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Permission denied when accessing STM2 SoC Level Time Source

Jump to solution
1,693 Views
kawin
Contributor III

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.

0 Kudos
1 Solution
1,608 Views
andrei_skok
NXP Employee
NXP Employee

Hi Kawin

Sorry, I misunderstood your question before.

There is nothing wrong with your operation. Did you forget to load the '*stm.ko' module ?

In addition, you can run the 'git status' command in the linux kernel directory to check whether the patch has been applied.

View solution in original post

0 Kudos
3 Replies
1,609 Views
andrei_skok
NXP Employee
NXP Employee

Hi Kawin

Sorry, I misunderstood your question before.

There is nothing wrong with your operation. Did you forget to load the '*stm.ko' module ?

In addition, you can run the 'git status' command in the linux kernel directory to check whether the patch has been applied.

0 Kudos
1,639 Views
andrei_skok
NXP Employee
NXP Employee

Hi Kawin

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

That is not going to work. You should enable the global stm timer from menuconfig menu with 'bitbake -c menuconfig virtual/kernel'.

Device Drivers ->Clock Source drivers->

andrei_skok_0-1644912828618.png

save and re-compile the kernel.

Below is the test procedure

step1. Boot to reach the Linux console.

step2. Insert the 'fsl_global_time.ko' kernel module with "insmod /lib/modules/5.10.41-rt42+g98b692708f63/kernel/drivers/clocksource/fsl_global_time.ko"

step3. 

andrei_skok_1-1644912828528.png

This should be a document description error.

0 Kudos
1,620 Views
kawin
Contributor III

Hi Andrei,

Could you give me some explanation on why patching defconfig directly wouldn't work? Is there a mistake in the documentation? In any case, should general procedure of patch -> clean -> build work? Since a patch should get applied before the compilation.

Thank you,

Kawin

0 Kudos