Commit graph

16477 commits

Author SHA1 Message Date
Benjamin Cabé f3b85ad92c drivers: modem: fix for possible non-null terminated string
Fix handling of strncpy in cgnsinf parsing function to avoid
potentially getting a non-null terminated string.
Fixes #58573 / CID: 248403

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-11-20 09:23:32 +01:00
Henrik Brix Andersen c0c8952739 shell: do not enable subsystem/driver shell modules by default
Do not enable subsystem/driver shell modules by default and stop abusing
CONFIG_SHELL_MINIMAL, which is internal to the shell subsystem, to decide
when to enable a driver shell.

The list of shell modules has grown considerably through the
years. Enabling CONFIG_SHELL for doing e.g. an interactive debug session
leads to a large number of shell modules also being enabled unless
explicitly disabled, which again leads to non-negligible increases in
RAM/ROM usage.

This commit attempts to establish a policy of subsystem/driver shell
modules being disabled by default, requiring the user/application to
explicitly enable only those needed.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-11-20 09:21:40 +01:00
Piotr Wojnarowski 6670dbe834 tests: drivers: intc_plic: Add tests for register index and offset
Add a test to verify that the regression from
ffb8f31bff is fixed.

Signed-off-by: Piotr Wojnarowski <pwojnarowski@antmicro.com>
2023-11-20 09:20:13 +01:00
Piotr Wojnarowski 3afe238926 drivers: intc: plic: Fix memory-mapped register offset calculation
Previously, the PLIC's registers were accessed through uint32_t *,
so all calculated offsets were effectively multiplied by
sizeof(uint32_t). Do the same manuallly now that we have
mem_addr_t/sys_read32.

Signed-off-by: Piotr Wojnarowski <pwojnarowski@antmicro.com>
2023-11-20 09:20:13 +01:00
Piotr Wojnarowski 3ef34ff6d1 drivers: intc: plic: Make function names and types consistent
`get_claim_complete_offset` and `get_threshold_priority_offset` actually
return addresses directly. Rename them to `_addr` for consistency within
the driver. Also change their return type to `mem_addr_t`.

Signed-off-by: Piotr Wojnarowski <pwojnarowski@antmicro.com>
2023-11-20 09:20:13 +01:00
Laurentiu Mihalcea 43a0839c6c drivers: dma: Add SOF host DMA driver
This commit introduces the SOF host DMA driver.
This driver is used by NXP platforms in the context of
SOF's host component to copy data from the host memory
to the firmware (local) memory. This is possible because
NXP platforms can access the host memory directly w/o
an actual DMA engine.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-11-20 09:19:53 +01:00
Natalia Pluta 8b2c5120aa drivers: sensor: qdec_nrfx: Add support for new QDEC instances
Introducing support for new QDEC instances in the driver.

Signed-off-by: Natalia Pluta <natalia.pluta@nordicsemi.no>
2023-11-20 09:19:45 +01:00
Daniel Leung c972ef1a0f kernel: mm: move kernel mm functions under kernel includes
This moves the k_* memory management functions from sys/ into
kernel/ includes, as there are kernel public APIs. The z_*
functions are further separated into the kernel internal
header directory.

Also made a quick change to doxygen to group sys_mem_* into
the OS Memory Management group so they will appear in doc.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-11-20 09:19:14 +01:00
Flavia Caforio 524ed5dbc1 drivers: counter: nrf_timer: Add event clear to set_top_value
At present, if you want to set a periodic timer again with
set_top_value, the last triggered event is not cleared. This could
result in an old event being served at the next interrupt activation.

The solution proposed in this patch adds the nrf_timer_event_clear
function into set_top_value to prevent this from happening in the
above case.

Signed-off-by: Flavia Caforio <flavia.caforio@amarulasolutions.com>
2023-11-20 09:19:02 +01:00
Andriy Gelman 0d1fa268bb drivers: clock_control: Add PWM clock device
Adds a clock control device for a PWM node, allowing the PWM
to be controlled using the clock control API.

It is a similar idea to the device driver in linux:
linux/Documentation/devicetree/bindings/clock/pwm-clock.yaml

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-11-20 09:18:44 +01:00
Jun Lin 4cfd4b5379 driver: timer: npcx: fix announce/set timer timeout tick
The timer driver doesn't annouce/set the timeout at the tick boundary
but at the absolute next expiration time.
It will cause the accumatlation of the tick drift and cannot pass the
kernel/timer/timer_behavior test suite.
This commit fixes the tick drift problem by annouce the time at the tick
bouandry.

