Skip to content

[nrf fromlist] drivers: serial: nrfx_uarte: Add support for device deinit #3089

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

Open
wants to merge 1,102 commits into
base: main
Choose a base branch
from

Conversation

mstasiaknordic
Copy link
Contributor

Add device deinit function. Support is optional as it is not widely used and it enables pinctrl sleep state so it impacts memory footprint.

Additionally, added option to create pinctrl sleep state. So far it was only created when power management was used but in case of deinit it is possible that it is used without PM and we still want to put pins into the default state.

Upstream PR #: 93273

jhedberg and others added 30 commits July 10, 2025 09:13
Use bt_hci_cmd_alloc() instead of the soon to be deprecated
bt_hci_cmd_create().

Signed-off-by: Johan Hedberg <[email protected]>
(cherry picked from commit e23d5a0)
Use bt_hci_cmd_alloc() instead of the soon to be deprecated
bt_hci_cmd_create().

Signed-off-by: Johan Hedberg <[email protected]>
(cherry picked from commit 6f26436)
Use bt_hci_cmd_alloc() instead of the soon to be deprecated
bt_hci_cmd_create().

Signed-off-by: Johan Hedberg <[email protected]>
(cherry picked from commit 354e75d)
Use bt_hci_cmd_alloc() instead of the soon to be deprecated
bt_hci_cmd_create().

Signed-off-by: Johan Hedberg <[email protected]>
(cherry picked from commit e9f0612)
Use bt_hci_cmd_alloc() instead of the soon to be deprecated
bt_hci_cmd_create().

Signed-off-by: Johan Hedberg <[email protected]>
(cherry picked from commit 8962129)
Use bt_hci_cmd_alloc() instead of the soon to be deprecated
bt_hci_cmd_create().

Signed-off-by: Johan Hedberg <[email protected]>
(cherry picked from commit 3056d07)
Use bt_hci_cmd_alloc() instead of the soon to be deprecated
bt_hci_cmd_create().

Signed-off-by: Johan Hedberg <[email protected]>
(cherry picked from commit 58fe2ab)
Use bt_hci_cmd_alloc() instead of the soon to be deprecated
bt_hci_cmd_create().

Signed-off-by: Johan Hedberg <[email protected]>
(cherry picked from commit 187ec70)
Use bt_hci_cmd_alloc() instead of the soon to be deprecated
bt_hci_cmd_create().

Signed-off-by: Johan Hedberg <[email protected]>
(cherry picked from commit b0bed23)
These tests have some sort of simple host implementation, which reuses the
bt_hci_cmd_create() API name, but the implementation is actually local and
something that can be made static. Change the function to be static and
rename it to be more in line with other internal functions.

Signed-off-by: Johan Hedberg <[email protected]>
(cherry picked from commit 978614a)
The new raw TX handling relies on these APIs, so, implement them for
Zephyr shim.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit b8d31f1)
Fixes the issue of leave the packets in the pending queue till a new TX
comes.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit ae198b8)
Monitor mode doesn't require station mode. Disabling station mode
require necessary changes to work monitor mode.

Upstream PR #: 92226

Signed-off-by: Kapil Bhatt <[email protected]>
…monitor

Disabling station mode require necessary changes to work monitor mode.

Upstream PR #: 92226

Signed-off-by: Kapil Bhatt <[email protected]>
This noup does the following:
- Adds the  modem_backend_uart_slm modem backend which is optimized
  for UART communication to SLM.

The noup is intended to live until upstream zephyr has proper
consistent RTS/CTS flow control support across multiple drivers,
and DTR, RTS and CTS support has been added to the upstream modem
UART backends, and lastly, SLM has been updated to use DTR, so
everything is in sync.

Ask Bjarki Arge Andreasen, Markus Lassila or Seppo Takalo when this
noup is to be altered as part of an upmerge for example.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
Signed-off-by: Markus Lassila <[email protected]>
…egacy scan+adv

In 25c993e a new case was introduced
where own_addr_type is not set by bt_id_set_scan_own_addr properly.

This led to issues for users where increasing their zephyr version
led to failures to start scanning after advertising in the case where
CONFIG_BT_SCAN_WITH_IDENTITY=n and legacy advertising commands are used.

Signed-off-by: Olivier Lesage <[email protected]>
(cherry picked from commit 43223a1)
…bled

It represents whether scanning was disabled as part of this flow.

Signed-off-by: Olivier Lesage <[email protected]>
(cherry picked from commit 11782db)
…with identity

Attempting this would fail (assuming the controller is implemented
correctly) because when using legacy commands it is not allowed to
change the device address while scanning.

It also did not make sense. If we have configured the scanner to use
the identity address as own_addr, because the advertiser and scanner
addresses are shared when using legacy commands, setting the adv NRPA
here would overwrite the identity address used by the scanner, which
I assume is not the intention.

Signed-off-by: Olivier Lesage <[email protected]>
(cherry picked from commit ef7ede6)
…pdating own_addr

