Commit graph

16174 commits

Author SHA1 Message Date
Andrej Butok 86d606ba2d flash: nxp: fix lpc55s36 flash read
Add additional check if page is erased,
to avoid a possible fault exception.
Fixes #63087

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2023-10-10 15:26:18 +02:00
Jukka Rissanen 493fe169a8 drivers: eswifi: Fix the SSID copying
The wrong ssid_len was used which causes build error.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-10-10 15:50:22 +03:00
Emil Lindqvist 97d608b98f display: stm32: fix bug where missing backlight pin causes crash
When backlight pin is not defined, a display suspend will cause
a crash since it looks at the wrong pin when deciding if
it exists.

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2023-10-10 15:16:59 +03:00
Flavio Ceolin e7bd10ae71 random: Rename random header
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.

Rename it to random.h and get consistently with other
subsystems.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 14:23:50 +03:00
Flavio Ceolin ea109f6a20 drivers: eswifi: shell: Fix possible overflow
Limit the copied data to the buffer's size.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 11:41:49 +02:00
Flavio Ceolin 2504329b76 drivers: eswifi: Fix possible buffer overflow
Limit the number of the copied ssid to WIFI_SSID_MAX_LEN
and avoid a possible one byte overflow.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 11:41:49 +02:00
Daniel DeGrasse daf6de7b99 drivers: flash: flexspi_mx25um513: enforce write size limit in DTR mode
Per the MX25UM51325G datasheet, all page programs in OPI DTR mode need to
start at an even address, and be of even length. Update the minimum
write size reported by the driver and check all writes when OPI DTR mode
is enabled, so that subsystems using the flash driver can align to this
requirement.

Fixes #63639

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-10-10 11:18:57 +02:00
Henrik Brix Andersen fc078f9d02 drivers: can: sja1000: do not attempt to sleep in IRQ context
The can_sja1000_handle_error_warning_irq() function should only attempt to
start bus-off recovery, but not wait for the result.

Fixes: #63712

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-09 23:54:47 +03:00
Aleksander Wasaznik f187d1bdf4 Bluetooth: drivers/rpmsg: Ensure coop prio bt_recv
Ensure that the Bluetooth rpmsg driver thread is temporarly in
cooperative mode using `k_sched_lock`.

The previous commit added the documentation on `bt_recv` stemming from
the general consensus among maintainers that `bt_recv` may not be called
from preemptible priorites.

Many uses may be affected by this race condition, since the default
configuration of rpmsg driver selects a preemtible priority.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-10-09 19:03:59 +03:00
Aaron Massey 32b27384a6 fuel_gauge: Fix desired current/voltage units
The desired current/voltage properties make use of milliamps/volts while
the present current/voltage properties make use of microamps/volts.

Fix the desired current/voltage properties to be consistent with the
present current/voltage properties where they're most likely to be used
with.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-10-09 19:01:49 +03:00
Fabio Baltieri d53b1a1c0e sensors: default_rtio_sensor: fix build warning
Fix a build warning on 64 bit architectures:

zephyr/drivers/sensor/default_rtio_sensor.c:238:17: error: format '%zu'
expects argument of type 'size_t', but argument 2 has type 'uint32_t'
{aka 'unsigned int'}

num_channels type changed to uint32_t in 96175fcc47.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-10-09 10:48:55 +01:00
Stephan Linz e7f399f4a3 drivers: can: avoid integer overflow in expression
Change the integer arithmetic to divide first before multiply.

The muliplication of sys_clock_hw_cycles_per_sec() by ten leads
to a really big number on boards with high-speed clocking, thus
to the overflow warning, and to errors for integration tests.

Fixes: #63678

Signed-off-by: Stephan Linz <linz@li-pro.net>
2023-10-09 10:39:43 +01:00
Flavio Ceolin 39068456c4 entropy: sam: Remove unused parameter
Do not propagate unused parameter. ISR callback is already handling
the given flags, there is not need to propagate it through internal
calls.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-09 10:16:19 +02:00
Flavio Ceolin 78af988546 entropy: sam: Fix get_entropy() behavior
entropy_get_entropy blocks if required to generate the necessary
random data.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-09 10:16:19 +02:00
Flavio Ceolin 1dcaf4637e entropy: fake_entropy: Fix return value in isr callback
get_entropy_isr() has to return the number of bytes copied or
a negative value in case of error.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-09 10:16:19 +02:00
Flavio Ceolin 58b0c8f4b7 entropy: neorv32: Return ENODATA on error
Return -ENODATA in neorv32_trng_get_entropy_isr when
there is no data available. This is consistent with other
drivers.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-09 10:16:19 +02:00
Flavio Ceolin 5133ac8af4 entropy: b91_trng: Fix callback return
get_entropy_isr() has to return the number of bytes copied or a negative
value for error. Since this driver is assuming that it will always
(????) get the number of requested bytes, change the function to return it
instead of 0.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-09 10:16:19 +02:00
Flavio Ceolin ff074551b0 entropy: gecko_se: Remove unnecessary callback
get_entropy_isr is not implemented, just remove it and let the
driver interface handle it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-09 10:16:19 +02:00
Kai Meinhard 06f35916e1 i2c: silabs: Fix I2C target crash on long ISR execution
Long I2C target callback functions could lead to an unresponsive
I2C peripheral. This commit ports the official ISR implementation
from Silicon labs to Zephyr:
https://github.com/SiliconLabs/peripheral_examples/blob/master/series2/i2c/i2c_follower/src/main.c

Signed-off-by: Kai Meinhard <meinhard@gessler.de>
2023-10-09 10:15:37 +02:00
Daniel DeGrasse a6adaedd51 drivers: i2s: mcux_sai: fix PCM data format and respect CLK format
This commit fixes the following issues with the PCM data format output
by the MCUX SAI driver:

- WS signal should be only one clock cycle in length for short PCM
  format
- Word count should not be fixed to 2, except for classic I2S format
- BCLK polarity should be on falling edge for PCM long and short format

Additionally, the I2S_FMT_CLK_ constants now flip the frame and bit
clock polarity from the normal value expected for the selected I2S
format, as expected by the API.

Fixes #63041

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-10-08 11:25:24 +01:00
Thomas Chiantia 4ebc963ed5 drivers: eth: gmac: Fixed ethernet startup when fixed-link
When upgrading to version 3.4, our hardware lost ethernet connectivity.
Our hardware assumes a fixed link and does not communicate with the
underlying phy via the mdio bus.

I confirmed that the atsame54_xpro board also will lose ethernet
functionality when the atsame54_xpro configures the phy via to use a
fixed link...

The eth_sam_gmac driver changed the initialization behavior to call
net_if_carrier_off and notes to wait until phy link is up (via
callback.)  However, when in a fixed link configuration, the callback is
never called. So the net_if_carrier_on event never occurs.