Fixes #59594

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-11-17 17:24:14 +00:00
Ian Morris 4c92419546 drivers: sensor: hs300x: Add driver for Renesas HS300x sensors
Adds support for Renesas HS3001 and HS3003 temperature/humidity sensors
connected via an I2C bus.

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
2023-11-17 10:33:02 -06:00
Josuah Demangeon 2dce408bc3 drivers: serial: uart_liteuart: fix interrupt-driven mode
Interrupt-driven mode was not working, and disabled by default.
When it was forced on, the behavior was to only have a few bytes:
as many as min(CONFIG_SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE, 9).

After the hardware FIFO was filled by software and emptied by hardware,
no interrupt occured, and enqueuing more data did never happen.

By letting the events enabled for TX (only), then interrupts are still
generated after the first transfer, and the software can then add the
subsequent transfers until all data is print: the UART works.

It does not generate endless interrupts either, which was tested by
adding litex_write8('%', UART_RXTX_ADDR) in liteuart_uart_irq_handler()
to log all interrupts events, and when there is nothing to print, no
interrupt is fired.

It was tested with the Zephyr shell.

Fixes #63794

Signed-off-by: Josuah Demangeon <me@josuah.net>
2023-11-17 15:29:14 +01:00
Nick Ward cd9f307e71 drivers: gpio: shell: add vendor specific flags argument
Allow the optional setting of vendor specific flags in the conf command.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-11-17 12:41:14 +01:00
Nick Ward 738a1517b1 drivers: gpio: shell: optimise blink command
Use gpio toggle api instead of manually toggling.
Remove redundant text.
Print error and break from blinking if it occurs.
Only print 'how to exit' text if first toggle is successful.

Saves roughly 40 bytes.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-11-17 12:41:14 +01:00
Nick Ward 45509fdc0e drivers: gpio: shell: make blink command optional
Adds CONFIG_GPIO_SHELL_BLINK_CMD symbol.
Saves around 300 bytes when command is disabled.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-11-17 12:41:14 +01:00
Nick Ward 695a0ac503 drivers: gpio: shell: add info command
Usage:
gpio info [device]

The new command prints gpio controller information
for a specific device if specified or if no device is specified
it prints out all controller information ordered by line name.

Also added Kconfig option so this command can be removed if
resources need to be conserved.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-11-17 12:41:14 +01:00
Nick Ward 0df794e316 drivers: gpio: shell: improve tab complete/suggestion support
This commit implements this enhancement:
https://github.com/zephyrproject-rtos/zephyr/issues/63018

The forms of the gpio commands are now:

        gpio conf device pin ol0
        gpio set device pin 1
        gpio get device pin
        gpio blink device pin

Device name and pin subcommands now are
suggested/completed when tab is used.

Pin names are suggested with numbers and line names if
available from the gpio controller’s Devicetree node.

GPIO pin command is now limited to pins that are not assigned
as reserved.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-11-17 12:41:14 +01:00
Adam Wojasinski 599bcb1e5d drivers: watchdog: wdt_nrfx: Implement disable API
nRF5340 SoC has `TASK_STOP` this patch implements disabling
watchdog for that SoC and enables allowing WDT to STOP in WDT setup.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-11-17 10:00:53 +01:00
Adam Wojasinski 968916572c drivers: watchdog: wdt_nrfx: Remove config field from config structure
The field config of `nrfx_wdt_config_t` type is redundant in device
config structure. Instead of that local variable is used in the setup
function.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-11-17 10:00:53 +01:00
Fabio Baltieri 3452f9fa4e input: it8xxx2_kbd: drop unnecessary include
Drop the atomic.h included, this does not use any atomic anymore.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-17 08:25:27 +00:00
Fabio Baltieri 716281b5c9 input: kbd_matrix: move few assignment off the declaration area
Move a couple of automatic variable assignment off the declaration
block, leaves only structure aliases there, makes it a bit easier to
read.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-17 08:25:27 +00:00
Fabio Baltieri eaac842b82 input: kbd_matrix: move scan_cycles_idx increment
Move the scan_cycles_idx increment in input_kbd_matrix_update_state
as it's only used there, use a modulo operation rather than the if to
handle the index wrapping condition.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-17 08:25:27 +00:00
Fabio Baltieri 2cf9d32b29 input: kbd_matrix: use CLAMP instead of two ifs
Replace the wait_period_us clamping functions using a single CLAMP,
reposition the debug log as well.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-17 08:25:27 +00:00
Fabio Baltieri c639ab8e57 input: kbd_matrix: clean debug logs
Tweak a couple of debug log entries.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-17 08:25:27 +00:00
Fabio Baltieri 958cd4ff53 input: kbd_matrix,npcx: drop explicit LOG_LEVEL define
Use the LOG_MODULE_REGISTER argument instead.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-17 08:25:27 +00:00
Ibe Van de Veire 22d470e6a5 drivers: eth_mcux: Add net_if_mcast_cb for IPv4
Added ability to receive mcast callbacks for both IPv4 and IPv6 instead of
only IPv6.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2023-11-17 09:23:39 +01:00
Benedikt Schmidt 3441fee460 drivers: spi: Implement workaround for unreliable busy flag
For some STM32 MCUs the busy flag of SPI is unreliable. This is a known
issue of the device and described in the device errata.
As a fix implement a configurable timeout which ensures that a call
to spi_transceive will eventually return.
Fixes #64927

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-11-17 09:22:18 +01:00
Flavio Ceolin 3763737326 smbus: Remove syscalls with callbacks
Remove syscalls that allows user threads to set callbacks that
will be invoked by the kernel.

