Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Kconfig.zephyr
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ osource "$(KCONFIG_BINARY_DIR)/Kconfig.shield.defconfig"
# This loads Zephyr base shield defconfigs
source "boards/shields/*/Kconfig.defconfig"

source "$(BOARD_DIR)/Kconfig.defconfig"
osource "$(BOARD_DIR)/Kconfig.defconfig"

# This loads custom SoC root defconfigs
osource "$(KCONFIG_BINARY_DIR)/Kconfig.soc.defconfig"
Expand Down
1 change: 1 addition & 0 deletions boards/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

config BOARD
string
default "$(dt_node_str_prop,/,model)"
help
This option holds the name of the board and is used to locate the files
related to the board in the source tree (under boards/).
Expand Down
1 change: 1 addition & 0 deletions doc/build/kconfig/preprocessor-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ while the ``*_hex`` version returns a hexadecimal value starting with ``0x``.
$(dt_nodelabel_has_prop,<node label>,<prop>)
$(dt_node_int_prop_int,<node path>,<prop>[,<unit>])
$(dt_node_int_prop_hex,<node path>,<prop>[,<unit>])
$(dt_node_str_prop,<node path>,<prop>)
$(dt_node_str_prop_equals,<node path>,<prop>,<value>)
$(dt_nodelabel_has_compat,<node label>,<compatible string>)
$(dt_nodelabel_path,<node label>)
Expand Down
5 changes: 5 additions & 0 deletions dts/bindings/base/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ properties:
deprecated: true
description: Human readable string describing the device (used as device_get_binding() argument)

model:
type: string
required: false
description: specifies the manufacturer’s model number of the device
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/number/name


clocks:
type: phandle-array
required: false
Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/devicetree.h
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@
* A property's type is usually defined by its binding. In some
* special cases, it has an assumed type defined by the devicetree
* specification even when no binding is available: "compatible" has
* type string-array, "status" and "label" have type string, and
* type string-array, "status", "model", and "label" have type string, and
* "interrupt-controller" has type boolean.
*
* For other properties or properties with unknown type due to a
Expand Down
3 changes: 2 additions & 1 deletion scripts/dts/python-devicetree/src/devicetree/edtlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2964,7 +2964,7 @@ class _BindingLoader(Loader):
#
# Zephyr: do not change the _DEFAULT_PROP_TYPES keys without
# updating the documentation for the DT_PROP() macro in
# include/devicetree.h.
# include/zephyr/devicetree.h.
#

_DEFAULT_PROP_TYPES = {
Expand All @@ -2973,6 +2973,7 @@ class _BindingLoader(Loader):
"reg": "array",
"reg-names": "string-array",
"label": "string",
"model": "string",
"interrupts": "array",
"interrupts-extended": "compound",
"interrupt-names": "string-array",
Expand Down
26 changes: 26 additions & 0 deletions scripts/kconfig/kconfigfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,31 @@ def dt_node_int_prop(kconf, name, path, prop, unit=None):
return hex(_node_int_prop(node, prop, unit))


def dt_node_str_prop(kconf, _, path, prop):
"""
This function takes a 'path' and property name ('prop') looks for an EDT
node at that path. If it finds an EDT node, it will look to see if that
node has a property 'prop' of type string and will return the value of
the property 'prop' as a string, if not it will return "".
"""

if doc_mode or edt is None:
return ""

try:
node = edt.get_node(path)
except edtlib.EDTError:
return ""

if prop not in node.props:
return ""

if node.props[prop].type != "string":
return ""

return node.props[prop].val


def dt_node_array_prop(kconf, name, path, prop, index, unit=None):
"""
This function takes a 'path', property name ('prop') and index ('index')
Expand Down Expand Up @@ -667,6 +692,7 @@ def shields_list_contains(kconf, _, shield):
"dt_node_int_prop_hex": (dt_node_int_prop, 2, 3),
"dt_node_array_prop_int": (dt_node_array_prop, 3, 4),
"dt_node_array_prop_hex": (dt_node_array_prop, 3, 4),
"dt_node_str_prop": (dt_node_str_prop, 2, 2),
"dt_node_str_prop_equals": (dt_node_str_prop_equals, 3, 3),
"dt_nodelabel_has_compat": (dt_nodelabel_has_compat, 2, 2),
"dt_nodelabel_path": (dt_nodelabel_path, 1, 1),
Expand Down