This patch adds a check to see if link is up already before calling
net_if_carrior_off. This check works because in fixed-link mode, link-up
is set synchronously during phy driver initialization.

I tested that atsame54_xpro with fixed-link configuration will now work
after this patch.

Signed-off-by: Thomas Chiantia <thomas.chiantia@gmail.com>
2023-10-08 11:16:39 +01:00
Henrik Brix Andersen 410c02ac57 drivers: can: sja1000: remove excessive debug logging
Remove excessive debug logging from the SJA1000 driver backend. Logging
each register access makes generic CAN debug logging unusable.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-06 17:43:36 +03:00
Yuval Peress 96175fcc47 sensors: Fix alignment issues
Add padding to the header and remove unnecessary memset in order to fix
alignment faults in cores such as M0 or ones that support
CONFIG_TRAP_UNALIGNED_ACCESS

Signed-off-by: Yuval Peress <peress@google.com>
2023-10-06 14:54:37 +01:00
Carles Cufi c0a349eac4 drivers: bluetooth: rpmsg: Send reset only when the Host is included
The rpmsg_close() call uses the HCI reset command to reset the
controller. But when building as controller-only we do not bring in the
infrastructure to send HCI commands (nor should we) and rpmsg_close()
will not be called anyway.

Fixes #63534.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-10-06 16:18:58 +03:00
Abram Early 6e789e7492 drivers: can: mcan: Move RF0L and RF1L to line 1
The code is designed to handle RF0L and RF1L in
line 1, but they were being sent to line 0. Becuase
they weren't handled, the interrupts would never
be handled which locked up the chip.

Signed-off-by: Abram Early <abram.early@gmail.com>
2023-10-06 16:14:03 +03:00
Tomasz Moń dbb4e8aa9d drivers: usb_dc_nrfx: Isochronous endpoint cannot be bulk
Prevent use of isochronous endpoints as bulk and/or interrupt endpoint.
The issue was observed when trying to use 4 CDC ACM instances where the
4th instance would claim the isochronous IN endpoint 0x88 to be bulk.
Because the isochronous endpoints cannot respond with handshake packet
the iso endpoints cannot be used as bulk or interrupt substitue.

Properly fail endpoint check and therefore make 4 CDC ACM instances not
enumerate at all because the hardware has endpoints that only allows up
to 3 CDC ACM instances.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-10-06 14:50:10 +02:00
Steve Jacot-Guillarmod 13d74677ba drivers: led: pca9633: disable allcall
The PCA9633 i2c LED controller offers an All Call address in its nominal
operation, allowing simultaneous communication with all instances present
on the same i2c bus. The default address is 0x70. While this functionality
is convenient, it is possible that the board uses another i2c component
that also uses this address (for example, the shtcx). In such cases, the
address conflict prevents the proper functioning of the system.

The idea is to add a "disable-allcall" property to the device tree. If this
option is present, the initialization of the PCA9633 forces the bit 0
(ALLCALL) to be set to false, thereby disabling this function. It is
necessary to add this property to all PCA9633 devices on the bus to free up
the address 0x70.

Signed-off-by: Steve Jacot-Guillarmod <steve@piziwate.net>
2023-10-06 12:24:23 +01:00
Carles Cufi a5e7ba3564 Bluetooth: Controller: Remove legacy BT_CTLR_FAST_ENC option
When the legacy LLCP implementation was removed this Kconfig option was
mistakenly left over. Remove it now with all its users.

Fixes #63212.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-10-06 13:32:33 +03:00
Najumon B.A e89b005368 drivers: pcie: add config for enable PRT
add config support for enable IRQ information retrieve via
ACPI PRT (PCI Routing Table)

Signed-off-by: Najumon B.A <najumon.ba@intel.com>
2023-10-06 10:40:14 +02:00
Grant Ramsay 236318332b drivers: systick: Fix Cortex-M SysTick dropping 1 cycle per tick
`last_load` is the full N cycles and `SysTick->LOAD` should
be loaded with `last_load - 1` for the calculations work
correctly.

Note: This only affects a kernel in ticked operation.
Tickless kernels periodically restart the timer correctly.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-10-05 15:30:20 +01:00
Grant Ramsay e032f9520d drivers: systick: Fix Cortex-M systick jumping forward and back again
The existing implementation did not properly
handle when `SysTick->VAL` is zero.

This caused three subtle edge cases:
* val1=0,COUNTFLAG=0,val2=0
  This should result in no cycles elapsed,
  however `(last_load - val2) = last_load`.
  So an extra `last_load` cycles was returned.
* val1=0,COUNTFLAG=0,val2=(last_load-1)
  This should result in 1 cycle elapsed,
  however `val1 < val2` so an extra `last_load`
  cycles was returned.
* val1=[2,1,0],COUNTFLAG=1,val2=0
  This should result in `last_load` cycles elapsed.
  However, `last_load * 2` cycles was returned.

To fix the calculation, val1 and val2 are first
wrapped/realigned from [0:last_load-1] to [1:last_load].

Tidy comments to better reflect the SysTick
behaviour and link reference manuals.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-10-05 15:30:20 +01:00
Andrzej Głąbek 38470a4231 drivers: pwm_nrfx: Connect IRQ handlers for anomaly 109 workaround
The workaround for the nRF52 anomaly 109 that is implemented in
the nrfx_pwm driver uses interrupts generated by a selected EGU
instance and by the enabled PWM instances (even if the interrupts
are not used in generation of the PWM output signals).
Add required IRQ_CONNECT calls so that those interrupts are
properly handled.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-10-05 12:48:29 +01:00
Florian Grandel 4b0e730fb1 drivers: ieee802154: cc13xx_cc26xx_subg: check radio op status
Not only the return code of TI's RF command queueing mechanism but also
the command status need to be checked to assert that a command was
executed successfully. This change introduces additional checking of the
command status.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel f2979edd5c drivers: ieee802154: cc13xx_cc26xx_subg: fix initial CMD_FS
The frequency synchronization command requires a proper frequency to be
set in order to be successfully executed. The command not being executed
leads to unnecessary internal error handling wrt command scheduling.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel 0c1c443fc6 drivers: ieee802154: cc13xx_cc26xx_subg: improve readability
Moves the RX callback closer to where it's actually being used also
removing the necessity to declare a function prototype.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel fce4788415 drivers: ieee802154: cc13xx_cc26xx_subg: fix oper. state
The driver API now distinguishes between operational UP/DOWN states as
required by Zephyr's network API and receiver on/off states as an
internal driver state for improved standard conformance.