Userspace is not trusted we can't allow a user thread set callbacks
that will be invoked by the kernel and run with supervisor privileges.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-11-17 09:22:05 +01:00
Henrik Brix Andersen 256adeebd9 Revert "drivers: watchdog: wdt_nrfx: Implement disable API"
This reverts commit 415b6fc945.

This does not even compile as it attempts to do assignment to a read-only
object (config->config.behaviour).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-11-16 19:09:49 +01:00
Fabio Baltieri e87ded3f03 input: it8xxx2: use the generic keyboard code
Split the common keyboard scanning code out of the ITE specific driver
and use the generic code instead.

Note that this changes few timing defaults, the change is not
significant though so I suspect there's no difference in practice.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-16 17:54:00 +01:00
Manuel Argüelles 24c1b42741 drivers: ethernet: nxp_s32: include soc.h
The SoC header already includes the necessary device headers for
all SoC variants supported.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-11-16 17:53:43 +01:00
Fabio Baltieri a089fa241f input: npcx: drop the input_ prefix from the internal functions
Drop the input_ prefix fromthe internal functions. Trying to unify the
input drivers to use the same style for function naming, this makes it a
bit more compact and makes it easier to distinguish the common keyboard
structures and functions from the driver ones.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-16 09:30:34 +01:00
Cong Nguyen Huu e59991abfe drivers: spi_nxp_s32: update StateIndex configuration
Set Spi StateIndex equal to index of DT Spi node.
Because number of State array is set base on
number of DT Spi node used. If StateIndex is set
equal to Spi instance, StateIndex can be over array.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2023-11-16 09:28:16 +01:00
Cong Nguyen Huu 5095d9d9e7 drivers: mbox_nxp_s32_mru: update to RTD 1.0.0
Update NOTIFYAdd configuration

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2023-11-16 09:28:16 +01:00
Cong Nguyen Huu e02c27aeb8 drivers: counter_nxp_s32_sys_timer: update to RTD 1.0.0
Rename function Stm_Ip_GetInterruptFlag to Stm_Ip_GetInterruptStatusFlag.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2023-11-16 09:28:16 +01:00
Cong Nguyen Huu 2a932ccab1 drivers: uart_nxp_s32_linflexed: update to RTD 1.0.0
Set default configuration BaudRateDivisor = 16U.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2023-11-16 09:28:16 +01:00
Adam Wojasinski 415b6fc945 drivers: watchdog: wdt_nrfx: Implement disable API
nRF5340 SoC has `TASK_STOP` this patch implements disabling
watchdog for that SoC.

Changed body of `wdt_nrf_setup()` to utilize `nrfx_wdt_reconfigure()`
driver API.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-11-16 09:27:03 +01:00
Andriy Gelman 325e28218f drivers: spi: xmc4xxx: Fix compiler warning with debug flags enabled
Fixes warning when CONFIG_DEBUG_OPTIMIZATION=y:

