Forum Discussion
HPS access to SDM for internal TDS readings
- 3 years ago
Hi,
yes I got it to work on stratix 10 with linux 5.15.30-lts and uboot 2022.01, ATF 2.6.1
The process is to enable the HWMON in the defconfig of the kernel (CONFIG_SENSORS_SOC64=y) and add a new node to the device tree that contains the labels and register address of the ADC channels that is then readout by the SDM.
look at 5.15.70-lts for some documentation and an example of adding these nodes to the device tree. You may also look at the patches made to this tag for the HWMON and apply them yourself if needed.
After doing that, booting into HPS in HPS first mode without loading any bitstreams, you can read the voltages and the die temperature with a system call at " /sys/class/hwmon/hwmon0/[<name>_label or <name>_input> "
the values are already multiplied by 1000 in the driver.
Thanks
Hi,
Looking at the way the RSU feature works on statix10, it also communicates with the SDM from HPS; it does so through the following flow:
RSU library (on HPS at EL0) --> intel RSU driver (EL1) --> intel SVC driver (EL1) --> SMC handler (EL3) --> SDM (Hardware)
This happens without programming a bitstream on the FPGA, in HPS first mode. The SVC driver and the RSU driver are implemented under "'/driver/firmware/" in the Linux repo under "stratix10-svc.c and stratix10-rsu.c". The SVC driver already has SMC call backs for reading the temperature and the voltage for HWMON.
There seems to have been some support for HWMON driver under "/driver/hwmon/soc64-hwmon.c" for which the documentation is limited or missing for kernel tag "5.15.30-lts".
I can also see that we can read these values in U-BOOT with a SMC call, for example "smc 0xc2000021 1", this is all doable without loading a bitsteam or having a mailbox IP.
I am now confused as to how we are able to do these if mailbox is needed, and further mode, why (how) can we do the same for reading the temperature and the voltage from HPS?! Doesn't the ATF boot flow enable these features because it allows SMC calls to be made?!
Does one have to implement a kernel module (or use the existing /drivers/hwmon/soc64-hwmon.c) first and the use that to make calls to the SDM from HPS? similar to how the 'librsu.c" is doing? if so, I'd appreciate a reference design or example code!
Thank you!
Kind regards