-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
DTS: Convert SAM UART/USART to DT_INST macros (plus pinctrl support) #24319
Conversation
Some checks failed. Please fix and resubmit. checkpatch issues
Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
All Atmel drivers need use nodelabel. I'll test this PR on top of #24110. |
Why? |
Re worked to use DT_NODELABEL
The above was tested and it works. This is an old discussion, people questioned about it on the devicetree slack channel at 2020-04-17, inclusive. Atmel drivers don't work using DT_INST without a property to handle the HW instance. It can't instantiate the proper HW instance using the node instance itself, it simple don't match with HW. If you can't follow, try create a non regular case like disabling USART0 and then try enable only USART1 on SAM_V71_XULT, for instance, then you will see the problem. When you disable USART0 the USART1 will be DT_INST___0 and HW will be wrongly configured. I already sent a patch that can address this but was declined in favor to use DT_NODELABEL without a technical answer at #23335. The #23338, #23332, #23359 are examples how to use HW instance + DT_INST based on #23335 but were closed in favor to use DT_NODELABEL. I'm adding people that questioned on slack to see this case. I think is important everyone have this pretty clear. That said, I've been using since than what seems to be the right solution and sent the #24110 as first PR to collect feedback to continue Atmel drivers conversion. |
@nandojve This PR adds |
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.
@galak Thanks for doing this. Now we finally have a proper I/O handling framework in the device tree for SAM series SoC.
Ohh boy! I was stuck on that and didn't realize! |
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.
After staring at this long enough I think it makes sense and looks clean. One anomaly in the documentation for the yaml (seems to cross compatibles).
The atmel,pins property will be utilized to describe pin mux configuration. The property will be a phandle-array in which the phandle points to the given GPIO port the pin is on, the pin number, and the mux configuration. This change updates the atmel,sam-gpio binding to support that phandle-array and updates the associated SoC dtsi files as well. Signed-off-by: Kumar Gala <[email protected]>
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 don't see anymore and removed the DNM.
Add pinctl support for the SAM UART and SAM USART devices. We update the UART and USART bindings to have pinctrl-0 bindings that are expected to have 2 phandles to the RX & TX pinctrl nodes. The pinctrl nodes will have an 'atmel,pins' property that describes the GPIO port, pin and periphal configuration for that pin. We add sam*-pinctrl.dtsi files with all the various pin ctrl configuration operations supported by the given SoC family. These files are based on data extracted from the Atmel ASF HAL (in include/sam<FAMILY>/pio/*.h). Signed-off-by: Kumar Gala <[email protected]>
Add a set of macros that will create a struct soc_gpio_pin initialization based on data extracted from device tree. This should allow replacing the static data in soc_pinmap.h with data coming from devicetree instead. Signed-off-by: Kumar Gala <[email protected]>
Reworked uart_sam driver to utilize new DT_INST macros as part of this rework we also now get pin ctrl/mux configuration information from the device tree instead of via Kconfig and defines in soc_pinmap.h We remove defines from dts_fixup.h and soc_pinmap.h and associated Kconfig symbols that are no longer needed due to getting all that information from devicetree. Signed-off-by: Kumar Gala <[email protected]>
Reworked usart_sam driver to utilize new DT_INST macros as part of this rework we also now get pin ctrl/mux configuration information from the device tree instead of via Kconfig and defines in soc_pinmap.h We remove defines from dts_fixup.h and soc_pinmap.h and associated Kconfig symbols that are no longer needed due to getting all that information from devicetree. Signed-off-by: Kumar Gala <[email protected]>
Convert Atmel SAM UART & USART to the new DT_INST macros and as part of this conversion we introduce basic pinctrl support for the ATMEL SAM.