It wasn't taken into account that bt_le_scan_set_enable()
has a return value. It's not likely that the controller
rejects the command when BT_DEV_SCANNING is set, however.

Signed-off-by: Olivier Lesage <[email protected]>
(cherry picked from commit aa4e6ac)
Add property which indicates that PWM instance supports IDLEOUT
feature. Add property to all instances that supports it.

Signed-off-by: Krzysztof Chruściński <[email protected]>
(cherry picked from commit 28cfb3f)
…y cycle

IDLEOUT presence in PWM means that there are 3 sources from which
PWM pin can be driven:
- GPIO setting when PWM peripheral is disabled.
- IDLEOUT setting when PWM is enabled.
- PWM Sequence when it is in use.

IDLEOUT setting cannot be changed after enabling PWM so it is
configured to the initial state of the pin. It means that if duty
cycle is 100%, GPIO output is set to 1 but initial pin state was 0
(IDLEOUT setting) there will be a glitch between disabling a PWM
sequence and disabling a PWM peripheral.

By default, PWM driver tries to disable PWM peripheral if all channels
are 0% or 100% duty cycle to safe power. When IDLEOUT feature is
present there will be a short glitch on channels with 100% duty cycle.

In order to avoid that CONFIG_PWM_NRFX_NO_GLITCH_DUTY_100 option is
added (enabled by default). When option is enabled 100% duty cycle
is achieved by PWM sequence and not by driving a GPIO pin. It will
consume more power in cases where all channels are 0% or 100% with
at least one channel set to 100% duty cycle.

Signed-off-by: Krzysztof Chruściński <[email protected]>
(cherry picked from commit 0261d7d)
adds kconfig that was probably skipped during migration.

Signed-off-by: Mateusz Michalek <[email protected]>
It's unused.

Signed-off-by: Tomi Fontanilles <[email protected]>
(cherry picked from commit e4e8870)
Do not call cache management functions in sample because it does not
work properly if driver uses bounce buffers.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 810118d)
Change I2S mem slabs to adhere to UDC padding and alignment requirements.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 45f1222)
Add configuration and feedback implementation necessary to run UAC2
samples on nRF54H20. Limit nRF54H20 to Full-Speed only operation because
the samples currently don't have necessary logic to support High-Speed.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit e0c2372)
Constify vendor quirks structure to not keep it in RAM. Use constified
vendor quirks structure directly if there is only one snps,dwc2 instance
to allow compiler inlining quirk implementation.

Signed-off-by: Tomasz Moń <[email protected]>
Signed-off-by: Johann Fischer <[email protected]>
(cherry picked from commit 46b11f1)
New control transfer is started prematurely from device perspective when
host timeout occurs. Any data transfer from previous control transfer
have to be cancelled prior to handling SETUP data. Unconditionally
disable control IN endpoint to prevent race for enqueued buffer between
udc_buf_get_all() called in dwc2_handle_evt_setup() and udc_buf_peek()
called in dwc2_handle_in_xfercompl().

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 89a81e3)
Add helper to handle SOF interrupts/events and new Kconfig option to
disable SOF interrupt.

Signed-off-by: Johann Fischer <[email protected]>
(cherry picked from commit 2d79957)
Signed-off-by: Tomasz Moń <[email protected]>
If the new Kconfig option is disabled, no SOF events are passed to the
higher layer.

Signed-off-by: Johann Fischer <[email protected]>
(cherry picked from commit 7b287ec)
Signed-off-by: Tomasz Moń <[email protected]>
nika-nordic and others added 4 commits July 25, 2025 11:23
…or nRF54LV10A

MDK 8.72.1 does not specify VDD and DVDD internal analog inputs
for this SoC.

Upstream PR #: 93316

Signed-off-by: Nikodem Kastelik <[email protected]>
Some SoCs might not have any VDD reference available.
Use internal 1.2V reference derived from VDD in this case.

Upstream PR #: 93316

Signed-off-by: Nikodem Kastelik <[email protected]>
…for nRF54L15

UARTE20 and UARTE21 instances enable usage of pins on different
port, but require request for constant latency mode. Added
handling of such scenario in the driver. Added testcase
to cover it.

Upstream PR #: 90197

Signed-off-by: Michał Stasiak <[email protected]>
…for nRF54L15

SPI(M/S)20 and SPIM(M/S)21 instances enable usage of pins on different
port, but require request for constant latency mode. Added
handling of such scenario in the driver. Added testcase
to cover it.

Upstream PR #: 90197

Signed-off-by: Michał Stasiak <[email protected]>
krish2718 and others added 16 commits July 28, 2025 07:01
Zephyr provides spinlock APIs which can be locked even during the
interrupt context.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 3e9dffb)
Instead if littering ifdef's across the code, use a single API and
initialize different pools only once.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit ab9c531)
This reverts commit 3e9dffb.
Though this works fine, when CONFIG_ASSERT=y the spinlock validation
fails as the underlying code though uses OSAL spinlock APIs is not ready