This change closes the gap between the driver API requirements and the
implementation in this respect.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel 016d3bed5c drivers: ieee802154: cc13xx_cc26xx_subg: improve locking
Replaces the mutex by a semaphore for ISR readiness as requested by the
driver API specification.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel 26a0ef15c4 drivers: ieee802154: cc13xx_cc26xx_subg: check for RX up
Checks whether the receiver is already on before trying to switch it on.
This also closes a gap wrt the driver API specification.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel 35cfe00e91 drivers: ieee802154: cc13xx_cc26xx_subg: remove redundant code
Removes redunant reset statements that update immutable data.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel 128354ae17 drivers: ieee802154: cc13xx_cc26xx_subg: simplify static funcs
Restructuring and renaming of driver-internal functions for improved
readability and maintainability:
- distinguish between externally exposed API methods
  (cc13xx_cc26xx_sub_* prefix) and internal helper methods
  (drv_* prefix).
- extract a few functions to reduce complexity and improve re-use

Also removes unnecessary initial runtime blanking of static (.bss) data
in the newly introduced extracted buffer initialization functions.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel c81c38114a drivers: ieee802154: cc13xx_cc26xx_subg: minor cleanup
Cleans up includes and a few other minor non-functional errors in the
CC13/26xx driver.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Jun Lin db8855aaa3 driver: crypto: SHA: npcx: change to support npcx4
The pre-alloacted size of the buffer for the SHA ROM API code increases
in npcx4 chip. This commit adds a new property context-buffer-size to
sha0 DT node in npcx9 and npcx4 separately. The driver can pre-allocate
buffer with the correct size based on the property.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-10-05 09:14:05 +01:00
Mario Jaun 01bdd845db drivers: i2c: stm32: disable reload mode at the end of a transfer
Fixes an issue that reload mode is not disabled in case of an error.
From this case the driver could not recover because in msg_init()
no new transfer could be initialized.

Signed-off-by: Mario Jaun <mario.jaun@gmail.com>
2023-10-04 20:25:20 +02:00
Daniel DeGrasse d487794dd6 drivers: i2s: i2s_mcux_sai: fix logging statements for k_mem_slab
Since 2f003e59 reworked the structure of k_mem_slab information fields,
we need to update the logging statements in the i2s_mcux_sai driver to
access these fields correctly.

Fixes #63527

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-10-04 20:25:09 +02:00
Fabio Baltieri 6f0a5961e3 drivers: i2c: i2c_nrfx_twim: fail gracefully on dma max size
Different nRF52 devices have different maximum TWI DMA transfer size,
and it's easy to hit the limit with i2c displays on nrf52832 (8 bit) and
nrf52810 (10 bit). Currently neither the driver or the hal validate the
limit, leading to random NACK errors when trying to transfer more data.

Add a check on the driver to fail gracefully when going over the limit.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-10-04 16:17:15 +01:00
Yong Cong Sin 39433f0669 drivers: intc: plic: define all registers' offset in the driver
Define all the register offset directly in the driver according
to the RISCV PLIC specification as they are not configurable,
see: https://github.com/riscv/riscv-plic-spec.

Updated devicetrees that has PLIC accordingly.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-04 09:06:28 -04:00
Yong Cong Sin 8db1a5add2 drivers: intc: plic: support trigger type by default and hardcode offset
Removing the edge-trigger Kconfig as it is supported by default
in the RISCV PLIC specifications.

Define the edge-trigger register offset in the driver instead
of retrieving the value from devicetree as it is not something
configurable. The value 0x1080 is defined in Andes & Telink
datasheets.

Updated build_all testcase.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-04 09:06:28 -04:00
Benjamin Cabé ba1af3f36b sensors: mpu6050: add missing break statement
Add missing break statement so that SENSOR_CHAN_DIE_TEMP is properly
supported.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-10-04 10:07:43 +02:00
Christopher Friedt 99ab1ab06c drivers: serial: uart_emul: make api implementation static
Keep uart API implementation of the uart_emul driver "private"
by adding the static keyword.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-10-03 14:58:19 -04:00
Christopher Friedt 9d79728c48 drivers: serial: uart_emul: support interrupt-driven receive
Previously, the uart_emul device did not support interrupt-driven
receive, which is an unwritten requirement for hooking up a uart to
the Zephyr console driver.

The console is a fairly high-traffic subsystem, and we should be able
to perform more extensive testing on it, aside from maching twister
output against a regular expression. With this change, we can use
the emulation uart within the body of a ZTest.

Testing Done:
```shell
west build -p auto -b qemu_riscv64 -t run tests/drivers/console_switching
...
*** Booting Zephyr OS build zephyr-v3.4.0-4277-gae0d63471be1 ***
Running TESTSUITE console_switching
===================================================================
START - test_read
read "Hello, uart_emul0!" from uart_emul0
read "Hello, uart_emul1!" from uart_emul1
read "Hello, uart_emul0!" from uart_emul0
read "Hello, uart_emul1!" from uart_emul1
 PASS - test_read in 0.005 seconds
===================================================================
START - test_write
wrote "Hello, uart_emul0!" to uart_emul0
wrote "Hello, uart_emul1!" to uart_emul1
wrote "Hello, uart_emul0!" to uart_emul0
wrote "Hello, uart_emul1!" to uart_emul1
 PASS - test_write in 0.003 seconds
===================================================================
TESTSUITE console_switching succeeded

------ TESTSUITE SUMMARY START ------

SUITE PASS - 100.00% [console_switching]: pass = 2, fail = 0, skip = 0...
 - PASS - [console_switching.test_read] duration = 0.005 seconds
 - PASS - [console_switching.test_write] duration = 0.003 seconds

------ TESTSUITE SUMMARY END ------

===================================================================
PROJECT EXECUTION SUCCESSFUL
```

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-10-03 14:58:19 -04:00
Henrik Brix Andersen f91bfae0a7 drivers: can: mcux: flexcan: validate initial timing parameters
Validate the initial timing parameters set via devicetree.

Fixes: #61909

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-03 18:16:46 +01:00
Flavio Ceolin 15aa3acaf6 kconfig: Remove MP_NUM_CPUS usage
Zephyr's code base uses MP_MAX_NUM_CPUS to
know how many cores exists in the target. It is
also expected that both symbols MP_MAX_NUM_CPUS
and MP_NUM_CPUS have the same value, so lets
just use MP_MAX_NUM_CPUS and simplify it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-03 17:45:53 +01:00
Aaron Ye a94422f686 drivers: spi: Fix the Ambiq apollo4p SPI transmission failure.
The instruction length can only be 0~5.
Use am_hal_iom_blocking_transfer and specify clearly the TX/RX direction.
Hold CS to continue to RX expected response after instruction transmission.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2023-10-03 15:24:20 +01:00
Aaron Ye 7cf21d1080 drivers: spi: Fix Ambiq apollo4p SPI reconfiguration.
The configured SPI should not be configured again.
Otherwise it would cause SPI transmission failure.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2023-10-03 15:24:20 +01:00
Aaron Ye 4e7d1b0f74 drivers: spi: Fix Ambiq apollo4p SPI mode configuration.
The commit fixes the SPI mode improper configuration.
Otherwise the MODE_3 and MODE_0 cases would never be entered as expected.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2023-10-03 15:24:20 +01:00
Erwan Gouriou c5408ab51c drivers: clock_control: stm32: Use hclk freq for flash latency computation
Flash is clocked with HCLK, while CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
reflects SYSCLK. HCLK = SYCLK / AHB prescaler.
When dealing with flash latency, use HCLK instead of SYSCLK.

