Skip to content
Permalink
Browse files

scripts: dts: Add extraction of clock frequency for fixed clock

This patch adds generation of `*_FIXED_CLOCK_FREQUENCY` macros for
clock consuming nodes that are provided with a fixed rate clock.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
  • Loading branch information...
anangl authored and galak committed May 24, 2019
1 parent 890b9eb commit bb8dddfa99544b2a61f0698490b6480a149152d0
Showing with 33 additions and 0 deletions.
  1. +33 −0 scripts/dts/extract/clocks.py
@@ -150,6 +150,39 @@ def _extract_consumer(self, node_path, clocks, def_label):
clock_label,
prop_alias)

# If the provided clock has a fixed rate, extract its frequency
# as a macro generated for the clock consumer.
if clock_provider['props']['compatible'] == 'fixed-clock':
clock_prop_name = 'clock-frequency'
clock_prop_label = 'CLOCKS_CLOCK_FREQUENCY'
if clock_index == 0 and \
len(clocks) == (len(clock_cells) + 1):
index = ''
else:
index = str(clock_index)
clock_frequency_label = \
self.get_label_string([clock_consumer_label,
clock_prop_label,
index])

prop_def[clock_frequency_label] = \
clock_provider['props'][clock_prop_name]
add_compat_alias(
node_path,
self.get_label_string([clock_prop_label, index]),
clock_frequency_label,
prop_alias)
if node_path in aliases:
add_prop_aliases(
node_path,
lambda alias:
self.get_label_string([
alias,
clock_prop_label,
index]),
clock_frequency_label,
prop_alias)

insert_defs(node_path, prop_def, prop_alias)

clock_cell_index = 0

0 comments on commit bb8dddf

Please sign in to comment.
You can’t perform that action at this time.