* sleeping with spinlock held
* multiple threads taking the same spinlock (might work on UP, but not
  on SMP on the same CPU)

Revert this for now, till the underyling is robust.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 9693852)
The revert for some reason didn't do a full revert, fix the lock
variable.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 1fe2369f649b366b63dc9acfcbe81515a8da405a)
Support to configure BSS max idle period at runtime.

To avoid big churn (net_mgmt 64bit), this commit should be reverted on
the next upmerge.

Signed-off-by: Ajay Parida <[email protected]>
These are helpful for logging in data-path, not to overwhelm the
console but still keep the user informed about the issues.

This is similar to printk_ratelimited in Linux kernel.

Add only basic build tests for now.

Upstream PR #: 93536

[To avoid release notes churn, marking as noup]

Signed-off-by: Chaitanya Tata <[email protected]>
Add the ratelimtied variants for data path debug.

Upstream PR #: 93536

Signed-off-by: Chaitanya Tata <[email protected]>
As this is the hot data path, use a rate limited warning variant.

Upstream PR #: 93282

Signed-off-by: Chaitanya Tata <[email protected]>
In case of a busy environment and if STA is far, then we see many
retries for the frames that cause the RPU to be awake though host has
de-asserted wakeup_now signal, this leads to WDT interrupt and host
thinks that it has given sleep opportunity to RPU and initiates a
recovery.

To handle this, increase the sleep opportunity window to 5s to cover all
the retries, this solves the false recovery problem. While at it, also
increase the range, no reason to limit to lower window. And update the
help text with the warning about power consumption.

Upstream PR #: 93662

Signed-off-by: Chaitanya Tata <[email protected]>
…i for keep-alive bit set"

This reverts commit 3350eb2.

Signed-off-by: Chaitanya Tata <[email protected]>
…ure flags

Pull fix to fail if no compatible feature is found.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit fcffe8f)
Pull fix for double pulling of raw TX header, fixes warnings seen during
tests.

Upstream PR #: 93085

Signed-off-by: Chaitanya Tata <[email protected]>
Add missing binding to fix the device tree warning.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 1495e2e)
the nRF connect device tree extension shows below warning:
'Property not mentioned in "nordic,nrf-pinctrl:child"'.

Fix this by applying the property to both groups separately.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 613ec82)
… groups

Add a newline between child nodes.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 86690f2)
SeppoTakalo and others added 4 commits July 28, 2025 11:39
When Kconfig option CONFIG_NET_L2_PPP_OPTION_DNS_USE is enabled,
Zephyr should request two DNS addresses in IPCP negotiation by sending
IPCP ConfReq for DNS otions using 0.0.0.0 as an address.

Remote peer may offer DNS by sending IPCP ConfNak with proper address.
This is explained in RFC 1332 and RFC 1877 (DNS extension).

When no DNS is required, we should only send IPCP ConfReq for IP
address, without having DNS fields in the same request.

However, when PPP is configured to serve a DNS using Kconfig option
CONFIG_NET_L2_PPP_OPTION_SERVE_DNS it should serve the DNS address in the
IPCP ConfNak message and from the ipcp.peer_options structure, not from
the ipcp.my_options.

This might break backward compatibility outside this repository
as DNS addresses used to be served from ipcp.my_options.

Signed-off-by: Seppo Takalo <[email protected]>
(cherry picked from commit 5a31f3d)
There are cases, for example when peer is requesting two DNS
addresses, but we can only give one, we should reject the secondary
DNS request first, before sending NAK to acceptable options.

Option parser can reject a parameter by returning -ENOTSUP and when
it wants to NAK the parameter, it returns -EINVAL.

On RFC 1661:
Configure-Reject
  If some Configuration Options received in a Configure-Request are
  not recognizable or are not acceptable for negotiation (as
  configured by a network administrator), then the implementation
  MUST transmit a Configure-Reject.

Configure-Nak
  If every instance of the received Configuration Options is
  recognizable, but some values are not acceptable, then the
  implementation MUST transmit a Configure-Nak.

So as stated by RFC, we should start the negotiation by rejecting all
parameters that we cannot configure. I added an example of rejecting
DNS requests, if we don't have those.

Signed-off-by: Seppo Takalo <[email protected]>
(cherry picked from commit d5f4ca3)
When PM or PM_DEVICE is enabled pinctrl sleep state is using for
device suspension. However, there are cases where power management is
not used but we still want to be able to put pins to sleep state, e.g.
device deinit.

Upstream PR #: 93273

Signed-off-by: Krzysztof Chruściński <[email protected]>
…init

Add device deinit function. Support is optional as it is not widely
used and it enables pinctrl sleep state so it impacts memory footprint.

Upstream PR #: 93273

Signed-off-by: Krzysztof Chruściński <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.