This changes reverts a abusive change done in an old commit (efd8ee465c)

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-10-03 15:19:12 +01:00
Erwan Gouriou b99651df24 drivers: clock_control: stm32: Set flash latency before increasing clocks
Latency should be set before HCLK clock increase. Not doing so can result
in broken behavior.
For instance, at startup, MSI is @4MHz on L4 series.
If MSI is required to be configured at 48 MHz for future use a USB clock,
this will be done in set_up_fixed_clock_sources(). If flash latency is
not correctly set at this point fetching flash will fail..

Move flash latency configuration before setting up fixed clocks.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-10-03 15:19:12 +01:00
Bjarki Arge Andreasen 7cac905e57 drivers: modem: modem_cellular: extend CMUX timeout
This commit adds a timeout of 300ms to the generic (gsm_ppp) init
chat script. This delay is required for some modems (discovered on
a Telit ME910G1-WW) to allow it to enter CMUX mode. Without this
delay, the modem simply refuses to respond to any CMUX commands.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-10-03 15:13:47 +01:00
Maureen Helm aab537c8e2 drivers: ethernet: Decouple generic MII PHY and adin2111 driver Kconfigs
Decouples the generic MII PHY driver from the adin2111 driver by making
it depend on an ethernet-phy compatible devicetree node rather than the
adin2111 driver not being enabled. This makes it possible to add the
adin2111 driver to tests/drivers/build_all/ethernet

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-10-03 15:10:12 +01:00
Maureen Helm 66a03e6a38 drivers: ethernet: Remove CONFIG_ETH_ADIN2111_INIT_PRIORITY
Simplifies the adin2111 ethernet driver to use the generic driver class
initialization priority instead of a driver-specific priority.

Suggested-by: Georgij Cernysiov <geo.cgv@gmail.com>
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-10-03 15:10:12 +01:00
Maureen Helm e503ec4064 drivers: ethernet: Fix adin2111 multiple compatibles support
The adin2111 ethernet driver supports both adi,adin2111 and adi,adin1110
devicetree compatibles, however it failed to build when both compatibles
existed in the same devicetree. This may be an unusual configuration for
real systems, but was found when extending
tests/drivers/build_all/ethernet to cover both compatibles.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-10-03 15:10:12 +01:00
Florian Grandel 7ac34d0957 drivers: ieee802154: cc13xx_cc26xx_subg: fix timing regression
Fixes a timing regression introduced by commit
a12a6ab5b9.

This caused a massively increased package error rate.

Fixes: #63324.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-02 15:53:45 -04:00
Henrik Brix Andersen 9bf17f9276 drivers: can: remove unnecessary asserts in timing callbacks
Remove unnecessary calls to __ASSERT_NO_MSG() in CAN controller driver
timing setter callbacks. The CAN API functions can_set_timing and
can_set_timing_data() already provide run-time timing parameter validation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-02 16:59:42 +01:00
Sylvio Alves b7fbec7920 drivers: i2c: esp32: check busy line before transfer
I2C scan might fail as peripheral is still busy completing last
operation. This makes sure transfer call waits for free line.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-10-02 16:57:39 +01:00
Tomasz Moń 113600eb4b drivers: i2s: use new k_mem_slab definition
Commit 2f003e59e4 ("kernel: Re-factor k_mem_slab definition") moved
block_size into from k_mem_slab to k_mem_slab_info without updating i2s
handlers. Use the new member to fix build failures.

Fixes: #63363

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-10-02 08:23:48 -04:00
Johann Fischer 9cb777b95e drivers: uhc: rework transfer buffer handling
The current approach is a bit impractical in the upper layer.
This patch removes the two fifos that hold the transfer buffers
and replaces them with a byte array for the setup packet and
a pointer to a data buffer. The data buffer is mandatory for
all types of transfers except control without a data stage.
The waste of eight unused bytes for non-control transfers should
be insignificant, since an additional pointer would be at least
half of it, and then there would be the overhead of handling it.

This patch also clean up the transfer flags, rename owner to callback
as it reflects the upper layer use case, and add an additional member
to hold the pointer to the USB device (peripheral on the bus).

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-10-01 09:26:07 +03:00
Johann Fischer 960e758e6b drivers: uhc: move transfer status to transfer structure
Aling with the changes in UDC done in the commit ad81b3b797
("drivers: udc: move transfer status to buffer info structure")
This allows us to get the result of synchronous transfer and
simplify uhc_submit_event().

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-10-01 09:26:07 +03:00
Andriy Gelman 31bef35897 drivers: can: mcp251xfd: Add driver
This continue PR #31270. The updated changes are:
- Updated to work with latest zephyr
- Inplace reads/writes of registers
- Batch read of RX messages when multiple messages can be read
- FIFO abstraction of RX/TEF queues
- Handle ivmif errors
- Use READ_CRC for register reads
- Use bitmasks instead of bitfield members
- Rename mcp25xxfd to mcp251xfd
- General cleanups

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-10-01 09:20:37 +03:00
Abram Early 33277f9b48 drivers: can: Implement MCP25xxFD driver
Implementation for Microchip MCP2517FD/MCP2518FD SPI based CAN-FD
controller.

Signed-off-by: Abram Early <abram.early@gmail.com>
2023-10-01 09:20:37 +03:00
Andrzej Kuros d44e96e486 nrf53: pretick with NRF_802154_RADIO_DRIVER
The `SOC_NRF53_RTC_PRETICK` option is now allowed to be used with
`NRF_802154_RADIO_DRIVER`.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2023-09-30 18:48:19 +02:00
Andrzej Kuros e03d5d4c6d nrf53: RTC pretick allows user channels and require just one CC
The nrf53 pretick can be used with non-zero
`NRF_RTC_TIMER_USER_CHAN_COUNT` Kconfig option.

The nrf53 pretick requires just one RTC1 CC channel.

The nrf53 pretick handles also RTC1 and RTC0 both CCs and OVERFLOW
events by examination of events scheduled on them. The pretick is set
based on number of ticks to the closest event scheduled that can trigger
an interrupt.

Because the operation in `z_arm_on_enter_cpu_idle` hook would
take too much time with interrupts disabled, the
`z_arm_on_enter_cpu_idle_prepare` hook enabled by Kconfig option
`ARM_ON_ENTER_CPU_IDLE_PREPARE_HOOK` is used. It performs RTC0 and RTC1
examination, and sets pretick without interrupts being blocked.

