diff mbox series

[U-Boot,v1,5/6] serial: stm32x7: add STM32F4 support

Message ID 1506519893-16509-6-git-send-email-patrice.chotard@st.com
State Accepted
Commit 6c30f15bf1abbf9549bace6ec605eb44a4641800
Delegated to: Tom Rini
Headers show
Series Update stm32x7 serial driver | expand

Commit Message

Patrice CHOTARD Sept. 27, 2017, 1:44 p.m. UTC
From: Patrice Chotard <patrice.chotard@st.com>

stm32f4 doesn't support FIFO and OVERRUN feature.
The enable bit is not at the same location in CR1
register than for STM32F7 and STM32H7.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
 drivers/serial/Kconfig          | 4 ++--
 drivers/serial/serial_stm32x7.c | 1 +
 drivers/serial/serial_stm32x7.h | 7 +++++++
 3 files changed, 10 insertions(+), 2 deletions(-)

Comments

Bo Shen Sept. 29, 2017, 6:26 a.m. UTC | #1
Hi Patrice,

On 09/27/2017 06:44 AM, patrice.chotard@st.com wrote:
> From: Patrice Chotard <patrice.chotard@st.com>
> 
> stm32f4 doesn't support FIFO and OVERRUN feature.
> The enable bit is not at the same location in CR1
> register than for STM32F7 and STM32H7.
> 
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
> ---
>   drivers/serial/Kconfig          | 4 ++--
>   drivers/serial/serial_stm32x7.c | 1 +
>   drivers/serial/serial_stm32x7.h | 7 +++++++
>   3 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> index 9bf2e26..7c54a49 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -531,9 +531,9 @@ config STI_ASC_SERIAL
>   
>   config STM32X7_SERIAL
>   	bool "STMicroelectronics STM32 SoCs on-chip UART"
> -	depends on DM_SERIAL && (STM32F7 || STM32H7)
> +	depends on DM_SERIAL && (STM32F4 || STM32F7 || STM32H7)
>   	help
> -	  If you have a machine based on a STM32 F7 or H7 SoC you can
> +	  If you have a machine based on a STM32 F4, F7 or H7 SoC you can
>   	  enable its onboard serial ports, say Y to this option.
>   	  If unsure, say N.
>   
> diff --git a/drivers/serial/serial_stm32x7.c b/drivers/serial/serial_stm32x7.c
> index 19697e3..44e8b42 100644
> --- a/drivers/serial/serial_stm32x7.c
> +++ b/drivers/serial/serial_stm32x7.c
> @@ -127,6 +127,7 @@ static int stm32_serial_probe(struct udevice *dev)
>   
>   #if CONFIG_IS_ENABLED(OF_CONTROL)
>   static const struct udevice_id stm32_serial_id[] = {
> +	{ .compatible = "st,stm32-uart", .data = (ulong)&stm32f4_info},

s/st,stm32-uart/st,stm32f4-uart/ (?)

>   	{ .compatible = "st,stm32f7-uart", .data = (ulong)&stm32f7_info},
>   	{ .compatible = "st,stm32h7-uart", .data = (ulong)&stm32h7_info},
>   	{}
> diff --git a/drivers/serial/serial_stm32x7.h b/drivers/serial/serial_stm32x7.h
> index ed8a3ee..b914edf 100644
> --- a/drivers/serial/serial_stm32x7.h
> +++ b/drivers/serial/serial_stm32x7.h
> @@ -27,6 +27,13 @@ struct stm32_uart_info {
>   	bool has_fifo;
>   };
>   
> +struct stm32_uart_info stm32f4_info = {
> +	.stm32f4 = true,
> +	.uart_enable_bit = 13,
> +	.has_overrun_disable = false,
> +	.has_fifo = false,
> +};
> +
>   struct stm32_uart_info stm32f7_info = {
>   	.uart_enable_bit = 0,
>   	.stm32f4 = false,
> 

Best Regards,
Bo Shen
Patrice CHOTARD Sept. 29, 2017, 11:52 a.m. UTC | #2
Hi Bo

On 09/29/2017 08:26 AM, Bo Shen wrote:
> Hi Patrice,

> 

> On 09/27/2017 06:44 AM, patrice.chotard@st.com wrote:

>> From: Patrice Chotard <patrice.chotard@st.com>

>>

>> stm32f4 doesn't support FIFO and OVERRUN feature.

>> The enable bit is not at the same location in CR1

>> register than for STM32F7 and STM32H7.

>>

>> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>

>> ---

>>   drivers/serial/Kconfig          | 4 ++--

>>   drivers/serial/serial_stm32x7.c | 1 +

>>   drivers/serial/serial_stm32x7.h | 7 +++++++

>>   3 files changed, 10 insertions(+), 2 deletions(-)

>>

>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig

>> index 9bf2e26..7c54a49 100644

>> --- a/drivers/serial/Kconfig

>> +++ b/drivers/serial/Kconfig

>> @@ -531,9 +531,9 @@ config STI_ASC_SERIAL

>>   config STM32X7_SERIAL

>>       bool "STMicroelectronics STM32 SoCs on-chip UART"

>> -    depends on DM_SERIAL && (STM32F7 || STM32H7)

>> +    depends on DM_SERIAL && (STM32F4 || STM32F7 || STM32H7)

>>       help

>> -      If you have a machine based on a STM32 F7 or H7 SoC you can

>> +      If you have a machine based on a STM32 F4, F7 or H7 SoC you can

>>         enable its onboard serial ports, say Y to this option.

>>         If unsure, say N.

>> diff --git a/drivers/serial/serial_stm32x7.c 

>> b/drivers/serial/serial_stm32x7.c

>> index 19697e3..44e8b42 100644

>> --- a/drivers/serial/serial_stm32x7.c

>> +++ b/drivers/serial/serial_stm32x7.c

>> @@ -127,6 +127,7 @@ static int stm32_serial_probe(struct udevice *dev)

>>   #if CONFIG_IS_ENABLED(OF_CONTROL)

>>   static const struct udevice_id stm32_serial_id[] = {

>> +    { .compatible = "st,stm32-uart", .data = (ulong)&stm32f4_info},

> 

> s/st,stm32-uart/st,stm32f4-uart/ (?)


We use the same DT bindings than kernel one and we want to keep aligned.

Historically stm32-uart is dedicated for F4, which was introduced first.
And then with introduction of F7 and H7, new compatible string 
(stm32f7-uart and stm32h7-uart) was added.

Patrice
> 

>>       { .compatible = "st,stm32f7-uart", .data = (ulong)&stm32f7_info},

>>       { .compatible = "st,stm32h7-uart", .data = (ulong)&stm32h7_info},

>>       {}

>> diff --git a/drivers/serial/serial_stm32x7.h 

>> b/drivers/serial/serial_stm32x7.h

>> index ed8a3ee..b914edf 100644

>> --- a/drivers/serial/serial_stm32x7.h

>> +++ b/drivers/serial/serial_stm32x7.h

>> @@ -27,6 +27,13 @@ struct stm32_uart_info {

>>       bool has_fifo;

>>   };

>> +struct stm32_uart_info stm32f4_info = {

>> +    .stm32f4 = true,

>> +    .uart_enable_bit = 13,

>> +    .has_overrun_disable = false,

>> +    .has_fifo = false,

>> +};

>> +

>>   struct stm32_uart_info stm32f7_info = {

>>       .uart_enable_bit = 0,

>>       .stm32f4 = false,

>>

> 

> Best Regards,

> Bo Shen
Bo Shen Sept. 30, 2017, 4:11 a.m. UTC | #3
Hi Patrice,

On 09/29/2017 04:52 AM, Patrice CHOTARD wrote:
>>> diff --git a/drivers/serial/serial_stm32x7.c
>>> b/drivers/serial/serial_stm32x7.c
>>> index 19697e3..44e8b42 100644
>>> --- a/drivers/serial/serial_stm32x7.c
>>> +++ b/drivers/serial/serial_stm32x7.c
>>> @@ -127,6 +127,7 @@ static int stm32_serial_probe(struct udevice *dev)
>>>    #if CONFIG_IS_ENABLED(OF_CONTROL)
>>>    static const struct udevice_id stm32_serial_id[] = {
>>> +    { .compatible = "st,stm32-uart", .data = (ulong)&stm32f4_info},
>> s/st,stm32-uart/st,stm32f4-uart/ (?)
> We use the same DT bindings than kernel one and we want to keep aligned.

I'd suggest to send a patch to kernel to rename it.

> Historically stm32-uart is dedicated for F4, which was introduced first.
> And then with introduction of F7 and H7, new compatible string
> (stm32f7-uart and stm32h7-uart) was added.

If we have patch in kernel to rename it, then it will be more clear.

Best Regards,
Bo Shen
Tom Rini Oct. 9, 2017, 5:01 p.m. UTC | #4
On Wed, Sep 27, 2017 at 03:44:52PM +0200, patrice.chotard@st.com wrote:

> From: Patrice Chotard <patrice.chotard@st.com>
> 
> stm32f4 doesn't support FIFO and OVERRUN feature.
> The enable bit is not at the same location in CR1
> register than for STM32F7 and STM32H7.
> 
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 9bf2e26..7c54a49 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -531,9 +531,9 @@  config STI_ASC_SERIAL
 
 config STM32X7_SERIAL
 	bool "STMicroelectronics STM32 SoCs on-chip UART"
-	depends on DM_SERIAL && (STM32F7 || STM32H7)
+	depends on DM_SERIAL && (STM32F4 || STM32F7 || STM32H7)
 	help
-	  If you have a machine based on a STM32 F7 or H7 SoC you can
+	  If you have a machine based on a STM32 F4, F7 or H7 SoC you can
 	  enable its onboard serial ports, say Y to this option.
 	  If unsure, say N.
 
diff --git a/drivers/serial/serial_stm32x7.c b/drivers/serial/serial_stm32x7.c
index 19697e3..44e8b42 100644
--- a/drivers/serial/serial_stm32x7.c
+++ b/drivers/serial/serial_stm32x7.c
@@ -127,6 +127,7 @@  static int stm32_serial_probe(struct udevice *dev)
 
 #if CONFIG_IS_ENABLED(OF_CONTROL)
 static const struct udevice_id stm32_serial_id[] = {
+	{ .compatible = "st,stm32-uart", .data = (ulong)&stm32f4_info},
 	{ .compatible = "st,stm32f7-uart", .data = (ulong)&stm32f7_info},
 	{ .compatible = "st,stm32h7-uart", .data = (ulong)&stm32h7_info},
 	{}
diff --git a/drivers/serial/serial_stm32x7.h b/drivers/serial/serial_stm32x7.h
index ed8a3ee..b914edf 100644
--- a/drivers/serial/serial_stm32x7.h
+++ b/drivers/serial/serial_stm32x7.h
@@ -27,6 +27,13 @@  struct stm32_uart_info {
 	bool has_fifo;
 };
 
+struct stm32_uart_info stm32f4_info = {
+	.stm32f4 = true,
+	.uart_enable_bit = 13,
+	.has_overrun_disable = false,
+	.has_fifo = false,
+};
+
 struct stm32_uart_info stm32f7_info = {
 	.uart_enable_bit = 0,
 	.stm32f4 = false,