-
Notifications
You must be signed in to change notification settings - Fork 8.2k
[WIP] NXP Kinetis DTS Pinmux rework #20398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dts/arm/nxp/nxp_k6x.dtsi
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think a pinmux property like mentioned in Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt in Linux could be used here?
The purpose seems to be to avoid having a ton of nodes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a look into the datasheet I also think it would be most appropriate to use pinmux property for this family.
dts/arm/nxp/nxp_k6x.dtsi
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to use the properties documented in Generic pin multiplexing node content in pinctrl-bindings.txt, for consistency.
Add child-binding to represent the pin config paramaters for given functions on the SoC. Signed-off-by: Kumar Gala <[email protected]>
Convert UART0 on FRDM-K64f (plus a few other UARTs) to new pinmux definition. Signed-off-by: Kumar Gala <[email protected]>
dts/arm/nxp/nxp_k6x.dtsi
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a look into the datasheet I also think it would be most appropriate to use pinmux property for this family.
| &uart0 { | ||
| status = "okay"; | ||
| current-speed = <115200>; | ||
| pinctrl-0 = <&uart0_rx_ptb16 &uart0_tx_ptb17>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be able to fully assess the proposed implementation we would need to generate defines based on pinctrl-0 property. That is, all the data hidden within uart0_rx_ptb16 node should be made available via the UART defines DT_NXP_KINETIS_UART_4006A000_*.
|
The method of storing pinctrl configuration data chosen by Linux DTS is quite different to the way other subsystems, e.g. gpio are configured. pinctrl data are stored as subnodes of pinctrl, while data of other subsystems, e.g. gpio are stored in the parent node. To illustrate the difference: pinctrl: gpio: In the latter case we can generate data directly from the property. The examples come from Linux DTS and not this PR since I would like describe the concept as described and implemented by Linux. The Such approach has some limitations. It seems appropriate if there exists only one allowed pin assignment, e.g. UART0 RX signal can be connected to one pin only, e.g. PB22. It's not that practical when the signal can be connected to several different pins, e.g. one of PB22, PA1, PC18. Which is a typical scenario. In this case the soc dtsi file would provide one default and arbitrary configuration of To work around this issue we could do what this PR proposes, which is define one pin per sub-node and then within pinctrl node provide a sub-node for every pin / mux (pin function) combination. On K64 platform we would have nodes If we want to go a non-standard way it may be easiest to do pinctrl configuration the same way we do gpios. E.g. we could have rx-pins property in board DTS file which could look as follows e.g. the pin / mux definition could be provided via a macro from an easy to search include file e.g. We already have a few families that adopted similar approach to define pin configuration in the current Zephyr tree, namely: Nordic, TI, ESP32. There are also families like Silicon Labs Gecko where it is not possible to provide pin muxing configuration as proposed by Linux DTS since they don't have pinctrl node. Pinmuxing is performed directly by a peripheral itself. |
Can you elaborate? I though this is one standard compliant way to define pin control.
"huge" is only a problem if you expect all possible pin/mux/drive/bias/... combinations to be predefined by a pinctrl state node. A user can create an own pinctrl state node and overload the "standard" DTS. In my view the policy should be:
Document! Read the documentation! I understand this is about ease of use - but for complex or "huge" things a user can be expected to read the documentation.
Pinctrl is very versatile, documented, covered by some presentations and talks. Creating one more way to do the same thing should only be done if it is not the same thing (aka. the concept of a pin controller does not fit to the SoC). |
Some idea's on how to represent the pinmux info in DTS on Kinetis to allow us to auto-generate the info from DTS.
Need to see how we'd convey a pin is used for GPIO and how we'd possibly pass through GPIO config to pinmux (if at all).