The LDREX/STREX are leveraged to detect if exception took place
between start of `z_arm_on_enter_cpu_idle_prepare` and
`z_arm_on_enter_cpu_idle`. If exception has not been taken, the pretick
calculation can be trusted because source data could not changed and
too much time could not pass. Otherwise the sleep attempt is disallowed,
the idle will loop again and try later.

Prompt for `SOC_NRF53_RTC_PRETICK` Kconfig option allows to control
this option by an user and turn the feature off if necessary.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2023-09-30 18:48:19 +02:00
Krzysztof Chruściński 31eaffdf05 nrf53: Add RTC pretick
Add RTC pretick option that triggers HW activity one tick before and
RTC event that leads to the interrupt. Option is active only on nrf53
network core.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-09-30 18:48:19 +02:00
Daniel Fladerer 9d1b7086d7 drivers: serial: uart_mcux_iuart: Add parity bit handling
Adding parity bit handling according to uart_mcux.c

Signed-off-by: Daniel Fladerer <d.fladerer@gmx.de>
2023-09-30 18:45:34 +02:00
Peter Mitsis baea37aeb4 kernel: Re-factor sys_mem_blocks definition
Rearranges the sys_mem_blocks fields so that information that describes
how much of the memory block is used is co-located. This will allow
easier of its statistics into the object core statistics reporting
framework.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-09-30 08:04:14 +03:00
Anas Nashif 34e16225eb neural_net: remove unused experimental API
Experimental API is not being used anymore, remove it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-29 20:48:33 -04:00
Manuel Argüelles b38dab48c6 counter: nxp_s32_sys_timer: use clock control APIs
Use clock control API to retrieve the counter module's frequency and
update the boards using it to provide the source clocks.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-29 16:29:31 +02:00
Najumon B.A a14bc241c0 drivers: sdhc: add driver support for emmc host controller
add host controller driver support for emmc version 5.1.
The driver expose zephyr sdhc api interface for emmc host controller.

Signed-off-by: Najumon B.A <najumon.ba@intel.com>
2023-09-29 16:29:00 +02:00
Kelly Helmut Lord 12fa534089 drivers: flash: shell: adjusted load command prompt
Adjusted the prompt of the load command to make it more obvious that
the user is being prompted for keyboard input.

Signed-off-by: Kelly Helmut Lord <helmut@helmutlord.com>
2023-09-29 16:28:40 +02:00
Anisetti Avinash Krishna c45b719442 drivers: misc: timeaware_gpio: Added intel PCH driver
Added intel PCH driver for timeaware GPIO.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-09-29 16:28:09 +02:00
Anisetti Avinash Krishna 667c35a019 qinclude: zephyr: misc: Added timeaware gpio header file
Added timeaware gpio interface.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-09-29 16:28:09 +02:00
Florian Grandel 36402b6d2a net: pkt: time: introduce ns timestamp helper
A little refactoring that simplifies dealing with nanosecond timestamp
values in packets and further decouples calling code from PTP:

Benefits:
- simplifies calling code by removing redundant conversions.
- prepares for removing PTP dependencies from net_pkt.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-29 16:27:15 +02:00
Guillaume Gautier 69fb18a19d drivers: adc: stm32: ADC nocache buffers can be in CONFIG_NOCACHE_MEMORY
CONFIG_NOCACHE_MEMORY is a valid way of declaring buffers in
nocache regions. Consider them valid in the STM32 ADC driver
nocache check.
Copied from commit 818aa2d

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-09-29 16:52:33 +03:00
Dat Nguyen Duy 0b0988db2d drivers: pwm_nxp_s32_emios: add support for pwm capture
This introduces pwm capture shim driver for NXP S32 EMIOS,
the driver uses SAIC mode that is supported for all channels,
to capture the counter value on each edge for period/pulse
measurement

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-29 15:40:04 +02:00
Dat Nguyen Duy 05fd40012f drivers: pwm_nxp_s32_emios: prepare for support pwm capture
This prepares support pwm capture APIs by extended current pwm
shim driver but use a differrence hal component:

- Introduce a Kconfig options that will be set when PWM pulse
  generation API is used, it is also used to select the hal
  component. Guarding current code inside this Kconfig option

- Increase #pwm-cells to 3, flags is supported for PWM capture

- Do not require duty-cycle and polarity be set in dt, PWM
  capture doesn't need it.

- Rename emum value for pwm-mode to keep only key information

- Add preprocessor in case no channel is configured for generate
  PWM output, to avoid warning when build

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-29 15:40:04 +02:00
Dat Nguyen Duy e021108ace misc: nxp_s32_emios: enable and declare interrupt handler
This enables and declares interrupt handlers for eMIOS,
the handlers defined and implemented at HAL, the driver
takes the name for each id from interrupt-names devicetree

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-29 15:40:04 +02:00
Pawel Osypiuk 7bc93a62b8 drivers: bluetooth: rpmsg: implement .close()
Add .close() implementation for the HCI RPMsg driver.

When running on the nRF5340 application core, it will power-cycle the
network core.

Signed-off-by: Pawel Osypiuk <pawelosyp@gmail.com>
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-09-29 13:53:13 +02:00
Bernt Johan Damslora 9eac29d532 drivers: sensor: npm1300_charger: Correct temperature order of magnitude
Changes the interpreted unit of the threshold temperatures to match the
description (millidegrees).

Signed-off-by: Bernt Johan Damslora <Bernt.Damslora@nordicsemi.no>
2023-09-29 11:57:23 +02:00
Guillaume Gautier 85fa6746de drivers: clock_control: stm32u5: enable backup access before enabling lsi
LSI needs write access to backup domain to be enabled.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-09-29 10:33:42 +02:00
Wouter Horré 3bc531e9c6 drivers: i2c: stm32: Support wakeup from STOP
This commit adds support for wakeup from STOP mode when the i2c device is
configured as a target.

Signed-off-by: Wouter Horré <wouter@versasense.com>
2023-09-29 09:48:04 +02:00
Stefan Petersen 58ca047fa7 dts: stm32h7: flash-controller: Add default STM32 as compatible
Add "st,stm32-flash-controller" as compatible for STM32H7 so that
what is defined for STM32 in general  is also defined for STM32H7.
Already most of the other STM32 versions have this addition.

Also removed the specific STM32H7 flag check in
/flash/driver/Kconfig.stm32.

