Commit graph

1871 commits

Author SHA1 Message Date
Gerson Fernando Budke
9b40960926 drivers: serial: Update sam0 drivers to use pinctrl
This update Atmel sam0 serial drivers to use pinctrl driver and API. It
updates all boards with new pinctrl groups format.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
bfaf027dde drivers: serial: Update sam drivers to use pinctrl
This update Atmel sam serial drivers to use pinctrl driver and API. It
updates all boards with new pinctrl groups format.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Kamil Gawor
ba6d9139bb drivers: uart_nrfx_uarte: Fix double Rx buffer releasing
Fixes a case for the asynchronous UART API where
only single buffer was attached to the UART, after
filling this buffer release event was trigger first
time and after disabling UART the release event was
triggered again for the same buffer.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2022-03-24 14:16:29 +01:00
Filip Kokosinski
38f38e0be8 boards: FE310-based boards: transition to pinctrl driver
This commit makes the transition from the pinmux driver to the pinctrl
driver. It also modifies UART, SPI and I2C drivers used in FE310-based
boards to use the new pinctrl API.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-03-24 10:46:34 +01:00
Andrei-Edward Popa
12fa630844 drivers: serial: rpi_pico: added reset support for UART devices
added reset controller for Raspberry Pi Pico UART devices

Signed-off-by: Andrei-Edward Popa <andrei.popa105@yahoo.com>
2022-03-23 12:51:39 +01:00
Daniel DeGrasse
00793592eb drivers: serial: Enable pinctrl for kinetis lpsci driver
Enable pinctrl for kinetis lpsci uart driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Andrzej Głąbek
a5234f3647 soc_nrf_common: Extend and rename the NRF_DT_ENSURE_PINS_ASSIGNED macro
Extend the macro with checks for DT properties related to pin
assignments that are defined but would be ignored, depending on
whether PINCTRL is enabled or not, what presumably indicates
a resulting configuration different from what the user expects.

Add also a possibility to indicate that the pinctrl-1 property
should not be checked because the caller does not support the
sleep state.

Rename the macro so that its name better reflects its function.
Update accordingly all drivers that use it.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-18 16:26:21 +01:00
Andrzej Głąbek
c18c5cabf1 drivers: uart_nrfx_uart: Fix incorrect uses of DT_NODE_HAS_PROP
Values of boolean DT properties need to be checked with DT_PROP(),
not DT_NODE_HAS_PROP(). Fix two such incorrect calls in the nRF UART
driver.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-17 11:43:13 +01:00
Andrzej Głąbek
88ec25b7ee drivers: uart_nrfx_uarte: Fix USE_LOW_POWER macro for PINCTRL case
This macro incorrectly uses DT_NODE_HAS_PROP() to check the truth value
of the "disable-rx" boolean property. In consequence, it always assumes
that RX is disabled and the low power mode needs to be used. Fix this
by replacing the check with DT_PROP().

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-17 11:40:39 +01:00
Gerard Marull-Paretas
5a71eeb35c pm: policy: move constraints to policy API
The pm_constraint_* APIs were effectively used by the policy manager
only. This patch renames the API to the policy namespace and makes its
naming more explicit:

- pm_constraint_set -> pm_policy_state_lock_get()
- pm_constraint_release -> pm_policy_state_lock_put()
- pm_constraint_get -> pm_policy_state_lock_is_active()

The reason for these changes is that constraints can be of many types:
allow/disallow states, impose latency requirements, etc. The new naming
also makes explicit that the API calls will influence the PM policy
behavior.

All drivers and documentation have been updated accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-16 15:26:47 +01:00
Hake Huang
40f3ab9f72 drivers: uart: add pinctrl support in mcux lpuart
enable pinctrl in lpuart driver, and clean up driver instance definition
macros

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-03-15 10:12:57 -05:00
Nazar Kazakov
9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Peter Marheine
1cf884786b drivers: it8xxx2: fix GPIO interrupt enables
gpio_pin_interrupt_configure asserts that one of GPIO_INT_ENABLE or
_DISABLE is specified by the caller, and also that GPIO_INT_EDGE is
requested if both states (GPIO_INT_TRIG_BOTH) should interrupt. This
change corrects the misuses in it8xxx2 drivers that cause assertion
failures.