zephyrproject/modules/hal/infineon/XMCLib/drivers/inc/xmc_usic.h:2132:18:
warning: 'clock_settings' may be used uninitialized [-Wmaybe-uninitialized]
 2132 |                  (uint32_t)passive_level |
      |                  ^~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-11-16 09:26:50 +01:00
Andriy Gelman a34d4d1ce9 drivers: spi: xmc4xxx: Fix potential runtime error
Fixes an unhandled interrupt runtime crash if CONFIG_SPI_XMC4XXX_DMA=y and
CONFIG_SPI_XMC4XXX_INTERRUPT=n.

The unhandled interrupt error is triggered because irq_enable() was called
without calling IRQ_CONNECT() when CONFIG_SPI_XMC4XXX_INTERRUPT=n.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-11-16 09:26:50 +01:00
Andriy Gelman 8246d14742 drivers: xmc4xxx: spi: Update buffers before transmitting data
In the interrupt driven spi, spi_context_update_tx() is called once
from the calling thread and then once in spi_xmc4xxx_isr() after each
new byte is received. This actually means that there is one extra call to
spi_context_update_tx(). This is fine if spi_context_update_tx() complete
it's call in the calling thread before the interrupt fires, however, this
cannot be guaranteed especially if the calling thread is pre-emptive and
has a low priority.

Fix this by calling spi_context_update_tx() in the calling thread before
transmitting the first byte.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-11-16 09:26:50 +01:00
Mulin Chao 76b0aab6cc soc: arm: npcx: fix clock reference of APB4/FIU1 buses
This CL fixes the clock reference of APB4/FIU1 buses by introducing new
Kconfig options.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-11-16 06:50:57 +00:00
Declan Snyder ad3b3a9b93 drivers: memc_nxp_flexram: Use nodelabel for GPR
Get GPR base address using nodelabel as this will align for all the
current in tree platforms. Currently inst 0 of the compat gets wrong
node and base address on RT11xx.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-11-15 15:04:39 -06:00
Declan Snyder 447f12d942 drivers: nxp_flexram: Fix GPR 17 calculation
GPR17 calculation for configuration of RAM banks is incorrect,
bit shift should be 2 per idx, not 1, this is major bug that needs
correcting, currently all RT boards are affected with wrong
configuration.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-11-15 15:04:39 -06:00
Manuel Argüelles 1a05cfc03a soc: nxp_s32: consolidate part number options
Currently, the NXP S32 SoCs have three redundant Kconfig hidden
options to define the part number. To streamline this, we will
retain `CONFIG_SOC_PART_NUMBER` to store the part number as a
string and `CONFIG_SOC_PART_NUMBER_<part>` that can be selected
by the boards.

Furthermore, for drivers requiring conditional code compilation
based on the target SoC, they should utilize the series or SoC
config option as applicable, instead of the part number config.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-11-15 10:25:43 -06:00
Manuel Argüelles 8ca4f5b4a1 soc: nxp_s32: s32k3: drop M7 suffix from options
The existing S32K3 Kconfig options employ the `M7` suffix, which is
redundant given that all cores in this series utilize an Arm Cortex-M7
core. Therefore, we should remove it.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-11-15 10:25:43 -06:00
Robert Lubos c7ac921640 net: loopback: Register IPv4 netmask
A proper netmask should be set on the loopback interface, so that
source address selection work properly when there are multiple
interfaces in the system.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-11-15 13:53:27 +01:00
Jakub Michalski 9265d2de0c drivers: gpio: add rzt2m gpio driver
Add Renesas rzt2m gpio driver with basic functionality.
It supports pin mode configuration and writing/reading to/from gpio ports.
Includes dts changes to build blinky sample.

Signed-off-by: Jakub Michalski <jmichalski@internships.antmicro.com>
2023-11-15 11:41:35 +01:00
Wojciech Sipak 9e44f59e9a drivers: pinctrl: add RZT2M driver
This adds a new driver for Renesas RZ/T2M.
The driver allows configuration of pin direction,
pull up/down resistors, drive strength and slew rate,
and selection of function for a pin.

Signed-off-by: Wojciech Sipak <wsipak@antmicro.com>
2023-11-15 11:41:35 +01:00
Wojciech Sipak 4e35d0e354 drivers: serial: add RZT2M uart driver
This adds a UART driver for the Renesas RZ/T2M
Serial Communication Interface.
The driver implements:
* Polling API,
* Interrupt-driven API.

Signed-off-by: Wojciech Sipak <wsipak@antmicro.com>
2023-11-15 11:41:35 +01:00