Signed-off-by: Stefan Petersen <spe@ciellt.se>
2023-09-29 09:47:46 +02:00
Maureen Helm d5287578fe dts: bindings: boards: Update Ethernet PHY to use reg property
Updates Ethernet PHY devicetree bindings to be more consistent with
Linux by using the standard `reg` property for the PHY address instead
of a custom `address` property. As a result, MDIO controller bindings
now require standard `#address-cells` and `#size-cells` properties.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-09-29 09:47:15 +02:00
Maureen Helm ce42ffcce0 dts: boards: Use ethernet-phy devicetree node name consistently
Some Ethernet PHYs used the devicetree node name `phy`, while others
used `ethernet-phy`. Be consistent and use `ethernet-phy` throughout.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-09-29 09:47:15 +02:00
Guillaume Gautier e8e5d5554c drivers: adc: stm32: reset acquisition time between reads
For all STM32 ADC that use common sampling times, there is a check made to
ensure that all channels of a sequence use the same sampling time.
The value was not reset between reads, resulting in error if two
consecutive sequences used different values.
This commit adds a reset of this value once read is done.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-09-29 09:47:07 +02:00
Yong Cong Sin 8cd64fd791 drivers: gpio: sifive: use Kconfig to convert between levels
The number of IRQ first level bits is not necessarily 8 bits
now, so use `CONFIG_1ST_LEVEL_INTERRUPT_BITS` instead of
hardcoded value.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-09-29 09:46:24 +02:00
Bjarki Arge Andreasen cc219c0132 drivers: serial: serial_test.c: Patch 64-bit incompat
The serial_test.c driver uses size_t to store read_size,
which becomes a 64-bit type when built for 64-bit
architectures. This is incompatible with the print
format %d which is 32-bit. Updated to %zd

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-09-28 16:38:30 -04:00
Bjarki Arge Andreasen d118d19293 drivers: serial: serial_test: Move ring buf dep to Kconfig
This commit moves the dependency management between the
RING_BUFFER and UART_ASYNC_API or UART_INTERRUPT_DRIVEN
options to the Kconfig Kconfig.test.

If either UART API options listed are selected, the
RING_BUFFER option must be selected. This is now handled
automatically by Kconfig instead of causing a build
assert.

The asserts where added with this PR #59880, and are
removed in this commit.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-09-28 16:38:30 -04:00
Bjarki Arge Andreasen ebd6681589 drivers: serial: serial_test: Patch irq_isr set to undefined
This commit fixes an error where the irq_isr callback is set
to an undefined variable instead of NULL.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-09-28 16:38:30 -04:00
Jeroen Reeskamp 1134245ac9 sensors: lsm6dso: Values now match better with the ODR values.
Values are specified in the datasheet(page 30, table 18).
Values match with values defined in lsm6dso-common.yaml

Signed-off-by: Jeroen Reeskamp <jeroen.reeskamp@vention.nl>
2023-09-28 12:21:54 -05:00
Henrik Brix Andersen a9d3935fa0 drivers: can: solely use sjw from devicetree for initial timing
Update the CAN controller drivers to solely use the sjw and sjw-data
devicetree properties for setting the initial timing when devicetree timing
parameters are specified in Time Quanta (TQ).

Any timing set via the CAN timing APIs will contain either user-provided or
automatically calculated SJW values. This includes any timing parameters
calculated from bus-speed and bus-speed-data devicetree properties.

Update the CAN controller driver tests accordingly and remove the
CAN_SJW_NO_CHANGE definition as it has lost its meaning.

Fixes: #63033

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-09-28 16:28:56 +02:00
Henrik Brix Andersen e397b85eb8 drivers: can: calculate a default SJW value
Change the CAN timing calculation APIs to automatically calculate a default
(Re-)Synchronization Jump Width (SJW) value. The calculated value can be
overwritten by the caller if desired.

This allows automatically scaling the SJW according to the number of Time
Quanta (TQ) used for phase segment 2 instead of relying on a compile-time
fallback value defined in devicetree.

This reduces the can_set_timing()/can_set_timing_data() API functions to
simple setters (with validation).

Fixes: #63033

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-09-28 16:28:56 +02:00
Mulin Chao 21d7c2db6d drivers: sensor: npcx: fix debug message when port B is captured
Fix wrong debug message when port B of tachometer is captured.

Signed-off-by: Evan Chang <MCCHANG1@nuvoton.com>
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-09-28 09:08:29 -05:00
Dominik Ermel 1f3605de21 drivers/flash/nrf: Workaround for nrf91 errata 7
Fix UICR read access.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-09-28 15:33:52 +02:00
honglin leng c4f102fd8b boards: arm64: add support for Raspberry Pi 4 Model B
This is an AArch64 board. We also add BCM2711 SoC support

Signed-off-by: honglin leng <a909204013@gmail.com>
2023-09-28 13:40:45 +02:00
Aleksander Wasaznik 4d926ac041 drivers: serial_test: Implement interrupt and async APIs
This allows testing code that uses the UART interrupt-driven API and
UART asynchronous API.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-09-28 14:07:52 +03:00
Anas Nashif 6d23a960db lib: os: build fdtable conditionally
Stop building fdtable by default, make it conditional and build it only
when needed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-28 06:25:16 -04:00
Fabiola Kwasowiec 02e4e60f2f dmic: add the correct gain values to the dmic registers
Zephyr increments the gain until it reaches the maximum value and
then sets the registers to zero which is incorrect.
The values set in the DMIC config should be restored.

Signed-off-by: Fabiola Kwasowiec <fabiola.kwasowiec@intel.com>
2023-09-28 09:34:44 +02:00
Manuel Argüelles 977ad483b4 mdio: shell: add Clause 45 commands
Add MDIO shell commands for Clause 45 read/write operations.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-28 09:33:10 +02:00
Manuel Argüelles 280ddaef4a mdio: introduce Clause 45 APIs
Add `mdio_read_c45()`/`mdio_write_c45()` APIs for Clause 45 access
and remove the `protocol` MDIO binding property so that MDIO bus
controller can support more than one protocol.

A new MDIO header is introduced with generic opcodes, MMD and
registers addresses, to be used by MDIO and PHY drivers.

Existing MDIO drivers that support both Clause 22 and Clause 45
access are migrated to the new APIs.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-28 09:33:10 +02:00
Manuel Argüelles 62b28cb443 mdio: rename argument devad to regad
Rename argument `devad` to `regad` to indicate this is the register
address in a given PHY device and to not be confused with the
Clause 45 device address within a port.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-28 09:33:10 +02:00
Francois Ramu 1d29a8c3c2 drivers: i2c: stm32 i2c driver supports 10-bit addressing
When slave_address is 10 bits, data type should be
uint16_t instead of uint8_t,
like the data typeof data->slave_cfg->address.
https://github.com/zephyrproject-rtos/zephyr/issues/55987

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-09-28 09:27:09 +02:00
Dat Nguyen Duy 8185faa0cb drivers: dma_mcux_edma: add support dma driver for s32k344
On S32K344, the offset in memory map between each channel
is 0x4000 for most channels, but there is specific case is
between channel 11 and 12 which is 0x1D4000 instead. As a
consequence, 32 channels are divided to two parts: one
starts from channel 0 -> 11. The other is from channel 128
to 145. The channel gap is from 12 -> 127.

For user and data structures in shim driver, the channel's
value comes from 0 --> 31. Above constraint will be counted
when interact with the mcux sdk