When assertions are disabled the existing code works correctly because
the it8xxx2 GPIO driver assumes that a pin interrupt should be enabled
if _DISABLE is not requested, and the driver only supports edge
triggers but assumes the absence of GPIO_INT_MODE_LEVEL indicates
an edge trigger was requested.

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Change-Id: I1aaee190ec4cf063f36e25c0c293a91d280e71bb
2022-03-11 11:00:22 +01:00
Pete Dietl
060e39e75a uart: logging: Add configurable log level to UART drivers
This change adds compile-time selection of log level for
the UART drivers.

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2022-03-10 13:49:43 -05:00
Gerard Marull-Paretas
95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Andrzej Głąbek
70fb3124db drivers: serial: nrfx: Ensure that instances have some pins assigned
Add build assertions that will ensure that every peripheral for
which a driver instance is created has some pins assigned to it.
Neither pinctrl-0 nor *-pin properties can be currently marked as
required in devicetree, so these assertions will help users avoid
invalid configurations where it could be hard to figure out why
the UART is not working.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-09 12:05:22 +01:00
Yegor Yefremov
1155d4679b drivers: serial: fix typos
Typos were found with codespell utility.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2022-03-08 10:24:23 +01:00
Daniel DeGrasse
6696d834cf drivers: serial: Add pm constraint setting to mcux lpuart driver
System entering sleep state before uart tx is complete can result in
characters being dropped from the transmission. Add pm constraint
setting to the lpuart driver to prevent character drops

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-07 13:53:14 -06:00
Jay Vasanth
156440f3f0 serial: update mchp uart module to use pinctrl
Changes to uart module to support pinctrl

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Daniel DeGrasse
1fd4205eee drivers: serial: Add pinctrl support to mcux uart driver
Add pinctrl support to mcux uart driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-03 13:00:20 -06:00
Sylvio Alves
bf08b5f0ed drivers: uart: esp32: fix driver initialization id number
The select uart instance used in uart driver initialization won't
work as expected because the index used was not correct. This
fixes the macro call to use proper index value.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-02-21 22:12:55 -05:00
Gerard Marull-Paretas
f8423a1b45 drivers: serial: xmc4xxx: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
4ee2f327bd drivers: serial: xlnx_ps: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
b6404df1ab drivers: serial: stellaris: remove unused definitions
The register definitions are not used by the driver (struct _uart is
used instead).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
ece65d7a74 drivers: serial: stellaris: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only. Since the config struct can now store a pointer to
the UART structure, casts from address to (struct _uart*) are no longer
needed. UART_STRUCT has also been dropped in favor of using the config
pointer directly now that it is possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
cb982cd669 drivers: serial: pl011: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only. Since the config struct can now store a pointer to
the UART structure, casts from address to (struct pl011_regs *) are no
longer needed. PL011_REGS has also been dropped in favor of using the
config pointer directly now that it is possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
dd3e3a7ee2 drivers: serial: numicro: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only. Since the config struct can now store a pointer to
the UART structure, casts from address to (UART_T *) are no longer
needed. UART_STRUCT has also been dropped in favor of using the config
pointer directly now that it is possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
863a661f70 drivers: serial: npcx: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only. Since the config struct can now store a pointer to
the UART structure, casts from address to (struct uart_reg *) are no
longer needed. HAL_INSTANCE has also been dropped in favor of using the
uart field from the config struct now that it is possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
dbdaf8ddba drivers: serial: msp432p4xx: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
14dda3af08 drivers: serial: msp432p4xx: remove unused sys_clk_freq
The variable is not used by the driver, so there is no need to
initialize it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
8e26bfcca2 drivers: serial: cmsdk_apb: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only. Since the config struct can now store a pointer to
the UART structure, casts from (uint8_t *) to (struct uart_cmsdk_apb*)
are no longer needed. UART_STRUCT has also been dropped in favor of
using the config pointer directly now that it is possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
c5ef13266a drivers: serial: cc32xx: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
1e6b251913 drivers: serial: cc13xx_cc26xx: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
70eefdbac9 drivers: serial: altera_jtag: remove unused config
The driver configuration was not used, so just remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
e101cc78e9 drivers: serial: stm32: store IRQ config function in a single place
When CONFIG_PM=y, the IRQ function also needs to be stored, something
the "generic" uart_device_config cannot support. This uses the config
irq_config_func field to store the function in all situations, thus
removing unnecessary logic and finally dropping uart_device_config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
32a3a028f2 drivers: serial: stm32: store USART instance
Instead of using "generic" uart_device_config fields, store the right
pointer to avoid unnecessary casts. This change makes code simpler and
more idiomatic.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Aymeric Aillet
e3621e6e00 drivers: serial: rcar: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.
Follows #41918.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-02-21 20:49:41 -05:00
Yuriy Vynnychek
b7f1b58810 drivers: serial: telink_b91: replace Pinmux by Pinctrl
Updated driver to use new Pinctrl driver.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Andrzej Głąbek
c80589af56 drivers: uart_nrfx_uarte: Fix RX auto disabling routine
This is a follow-up to commit 11bbdb030d.

