Commit graph

696 commits

Author SHA1 Message Date
Stephanos Ioannidis 9aed7fb040 drivers: serial: uart_sam0: Fix interrupt connection
This commit fixes the multiple SERCOM interrupt handling for the SAM
D5x and E5x devices by replacing the obsolete device tree symbol with
the new `DT_INST` symbol.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-06 18:34:12 +02:00
Ulf Magnusson 378d6b137a kconfig: Replace non-defconfig single-symbol 'if's with 'depends on'
Same deal as in commit eddd98f811 ("kconfig: Replace some single-symbol
'if's with 'depends on'"), for the remaining cases outside defconfig
files. See that commit for an explanation.

Will do the defconfigs separately in case there are any complaints
there.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-12 10:32:34 -06:00
Yannis Damigos a4b448ea59 uart_stm32: Fix flow misspelling
Fix flow misspelling.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2020-02-07 08:08:25 -06:00
Kumar Gala 6115346174 drivers: serial: stm32: Fix possible issue with mixed enum
When building with LLVM we get the following error:

uart_stm32.c:272:9: error: implicit conversion from enumeration type
'enum uart_config_parity' to different enumeration type
'enum uart_config_flow_control' [-Werror,-Wenum-conversion]
        return UART_CFG_PARITY_NONE;
        ~~~~~~ ^~~~~~~~~~~~~~~~~~~~

We shouldn't be mixing parity and flow control enum's.  Use
UART_CFG_FLOW_CTRL_NONE instead or UART_CFG_PARITY_NONE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-02-07 11:50:38 +01:00
Mieszko Mierunski 971c27af0d drivers: sam: UART async API change timeout to signed value.
Change timeout to signed value.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2020-01-29 19:37:31 +01:00
Mieszko Mierunski 20444869e3 drivers: nrf: Fix forever timeout handling in UART async API.
Current implementation directly passes timeout value to workqueue/timer
which results in assertion or instant timeout in case when K_FOREVER is
passed. This fix ensures that no timer or workqueue is called with
K_FOREVER.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2020-01-29 19:37:31 +01:00
Mieszko Mierunski dc3c906d12 drivers: uart: Switch timeout values to s32_t in UART async API
Use signed values for timeout in UART asynchronous API, to be consistent
with timeout type in timer and workqueue values.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2020-01-29 19:37:31 +01:00
Krzysztof Chruscinski dcdc61cfdb drivers: serial: nrf_uarte: Allow TX only instance
Extended nrf_uarte driver to support TX only UARTE instances.
When RX pin is not provided then RX is not started at all. This
allows to achieve low power with logging/console enabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-01-29 12:03:05 -06:00
Peter Bigot 02ae343100 treewide: use full path to uart.h header
The build infrastructure should not be adding the drivers subdirectory
to the include path.  Fix the legacy uses that depended on that
addition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-26 17:52:12 +01:00
Peter Bigot 0b0d2e640b treewide: use full path to clock_control/stm32_clock_control.h header
The build infrastructure should not be adding the drivers subdirectory
to the include path.  Fix the legacy uses that depended on that
addition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-26 17:52:12 +01:00
Peter Bigot 4147188bbb treewide: use full path to clock_control/arm_clock_control.h header
The build infrastructure should not be adding the drivers subdirectory
to the include path.  Fix the legacy uses that depended on that
addition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-26 17:52:12 +01:00
Oane Kingma ea9140e652 drivers/serial: Add more USART ports for Silabs EFM32GG11B
Silicon Labs EFM32GG11B SoCs have more USART ports than
currently supported by the driver. Driver expanded with
support for USART4 and USART5.

Signed-off-by: Oane Kingma <o.kingma@interay.com>
2020-01-24 10:28:33 -06:00
Carlo Caione b9fc192779 drivers: uart_pl011: Enable shared interrupts support
The PrimeCell UART (PL011) IP can use one single combined/shared
interrupt line instead than different IRQ lines for TX/RX/Err/... This
is the most common configuration supported in the Linux world but not
currently supported in Zephyr. QEMU emulates a PL011 UART with a single
interrupt line as well.

To support this configuration we have to hookup the PL011 driver with a
shared IRQ driver and add two new configuration options when the shared
IRQ line is used.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-01-23 02:04:52 -08:00
Flavio Ceolin 2abfccb352 driver: uart: ns16550: Simplify drv_cmd function
There is only one possible command, so just use if instead of switch
to avoid several MISRA-C violations and also avoid set dev_data wrongly
unused when UART_NS16550_DLF_ENABLED is defined.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-01-22 21:21:49 -05:00
Flavio Ceolin e1589c2278 driver: uart: ns16550: Setting default options
Commit 68a235932f changed this driver to
not use hard-coded options. The problem was that these options were
never being set. This commit just set an initial value that can be
changed later.

Fix 68a235932f

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-01-22 01:52:51 -05:00
Jennifer Williams 68a235932f drivers: uart: ns16550: move from hard-coded to configurable
The NS16550 UART driver is currently hard-coded as 8-n-1
with no flow control. The baud rate is set by what is in DTS.
This commit moves away from hard-coded and strictly DTS to
configurable using the UART configure API. Requires commit #bcb807.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2020-01-21 18:50:27 -05:00
Jennifer Williams 3a34db8501 driver: uart: ns16550: implement configure API
The UART configure API was added to uart.h and this commit
implements the initial framework for the configure API for
the ns16550 uart. This includes the configure() and config_get()
functions and uart device configuration structures of the uart
configure API for the ns16550.

Note this commit does not resolve the pre-existing hard-coded
8-n-1 implementation.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2020-01-21 18:50:27 -05:00
Kumar Gala b1602c8e39 arm: Removed support for CC2650
The SoC, driver, and board support for the CC2650 and CC2650 Sensortag
aren't currently supported and we are removing them as such.  If anyone
is interesting in supporting this platform we can easily recovery it
from git.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-01-18 09:27:55 -06:00
Andrew Boie a51b125aba drivers: serial: add async API system calls
These were unintentionally omitted. We don't expose callback
registration or callback response APIs for security reasons.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-01-17 16:15:02 -05:00
Audun Korneliussen a68ef65bc4 drivers: uart: Enable rx byte counting timer only in active power state
Nrfx_uarte uses a hardware timer/counter to count received bytes.
Keeping this timer enabled increases power consumption for some SoCs.

This change disables the timer when an inactive power state is set.

Signed-off-by: Audun Korneliussen <audun.korneliussen@nordicsemi.no>
2020-01-16 11:55:56 +01:00
Maureen Helm 93b457f4da drivers: serial: Refactor mcux lpsci driver to use generated dts macros
Refactors the mcux lpsci driver to use generated device tree macros
directly. Removes now unused dts fixup macros from i.mx rt and kinetis
socs.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-01-15 18:02:19 -05:00
Maureen Helm 5df8b5d63e drivers: serial: Refactor mcux uart driver to use generated dts macros
Refactors the mcux uart driver to use generated device tree macros
directly. Removes now unused dts fixup macros from kinetis socs.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-01-15 18:02:19 -05:00
Maureen Helm a2082303b8 drivers: serial: Refactor mcux lpuart driver to use generated dts macros
Refactors the mcux lpuart driver to use generated device tree macros
directly. Removes now unused dts fixup macros from i.mx rt and kinetis
socs.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-01-14 11:10:27 -05:00
Ismael Fillonneau 0c3fbaa882 drivers: nrf: avoid UARTE pm infinite loop
calling UARTE power management with DEVICE_PM_SUSPEND_STATE
then DEVICE_PM_OFF_STATE causes a deadlock in while loop.
It waits for an event witch never comes

Signed-off-by: Ismael Fillonneau <ismael.fillonneau@stimio.fr>
2020-01-10 10:42:23 +01:00
Marciano C. Preciado d3abb0b9ca drivers: nrf: Catch for nRF53 serial interference
UARTE, SPI, & TWI with the same ID# share resources on nRF53

Signed-off-by: Marciano C. Preciado <marciano@passive-logic.com>
2020-01-07 17:14:25 +01:00
Krzysztof Chruscinski d716e3a66c various: Cleanup COND_CODE_1 usage or replace with IF_ENABLED()
Cleanup around COND_CODE_1 usage and replacing with
IF_ENABLED if applicable.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-12-18 08:14:52 -05:00
Pawel Dunaj 6d911b8f2c drivers: uart_rtt: Handle PM callback properly
All drivers must have power management callbacks specified.

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2019-12-18 12:10:19 +01:00
Maureen Helm 95743561a6 drivers: serial: Use generated dts macros in mcux flexcomm driver
Uses the generated device tree macros, DT_NXP_LPC_USART_USART_*, in the
mcux flexcomm driver and removes the now unused dts fixups from the
lpc54xxx and lpc55xxx socs.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-12-13 18:45:54 +01:00
Maureen Helm 72e0080e56 drivers: serial: Rename lpc usart shim driver
Renames the lpc usart shim driver to more accurately reflect the
flexcomm hardware IP and to prepare for instantiating it on an SoC
outside the LPC family.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-12-13 18:45:54 +01:00
Ulf Magnusson 984bfae831 global: Remove leading/trailing blank lines in files
Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and
.yaml files.

Will avoid failures with the new CI test in
https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only
checks changed files.

Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst
to get rid of the trailing blank line there. It was probably misplaced.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-11 19:17:27 +01:00
Kumar Gala cd0f8d5c4f include: Fix use of <sys_io.h> -> <sys/sys_io.h>
Fix #include <sys_io.h> as it has been deprecated and
should be #include <sys/sys_io.h>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-12-10 08:39:37 -05:00
Ulf Magnusson 87e917a925 kconfig: Remove redundant 'default n' and 'prompt' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though.

Also replace some

    config
    	prompt "foo"
    	bool/int

with the more common shorthand

    config
    	bool/int "foo"

See the 'Style recommendations and shorthands' section in
https://docs.zephyrproject.org/latest/guides/kconfig/index.html.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-09 16:14:50 +01:00
Mieszko Mierunski b7ae41779d drivers: nrf: Add CTS and RTS pins to UART and UARTE PM
Add gpio management for CTS and RTS pins in UART and UARTE drivers

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-11-29 09:04:55 +01:00
Mieszko Mierunski 21e0d48750 drivers: nrf: Fix UART and UARTE hanging on RX errors
Add clearing error event to UART and UARTE drivers.
Without it driver goes into infinite interrupt loop.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-11-26 09:01:22 +01:00
Francois Ramu d3ffa8d089 driver: serial: Error handling issues in uart_stm32_set_baudrate
This patch tests the return code when calling clock_control_get_rate
and completes the issue #20503 seen on watchdog
[Coverity CID :205655]

Fixes #20503

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2019-11-18 09:18:13 -06:00
Mieszko Mierunski 117bc6dfa4 drivers: nrf: Fix values in UARTE async API callback.
There is possibility that endrx interrupt will be triggered in the
middle of timer interrupt responsible for UARTE timeout, this
patch handles this case.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-11-13 15:09:12 -06:00
Andrzej Głąbek b1d5eed262 drivers: nrfx: Update implementations after switching to nrfx 2.0.0
Update calls to nrfx HAL functions to reflect API changes introduced in
nrfx 2.0.0. All these functions are now called with the first parameter
pointing to the structure of registers of the relevant peripheral.
Also a few functions got renamed:
- nrf_gpiote_int_is_enabled to nrf_gpiote_int_enable_check
- nrf_gpiote_event_is_set to nrf_gpiote_event_check
- nrf_rng_event_get to nrf_rng_event_check
- nrf_rng_int_get to nrf_rng_int_enable_check
- nrf_rtc_event_pending to nrf_rtc_event_check
- nrf_rtc_int_is_enabled to nrf_rtc_int_enable_check
- nrf_timer_cc_read to nrf_timer_cc_get
- nrf_timer_cc_write to nrf_timer_cc_set

Default configuration values were removed from nrfx_config files,
so the drivers pwm_nrfx and spi_nrfx_spis no longer can use those.

Function nrfx_pwm_init() now takes one more parameter - context pointer
that is passed to the event handler, not used in the pwm_nrfx driver.

HALs for UART and UARTE now allow configuration of the parity type
and the number of stop bits, for SoCs that provide the corresponding
registers.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-11-08 14:54:12 +01:00
Peter A. Bigot a58d8ebaa6 driver: uart: make deprecation effective
Several macros were documented as deprecated but lacked the
infrastructure to produce deprecation warnings.  Add the deprecation
marker, and fix the in-tree references to the deprecated spellings.

Note that one non-deprecated macro should have been deprecated, and
is, referring to a newly added line control bit.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-07 12:44:15 -06:00
Benjamin Valentin ca9a64bd13 serial: sam0: Add support for SAME54
The SAME5x/SAMD5x MCUs share their SERCOM peripherals with the
samd2x and saml1x MCUs with only few registers changed.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-11-06 17:36:23 -08:00
Ulf Magnusson bd6e04411e kconfig: Clean up header comments and make them consistent
Use this short header style in all Kconfig files:

    # <description>

    # <copyright>
    # <license>

    ...

Also change all <description>s from

    # Kconfig[.extension] - Foo-related options

to just

    # Foo-related options

It's clear enough that it's about Kconfig.

The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)

    git ls-files '*Kconfig*' | \
        xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-04 17:31:27 -05:00