Beside that, the DMAMUX register in this platform is very
specific, not in identical with DMAMUX channel, so shim
driver is updated to cover this case

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-27 14:02:09 -05:00
Dat Nguyen Duy d4a2b2244f drivers: dma_mcux_edma: add support for edma version 3
Add new dt binding for edma v3 that inherits whole dt
properties from current version. One more property is
added for SoCs that don't have separate error interrupt
id, use same id with channel interrupt

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-27 14:02:09 -05:00
Dat Nguyen Duy a5cf757c9e drivers: dma_mcux_edma: improve interrupt handling
The current implementation iterates over all channels
even if only several channels share the same irq. This
introduces one more dt property to describe an offset
between two channels share the same interrupt id.

Beside that, the error interrupt must be put as last
element of "interrupt" dt property.

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-27 14:02:09 -05:00
Dat Nguyen Duy 03b5ba5990 drivers: dma_mcux_edma: add support for multiple DMAMuxes
This adds support for platforms that have multiple DMAMUXes
per DMA instance

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-27 14:02:09 -05:00
Dat Nguyen Duy ad08d71efa drivers: dma_mcux_edma: correct valid values for dma channel/slot
The dma-channels devicetree value - 1 = maximum valid channel
The dma-requests devicetree value - 1 = maximum valid request

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-27 14:02:09 -05:00
Andrei Emeltchenko d7fd3db32e drivers: smbus: pch: Simplify IRQ flags
Use COND_CODE_1() macro instead of macro trampoline.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-09-27 20:35:06 +03:00
Flavio Ceolin eeea26d206 ipm: cavs: Fix possible buffer overflow
A buffer overflow happens in send() when size is negative because
it is promoted to signed when used in memcpy.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-09-27 11:51:34 -05:00
Flavio Ceolin 98857c267d ipm: imx: Initialize variable before using it
Since the driver is passing the whole buffer, let's zero it to avoid
pass garbage in case of size != buffer's size.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-09-27 11:51:34 -05:00
Flavio Ceolin 0a12a05e63 ipm: imx: Fix possible buffer overflow
It is possible to happen a buffer overflow in ipm_send due the lack
of a checking for negative value.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-09-27 11:51:34 -05:00
Flavio Ceolin 4ff32d9290 ipm: mcux: Initialize variable before using it
Since the driver is passing the whole buffer, let's zero it to avoid
pass garbage in case of size != buffer's size.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-09-27 11:51:34 -05:00
Flavio Ceolin 6654d18596 ipm: mcux: Fix possible buffer overflow
It is possible to happen a buffer overflow in ipm_send callback
due a wrong comparison between signed/unsigned types.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-09-27 11:51:34 -05:00
Florian Grandel a12a6ab5b9 drivers: ieee802154: introduce channel pages
Replaces the previous approach to define bands via hardware capabilities
by the standard conforming concept of channel pages.

In the short term this allows us to correctly calculate the PHY specific
symbol rate and several parameters that directly depend from the symbol
rate and were previously not being correctly calculated for some of the
drivers whose channel pages could not be represented previously:
* We now support sub-nanosecond precision symbol rates for UWB. Rounding
  errors are being minimized by switching from a divide-then-multiply
  approach to a multiply-then-divide approach.
* UWB HRP: symbol rate depends on channel page specific preamble symbol
  rate which again requires the pulse repetition value to be known
* Several MAC timings are being corrected based on the now correctly
  calculated symbol rates, namely aTurnaroundTime, aUnitBackoffPeriod,
  aBaseSuperframeDuration.

In the long term, this change unlocks such highly promising functional
areas as UWB ranging and SUN-PHY channel hopping in the SubG area (plus
of course any other PHY specific feature).

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-27 12:44:15 -04:00
Florian Grandel 7c00b81705 drivers: ieee802154: cc13xx_cc26xx: readability improvement
Aligns the name of the return value variable with what is used elsewhere
in the driver and the subsystem for improved readability and
consistency.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-27 12:44:15 -04:00
Florian Grandel ea6248b870 drivers: ieee802154: cc1200: SUN-FSK compatibility
Preparative change to introduce build-time configured channel pages.
This fixes the description of the driver's available PHYs and makes
channel page and channel range independent from runtime attributes.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-27 12:44:15 -04:00
Andrzej Głąbek eafe6a9a31 drivers: spi_nrfx_spis: Handle empty spi_buf_set structures properly
SPI API allows `spi_buf_set` structures with no buffers linked to them
(with `.buffers = NULL`). Correct the spi_nrfx_spis driver so that it
is able to deal with such structures.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-09-27 17:49:28 +02:00
Aaron Massey 12cbfcf397 fuel_gauge: Repl property struct w/ union
Based on review of the similar charger driver API, it's been demonstrated
from the community that embedding a per value property type when fetching
properties. Separating off the property types from the property values
themselves also allow an array of property types to declared as static
const.

Break up fuel_gauge_property struct into a fuel_gauge_prop_val union and a
fuel_gauge_prop_t property type as inputs into fuel gauge API functions.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-09-27 12:07:59 +02:00
Aaron Massey 329ecd1e12 fuel_gauge: Remove status from fuel gauge properties
Based on review of the similar charger driver API, it's been demonstrated
from the community that embedding a per value status code when fetching
multiple properties isn't particularly wanted or needed. It was largely
considered not worth the additional maintenance to have the extra per
property error information.

Remove the status field from the fuel_gauge property value structs.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-09-27 12:07:59 +02:00
Aaron Massey bddd88955d fuel_gauge: Add fuel_guage_set_props()
The fuel_gauge_set_prop() function prototype declares a function that sets
multiple fuel gauge properties at once. The naming suggests it ought to
fetch a singular property at a time. Moreso, some clients may just want to
set properties one at a time and may feel uncomfortable using a prototype
for fetching multiple properties when wanting to fetch them one at a time.

Modify fuel_gauge_set_prop() to fetch a single property and add
fuel_gauge_set_props() to support fetching multiple properties. Modify
existing tests/drivers/samples.

This is part of #61818 work.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-09-27 12:07:59 +02:00
Aaron Massey e294b16a2f fuel_gauge: Add fuel_guage_get_props()
The fuel_gauge_get_prop() function prototype declares a function that
retrieves multiple fuel gauge properties at once. The naming suggests it
ought to fetch a singular property at a time. Moreso, some clients may just
want to fetch properties one at a time and may feel uncomfortable using a
prototype for fetching multiple properties when wanting to fetch them one
at a time.

Modify fuel_gauge_get_prop() to fetch a single property and add
fuel_gauge_get_props() to support fetching multiple properties. Modify
existing tests/drivers/samples.

