Skip to content

Commit 6ea8d6f

Browse files
VivekNagamallazeddii
authored andcommitted
lopper: assists: gen_domain_dts: Generate rtc-counter wrapper for xlnx,zynqmp-rtc
Create a zephyr,rtc-counter child node under the generated xlnx,zynqmp-rtc node and update the rtc alias to point to the wrapper node used by the Zephyr RTC framework. Also correct the fallback RTC clock frequency from 32767 Hz to 32768 Hz. This enables RTC samples and tests to access the Xilinx RTC through the upstream rtc-counter based architecture. Signed-off-by: Vivek Nagamalla <vivek.nagamalla@amd.com>
1 parent 4b1ac26 commit 6ea8d6f

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

lopper/assists/gen_domain_dts.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ def xlnx_generate_zephyr_domain_dts_arm(tgt_node, sdt, options, machine):
851851
# Set clock frequency for RTC
852852
# Revert this snippet once the clock support is added in sdtgen
853853
if node.propval('clock-frequency') == ['']:
854-
node["clock-frequency"] = 32767
854+
node["clock-frequency"] = 32768
855855
elif compatible == "cdns,ttc":
856856
# TTC: Convert 3-cell interrupts to 4-cell GIC format by adding 0xa0 priority
857857
intr_list = node["interrupts"].value
@@ -910,9 +910,17 @@ def xlnx_generate_zephyr_domain_dts_arm(tgt_node, sdt, options, machine):
910910
if ufs_nodes:
911911
ufs_node = sdt.tree.pnode(ufs_nodes[0].phandle)
912912
sdt.tree['/aliases'] + LopperProp(name="ufs0", value = ufs_node.abs_path)
913+
# Add a zephyr,rtc-counter child node for the RTC counter framework.
914+
# update the "rtc" alias to reference the wrapper node used by RTC APIs.
913915
if rtc_nodes:
914916
rtc_node = sdt.tree.pnode(rtc_nodes[0].phandle)
915-
sdt.tree['/aliases'] + LopperProp(name="rtc", value = rtc_node.abs_path)
917+
sdt.tree['/aliases'] + LopperProp(name="rtc", value = rtc_node.abs_path + "/rtc-counter")
918+
rtc_counter_node = LopperNode()
919+
rtc_counter_node.name = "rtc-counter"
920+
rtc_counter_node['compatible'] = "zephyr,rtc-counter"
921+
rtc_counter_node['status'] = "okay"
922+
rtc_counter_node['alarms-count'] = 1
923+
rtc_node.add(rtc_counter_node)
916924

917925
for node in root_sub_nodes:
918926
if node.propval("compatible") != ['']:

0 commit comments

Comments
 (0)