-
Notifications
You must be signed in to change notification settings - Fork 8.2k
pinctrl: mcux_rt1xxx: add pinctrl support for rt1xxx series #41448
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
add dts binding dedicated for mcux iomuxc settings Signed-off-by: Hake Huang <[email protected]>
enable pinctrl in i2s and lpuart driver dts Signed-off-by: Hake Huang <[email protected]>
select pinctrl by default in rt series Signed-off-by: Hake Huang <[email protected]>
|
below warning in CI is a must for pinctrl |
danieldegrasse
left a comment
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.
Thanks for getting this implemented @hakehuang! Just a note: I built a version of pinctrl for the RT1xxx based off this PR (here's a link to the fork), that uses pin nodes at the SOC level as opposed to pin groupings defined at the board level. After implementing that method of pinctrl, I think your implementation may be the cleaner method, but I'm interested to hear your thoughts.
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.
Maybe move the inputOnfield parameter in the pinmux property to be a configurable value instead of part of the pin definition? My reasoning here is that the the inputOnfield property is usually given as an argument to IOMUXC_SetPinMux, where as the rest of the constants defined here are not
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.
looks better.
dts/arm/nxp/nxp_rt-pinctrl.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.
Why is this file necessary?
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.
yes it is not used, remove
dts/arm/nxp/nxp_rt.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.
Do we need address-cells and size-cells? The dts parser was giving me a warning that they were unused
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.
yes, they are not used for now, remove it
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.
These constants are defined in the device files in the HAL, see here
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.
right, but dts can not include those header file. I can not find a way for it
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.
does the DTS use these definitions directly? I thought it pulled from the yaml file for pinctrl, and that these constants would only be used in the C driver file
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.
right, dts does not use this, update to use sdk macros.
add pinctrl_soc required headers Signed-off-by: Hake Huang <[email protected]> Signed-off-by: Daniel DeGrasse <[email protected]>
add dtsi settings for rt series dtsi use gpr to replace pinmux nxp iomuxc has gpr which has more settings than mux and io settings current solution is to export gpr separately and access then directly Signed-off-by: Hake Huang <[email protected]> Signed-off-by: Daniel DeGrasse <[email protected]>
enable pin control in board level Signed-off-by: Hake Huang <[email protected]> Signed-off-by: Daniel DeGrasse <[email protected]>
add pinctrl driver for rt1xxx Signed-off-by: Hake Huang <[email protected]>
enable pinctrl in lpuart Signed-off-by: Hake Huang <[email protected]>
enable i2s pinctrl Signed-off-by: Hake Huang <[email protected]>
rename pinmux to gpr different from pinmux and io settings gpr will do more IO settings. Signed-off-by: Hake Huang <[email protected]>
@danieldegrasse , I leave some comments to your commit directly, and I will close this PR, and wait for yours |
|
@hakehuang To clarify- I think your approach is probably best here, I just wanted to make my change known in case we wanted to go that direction. Do you feel that the other approach would work better for the RT parts? I prefer your approach because it feels like it will lend itself better to auto generation of DTS files |
so the differences are:
@dleach02, @mmahadevan108 do you have any comments on this? btw: I add you as code-signer, thanks for the ideas on inoutput, and header |
I think that's correct, yeah. The primary differences are that the pins can no longer be grouped by peripheral, and that SOCs will have all pins defined in a dtsi file (as opposed to per board definitions). I agree that grouped pins are a big benefit to your method. When I set out to implement my method, I felt it would better lend itself to auto generation of board level DTS files, but after comparing each approach I no longer believe that. An auto generation tool would likely be aware of the relevant registers used to configure each pin, but would not be aware of the specific DTS names we used for each pinmux node in my approach. |
@danieldegrasse so you mean like the IOMUXC_GPIO_AD_B1_09_SAI1_MCLK is not consist over each soc? so the board dts will suffer to re-implement them, and if in this case use a soc.h file would be more concise, as we only need update the board pinctrl.dtsi. am I right? |
|
@hakehuang Exactly, when moving between SOCs (or implementing a custom board) having all pinmux possibilities defined at the soc level in a dtsi file would simplify hand-coding new board pinctrl dts files. However, if auto generation of the board level dts files became an option, then your method would work best. The reason I think that is because an autogeneration tool would always be aware of the SOC level registers used for configuring pinctrl, but would not necessarily be aware of the pinctrl node names in Zephyr. If the auto generation tool was made aware of the pinctrl node names defined at the soc level dtsi than my method would also work. |
@danieldegrasse , you mean IOMUXC_GPIO_AD_B1_09_SAI1_MCLK? this name is generated by the config tools for device header file, I guess those can be aligned in auto tools. |
|
@hakehuang yeah, values like IOMUXC_GPIO_AD_B1_09_SAI1_MCLK. I guess the core question is this: Are those names defined by SOC data the config tools use, or by the config tools themselves? If the names are defined by SOC data, then I think my approach will work without too much risk, since those names are unlikely to change. Otherwise, I think we should go with your method. |
@danieldegrasse those names are defined by config tools usually default value will not change. so I think you method will always work. |
|
@hakehuang I've been working on this for a few days, and after some discussions with the config tools team I've opened #41810. The main differences are that a header file is used to define the IOMUXC constants for pinmux configuration, and the pinctrl node property names are changed to make future auto generation efforts of the board level DTSI file more viable. |
pinctrl: nxp imxrt1xxx: add pinctrl support
demo on lpuart and i2s driver.
nxp rt1xxx series has different iomuxc so we add sepcial pincontrol bindings definitions.
and for gpr registers sets we rename former pinmux to gpr, and driver can access gpr directly demoed in i2s driver
tested on imxrt1060_evk board with hello_world