This is part of #61818 work.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-09-27 12:07:59 +02:00
Sylvio Alves bdda8ac48e soc: esp32s3: add esp32s3_appcpu for AMP support
Adds esp32s3_appcpu SoC and update default esp32s3 SoC
to support AMP feature.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-09-27 12:07:21 +02:00
Gerson Fernando Budke 037618a638 drivers: ieee802154: rf2xx: Fix rx promiscuous behaviour
When radio is set to promiscuous mode it is desirable to receive
invalid frames. This skip a few checks and allow an invalid and
non-standard frames be delivered for diagnose.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-09-27 09:53:08 +02:00
Jonas Otto 1402d2d8b4 drivers: i2c_ll_stm32_v2: add warning about i2c speeds above fast
The i2c_ll_stm32_v2 driver requires manual timing configuration for
"fast mode plus" speed.
This adds an error message linking to the appropriate documentation.

Signed-off-by: Jonas Otto <jonas@jonasotto.com>
2023-09-27 09:13:31 +02:00
Benjamin Cabé 14c92da96d doc: stm32: Update all st.com links to use HTTPS
While recent browsers seem to transparently try to use https for
http://www.st.com/... URLs, they are effectively not working anymore, so use
https://www.st.com/... URLs instead.

curl http://www.st.com/en/evaluation-tools/nucleo-g070rb.html -m 5 -v
*   Trying 104.89.117.48:80...
* Connected to www.st.com (104.89.117.48) port 80 (#0)
> GET /en/evaluation-tools/nucleo-g070rb.html HTTP/1.1
> Host: www.st.com
> User-Agent: curl/8.1.2
> Accept: */*
>
* Operation timed out after 5002 milliseconds with 0 bytes received
* Closing connection 0
curl: (28) Operation timed out after 5002 milliseconds with 0 bytes
received

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-09-26 16:55:08 +02:00
Jilay Pandya 4e262bf83a fix: drivers: remove redundant config checks in cmake files
This commit does not introduce any functional change to the
codebase. Just removes certain redundant checks from
various CMakeLists.txt files in order to bring more coherence
in the codebase.

Signed-off-by: Jilay Pandya <jilay.pandya@zeiss.com>
2023-09-26 16:54:58 +02:00
Iuliana Prodan 8148643881 ipm: imx: send firmware ready reply to check for fw boot completion
Send a fw ready reply message as soon as possible.
This is usually used on host side which is waiting
for this message in order to establish the
communication with the remote processor - see
imx_dsp_rproc driver from Linux.

This can be enabled by IPM_IMX_FW_READY_REPLY config,
which is by default N.

Set CONFIG_IPM_IMX_FW_READY_REPLY as Y for
openamp_rsc_table sample, running on nxp_adsp_imx8m.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2023-09-26 16:54:04 +02:00
Manuel Argüelles ca3310145f drivers: select nocache only when supported
NOCACHE_MEMORY depends on ARCH_HAS_NOCACHE_MEMORY_SUPPORT, so
don't try to select the symbol if not supported.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-26 15:09:51 +02:00
Yong Cong Sin 0538411c09 drivers: mm: refine includes of the header
Refines the `system_mm.h` to include `zephyr/types.h` instead
of `zephyr/kernel.h` as that is all it needs.

Updated the includes of `mm_drv_ti_rat.c` accordingly.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-09-26 15:09:12 +02:00
Jatty Andriean e364a095a6 drivers: clock_control: Add PLL fracn for STM32U5
Based on RM0456, each PLL in the STM32U5 has the
capability to work either in integer or fractional mode.
In this update, the fractional mode can be enabled
by setting the fracn value in the device tree.

Signed-off-by: Jatty Andriean <jandriea@outlook.com>
2023-09-26 15:06:56 +02:00
Dawid Niedzwiecki 68292b0310 counter: stm32 rtc: improve readability
Split the read function into 2 versions (date and no date) since they
don't have common code.

It improves readability.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-26 15:05:35 +02:00
Dawid Niedzwiecki 49f9aa7d12 counter: stm32 rtc: handle sub second registers
Add support for using the sub second registers. It allows reading and
setting alarm with the sub second tick resolution.

The RTC module is configured to get as high frequency as possible, which
equals the source clock (RTCCLK) divided by 2. To get such frequency,
the asynchronous prescaler is set to 1.

According to RM, setting the asynchronous prescaler to a high value
minimize consumption, so the change increase the power consumption.

Use a config to enable the sub second support.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-26 15:05:35 +02:00
Dawid Niedzwiecki 322f7980c5 counter: stm32 rtc: simplify calculation
RTC drivers uses only seconds, so transition to microseconds is
necessary.

Change way of calculation tick<->time to avoid unnecessary
conversations.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-26 15:05:35 +02:00
Dawid Niedzwiecki c7d779f6e2 counter: stm32 rtc: fix indentations
Fix indentations of the API definition.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-26 15:05:35 +02:00
Dawid Niedzwiecki 16370a259a counter: stm32 rtc: improve reading registers
Synchronize reading two separate registers. In some edge cases the read
registers could point different dates.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-26 15:05:35 +02:00
Dawid Niedzwiecki ad53863d1a counter: stm32 rtc: improve assigning configs
The config values have been hardcoded as magic values. Introduce
universal calculation based on the DTS entries.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-26 15:05:35 +02:00
Daniel Leung 3374e81438 uart: ns16550: separate IO/MMIO and PCIe init macros
This separates the DT device init macros into two: one for
UART accessed via IO port or MMIO, the other for PCIe UART.
All the conditions needed to setup the device structs are
getting complicated. Hopefully separating them would make
them easier to decode, and to avoid the conditions having
too many levels.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung 9f9b4a8afa uart: ns16550: use io-mapped DT property for IO port access
The old CONFIG_UART_NS16550_ACCESS_IOPORT has been used to
indicate whether to access the NS16550 UART via IO port
before device tree is used to describe hardware. Now we have
device tree, and we can specify whether a particular UART
needs to be accessed via IO port using property io-mapped.
Therefore, CONFIG_UART_NS16550_ACCESS_IOPORT is no longer
needed (and thus also CONFIG_UART_NS16550_SIMULT_ACCESS).
Remove these two kconfigs and modify code to use device tree
to figure out how to access the UART hardware.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung 3296956331 uart: ns16550: move setting .reset_spec inside initializer
This moves setting .reset_spec inside struct initializer
instead of using macro trampoline.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung 53bc95e218 uart: ns16550: refactor UART_NS16550_IRQ_CONFIG_*
Instead of PCIE0 and PCIE1, use no suffix for IO port/MMIO IRQ
configuration funct, and suffix PCIE for IRQ config on PCIE
bus.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung 566d21804c uart: ns16550: simplify DEV_DATA_FLOW_CTRL
Use COND_CODE_1() instead of macro trampoline and move it
into struct initializer.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung 8b54cb859e uart: ns16550: simplify BOOT_LEVEL
Use CODE_CODE_1() instead of macro trampolines when
CONFIG_UART_NS16550_PARENT_INIT_LEVEL is enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00