When RX is automatically disabled because all provided RX buffers have
been filled up, the rx_enabled flag needs to be cleared, otherwise it
will be impossible to enable RX again.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-02-05 06:25:46 -05:00
Andrei-Edward Popa
e11077d7a5 drivers: serial: rpi_pico: replaced high level API functions
replaced high level API functions with register access

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2022-02-05 06:18:44 -05:00
Andrei-Edward Popa
5e8b0723e2 drivers: serial: added UART interrupts for Raspberry Pi Pico board
added UART interrupts driver for Raspberry Pi Pico board
moved baudrate from config to data structure

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2022-02-05 06:18:44 -05:00
Andrei-Edward Popa
2fc2928fa5 drivers: serial: rpi_pico: check if baudrate was set by the API function
if peripheral clock is not configured, uart init API function returns 0,
so we need to check the return value of this function

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2022-02-05 06:18:44 -05:00
Yong Cong Sin
731241f8d0 kernel: workq: Fix type errors in delayable work handlers
A common pattern here was to take the work item as the subfield of a
containing object. But the contained field is not a k_work, it's a
k_work_delayable.

Things were working only because the work field was first, so the
pointers had the same value. Do things right and fix things to
produce correct code if/when that field ever moves within delayable.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-02 18:43:12 -05:00
Yonatan Schachter
cd7bd5f450 drivers: serial: Added support for raspberry pi
Added a serial driver for the RP2040. Only polling
API is supported.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-02-02 16:23:35 +01:00
Krzysztof Chruscinski
2c044c8162 drivers: serial: nrfx_uarte: Add support for read only TX buffers
UARTE does not support RO TX buffers. Added cache buffer to the
driver which is used when provided buffer is not from RAM.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-02 12:47:46 +01:00
Francois Ramu
860bd87ca9 drivers: uart stm32 F4X, F1X, F2X have a sw sequence to clear error flags
Gives more explanation on uart_stm32_err_check function.
On stm32 F4X, F1X, and F2X, when clearing the usart Error Flag
(PE, ORE, FE, NE), the  LL Clear function applies a software sequence
which reads the usart SR then the usart DR.
Consequently the RXNE flag is affected (cleared) by the
uart_stm32_err_check function call.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-02-01 16:21:38 -05:00
Marius Scholtz
56ebbb4603 drivers: serial: atmel_sam: Fix api to work with modbus
This patch adds fixes to the api so that it behaves as expected.
1 - The irq_tx_ready now only returns true if the tx interrupt is
enabled.
2 - The irq_tx_complete now functions as expected and returns true
only once all characters have been transmitted

Signed-off-by: Marius Scholtz <mariuss@ricelectronics.com>
2022-02-01 16:19:24 -05:00
Sylvio Alves
ef3ecbe596 uart: esp32: fix baudrate return value
HAL call function used to retrieve the configured baudrate
returns the real calculated value, which might not be exactly as
the configured. For baudrate of 115200, HAL api
returns 115201, which then causes uart_basic_api test
to fail. Instead of returning the calculated baudrate value,
returns the configured one.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-28 19:13:20 -05:00
Wealian Liao
6d6c5e1155 drivers: npcx: Drop DRV_CONFIG/DRV_DATA usage
Stop using DRV_CONFIG/DRV_DATA macros and use dev->data and dev->config
instead.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-28 10:06:05 +01:00
Wealian Liao
3565f71a72 drivers: npcx: Correct the macro parentheses
This corrects the following:
1. The priority of type cast is lower than member access. So don't need
the redundant parentheses.
2. The macro should be added to the parentheses.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-28 10:06:05 +01:00