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

drivers: Rework Silabs Gecko UART Driver #8930

Merged
merged 3 commits into from
Oct 16, 2018

Conversation

diegosueiro
Copy link
Contributor

This patch series introduces a new config HAS_DTS_SERIAL and reworks the Silabs Gecko UART driver and associated soc and board files to enable using values defined by the device tree configuration.

@codecov-io
Copy link

codecov-io commented Jul 13, 2018

Codecov Report

Merging #8930 into master will decrease coverage by 0.15%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8930      +/-   ##
==========================================
- Coverage   53.34%   53.19%   -0.16%     
==========================================
  Files         211      211              
  Lines       25828    25828              
  Branches     5686     5686              
==========================================
- Hits        13779    13738      -41     
- Misses       9734     9781      +47     
+ Partials     2315     2309       -6
Impacted Files Coverage Δ
include/posix/posix_sched.h 0% <0%> (-100%) ⬇️
lib/posix/pthread_barrier.c 0% <0%> (-100%) ⬇️
lib/posix/pthread_cond.c 62.5% <0%> (-20.84%) ⬇️
lib/posix/pthread.c 68.03% <0%> (-12.33%) ⬇️
lib/posix/pthread_mutex.c 76.38% <0%> (-1.39%) ⬇️
lib/posix/pthread_sched.c 62.5% <0%> (+20.83%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c0a6801...231cf44. Read the comment docs.

@@ -26,7 +26,7 @@ if UART_GECKO_0
config UART_GECKO_0_GPIO_LOC
int "Pin Locations"
range 0 3
depends on UART_GECKO
depends on UART_GECKO && !HAS_DTS_SERIAL
Copy link
Collaborator

Choose a reason for hiding this comment

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

Or could we enforce HAS_DTS_SERIAL somehow, so all gecko mcus must use it? In that case all _LOC config options could be removed from Kconfig.gecko.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chrta,

I totally agree with you.

@galak,

What do you think? Can we remove the *_LOC from Kconfig?

@diegosueiro
Copy link
Contributor Author

@galak and @MaureenHelm ,

Any feedbacks?

1 similar comment
@diegosueiro
Copy link
Contributor Author

@galak and @MaureenHelm ,

Any feedbacks?

@diegosueiro
Copy link
Contributor Author

@galak, can we proceed with the review?

@galak
Copy link
Collaborator

galak commented Sep 12, 2018

These changes seem part of the PR #9042. I made comments over there.

@galak galak added area: UART Universal Asynchronous Receiver-Transmitter area: Devicetree platform: Silabs Silicon Labs labels Sep 12, 2018
@diegosueiro diegosueiro force-pushed the uart_gecko branch 3 times, most recently from 9f0ff44 to d925896 Compare September 16, 2018 19:38
title: EFM32 UART
id: silabs,efm32-uart
title: GECKO UART
id: silabs,gecko-uart
Copy link
Collaborator

Choose a reason for hiding this comment

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

Trying to remove id: so lets leave that alone

Copy link
Collaborator

@galak galak left a comment

Choose a reason for hiding this comment

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

Use CONFIG_ for dt generated defines. This makes it easier for us to know what is being generated by DT rather than dropping the CONFIG_ prefix. Eventually this will go away when we do more codegen and remove dts fixups.

Also, might need updating now that we merged the EFM32HG support

title: EFM32 USART
id: silabs,efm32-usart
title: GECKO USART
id: silabs,gecko-usart
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment about id.

@@ -33,15 +33,15 @@
#endif /* CONFIG_USART_GECKO_0 */

#ifdef CONFIG_USART_GECKO_1
#if (CONFIG_USART_GECKO_1_GPIO_LOC == 0)
#if (USART_1_LOCATION == 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

leave these as CONFIG_

@@ -18,13 +18,13 @@

#ifdef CONFIG_SOC_PART_NUMBER_EFR32FG1P133F256GM48
#ifdef CONFIG_USART_GECKO_0
#if (CONFIG_USART_GECKO_0_GPIO_LOC == 0)
#if (USART_0_LOCATION == 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

leave as CONFIG_

@@ -7,9 +7,5 @@
/* SoC level DTS fixup file */

#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
#define CONFIG_USART_GECKO_0_NAME SILABS_EFM32_USART_40010000_LABEL
Copy link
Collaborator

Choose a reason for hiding this comment

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

Leave this mapping

@@ -18,13 +18,13 @@

#ifdef CONFIG_SOC_PART_NUMBER_EFM32WG990F256
#ifdef CONFIG_UART_GECKO_0
#if (CONFIG_UART_GECKO_0_GPIO_LOC == 0)
#if (UART_0_LOCATION == 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

keep these as CONFIG_

@ekarlso
Copy link
Contributor

ekarlso commented Oct 15, 2018

Hi, can we rebase this ontop https://github.com/ekarlso/zephyr/tree/silabs-uart @diegosueiro ?

@diegosueiro diegosueiro force-pushed the uart_gecko branch 3 times, most recently from 2e63807 to 231cf44 Compare October 16, 2018 06:47
@carlescufi
Copy link
Member

@ekarlso this was rebased on top of your tree? do you have a PR outstanding or is this the only Gecko UART driver PR open?

@diegosueiro diegosueiro force-pushed the uart_gecko branch 2 times, most recently from 2910ccf to 2bc4ffa Compare October 16, 2018 16:51
@diegosueiro
Copy link
Contributor Author

@carlescufi and @galak,

Branch rebased and all checks have passed. ;-)

