Skip to content
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

Convert SAM SoC SERIAL drivers to DT macros #24110

Closed

Conversation

nandojve
Copy link
Member

@nandojve nandojve commented Apr 6, 2020

This convert Atmel SAM/SAM0 SERIAL drivers to use DT macros.

see #23107

@zephyrbot
Copy link
Collaborator

zephyrbot commented Apr 6, 2020

All checks passed.

checkpatch (informational only, not a failure)

-:187: WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon
#187: FILE: drivers/serial/uart_sam.c:340:
+#define UART_SAM_IRQ_HANDLER_DECL(n)					\
+static void uart##n##_sam_irq_config_func(struct device *port);

-:391: WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (8, 8)
#391: FILE: drivers/serial/uart_sam0.c:933:
 	do {								\
+	IRQ_CONNECT(DT_IRQ_BY_IDX(UART(n), m, irq),			\

-:487: WARNING:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
#487: FILE: drivers/serial/uart_sam0.c:987:
+#define UART_SAM0_SERCOM_PADS(n)					\
+	(DT_PROP(UART(n), rxpo) << SERCOM_USART_CTRLA_RXPO_Pos) |	\
+	(DT_PROP(UART(n), txpo) << SERCOM_USART_CTRLA_TXPO_Pos)

-:699: WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon
#699: FILE: drivers/serial/usart_sam.c:341:
+#define USART_SAM_IRQ_HANDLER_DECL(n)					\
+static void usart##n##_sam_irq_config_func(struct device *port);

- total: 0 errors, 4 warnings, 986 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Your patch has style problems, please review.

NOTE: Ignored message types: AVOID_EXTERNS BRACES CONFIG_EXPERIMENTAL CONST_STRUCT DATE_TIME FILE_PATH_CHANGES MINMAX NETWORKING_BLOCK_COMMENT_STYLE PRINTK_WITHOUT_KERN_LEVEL SPLIT_STRING VOLATILE

NOTE: If any of the errors are false positives, please report
      them to the maintainers.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

@nandojve nandojve added the platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM) label Apr 6, 2020
@stephanosio stephanosio added area: Devicetree area: Drivers area: UART Universal Asynchronous Receiver-Transmitter labels Apr 6, 2020
Copy link
Member

@stephanosio stephanosio left a comment

Choose a reason for hiding this comment

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

I can see that we cannot use DT_INST_n here because the SAM/SAM0 device tree does not fully incorporate device clock and I/O mappings, and DT_INST_n does not necessarily match the UART_n or SERCOM_n definitions used to infer device clock and I/Os.

This should eventually be fixed, but I guess that is out of scope for this PR.

drivers/serial/uart_sam.c Outdated Show resolved Hide resolved
drivers/serial/uart_sam0.c Outdated Show resolved Hide resolved
@nandojve
Copy link
Member Author

rebase and add d5d1639 to fix sam3x. Now we need all nodes with index.

Convert driver to use new device tree macros.

see zephyrproject-rtos#23107

Signed-off-by: Gerson Fernando Budke <[email protected]>
Convert driver to use new device tree macros.

see zephyrproject-rtos#23107

Signed-off-by: Gerson Fernando Budke <[email protected]>
Convert driver to use new device tree macros.

see zephyrproject-rtos#23107

Signed-off-by: Gerson Fernando Budke <[email protected]>
The Atmel UART driver now uses new DT macros and need use NODELABEL to
select proper node. The driver now needs search by name and index to
find the right node. This rename SAM3X uart to uart0 to be compliant.

Signed-off-by: Gerson Fernando Budke <[email protected]>
@galak
Copy link
Collaborator

galak commented Apr 14, 2020

The SAM (not SAM0) part of this should now be handled by #24319

@nandojve
Copy link
Member Author

Close in favor of #24319, #24572.

@nandojve nandojve closed this Apr 21, 2020
@nandojve nandojve deleted the dt_inst_sam_serial branch April 28, 2020 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Boards area: Devicetree area: Drivers area: UART Universal Asynchronous Receiver-Transmitter platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants