-
Notifications
You must be signed in to change notification settings - Fork 166
dts: add include file required by iMX.RT pinctrl implementation #132
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
|
Is it possible to add a comment block describing what the 5 numbers in each macro. |
cfcfdb3 to
d0c0505
Compare
|
@mmahadevan108 Yes, I updated the pinctrl dtsi file with a comment block describing the purpose of each register |
| * <mux_register mux_mode input_register input_daisy config_register> | ||
| * the mux_register and input_daisy reside in the IOMUXC peripheral, and | ||
| * the pinctrl driver will write the mux_mode and input_daisy values into | ||
| * each register, respectively. the config_register is used to configure |
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.
Minor issue. Capital T for the.
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, fixed now
fc6667a to
9768ebf
Compare
Add SOC level include file for RT1062 pinctrl implementation, which defines all pin mux options Signed-off-by: Daniel DeGrasse <[email protected]>
9768ebf to
45bd658
Compare
| IOMUXC_GPIO_AD_B0_00_FLEXPWM2_PWMA03: IOMUXC_GPIO_AD_B0_00_FLEXPWM2_PWMA03 { | ||
| pinmux = <0x401f80bc 0 0x401f8474 2 0x401f82ac>; | ||
| bias-bus-hold; | ||
| drive-strength = <6>; | ||
| nxp,speed = <2>; | ||
| slew-rate = <0>; | ||
| }; |
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.
A few comments:
- Some of these properties seem redundant here, DT bindings can provide defaults.
- Node names should
use_lowercase, by convention - Remember autogenerated nodes are only suitable for a single state (I suppose
defaulthere). How will, e.g.sleepstate be solved in this case? - Node naming structure should be documented
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.
- The core issue I'm running into with DT binding defaults here is that not every pin on the SOC has the same set of default register values. Since there are many permutations of register values possible, several different DT bindings would need to be created to provide defaults. Another method I could use is to have the driver check if a property is actually present before configuring it, and otherwise leave it at the SOC default. Do you think that would work better?
- Noted, I'll fix this in the next push.
- That's a good question, and an issue with this approach I hadn't considered. I looked at ST's implementation and do not see how they solve it. Do you know what approach they are using?
- Same as point 2, I'll fix this in the next push. Just want to wait to update this PR until we've worked through your 1st and 3rd points
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.
@gmarull Just wanted to make you aware of this PR: zephyrproject-rtos/zephyr#42238. I opened a second PR primarily so that both the pin node and pin group approaches could be compared, rather than replacing the current PR with a pin group based approach.
In that PR, the pinctrl driver does not modify a given bitfield in the SOC pin configuration register unless the board level pinctrl node sets a property. The pin group based approach should solve the issue with states, since pinctrl nodes in different groups can select the same pinmux setting but use different pin configuration settings for something like a sleep state.
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.
- The core issue I'm running into with DT binding defaults here is that not every pin on the SOC has the same set of default register values. Since there are many permutations of register values possible, several different DT bindings would need to be created to provide defaults. Another method I could use is to have the driver check if a property is actually present before configuring it, and otherwise leave it at the SOC default. Do you think that would work better?
I could probably provide a more informed advice if you can provide me with a datasheet (and concrete section) to look at. Do all settings have different defaults, for example slew-rate, speed, etc.?
- That's a good question, and an issue with this approach I hadn't considered. I looked at ST's implementation and do not see how they solve it. Do you know what approach they are using?
In case of STM32 low power is achieved by configuring pin in analog mode, so they basically provide predefined nodes for analog config, see zephyrproject-rtos/hal_stm32#126 (ongoing).
pinctrl-0 = <&i2c0_scl_pa0 &i2c0_sda_pa1>;
pinctrl-1 = <&analog_pa0 &analog_pa1>;
pinctrl-names = "default", "sleep";
GD32 is a similar case but doesn't pre-define nodes, see https://github.com/zephyrproject-rtos/hal_gigadevice/blob/main/include/dt-bindings/pinctrl/gd32f450i(g-i-k)xx-pinctrl.h#L105-L122
&i2c0_default {
group1 {
pinmux = <I2C0_SCL_PA0>, <I2C0_SDA_PA1>;
bias-open-drain;
};
};
&i2c0_sleep {
group1 {
pinmux = <ANALOG_PA0>, <ANALOG_PA1>;
};
};
...
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
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.
I could probably provide a more informed advice if you can provide me with a datasheet (and concrete section) to look at. Do all settings have different defaults, for example slew-rate, speed, etc.?
Here's a link to the reference manual for the RT1060 (NXP requires you to create a free account to download it). The specific section I'm looking at is 11.7, IOMUXC Memory Map/Register definition. You can see that the reset values for various SOC pin configurations (for example DSE in IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_05 and IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_06) differ.
Usually the only settings that will differ are the PUE, PUS and DSE bits, but I have only done this comparison on the RT1060, so ideally no register bit fields would be assigned a driver wide default, since other SOCs might have different default values for these bits.
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 the reference manual link. After looking in more detail, I think you have these options:
- Use autogenerated nodes containing all register defaults. They can be overridden at the board level as needed. This sounds like the safest option in this particular case.
- Autogenerate pinmux combinations, and force people to define all fields that have “no default”.
- Autogenerate pinmux combinations, and have a special value to indicate user has not specified a certain property value, meaning it will be left as is. This may be dangerous because the current value may not always be register default (e.g. a bootloader tweaking things).
So in the end it's a vendor decision, take the option that you think your users will feel more comfortable, or are used to. Human factor is important: people will be reading and writing these files, so it has to be easy and non-error-prone. I don't have any preference, as soon as standard properties are used when available.
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.
- Use autogenerated nodes containing all register defaults. They can be overridden at the board level as needed. This sounds like the safest option in this particular case.
I agree that this is the safest option, but I have the following concerns:
- Defining a large number of states for a given peripheral's pins becomes challenging (for example pin states corresponding to bus speed for an SDHC)
- Our linux capable cores use the pin group implementation, as opposed to pin nodes.
I think we may end up using option 2. Forcing the user to define all fields feels a bit unfriendly, but it prevents issues like you mentioned in option 3. Do you have any issues if we proceed with that approach (outside of the comments you have left on that PR)?
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.
It's really a vendor decision, I have no preference.
|
Closing this PR in favor of #136, which enables pin groups |
Add SOC level include file for RT1062 pinctrl implementation, which
defines all pin mux options
Signed-off-by: Daniel DeGrasse [email protected]