Use CONFIG_UART_GECKO instead of CONFIG_SERIAL_HAS_DRIVER to compile
the low level uart driver.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
Add more uart/usart instances for Silabs Gecko Devices and remove
the *_GPIO_LOC configs.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
Introduces the location property and adds the ability to use values
generated by the device tree configuration.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Copy link
Collaborator

@galak galak left a comment

Choose a reason for hiding this comment

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

I've made some updates, dropped board.h from driver. Used standard CONFIG_ naming convention for now, dropped 'id:' from yaml.

Can you test this out to make sure it still works.

@@ -1,16 +1,17 @@
---
title: EFM32 USART
title: GECKO USART
id: silabs,efm32-usart
Copy link
Collaborator

Choose a reason for hiding this comment

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

drop id

@@ -1,16 +1,17 @@
---
title: EFM32 UART
title: GECKO UART
id: silabs,efm32-uart
Copy link
Collaborator

Choose a reason for hiding this comment

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

drop id

@@ -10,6 +10,7 @@
#include <em_gpio.h>
#include <em_cmu.h>
#include <soc.h>
#include <board.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need board.h included?

Copy link
Contributor Author

@diegosueiro diegosueiro Oct 16, 2018

Choose a reason for hiding this comment

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

Because for efr32mg_sltb004a board the board.h includes the "soc_pinmap.h", inside the board folder, which holds the UART pin settings.

The other silabs boards are setting the pins in the "soc_pinmap.h" header, inside the soc folder, which is included by the "soc.h" header, and I think is not the best approach since pin configuration/muxing should be set at board level, not soc. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The mapping which location corresponds to which pin is a property of the soc. But the location that is actually chosen is part of the board. Or am I missing something here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Its a 50/50 case, in that we set some standard pin cfg in the soc headers for a number of SoCs. The board ends up select a default or pre-cfg option in a lot of cases. Eventually we will move pin cfg info into the device tree. For now I'd keep with the same pattern that other SiLabs boards/SoC are using.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok.

I'll update the PR #9042 as soon as this one gets merged.

@diegosueiro
Copy link
Contributor Author

diegosueiro commented Oct 16, 2018

@galak,

I've made some updates, dropped board.h from driver. Used standard CONFIG_ naming convention for now, dropped 'id:' from yaml.

Can you test this out to make sure it still works.

The only hardware that I have is the thunderboard from the other PR #9042.

But the changes looks fine to me apart from dropping the board.h as I explained here

@galak
Copy link
Collaborator

galak commented Oct 16, 2018

But the changes looks fine to me apart from dropping the board.h as I explained here

ok, let me look at that.

Copy link
Collaborator

@chrta chrta left a comment

Choose a reason for hiding this comment

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

This is working fine on the EFM32WG-STK3800

@galak galak merged commit 0c7a28c into zephyrproject-rtos:master Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree area: UART Universal Asynchronous Receiver-Transmitter platform: Silabs Silicon Labs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants