-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
stm32f4: Add support for UART4 to 10 #27
Conversation
drivers/serial/uart_stm32.c
Outdated
#ifdef CONFIG_CLOCK_CONTROL_STM32_CUBE | ||
.pclken = { .bus = STM32_CLOCK_BUS_APB2, | ||
.enr = LL_APB2_GRP1_PERIPH_USART1 }, | ||
#define STM32Fxxx_CLOCK_UART(type, apb, n) \ |
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.
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'm ok with this while we still work on generation, it helps at least see the pattern for the STM UART
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.
Ok I will change the name for all macro.
drivers/serial/uart_stm32.c
Outdated
uart_stm32_isr, DEVICE_GET(uart_stm32_1), | ||
0); | ||
irq_enable(PORT_1_IRQ); | ||
#define STM32Fxxx_UART_IRQ_HANDLER_DECL(n) \ |
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.
same here STM32_UART_IRQ_HANDLER
drivers/serial/uart_stm32.c
Outdated
irq_enable(PORT_1_IRQ); | ||
#define STM32Fxxx_UART_IRQ_HANDLER_DECL(n) \ | ||
static void uart_stm32_irq_config_func_##n(struct device *dev) | ||
#define STM32Fxxx_UART_IRQ_HANDLER_FUNC(n) \ |
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.
same here
drivers/serial/uart_stm32.c
Outdated
static void uart_stm32_irq_config_func_##n(struct device *dev) | ||
#define STM32Fxxx_UART_IRQ_HANDLER_FUNC(n) \ | ||
.irq_config_func = uart_stm32_irq_config_func_##n, | ||
#define STM32Fxxx_UART_IRQ_HANDLER(n) \ |
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.
same here
|
||
#define PINMUX_UART_TX(pin, port) PINMUX_UART##port(TX, pin) | ||
#define PINMUX_UART_RX(pin, port) PINMUX_UART##port(RX, pin) | ||
|
||
static const stm32_pin_func_t pin_pa0_funcs[] = { |
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.
This is an interesting proposal (that would eventually deserve to be extended to whole stm32 family to keep consistency across STM32 series). Thought, please keep it easily readable and consistent across IPs. For instance:
PINMUX_UART(PA2, UART2, TX)
PINMUX_PWM(PA0, PWM2, CH1)
Aim is to understand what macro does at first reading w/o refering to macro definition.
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 would be good to extend to other STM32 as I also said in the cover letter. This can be done as a follow-up if you agree, especially considering that I do not have other STM32 on my desk right now.
Sure, I will look into the consistency issue, thanks.
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.
Would also be good to look at using the generated defines from dts directly now that all STM boards use DTS.
34a8649
to
255f198
Compare
Hi Kumar.
So you mean the defines for the UART (without the fixup file), right? We do not have the pinmux AFAIK. Do you have an idea/proposal how to do that? The generated defines does contain the physical address (ST_STM32_USART_40004800_IRQ_0), so I do not see how to cleanly abstract this across all STM32; unless we assume that the physical address is always the same across devices. |
The registration of each serial port differs only by a few details. These differences can be factorized in order to create a generic registration macro. This has several advantages: - Less code - Easier to add new ports - Less work to add support for new STM32 families Change-Id: I6e62a96ccbbf03c9d51bc2617db6a851ff0d83c7 Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Add support for U(S)ART 4 to 10 that can be found at least on some members of the STM32F4 family. Change-Id: Ie870492511f885005cf023040e498bd4d800e807 Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Clean-up the pinmux arrays as a preparatory work before adding more pinmuxes. This is achieved by the following two actions: - Define the PAD macro to simplify the [x - 1] = y construct - Reorder the declartions by bank / pin to make it easier to locate a pin among a high number of other pins, while minimizing the risk of conflict when two people add a new declaration for two different pins Change-Id: I1ca0cc4f48bcd8cfd35b331e9821935f5c855876 Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
It is useless to include the pinmux for a peripheral if it is not enabled in the Kconfig. This is unnecessary and it increases the size of the binary. Define macros that will default to void if the associated Kconfig is not enabled. Change-Id: I0857fcef335c75b8bb6d537fd859f93d5be4a228 Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Add defines and pinmux arrays to support more UARTs on STM32F4. Change-Id: Ib06c549bdb2b3d7065554a0a6d1a3d15441b29c9 Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Add missing UARTs from the main device tree. They are declared as disabled and can be enabled individually by each board. Change-Id: I0ec73c59b4c3c4ee56f12ae70f2d6cdbec14fe33 Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
313855b
to
b6bebea
Compare
I rebased + addressed Erwan's comments. Kumar please provide me with more details regarding your requested changes. Thanks! |
static const stm32_pin_func_t pin_pa9_funcs[] = { | ||
[STM32F4_PINMUX_FUNC_PA9_USART1_TX - 1] = | ||
STM32F4X_PIN_CONFIG_AF_PUSH_UP, | ||
#define PAD(AF, func) \ |
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 to separate this on more than one line?
[ZEPHYR] Fix build errors against upstream Zephyr
Add specific compatible to existing JEDEC SPI device. Add a second JEDEC SPI device with a different compatible. Demonstrates issues with checkpatch: -:27: WARNING:UNDOCUMENTED_DT_STRING: DT compatible string "mxicy,mx25r6435f" appears un-documented -- check ./dts/bindings/ zephyrproject-rtos#27: FILE: boards/arm/nrf52840_pca10056/nrf52840_pca10056.dts:195: + compatible = "mxicy,mx25r6435f", "jedec,spi-nor"; -:37: WARNING:UNDOCUMENTED_DT_STRING: DT compatible string "mxicy,mx25l3233f" appears un-documented -- check ./dts/bindings/ zephyrproject-rtos#37: FILE: boards/arm/nrf52840_pca10056/nrf52840_pca10056.dts:207: + compatible = "mxicy,mx25l3233f", "jedec,spi-nor"; Demonstrates inability to relate specific to generic variant by prefix: #define DT_INST_0_MXICY_MX25R6435F 1 #define DT_INST_0_JEDEC_SPI_NOR 1 #define DT_INST_0_MXICY_MX25L3233F 1 #define DT_INST_1_JEDEC_SPI_NOR 1 Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
MFI audio packets now pass through HCI with the packet boundary flag set to '11' as suggested by the MFI spec
Signed-off-by: Connor Graydon <connor.graydon@intel.com>
Some devices, like the STM32F413, support up to 10 UARTs. This series adds the necessary support with the following actions:
This is targeting STM32F4, but similar patches can be done for other STM32 families if well received.
This change is