Ulf Magnusson 3b98417ef2 drivers: serial: liteuart: Remove unused UART_LITEUART_PORT_0 symbol
Added in commit f9efca4b4f ("boards: riscv32: add LiteX VexRiscV
board"), then never used.

Found with a script.

Also change UART_LITEUART from a 'menuconfig' symbol to a 'config'
symbol, as it's no longer followed by symbols that depend on it
(UART_LITEUART_PORT_0 should have been a plain 'config' too).

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-29 06:16:27 +01:00
Dennis Wildmark 582e5e58c9 drivers: serial: Configurable GPIO management in NRFX UARTE
In some applications where power management is used, it is not expected
that the GPIO pins of the UARTE is reconfigured upon power state change.
Added a Kconfig option to disable the UARTE driver management of GPIOs.
It defaults to y in order to not affect current behavior unless the user
configures it specifically.

Signed-off-by: Dennis Wildmark <dennis.wildmark@assaabloy.com>
2019-10-25 08:50:25 +02:00
Ulf Magnusson 677f1e6db9 kconfig: Turn pointless/confusing 'menuconfig's into 'config's
Defining a symbol with 'menuconfig' just tells the menuconfig to display
any dependent symbols that immediately follow it in a separate menu.
'menuconfig' has no effect on symbol values.

Making a symbol that doesn't have any dependent symbols after it a
'menuconfig' should be avoided, because then you end up with an empty
menu, which is shown as e.g.

    [*] Enable foo ---

This is how it would be shown if there were children but they all
happened to be invisible as well.

With a regular 'config', it turns into

    [*] Enable foo

Change all pointless 'menuconfig's to 'config's.

See the section on 'menuconfig' on the Kconfig - Tips and Best Practices
page as well.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-22 13:53:06 -05:00
Henrik Brix Andersen 3d9eefc023 drivers: serial: mcux_lpuart: use base address from DTS for LPUART0
Use the base address from the device tree for instance 0 (LPUART0)
instead of hardcoding the address using the NXP MCUX HAL definition.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-10-21 12:25:26 -05:00
Carlo Caione 1c4626d324 kconfig: uart_pl011: Do not limit PL011 driver to ARM family
The driver is not specific to 32bit ARM family. For example it is
currently used by the QEMU ARM64 virt machine.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2019-10-18 08:11:48 -05:00
Carlo Caione 6148b5bd9e drivers: uart_pl011: Fix unused variable warning
Fix GCC complain when CONFIG_UART_INTERRUPT_DRIVEN=n

  warning: unused variable ‘config’ [-Wunused-variable]

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2019-10-18 08:11:48 -05:00
Mateusz Holenko ee36c2ce53 drivers: uart_liteuart: fix usage of DT_ defines
This commit switches from using device tree automatically
generated address-based defines to the instance id-based ones.

Without this change it is not be possible to re-use the driver
on boards where the device is located at different location
than 0xe0001800.

Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2019-10-18 07:48:14 -05:00
Tommy Vestermark 22be864af3 stm32: Fix uart_irq_tx_complete() to output correct status
Currently both uart_stm32_irq_tx_complete() and
uart_stm32_irq_tx_ready() return the TXE flag. However
uart_irq_tx_complete() should really return the TC flag to output true
"Transmit Complete" status.

Signed-off-by: Tommy Vestermark <tovsurf@vestermark.dk>
2019-10-09 06:30:14 -05:00
Carlo Caione 26ff7603f1 drivers: uart_pl011: Fix compilation when CONFIG_UART_INTERRUPT_DRIVEN=n
The driver fails to compile when CONFIG_UART_INTERRUPT_DRIVEN=n. This is
due to a nested ifdef on CONFIG_UART_INTERRUPT_DRIVEN that is excluding
pieces of code unrelated to the uart interrupts management.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2019-10-08 10:22:46 -07:00
Carlo Caione a76a74c541 drivers: uart_pl011: Remove cortex_m header
The PL011 driver is not specific to the cortex_m arch and the driver
does not really use anything from the cmsis header file. Remove it.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2019-10-08 10:22:46 -07:00
Richard Osterloh 1d2a030ee3 drivers: serial: Add STM32G4X serial support
Add UART driver support for STM32G4X SoC series.

Signed-off-by: Richard Osterloh <richard.osterloh@gmail.com>
2019-10-04 18:44:24 -07:00
Peter Bigot ab91eef23b coccinelle: standardize kernel API timeout arguments
Use the int_literal_to_timeout Coccinelle script to convert literal
integer arguments for kernel API timeout parameters to the standard
timeout value representations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-03 11:55:44 -07:00
Kumar Gala 0228c181b0 serial: mcux_lpc: Fix up driver to work on new SDK
The new SDK version 2.6.3 for LPC55S69 changes how CLOCK_GetFreq works.
Change to use CLOCK_GetFlexCommClkFreq which can work on both the old
and new SDK.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-09-27 13:41:13 -07:00
Oane Kingma 536e785b93 drivers: (le)u(s)art_gecko: use DT defined clock identifiers
Use the device tree to assign the correct peripheral clock to each
UART/USART/LEUART. Previously, the clock identifier was determined
through the sequence number of the instantiated UART. This meant
configuring all UARTs when only one of the later UARTs was required.

Signed-off-by: Oane Kingma <o.kingma@interay.com>
2019-09-25 03:43:47 -07:00
Ioannis Glaropoulos cfa2fb278f drivers: serial: mcux: enforce an error-free header inclusion
We need to change the order of inclusions in
uart_mcux_lpuart.c, to avoid build errors. This
is required since the driver structures contain
a field named DATA, which is also a macro defined
in the linker script.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-24 21:53:49 -04:00
Mieszko Mierunski cacb529206 drivers: nrf: Add 2 stop bits option to nrf UARTE and UART driver
nrf52840 and nrf9160 have possible configuration of two stop bits
for UART and  UARTE, this commit adds handling of it to driver.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-09-24 15:23:33 +02:00
Ioannis Glaropoulos 95c2968d32 soc: arm: nxp: cleanup in soc.h headers
A commit that organizes the soc.h header of NXP SoCs:
- removing redundant inclusions of sys/util.h
- removing inclusions of device.h and kernel_includes.h
- including the auto-generated DTS board header
- including the fsl_common.h header
- fixing minor style issues

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-23 18:02:00 -07:00
Anas Nashif 08b43fc9ef drivers: uart: remove qmsi UART driver
No users of this driver after dropping quark platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-18 11:06:18 -05:00
Jan Van Winkel 7e5c65d521 uart: native_posix: Moved declaration of native_uart_status
Move declaration of struct native_uart_status before definition of
a variable of its type

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-17 11:27:19 +02:00
Kumar Gala 8a50048b2b kconfig: serial: sam0: Convert to use new kconfigfunctions
Convert use of dt_int_val to dt_compat_enabled.  As we want to
remove dt_int_val.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-09-13 11:42:34 -05:00
Andy Ross 643701aaf8 kernel: syscalls: Whitespace fixups
The semi-automated API changes weren't checkpatch aware.  Fix up
whitespace warnings that snuck into the previous patches.  Really this
should be squashed, but that's somewhat difficult given the structure
of the series.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-09-12 11:31:50 +08:00
Andy Ross 346cce31d8 kernel: Port remaining buildable syscalls to new API
These calls are buildable on common sanitycheck platforms, but are not
invoked at runtime in any tests accessible to CI.  The changes are
mostly mechanical, so the risk is low, but this commit is separated
from the main API change to allow for more careful review.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-09-12 11:31:50 +08:00
Filip Brozovic e464e98067 drivers: serial: Add instance 4 to mcux lpuart shim driver
Adds instance 4 to the mcux lpuart shim driver.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
2019-09-11 09:23:28 -05:00
Mohamed ElShahawi bcd9e49f3f drivers: esp32: UART - use dts config for HW flow Control
- dts updated for UART1/2
- Additional check added to _INIT macro to configure flow control mode
- Additional check added to _INIT macro to set CTS/RTS gpios values
- Additional check added for gpio config

Signed-off-by: Mohamed ElShahawi <ExtremeGTX@hotmail.com>
2019-09-11 07:50:20 -05:00
Mohamed ElShahawi 0705be344c drivers: esp32: UART Fix yaml/dts binding name
replace "xtensa" with "espressif", as the latter is the correct
vendor name.

Signed-off-by: Mohamed ElShahawi <ExtremeGTX@hotmail.com>
2019-09-11 07:50:20 -05:00
Mohamed ElShahawi 2d035c4191 drivers: esp32: Add UART Driver with FIFO/Interrupt support
- Fixes #3981
- Implement UART Polling functions
- Implement UART Interrupt APIs
- Remove dependency on esp32_rom_uart_xxx functions
- Update Device tree with UART addresses and pin config
- Update ESP32 UART KConfig

Notes about implementation:
- Interrupts now defined as a local macros, and should be removed
later on, when interrupts for esp32 are supported in dts

- Threshold interrupts are used for TX/RX
- Reseting FIFOs using _RST bit will corrupt FIFO of UART2 when used for
UART1 and vice-versa, so a generic way is used for all three UARTs

- Old Silicon rev is not supported

Signed-off-by: Mohamed ElShahawi <ExtremeGTX@hotmail.com>
2019-09-11 07:50:20 -05:00
Kumar Gala 95f78bcacf interrupt: Convert RISC-V plic to use multi-level irq support
Utilize the multi-level irq infrastructure and replace custom handling
for PLIC on riscv-privilege SoCs.  The old code offset IRQs in drivers
and various places with RISCV_MAX_GENERIC_IRQ.  Instead utilize Zephyr's
encoded IRQ and replace offsets in drivers with the IRQ define from DTS.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-09-10 07:34:57 -05:00
Mieszko Mierunski 6a6ed174b7 drivers: uart: Properly configure pins in NRF UARTE power management
Configure pins before enabling and after disabling UARTE through
power management functions.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-08-28 14:04:18 +02:00
Mieszko Mierunski f2bd628c5a drivers: nrf: Fix RX timeout and ENDRX ISR handling.
Ensure that two routines won't interfere with eachother.
In current situation there is possibility that ENDRX will be called
during rx_timeout routine or vice-versa which will result in wrong
offset and length passed to user.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-08-26 16:21:25 +02:00
Mieszko Mierunski 4a13041c38 drivers: uart: Fix incorrect len and offset in nrf UARTE async API.
Due to longer than expected user callback handling, rx byte counting
got out of sync with real values. It leads to incorrect values
reported to user. This fix adds sync point at the end of buffer.

When using hardware rx counting this issue should not occur.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-08-26 16:21:25 +02:00
Wayne Ren 4fb8bf61c0 drivers: ns16550: add WORD only access support
In some hardware,e.g. ARC HS Development kit,the
peripheral space of ns16550 only allowes WORD
access,  byte acess will raise bus error.

This commit adds support for this case

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-08-10 20:11:29 +02:00
Wendy Liang 5364a389e5 serial: Add Xilinx ZynqMP PS uart driver
Add ZynqMP PS uart driver for Xilinx ZynqMP platform

Signed-off-by: Wendy Liang <wendy.liang@xilinx.com>
2019-08-09 22:50:50 +02:00
Nicolas Pitre 75bf3c5368 riscv: freedom: rename RISCV32 to RISCV
This code is common to 32- and 64-bit builds.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-08-08 00:29:24 -04:00
Nicolas Pitre e5981f2b71 drivers: sifiv: make them 64-bit compatible
Make those drivers compatible with a 64-bit build.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-08-08 00:29:24 -04:00
Pavel Kral b7db90da43 drivers: serial: uart_rtt: Virtual UARTs over RTT channels
Add support for virtual UART device that uses Segger RTT channels
for data transfers. Due to the RTT principle, this driver supports
only polling API.

Signed-off-by: Pavel Kral <pavel.kral@omsquare.com>
2019-07-31 17:23:57 +02:00
Kumar Gala 4e7863dc41 dts: Make instance defines consistent
We generated a define for each instance to convey its existance of the
form:
	#define DT_<COMPAT>_<INSTANCE> 1

However we renamed all other instance defines to be of the form
DT_INST_<INSTANCE>_<FOO>.  To make things consistent we now generate a
define of the form:

	#define DT_INST_<INSTANCE>_<COMPAT> 1

We also now deprecate the DT_<COMPAT>_<INSTANCE> form and fixup all uses
to use the new form.

Fixes: #17650

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-07-30 17:10:31 -05:00
Piotr Zięcik 08f8abcfe4 drivers: uart_cc13xx_cc26xx: Get clock frequency from DTS
The uart_cc13xx_cc26xx driver used system clock frequency
as a base for baudrate calculation. This commit corrects
that by obtaining the needed value from DTS.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-07-24 15:10:02 +02:00
Piotr Zięcik 9e9f5cecff drivers: uart_stellaris: Get clock frequency from DTS
The uart_stellaris driver used system clock frequency
as a base for baudrate calculation. This commit corrects
that by obtaining the needed value from DTS.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-07-24 15:10:02 +02:00
Piotr Zięcik dc44cb00d1 drivers: uart_qmsi: Get clock frequency from DTS
The uart_qmsi driver used system clock frequency
as a base for baudrate calculation. This commit corrects
that by obtaining the needed value from DTS.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-07-24 15:10:02 +02:00
Piotr Zięcik 69bbcec74f drivers: uart_msp432p4xx: Get clock frequency from DTS
The uart_msp432p4xx driver used system clock frequency
as a base for baudrate calculation. This commit corrects
that by obtaining the needed value from DTS.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-07-24 15:10:02 +02:00
Piotr Zięcik 170e93bb17 drivers: uart_cc32xx: Get clock frequency from DTS
The uart_cc32xx driver used system clock frequency
as a base for baudrate calculation. This commit corrects
that by obtaining the needed value from DTS.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-07-24 15:10:02 +02:00
Piotr Zięcik 60314555ef drivers: uart_pl011: Get clock frequency from DTS
The uart_pl011 driver used system clock frequency
as a base for baudrate calculation. This commit corrects
that by obtaining the needed value from DTS.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-07-24 15:10:02 +02:00
Piotr Zięcik e858805742 drivers: uart_cmsdk_apb: Get clock frequency from DTS
The uart_cmsdk_apb driver used system clock frequency
as a base for baudrate calculation. This commit corrects
that by obtaining the needed value from DTS.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-07-24 15:10:02 +02:00
Erwan Gouriou fda2ea7253 drivers/serial: stm32: Add support for STM32H7 series
Add needful to enable uart on STM32H7.
This mostly impact dts but as well soc for fixup.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-07-04 08:50:04 -04:00
Erwan Gouriou 8c6070d89b drivers: stm32: Fix leading space warnings
In two stm32 drivers, fix leading spaces warning.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-07-04 08:50:04 -04:00
Anas Nashif a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 5eb90ec169 cleanup: include/: move misc/__assert.h to sys/__assert.h
move misc/__assert.h to sys/__assert.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif d1b2718687 cleanup: include/: move uart.h to drivers/uart.h
move uart.h to drivers/uart.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 46a5d1e5cb cleanup: include/: move dma.h to drivers/dma.h
move dma.h to drivers/dma.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 17ddd1714c cleanup: include/: move clock_control.h to drivers/clock_control.h
move clock_control.h to drivers/clock_control.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif ef281c4237 cleanup: include/: move sys_io.h to sys/sys_io.h
move sys_io.h to sys/sys_io.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 190e368275 cleanup: include/: move power.h to power/power.h
move power.h to power/power.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif cdc78108d5 drivers: serial: ns16550: move header from /include/
Move ns16550 to the driver directory. No other users in the tree and it
is a private header.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-25 15:27:00 -04:00
Anas Nashif 43a49335f4 include: move interrupt controller headers to interrupt_controller/
Move internal and architecture specific headers from include/drivers to
subfolder for interrupt_controller:

include/drivers/interrupt_controller/

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-25 15:27:00 -04:00
Charles E. Youse 3dc7c7a6ea drivers/interrupt_controller/mvic.c: remove MVIC interrupt controller
The Quark D2000 is the only x86 with an MVIC, and since support for
it has been dropped, the interrupt controller is orphaned. Removed.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-06-25 08:06:43 -04:00
Charles E. Youse 57b46bbc85 soc/x86/intel_quark: remove support for Quark D2000 SoC
Removed Quark D2000 SoC files and first-order related DT bindings.

A few config options have been moved from the CONFIG_* space to
the DT_* space, as they were defined in the D2000 Kconfig files
and "leaked" into the other Quark trees.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-06-25 08:06:43 -04:00
Kumar Gala f20d2b6f41 drivers: rv32m1: remove bogus IRQ_PRI related defines
The defines related to IRQ priority don't exist and aren't used.  So
just pass 0 to IRQ_CONNECT for the priority field.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-24 07:22:27 -04:00
Andrei Gansari 58e05ddcc1 drivers: uart for LPC devices interrupt enabled
NXP's MCU LPC families uart interrupt was enabled.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-06-21 11:24:09 -05:00
Kumar Gala dba65ce47c drivers: Update DT IRQ alias defines
The defines should have had a _0 on them, now that we generate the
proper defines, fixup the cases that used that old scheme.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-21 07:53:05 -05:00
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
Kumar Gala dca8a62afa drivers/uart_rv32m1_lpuart: Fix DT define usage
The driver was using a mix of instance defines and alias, move to just
using the alias defines so its consistent.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-15 07:14:12 -04:00
Kumar Gala d4a0c3a2aa dts: Convert new/missed DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-15 07:14:12 -04:00
Kumar Gala a2693975d7 dts: Convert from DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-14 08:02:15 -05:00
Anas Nashif 4c32258606 style: add braces around if/while statements
Per guidelines, all statements should have braces around them. We do not
have a CI check for this, so a few went in unnoticed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-06 15:20:21 +02:00
Benjamin Valentin 4d89ff1232 drivers/uart: introduce SERIAL_SUPPORT_ASYNC option
Not all serial drivers support ASYNC operation and if they do,
they might not support it on every SoC.

Add the SERIAL_SUPPORT_ASYNC option to indicate ASYNC operation
is availiable.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-06-05 07:45:27 -04:00
Nathaniel Graff 3093f5cd2f drivers/gpio: Remove DTS fixups for SiFive GPIO
Change the DT macros used by the SiFive GPIO driver so that fixups
are no longer required.

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2019-05-30 18:40:26 -04:00
Nathaniel Graff a11ebbd48a drivers/uart: Remove DTS fixups for SiFive UART
Change the DT macros used by the SiFive UART driver so that fixups
are no longer required.

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2019-05-30 18:40:26 -04:00
Derek Hageman 55bb37e35c drivers: serial: sam0: Implement DMA async API
This adds support for the async API for SAM0 SERCOM USARTs using
DMA to drive the device.

Tested on SAMD21 with a few trivial programs and with
tests/drivers/uart/uart_async_api.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-30 17:18:44 -04:00
Sören Tempel 52a4e4d840 drivers: serial: sifive: fix configuration of rxcnt/txcnt
The values were swapped meaning the configured value for rxcnt was used
for txcnt and vice versa.

Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net>
2019-05-29 17:22:58 -04:00
Erwan Gouriou eb97fea741 boards: nucleo_wb55rg: configure LPUART
Configure LPUART as btmon interface and
re-instantiate usart1 as console output (using ST-Link VCP)


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-05-29 10:58:36 -04:00
Jan Van Winkel 7a246c30bd dts: posix: Add DTS support for POSIX architecture
Added device tree support for POSIX architecture based boards.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-05-28 21:14:19 -04:00
Erwan Gouriou 9c1ffddcaf drivers: serial: Enable LPUART for STM32WB
A required code to enable LPUART_1 on stm32wb series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-05-21 07:49:14 -05:00
Erwan Gouriou 69a2896f3e drivers/serial: stm32: Optimize LPUART code
On STM32 series currently available in Zephyr,
LPUART and U(S)ART IPs are similar and share most of their
registers. As a consequence LL API defined for U(S)ART also
applies to LPUART.
This allows to remove specific LPUART code.

Restrict use of LL LPUART API when it diverges from UART one.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-05-21 07:49:14 -05:00
Jukka Rissanen f521996d71 uart: native_posix: Add support for another serial port
The second serial port (UART_1) can be used for connecting to
host serial port. This is used for example by PPP (Point-to-Point
Protocol) implementation in which case the pppd running in Linux host
connects to a pty that is linked to UART_1 in Zephyr.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-21 08:21:31 -04:00
Mieszko Mierunski 7b0576243a drivers: nrf: Fix long receptions in UARTE async API.
If reception was longer than rx timeout, UART_RX_RDY event
would provide data with delay, and synchronise at buffer end.

This change makes sure that all data is given to user when timeout
occurs.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-05-16 13:47:07 +02:00
Filip Kokosinski b3739169cb drivers: serial: add LiteUART driver
Add LiteX UART driver with bindings for this device.

Signed-off-by: Filip Kokosinski <fkokosinski@internships.antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2019-05-15 12:52:16 -05:00
Henrik Brix Andersen 56dfb62e40 drivers: serial: uart_mcux_lpuart: add support for LPUARTs with two IRQs
Add support for NXP MCUX LPUART devices with separate IRQ lines for
transmit and receive status interrupts (e.g. the Kinetis KE1xF SoC
series).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-05-14 15:00:11 -05:00
Benjamin Lindqvist 55e2014d99 drivers: nrf: Trigger STOP RX event and wait before disabling UARTE
Without first triggering TASKS_STOP{RX,TX}, I observed that the UARTE
was never disabled when using device_set_power_state which resulted in
the HFCLK never being shut down and several hundred microamps in
unnecessary current consumption when idle. This seems to fix the issue.

Also added special treatment of uarte if CONFIG_UART_ASYNC_API is
selected. Note that the #ifdef isn't enough, since it's possible that
the option is set, but only one of the UARTs uses it.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2019-05-14 17:02:17 +02:00
Benoit Leforestier 9fee67d562 Driver: Uart: Add support of 9 bits data length for STM32
Some STM32 (F0, F1, F2, F3, F4, L0, L4) USART support
9bits data word length.

Signed-off-by: Benoit Leforestier <benoit.leforestier@gmail.com>
2019-05-07 23:16:55 -04:00
Charles E. Youse 4a49736bd1 drivers/uart_ns16550: fix style issues flagged by Zephyrbot
Simple whitespace and other style issues.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-04 18:29:32 -04:00
Charles E. Youse 869c5d2e54 drivers/uart_ns16550: enable auto IRQ detection for PCI(e) endpoints
If a UART is configured with IRQ == PCIE_IRQ_DETECT, then use the
pcie_wired_irq() to determine the IRQ at runtime, and install the
handler using the dynamic interrupt mechanism.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-04 18:29:32 -04:00
Charles E. Youse f2af5fe731 drivers/uart_ns16550: move UART configuration boilerplate to template
The per-UART configuration is boilerplate that is becoming a maintenance
nightmare as it grows. A template file is created, and instances are
created as needed by cmake at build time.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-04 18:29:32 -04:00
Charles E. Youse ef1788da70 drivers/uart_ns16550: remove unnecessary #include
There aren't any dependencies on MSI enablement in the source anymore.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-04 18:29:32 -04:00
Brett Witherspoon f101b77db2 soc: ti_simplelink: add support for TI CC13x2 / CC26x2 series
Add initial support for the TI CC13x2 / CC26x2 series with the CC2652R
and CC1352R SoCs. The UART and GPIO peripherals are supported. Drivers
use the driverlib HAL from the TI CC13x2 / CC26x2 SDK.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-04 09:13:43 -05:00
Derek Hageman 4709816a69 soc: sam0: Remove SERCOM defines from dts_fixup.h
Move SERCOM peripherals to use the raw defines generated from DTS
parsing.  This adds aliases to the DTS so that the SERCOM number
can still be used for clocking and pinmux.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-03 08:46:57 -05:00
Jun Li 32d23cb3aa driver: api: uart: remove exclusive config for async api
The PR removes the exclusive limit on enabling both UART_ASYNC_API
and UART_INTERRUPT_DRIVEN so that both options can be enabled
together for same uart driver.

Also, the interrupt handler will be used for both cases. So, enable
definition of interrupt handler for both.

However, nRF UART driver still wants to enable only one of them.
So, a new config is added to disable the code for UART_ASYNC_API
when the option UART_INTERRUPT_DRIVEN is enabled.

Signed-off-by: Jun Li <jun.r.li@intel.com>
2019-05-01 08:33:16 -07:00
Sören Tempel ec2f503635 drivers: serial: sifive: Fix UART extern interrupts
IRQ_CONNECT and irq_enable calls in the SiFive UART driver were
misconfigured when the conversion to DeviceTree support occurred.

See also: https://github.com/zephyrproject-rtos/zephyr/pull/10613

Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net>
2019-05-01 10:29:28 -04:00
Charles E. Youse 18833ac0ef drivers/pcie: verify PCI(e) assigned interrupts
A new function pcie_irq_enable() is added to be used in lieu of
irq_enable() when the target device is PCI(e)-attached. The function
attempts to use MSI, when configured in the kernel and supported by
the endpoint; failing that, it will verify that IRQ requested is in
fact routed to the device by the boot firmware before enabling it.

The NS16550 UART driver is updated to use pcie_irq_enable().

The PCI(e) shell is extended to dump information about wired IRQs.

The up_squared devicetree is fixed (reverted?) to IRQ5 for UART1.

The galileo enables MSI by default.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-04-28 13:36:28 -04:00
Benjamin Valentin 4d9486fc22 soc: sam0: Enable generic peripheral selection
Make sure that when e.g. CONFIG_SERIAL is set, CONFIG_UART_SAM0 is
selected automatically when the sam0 SoC family is used.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-04-19 14:37:17 -05:00
Ryan QIAN 6e277cff20 drivers: serial: add config for uart 4
- Add config for uart 4

Signed-off-by: Ryan QIAN <jianghao.qian@nxp.com>
2019-04-18 16:11:34 -05:00
Georgij Cernysiov 04da64db76 drivers: serial: stm32: dts binding, and fixup for flow control
Allows to enable initial RTS/CTS hardware flow control
in the dts.

Co-authored-by: Benoit Leforestier <benoit.leforestier@gmail.com>
Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
2019-04-17 16:09:54 -05:00
Georgij Cernysiov 78eed34b78 drivers: serial: stm32: add serial hw flow control
Adds RTS CTS hardware flow control support.

Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
2019-04-17 16:09:54 -05:00
Georgij Cernysiov c74c131e4f drivers: serial: stm32: add err_check
Adds 'err_check' implementation.

Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
2019-04-17 15:58:56 -05:00
Georgij Cernysiov 3de55daab1 drivers: serial: stm32: remove forced RXNE clearance
Removed RXNE clearance. RXNE is cleared upon reading DR|RDR register.

Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
2019-04-17 15:51:43 -05:00
Charles E. Youse e039053546 uart/ns16550, drivers/pcie: add PCI(e) support
A parallel PCI implementation ("pcie") is added with features for PCIe.
In particular, message-signaled interrupts (MSI) are supported, which
are essential to the use of any non-trivial PCIe device.

The NS16550 UART driver is modified to use pcie.

pcie is a complete replacement for the old PCI support ("pci"). It is
smaller, by an order of magnitude, and cleaner. Both pci and pcie can
(and do) coexist in the same builds, but the intent is to rework any
existing drivers that depend on pci and ultimately remove pci entirely.

This patch is large, but things in mirror are smaller than they appear.
Most of the modified files are configuration-related, and are changed
only slightly to accommodate the modified UART driver.

Deficiencies:

64-bit support is minimal. The code works fine with 64-bit capable
devices, but will not cooperate with MMIO regions (or MSI targets) that
have high bits set. This is not needed on any current boards, and is
unlikely to be needed in the future. Only superficial changes would
be required if we change our minds.

The method specifying PCI endpoints in devicetree is somewhat kludgey.
The "right" way would be to hang PCI devices off a topological tree;
while this would be more aesthetically pleasing, I don't think it's
worth the effort, given our non-standard use of devicetree.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-04-17 10:50:05 -07:00
Mieszko Mierunski 6a739435a0 drivers: nrf: Fix UARTE interrupt driven operation.
Bad order of interrupt calls made it unable to transmitt data
using interrupt driven API.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-04-10 13:53:40 -04:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Patrik Flykt 97b3bd11a7 drivers: Rename reserved function names
Rename reserved function names in drivers/ subdirectory. Update
function macros concatenatenating function names with '##'. As
there is a conflict between the existing gpio_sch_manage_callback()
and _gpio_sch_manage_callback() names, leave the latter unmodified.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-04-03 17:31:00 -04:00
Patrik Flykt 21358baa72 all: Update unsigend 'U' suffix due to multiplication
As the multiplication rule is updated, new unsigned suffixes
are added in the code.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Mieszko Mierunski 0b2946f4f3 drivers: nrf: Add power management to uarte shim
Adds power management to uarte shim.

Fixes 12501

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-03-28 09:30:57 -04:00
Mieszko Mierunski b121660a8f drivers: nrf: Enable usage of Async UART API for UARTE on nrf91
Modify driver to use PPI or DPPI depending on soc.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-03-28 09:30:57 -04:00
Mieszko Mierunski 35aedfa532 drivers: nrf: Rework UARTE shim for uart ASYNC API.
Rework uart_nrfx_uarte shim to work with asynchronous API.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-03-28 09:30:57 -04:00
Ramakrishna Pallala e1639b5345 device: Extend device_set_power_state API to support async requests
The existing device_set_power_state() API works only in synchronous
mode and this is not desirable for devices(ex: Gyro) which take
longer time (few 100 mSec) to suspend/resume.

To support async mode, a new callback argument is added to the API.
The device drivers can asynchronously suspend/resume and call the
callback function upon completion of the async request.

This commit adds the missing callback parameter to all the drivers
to make it compliant with the new API.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2019-03-14 14:26:15 +01:00
Alberto Escolar Piedras 319caa25e0 uart: native_posix: Fix out of bounds access
Fix an out of bound access in the native_posix uart driver,
when generating the string to autoattach a terminal to the UART.
(The space for the null termination was missing)

Fixes: #14401
Coverity issue CID: 195855

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-03-13 11:58:50 -05:00
Alberto Escolar Piedras 448755e622 uart: native_posix: Check fcntl() return value
fcntl() may (very unlikely) fail when setting the new pseudoterminal
to non-blocking.
Let's check for this condition, handle it, and in the process
silence a coverity issue.

Fixes #14396
Coverity CID: 195872

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-03-13 11:58:26 -05:00
Ulf Magnusson 53376394b7 kconfig: Remove blank lines at the beginning/end of files
Maybe this is some "just in case" thing that got copied around. There's
no need to have a blank line at the beginning or end of Kconfig files.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-13 07:29:42 -05:00
Patrik Flykt 4344e27c26 all: Update reserved function names
Update reserved function names starting with one underscore, replacing
them as follows:
   '_k_' with 'z_'
   '_K_' with 'Z_'
   '_handler_' with 'z_handl_'
   '_Cstart' with 'z_cstart'
   '_Swap' with 'z_swap'

This renaming is done on both global and those static function names
in kernel/include and include/. Other static function names in kernel/
are renamed by removing the leading underscore. Other function names
not starting with any prefix listed above are renamed starting with
a 'z_' or 'Z_' prefix.

Function names starting with two or three leading underscores are not
automatcally renamed since these names will collide with the variants
with two or three leading underscores.

Various generator scripts have also been updated as well as perf,
linker and usb files. These are
   drivers/serial/uart_handlers.c
   include/linker/kobject-text.ld
   kernel/include/syscall_handler.h
   scripts/gen_kobject_list.py
   scripts/gen_syscall_header.py

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-11 13:48:42 -04:00
Ulf Magnusson 116fb2fe0a kconfig: drivers: serial: Remove redundant dependencies
One of these is from 'source'ing a file within an 'if SERIAL', and then
adding another 'depends on SERIAL' within it.

'if FOO' is just shorthand for adding 'depends on FOO' to each item
within the 'if'. Dependencies on menus work similarly. There are no
"conditional includes" in Kconfig, so 'if FOO' has no special meaning
around a source. Conditional includes wouldn't be possible, because an
if condition could include (directly or indirectly) forward references
to symbols not defined yet.

Tip: When adding a symbol, check its dependencies in the menuconfig
('ninja menuconfig', then / to jump to the symbol). The menuconfig also
shows how the file with the symbol got included, so if you see
duplicated dependencies, it's easy to hunt down where they come from.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-09 09:57:17 -05:00
Jiri Kubias b71b9c688c serial: u(s)art_sam: Fixed return value of usart_sam_irq_is_pending
The function usart_sam_irq_is_pending (uart_sam_irq_is_pending) return
only the masked value of US_CSR register but it doesn't respect if the
IRQ is enabled or not. For proper function it must check if the IRQ is
enabled for the event.

Signed-off-by: Jiri Kubias <jiri.kubias@leapslabs.com>
2019-03-07 06:24:48 -06:00