Commit graph

18932 commits

Author SHA1 Message Date
Armin Brauns
2f6dff59c5 drivers/fpga: ice40: use k_usleep instead of busy loop in SPI mode
The 200ns reset time are a minimum value, there is no need to enforce
precise timing (and thus manual per-device calibration) here.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-14 11:17:35 +01:00
Armin Brauns
8aec9dd552 drivers/fpga: ice40: fix minimum config delay
From FPGA-TN-02001-3.3 "iCE40 Programming and Configuration":

> After driving CRESET_B High or allowing it to float High, the AP must
> wait a minimum of 1200 µs, allowing the iCE40 FPGA to clear its internal
> configuration memory.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-14 11:17:35 +01:00
Patryk Duda
8a85f0e87f drivers: flash: Introduce API function for flash extended operations
Besides of standard flash operations like write or erase, flash
controllers also support additional features like write protection or
readout protection. These features are not available in every flash
controller, what's more controllers can implement it in a different way.

It doesn't make sense to add a separate flash API function for every
flash controller feature, because it could be unique (supported on small
number of flash controllers) or the API won't be able to represent the
same feature on every flash controller.

Extended operation interface provides flexible way for supporting flash
controller features. Code space is divided equally into Zephyr codes
(MSb == 0) and vendor codes (MSb == 1). This way we can easily add
extended operations to the drivers without cluttering the API or
problems with API incompatibility. Extended operation can be promoted
from vendor codes to Zephyr codes if the feature is available in most
flash controllers and can be represented in the same way.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-03-14 11:17:13 +01:00
Ionut Catalin Pavel
867c254801 drivers: regulator: common: skip voltage change at init if already valid
The current implementation always sets the voltage before enabling,
even if the current voltage is in the allowed range.

This has some side effects, i.e. for PMIC regulators that are
pre-programmed for a specific value but allow voltage changes during
runtime. The side effect being that the regulator will always be reset
to the lower value of the voltage range at init.

Another usecase would be when a bootloader sets a specific voltage then
loads an application that uses the same driver.

The proposed fix is to evaluate the current voltage and try to bring
the actual voltage in range if the current voltage is not valid
according to the min/max constraints.

Tested on custom SAMD20 board with a custom RK816 PMIC driver.

Signed-off-by: Ionut Catalin Pavel <iocapa@iocapa.com>
2023-03-13 18:33:26 +00:00
Andriy Gelman
6c3998d494 drivers: spi: spi_esp32_spim: Remove check for NULL before freeing
As per k_free() documentation it accepts a NULL argument.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-03-13 14:03:35 +01:00
Andriy Gelman
1eff8e76bd drivers: spi: spi_esp32_spim: Fix potential tx_temp leak
If rx_temp allocation fails then tx_temp needs to freed.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-03-13 14:03:35 +01:00
Lucas Tamborrino
7f4dadee3a drivers: spi: esp32xx: add support for dedicated CS
Currently the driver only support software controlled CS
defined by cs-gpios property.
This commit enables the possibility of using dedicated CS
by setting the pins on pinctrl and omitting the cs-gpios
property.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-03-13 14:02:06 +01:00
Lucas Tamborrino
1adec07f01 drivers: spi: esp32xx: refactor SPI DMA preprocessor identifiers
Change the preprocessor identifier from CONFIG_SOC_ESP32C3 to
SOC_GDMA_SUPPORTED so it can include ESP32S3 in GDMA routines.

Remove hardcoded values from hal calls to use dma_host instead.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-03-13 14:02:06 +01:00
Henrik Brix Andersen
641b89801a drivers: can: mcan: add support for CAN-FD ESI flag
Add support for the CAN-FD Error State Indicator (ESI) flag in received
frames.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-11 19:45:14 +01:00
Henrik Brix Andersen
e08546fe98 drivers: can: shell: add support for the CAN-FD ESI flag
Print the CAN-FD Error State Indicator (ESI) flag as "P" for "Passive" in
received frames.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-11 19:45:14 +01:00
Emilio Benavente
5081f6aa28 drivers: pwm: pwm_mcux_sctimer: duty cycle fix
This is a fix for a driver bug that assumes a
user will want a new pwm channel for a new
pwm signal if they decide to change the
period length of the pwm. In some cases,
this creates a noticable change of
duty cycle accuracy.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2023-03-11 19:44:27 +01:00
Henrik Brix Andersen
0f2b17b5e1 drivers: can: shell: add support for CAN-FD frame format filters
Add shell support for adding filters for CAN-FD format frames.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-10 12:21:03 -08:00
Gerard Marull-Paretas
aced3bb2ac drivers: i2c: gpio: cast io context to void*
i2c_bitbang_init takes a context as void *, so discarding const
qualifier of the driver's config. Explicitely cast to void * to fix the
problem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-03-10 12:20:22 -08:00
Declan Snyder
109e03eb4e drivers: memc: fix flexspi init priorities
Fix flexspi memc drivers init priorities

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-03-10 13:10:30 -06:00
Vaishnav Achath
c6da2ebe77 drivers: ieee802154: cc13xx_cc26xx: Allow both radios to coexist
Currently the 2.4G radio driver for CC1352 has few implementations which
prevents both the radios to be used in a single build, thus preventing
applications to have different builds to switch the RF bands even though
the hardware supports dual bands simultaneously.

The following updates are made:
 * Remove RF patches from stack.
 * Implement if_stop() to stop the interface and yield the interface.
 * Use RF_runCmd() instead of RF_runImmediateCmd() so that two RF handles
 can work simultaneously.

All the updates are similar to the more recent cc13xx subg driver which
implements all these recommended practices already.

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
2023-03-10 10:22:16 -05:00
Vaishnav Achath
2535a46995 drivers: ieee802154: cc13xx_cc26xx_subg: Skip CRC for invalid packets
During extended testing, rx_done() callback was seen to be invoked with
zero-length packets.When RAW_MODE is enabled, CRC is being appended to
these packets thus making downstream consumers think the packet is valid.
Root cause of the callback being invoked with zero-length packet is
unknown, but appending CRC to these packets is incorrect, thus fix it.

Also fix a minor error which causes build failure when
CONFIG_NET_L2_IEEE802154_SUB_GHZ is not defined.

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
2023-03-10 10:22:16 -05:00
Manojkumar Subramaniam
f75c5b8c3b drivers: gpio: sifive: Update to use the available common IRQ API and
remove obsolete code.

Fixes issue: #20338

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2023-03-10 07:59:42 -06:00
Rainer Paat
ed2c25effc drivers: counter: MCP7940N: initialization fix
This PR fixes MCP7940N initialization failure on Sunday if
external battery is used to keep the RTC running over the
MCU or Zephyr OS restarts.

Signed-off-by: Rainer Paat <rapaat@gmail.com>
2023-03-10 14:09:49 +01:00
Sylvio Alves
4701581776 drivers: timer: esp32c3: fix dtick counter increment
System uptime is not getting incremented when TICKLESS_KERNEL is enabled.

This fixes it by changing the clock_annouce and updating
last_count increment accordingly.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-03-09 17:22:34 +01:00
Attie Grande
cf20ff0765 drivers: i2c: sam0: add support for I2C_MSG_RESTART
This support was accidentally removed in the re-shuffle in de18f97

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2023-03-09 09:22:02 +01:00
Aditya Bhutada
7d9da1c687 drivers: espi: espi_mchp_xec: removed redundant state variables
Removed struct variables for storing states: sx, plt_rst, espi_rst.
While Sx & espi_rst state variables were totally redundant, plt_rst
variable had a use-case to prevent sending multiple callbacks to app.
Experimentally proven that use-case was not valid, as plt_rst isr
itself gets called only upon rising/falling edge.
Removing the condition to check plt_rst's current and previous state,
also solves the problem where global reset do not update plt_rst state.

Signed-off-by: Aditya Bhutada <aditya.bhutada@intel.com>
2023-03-09 09:21:43 +01:00
Jeppe Odgaard
c3b6ad07c1 drivers: uart: mcux_lpuart: add parity support
Read and use device tree parity value.
If the property is not set parity none is used.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-03-09 09:20:44 +01:00
Sam Hurst
430990ee3f usb-c: tcpc: Disable Dead Battery after system starts
The Dead Battery resistors interfere with port partner
detection. So, Dead Battery is disabled after the system
starts and sets the Rd or Rp resistors on the CC lines.

Tested on b_g474e_dpow1 with JP5 set to USBC.
Tested on stm32g081b_eval with JP17 set to D5V.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-03-09 09:20:35 +01:00
Przemyslaw Bida
dc5155e5a5 openthread: ieee802154_nrf5: Add implementation of new api.
Adding an Openthread radio API `otPlatRadioSetMacFrameCounterIfLarger`
implementation and the corresponding call to the IEEEE802154 driver.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2023-03-08 11:07:22 +01:00
Francois Ramu
551be5c7f6 drivers: adc: stm32 adc driver disable before calibration
In the adc_stm32_init() function, when adc_stm32_calib() is called,
the ADC is not yet enabled but still disabled.
This patch makes sure to Disable the ADC before  its calibration.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-08 11:06:27 +01:00
Armin Brauns
821fddc2e1 drivers: bluetooth: hci_spi: fix condition causing infinite loop
With a size of 0, the inner loop will never terminate, so don't try to
enter it.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-08 08:58:33 +01:00
Chen Xingyu
7ae7847643 soc: arm: Add support for STM32H730xxQ
The STM32H730 series has a variant built with SMPS. It uses
`stm32h730xxq.h` header file instead of `stm32h730xx.h`, which has the
SMPS macro defined.

This commit adds the `SOC_STM32H730XXQ` configuration option to allow
the build system include the proper header file. With this change,
boards can enable `CONFIG_POWER_SUPPLY_DIRECT_SMPS` to set up the power
supply for the CPU.

Signed-off-by: Chen Xingyu <hi@xingrz.me>
2023-03-07 15:49:47 +01:00
Declan Snyder
e72d1bf970 drivers: memc: flexspi: Update init priority
Update flexspi driver init priority to be the
memc driver init priority. This fixes a bug where
the flexspi flash drivers on i.MX RT platforms were
being initialized before the flexspi memc driver.
Since those flash drivers depend on the flexspi
spi bus controller being initialized, the flash drivers
would fail to initialize and cause runtime failures.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-03-07 08:32:48 +01:00
Purdea Andrei
f4e0f9004f drivers: usb_dc_rpi_pico: implement remote wakeup support
This change implements the following, necessary for remote wakeup to be
supported:

- implement usb_dc_wakeup_request() call to trigger remote wakeup
- implement interrupts to detect supsended/resumed state
- implement extra logic to simulate resumed state when the resume
  is a result of remote wakeup. In this case the rp2040 chip doesn't
  send a USB_INTR_DEV_RESUME_FROM_HOST interrupt, or any other
  interrupts when the resume condition is detected to be extended
  by the upstream port, so we need to simulate this event when we
  see activity on the bus.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-03-06 21:18:38 +01:00
Yuval Peress
d6c45ad27b sensor: implement drdy trigger for icm42688
Add support for the data ready trigger in the icm42688 driver.

Signed-off-by: Yuval Peress <peress@google.com>
2023-03-06 10:44:52 -06:00
Seppo Takalo
edae1bed3d drivers: kscan: Add driver for XPT2046
Add driver for Xptek XPT2046 resistive touch controller on SPI.
Only interrupt driven mode supported, does not do polling.

Signed-off-by: Seppo Takalo <seppo.takalo@iki.fi>
2023-03-06 17:21:17 +01:00
Sylvio Alves
690f65dbd9 drivers: wifi: esp32: fix possible interface null pointer
esp32_wifi_dev_init() currently starts Wi-Fi stack before
the interface is properly configured, which happens in function
esp32_wifi_init(). This can trigger a ESP32_WIFI_EVENT_STA_START event
before interface initialization, causing a crash.
Moving esp_wifi_start() to esp32_wifi_init() will guarantee that
this won't happen.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-03-06 16:44:45 +01:00
Giancarlo Stasi
654d2176d7 drivers: nrf_rtc_timer: force init of interrupt and event enabling
Make sure that the interrupt and event routing enable bits have the
reset values in case the Zephyr firmware image is chain-loaded.
When started by MCUboot, these registers values aren't the reset values,
but then Zephyr initializes them in same way. Yet, when the Zephyr
firmware image is chain-loaded by nRF5 bootloader, they may have values
that cause the scheduler to behave in unexpected ways.

Signed-off-by: Giancarlo Stasi <giancarlo.stasi.co@gmail.com>
2023-03-06 12:34:08 +01:00
Daniel DeGrasse
7daba22c41 drivers: kscan: fix GT911 support when not using interrupt
Fix support for GT911 touchscreen driver when not using interrupt.
The controller still requires that the INT pin be set to input in
order to correctly respond to I2C queries.

Also, the GT911 requires that the INT pin is not configured until the
RESET pin has been low at least 10 ms after reset, so add an additional
delay during initialization to account for this.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-04 09:19:26 +01:00
Daniel DeGrasse
d8b8566daf drivers: clock_control: add clock rate definitions for MIPI and LCDIF
Add clock rate definitions for MIPI and LCDIF peripherals, to enable
retrival of these peripheral clock rates at runtime.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-04 09:19:26 +01:00
Daniel DeGrasse
0105a85ed2 drivers: display: introduce driver for NXP DCNANO LCDIF peripheral
Introduce driver for NXP DCNANO LCDIF (lcd interface) peripheral,
present on iMX.RT500. Currently this driver only supports updating
the primary framebuffer, and does not implement support for the cursor
buffer present on this IP.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-04 09:19:26 +01:00
Daniel DeGrasse
5cc33d2a3c drivers: mipi: introduce MCUX MIPI DSI 2L driver
Introduce driver for MCUX MIPI DSI 2L. This IP block differs slightly from
the existing MCUX MIPI peripheral, and uses a different hardware
abstraction layer. For these reasons, a new driver was introduced rather
than extending the existing mcux_dsi implementation.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-04 09:19:26 +01:00
Daniel DeGrasse
5455c556f1 drivers: memc_mcux_flexspi: enable configuring AHB RX buffer allocation
Allow configuration of AHB RX buffer allocation. This allows sections
of the AHB RX buffer to be reserved for specific masters, which can
enhance performance.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-04 09:19:26 +01:00
Andriy Gelman
33d1792e3d drivers: spi: Add xmc4xxx driver
Adds spi driver for xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-03-03 17:20:17 +01:00
Mark Watson
1f178ca935 drivers: sensor: VL53L1X time-of-flight sensor.
The driver utilizes ST Microelectronics library (which
exists in modules\hal\st\sensor\vl53l1x. Platform specific
headers and source files used by the library are included
and adapted for Zephyr.

The driver can be configured in proj.conf to use a
interrupt/polling methods and the use of the XSHUT pin on
the VL53L1X. All uses were tested successfully.

Signed-off-by: Mark Watson <mwatson@prosaris.ca>
2023-03-03 10:01:55 -06:00
Ben Lauret
70c6befa88 drivers: watchdog: implement Smartbond watchdog driver
This patch adds watchdog driver for Renesas Smartbond SOCs.

Co-authored-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>

Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2023-03-03 11:02:37 +01:00
Ben Lauret
36ac1ee2a2 drivers: entropy: add Renesas SmartBond entropy generator driver
This adds driver for SmartBond TRNG peripheral that with separate
ISR an thread data pools.

Co-authored-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>

Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2023-03-03 11:01:36 +01:00
Matthias Hauser
d4e9e5f46c drivers: sensor: Added driver for the Würth Elektronik WSEN-TIDS sensor
Added sample for the WSEN-TIDS temperature sensor.

Signed-off-by: Matthias Hauser <Matthias.Hauser@we-online.de>
2023-03-03 11:01:10 +01:00
Jeppe Odgaard
9a2997fac9 drivers: sensor: mcux qdec rework rotation
Remove modulus feature and return degrees larger than
count_per_revolution.
This makes it possible to detect if a full rotation has occured.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-03-03 10:59:55 +01:00
Daniel DeGrasse
01b9a9cdbb drivers: sdhc: add support for configurable power on delay to SPI SDHC
Add support for configuring power on delay when using SPI SDHC. This
allows cards that reliably initialize with a shorter (1ms) delay to
avoid the long initialize delay otherwise imposed.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-03 09:18:47 +01:00
Maxmillion McLaughlin
2f9335d20a drivers: i2c: stm32: add bus recovery support
Add I2C bus recovery support to the STM32 v1 and v2 driver. The STM32 i2c
peripheral does not natively support I2C bus recovery so recovery is
performed using GPIO bitbanging. This mirrors the bus recovery
implementation for NXP MCUX LPI2C driver.

Fixes: zephyrproject-rtos#54917

Signed-off-by: Maxmillion McLaughlin <github@maxmclau.com>
2023-03-03 09:18:29 +01:00
Jordan Yates
0561d0dd59 console: uart_console: handle runtime PM
Allow the uart_console console_out implementation to integrate with
'Device Runtime Power Management'.

Without using runtime PM, it is impossible for the application to manage
the power state of a UART instance, given that any module in the
application could theoretically LOG_* or printk at any point in time.

This removes the need to manually call `pm_device_state_set` when the
lowest power states must be reached, while still allowing console and
printk messages to be output.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-03 09:17:49 +01:00
Nicolas Pitre
0fc9c9f46a drivers/timer/arm_arch_timer: driver revamp
Couple issues:

- `sys_clock_set_timeout()` should not base its `mtime` on the current
  time either. Tracking the `last_tick` and `last_elapsed` values avoids
  the need for all the tick rounding computation.

- The MIN_DELAY thing is pointless. The hardware performs a signed
  comparison. If the delay gets close or even behind current time then
  the IRQ will be triggered right away. This is unlikely to happen very
  often anyway so the constant overhead is uncalled for.

- Runtime 64-bits divisions on 32-bits hardware are very expensive.

- The timer must be enabled before the count can return a sensible
  value during driver init (at least on qemu_cortex_a9).

Discussion in PR #54919 applies here too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-03-02 15:37:35 -05:00
Aaron Massey
1657860320 emul: Fix endianness fault in sbs gauge emulator
The sbs gauge emulator intercepts SMBus messages for an sbs gauge
compatible IC. However, it was incorrectly interpreting the byte order of
received register write values based on the endianness of the SoC
architecture instead of SMBus' defined little-endianness. This fault was
not caught earlier because native posix and the majority of qemu
architectures use little-endian.

Explicitly interpret the write values as little-endian.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-03-02 21:14:44 +01:00
TOKITA Hiroshi
47f52bba42 drivers: regulator: add support for RaspberryPi Pico regulator.
Add support for rpi_pico regulator.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-03-02 21:14:34 +01:00
Dominik Ermel
94af3a88ee drivers: flashdisk: Change page info verification log message
Change message to make allow distinguishing between error while
getting page info for disk configuration and page layout
verification.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-02 17:08:39 +01:00
Grant Ramsay
9df37fff79 drivers: serial: Add pinctrl support to the NS16550 driver
This enables configuring pins for the UART

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-03-02 13:50:06 +01:00
Grant Ramsay
026105c883 drivers: pinctrl: Add pinctrl support for TI K3 devices
K3 is a common architecture used between different TI
processor families

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-03-02 13:50:06 +01:00
Purdea Andrei
73a800f7dd drivers: usb_dc_rpi_pico: fix stability issue related to control transfers
Description of the bad behaviour before this change:

The arming of the control EP0_OUT endpoint was not kept under
control. It could happen that the EP0_OUT endpoint was left
armed, after the completion of a complete control transfer.

It is clear that the intention was to NOT keep EP0_OUT constantly
armed while idle, because usb_dc_ep_enable() doesn't arm it,
and the intention was for when usb_dc_ep_read() is called to
collect the Setup-Stage 8-byte data, that is when EP0_OUT is armed,
and before this call is performed, the host will keep getting NAKs
for the Data-Stage of the to_device control transfer.

This happens correctly on the first to_device control transfer with
wLength > 0. However, because usb_dc_ep_read_continue() indiscriminately
re-arms all OUT endpoints, in the case of to_device control transfers
with wLength > 0, on the Data-Stage, the endpoint is also re-armed,
which is wrong, because then the endpoint will be left armed after
the control transfer is over.

In this case when a new to_device control transfer starts, the
Data-Stage will be accepted on the first try. This would still
have worked without a failure if the Setup-Stage would have been
processed immediately, but because we process everything in a work
queue at a later time, when the Setup-Stage associated 8-byte data
buffer is read both the Setup-Stage and Data-Stage have arrived.
At the end of handling the Setup-Stage we try to re-arm the EP0_OUT,
which already contains data, thereby corrupting the received length
portion of the buf_ctl register. (Obviously other fields are changed
too, but the length field is the one that first causes chaos, cause
it's written to the maximum, which is 64.) The above mentioned Data-Stage
already has a message in its workqueue for it to be processed, but
it is picked up only after the length field has been corrupted.
Because of this usb_dc_ep_read() thinks there is more data in the buffer
than there really is, and everything becomes de-synchronized, with
later reads accessing uninitialized parts of the buffer.

This sounds like a fundamental failure, that should make it impossible
to operate USB, however the reason this behaviour doesn't make it
impossible to enumerate the device is that this only affects
to_device control transfers with wLength > 0, and during enumeration
there are not many of those happening.
When enumerating a HID keyboard, there is only _one_ of those
happening, and it is the initial setting of the lock light led status.
And that first one succeeds because it's the first one. (However, later
lock light setting control transfers can cause problems, which is how
this problem was encountered.)

The solution in this commit is to keep better control over when EP0_OUT
is armed. This forces the Data-Stage to arrive later (the host will keep
re-trying), and that way the corruption of the buffer control register
is avoided.

Summary of the changes:
 - Rework the logic around deciding wether to re-arm the out endpoint
   after a read. For non-0 endpoint the previous behaviour is kept,
   however for EP0 it is only re-armed if more OUT transactions are
   expected for that SETUP transfer (be it data-stage or status-stage)
 - Force un-arm the EP0_OUT endpoint in case a stall condition is observed.
 - When a setup transfer is received check if EP0_OUT is already armed.
   If armed then log a warning message, and force-disarm it.
 - When a setup req interrupt fires, don't immediately force the next
   read to get it, instead, it will be read only after a setup message
   is extracted from the message queue.
 - When a setup packet is received abort any unfinished previous control
   transfers:
    - cancel any data buffers given to the EP0_IN endpoint
    - drop any new ep0_in writes that are attempted before this newest
      setup packet's associated message is extracted from the message
      queue.
 - In the ISR, check buffer interrupts before setup req interrupts.
   This is to make sure that the final 0-length status message from the
   previous setup packet is consumed before the new setup packet.
   (this is the only case now when both interrupts could be seen as
   having fired by the time the interrupt handler routine executes.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
Co-authored-by: Johann Fischer
2023-03-02 12:58:24 +01:00
Jeff Daly
3acdc971fb drivers: pwm: mchp_xec: fix PWM control register updates
The pwm_mchp_xec driver doesn't clear the divisor or clock select fields
of the config register value before writing it back.  If the register
was previously written, the new values were being logically OR'd with
the prior values.

Signed-off-by: Jeff Daly <jeffd@silicom-usa.com>
2023-03-02 10:55:33 +01:00
Ruibin Chang
f77f02c032 ITE drivers/sensor/vcmp/it8xxx2: add work queue for voltage comparator
Voltage comparator driver submits notifications into system work queue,
this change will make driver to use dedicated work queue, and priority
of dedicated work queue are configurable as well.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2023-03-01 09:12:49 -06:00
Hein Wessels
7d76842fdf drivers: dma: stm32: dmamux: support dmamux2 and bdma
Extends dmamux driver to support DMAMUX 2,
which supports the BDMA on STM32H7 devices.

Co-authored-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-03-01 15:58:27 +01:00
Hein Wessels
c4f88a9d6e drivers: dma: stm32: dmamux: abstact calls to dma drivers
Wrap calls to DMA drivers through fops to allow
different dmamuxes to point to different types of
dma with different function calls.

In preperation to add support for BDMA and DMAMUX2.

Co-authored-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-03-01 15:58:27 +01:00
Hein Wessels
e01270793e drivers: dma: stm32: bdma support for H7
Implement STM32H7 BDMA driver.

Co-authored-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-03-01 15:58:27 +01:00
Jay Vasanth
f8d9465332 pm: adc: MEC172x adc device PM support
update MEC172x adc driver to support device PM.
Implement pm resume and suspend actions to put adc
pins in proper state for suspend and resume.
Notify kernel of busy when adc sampling is in progress.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-03-01 08:41:16 -06:00
Nazar Palamar
bc638f38db drivers: gpio: Add Infineon CAT1 GPIO driver
Added initial version of Infineon CAT1 GPIO driver.
Added initial version of binding file for Infineon CAT1 GPIO driver.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-03-01 11:44:57 +01:00
Nazar Palamar
f956e81bb6 drivers: serial: Add Infineon CAT1 UART driver
Added initial version of Infineon CAT1 UART driver.
Added initial version of binding file for Infineon CAT1 UART driver.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-03-01 11:44:57 +01:00
Nazar Palamar
81822e0501 drivers: clock_control: Add Infineon CAT1 clock control driver
Add initial version of Infineon CAT1 clock control driver.
- supports clock initialization based on board DT configuration.

Added initial version of system_clocks.dtsi for Infineon PSoC 6 SOC.
Includes: clk_imo, path_mux0..4, fll0, pll0, clk_hf0..4, clk_fast,
clk_slow and clk_peri.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-03-01 11:44:57 +01:00
Nazar Palamar
dcf52fd566 drivers: pinctrl: Add Infineon CAT1 Pin controller driver
Added initial version of Infineon CAT1 Pin controller driver.
Added initial version of binding file for Infineon CAT1 Pinctrl driver.
Added initial version of dt header for Infineon CAT1 pinctrl driver.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-03-01 11:44:57 +01:00
Erwan Gouriou
8b4407ab7c drivers: clock_control: stm32: Implement F412 PLL I2S Support
Add PLLI2S support within clock_control driver.
This implementation is compatible with "st,stm32f412-plli2s-clock"
binding.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-03-01 08:56:05 +01:00
Erwan Gouriou
e04ff4c3db drivers: clock_control: stm32: Implement F4 PLL I2S Support
Add PLLI2S support within clock_control driver.
This implementation is compatible with "st,stm32f4-plli2s-clock"
binding.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-03-01 08:56:05 +01:00
Jeff Daly
bd1a8141e5 drivers: pwms: pwm_xec: add polarity support to XEC PWM driver.
Polarity support added to XEC PWM driver.  This allows (for example) PWM
controlled LEDs that are active low to actually be turned off when set
to off.

Signed-off-by: Jeff Daly <jeffd@silicom-usa.com>
2023-03-01 08:55:49 +01:00
Jamie McCrae
f9fd899da0 drivers: bbram: Add Microchip MCP7940N driver
Adds Microchip MCP7940N battery-backed RAM support.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-01 08:55:39 +01:00
Benedikt Schmidt
ecafade8ae drivers: gpio: add driver for PCAL6416A
Generalize the driver for PCAL6408A into a more abstract base
and reuse this abstraction to implement a driver for
PCAL6416A.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-02-28 20:09:19 -05:00
Benjamin Cabé
ca90bdacf3 drivers: sensor: th02: Handle unsupported channels
Fixed th02_channel_get() code to return -ENOTSUP when the channel is not
supported.
Fixes #55160.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-02-28 10:58:52 -06:00
Gerard Marull-Paretas
27b73a116f soc: arm: nordic_nrf: replace NRF_DT_CHECK_PIN_ASSIGNMENTS
Since PINCTRL and pinctrl-0 is now required, there's no point in doing
extra validation at driver level. Modify the macro to just check that
sleep state is present when needed, since it was the only remaining
assertion that was not covered. Renamed the macro to make it more clear
what it does: NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
1efaa94bc6 drivers: audio: dmic_nrfx_pdm: drop -pin support
Driver will always use pinctrl now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
708a00d587 drivers: flash: nrf_qspi_nor: drop -pin support
Driver will now use pinctrl only.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
401334446d drivers: sensor: qdec_nrfx: drop -pin support
QDEC driver will only use pinctrl now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
868c25de76 drivers: pwm: nrfx: drop -pin support
PWM driver will now use pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
a8efe38c43 drivers: i2s: nrfx: drop -pin support
Driver will now use pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
dea028a0da drivers: i2c: nrfx_twi/m: drop -pin support
TWI/M drivers will use pinctrl now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
55ac2f91f6 drivers: spi: nrfx_spi/s/m: drop -pin support
SPI/S/M drivers will only use pinctrl now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
aa9df1abc0 drivers: serial: nrfx_uart/e: drop -pin support
UART/E driver will only support using pinctrl now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Lucas Tamborrino
be577cfef0 drivers: i2c: esp32xx: Remove direct REG access
Remove direct register access and use hal functions instead.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-02-28 14:44:47 +01:00
Seppo Ingalsuo
8ef2cd20d9 Drivers: DAI: Intel: DMIC: Shorten unmute ramp time
This change produces more quickly in the stream valid
audio samples. The start fade-in ramp can be shortened to
100 ms for 48 kHz and 200 ms for 16 kHz. It was before 200 ms
and 400 ms. The updated DMIC hardware in allows to do this
change.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@intel.com>
2023-02-28 11:43:14 +01:00
Dawid Niedzwiecki
e734adfb78 subsys/mgmt/ec_host_cmd: update directory structure
The Host Commands can be used with different transport layers e.g. SHI
or eSPI. The code that provides the peripheral API and allows sending
and receiving Host Commands via different transport layers is not
actually drivers of a peripheral, so move it to the
subsys/mgmt/ec_host_cmd folder.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-02-28 10:42:23 +01:00
Sylvio Alves
d4ef6aa713 drivers: interrupt: add esp32s3 interrupt controller
Enables SoC specific interrupt controller.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-02-27 19:41:33 +01:00
Sylvio Alves
f1cc21a146 driver: uart: esp32s3: enable ESP32S3 uart interface
Includes additional SoC specific headers.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-02-27 19:41:33 +01:00
Sylvio Alves
da66cffd3a clock: esp32s3: add peripheral initialization
Update clock control source to enable proper
ESP32S3 clock init.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-02-27 19:41:33 +01:00
Julien D'Ascenzio
704ca8f1b4 drivers: timer: stm32_lptim: fix sys_clock_* return value
This commit finish to fix the bug describe by 85e2a0679a68f02f7ef.
With the previous correction, the uptime read could be in the past:
if the counter rewinds just after testing ARRM flag, we had lost
some counts.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2023-02-27 17:31:03 +01:00
Pieter De Gendt
a6ff01cc3d drivers: flash: spi: Move to using select in Kconfig for SPI bus
Move to using 'select SPI' instead of 'depends on SPI'
(see commit df81fef for more details)

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-02-27 14:35:15 +01:00
Benedikt Schmidt
fd44b2eb2d drivers: gpio: add driver for BD8LB600FS
Add a driver for BD8LB600FS

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-02-27 06:44:23 -05:00
Lucas Tamborrino
1eda399c44 drivers: gpio: esp32: fix reset interrupt status on new config
The interrupt status of the GPIO was not cleared when a new
interrupt configuration was set. This prevents the driver from
passsing all the gpio tests.

Fixes #54833

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-02-27 11:35:26 +01:00
Purdea Andrei
38f554ef4f drivers: gpio_rpi_pico.c: add support for single-ended IO
Note: RP2040 can support single-ended IO, by setting the GPIO_OUT
register to a constant value, and then changing the GPIO_OE register
instead, when the output has to change. To do this, the output-setting
functions need to know which pins have been configured as single-ended,
and for that reason the data structure has been extended to include
this information.

Another change is the PR, is that setting of the pull-ups/pull-downs
now applies to both inputs and outputs as well. Previous solution was
wrong, because if the user wanted to set up an input with a pull
resistor enabled, and then reconfigure it to an output without any
pulls, then the pulls remained in place for the output. Now pulls
are correctly set based on the gpio flags for outputs too, and this
is especially useful for single-ended outputs too.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-02-26 18:38:08 -05:00
Jordan Yates
b83cf1f1ee drivers: serial: uart_rtt: fix multi-channel
Populate the `channel` index when constructing configuration structs for
secondary RTT channels. Originally missed in #27704.

Fixes #54955.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-02-25 06:55:58 -05:00
Yuval Peress
ebfd9aaba5 sensor: Implement driver and tests for akm09918c
Add the implementation for the akm09918c magnetometer driver.
Additionally, add the appropriate node to the TDK robokit1 device
tree. In order to prevent regressions, add the sensor to the sensor
build_all tests and specific tests using an emulator.

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 17:00:14 -05:00
Jonathan Rico
f8e5e17246 drivers: led_strip: add WS2812 I2S-based driver
Add a driver implementation that uses the I2S peripheral.
Based off this blog post:
https://electronut.in/nrf52-i2s-ws2812/

Should help with #33505, #29877 and maybe #47780, as there is no garbage
data at the end of transmissions on nRF52832, and no gaps.

Signed-off-by: Jonathan Rico <jonathan@rico.live>
2023-02-24 10:12:47 -08:00
Grant Ramsay
f92dd6d357 drivers: serial: Name the NS16550 variant Kconfig choice
Naming this choice allows setting a default value in defconfig.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-02-24 18:11:56 +01:00
Yuval Peress
0e003cdbee test: verify accel/gyro data for icm42688
Verify the conversion of register values in both accel and gyro to
sensor_value for the icm42688.

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Yuval Peress
e6514d4dc9 icm42688: Add test for data read and temperature regisers
Add tests that verify the behavior of the REG_INT_STATUS, REG_TEMP_DATA1,
and REG_TEMP_DATA0 registers

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Yuval Peress
591958752a icm42688: fix configure call
The icm42688 introduced a safe configure function to make the
configuration more atomic, but the main driver was never updated
to call it so the new config values were discarded.

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Yuval Peress
a3f59fd86f icm42688: Fix temperature calculation
Fix the calculation which was adding the 25 degree offset too late.

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Yuval Peress
8ac822e69c emul: Cleanup emul directory
Avoid implementations in the subsys emul directory to keep the directory
focused on emulator subsystem instead of consumers. Consumers should be
implemented side-by-side to their drivers

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Yuval Peress
a6326f1f7f bmi160: move emulator to driver directory
Allow the emulator to sit in the same directory as the driver
implementation. This will make working on the emulator much easier and
keep the emulator subsystem directory clean by allowing it to focus on
the actual subsystem and not the use cases of the subsystem.

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Yuval Peress
2bb4de9a0b emul: Add emulator for icm426888
Add an implementation for the icm42688 emulator that supports reading
any registers.

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Maciej Baczmanski
01884c857a drivers: ieee802154: nrf5: added continuous_carrier API call
implemented `nrf5_continuous_carrier()` which starts continuous
carrier wave transmission

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2023-02-24 09:26:01 +01:00
Francois Ramu
9363a9319e drivers: flash: stm32 qspi Enter 4-Byte Address Mode
No need to read back the CR (NOR flash config or control register)
to check if entering the 4-Byte Address Mode is effective.
The action of this command is immediate and the result
(bit field of the CR) is NOR flash vendor-specific.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-02-24 09:13:44 +01:00
Gerard Marull-Paretas
a1e983fef0 drivers: pinmux: drop driver class
Pinctrl is the new pinmux.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
f436aeb12c drivers: spi: xec_qmspi: remove unused pinmux.h include
Driver did not use pinmux API.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
d76f4f2c8a drivers: pinmux: mchp_xec: drop driver
Drop Microchip XEC driver in favor of pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
9ca624eb13 drivers: pinmux: mcux: drop driver
Drop the MCUX driver in favor of Kinetis pinctrl driver.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
099012a59f drivers: pinmux: lpc11u6x: drop driver
Drop LPC11U6X pinmux driver in favor of pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
33372b9e48 drivers: pinmux: mcux_lpc: drop driver
Drop MCUX LPC pinmux driver in favor of pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
d925c660ed drivers: pinmux: stm32: drop driver
Drop STM32 pinmux driver in favor of pinctrl. Some definitions located
in pinmux headers were used by the pinctrl driver, so they have been
moved there.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
f1539b48cf drivers: pinmux: rv32m1: drop driver
Drop RV32M1 pinmux driver in favor of pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Andrei Emeltchenko
8e84d840b5 usb: Fix build for 64 bit platforms
Use proper format for size_t type eliminating warnings of type:

...
error: format '%u' expects argument of type 'unsigned int', but
argument 2 has type 'size_t' {aka 'long unsigned int'}
[-Werror=format=]
...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-02-23 17:51:31 +01:00
Andrei Emeltchenko
ddf9854bfb usb: udc_virtual: Adapt to updated API
Commit 00adb2a539 ("drivers: udc: remove no more required pending
state flag") removed state parameter from udc_buf_peek and udc_buf_get.
Adapt udc virtual driver so the code compiles.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-02-23 17:51:31 +01:00
Petr Hlineny
94847be172 drivers/disk: sdmmc stm32: Enable SDMMC Internal DMA on STM32L4plus mcu
STM32L4plus mcu has SDMMC internal DMA which works without any
configuration and it's handled by SDMMC HAL driver. This commit adds
option to enable it and use it.

Signed-off-by: Petr Hlineny <development@hlineny.cz>
2023-02-23 10:48:50 +01:00
Goh Shun Jing
9ecfa4decc drivers: serial: uart_altera: add driver
Add driver for altera avalon uart core.

Signed-off-by: Goh Shun Jing <shun.jing.goh@intel.com>
2023-02-23 09:26:33 +01:00
Petr Sharshavin
f5ae6ccfa8 drivers: lora: fix busy after sx12xx_lora_test_cw
The LoRa modem has been staying in STATE_BUSY
after sx12xx_lora_test_cw() call
because Radio.SetTxContinuousWave() doesn't configure the PHY
to raise 'TX done' event.

It runs TxTimeoutTimer instead,
so we have to handle 'TX timeout' event to correctly release the modem.

This fix has been tested on custom board with STM32L4 and SX1276.

Signed-off-by: Petr Sharshavin <sharshavin@mail.ru>
2023-02-23 09:25:39 +01:00
Garrett Battaglia
65e3f5b23d drivers: sensor: add MAX31855
add MAX31855 cold-junction compensated thermocouple-to-digital
converter sensor driver and sample

Signed-off-by: Garrett Battaglia <garrett@garrettbattaglia.com>
2023-02-23 09:06:28 +01:00
Henrik Brix Andersen
eb9bbf4490 drivers: can: sja1000: move public header file to public include path
Move the can_sja1000.h header file to the public
include/zephyr/drivers/can/ include path. This allows writing out-of-tree
SJA1000 based driver front-ends.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-02-23 09:00:34 +01:00
Henrik Brix Andersen
36bffb20ae drivers: can: move CAN utility function to public header
Rename the can_utils_filter_match() utility function to
can_frame_matches_filter(), move it to the public
include/zephyr/drivers/can.h header file, and add a missing mismatch for
standard (11-bit) ID frames passing extended (29-bit) filters.

This allows using the utility function in out-of-tree CAN drivers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-02-23 09:00:12 +01:00
Tim Lin
00e6c19ab5 ITE: drivers/adc: Add config of ADC reference voltage full-scale 3300mV
This option can enable ADC internal reference voltage as
full-scale 3300mV.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-02-23 08:59:54 +01:00
Alexander Wachter
244f623f8c drivers: gpio: emul: replace mutex with spinlock
Replace all mutex with spinlocks to make the driver usable
from ISRs.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2023-02-22 21:48:30 +01:00
Mulin Chao
809e63a91a driver: uart: npcx: add missing tx/rx interrupt enabled checks
When checking if any UART TX/RX IRQs are pending, the driver should also
consider whether these IRQs are enabled. Or we still get pending status
set even if the related interrupts are disabled.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-02-22 16:30:08 +01:00
Mulin Chao
dbc614ee10 driver: uart: npcx: avoid concurrency writing UFTCTL register
In order to avoid concurrency situation during writing UFTCTL register,
this CL adds critical sections to prevent the unexpected result if the
driver wants to set/clear bits of this register.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-02-22 16:30:08 +01:00
Logiase Song
4b135fe911 drivers: clock_control: stm32: fix error pll freq calculation
The origin pll freq calculation leads to an uint32_t overflow

Signed-off-by: Logiase Song <logiase.syx@gmail.com>
2023-02-22 15:39:54 +01:00
Krishna T
186fbc33a2 drivers: ieee802154: Fix build error for variable net buffers
The assert is only applicable for fixed network buffers, so, add a
protection.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2023-02-22 12:18:24 +01:00
Cyril Fougeray
f43292a01a adc: stm32: stop ADC before disabling it
It is advised to stop any ongoing ADC conversion before
disabling the peripheral.
Added some comments so that ADC state isn't left into
intermediate state that would prevent correctly
enabling or disabling the peripheral

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-02-22 12:05:32 +01:00
Jonathan Rico
894275c098 Bluetooth: HCI: Make driver stack sizes configurable
This is necessary to prevent stack overflows when building with
non-standard configurations (e.g. CONFIG_DEBUG).

Adding them as hidden kconfig options to avoid the stuck kconfig syndrome.
Users are free to redefine them in their app to force a value.

The userchan.c driver is only built for posix, and the help text for
ARCH_POSIX_RECOMMENDED_STACK_SIZE states that the real stack comes from
somewhere else (the pthread stack), hence why it doesn't use the new
kconfig options.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-22 11:58:15 +01:00
Fabio Baltieri
8c6137d7a7 build: sort and compact drivers and subsys CMakeLists and Kconfig
There are just list of child files to include, right now there's a hint
of that trying to be alphabetical but then entries have been added with
various logic, so one has to figure where stuff has to be added.

Rewrite these to:
- keep the list alphabetical, for CMakeLists unconditional first,
  conditional after so one just has to select and sort
- drop the spaces in the Kconfig
- use a single space between  target and directory
- rename from "Sub Systems" to "Subsystems" (single word)

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-02-22 10:25:11 +01:00
Aaron Massey
6cdef0894f drivers: fuel_gauge: kernel drivers use syscalls
The fuel gauge API doesn't make use of syscalls with device drivers, which
is not congruent with Zephyr's security model.

Correct the fuel gauge API to only allow access to fuel gauge device
drivers functionality via syscalls to keep with Zephyr's security model.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-02-22 08:51:55 +01:00
Aaron Massey
7d83bf7d54 drivers: fuel_gauge: Rename API struct
Fuel gauge API struct type is currently named battery_driver_api, this is
inaccurate as the API struct represents functions for interacting with fuel
gauge drivers in particular.

Rename the API struct type to fuel_gauge_driver_api to clearly signal its
functionality.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-02-22 08:51:55 +01:00
Tom Burdick
2ae6b7bd75 sensor: icm42688 configuration and regmap fixes
The int config and fifo config register addresses were wrong, fix those.

Adds lots of debug information (when LOG_DBG=y) to the configuration of the
device which is incredibly helpful for diagnosing configuration issues.

Disables the device interrupts while reconfiguring. Adds a safely
reconfigure function which will rollback to previous configuration
on misconfiguration.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-02-22 08:51:30 +01:00
Nicolas Pitre
11a2107d99 riscv: timer: driver revamp
Several issues:

- `last_count` should not be updated with current time or this will
  cause a time drift and induce jitter due to IRQ servicing latency.

- `sys_clock_set_timeout()` should not base its `mtime` on the current
  time either. Tracking the `last_tick` and `last_elapsed` values avoids
  the need for all the tick rounding computation.

- The MIN_DELAY thing is pointless. If the delay gets close or even behind
  current time then the IRQ will be triggered right away. This is unlikely
  to happen very often anyway so the constant overhead is uncalled for.

- Runtime 64-bits divisions on 32-bits hardware are very expensive.

Fix the above, and improve the following:

- Prime the accounting by simply invoking the IRQ handler from the init
  code. That will make the "ticks since boot" counter right.

- Remove excessive casts, especially a few wrong ones.

- Simplify the code overall.

Here's the output from the timer_jitter_drift test.

Before this patch:

|timer clock rate 60000000, kernel tick rate 10000
|period duration statistics for 10000 samples (0 rollovers):
|  expected: 1000 us,            60000.000000 cycles
|  min:      907.600000 us,      54456 cycles
|  max:      1099.750000 us,     65985 cycles
|  mean:     1008.594633 us,     60515.678000 cycles
|  variance: 2.184205 us,        7863.136316 cycles
|  stddev:   1.477906 us,        88.674332 cycles
|timer start cycle 995589, end cycle 606152369,
|total time 10085946.333333 us, expected time 10000000.000000 us,
|expected time drift 0.000000 us, difference 85946.333333 us

After this patch:

|timer clock rate 60000000, kernel tick rate 10000
|period duration statistics for 10000 samples (0 rollovers):
|  expected: 1000 us,            60000.000000 cycles
|  min:      992.116667 us,      59527 cycles
|  max:      1030.366667 us,     61822 cycles
|  mean:     1000.001902 us,     60000.114100 cycles
|  variance: 0.105334 us,        379.201081 cycles
|  stddev:   0.324551 us,        19.473087 cycles
|timer start cycle 987431, end cycle 600988572,
|total time 10000019.016667 us, expected time 10000000.000000 us,
|expected time drift 0.000000 us, difference 19.016667 us

The mean, variance and standard deviation number differences speak for
themselves, even in the absence of competing ISRs and/or IRQ-disabled
periods which would have made the comparison even worse.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-02-21 18:04:55 -05:00
Bartosz Bilas
2b4a6e52d5 drivers: i2c: eeprom_target: switch to dedicated driver compatible
Create and use a new `zephyr,i2c-target-eeprom` compatible
within I2C  eeprom target driver that allows to use
that driver along with real atmel at24 EEPROM simultaneously.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2023-02-21 18:03:11 -05:00
Andriy Gelman
4e13e6ada7 drivers: serial: xmc4xxx: Fix Kconfig help entry
The configurations are no longer hard coded for UART_0.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-21 21:15:53 +01:00
Andriy Gelman
30b11260be drivers: uart_xmc4xxx: Add async support
Adds async uart for xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-21 21:15:53 +01:00
Andriy Gelman
cfeaada65e drivers: uart_xmc4xxx: Change order of functions
This patch is in preparation of uart async support. There are no
functional changes. The patch changes the ordering of functions to
organize shared functions between async/interrupt driven in the same order.
Also move uart_xmc4xxx_init() so that a forward declaration can be
removed.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-21 21:15:53 +01:00
Andriy Gelman
3dac715569 drivers: uart_xmc4xxx: Split up tx/rx into separate service requests
In preparation for async support. In async uart, service requests are
forwarded to separate dma lines. This patch splits up tx/rx into
separate service requests to enable this.

Also put service request enable code into a separate function. Before,
the same code was generated for different uart devices.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-21 21:15:53 +01:00
Andriy Gelman
8a97da056b drivers: dma: Add infineon xmc4xxx dma support
Adds dma drivers for xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-21 21:15:53 +01:00
Marcin Niestroj
2087579d8e drivers: wifi: esp_at: support WiFi 'iface_status' callback
This allows to fetch information about currently connected WiFi network,
e.g. with WiFi mgmt shell commands:

  uart:~$ wifi status
  Status: successful
  ==================
  State: COMPLETED
  Interface Mode: STATION
  Link Mode: UNKNOWN
  SSID: Tp-Link
  BSSID: xx:xx:xx:xx:xx:xx
  Band: 2.4GHz
  Channel: 13
  Security: UNKNOWN
  MFP: UNKNOWN
  RSSI: -39

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-02-21 18:09:40 +01:00
Marcin Niestroj
650b244215 drivers: wifi: esp_at: fetch version of ESP-AT firmware
For development and debugging purposes it is good to know what is the
version of ESP-AT firmware used on modem. This can be fetched with AT+GMR
command.

Fetch this information during driver init and log all available version
strings, so they look like that:

  wifi_esp_at: AT version: 2.1.0.0(883f7f2 - Jul 24 2020 11:50:07)
  wifi_esp_at: SDK version: v4.0.1-193-ge7ac221
  wifi_esp_at: compile time: (0ad6331):Jul 28 2020 02:47:21
  wifi_esp_at: Bin version: 2.1.0(WROOM-32)

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-02-21 15:04:08 +01:00
Andrzej Głąbek
68bd036947 drivers: entropy_nrf5: Eliminate direct use of WFE instructions
Use the appropriate kernel function, i.e. `k_cpu_atomic_idle()`,
instead of directly executing the WFE instruction.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-02-21 15:02:54 +01:00
Fabio Baltieri
d4c8de514f drivers: net: initialize logging for the slip module
This fixes a regression introduced in:

16a0e314ea drivers: net: Move Ethernet device definition for SLIP to
	   ethernet

Where the module would fail to build with:

log_core.h:153:20: error: '__log_level' undeclared (first use in this
function)

Registering a module fixes the build.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-02-20 16:44:23 +01:00
TOKITA Hiroshi
0324a2fb24 drivers: display ssd1306: Remove referencing to cfb.h
It is undesirable referencing to cfb.h because it form
reverse dependency from the driver layer to the subsystem layer.
Including drivers/display.h can solves all references in this file,
so replace it with this.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-02-20 16:29:25 +01:00
Khor Swee Aun
c93c853cba drivers: timer: Machine timer driver enablement for NIOSV
Update machine timer drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on NIOSV devicetree.

Signed-off-by: Khor Swee Aun <swee.aun.khor@intel.com>
2023-02-20 09:29:13 -05:00
Gerard Marull-Paretas
86a0f80c57 drivers: usb: udc: nrf: fix declaration after label
C language does not allow declarations after labels, only statements are
allowed. Add {} around the `NRFX_USBD_EVT_SETUP` case to fix build
issues (`error: a label can only be part of a statement and a
declaration is not a statement`)

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-20 13:22:02 +01:00
Adrian Warecki
9af2789cad watchdog: dw: Fixed interrupt configuration
An invalid macro name was used to check whether the watchdog device has
configured interrupts. As a result, the interrupt were never configured.
This issue has been fixed.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-02-20 06:53:06 -05:00
Armin Brauns
b2c75f423a drivers: disk: sdmmc_stm32: handle DMA errors instead of ignoring them
One was clearly a typo, the other should also be handled properly.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-02-20 12:40:45 +01:00
Emil Gydesen
ab6a26ab17 flash: flash_shell: Fix check_arr size
The check_arr used the TEST_ARR_SIZE value for the size, but
has been removed and replaced with CONFIG_FLASH_SHELL_BUFFER_SIZE.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-20 19:41:17 +09:00
Andriy Gelman
0079cabb49 drivers: sensor: Add infineon xmc4xxx die temperature sensor
Adds die temperature driver for infineon xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-20 11:14:15 +01:00
Adrian Bonislawski
1243fa7f2d drivers: counter: align ace rtc get_value with api
This will align ace rtc get_value parameter with counter api
and fix build warning

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2023-02-20 11:13:45 +01:00
Adrian Bonislawski
c1b216d3bf drivers: counter: return status in ace rtc counter
This will align return value with counter API and fix build warning

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2023-02-20 11:13:45 +01:00
Adrian Bonislawski
9952576945 drivers: counter: fix ace counters build errors
This will fix includes and allow to successfully build ace counters

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2023-02-20 11:13:45 +01:00
Dominik Ermel
a33186a8f9 drivers: flash: spi_nor: Return EINVAL when erase out of range
Fixes spi_nor_erase to return -EINVAL instead of -ENODEV
when erase requested is out of flash range.
This makes the SPI NOR return the same error as all other errors.

Fixes #54897

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-20 10:54:00 +01:00
Robert Lubos
16a0e314ea drivers: net: Move Ethernet device definition for SLIP to ethernet
Currently, if CONFIG_SLIP_TAP is enabled (default for QEMU), and no
other Ethernet driver is enabled, the following warning is printed by
CMake:
    No SOURCES given to Zephyr library: drivers__ethernet

This happens because SLIP_TAP enabled Ethernet L2, but has no actual
sources in drivers/ethernet. This commit fixes this, by moving the
actual definition of the SLIP TAP Ethernet interface into a separate
file, within drivers/ethernet. Technically, in that configuration SLIP
defines a Ethernet device, implementing Ethernet API, so such a change
is justifiable, and prevents unwanted warning from being generated.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-02-20 10:52:20 +01:00
Ryan Erickson
75926dacb3 modem: hl7800: Fix DNS resolver for all address families
Fix DNS resolver config for IPv6 only setup.
Check validity of the DNS addresses before trying to
configure the resolver.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-20 09:51:38 +01:00
Tim Lin
6ae75b6d00 ITE: drivers/i2c: Mutex issue in I2C transfer
These global variables should be under the mutex lock, otherwise they
will be overwritten by other transfers.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-02-20 09:50:36 +01:00
Ryan Erickson
dd195d6ea5 modem: hl7800: fix power off
Ensure DNS resolver is stopped if modem is turned off.
All IO connected to the HL7800 need to be de-asserted
in order for the HL7800 to power off.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-20 09:49:43 +01:00
Hein Wessels
e2c9d30578 drivers: flash: shell: default test repeat parameter when not supplied
Previously when the repeat argument wasn't supplied to the shell
command it would falsely seem to succeed, even though the
test was never run. Instead of displaying an error message this
rather overrides the repeat to 1, so that the test is run once.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-02-20 09:49:22 +01:00
Hein Wessels
636a1615b3 drivers: flash: shell: add verify step to cmd_test
Previously cmd_test could falsely give the indication that the
flash driver is functioning properly, because the written data
isn't validated and could have silently failed.

This commit adds a verify step to ensure the data was written successfully.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-02-20 09:49:22 +01:00
Peter Mitsis
5760523091 drivers: mm: Use mm_drv_bank module
Updates the meteor-lake TLB MM driver to use the memory bank module
to track page usage statistics.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-02-20 09:48:44 +01:00
Peter Mitsis
87899c07f7 drivers: mm: Add module for tracking page usage
Adds a module for tracking page usage within a memory bank.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-02-20 09:48:44 +01:00
Jamie McCrae
3c9d529899 flash: flash_shell: Add flash read/write/erase speed test commands
Adds commands which can be used for timing flash device tasks and
outputting a rough speed.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-02-20 09:48:24 +01:00
Jun Lin
2e961102c1 driver: Port80: npcx: defer Port80 code sending to workqueue thread
If the host sends Port80 postcodes frequently while EC is busy handling
other tasks, the Port80 FIFO (16-byte depth) might overflow easily,
especially when the host sends the postcode with the 4-byte format.
This change defers the handling and sending (to the upper layer)
postcodes to the system workqueue thread. It can reduce a lot of
(but not all) the overflow case. Also in practice, we usually care
about the latest postcodes. The older codes are not significant to the
developer. This commit also lowers the printing of the overflow warning
to LOG_DEBUG.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-02-20 09:43:20 +01:00
Ruibin Chang
e3b57c392c ITE drivers/pinctrl/it8xxx2: add default mode function
Add default mode function for pin control.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2023-02-19 21:00:14 -05:00
Zachary J. Fields
c29dcb3a98 cortex-m: warnings: Address -Wextra warnings
`#defines` do NOT sepecify a type. They will either adopt a native
system type or type of the value that was passed into the expression.
This can lead to warnings such as, "warning: comparison of integer
expressions of different signedness: 'uint32_t' {aka 'unsigned int'}
and 'int' [-Wsign-compare]".

By casting expressions, such as `MAX_TICKS` to `k_ticks_t`, we can
force the appropriate types and resolve these warnings.

Signed-off-by: Zachary J. Fields <zachary_fields@yahoo.com>
2023-02-19 20:58:44 -05:00
Muhammed Ahmed
3f0fc7fe6b drivers: serial: Add PM support for UART MCUX
Adding PM support to uart_mcux by gating clock and disabling transmitter

Signed-off-by: Muhammed Ahmed <muhammed.ahmed@intel.com>
2023-02-19 20:56:16 -05:00
Giuliano Franchetto
67767df8c0 drivers: iis2dlpc: adding activity interrupt
This commit adds the activity/inactivity recognition as well as the
stationary/motion detection as defined in the IIS2DLPC application
note.

For now, there is no possibility to configure this interrupt using
device tree binding, as I would like to keep the configuration updatable
and not set at boot time. This behaviour is fine for prototypes and
samples, but is too restrictive on products that may want to change the
interrupt configuration at run-time.

The interrupt is configured using the attributes SENSOR_ATTR_SLOPE_TH and
SENSOR_ATTR_SLOPE_DUR.

Signed-off-by: Giuliano Franchetto <giuliano.franchetto@intellinium.com>
2023-02-19 20:55:09 -05:00
Michal morsisko
2e4d8761be drivers: sensor: Add support for BH1750 ambient light sensor
This commit adds support for BH1750 ambient light sensor.
The driver works using I2C peripheral in one-time mode.

Signed-off-by: Michal morsisko <morsisko@gmail.com>
2023-02-19 20:44:34 -05:00
Jaska Uimonen
26e4da9511 drivers: dai: intel: ssp: add aux data support
Intel SSP configuration can have auxiliary data embedded after it in a
variable length tlv array. Enable the parsing of this data and add the
data structs to describe the contents.

For now add support only for new version 1.5 blob. This is because
legacy blob doesn't have size field to describe its variable size.
Auxiliary data parsing has currently only 1 setting for link clock
needed in ACE platforms.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2023-02-19 20:43:34 -05:00
Jaska Uimonen
c64f91de1a drivers: dai: intel: ssp: add blob 1.5 support
Add support for newer data blob version 1.5. Refactor the code to re-use
the common register setting. Clock setting will be handled differently
with legacy and version 1.5 blob.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2023-02-19 20:43:34 -05:00
Jaska Uimonen
3b7f9c320d drivers: dai: modify dai_config_get API func
Modify dai_config_get function to have the config struct as argument.
This was not a showstopper but a request in the API review.

In the same patch modify all Intel dai drivers using the API to preserve
bisect/compile.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2023-02-19 20:43:14 -05:00
Adrian Warecki
f230a887da drivers: watchdog: Add a new driver for Synopsys DesignWare watchdog
This commit adds a base version of the driver for Synopsys DesignWare
watchdog.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-02-19 20:42:52 -05:00
Rajavardhan Gundi
09d8123d0a drivers: sbs_gauge: Add support for additional properties
Fuel Gauge mode, status, charge current, charge voltage, design
capacity and design voltage are added.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2023-02-19 20:42:10 -05:00
Zhang Lixu
b67e33fc50 sensor: bmi160: fix the issue of missing gpio cfg for i2c
Add BMI160_TRIGGER_CFG in bmi160_cfg for i2c instance when
trigger mode enabled.

Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
2023-02-19 20:41:56 -05:00
Zhang Lixu
21436b27bf sensor: bmi160: fix the issue with interrupt status
When enabling trigger mode of bmi160 on i2c bus, I've come across
an issue where the readings register STATUS. The issue comes from
the dummy byte in the beginning of the buf.raw which is not necessary.
In addition, for bmi160 on spi bus, the dummy byte has already been
handled in bmi160_transceive while reading register.
So the dummy byte should be removed.

Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
2023-02-19 20:41:56 -05:00
Jay Vasanth
f3714825ad drivers: pwm: Add Microchip XEC BBLED PWM driver
The Microchip XEC (MEC172x and MEC152x) have a breathing-blinking
LED (BBLED) block which implements a simple PWM mode. The BBLED
PWM frequencies are 32KHz and 48MHz selectable in device tree.
Frequency divider is 12-bit resolution from 256 to (256 * 4096).

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-02-19 20:40:22 -05:00
Jay Vasanth
c504e1e5cd drivers: dma: Add Microchip XEC DMA driver
The Microchip XEC family of microcontrollers includes a
simple DMA block implementing multiple channels. DMA supports
memory to memory, memory to peripheral, and peripheral to
memory transfers. Peripheral support is limited by each
chip to I2C and SPI controllers. DMA hardware does not support
scatter-gather or linked transactions.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-02-19 20:38:21 -05:00
Kai Vehmanen
0c0d73721e dma: dw: allow to stop in DW_DMA_SUSPENDED state
Allow DMA channel to be stopped even if it is in suspended state.
The current code in dw_dma_stop() supports this, but the recently
added early check for dw_dma_is_enabled() results in DMA stop
sequence to be skipped if the channel was in suspended state.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-02-19 20:37:26 -05:00
Kai Vehmanen
6422b2b094 dma: dw: fix include for chan_data
The conditional definitions are not correct as "chan_data"
is used without any include guards, but defined only if
CONFIG_DMA_DW_HW_LLI or CONFIG_DMA_DW_SUSPEND_DRAIN is defined.
Correct the declaration to match usage.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-02-19 20:37:26 -05:00
Andrzej Głąbek
31c11a5dc0 drivers: nrf_rtc_timer: Fix handling of COMPARE events in set_alarm()
This is a follow-up to commits cf871aec64
and 205e684958.

It turns out that the current implementation of the nrf_rtc_timer may
still fail to properly handle a timeout if that timeout is set in very
specific conditions - when a previously set timeout is about to expire.
When that happens, the new timeout is handled 512 seconds later (when
the system timer overflows) than it should be.

A recently added nrf_rtc_timer test case (test_tight_rescheduling)
exposes this problem and this commit fixes it by adding examination
of COMPARE events that appear during setting of the CC register value
for a given timeout.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-02-14 08:28:28 +01:00
Andrzej Głąbek
d6ba49e298 drivers: nrf_rtc_timer: Rename set_absolute_alarm() to set_alarm()
This function name is misleading as the absolute time values handled
by the driver are 64-bit and this function receives a 32-bit parameter,
which is supposed to be a CC register value, not the target time.
Correct the name of this function and its parameter, and remove a now
unnecessary masking from its body.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-02-14 08:28:28 +01:00
Purdea Andrei
158ee9139c drivers: usb_dc_rpi_pico: cleanup incorrect comment and condition
I believe this comment and condition may have found its way into the
rp2040 driver from other drivers where it makes more sense. For
example for the stm32 driver performing a read on the EP0_IN endpoint
turns it silently into a read on the EP0_OUT endpoint. As far as I can
tell, this really was only used to consume 0-length Status-Stages of
to_host control transfer in the other drivers.

Note that usb_dc_ep_start_read() is never called in an IN endpoint
in the rp2040 driver, and furthermore, even if it would have been
called like that, the current implementation would not do the silent
change into actually performing a read on the EP0_OUT endpoint instead,
so the condition and comment is just wrong.

Note that 0-length Status-Stage of to_host control transfers is
currently consumed in this driver by usb_dc_ep_read_continue().

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-02-11 08:23:03 +09:00
Dino Li
e442a15c32 gpio/it8xxx2: do not set flag if register does not exist
Since not all GPIOs support voltage selection, voltage flag
is only set if voltage selection register is present.

fixes: #54366

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-02-11 08:20:40 +09:00
Purdea Andrei
4fcbba2fb1 drivers: usb_dc_rpi_pico: fix toggle data1/0 on to_device control transfers
The data stage of Control transfers that are sent from Host to Device, can
be made out of multiple OUT transactions, if the amount of data to be
transmitted is larger than the endpoint size. When this happens, the DATA
pid should be toggling. The USB Device driver of the pico must correctly
prime the EP0_OUT buffer with the correct data PID, otherwise the hardware
will reject the received transaction.

Before this change the driver used to always prime EP0_OUT with a DATA1
pid.
After this change the driver only uses DATA1 pid after a setup transaction,
and then toggles the pid for each transaction.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-02-11 08:00:43 +09:00
Francois Ramu
4de473e4c9 drivers: dma for stm32u5 returns from a repeated start or stop command
On a repeated dma_start, the stm3u5 dma driver should return
immediately if it is already started.
On a repeated dma_stop, the stm3u5 dma driver should return
immediately if it is already stopped.
This like the dma driver does for other stm32 series.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-02-11 07:57:44 +09:00
Andrei Emeltchenko
9c1076e7f7 drivers: ieee802154_rf2xx: Remove magic number
Define and use RF2XX_TRAC_STATUS instead of magic number.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-02-10 18:13:48 +01:00
Andrei Emeltchenko
72c5bc3ae2 drivers: ieee802154_rf2xx: Correct bit mask
Correct bit mask for RF2XX_RX_TRAC_BIT_MASK. Current mask produce dead
code warnings when comparing to value:

RF2XX_TRX_PHY_STATE_TRAC_INVALID = 0x07

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-02-10 18:13:48 +01:00
Siyuan Cheng
1a5676d338 ARC: boards: hsdk: fix cy8c95xx I2C GPIO port init
cy8c95xx I2C GPIO support was broken in commit 4b30008 due
to wrong i2c bus and addr were wrote during GPIO_PORT_INIT.
Now fix this issue.

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-02-10 10:19:19 +01:00
Ramon Aerne
a5e04ccd4a drivers: serial: rp2040: fix rpi pico address mapping
Address map used for config item `uart_dev` and `uart_regs` is
currently derived using the rpi hal macros `uart0` and `uart1`
which map to the same register address as given in the `reg` property
of the devicetree.

However, the sdk macro is generated using `uart##idx` which zephyr does
not necessarily map to uart0 or uart1.
This is, for example, the case when disabling uart0 with the devicetree
status "disabled"
and enabling uart1 for which then the idx==0 and not 1 which therefore
maps to the wrong controller address space.

This can simply be fixed by deriving the base address from
`DT_INST_REG_ADDR(idx)` instead

Signed-off-by: Ramon Aerne <ramon.aerne@axelera.ai>
2023-02-09 23:40:38 +01:00
Björn Stenberg
dcbc56cfe7 ethernet: stm32h7: Move DMA buffers from sram3 to sram2
PR #30403 implemented nocache regions for ethernet DMA buffers in sram3 to
fix issue #29915. Unfortunately, some STM32H7 variants do not have any
sram3 so they still suffer from #29915.

All H7 variants have sram2 though, so use that for targets without sram3.

Signed-off-by: Björn Stenberg <bjorn@haxx.se>
2023-02-09 22:14:07 +09:00
Marc Desvaux
7851c3c26b drivers: ethernet: eth_stm32_hal.c ETH_MAC_config issue
ETH MAC config for STM32H7X and STM32_HAL_API_V2
too late and fails #54409
call HAL_ETH_SetMACConfig before HAL_ETH_Start_IT()
check the return of HAL_ETH_SetMACConfig()

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-02-09 13:18:21 +01:00
Francois Ramu
df4fa7088d drivers: timer: stm32u5 lptimer waits for DIER complete
On the stm32U5, when modifying the DIER register of the LPTIM peripheral,
a new write operation to can only be performed when the previous write
operation is completed and before going-on.
This is done with a function call for better readability.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-02-09 13:17:03 +01:00
Francois Ramu
7dff172519 drivers: serial: stm32 uart driver avoid LOG_WRN when going to sleep
When the LOG_WRN is used on stm32 uart driver it could block
execution : when pin state for sleep mode is not defined by the DTS
even if no error is raised, LOG_ msg is crashing when entering sleep mode.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-02-09 13:14:46 +01:00
Guillaume Gautier
60fc300195 drivers: counter: Do not keep RTC value between resets on STM32
This commit changes the ability to keep the RTC value between resets, and
turns it off by default.
Though this feature makes sense for an RTC counting the time and date,
here it is used as a counter. As such the registers used for coutning
should be reset after each MCU reset.

This change puts back in place the previous behavior before the Kconfig
CONFIG_COUNTER_RTC_STM32_BACKUP_DOMAIN_RESET was removed.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-02-08 12:10:34 +01:00
Armin Brauns
a0026d1589 drivers: ethernet: stm32: fix multicast filter configuration
With CONFIG_ETH_STM32_MULTICAST_FILTER=n, MACFFR was being set to 0 instead
of ETH_MULTICASTFRAMESFILTER_NONE, blocking all multicast traffic.

Instead, reset all the relevant bits first, then set either
ETH_MULTICASTFRAMESFILTER_HASHTABLE or ETH_MULTICASTFRAMESFILTER_NONE
depending on Kconfig.

This issue was introduced in #53850, `git diff a5f9fc2~2 a5f9fc2` (the
total diff of that PR) shows what happened - the
`tmp |= ETH_MULTICASTFRAMESFILTER_NONE;` line was removed completely
instead of being gated by `!defined(CONFIG_ETH_STM32_MULTICAST_FILTER)`.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-02-08 11:24:02 +01:00
Maciej Zagrabski
7ca8accdc6 drivers: flash: fix uninitialised layout_size
Requesting page layout triggers filling bank array
only once, and returns pre-filled array on consequential calls.
But ignores array size.

Remember size of this array as well.

Fixes #54563

Signed-off-by: Maciej Zagrabski <mzi@trackunit.com>
2023-02-08 19:01:32 +09:00
Declan Snyder
0744e42e22 drivers: disk: Decouple SDMMC and MMC Kconfigs
MMC was using SDMMC kconfigs to build disk driver.
This is incorrect, MMC and SDMMC should not be sharing
Kconfigs. Split the drivers/disk/Kconfig.sdmmc into
drivers/disk/Kconfig.mmc and drivers/disk/Kconfig.sdmmc.

Also update disk tests to account for new MMC Kconfigs.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-02-08 10:18:13 +01:00
Tom Burdick
86af9bcce1 spi: SAM add spin lock around all tx/rx/txrx funcs
The fast tx/rx/txrx functions will leave the SPI bus in an
inoperable state if interrupted, potentially spinning forever waiting on
some data. Wrapping these operations in what amounts to a critical section
using spin locks to avoid the issue.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-02-08 01:08:59 +09:00
Daniel DeGrasse
f7d9ea889b drivers: adc: support side B channels in LPADC driver
Add support for side B channels in MCUX LPADC driver. Given
that no instances of the IP block have more than 8 a side channels,
use channel numbers over 8 to indicate side B channel is desired.

Fixes #51076

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-02-08 01:08:08 +09:00
Ryan Erickson
bec12a098d modem: hl7800: fix low power mode
PSM hibernate mode would draw excessive current
because the UART would be enabled if CTS went low.
In hibernate mode, do not use CTS to power on the UART.

Fix reading of input pin states for low power by reading
the raw value.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-07 00:25:53 -08:00
Ryan Erickson
8aeb821a4e modem: hl7800: emit event on band change
Ensure an event is triggered any time the LTE bands change.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-07 00:25:53 -08:00
Ryan Erickson
6e58ba5dd8 modem: hl7800: Improve set bands API
Change the API to not block waiting for a reboot.
Reboot asynchronously.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-07 00:25:53 -08:00
Ryan Erickson
57b52adc15 modem: hl7800: Improve RAT API
Change the API to not block waiting for a reboot.
Reboot asynchronously.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-07 00:25:53 -08:00
Ryan Erickson
fe76aa0959 modem: hl7800: Fix event lock
Change event callback lock to a semaphore to avoid
priority issues the mutexes can cause.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-07 00:25:53 -08:00
Purdea Andrei
9a7f9ec0ba drivers: usb_dc_rpi_pico: avoid infinite unhandled irq retriggers
This driver enables a number of interrupts it does not attempt to handle.
This results in "unhandled IRQ: 0x...." messages being printed, and the
interrupt handler retriggers immediately again, and this happens again
and again forver, because nothing ends up clearing the interrupt.

This change implements very limited handling of these interrupts. A custom
warning is logged, and the interrupt is cleared.

This change does not imply that doing this is sufficient. More changes may
need to be implemented to more gracefully re-start transactions or
re-arm some endpoints, but this is one step in the right direction,
and at least the OS doesn't freeze up.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-02-06 22:07:03 +09:00
Tomasz Bursztyka
d5a6011589 drivers/interrupt_controller: Move VT-D to new cache API
Just a left-over from previous API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-02-06 10:07:53 +01:00
Adam Kondraciuk
dac3a42063 drivers: counter: align to NRF_TIMER hal
Align driver with changes introduced in the hal. `nrf_timer_frequency_set`
was changed to `nrf_timer_prescaler_set`, update driver accordingly.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-06 10:07:17 +01:00
Fabio Baltieri
47874e2f6e gpio: gpio_keys_zephyr: drop one instance of num_keys
The driver currently stores num_keys in both config and data. Drop the
data copy, save 4 bytes of RAM.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-02-06 10:06:36 +01:00
Daniel DeGrasse
844685224b drivers: dma: remove unused mutex from edma driver
Mutex initialized by edma driver is not used. Remove it from the
driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-02-06 10:05:44 +01:00
Sam Hurst
cc416a8b9b usb-c: tcpc: Add support for Dead Battery
Add Dead Battery functionality to the TCPC drive

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-02-06 10:03:13 +01:00
Andrzej Głąbek
8eba36dd56 drivers: spi_nrfx_spi[m]: Handle transaction timeouts properly
Add code that acts accordingly when a transaction does not complete
in the expected time. It makes sure that the transaction is aborted
so that no unexpected interrupt occurs afterwards and it also cleans
up after that abort so that the driver can handle further requests.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-02-03 10:34:27 -08:00
Marcin Szkudlinski
44222b7dfc mtl: bugfix: tlb driver should allow remapping all unused pages
UNUSED_L2_START_ALIGNED is a marker of first page not used by the
linker. Starting from this page, the memory may be re-mapped.
assertion <= is banning remapping of the first unused page
changing to <

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-02-03 20:59:08 +09:00
Mahesh Mahadevan
5d7051f173 drivers: kscan: Fix the kscan gt911 driver
Update the calculation of the row and column.
Issues were seen when running the LVGL sample.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-02-03 02:24:48 +09:00
Fabio Baltieri
5d9c65fe7f gpio: gpio_keys_zephyr: add missing gpio initialization
The driver is missing the GPIO initialization entirely, meaning that
flags like PULL_UP are not currently being applied. Add the missing
call.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-02-01 09:25:40 +00:00
Henrik Brix Andersen
63850804f1 drivers: timer: mcux: lptmr: add dependency on CONFIG_PM
The introduction of cc2c05a90c caused
CONFIG_MCUX_LPTMR_TIMER to always be enabled for boards where the NXP LPTMR
is enabled in the board devicetree.

Using this low-power timer as system timer only makes sense when using
power management. Otherwise, it just results in a lower tick resolution and
non-tickless operation.

Add dependency on CONFIG_PM for CONFIG_MCUX_LPTMR_TIMER.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-31 22:10:28 -06:00
Stancu Florin
236084df70 drivers: ti: cc13xx/cc26xx: implement watchdog timer
New Zephyr WDT driver for TI CC13xx/CC26xx family.
Supports interrupts & MCU soft reset on timeout.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2023-01-31 16:08:00 -05:00
Fabio Baltieri
48a6f160f2 gpio: gpio_keys_zephyr: fix build warning with assertion disables
Fix two "unused variable" warnings when compiling with assertions
disabled. The two variables are used only in the __ASSERT() call.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-31 06:08:02 -05:00
Fabio Baltieri
20644536b9 uart: microchip: fix build error with PM_DEVICE=n
Fix a build error when the driver is built with:

CONFIG_PM=y
CONFIG_PM_DEVICE=n
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_CONSOLE_INPUT_EXPIRED=y

due to uart_xec_pm_policy_state_lock_get() and rx_refresh_timeout_work()
declared under different configuration options.

Fixes: 343d1919f1 "uart: microchip: add low power & wake support"
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-30 18:54:59 +00:00
Francois Ramu
842a6ba02d drivers: watchdog: stm32 iwdt enable and update during setup
To follow the IWDG configuration sequence, the timeout install is
just preparing the reload and prescaler parameters.
Then during the iwdg setup the watchdog is enabled and configured
at the same time.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-30 15:05:39 +00:00
Mahesh Mahadevan
4e6f80d37a drivers: usb: mcux: Fix the write operation
1. Do not copy over the data to the local buffer,
it can be directly sent to the controller. The
cache is flushed before calling the HAL send
function. Also do not allocate a buffer from
the heap pool for the write operation.
2. Remove a length check as this is handled by
the HAL driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-30 10:07:07 +00:00
Mahesh Mahadevan
9bef7d07e7 drivers: usb: mcux: Remove unnecessary while loop
The while loop is changed to an if check.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-30 10:07:07 +00:00
Mahesh Mahadevan
17da2015bc drivers: usb: Cleanup MCUX driver
1. Remove unused ep_type structure member
2. Add more direction checks

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-30 10:07:07 +00:00
Siyuan Cheng
59130b11dc driver: gpio: Add pin_configure api for creg_gpio driver
Update pin_configure api for creg_gpio driver

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-01-27 19:52:25 -05:00
Henrik Brix Andersen
cb274e6a3c drivers: gpio: add GPIO hog support
Add support for automatically configuring GPIO hogs defined in the
devicetree during system initialization.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Conor Paxton
6b641c3483 drivers: timer: get mtime cmp reg by reading mhartid
It is not guaranteed that a multi-core RISC-V hart numbering scheme
will match Zephyr's sequential cpu numbering scheme. Read the hartid and
use that value in calculation to get mtime_cmp reg, instead of the
current_cpu id.

Signed-off-by: Conor Paxton <conor.paxton@microchip.com>
2023-01-27 12:49:56 -08:00
Jay Vasanth
343d1919f1 uart: microchip: add low power & wake support
changes to support low power and wake support in microchip xec uart
driver. Add support for wakerx_gpio config in dts to select the wake gpio.
Configure for wake in PM_DEVICE_ACTION_SUSPEND state and clear
interrupt in wake isr. Also added support for
CONFIG_UART_CONSOLE_INPUT_EXPIRED

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-01-27 14:25:58 -05:00
Goh Shun Jing
5858cca8b8 drivers: serial: uart_altera_jtag: enhancement
implement uart poll in and interrupt driven api.

Signed-off-by: Goh Shun Jing <shun.jing.goh@intel.com>
2023-01-27 14:24:43 -05:00
Johann Fischer
2f310dc424 drivers: udc: add capability for MPS of control endpoint
New capability is to be used by the stack to adjust the corresponding
field in the device descriptor.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-27 16:11:20 +01:00
Johann Fischer
373d660d96 drivers: udc: remove unused and unsupported udc_ep_flush()
udc_ep_flush() is not implemented by the driver and is not
used by the USB device stack. Remove it for less confusion
when porting drivers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-27 16:11:20 +01:00
Mario Jaun
e3c1747d80 drivers: flash: stm32_qspi: handle 4-byte addressing only chips
Correctly initialize driver if flash chip supports 4-byte addressing
only.

Signed-off-by: Mario Jaun <mario.jaun@gmail.com>
2023-01-27 23:31:39 +09:00
Alberto Escolar Piedras
0de83109de drivers: ieee802154_nrf5: Fix warning in ISR prototype
The ISR prototype was changed some time ago
(6df8b3995e)
to (const void*) => fix the prototype used when
CONFIG_IEEE802154_NRF5_EXT_IRQ_MGMT is not set
to avoid a compile warning.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-01-27 12:35:33 +01:00
Shawn Nematbakhsh
cd0f54fb88 drivers: timer: riscv_machine_timer: Add support for OpenTitan
OpenTitan uses a timer compliant with the RISC-V privileged
specification.

Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
2023-01-27 19:25:26 +09:00
Shawn Nematbakhsh
1d3fb5490f drivers: serial: Add support for OpenTitan serial UART
UART output confirmed to work in simulation.

Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
2023-01-27 19:25:26 +09:00
Jeroen van Dooren
77824a1820 drivers: display: ili9341: add 4th parameter in DISCTRL command
As stated in the datasheet https://www.crystalfontz.com/controllers/Ilitek/ILI9341/142/
there's a 4th parameter in DISCTRL command

Signed-off-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
2023-01-27 19:24:13 +09:00
Wouter Cappelle
0934f705eb sensor: SHT3x: Fix low repeatability in single shot mode
Fix the low readability read command which was swapped with high
readability. This should fix an issue which caused a sensor fetch
fail in low repeatability single shot mode (no data ready)

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2023-01-27 18:11:02 +09:00
Andrei Emeltchenko
3f0487b725 drivers: adc_ads1119: Fix using wrong status bit
Fixes using wrong status bit for ADS1119_STATUS_MASK_ID. Moreover
using BIT(8) does not make much sense for working with uint8_t.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-27 18:09:49 +09:00
Stancu Florin
817e41f965 boards: cc1352p1_launchxl: new board, support antenna switching
Added new CC1352P1 LaunchXL board supporting 20dBm TX for its
sub-GHz radio.

Note that the board has a multiplexer circuit to switch between
2.4GHz, High-Power TX and Sub1GHz states, for which a custom board
module was implemented, together with board-specific device-tree
bindings and pinctrl definitions for each of the RF states.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2023-01-27 17:44:38 +09:00
Stancu Florin
e41de9235a drivers: ieee802154: cc13xx_cc26xx_subg: PA TX amplifier support
Enhance IEEE802154 Sub-GHz driver to support CC13x2P's internal power
amplifier (20dBm) for TX.

Note: requires board-specific antenna switching for it to work
properly.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2023-01-27 17:44:38 +09:00
Trent Piepho
43781ba2a0 i2c: Add an option to dump all I2C messages to the log
When turned on, the existing i2c dump code is use to log every I2C
transaction at debug level.

This can be very useful for detecting problems with I2C peripherals.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-26 14:55:44 -05:00
Trent Piepho
0c7ff3b728 i2c: Improve formatting of i2c dump function
If an i2c message is for just one byte, instead of logging it with a
hexdump after logging the other message info, just added the one byte to
the same log message.

Since most i2c messages are one byte, this significantly reduces the
number of messages and lines needed to log i2c transactions, from three
line per message to just one.  It's also a lot easier to read.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-26 14:55:44 -05:00
Trent Piepho
c09f6918fa i2c: Allow dumping the data of read messages
Add an argument to i2c_dump_msgs() to log the data from reads too.  And
then rename the function to i2c_dump_msgs_rw() so the API doesn't
change.  If the dump is done after a transaction is processed, as
opposed to before, then the read data is valid and can be very useful.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-26 14:55:44 -05:00
Andrzej Głąbek
37665b5e95 drivers: spi_context: Refactor spi_context_wait_for_completion()
Refactor the code of this function to make it a bit easier to read.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-27 01:22:15 +09:00
Andrzej Głąbek
f36c15e2e3 drivers: spi_context: Use total transfer length in timeout calculation
When estimating the time that a given SPI transfer will take, whole
buffer sets for TX and RX need to be taken into account, not only their
first parts. Correct `spi_context_wait_for_completion()` accordingly.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-27 01:22:15 +09:00
Michael Larson
0267612305 drivers: flash: spi_nor: Fix spi_nor_sfdp_read conditional
spi_nor_sfdp_read is now called from spi_nor_process_sfdp for the
CONFIG_SPI_NOR_SFDP_RUNTIME case and that could be defined without
CONFIG_FLASH_JESD216_API being defined

Signed-off-by: Michael Larson <larson@whisper.ai>
2023-01-27 01:21:52 +09:00
Francois Ramu
05da8d7a7a drivers: flash: stm32 page layout size differs in stm32u5 or stm32l5
Adjust the size of the stm32_flash_layout[] table depending on the
bank configuration of the stm32u5 or stm32l5 devices.
That will avoid div by zero error in flash_get_page_info()
if the layout_size is not correct.
Assign the *layout_size only once with the correct value : 3 or 1.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-27 01:05:44 +09:00
Cyril Fougeray
4d7e150189 drivers: i2c: stm32: format
Detected by checkpatch.pl

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-01-27 01:02:08 +09:00
Cyril Fougeray
400fa70ca2 drivers: i2c: stm32: PM device runtime support
Lock I2C device state when used so that Power Manager doesn't
suspend the device.
Initial state is a suspended device.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-01-27 01:02:08 +09:00
Cyril Fougeray
7710082e87 drivers: i2c: stm32: PM device support
Clock and pins used by the I2C device are suspended when power
manager requires it.
Do not compile function i2c_stm32_suspend when PM_DEVICE isn't
 enabled as it is left unused and will make the compiler throw
 a warning.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-01-27 01:02:08 +09:00
Cyril Fougeray
51fa86bb98 drivers: exti: stm32: expose STM32_EXTI_LINE_NONE
Common STM32_EXTI_LINE_NONE for declaration and setting
of wakeup EXTI line when configured.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-01-27 01:02:08 +09:00
Benjamin Björnsson
500809f8fa drivers: can: can_loopback: Abort pending messages when stopped
This commit aims at updating the drivers stop function to better
follow the CAN header file which specifiec that stopping the CAN
controller should "abort any pending CAN frame transmissions".

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-01-27 00:58:59 +09:00
Johann Fischer
e60a4efbb0 drivers: udc: do not update MPS for isochronous endpoints
Zero data payload size for isochronous endpoints is a
is a valid setting for default interface.
Also do not update MPS of control endpoint since it is
set by the driver.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-27 00:57:22 +09:00
Chamira Perera
da3e3d3ed3 drivers: ethernet: stm32: Enabling stats for the driver.
The change enables the ethernet driver to save statistics in a
structure in the ethernet driver API structure. In addition, the
change also attempts to update error statistics based on errors
reported in the STM32 ethernet HAL API.

Fixes #53995

Signed-off-by: Chamira Perera <chamira.perera@audinate.com>
2023-01-27 00:56:06 +09:00
David Leach
cde1573619 drivers: entropy: use non-cache intermediate buffer for RNG
The CAAM hardware needs to read RNG values into a non-cache
buffer. Since the contract to Zephyr RNG functions do not
require non-cache buffers, we use an intermediate non-cache
buffer to retrieve results.

Added a Kconfig to control the size of the intermediate buffer.

Fixes #53035

Signed-off-by: David Leach <david.leach@nxp.com>
2023-01-26 09:46:20 -06:00
Brian Juel Folkmann
8d11d183f6 drivers: flash: bug fix stm32 ospi flash erase
This commit fixes a bug in the STM32 ospi flash driver when attempting
to erase an area that spans more than one erase sector.
Without this fix, only the first sector is actually erased, the rest
silently fails the erase.
Issue is that the write enable latch command is only sent for the first
erase command.

Signed-off-by: Brian Juel Folkmann <bju@trackunit.com>
2023-01-26 09:39:59 +00:00
Armin Brauns
219dd436d1 drivers/clock_control: stm32l4: allow enabling MCO output
This enables the MCO clock output pin to be configured through Kconfig on
stm32l4 devices.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-01-26 09:39:33 +00:00
Armin Brauns
706f5caf0e drivers/clock_control: stm32f7: allow enabling MCO outputs
This enables the MCO clock output pins to be configured through Kconfig on
stm32f7 devices.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-01-26 09:39:33 +00:00
Yuval Peress
e7443bb203 sensors: Add attribute configuration for icm42688
Implement the attribute get/set for the icm426888

Signed-off-by: Yuval Peress <peress@google.com>
2023-01-25 09:48:05 -06:00
Yuval Peress
ad4cb88494 sensor_shell: add attribute support
Add 2 new sub-commands to the sensor command (attr_get and attr_set).
These commands can be used to access the driver's attr_set and attr_get
functions.

Signed-off-by: Yuval Peress <peress@google.com>
2023-01-25 09:48:05 -06:00
Yuval Peress
3f4c568f71 sensor_shell: run clang-format
Run clang-format on the sensor_shell.c to make diffs easier for the
next commit.

Signed-off-by: Yuval Peress <peress@google.com>
2023-01-25 09:48:05 -06:00
Henrik Brix Andersen
55d0ffa874 drivers: can: remove CAN_HAS_CANFD Kconfig helper
Remove the CAN_HAS_CANFD Kconfig helper symbol in order to allow enabling
CAN-FD support in the API regardless of driver support.

Change default to CAN-FD support being disabled and have samples and tests
that require CAN-FD support turn it on. This aligns the default
configuration across CAN controller drivers regardless of their
capabilities.

The rationale behind this is that we are starting to see MCUs with multiple
CAN controllers, some CAN-FD compatible, some not (e.g. NXP i.MX RT1060 and
FPGAs). Automatically enabling CAN-FD support based on the presence of a
CAN-FD capable CAN controller leads to different application default
settings based on the CAN controller(s) in use.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-25 15:00:39 +00:00
Henrik Brix Andersen
f1a7ec96db drivers: can: remove CAN_HAS_RX_TIMESTAMP Kconfig helper
Remove the CAN_HAS_RX_TIMESTAMP Kconfig helper symbol in order to allow
enabling CAN RX timestamps in the API regardless of driver support.

This simplifies application prj.conf settings across board supporting/not
supporting RX timestamps considerably.

CAN drivers not supporting RX timestamps already initialize the timestamp
to 0 for received frames.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-25 15:00:39 +00:00
Guillaume Gautier
6deebdd13a drivers: adc: Remove now unused variables for STM32 ADC
Remove boolean variables for internal channels now that we use channel
number directly

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-01-25 15:00:21 +00:00
Guillaume Gautier
9c6d44ef5a drivers: adc: Simplify STM32 ADC channels setup
Now that we have the information of internal channel number for STM32
ADCs in the dts, we can use it to remove a lot of specific code and
make it clearer.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-01-25 15:00:21 +00:00
Erwan Gouriou
34e49a7c54 drivers: adc: stm32: Refactor driver init section
Slightly refactor STM32_ADC_INIT macro.
adc_stm32_cfg_##index declaration is now part of ADC_STM32_INIT
and extracted from CONFIG_ADC_STM32_SHARED_IRQS #ifdef.

Aim is to minimize code duplication when adding new adc_stm32_cfg_X
or adc_stm32_data_Y entries

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-25 15:00:21 +00:00
Andrei Emeltchenko
ec8c9f05fc drivers: ieee802154_rf2xx: Fix logical operation
Fix using AND instead of OR.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-25 14:58:09 +00:00
Andrzej Głąbek
cf871aec64 drivers: nrf_rtc_timer: Adjust set_absolute_alarm to prevent CC misses
This is a follow-up to commit 205e684958.

The recently added nrf_rtc_timer test case (test_next_cycle_timeouts)
revealed a problem in the current implementation of this function.
Adjust it to avoid missing COMPARE events in specific circumstances.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-25 11:25:01 +00:00
Marcin Jabrzyk
61916c69dd drivers: watchdog: Fix RP2040 watchdog load time
RP2040 requires watchdog load time in us, but Zephyr
watchdog window values are in ms. Make sure that it is
adjusted to hardware requirements.

Signed-off-by: Marcin Jabrzyk <marcin.jabrzyk@gmail.com>
2023-01-24 19:01:34 -08:00
Evgeniy Paltsev
9eb8baeff9 ARC: irq: idu: mask IRQ before level setup
Currently we setup irq trigger type (pulse or level) in IDU
before we Mask (disable) IRQ line.

The IDU is disabled at this moment, however we still may
accidentally generate interrupt by trigger setup.

To avoid that let's mask (disable) IRQ before trigger type setup.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-01-24 18:57:50 -08:00
Benjamin Kyd
ee1e514b3b driver: ethernet: cvsx remove ugly whitespace
Remove the ugly whitespace in drivers/ethernet/eth_cyclonev.c

Signed-off-by: Benjamin Kyd <benjamin.kyd@intel.com>
2023-01-24 17:46:17 -06:00
Benjamin Kyd
f3a610fffe drivers: ethernet: cvsx change bit label
Change the bit label to include the BIT() macro to tidy up the code.

Signed-off-by: Benjamin Kyd <benjamin.kyd@intel.com>
2023-01-24 17:46:17 -06:00
Benjamin Kyd
aad76523e1 drivers: ethernet: bugfix for Cyclone V Ethernet
bugfix for Cyclone V Ethernet Phy error and timeout overflow.
 - p->instance was incorrectly assumed to be a reference to
   the emac device, this is ammended
 - the volatile uint16_t timeout would often overflow
 - code cleanup and added more macros for housekeeping

Signed-off-by: Benjamin Kyd <benjamin.kyd@intel.com>
2023-01-24 17:46:17 -06:00
Jeppe Odgaard
a76b908f4c drivers: sensor: add mcux quadrature encoder
Add a driver for the NXP MCUX Quadrature Decoder. The driver
is simple and only implements the phase a and phase b inputs. The
module has additional features which can be added in future PRs.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-01-24 10:21:39 -06:00
Marc Desvaux
d72f65f358 drivers: ethernet: PTP clock CONFIGURATED
Set PTP Configuration done on ETH_STM32_HAL_API_V2

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-01-24 14:34:34 +00:00
Francois Ramu
210e0b76bf dts: bindings: pwm custom macro for STM32 vendor
Change the name of the custom macro defined for the stm32 devices
to fit the VND_PWM_xxx model
Keeping old deprecated macro, though.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-24 14:49:53 +01:00
Manuel Arguelles
8d2778f326 drivers: ethernet: add support for NXP S32 NETC
Introduce Ethernet low-level driver for NXP S32 Network Controller
(NETC). Current driver allows to manage from Zephyr a Physical Station
Interface (SI) and/or a Virtual SI. The NETC has an integrated Ethernet
Switch. Currently the Switch is initialized from this driver with a
default configuration, and all ports are enabled and transparent for
the user. A separate Switch driver should be addressed in future patches.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-24 14:37:20 +01:00
Manuel Arguelles
1d6452c57b drivers: mdio: add support for NXP S32 NETC EMDIO
Introduce NXP S32 NETC External MDIO controller driver. Driver supports
a single instance, as current support is based on NXP S32Z/E SoCs.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-24 14:37:20 +01:00
Manuel Arguelles
642303ac7e drivers: eth: phy_mii: support Gigabit ethernet
Advertise Gigabit Ethernet if the PHY supports it. As with the
other speeds, it is assumed the PHY supports both duplex modes.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-24 14:37:20 +01:00
Manuel Arguelles
60608b7a31 drivers: mbox: add support for NXP S32 MRU
Introduce NXP S32 Message Receive Unit (MRU) driver based
of Mbox API. The MRU couples with a processor and allows to
receive messages from senders, which are other modules or
processors.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-24 14:37:20 +01:00
Manuel Arguelles
47de21d5c0 drivers: mbox: separate NRFx specific Kconfig
Separate NRFx Mbox driver Kconfig to make place for other drivers.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-24 14:37:20 +01:00
Sam Hurst
6b4b7a02e7 usb-c: tcpc: Enable ISR Hard Reset sent bits
This change enables the ISR Hard Reset sent bits, so that
an interrupt is generated when a Hard Reset is sent or
the Hard Reset failed.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-01-24 09:43:20 +01:00
Sam Hurst
603ac13145 usb-c: tcpc: Correctly detect Hard Reset sent detection
The Hard Reset sent signal was tested twice in the same
"if else" structure but only handled in the last test. This
change removes the first detection so that Hard Reset can
be correctly detected.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-01-24 09:43:20 +01:00
Sam Hurst
e3365e961d usb-c: tcpc: Simplify Hard Reset complete logic
This change simplifies the Hard Reset complete logic

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-01-24 09:43:20 +01:00
Erwan Gouriou
7b221fbe45 drivers: clock_control: stm32: Can't get MSI freq
Update driver to allow MSI frequency retrieval.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-24 09:42:51 +01:00
Erwan Gouriou
e67b2fa60d drivers/disk: sdmmc stm32: Fix compilation issues
Fix a bunch of issues which were blocking driver compilation.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-24 09:42:51 +01:00
Jordan Yates
addf405fe6 power_domain: gpio: only run actions for children on domain
Only run the `PM_DEVICE_ACTION_TURN_ON` and `PM_DEVICE_ACTION_TURN_OFF`
actions for child devices that have refered to the domain via the
`power-domain` property.

This prevents multiple actions being run for devices that refer to
several power domains, e.g.

```
	test_dev: test_dev {
		compatible = "test-device-pm";
		status = "okay";
		power-domain = <&test_reg_1>;
		alternate-domain = <&test_reg_chained>;
	};
```

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-01-24 09:42:11 +01:00
Mahesh Mahadevan
3b7e7575a9 drivers: usb: Enable High speed Kconfig for NXP controllers
Enable the USB_DC_HAS_HS_SUPPORT Kconfig for NXP controllers
that support High speed.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-23 19:40:44 -08:00
Benjamin Lindqvist
7ffc200820 drivers: sensor: bmi270: don't force val2 > 0
The struct sensor_value type does NOT require val2 to be positive. The
removed code is in fact a rather serious bug, probably put in place
because it makes printing sensor_values easier.

Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
2023-01-23 12:02:30 -08:00
Trent Piepho
c45bc68e5c drivers/sensor: lsm6dso: Remove busy wait on bank change
It's not necessary to busy wait 150 µs after changing register banks.
Nothing in the data sheet nor app note suggests this.  ST's own HAL,
which is used by this driver, does not delay when changing banks.  It
does a bank change around every function that accesses a non-user bank
register (it's quite inefficient).

So if it was necessary it would be broken now, as most of the bank
changes have no delay.

One of the few page changes that did have this delay are the those done
before and after reading a sensor sample.  Which is where the speed is
significant and is limiting the update rate the driver is capable of.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Trent Piepho
0cfe9560d9 drivers/sensor: lsm6dso: Remove unneeded read/modify/write in shub read
The code in the ST HAL does a read/modify/write to change the bits in
the LSM6DSO_FUNC_CFG_ACCESS register that control which register bank is
active.

All the other bits in the register are defined as zero.  It's possible
to simply set the register to the desired value without reading the
contents first.

This bank switch needs to be done twice for every sensor read when the
sensor hub is used.  The driver as it is can not keep up with the higher
update rates of the lsm6dso.  So any speed increase in this code allows
for a higher update rate as well as reduced latency.

Previously, a read of the lsm6dso's accel and gyro on a 400 kHz I2C bus
with a 3-axis magnetometer on the sensor hub takes 2.69 ms.  This drops
that to 2.26 ms.  This is enough to support the 417 Hz ODR.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Trent Piepho
8e80661db7 drivers/sensor: lsm6dso: Fix shub init and configuration failures
There is a flaw with I2C communication to peripherals behind the shub
that causes sporadic failures.  Especially calls to configure a device
after the lsm6dso initialization is finished, e.g. to set the ODR, can
fail to work correctly.

Access to shub peripheral registers is done by putting the parameters of
the operation into SLV0 and then waiting for the lsm6dso to perform the
xfer on the shub I2C bus.  The lsm6dso does this in sync with the
accelerometer update rate.  Once the shub is enabled, it peforms the
xfer repeatedly as the accelermeter is sampled.

The wait has a problem:  It might detect that a previous shub xfer has
finished, which was done before SLV0 was programmed with new parameters.

The shub status register is read-to-clear.  This isn't in the data sheet
or app note, but it is.  By reading the status before enabling the
sensor and after programming SLV0, we can be sure when it becomes set it
has finished the current operation and not a previous one.

Also set the write-once flag before shub init.  This causes the shub to
only perform I2C writes once instead of continuously.  This was set at
the end of init, so any writes done during it would repeat until the
shub was disabled.

Put a timeout in the code that polls for the sensor hub op complete.  It
could possibly poll forever.  More importantly, if there is no device
connected to the sensor hub, the lsm6dso does not timeout on the
operation for ~13 seconds.  Since the shub init does a probe for devices
on startup, this will happen if shub support is enabled but a lsm6dso
has no sensor hub devices.  There could be multiple devices, some with
additional sensors and some without.  Initialization of the devices
without additional sensors takes tens of seconds without this timeout
being added.

Add a 300 µs wait after disabling the sensor hub.  This is necessary
according to the ST app note AN5192 §7.2.1.

Read the shub status from the main bank register instead of the shub
bank register.  This avoids an extra bank switch before and after each
status poll.  Actually two bank switches on each side, since the lsm6dso
driver switched banks and then the ST HAL function to get the status
register switches again.

The wait for the shub I2C transaction to finish is not needed when the
shub is enabled at the end of init.  We aren't starting a new I2C write
or reading the result of a read.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Trent Piepho
c379f86dbd drivers/sensor: lsm6dso: Set to user bank on init
The lsm6dso initialization will fail if the device is not already set to
the user register bank.  All the registers used will be the wrong ones
from whatever bank it is in, e.g. sensor hub bank.  This includes the
registers to reset the device!

The bank will default to the user bank on reset, but the chip has no
hardware reset line.  On a reboot it will be in whatever bank it was
last in.  If the sensor hub is enabled, it will switch banks on every
sample, so it's entirely possible to reset or reboot when it happens
to be set to the sensor hub bank, which will cause the driver to
fail to initialize.  It will not work again until the lsm6dso is power
cycled.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Trent Piepho
25579d95b1 drivers/sensor: lsm6dso: Disable sensor hub before reset
Per an ST app note, the sensor hub I2C controller should be disabled
before doing a software reset.  Possibly, this is because the sensor hub
could be in the middle of the an I2C transaction to a sensor when it is
reset.  Disabling it and then waiting makes sure it has quiesced before
resetting.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Trent Piepho
7cf6d75a11 drivers/sensor: lsm6dso: Move interrupt config to after chip reset
The initialization code would configure the lsm6dso interrupt, then
configure the rest of the chip.  The chip init includes a reset that
would undo the register setting done during interrupt configuration.

It's also not a good idea to enable the interrupt on the SoC when the
lsm6dso has not yet been reset or configured.  It might be generating
interrupts.

The lsm6dso has no hardware reset line, so it will not be reset on
reboot unless a power cycle is involved.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Trent Piepho
d14732b541 drivers/sensor: lsm6dso: Set thread name
When the driver creates its own thread, set the name.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Tom Burdick
58312e6104 dma: Repeated start/stop support for gpdma
Allows for repeatedly calling start/stop on designwares gpdma.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-01-23 11:51:21 -08:00
Tom Burdick
b14296af38 dma: HDA ignore repeated start/stop requests
The DMA API contract specifies that start/stop may be called multiple
times. Prior to adding power management this was perfectly fine as it was.
In adding power management, there are additional side effects that can
cause issues. Instead check the state of the channel prior to start/stop
and do nothing if already in the desired state.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-01-23 11:51:21 -08:00
Gerson Fernando Budke
97967f0526 drivers: ieee802154: rf2xx: Fix hang on 0x2c isr_status
When transceiver is overload on reception a frame can be stored on
the internal buffer without processing a frame start interrupt. The
frame will complete and system will received a interrupt and signal
receiver thread with an isr_status equal to 0x2c.

The current implementation process one flag at time and it may hang
when status is 0x2c. This issue can be reproduced using two nodes
where one perform a regular TX broadcast and tThe other one should
be wait for frames. The receptor should run on debug mode and system
should be started normally. The problem happens when pressing CTRL+C
on the debugger, which will cause system to stop. However, the
transceiver still can receive one last frame. After a few transmission
user can continue application and a isr_status of 0x2c will be visible
if CONFIG_IEEE802154_DRIVER_LOG_DEBUG is enabled.

This fixes the current issue by processing all RF2XX_TRX_END events.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-01-23 09:33:53 -08:00
Nickolas Lapp
be2906a64c NRF_QSPI_NOR: Exit DPD mode regardless of CONFIG_PM_DEVICE.
A call to exit_dpd mode for the nrf QSPI nor flash should always be
made, even if the currently executing image is compiled with
CONFIG_PM_DEVICE=n, because a previously executing image could have set
the device into DPD mode, and a call to exit_dpd is required for proper
functionality. Call `exit_dpd` regardless of the setting of
CONFIG_PM_DEVICE during QSPI nor initialization.

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
2023-01-23 10:10:49 +00:00
Hein Wessels
6724c8d1fe drivers: adc: stm32: only teardown channel after context complete
Previously channels could be tore down before a sequence completes,

either when using async, or when ADC_ACTION_REPEAT was specified

The teardown is now moved to after an entire context is complete

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-01-23 09:59:46 +00:00
Hein Wessels
cbe52e9027 drivers: adc: stm32: support multiple channels
Support sequencing multiple channels into a single read

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-01-23 09:59:46 +00:00
Hein Wessels
dce0eb7e8f drivers: adc: adc_context: add optional context_on_complete
This optional function allows a driver to do operations

after a complete sampling sequence is completed.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-01-23 09:59:46 +00:00
Andrei Emeltchenko
63f360c7fc drivers: gpio_nct38xx_port: Fix checking wrong return
Fix error check for previous function return code.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-21 21:27:38 -05:00
Joakim Andersson
8703ec6e86 drivers: timers: Add dependency on SYS_CLOCK_EXISTS to all timer configs
Add dependency on SYS_CLOCK_EXISTS to all timer configurations.
This would avoid a situation where a possible timer configuration would
be wrongfully selected but SYS_CLOCK_EXISTS is disabled.

This simplifies code that wants to check for system clock capabilities
don't have to check if the system clock exists in addition.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2023-01-20 20:02:20 +01:00
Rami Saad
1d8681965c drivers: spi: fix 16 bit spi dma transfers for the STM32 driver
Calculate the correct dma segment length for STM32 16 bit spi dma transfers
Fixes zephyrproject-rtos#52563

Signed-off-by: Rami Saad <rami.saad@morgansolar.com>
2023-01-20 16:11:48 +01:00
Wojciech Slenska
fdae56dc6a drivers: watchdog: stm32 iwdg: max prescaler value
In some stm32 MUCs maximum prescaler value can be 1024.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2023-01-20 16:11:39 +01:00
Raul Pando
0acc7fdd58 drivers: i2s: Improve precision in PLLI2S VCO calculation
Minor rework to perform the PLLI2S VCO computations in floating point as
per the original seemingly intent.

Signed-off-by: Raul Pando <raul.pando@bytegrity.co.uk>
2023-01-20 14:35:36 +01:00
Erwan Gouriou
b8917cdbf6 drivers: ethernet: stm32f7: Enable use of HAL V2 API
Point to the modified version of hal_stm32 which allow to use
ETH HAL V2 on stm32F7.
Update zephyr driver to allow it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-20 13:03:27 +00:00
Mateusz Sierszulski
5744709c9c drivers: watchdog: Enable Gecko wdt driver efr32bg_sltb010a
This commit enables the Gecko Watchdog Timer driver on the
efr32bg_sltb010 board.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-01-20 12:22:56 +01:00
Erwan Gouriou
29a4eb3acc divers: disk: stm32 sdmmc: Configure clock through device tree
Similarly to what was done in USB or RNG drivers, configure 48MHz domain
clock using device tree.
By default a freq clock check is enabled.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-19 20:58:15 -08:00
Henrik Brix Andersen
51cac9e04f drivers: can: rcar: add RX overrun counter statistic support
Add support for the RX overrun statistics counter to the Renesas R-Car
CAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-19 16:51:22 -08:00
Henrik Brix Andersen
8b896fdf01 drivers: can: stm32: add RX overrun counter statistic support
Add support for the RX overrun statistics counter to the ST STM32 bxCAN
driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-19 16:51:22 -08:00
Henrik Brix Andersen
5517a935d0 drivers: can: mcux: flexcan: add RX overrun counter statistic support
Add support for the RX overrun statistics counter to the NXP FlexCAN
driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-19 16:51:22 -08:00
Henrik Brix Andersen
46136b3c12 drivers: can: mcux: flexcan: fix handling of failed RX MB reads
Fix handling of failed NXP FlexCAN RX mailbox reads. Instead of re-enabling
the RX MB in the ISR, we need to handle a failed RX MB read (e.g. due to a
busy MB bit).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-19 16:51:22 -08:00
TOKITA Hiroshi
10ef1a7cba drivers: sensors: Add support for RaspberryPi Pico CPU temperature
Support for the measuring the CPU die temperature
for the RaspberryPi Pico.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-19 15:32:41 -06:00
Felipe Neves
cd04926d6b sensors: as5600: added as5600
magnetic angle sensor driver.

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2023-01-19 15:18:24 -06:00
Declan Snyder
33ffda4dd6 drivers: i2c_mcux_flexcomm: Add thread safe lock
Add a locking semaphore so that multiple threads
doing transfers with the same i2c will not produce
unexpected results. The lock will ensure that only one
transfer will happen at a time and it must be completed
before another thread can request a new transfer.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-19 14:25:02 -06:00
Jay Vasanth
6bd7f781a3 mec150x: clk ctrl: fix clock trim register update
Program the right trim control register for mec150x.
This fixes uart debug console output issue.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-01-19 12:45:56 -06:00
Erwan Gouriou
d7631a60ec drivers: interrupt_controller: stm32: Generate irq_table and isr from dt
This change takes advantage of line information coming from new properties
to simplify exti_irq_table definition and isr routing related code.

All __stm32_exti_isr_x routing functions are removed and instead,
stm32_exti_isr is now taking a exti_range structure which provides,
for each irq, start line and range length.
This argument is provided by IRQ_CONNECT macro instead of previous
dev info (which is constant and doesn't need to be provided as argument).

line_range_x variables are generated at driver init thanks to a
mix of dt magic and runtime implementation:
DT_FOREACH_PROP_ELEM iterates over each irq line (counted as
interrupt-names property) call a macro which instantiates populated
line_range_x variables, and calls IRQ_CONNECT for each IRQ.
Additionally, at each iteration stm32_fill_irq_table() is called to
fill exti_irq_table.

Since not required anymore, Kconfig symbols EXTI_STM32_EXTIX_Y_IRQ_PRI
are removed. IRQ prio is now supposed to be configured in device tree.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-19 17:20:48 +00:00
Adrian Warecki
5d902ea621 dma: dw: Align error code for xrun reporting
The hda driver uses -EPIPE to signal xrun, as proposed in the alsa lib
https://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html. This commit
changes the xrun error code in dw dma driver from -ENODATA to -EPIPE to
make it consistent across drivers.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-01-19 15:45:16 +00:00
Jukka Rissanen
c21299ad53 drivers: uart_mux: Fix documentation of uart_mux_recv()
The uart_mux_recv() documentation was wrong, the function parameters
were incorrectly documented.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2023-01-19 08:44:34 -06:00
Daniel Leung
422250d3b1 mm: intel_adsp_mtl_tlb: suppress sparse address space warnings
There are various call to z_soc_cached_ptr() which returns values
in the cached address space and are stored in temporary variables
that are not marked as in the cached address space. This results
in sparse complaining about discarding the cached address space
attribute. These temporary variables are then passed to other
internal memory management related functions which do not have
the concept of cached address space (as it is currently Xtensa
specific). Because of this, we cannot change the signature of
these functions. Instead, we force a change of address space
when those temporary variables are being assigned to suppress
sparse warnings.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-01-19 06:52:23 -05:00
Francois Ramu
227226313a drivers: dma: stm32 dma driver support repeated start/stop
To support the repeated start/stop, the stm32 dma driver is
returning 0 if the channel is already started/stopped.
This is not done at the dmamux level if any.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-19 12:03:50 +01:00
Daniel DeGrasse
158f63794f drivers: i2c: enable i2c target mode for LPI2C driver
Enable I2C target mode for LPI2C driver. Verified with i2c_target_api
test, on RT1060 EVK.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-19 10:16:13 +01:00
Chamira Perera
a5f9fc2382 drivers: ethernet: stm32: Updated original multicast hash filter change
- Applied changes on the most recent version of the driver
 - Using CONFIG_ETH_MULTICAST_FILTER to enable/disable the hash filter
 - Using read-modify-write the hash table for a single address
when joining
 - When leaving rebuild the entire hash table and ensure that multicast
addresses used for the hash calcuation doesn't have the joined flag set

I have tested these conditions:
 - IGMP enabled and disabled on my ethernet network
 - Observed the network utilisation on a STM32H7 device running these
changes with the hash filter enabled and disabled while the device is
on a ethernet network with high rate multicast traffic
 - When the application closes a socket for a multicast receive, ensure
it doesn't affect the receiption of existing sockets as well as IGMP

Fixes #53773

Signed-off-by: Chamira Perera <chamira.perera@audinate.com>
2023-01-18 16:17:27 +01:00
Markus Fuchs
c76aaf3818 drivers: ethernet: stm32: Enable multicast address filter
Use the MAC's hash table to filter incoming multicast frames that are
targeted to subscribed multicast groups and discard all others.

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>

# Conflicts:
#	drivers/ethernet/eth_stm32_hal.c
2023-01-18 16:17:27 +01:00
Mulin Chao
5973a944af Revert "driver: uart: npcx: add missing tx/rx interrupt enabled checks"
This reverts commit 271b306.

In rare conditions, this commit causes the uart shell mechanism to
corrupt on Cros ec system. Revert this commit on upstream repo first to
avoid blocking the development. Will dig out why this symptom occurs
later.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-01-18 16:08:49 +01:00
Andrei Emeltchenko
4d2914c5c2 drivers: eeprom: Fix splitting format string
Fix splitting format string to arguments.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-18 07:27:00 -05:00
Andrzej Głąbek
8b391dc438 drivers: audio: dmic_nrfx_pdm: Fix a race condition in the driver
When the PAUSE or STOP command was triggered, the driver was first
requesting the PDM peripheral to stop by calling nrfx_pdm_stop() and
then it was setting a flag that was in turn checked in an interrupt
that was generated when the PDM actually stopped (what happens a moment
after the stop request is made). But that setting of the flag could get
preempted and the interrupt handler could get executed first causing
the stopping to be not handled properly and leaving the driver falsely
considering the peripheral as still active.
This commit reverses the order of these two operations to avoid
the described race condition.
Same sequence is corrected also in event_handler(), but this is
done only for consistency (it is in the interrupt handler itself
so there is no race possible in this case).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-18 12:14:07 +01:00
Adrian Warecki
0e17395bbf mtl: drv: mm: tlb: Add reporting of memory usage to PMC
The number of HPSRAM memory blocks in use is reported to the
PMC via the sideband channel supported by the communication widget.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-01-18 10:47:21 +01:00
Francois Ramu
9400de333e drivers: watchdog: stm32 iwdg starts with wdt_setup()
the watchdog is enabled by the wdt_setup()
coming after the wdt_install_timeout.
Due to PR #44972, the code did not follow that.
This PR fixes the correct other in the sequence.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-18 09:56:14 +01:00
Erwan Gouriou
8725edc134 drivers: entropy: stm32: Check clock config at runtime
RNG clock configuration constraints differ between each series.
Rather than providing complex build time code to verify RNG clock
configuration is correct, take advantage of CECS bit (Clock error
current status) to assess clock configuration.

This check is implemented under a specific ENTROPY_STM32_CLK_CHECK
Kconfig option. This allows user to disable this feature in specific
conditions:
- CED bit disabled in application (in which case CECS status is not valid)
- Clock configuration is deemed as correct by user. Note that RNG number
  are always generated, whatever the clock status.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-18 09:56:03 +01:00
Erwan Gouriou
b9da848c0b drivers: entropy: stm32: Configure clock source using clock_control driver
RNG domain source clock is now configured via call to clock_control
driver.
Besides, add static checks to verify domain clock configuration
is correct:
- If HSI48 is used because it is default domain clock config,
it should be enabled
- If no HSI48 is available, a specific domain clock should be set
- In L0 case, PLL could be used as domain clock only at a specific freq.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-18 09:56:03 +01:00
Erwan Gouriou
5cbff34e35 drivers: entropy: stm32: Allow to configure clock source from dt
Use STM32_DT_INST_CLOCKS to populate device clock information.
This will allow to add clock source information in next commits.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-18 09:56:03 +01:00
Dino Li
a41a4e5e24 espi: it8xxx2: enable espi transaction interrupt
The interrupt is used to wake up EC from low power mode.
So EC does not defer eSPI bus while transaction is accepted.
Fixes EC host commands slow issue.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-01-18 09:55:44 +01:00
Piotr Makaruk
00b5114344 dma: hda: enable xrun handling
Enable link under/overruns handling and reporting such events in dma
status

Signed-off-by: Piotr Makaruk <piotr.makaruk@intel.com>
2023-01-17 18:50:15 -05:00
Pawel Czarnecki
04ec6d72e7 dts: spi: silabs: make peripheral-id property optional
This commit makes the peripheral-id property optional and removes it's
usage from the Gecko SPI driver.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2023-01-17 15:37:27 -06:00
Pawel Czarnecki
06245f3653 drivers: spi: gecko: add support for CPOL and CPHA
This commit adds support for CPOL/CPHA configuration in the Gecko SPI
driver.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2023-01-17 15:37:27 -06:00
Pawel Czarnecki
f1d3011ae1 drivers: spi: gecko: add support for pinctrl configuration
This commit adds support for pinctrl configuration in the Gecko SPI
driver.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2023-01-17 15:37:27 -06:00
Pawel Czarnecki
eb4a0ae225 drivers: pinctrl: silabs: add spi handling
This commit adds pinctrl configuration for SPI on USART.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2023-01-17 15:37:27 -06:00
Daniel DeGrasse
47271ce8be treewide: update usage of zephyr_code_relocate
Update usage of zephyr_code_relocate to follow new API. The old method
of relocating a file was the following directive:

zephyr_code_relocate(file location)

The new API for zephyr_code_relocate uses the following directive:

zephyr_code_relocate(FILES file LOCATION location)

update in tree usage to follow this model. Also, update the NXP HAL SHA,
as NXP's HAL uses this macro as well.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-17 18:08:37 +01:00
Andrzej Głąbek
3454a2547e drivers: nrf_rtc_timer: Remove unnecessary interrupt locking
There is no need to disable interrupts while just checking if
a channel needs to be processed in the ISR, as that section
does not contain anything that needs to be protected against
overwriting from some other context. In particular, if a given
timeout is changed or even aborted while its event is being
checked, this will be correctly handled in the code that follows
and that checks the expiration time.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
eb0cbb433c drivers: nrf_rtc_timer: Correct initial timeout value
Values to be set to the comparator need to be specified in RTC cycles,
not ticks, so the initial value used in the tickless mode needs to be
MAX_CYCLES, otherwise when CONFIG_SYS_CLOCK_TICKS_PER_SEC is set to
a value less then the RTC frequency, the initially configured timeout
will be unnecessarily shorter.
On the occassion, remove also the call to counter() when setting the
initial timeout value in non-tickless mode. RTC is cleared a few lines
above, so at this point it will most likely be 0, and even if it was
not, compare_set() would properly handle a target time value that had
already passed.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
3ffaaa989a drivers: nrf_rtc_timer: Always announce actual number of elapsed ticks
In non-tickless mode, the timeout handler always announced maximum 1
tick to kernel, but in fact it cannot be guaranteed that the handler
execution is not delayed and that the number of elapsed ticks does not
exceed 1. Use the actual number instead.
Switch also to using a 32-bit value for `dticks` to get a bit simpler
generated code (ticks delta is not supposed to be that huge).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
a98316ba09 drivers: nrf_rtc_timer: Fix checking of maximum timeout value
Align the condition checked in compare_set_no_locks() with what
set_absolute_alarm() actually provides (and slightly correct the
latter function so that it provides what it is supposed to).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
e5aa0ab796 drivers: nrf_rtc_timer: Check channel bit when handling force_isr_mask
Add missing masking against `BIT(chan)` when handling a forced ISR
to avoid unnecessary processing of multiple channels instead of just
the one that actually requires it.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
ac96b86493 driver: nrf_rtc_timer: Remove unnecessary setting of comparator
Remove a piece of code that was supposed to bring an extra update
of the anchor value but which in fact was not able to provide it,
because of the target time checking performed in process_channel(),
and which is anyway unnecessary because the timeout span is limited
to MAX_CYCLES in sys_clock_set_timeout(), so the timeout handler is
guaranteed to be executed at least twice per each RTC overflow.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
205e684958 drivers: nrf_rtc_timer: Rework set_absolute_alarm()
Eliminate waiting for a potential COMPARE event when setting a CC
value close to the previously set one and rely instead on checking
target time when processing channel events in the ISR.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
bf1d3db1d4 drivers: nrf_rtc_timer: Simplify sys_clock_set_timeout calculations
Remove unnecessary decreasing of the number of ticks by 1 (it was then
increased by 1 when it was converted to the number of cycles) and add
a comment that clarifies the way that ticks < 1 are handled.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Armin Brauns
fc0157f97c drivers: disk: reset stm32 SDMMC peripheral during init
This is important for applications which are chain-loaded by a broken
bootloader which doesn't reset the peripheral before handing over control.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-01-17 11:27:16 +01:00
Gerard Marull-Paretas
e59e38532a drivers: regulator: shell: fix fp number parsing
Parser did not handle decimals correctly (multiplier was not decreased).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-16 16:52:35 +01:00
Gerard Marull-Paretas
0c28da26ba drivers: regulator: npm6001: handle LDO0 set voltage correctly
Even if the regulator is fixed, allow valid voltage input (1.8V).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-16 16:52:35 +01:00
Gerard Marull-Paretas
240be492fa drivers: regulator: common: set regulator voltage before enabling
Regulator voltage needs to be within allowed range before enabling. It
could happen that regulator default voltage is out of the allowed range,
so the regulator could be enabled at boot time producing a not-allowed
voltage.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-16 16:52:35 +01:00
Gerard Marull-Paretas
4eb74c8ed2 drivers: regulator: remove ONOFF dependency
The regulator drivers no longer depend on ONOFF.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-16 16:52:35 +01:00
Gerard Marull-Paretas
e086738b88 sys: linear_range: allow out-of-range values/windows
The existing linear_range API did not allow values or windows outside of
the linear range (returned -EINVAL). With this change values are allowed
outside of the range, being adjusted to the edge values (min/max)
instead. In the case of windows, it is allowed to have partial
intersection. In both cases, the API assigns a valid index (nearest) and
returns -ERANGE. This change is useful because the main client of the
linear range API, regulators, needs such behavior. For example, If an
application specifies a voltage range from 1.0V to 1.5V and the
regulator supports from 1.2V to 2.7V, the regulator can configure a
voltage that satisfies the condition: 1.2V.  With the current API, the
input would be refused because 1.0V lies outside of the 1.2V-2.7V range.

Also, for constant ranges, the minimum index is returned.

Tests have been updated/extended accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-16 16:52:35 +01:00
Erwan Gouriou
419adeaeed drivers: usb: stm32: Replace static clock check by a runtime check.
In order to clean up clock related code, replace static build time
clock configuration code by a runtime check.
Since I'm not able to guarantee this check will provide a correct
verdict in 100% of the cases (I'm thinking to ULPI or exotic configurations
like F7 OTG-HS), add a config option to disable it if needed.
It also doesn't apply on F1/F3 series. Keep the build time check for now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Erwan Gouriou
4899c104e0 drivers: usb: stm32: Configure domain clock using device tree
This change doesn't consider STM32F1 series.

There are 5 categories of STM32 regarding USB domain clock:
A] USB domain clocks directly driven by CK48 clocks
B] USB domain clocks which can select either CK48 or an alternative clock
C] USB domain clocks which can select between MSI or PLL
D] USB domain clocks relying statically on a PLL output
E] USB domain clocks which can be set on 2 different PLL ouputs

For case A], there is nothing to be done. Clk48 was already configured
in a previous change (51c7643295b02ba26ddcd0fd915484114db7101c).
For case B] and C] USB domain clocks will need to be configured in
each board.
For case D] and E] relying on existing dts configuration. Though
there is no easy build time chekc that can be done.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Erwan Gouriou
cbc44075b7 drivers: usb: stm32: Store dt clock information into an array
Use STM32_DT_INST_CLOCKS() to access usb device clock information.
This will help accessing domain clock information from dt nodes.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Erwan Gouriou
fccf4c95c0 drivers: usb: stm32: Remove HSI48 activation related code
Remove this code to clean up the driver.
Clock activation is done from device tree configuration in clock_control
driver.
Users are informed by warning about missing configuration.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Erwan Gouriou
bef7a89823 drivers: clock_control: stm32wb: Lock CLK48 hsem
On stm32wb, M0 core may enable and disable CLK48 when using RNG.
Lock related hsem to prevent M0 to disable CLK48 when it doesn't need it
anymore.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Grixa Yrev
15a83fe0a0 drivers: pwm: pwm_mcux: Reload mode option
DTS property "nxp,reload" selects how to load the buffered-registers
with new values.

Signed-off-by: Grixa Yrev <grixayrev@yandex.ru>
2023-01-16 09:26:23 +01:00
Ruibin Chang
7b5780e007 ITE drivers/kscan/it8xxx2: set KSI/KSO kbs mode by pinctrl driver
Set KSI/KSO kbs mode by pinctrl driver.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2023-01-14 09:22:39 +01:00
Ruibin Chang
344c9c67f9 ITE drivers/pinctrl/it8xxx2: extend pinctrl driver for kscan pins
Extend pinctrl driver for kscan pins.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2023-01-14 09:22:39 +01:00
Ruibin Chang
d7f482a022 ITE driver/gpio/it8xxx2: add kscan pins gpio driver
Add kscan pins gpio driver for KSI[7:0], KSO[15:0] pins that
they can be configured to gpio mode. These pins registers address,
bit fields and function are different from GPIO group, so I create
a new compatible driver for these pins.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2023-01-14 09:22:39 +01:00
Declan Snyder
4fe04f9a85 drivers: sdhc: Support HS400 mode on IMX driver
Enables HS400 mode on mimxrt595_evk

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder
f7e026f655 drivers: sdhc: Adds MMC functionality to IMX USDHC
Adds MMC support to IMX USDHC driver.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder
e1d309c17b drivers: disk: Framework for eMMC
Framework for using eMMC with disk subsystem.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder
26ad12f55e drivers: sdhc: Fixes IMX SDHC DMA support
Enables DMA support for cacheless IMX systems.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder
a838eef33b sd: Changed KConfig Structure
Changed KConfig structure for SD:
- Better Menu Interface
- Changed symbol dependency structure

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Daniel DeGrasse
b7cd970493 sd: add stub for SDIO support
Add stub code for SDIO support, capable of verifying card responds to CMD5.
This commit also changes the architecture of the SDIO probe step to make
adding new protocol support more streamlined, and enable compiling out
support for undesired protocols.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-14 09:22:22 +01:00
Gerard Marull-Paretas
3bd9352b24 drivers: regulator: npm1100: regulator device may be unused
Since nPM1100 may be configured statically in some circuits, BUCK node
may note be defined, so neither API ops or init call are used in the
code. Add __unused attribute to account for such case.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-13 16:14:35 +01:00
YuLong Yao
aed1f1ac5b drivers: gd32_adc: add support for gd32a50x series.
add support for gd32a50x series.

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-01-12 21:45:38 +01:00
YuLong Yao
2a013216eb drivers: gd32_spi: drop APB marco
drop APB marco because clock_control driver is added.

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-01-12 21:45:38 +01:00
YuLong Yao
d048c44918 drivers: gd32-dac: add support for gd32a50x
add macro for gd32a50x

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-01-12 21:45:38 +01:00
YuLong Yao
caa4721dc4 drivers: clock: gd32: add gd32a50x support
add gd32a50x support

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-01-12 21:45:38 +01:00
YuLong Yao
e5d35910f4 drivers: pinctrl: gd32: add gd32a50x support
set port speed for `gd32a50x`

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-01-12 21:45:38 +01:00
Lucas Tamborrino
41b431a01a drivers: uart: esp32c3: Add async support
Add UART async support for ESP32C3

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-01-12 19:09:01 +01:00
Lucas Tamborrino
17fbdc55b5 drivers: dma: esp32c3: add gdma driver
Add GDMA driver for esp32c3.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-01-12 19:09:01 +01:00
Gerard Marull-Paretas
8c73db666c drivers: regulator: npm1100: add initial support
While nPM1100 is to be operated in fixed configuration for some
applications, it has some degree of configuration via GPIOs. For
example, mode (auto/PWM) can be configured via MODE pin. VBUS current
can also be adjusted using ISET pin, even though there is no API yet to
limit the PMIC input current.

This patch adds a new regulator class driver for nPM1100 PMIC, so that
it can be used with the standard regulator API when needed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-12 19:07:05 +01:00
Michał Barnaś
cc3faf27ca ec_host_cmd: add missing name to choice in Kconfig
It is recommended that choices in Kconfig have names
so this commit adds missing one for the type of
host commands peripheral.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-01-12 16:12:55 +00:00
Mateusz Sierszulski
b36a31fd7a drivers: entropy: Add Gecko trng driver for EFR32BG22
This commit enables entropy driver on EFR32BG22 SoC.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-01-12 15:22:11 +00:00
Erwan Gouriou
6cbb3f5eec drivers: clock_control: stm32: Fixed domain clock configuration
In some case, we may need to describe a domain clock for a device
while there is no way to configure it (ex: USB clock set on PLL_Q output
on F405 devices > It is not selectable).
Then, configuring a device clock domain in the clock_control driver
will allow to retrieve its subsys rate.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-12 12:46:53 +01:00
Kai Vehmanen
8374325062 drivers: dai: intel: dmic: don't use assert for error handling
The dai.h interface does not prohibit calling dai_config_get()
with different direction values. The dmic driver should handle
invalid direction value explicitly and not rely on an assert.

Link: https://github.com/thesofproject/sof/issues/6896
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-01-12 10:01:41 +01:00
TOKITA Hiroshi
e55cbb8ce6 drivers: spi: gd32: Add support DMA transfer
Add supporting DMA-based transfer for GD32 SPI.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2023-01-11 08:50:56 -08:00
Johann Fischer
b5bfd3b12c drivers: udc: fixup parameter endpoint description
The description was still from the early stages of development.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00
Johann Fischer
2cab3a8243 drivers: usb: udc_kinetis: fix race condition in Kinetis USBFSOTG
Periodic enqeueu of buffers can cause a attempt to start
a new transfer even though an endpoint is already busy.

Split usbfsotg_xfer_start() into two function, one to start
next transfer and another to continue the transfers, and use
busy state flags to explicitly mark an endpoint busy.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00
Johann Fischer
00adb2a539 drivers: udc: remove no more required pending state flag
Pending state flag was only used by the UDC nRF USBD driver.
With the introduction of busy state flag it is no longer needed
and can be removed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00
Johann Fischer
a033784c7e drivers: usb: udc_nrf: fix race condition in nRF USBD
Periodic enqeueu of buffers can cause a attempt to start
a new transfer to host even though an IN endpoint is already busy.
Use busy state flags to explicitly mark an endpoint busy.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00
Johann Fischer
baef621bed drivers: udc: add helper functions to set/check endpoint busy state
Add helper functions to set and check endpoint busy state.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00
Johann Fischer
c1860326d1 drivers: udc: avoid NULL pointer dereferencing if endpoint is invalid
Immediately return NULL if endpoint configuration is not available.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00
Erwan Gouriou
3b92034b57 drivers: ethernet: stm32_hal: Rework data provisionning style
Use more concise and readable style.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-11 17:07:20 +01:00
Erwan Gouriou
8eee0afa1f drivers: stm32_hal: Add option to enable HW checksum
Provide a Kconfig option to enable HW RX and TX checksum, which
can increase throughput performances.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-11 17:07:20 +01:00
Fabio Baltieri
afd766d2b3 drivers: xec_qmspi: add missing default y to SPI_XEC_QMSPI_FULL_DUPLEX
Add missing "default y" to the Kconfig option so that it gets selected
automatically when a matching devicetree node is enabled.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-11 09:11:03 -06:00
Marc Desvaux
ae2cf06f0b drivers: ethernet: fix error UDP server on STM32
With ETH_STM32_HAL_API_V2 avoid log error message
if error log report:
we have problems if the traffic is high


Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-01-11 09:42:00 +01:00
Mulin Chao
b1214ead19 driver: i2c: npcx: simplify smb bank registers with union
For NPCX SMB/I2C SMB modules in FIFO mode, the registers include:

* Common registers, offset 0x00-0x0f, accessible regardless of the value
  of BNK_SEL
* Bank 0 registers, offset 0x10-0x1e, accessible if BNK_SEL is set to 0
* Bank 1 registers, offset 0x10-0x1e, accessible if BNK_SEL
is set to 1

In the current driver, it uses two structures, `smb_reg` and
`smb_fifo_reg`, to access `Common + Bank 0` and `Common + Bank 1`
registers. But It might be easy to misunderstand that they are two
different modules.

This CL tries to simplify this by the following steps:

1. Use `union` to combine `Bank 0/1` registers in the same structure.
2. Remove `smb_fifo_reg`. We needn't use two structures to present
   SMB registers.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-01-11 09:40:36 +01:00
Francois Ramu
302983fd7d drivers: flash: stm32 qspi driver correct device size
The find_lsb_set is giving the position of the first '1' found,
starting from 1. "Bits are numbered starting at 1
from the least significant bit."
So that the find_lsb_set(64MBytes) is 27.
The HAL_QSPI_Init() accepts Init.FlashSize where "FlashSize+1
is effectively the number of address bits
required to address the flash memory."
To get 64MBytes = 2^26, the value of the Init.FlashSize must be 25.
and bit written to the DCR = 25.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-11 09:39:47 +01:00
Francois Ramu
4500dba078 drivers: flash: stm32 ospi driver correct device size
The find_lsb_set is giving the position of the first '1' found,
starting from 1. "Bits are numbered starting at 1
from the least significant bit."
So that the find_lsb_set(64MBytes) is 27.
To get 64MBytes = 2^26, the value of the Init.DeviceSize must be 26.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-11 09:39:47 +01:00
Francois Ramu
2cca8b54a3 drivers: flash: stm32 ospi driver prepare sfdp command
Change the stm32_ospi_read_sfdp to have AddressSize
prepared in one single condition.
Add more debug msg.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-11 09:39:47 +01:00
Michał Barnaś
0918442ba6 ec_host_cmd: add ITE SHI peripheral for the host commands
This commit adds the support for host commands being transported
by the Serial Host Interface on the IT8xxx2 SoC.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-01-11 09:38:45 +01:00
Michał Barnaś
3ae105e76b ec_host_cmd: add NPCX SHI peripheral for the host commands
This commit adds the support for host commands being transported
by the Serial Host Interface on the NPCX SoC.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-01-11 09:38:45 +01:00
Michał Barnaś
cbb6742855 ec_host_cmd: add Kconfig to set ec host commands logging level
This commit adds Kconfig CONFIG_EC_HC_LOG_LEVEL that sets the logging
level of host commands subsystem.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-01-11 09:38:45 +01:00
Nick Ward
658b618289 drivers: pwm: add NXP PCA9685 controller
Adds PCA9685 16-channel, 12-bit PWM Fm+ I2C-bus LED controller

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-01-11 09:38:18 +01:00
Tom Burdick
15786ce648 sensor: tdk 42688 driver
Adds a driver for TDK InvenSense 42688 six axis IMU. Verified using
the sensor shell sample app via:

- sensor info
- sensor get icm42688p@0

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Signed-off-by: Yuval Peress <peress@google.com>
2023-01-10 14:45:36 -06:00
Francois Ramu
c14670abea drivers: timer: lptim timer clock on stm32u5 has a prescaler
The stm32 devices shows a x2 factor on the LPTIM1,3,4
clock source but it acts as a prescaler.
The max lptim counter (timebase) is counting 4 sec
In that case, the LPTIM count unit is double.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-10 15:54:25 +00:00
Mathis Raemy
c4b07e8321 drivers: flash: bug fix inline function was not inlined
During flash operation, you have to disable XiP which force function
to be located in RAM. On top of that, the function `flash_put_cmd_addr`
is time critical so we need to declare as inline. For some reason,
sometimes the function was not really inline. Changed it to
ALWAYS_INLINE fixed the bug.

Signed-off-by: Mathis Raemy <mathis.raemy@gmail.com>
2023-01-10 09:26:37 +01:00
TOKITA Hiroshi
c1fc906599 drivers: counter: gd32_timer: Remove is_bit_mask() implementation
Replace is_bit_mask() with IS_BIT_MASK() and remove the implementation.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
TOKITA Hiroshi
33963c43ca drivers: counter: nrfx_timer: Remove is_bit_mask() implementation
Replace is_bit_mask() with IS_BIT_MASK() and remove the implementation.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
TOKITA Hiroshi
21dc3f58e4 drivers: counter: nrfx_rtc: Remove is_bit_mask() implementation
Replace is_bit_mask() with IS_BIT_MASK() and remove the implementation.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
TOKITA Hiroshi
429b05a79a drivers: counter: stm32_timer: remove counter_stm32_is_bit_mask() function
Remove implementation of counter_stm32_is_bit_mask() and
Use IS_BIT_MASK() macro.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
Chris Friedt
8659e2f69e libc: minimal: include: move fcntl.h to posix
The `fcntl.h` header has never been a part of ISO C so move it to
`include/zephyr/posix`.

To ensure a smooth migration, a header was left in
`lib/libc/minimal/include` that prints a deprecation warning.

Users should either include `<zephyr/posix/fcntl.h>` or switch to
`CONFIG_POSIX_API=y`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Erwan Gouriou
773f96b763 drivers: stm32: stm32_hal: Generate device id based mac address
In case user didn't set mac address in any way (locally defined or
randomly generated), define mac address using device unique id.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Erwan Gouriou
179963899e drivers: ethernet: stm32_hal: Move mac address configuration to dt
Deprecate Kconfig mac address related symbols and replace by existing
device tree properties:
- local-mac-address
- zephyr,random-mac-address

User who wants to keep using deprecating method of defining random
MAC address using Kconfig should set CONFIG_ETH_STM32_HAL_RANDOM_MAC=y.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Erwan Gouriou
eee1d7fc66 drivers: ethernet: stm32_hal: Centralize mac address configuration
Get the mac address be set in a central function rather than split
between 2 places.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Erwan Gouriou
ddb457a8d9 drivers: ethernet: stm32_hal: Make MAC address setting method a K choice
In order to ease deprecation of these methods (in favor of dt based
configuration), introduce a choice for MAC address configuration method.

Default to random method (no change).

User wanting to still use ETH_STM32_HAL_MACX symbols should define
CONFIG_ETH_STM32_HAL_USER_STATIC_MAC=y

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Jani Hirsimäki
e92b067b7f net: ip: net_context: AF_PACKET/SOCK_RAW/IPPROTO_RAW: set pkt family
Setting a detected packet family (ipv4 or ipv6) in net_context level
instead in lower layers for AF_PACKET/SOCK_RAW/IPPROTO_RAW type sockets
when sending data.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2023-01-09 19:21:18 +01:00
Marco Peter
ec3857dbcf drivers: flash: stm32: Use consistent log priorities
Any error erasing the flash might want to log
the event with "ERROR" priority.

Signed-off-by: Marco Peter <marco.peter@joylab.ch>
2023-01-09 19:19:49 +01:00
Flavio Ceolin
24cb520698 timer: hpet: Remove deadcode
Move hpet_int_sts_set to inside HPET_INT_LEVEL_TRIGGER guard.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-01-09 12:07:28 -05:00
Gerard Marull-Paretas
a6575e5834 drivers: regulator: npm6001: add support for BUCK1/2 disable
BUCK1/2 are defined as "always on" regulators, however, there is a
special override register that allows to turn them on/off.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-09 16:19:09 +00:00
Gerard Marull-Paretas
7feb008c85 drivers: regulator: common: allow to specify on by default
Some regulators are enabled by default, however, such condition cannot
be captured now by the regulator driver API. Refactor
regulator_common_init_enable to regulator_common_init (enable removed,
as it also sets mode) and add a new argument to specify such condition.
With this change, regulator_disable() and regulator_is_enabled() work as
expected without a first call to regulator_enable().

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-09 16:19:09 +00:00
Raul Pando
cd1d7e4bb8 drivers: usb: make USB VBUS sensing configurable for STM32 devices
Vbus detection is required by self-powered, with external non-USB
supply, devices to have an operational USB peripheral. The voltage
sensing, when enabled, is performed via a designated pin (PA9 is
the most common).

For greater details see section 2.6, ST application note AN4879.

Signed-off-by: Raul Pando <raul.pando@bytegrity.co.uk>
2023-01-09 15:26:21 +00:00
Erwan Gouriou
079470be02 drivers: clock_control: stm32: Fix HSI48 oversights
Take into account HSI48 when computing susbys rate.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 14:01:28 +00:00
Patryk Duda
09277d44e3 drivers: watchdog: Make SOC reset as an option in counter watchdog
When using watchdog which doesn't support callbacks (e.g. STM32 IWDG)
it's very useful to have counter based watchdog with shorter timeout.
This way we can gather useful information before IWDG resets SOC.

In above case it's usually not desired to reset SOC when counter
watchdog is triggerd, because we can lose information about reset cause.
For example, STM32 can determine if the reset was caused by watchdog.

Another use case for counter watchdog without SOC reset is to detect
slow code paths.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-01-09 10:15:33 +01:00
Guillaume Gautier
3e6c9c40aa drivers: counter: Properly deprecate Kconfig symbols in STM32 RTC driver
Now that both RTC source clock Kconfig symbols are disabled by default,
we invert the ifdef so that in the absence of configuration we still
fall in the LSI configuration.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-01-09 10:14:35 +01:00
Guillaume Gautier
1cbc1c14f0 drivers: counter: Deprecate Kconfig STM32 source clock
Following #50104, properly deprecates old Kconfig symbols concerning
RTC source clock and makes them optional to have them disabled by
default.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-01-09 10:14:35 +01:00
Erwan Gouriou
af0576b7ea drivers: flash: stm32: Remove useless Kconfig
SOC_FLASH_STM32_V1 is not used anymore.
Remove it

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:49:12 +01:00
Erwan Gouriou
cc1601fde7 driver: flash: stm32: Use compat information to select file to build
Now that compatible is directly linked with driver version,
use DT compat based Kconfig flag to build the correct flash driver
version.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:49:12 +01:00
Erwan Gouriou
a934cce35b drivers: flash: stm32: Rename v1 driver into f1x
Instead of introducing a vX driver version, use series name.
With this commit F0, F1, F3, L0 and L1 series are using F1 flash driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:49:12 +01:00
Daniel DeGrasse
29c53f4f6a drivers: adc_mcux_lpadc: add clock setup for RT5xx SOC
Add clock setup code for RT5xx series SOC to LPADC driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-08 19:48:54 +01:00
Erwan Gouriou
c5ab922f50 drivers: hci: stm32wb: Use clock_control driver for clock configuration
Instead of relying on STM32Cube API, use clock_control framework
for clock configuration inside this driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
f3e788e84e drivers: hci: stm32wb: Refactor c2_reset()
In preparation of the introduction of dt configured clock in this
driver, refactor clock related clocks.
- remove start_ble_rf()
- Move  IPCC clock activation in c2_reset()

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
079a43d9f8 drivers: hci: stm32wb: LSE clock configuration not required
As long as LSE clock is set in device tree, configuration will be
done in clock control driver, no need to do it here.
Besides, remove back up domain related code as this is also already
handled in clock_control driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
52b9724a88 drivers: hci: stm32wb: LSI is not an allowed clock for BLE RF.
Remove code related to LSI used as clock source for RF wakeup,
it isn't a valid clock source.
Also don't disable LSI when LSE is selected.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
f1dfeff282 drivers: hci: stm32wb: Don't mess with RTC Clock source
No reason to update RTC clock source in this driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Aaron Massey
c4be38dec1 fuel_gauge: sbs_gauge: Enable MFR ACC write
Update the SBS Gauge driver that implements the fuel_gauge API to implement
a set_property function allowing the writing of an SBS word to the
manufacturer access register per the SBS spec.

Includes an update to the SBS Gauge emulator and SBS fuel gauge tests to
weakly verify the code runs.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-01-08 19:48:12 +01:00
Aaron Massey
c0762d003a fuel_gauge: Implement sbs gauge read for mfr acc
Implement and weakly test fetching the manufacturer access word from an SBS
compatible fuel gauge.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-01-08 19:48:12 +01:00
Chris Wilson
18d47316ed drivers: clock_control: esp32: fix cpu_freq divisor typo.
Current divisor is 10000000 (should be 1000000).

For example, ESP32_CLK_CPU_240M / 10000000 == 24 MHz (incorrect).

Signed-off-by: Chris Wilson <christopher.david.wilson@gmail.com>
2023-01-05 12:43:17 +01:00
Dino Li
5bcd47f9b9 espi: it8xxx2: make sure h2ram offset is configured correctly
This change for addressing the below symptoms.
Two FW images have different h2ram offset settings.
Jumping to each other will cause offset setting errors.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-01-04 18:41:29 +00:00
Dino Li
02578cb834 it8xxx2/espi: protect clear OBF request
At default, IBF (input buffer full) interrupt status will be cleared
after reading keyboard data input register (KBHIDIR) in ISR.
For request to clear OBF (output buffer full), we need to enable clear
mode. In the mode, IBF status cannot be cleared by reading KBHIDIR
register. It means that if AP output data to 60h/64h port during the
mode enable, IBF interrupt will keep triggering until the watchdog is
reset. This patch addresses this issue.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-01-04 18:40:55 +00:00
Mahesh Mahadevan
3f38b011c3 drivers: counter: Update NXP LPC RTC for wakeup source
Add support to wakeup from low power modes

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-04 11:03:42 -06:00
Mahesh Mahadevan
db7dedaead drivers: memc: Add device PM to MCUX Flexspi driver
Add Device level power manangement support to the
MCUX FlexSPI driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-04 11:03:42 -06:00
Manuel Arguelles
a7743a49aa drivers: pinctrl: rename S32 to NXP S32
Following updates previously done for other drivers, rename all
occurrences of S32 to NXP S32 to avoid ambiguity.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-04 16:51:38 +01:00
Manuel Arguelles
415131c2e4 drivers: serial: rename S32 to NXP S32
Following updates previously done for other drivers, rename all
occurrences of S32 to NXP S32 to avoid ambiguity.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-04 16:51:38 +01:00
Manuel Arguelles
492e196e8a drivers: gpio: rename S32 to NXP S32
Following updates previously done for other drivers, rename all
occurrences of S32 to NXP S32 to avoid ambiguity.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-04 16:51:38 +01:00
Cong Nguyen Huu
d167d3a29a driver: can: add new filter to match CAN-FD frames
Add support FD frame filter to configure type frame for
each Rx msg to receive corresponding frames (classic, FD frames).

The Bosch M_CAN driver does not support FD frame filter,
so inmplement driver to handle it in software.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2023-01-04 08:18:13 -06:00
Martin Jäger
c8c0879963 drivers: can: mcan: Fix flag overflow for some MCUs
The number of extended filters can be up to 15 for MCUs like the NXP
LPC55Sxx series, so the flags don't fit into uint8_t.

Fixes #53417

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-01-04 14:24:35 +01:00
Sylvio Alves
cff71c8d2b driver: systimer: increase esp32c3 tick resolution
hal_espressif systimer HAL calls are based on 1MHz reference.
This changes systimer driver to allow max clocking reference of 16MHz
and increases soc tick resolution by reducing min delay interval.

This also sets all ESP32-C3 socs to 16MHz hardware cycles reference.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-01-04 14:24:25 +01:00
Gerard Marull-Paretas
24f2c30678 drivers: regulator: shell: fix isdigit() usage
ISO/IEC 9899:1999 (C Standard), §7.4 Character handling <ctype.h>:

In all cases the argument is an int, the value of which shall be
representable as an unsigned char or shall equal the value of the macro
EOF. If the argument has any other value, the behavior is undefined.

So add a cast to unsigned char to make sure we do not trigger UB.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-04 11:19:25 +01:00
Al Semjonovs
211e4d276e gpio: Add driver support for software based gpio debounce
Software based GPIO debounce driver implementation.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-01-04 10:36:00 +01:00
Daniel DeGrasse
64a14a8c1c drivers: memc: introduce driver for APS6408L PSRAM
Introduce driver for APS6408L PSRAM, built on top of the MCUX memc
driver for flexSPI. This driver supports operating the PSRAM in high
speed mode (200MHz or more). Note that in order to support this
PSRAM's alignment requirements, either ahb-read-addr-opt or
ahb-prefetch must be set for the FlexSPI instance.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-04 10:35:25 +01:00
Daniel DeGrasse
41acdc1078 drivers: memc: fix XIP active logic for RT6xx/RT5xx
memc driver was setup to always assume the flexSPI would be in XIP mode,
and skip init. This is only true for the active flexSPI, which is
typically FlexSPI1. Fix this check to only skip init for FlexSPI1

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-04 10:35:25 +01:00
Daniel DeGrasse
0aba1a80b1 drivers: memc: rename flexspi-hyperram driver to flexspi-s27ks0641
Rename flexspi-hyperram driver to flexspi-s27ks0641, and update
function names. This driver is only capable of supporting the
s27ks0641 HyperRAM chip, as the lookup table given in this driver
is specific to the s27ks0641.

Rename the flexspi-hyperram binding to reflect this, to
prevent confusion from users.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-04 10:35:25 +01:00
Tim Lin
c7d9f2ba5f ITE: drivers/i2c: Don't spam NACK error messages
Printing of NACK messages should be set to LOG_DBG to avoid spamming.
When we scan whether there is a target device through I2C, if we use
LOG_ERR, it will frequently print out NACK messages. So it is set to
LOG_DBG in the case of NACK.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-01-04 10:34:46 +01:00
Dawid Niedzwiecki
4a2a512c11 drivers: serial: fix STM32 async uart driver
Fix a bug that causes not handling an IDLE line detection interrupt for
some STM chips, e.g. STM32F412. It impacts the async UART
communication - an information that data have been recieved is lost.

The issue occurs when the IDLE flag is set during handling another UART
interrupt, e.g Transmission complete. The ISR calls uart_stm32_err_check
function, which clears the noise error flag with LL_USART_ClearFlag_NE
without any additional checks. Unfortunately, clearing the noise flag
also clears the IDLE flag for some chips(an read to the USART_SR
register followed by a read to the USART_DR register for STM32F412
clears PE, FE, NF, ORE and IDLE flags), hence the ISR is not called
again for the IDLE event. The IDLE flag is no longer set.

Add checking the noise flag before clearing it.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2023-01-04 10:33:49 +01:00
Sylvio Alves
42b33382f7 driver: clock: esp32: retrieve HW clock from DTS
ESP32 and ESP32-S2 HW clock are tied to DTS clock configuration.
This changes updates the default configuration to retrieve
this information from DTS.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-01-03 17:12:06 -05:00
Daniel DeGrasse
a5994dbd1a drivers: memc: don't relocate MEMC functions unless CONFIG_FLASH=y
Only relocate memc driver when CONFIG_FLASH=y.
CONFIG_FLASH_MCUX_FLEXSPI_XIP previously was dependent on
CONFIG_FLASH, but the scope of this Kconfig has changed.

Due to this, the memc driver now must have two checks, as it should not
relocated when the driver is being used for a memory controller that does
not expose the flash driver interface.

Since the NXP HAL also relocates the underlying FlexSPI driver
using a similar check, it is updated in this commit as well.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-03 12:20:39 -06:00
Antonio Tessarolo
e614a38cbd nxp/imx: fix imx6sx gpio pull up-down configuration
To enable pin pull up/down with the new pinmux APIs bit 13 must be set.

Signed-off-by: Antonio Tessarolo <anthonytexdev@gmail.com>
2023-01-03 10:46:52 -06:00
Erwan Gouriou
4b67b98830 drivers: flash: stm32: Fix CmakeLists issue
Missing "x" prevents to find the right file.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-03 11:18:55 -05:00
Yonatan Schachter
abe50cc929 rpi_pico: Fix DTC warnings concerning the flash
The addresses of the flash and flash controller of the RP2040
SoC were mixed up. There was no clear distinction between the
flash and the flash controller, which was unclear but also
caused a DTC warning.
This commit makes the distinction clearer: The SSI peripheral at
0x18000000 is the flash controller, and the flash itself starts
at 0x10000000. The flash driver and rpi_pico.dts were fixed
accordingly.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2023-01-03 13:37:23 +01:00
Chao Song
96271c77bf drivers: crypto: don't return uninitialized local variable
It should never be intended to return an uninitialized
variable from a function.

Remove the use of the uninitialized variable to fix the bug.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-01-03 13:36:46 +01:00
Hein Wessels
3210541c86 toolchain: gcc: rename popcount to avoid conflict with C++20
The macro conflicts with the C++20 feature std::popcount

fixes zephyrproject-rtos/zephyr#53421

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-01-03 11:06:45 +01:00
Francois Ramu
fd9902be2d drivers: adc: stm32g4 also have a shared IRQ for ADC instances
The adc1 & 2 of the stm32g4 devices share the same irq

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2023-01-03 11:02:34 +01:00
Erwan Gouriou
cbef00587b drivers: flash: stm32: Rename _l5_u5.c driver to _l5x.c
This will simplify addition of new series that share the same driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-03 11:01:44 +01:00
Mikhail Siomin
d4f65e4031 mcux: flexcan: fixes the race condition
Since the FLEXCAN_TransferSendNonBlocking() function has
read-modify-write operations on global resources, then
if interrupts are enabled and/or if there is more than
one thread with a different priority, threads with
a lower priority can overwrite global resource changes
made by higher priority threads.
Fixes #52673.

Signed-off-by: Mikhail Siomin <victorovich.01@mail.ru>
2023-01-03 11:01:31 +01:00
Oliver Barta
e4fcb32451 drivers: pwm: rpi_pico: fix setting of cycle count per period
pwm_set_wrap() sets the TOP value, not the number of cycles.
Counter will run from 0 to TOP inclusive, generating TOP + 1 cycles.
To get n cycles, we need to set TOP to (n - 1).

The wrong setting made it impossible to achieve 100 % duty cycle, as
there was always one extra cycle.

Fixes: 7e0fff24c7 ("drivers: pwm: add pwm driver for rpi_pico")
Signed-off-by: Oliver Barta <o.barta89@gmail.com>
2023-01-02 13:03:46 +01:00
Carlo Caione
d4c7f04a41 cache: kconfig: Reorder and fix entries
The general Kconfig is at the moment a bit messy. Reorder and fix it.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-12-30 10:53:22 +00:00
Gerard Marull-Paretas
4d9b6c4e2e drivers: gpio: sx1509b: add multi-instance support
The driver only supported one instance. Update it to support multiple
instances.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-28 18:47:25 +01:00
Mizuki Agawa
687d1f0ae5 drivers: sensor: Add support ICP10125 pressure and temperature sensor
Product Homepage:
https://invensense.tdk.com/products/1-axis/icp-10125/

DataSheet:
https://3cfeqx1hf82y3xcoull08ihx-wpengine.netdna-ssl.com/wp-content/uploads/2021/04/DS-000329-ICP-10125-v1.1.pdf

Testing Environment:
STMicroelectronics NUCLEO-F401RE

Signed-off-by: Mizuki Agawa <agawa.mizuki@fujitsu.com>
2022-12-28 10:44:16 +01:00
Dennis Wang
357c6dba45 driver: i2c: Fix Controller Initialization
Change Summary: The TX/RX FIFO was not flush on initialization thus
causing bad transactions. Thus, we need to flush the FIFO, and
according to Synopsys DW I2C spec, we can flush TX/RX FIFO by clearing
the enable bit. This is verified with our own I2C test on the SoC with
Synopsys DW I2C IP.

Signed-off-by: Dennis Wang <dennisjw@fb.com>
2022-12-28 10:43:34 +01:00
Jay Vasanth
c7e0d727d7 drivers: clock: Microchip XEC clock driver add MEC15xx support
Add support for Microchip MEC15xx to the XEC clock control driver.
MEC15xx 32KHz clock support uses the same 32KHz source for both the
PLL and peripherals. MEC152x does not include the PCR clock monitor
present in MEC172x.  MEC15xx and MEC172x support internal silicon
oscillator, parallel and single ended crystal inputs, and the
32KHZ_PIN input. MEC152x supports fall back to internal silicon
OSC when VTR and 32KHZ_PIN are turned off. Therefore in MEC152x the
internal silicon oscillator can only be disabled if using an external
32KHz which is always on. For MEC152x the driver will only use the
PLL source clock device tree value.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-12-28 10:43:03 +01:00
Jay Vasanth
ed52729a4b drivers: clock: Microchip MEC172x clock control driver support all modes
Fix Microchip XEC clock control driver single-ended XTAL2 pin
initialization. Add support for external 32KHZ_IN pin as a
clock source including PINTRL to switch the GPIO to 32KHZ_IN
function. Add device tree option to disable internal silicon
oscillator if it is not required by the configuration. Add
device tree tuning options based on crystal and board layout.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-12-28 10:43:03 +01:00
Marcin Szymczyk
6e5f432eee drivers: serial: nrfx: ifdef optional baudrates
Some baudrates are not supported in certain SoCs.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-28 10:38:09 +01:00
HaiLong Yang
2b75aa1f8d drivers: adc: gd32: adc gd32l23x series
gd32 adc support gd32l23x series.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2022-12-28 10:37:52 +01:00
HaiLong Yang
2feac2a0f0 drivers: clock_control: gd32: add gd32l23x series
gd32 clock_control support gd32l23x series.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2022-12-28 10:37:52 +01:00
HaiLong Yang
83f38bd52a drivers: pinctrl: gd32_af: add gd32l23x series
gd32_af pinctrl support gd32l23x series.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2022-12-28 10:37:52 +01:00
Gerard Marull-Paretas
ea7293e464 drivers: regulator: shell: fix printing of first voltage
The first supported voltages was not printed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 16:50:36 +00:00
Francois Ramu
b7266f2b26 drivers: adc: stm32 driver for the stm32U5 configuration for the ADC4
The ADC4 requires particular sequencer configuration.
Clean section that are not used for the configuration.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-27 15:33:06 +01:00
Francois Ramu
847338baa8 drivers: adc: stm32u5 adapt resolution range for ADC1 and ADC4
Adding the possible 6 bit resolution format for the ADC4
of the stm32U5 serie.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-27 15:33:06 +01:00
Francois Ramu
ddd7047b29 drivers: adc: stm32 driver for the stm32U5 instance 1 or 4
Depending on the ADC instance, internal channels
temperature sensor or vbat differ.
That must be adapted so that each internal channels
of ADC4 are operational.
ADC4 is using CommonChannel config for the Sampling time.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-27 15:33:06 +01:00
Marin Jurjević
b99b66fba2 drivers: modem: gsm: fix RSSI check condition
Fixes invalid condition introduced in #48533 when FSM implementation
was added.

Signed-off-by: Marin Jurjević <marin.jurjevic@hotmail.com>
2022-12-27 15:32:07 +01:00
Gerard Marull-Paretas
2c9a9c3671 drivers: regulator: shell: refactor shell
- Refactor the regulator shell so that it exposes all regulator APIs
- vset/iset commands allow to specify a single value (equal min/max) or
  a range
- Voltage/current input is now more user friendly, e.g. user can specify
  units and decimals: 3.3v, 200mv, -4mv, etc.
- Reported values are also printed in a more user friendly way, e.g.
  1800000 uV will be printed as 1.800 V.
- Added new command to list supported voltages

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 13:12:55 +01:00
Gerard Marull-Paretas
5ec95ef35e drivers: regulator: npm6001: add support for get_mode
Allow to query operating mode on each BUCK converter (PWM or
Hysteretic).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 13:12:55 +01:00
Gerard Marull-Paretas
1ca1f25918 drivers: regulator: add get_mode API
Add a new API to query the configured regulator mode. Updated fake
driver and API tests.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 13:12:55 +01:00
Gerard Marull-Paretas
fbba106a23 drivers: regulator: apply initial mode
Apply initial mode (regulator-initial-mode) as part of the
regulator_common_init_enable call. Update tests to cover this change.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 13:12:55 +01:00
Gerard Marull-Paretas
6f4c019312 drivers: regulator: common: remove redundant cast
Unlike in C++ code, explicit casts from void* are not needed, so remove
them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 13:12:55 +01:00
Quang Bui Trong
17d86aed80 drivers: watchdog: add support for NXP S32 S32ZE
Add driver shim for the NXP S32 SWT module.

Signed-off-by: Quang Bui Trong <quang.buitrong@nxp.com>
2022-12-27 10:36:42 +01:00
Guillaume Gautier
ba9636027e drivers: i2c: Fix clock value for STM32 I2C
If present, get the clock value for STM32 I2C from the clock source defined
in the dts.
Otherwise, use pclk.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-12-24 16:58:54 +01:00
Guillaume Gautier
f8f77e456b drivers: i2c: Use domain clock support macro for STM32 I2C
Add support of STM32_DT_INST_DEV_DOMAIN_CLOCK_SUPPORT to condition the
configuration of an source clock for STM32 I2C.


Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-12-24 16:58:54 +01:00
Guillaume Gautier
16a6520278 drivers: i2c: Use device tree instance for STM32 I2C driver
This commit modifies the way we define the I2C driver by using device tree
instance macros instead of node label names.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-12-24 16:58:54 +01:00
Marek Matej
937ea00e7a drivers: adc: esp32: Add support for single-shot conversion
Allow single-shot adc conversion on all supported targets.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2022-12-23 23:45:05 +00:00
Erwan Gouriou
56d93e3fef drivers: usb: stm32f1: USB clk prescaler config done in clock_controller
Now that USB clock prescaler is done is clock_control driver.
Remove similar part in USB driver.

Note that behavior is different: it is now up to the user to provide
the proper configuration.
Add a warning during the transition period.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-22 14:43:26 +01:00
Erwan Gouriou
961e4303a7 drivers: clock_control: stm32f1: Configure USB prescaler
On STM32F1 series, configure USB(/OTGFS) prescaler based on DT.
When prescaler is set, PLL output clock is not divided.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-22 14:43:26 +01:00
TOKITA Hiroshi
1690326268 dts: bindings: dma: gd32: split gd,gd32-dma-v1 for support F4xx feature
Split gd,gd32-dma-v1 from gd,gd32-dma to support F4xx specific features.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-22 13:43:49 +01:00
TOKITA Hiroshi
498ef65242 dts: bindings: gd32-dma-base: add gd,mem2mem property
Add `gd,mem2mem` property to indicate the DMA controller supports
memory to memory transfer.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-22 13:43:49 +01:00
TOKITA Hiroshi
ad055bd5fc drivers: dma: dma_gd32: Use dma_slot for peripheral request
Use dma_slot for peripheral request instead of linked_channel.
This is a more suitable usage as described in dma_config.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-22 13:43:49 +01:00
Dominik Ermel
db34adf9c3 mgmt/mcumgr: Standardise MCUmgr Kconfig names
Standardise Kconfig options for MCUmgr.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-12-22 12:36:34 +01:00
Emilio Benavente
39762716d4 boards: arm: rtxxx: moving the instances FLASH_MCUX_FLEXSPI_XIP
This Kconfig is moved to the soc level since it determines
the flexspi clock initialization for XIP.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2022-12-22 11:07:08 +01:00
Fabio Baltieri
551c632ac4 drivers: espi: enable ESPI_EMUL automatically
Enable ESPI_EMUL automatically based on the corresponding devicetree
compatible.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-12-22 11:06:18 +01:00
Daniel DeGrasse
21c4957cde drivers: gpio: fix gpio-reserved-ranges handling in MCUX iGPIO driver
Fix handling of gpio-reserved-ranges within MCUX iGPIO driver, to ensure
that the configuration IDX will be correctly calculated for pins where
multiple reserved ranges are present on the GPIO controller

Fixes #52506

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-12-22 11:05:52 +01:00
Lukasz Mazur
f7ab9a8c52 pinctrl_stm32: GPIO output info in Z_PINCTRL_STM32_PINCFG_INIT
Added information about pin output direction into
Z_PINCTRL_STM32_PINCFG_INIT if output_low or output_high is provided.
GPIO output flag is set in configuration struct and this will end up
being loaded into MODE register. Because of that it is no longer
required for pinctrl_configure_pins() to set MODE register value for
GPIO input/output.
Fixes #53141.

Signed-off-by: Lukasz Mazur <lukasz.mazur@hidglobal.com>
2022-12-22 11:00:45 +01:00
Erwan Gouriou
46378b7ff2 drivers: clock_control: stm32: Use zephyr functions for bit operations
Use builtin functions for bit operations to increase readability.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-22 10:58:27 +01:00
Declan Snyder
f2e0ac5c58 drivers: uart_mcux_flexcomm: Add runtime configure
Add uart_configure and uart_config_get functionality to
MCUX flexcomm driver to be able to dynamically configure
flexcomm uart at runtime.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-12-21 09:38:33 -06:00
Pawel Czarnecki
d45cd9afea drivers: eth: gecko: fix GPIO configuration
This fixes errors in samples/net/sockets/big_http_download for SiLabs
platforms.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-21 23:32:57 +09:00
TOKITA Hiroshi
bafbc75270 drivers: gpio: sifive: Reset iof_en and iof_sel on init
If the bootloader changes iof_en/iof_sel settings before zephyr launching,
GPIO does not behave correctly.
These values should be 0 initially, Initialize to 0 at GPIO initialize.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-12-21 12:19:27 +01:00
Mulin Chao
271b306b2d driver: uart: npcx: add missing tx/rx interrupt enabled checks
When checking if any UART TX/RX IRQs are pending, the driver should also
consider whether these IRQs are enabled. Or we still get pending status
set even if the related interrupts are disabled.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-12-21 12:19:13 +01:00
Guillaume Gautier
2f4c790a51 drivers: i2c: Use dts to determine i2c clock source for STM32
Add the possibility to use the clock parameter in dts to set the clock
source of I2C devices for all STM32 MCUs.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-12-21 12:17:38 +01:00
Andrzej Głąbek
c984a343af drivers: uart_nrfx_uarte: Prevent re-enabling RX until UART_RX_DISABLED
Fix the driver so that after a call to uart_rx_disable() it does not
allow re-enabling RX until the UART_RX_DISABLED is generated (what
means that the disabling procedure is complete). Otherwise, it is
possible that the RXTO event from the previous RX is handled right
after a new RX is started, and the RX buffer pointer gets corrupted
in the `rx_flush()` function.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-12-21 11:47:34 +01:00
Jun Lin
885695f425 drivers: crypto: SHA: npcx: add support for SHA hardware accelerator
NPCX9 series chips include a SHA hardware accelerator, which supports
SHA256/SHA384/SHA512 hashing and a library (APIs) in the on-chip ROM.
This commit adds the driver support by wrapping the on-chip ROM APIs.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-12-21 10:10:10 +01:00
Erwan Gouriou
66d4c64966 all: Fix "#if IS_ENABLED(CONFIG_FOO)" occurrences
Clean up occurrences of "#if IS_ENABLED(CONFIG_FOO)" an replace
with classical "#if defined(CONFIG_FOO)".

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-21 10:09:23 +01:00
Cyril Fougeray
6b4a4381de drivers: timer: stm32_lptim: load counter after checking for autoreload
Bug occurs when polling kernel uptime. Uptime was suddenly
jumping because lptim counter was counted twice
(from CNT and ARR registers) in case reload happens between
values are fetched.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2022-12-20 22:51:01 +01:00
Pawel Czarnecki
0095eed3a1 dts: uart: silabs: make peripheral-id optional
peripheral-id property should be eventually removed.
For now set it as optional and allow skipping the usage
in UART driver.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Pawel Czarnecki
83b9e53bb6 dts: gpio: silabs: make peripheral-id optional
peripheral-id property should be eventually removed entirely.
For now set it as optional and allow skipping the usage
in GPIO driver.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Pawel Czarnecki
5c3ce5a21f drivers: watchdog: silabs: include zephyr/irq.h
Add missing include

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Mateusz Sierszulski
ea4746fc68 drivers: hwinfo: Fix Gecko hwinfo driver building
do not build hwinfo driver for this board - it does not have support for it

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2022-12-20 22:50:19 +01:00
Paweł Czarnecki
dc153b3bcb drivers: gpio: gecko: stop using deprecated function
change GPIO_IntConfig to GPIO_ExtIntConfig

Signed-off-by: Paweł Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Pawel Czarnecki
067f3766da drivers: gpio: gecko: enable GPIO clock
Enable GPIO clock so that other drivers could
configure their I/O pins

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Pawel Czarnecki
0892293b58 drivers: gpio: gecko: initialize driver earlier
Common GPIO driver needs to be initialized before e.g UART driver
to ensure correct GPIO clock configuration when configuring UART pinout

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Mateusz Sierszulski
d4a6a14926 drivers: counter: Add counter_gecko_stimer driver
This commit adds initial support for Silabs Real-Time counter

Co-authored-by: Filip Kokosinski <fkokosinski@antmicro.com>
Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2022-12-20 22:50:19 +01:00
Filip Kokosinski
9756766892 drivers: serial: uart_gecko: Make driver dependent on pinctrl
This commit adds a series of driver-related changes to
Gecko pinctrl.

Co-authored-by: Mateusz Sierszulski <msierszulski@antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-12-20 22:50:19 +01:00
Filip Kokosinski
6058f4972d drivers: pinctrl: Add Silabs Gecko pin controller
This commit adds initial support for gecko pinctrl driver

Co-authored-by: Mateusz Sierszulski <msierszulski@antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-12-20 22:50:19 +01:00
Pawel Czarnecki
e8d3673c13 soc: arm: silabs: remove soc_gpio_configure wrapper
It would be better to use GPIO_PinModeSet() functions directly
in the drivers.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Erwan Gouriou
11836dd4c1 dts: bindings: usb stm32: Remove deprecated prop 'enable-pin-remap'
Property is deprecated since more than one year.
Remove it and clean up related driver code.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-20 17:05:26 +00:00
Andriy Gelman
2d3493bff0 drivers: adc: Add ADC xmc4xxx drivers
The ADC module has four conversion groups, each one is set up as a zephyr
device. The start-up calibration is initiated globally for all groups
and it is run in each device init function. The ADC module supports post
calibration per group. Post calibration is run automatically after each
group acquires the samples.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-12-20 14:17:23 +01:00
Jakub Dabek
72f626046d memory manager: add region calculation for virtual memory
Add region calculations and implementation of
sys_mm_drv_query_memory_regions to pass calculated regions down
the line.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2022-12-20 07:03:55 -05:00
Jakub Dabek
9531f96627 memory manager: refactor
Separate definitions from function code by creating header file for statics
managment.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2022-12-20 07:03:55 -05:00
Gerard Marull-Paretas
1080afa680 drivers: regulator: add fake driver
Add FFF-based fake regulator driver. This driver can be used as a stub
or mock in testing.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-20 10:15:29 +00:00
Gerard Marull-Paretas
63c005d3b4 drivers: regulator: fix set_current_limit limits check
Only current ranges out of the allowed range have to be skipped.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-20 10:15:29 +00:00
Gerard Marull-Paretas
8c6819120e drivers: regulator: fix set_voltage limits check
Only voltage ranges out of the allowed range have to be skipped.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-20 10:15:29 +00:00
Gerard Marull-Paretas
2b6a211946 drivers: regulator: fix is_supported_voltage return code
If a voltage is not supported we need to return false, not a negative
errno.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-20 10:15:29 +00:00
Gerard Marull-Paretas
491a132369 drivers: regulator: common: fix is_supported_voltage comparison
The edge voltages within a range need to be included as part of the
supported comparison.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-20 10:15:29 +00:00
Jiafei Pan
dc2d6b833a drivers: pinctr_imx: add imx93 support
Add i.MX93 support for pinctrl driver.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-12-20 09:22:40 +01:00
Jiafei Pan
d963900dbd drivers: mcux_ccm: add support for lpuart on imx93
Add support for i.MX93 support for CCM driver.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-12-20 09:22:40 +01:00
Jiafei Pan
9d6bda0ec1 drivers: mcux_lpuart: fix compile warning
Fixed the following compile warnings:
../include/zephyr/sys/util.h:108: warning: "ARRAY_SIZE" redefined
hal/nxp/mcux/mcux-sdk/drivers/common/fsl_common.h:236: note:
this is the location of the previous definition

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-12-20 09:22:40 +01:00
Jiafei Pan
e8d3e7d544 drivers: mcux_lpuart: remove unsed soc.h
soc.h will not used anymore, remove it.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-12-20 09:22:40 +01:00
Sam Hurst
77e1638c3c drivers: usb_c: tcpc: stm32: Add VCONN functionality
Add VCONN discharge functionality to TCPC and driver

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst
a19cf99aa3 drivers: usb_c: tcpc: stm32: Explicitly set the unconnected CC line to OPEN
Explicitly set the unconnected CC line to OPEN, so that it can be
used for VCONN.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst
21f28eacbc drivers: usb_c: tcpc: stm32: Add GoodCRC timer
When operating as a Source, the driver will wait indefinitely for
a GoodCRC message from a Sink. This PR adds a timer to trigger a
no response when a GoodCRC message isn't received.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst
c659f3d8d7 drivers: usb_c: tcpc: stm32: Enable ISR after all UCPD devices initialized
Since all UCPD devices share the same ISR, the interrupt
should be enabled after all UCPD devices are initialized.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst
9750951dd1 drivers: usb_c: tcpc: stm32: Simplify shared ISR detection
Remove unnecessary code used during shared ISR detection

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst
029dc41acb drivers: usb_c: tcpc: stm32: Read UCPD Status Reg for source of IRQ
At system startup, the SYSCFG ITLINE registers might not
indicate an interrupt even though a UCPD interrupt is pending.
This cause the ISR to be called repeatedly without being serviced,
resulting in a system lockup. Reading the UCPD Status Reg instead
of the SYSCFG ITLINE register fixes the issue.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Erwan Gouriou
39e6d62b66 drivers: flash: stm32: Kconfig clean up
FLASH_PAGE_LAYOUT and FLASH_HAS_PAGE_LAYOUT are systematically
selected, whatever the series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-19 18:15:45 +01:00
Andrzej Głąbek
5def5e6edf drivers: nrf_qspi_nor: Avoid using QSPI with HFCLK192M divided by 4
The nRF5340 product specification states that the QSPI peripheral
supports 192 MHz and 96 MHz PCLK192M frequency, thus the default /4
divider for HFCLK192M (from which PCLK192M is derived) can only be
used when the QSPI peripheral is idle. Correct the shim accordingly
and improve related comments.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-12-19 18:11:59 +01:00
BJ Chen
108d516397 ITE: drivers/espi: fix the VW valid flag issue in MAFS mode
Add CONFIG_ESPI_SET_VW_VALID_WITH_LEVEL to fix the VW Valid Bits Issue

fixes #52776

Signed-off-by: BJ Chen <bj.chen@ite.com.tw>
2022-12-19 09:44:31 +00:00
Erwan Gouriou
50473ec0a9 drivers: hwinfo: stm32: Deal with iwdgX and wwdgX instances
On some STM32 series (H7, MP1), iwdg and wwdg have multiple instances.
Due to current driver implementation, these wdg instances were not
checked in the function.

Fixes #53002

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-19 09:22:28 +00:00
Fabio Baltieri
4b48d91cce drivers: usb_dc_stm32: implement usb_dc_wakeup_request
Implement usb_dc_wakeup_request for STM32 USB DC and default to enable
remote wakeup functionality when the drivers is selected.

This allows the device to wake the host up by calling
usb_wakeup_request().

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-12-16 14:46:25 +01:00
Johann Fischer
e939c1d8ae drivers: uhc: add driver for virtual USB host controller
Add support for virtual USB host controller intended for use
together with virtual bus and virtual device controllers.
This driver is not an emulation of any real host controller.
The driver has initial support for handling control and bulk
transfers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-16 13:21:12 +01:00
Johann Fischer
ac649c35fd drivers: udc: add driver for virtual USB device controller
Add support for virtual USB device controller intended for use
by virtual bus and virtual UHC controllers. This driver is not
an emulation of any real host controller.
The driver has initial support for handling control and bulk
transfers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-16 13:21:12 +01:00
Johann Fischer
deb637eb8a drivers: usb: add support for virtual USB bus
Add support for virtual USB bus (UVB) intended for use
by virtual UDC and UHC controllers. UVB is not an emulation
of the USB bus or protocol but a simplified service to connect
a virtual host controller to one or more virtual device
controllers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-16 13:21:12 +01:00
Johann Fischer
da639954c1 drivers: usb: add common layer of UHC API and MAX3421E driver
Add common layer of UHC API and MAX3421E host controller driver.
This implements the bare minimum necessary to communicate with
one peripheral device.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-16 13:21:12 +01:00
Tomasz Leman
af6d827b64 drivers: hda: enable runtime power mgmt in intel hda dma
Enable Zephyr device runtime power management mechanisms in Intel HDA
DMA driver. This allows Zephyr to track usage reference for power domain
gating.

PM action handler is currently empty and will be fill out later.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-12-16 11:03:15 +00:00
Gerard Marull-Paretas
7568749c8c drivers: regulator: initial driver for nPM6001
Add initial driver for the nPM6001 PMIC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-16 11:26:47 +01:00
Daniel DeGrasse
4be1fb81ce soc: arm: nxp: switch imxrt boards to use systick timer unless CONFIG_PM=y
Switch all imxrt boards to use the systick timer by default, and only
enable the GPT timer when using low power modes. This is desirable
because the systick has a higher resolution, but the GPT can run
while the core clock is gated, making it useful for low power modes.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-12-16 09:31:48 +01:00
Tomasz Leman
de1bd1fa04 drivers: gpdma: enable runtime power mgmt in intel gpdma
Enable Zephyr device runtime power management mechanisms in Intel GP DMA
driver. This allows Zephyr to track usage reference for power domain
gating.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-12-15 19:17:21 +01:00
Marek Matej
45d55205db drivers: esp32: temp: CPU die temperature sensor
Support for the measuring the CPU die temperature
for the ESP32 targets S2,C3. The ESP32 support
was ommited due to lack of offset calibration.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2022-12-15 18:21:39 +01:00
Cyril Fougeray
00ceb258d3 drivers: flash: clear stm32 status register errors
In case of errors in the status register and to
unblock Flash, it is advised to clear the errors.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2022-12-15 14:31:37 +00:00
Ryan McClelland
1f489cf03a drivers: usb: stm32: add usb hs ulpi support
Add support for the STM32H7 USB OTG HS and support for the ULPI PHY.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2022-12-15 14:28:00 +00:00
Dinesh Kumar K
f050e18798 drivers: sensor: Add support for grow_r502a fingerprint sensor
Add driver support for grow_r502a fingerprint sensor

Signed-off-by: Dinesh Kumar K <dinesh@linumiz.com>
2022-12-14 18:44:29 +01:00
Gerard Marull-Paretas
539d4aa6e6 drivers: regulator: add common init enable API
Add a new API for drivers that can be called to initialize the regulator
at init time if `regulator-boot-on` or `regulator-always-on` are set.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
9b5152153b drivers: regulator: add regulator_is_enabled
Add a new API to check if a regulator is enabled or not.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
305ce33b77 drivers: regulator: add parent DVS API
PCA9420 PMIC offers of multiple operation states, or DVS (Dynamic
Voltage Scaling). Such states may be automatically changed by hardware
using MODESEL0/1 pins. Certain MCUs allow to automatically configure
certain output pins when entering low power modes so that PMIC state is
changed without software intervention.  This means that application just
needs to configure the voltages for each state using
`nxp,modeN-microvolt`, set `nxp,enable-modesel-pins` in devicetree and
forget about configuring regulators.

This patch introduces a new _parent_ API to expose such functionality in
a vendor agnostic way. Consider this API as experimental for now, until
we have other usecases.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
10ce9684c3 drivers: regulator: fix/improve usage of devicetree properties
Most of devicetree properties for regulator, such as:

- regulator-min/max-microvolt
- regulator-min/max-microamp
- regulator-allowed-modes
- etc.

Are meant to specify limits on what consumers may set. They are **NOT**
meant to describe the hardware capabilities. For example, I could have a
BUCK converter that supports 0-5V output voltage, but my circuit may
only allow working on the 2.7-3.3V range.

This patch reworks the API so that the API class layer manages this
information. This is done by drivers collecting all such fields in a
common configuration structure that is later accessed by the class
layer. This simplifies drivers implementation. For example, if A
consumer calls regulator_set_voltage() with a voltage that is supported
but not allowed, driver code won't be called. Similarly, if a regulator
is configured to be `always-on`, enable/disable driver code will never
be called.

Drivers have been adjusted. PCA9420 mode settings have been removed from
devicetree in this commit as they are not actual modes but PMIC states.
This will be refactored in a follow-up commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
1029a4db6f drivers: regulator: pca9420: some minor improvements
- Remove redundant comments
- Remove internal *_mode functions, as they were only used once.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
8e60c2df0c drivers: regulator: add regulator_mode_t opaque type
Define regulator mode as an opaque type, same as we do in other
subsystems like GPIO (e.g. gpio_flags_t).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
2bd6d50934 drivers: regulator: improve regulator_get_current_limit
- Function returns now the value by reference, similar to voltage
  counterparts.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
8db7e046c5 drivers: regulator: clarify regulator_set_mode interface
Clarify the API for regulators that have the option to set mode
externally, such as PCA9420. Adjust the PCA9420 driver to comply with
the interface.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
3d47b6dfba drivers: regulator: improve regulator_get_voltage
- Function now returns error, value is obtained by reference. This
  allows to propagate potential bus errors.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
b909d0e560 drivers: regulator: drop mode specific APIs
- Mode specific APIs repeat the same functionality offered by non-mode
  specific APIs
- The same functionality can be achieved by the non-mode APIs, since
  they apply to the active mode which can be set using
  regulator_set_mode() first.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
4e8795a8ce drivers: regulator: provide generic regulator_is_supported_voltage
The function can be implemented by using regulator_count_voltages() +
regulator_list_voltage(), so there's no need to defer the job to each
driver.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
c77c3ac7d6 drivers: regulator: improve regulator_list_voltages
- Rename to regulator_list_voltage (it is listing a single voltage)
- Function returns the value via a parameters, so that we can indicate
  wether the given index is valid or not. If a driver doesn't implement
  this call, function returns -EINVAL (as it should be).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
aab28d735f drivers: regulator: drop regulator_count_modes
The regulator_count_modes was an API that was not useful. Unlike with
voltages where the interface guarantees they are zero-indexed, modes can
take an arbitrary identifier. So counting supported modes doesn't
provide any useful information such as if a mode is allowed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
9a73be82c4 drivers: regulator: improve regulator_count_voltages specs
- Interface guarantees that voltage indices start from zero to
  regulator_count_voltages()
- Function always return an unsigned number. If the device doesn't
  implement the API returned value is zero, as expected.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Johann Fischer
95717520bf drivers: udc: do not call driver's dequeue on empty fifo
Do not call driver's dequeue implementation if endpoint fifo
is empty.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-14 12:06:03 +01:00
Johann Fischer
721b8c22d8 drivers: udc_nrf: dequeue instantly when endpoint is not busy
In the case that IN endpoint is not busy there will be
no notification from the HAL driver.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-14 12:06:03 +01:00
Michal Moskal
d46b9bd124 drivers: hwinfo: Implement hwinfo_get_device_id for ESP32-C3
ESP32-C3 uses different fuse addresses for storing the MAC addr,
but the the format is the same.

Signed-off-by: Michal Moskal <michal@moskal.me>
2022-12-14 09:51:44 +01:00
Tom Burdick
603cc27045 dma: Add max block count attribute
Adds an attribute that describes the maximum number of scatter gather
blocks that the DMA will accept. Useful in cases where DMA is used as
the abstraction for moving data around (e.g. SoF audio streams) and
variances of the hardware need to inform decisions about how to use
the DMA API.

Co-authored-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Co-authored-by: Jaska Uimonen <jaska.uimonen@intel.com>
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-12-14 09:51:10 +01:00
Marek Matej
f86a7d2c25 drivers: dac: esp32: Add support for DAC controller
Initial DAC driver for the ESP32/ESP32-S2 SOCs

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2022-12-13 16:29:38 +00:00
Aaron Massey
5e33f833ed fuel_gauge: Fix sbs_gauge err to conform to API
The SBS fuel gauge driver did not return a count of the number of
properties that failed.

Fix this and add a test that verifies the sbs_gauge returns the number of
failing properties as well as a test that verifies a negative return code
if all properties failed.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2022-12-13 11:10:44 +01:00
Huifeng Zhang
12fa8335a3 drivers: gicv3: add zephyr kernel header file
zephyr kernel header file should be included otherwise gcc will report
the warning: implicit declaration of function 'k_aligned_alloc' and
the return value of 'k_aligned_alloc' will be treated as an int type,
which will cause an error on the 64 bits platform.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2022-12-13 18:08:40 +09:00
Ryan McClelland
672a401f20 i3c: add cdns i3c driver
This gives initial support to the cadence i3c controller

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2022-12-12 15:51:16 -05:00
Ryan McClelland
371470d608 i3c: GETMWL and GETMRL may be optionally supported if no settable limit
According to section 5.1.9.3.5 and 5.1.9.3.6 of the I3C Specification
v1.1.1. This CCC is may be optionally supported if the target device
has no settable limit.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2022-12-12 15:51:16 -05:00
Ryan McClelland
b7dc01cd48 i3c: rename is_primary to is_secondary
Rename is_primary to is_secondary. The justification for this is
because it is less likely to have something configured to be
secondary, and the 0 value would be if it is primary.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2022-12-12 15:51:16 -05:00
Erwan Gouriou
428700f709 drivers: gpio: stm32: Keep port clock in input configuration
When pin is configured in input mode, clock is also required.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-12 15:50:21 -05:00
Ravik Hasija
22e2b004df drivers: serial: Add Driver for CDNS UART IP6528
Adding New Serial/UART driver for Cadence UART IP6528.

Signed-off-by: Ravik Hasija <ravikh@fb.com>
2022-12-12 12:19:35 -05:00
Marco Argiolas
3540ae1df9 drivers: sensor: bmm150: fix mispelling
Build error appearing only when enabling CONFIG_BMM150_PRESET_LOW_POWER

Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
2022-12-12 10:54:40 -06:00
Brian Dunlay
491933b185 drivers: wifi: eswifi: Guard net_ctx state change
Previously, a call to set the net_context state was added here to
accommodate a new KConfig scenario that permitted disabling offload
sockets. This code path is used by both local and offloaded sockets.
While it is necessary to update the state of the net_context for a
locally managed socket, setting the net_context for an offloaded socket
is an error, as the net_context is invalid (in fact, it points to a
hard-coded dummy socket), as observed in #52346 and #38544.

A prior commit (a9ac0a88) attempting to remedy the offload socket
scenario removed this line, which resulted in problems for the local
socket scenario. The socket never got updated to the connected state,
and thus was unusable.

Adding this guard allows the eswifi socket to set the socket net_context
only if the socket is NOT offloaded.

Signed-off-by: Brian Dunlay <brian@nubix.io>
2022-12-12 14:55:03 +01:00
Andriy Gelman
a9481bdbe1 drivers: gpio_xmc4xxx: Use interrupt controller for edge/level interrupts
Use the XMC4XXX interrupt controller for edge/level gpio interrupts.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-12-12 10:51:29 +01:00
Andriy Gelman
727e589448 drivers: interrupt_controller: Add XMC4XXX ERU driver
In Infineon XMC4XXX SoCs, gpio interrupts are triggered via an
Event Request Unit (ERU) module. A subset of the gpios are
connected to the ERU. The ERU monitors edge triggers and creates
a SR.

This driver configures the ERU for a target port/pin combination
for rising/falling edge events. Note that the ERU module does
not generate SR based on the gpio level. Internally the ERU
tracks the *status* of an event. The status is set on a positive
edge and unset on a negative edge (or vice-versa depending on
the configuration). The value of the status is used to implement
a level triggered interrupt; The ISR checks the status flag and
calls the callback function if the status is set.

The ERU configurations for supported port/pin combinations are
stored in a devicetree file dts/arm/infineon/xmc4xxx_x_x-intc.dtsi.
The configurations are stored in the opaque array
uint16 port_line_mapping[].

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-12-12 10:51:29 +01:00
Duong Vu Nam
b24f4625f0 arch: support nocache for Cortex-R52
Config NOCACHE_MEMORY depend on ARCH_HAS_NOCACHE_MEMORY_SUPPORT. Enable
ARCH_HAS_NOCACHE_MEMORY_SUPPORT for Cortex-R52 to run NXP S32Z/E with
nocache attibute.

Enable nocache in each driver use it.

Signed-off-by: Duong Vu Nam <duong.vunam@nxp.com>
2022-12-12 10:39:31 +01:00
TOKITA Hiroshi
e965db984d samples: counter: alarm: add support for GD32 boards
Add support for boards that implements the GD32 SoCs.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-12 10:08:12 +01:00
TOKITA Hiroshi
981d88bf7b drivers: counter: add support for GD32 timer
Adds support for GD32 timer

Note: Currently, it is not supporting RISC-V(GD32V) devices.
It needs some work on the interrupt controller first.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-12 10:08:12 +01:00
TOKITA Hiroshi
d38a1fe2fa drivers: clock_control: gd32: timer should recognize with entire id
The timer_ids contain timers that belong to any bus.
So, It should recognize with entire id, not only the CLOCK_ID_BIT part.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-12 10:08:12 +01:00
TOKITA Hiroshi
79451c221a drivers: clock_control: gd32: Correcting timer node detection
DT_COMPAT_GET_ANY_STATUS_OKAY is not suited for the node's existing check.
(This macro returns the stem of the DTS macro name,
 the stem part is not a defined symbol.)
Instead, it should use the DT_HAS_COMPAT_STATUS_OKAY macro.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-12 10:08:12 +01:00
Ravik Hasija
96da6f2234 driver: dw: Use base_addr variable to set dir.
Change Summary:
Update Base addr to set direction to use Aligned IP base address instead
of Port Base Address. Port Base Address + offset to direction register
will set incorrect value for Port B,C & D. For ex: In cases when more than
1 port is configured on the same IP, the DTS node for port B will start
at offset 0xC. Calculating the port using Port Base will yield offset of
PORTB DIR register which is at offset 0x10 from Aligned Base, and as a
result will result in setting DIR register of PORTC instead.

Signed-off-by: Ravik Hasija <ravikh@fb.com>
2022-12-11 20:37:33 -05:00
Ravik Hasija
7ba1925d97 driver: gpio: Fixing Pin Direction Setting.
Change Summary:
Moving the setting of Pin direction before setting/clearing the pin
configured as output for the change to correctly take place.

Signed-off-by: Ravik Hasija <ravikh@fb.com>
2022-12-11 20:37:33 -05:00
Rodrigo Cataldo
bcb3961567 drivers: pcie: late initialization of pcie when PCIe controller is used
For architectures that rely on a PCIe controller (for example, ARM64),
scanning the PCI space will only succeed after the controller has
initialized. Therefore, in the presence of PCIe controller, the PCIe
initialization is bumped to the next system init level.

In the past, drivers like ivshmem would do a late scan of the PCI space
in case the early scan failed; however, the cited commit removed this
feature and ivshmem fails for ARM64. This commit fix this by making the
early scan succeed.

Fixes: a96016d747 ("drivers: ivshmem: Remove unnecessary BDF lookup ...")
Signed-off-by: Rodrigo Cataldo <rodrigo.cataldo@huawei.com>
Co-authored-by: Henri Xavier <datacomos@huawei.com>
2022-12-10 09:47:26 +01:00
Rodrigo Cataldo
0efb0f55b3 drivers: ivshmem: msi.h header only required for ivshmem-doorbell
Only include the MSI header when ivshmem-doorbell is employed, as the
ivshmem data structures already use the same protection for msi-related
structures.

Signed-off-by: Rodrigo Cataldo <rodrigo.cataldo@huawei.com>
Co-authored-by: Henri Xavier <datacomos@huawei.com>
2022-12-10 09:47:26 +01:00
Rodrigo Cataldo
eb4dee62c5 drivers: ivshmem: remove unnecessary platform dependency
The ivshmem code does not use any platform-specific code; therefore,
remove the dependency to the soc interface.

No functional change intended.

Signed-off-by: Rodrigo Cataldo <rodrigo.cataldo@huawei.com>
Co-authored-by: Henri Xavier <datacomos@huawei.com>
2022-12-10 09:47:26 +01:00
Andrzej Głąbek
1a6e26db33 drivers: i2c_nrfx_twi[m]: Make transfer timeout value configurable
Add a Kconfig option allowing users to configure the transfer timeout
value, as the default 500 ms may not be sufficient in specific cases.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-12-10 09:46:45 +01:00
Patryk Duda
1aebcec02f drivers: serial: Reset UART using RCC before initialization
In multi-image environment, after jump to the image we can have UART in
unexpected state. Reset UART to default state to make sure that UART is
initialized properly and won't cause system to crash or hang.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-09 09:43:36 -08:00
Patryk Duda
227ac76828 drivers: counter: Reset timer using RCC before initialization
In multi-image environment, after jump to the image we can have running
timer with interrupts enabled. If interrupt is triggered, the asserts
in the driver can cause a crash.

This patch also adds 'resets' property for all timer nodes.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-09 09:43:36 -08:00
Patryk Duda
3cbbcefb12 drivers: reset: Add support for reset clear register
To deassert reset in STM32MP1 RCC the driver needs to set the bit in
reset clear register.

This patch extends existing implementation to support this type of
register.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-09 09:43:36 -08:00
Patryk Duda
d6f8e9ae5b drivers: reset: Introduce STM32 reset controller
This driver exposes STM32 RCC reset functionality through reset API.

Information about RCC register offset and bit is encoded just like GD32.
The first 5 least significant bits contains register bit number.
Next 12 bits are used to keep RCC register offset. Remaining bits are
unused.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-09 09:43:36 -08:00
Patryk Duda
e4b8dce1e5 drivers: dma: Simplify stm32_dma_check_fifo_mburst() function
This function is responsible for checking if combination of msize,
mburst and FIFO level is allowed. Possible combinations can be found in
ST documentation, eg. Table 36. FIFO threshold configurations, RM0402
9.3.13 FIFO chapter.

Previously there was no 'break' or '__fallthrough' in msize switch which
caused compilation errors. Since we are confirming that combination is
correct, 'break' statements should be used.

Besides of introducing missing 'break' statements, this patch moves
'return false' from switch to the end of the function. This makes code
shorter and easier to understand, because we have only correct
combinations.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-09 11:18:01 +01:00
Filip Brozovic
c60e100ab3 drivers: serial: numicro: fix poll_in function
The poll_in function of the NuMicro UART driver was using the UART_Read
function from the Nuvoton HAL, which is blocking. Replace it with a
non-blocking implementation.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
2022-12-08 18:46:33 +01:00
Filip Brozovic
617aa8cc65 drivers: serial: numicro: use pinctrl instead of hard-coded values
This commit enables the numicro serial driver to configure the UART
pins using the pinctrl API.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
2022-12-08 18:46:33 +01:00
Filip Brozovic
3453a3b247 drivers: pinctrl: add numicro pinctrl driver
This commit adds a pinctrl driver for the Nuvoton NuMicro family
of processors.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
2022-12-08 18:46:33 +01:00
Filip Brozovic
8577bb3e84 drivers: gpio: add driver for nuvoton numicro
This commit adds a GPIO driver for the Nuvoton NuMicro family
of processors.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
2022-12-08 18:46:33 +01:00
Francois Ramu
9c49ee3e48 drivers: dma: stm32u5 dma with resume API function
Add the resume API function for the dma driver of the stm32U5 serie.
That completes the suspend API function.
Controlling the SUSPF bit of the GPDMA CR register is enough
to suspend/resume the channel.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-08 14:59:01 +00:00
Francois Ramu
e5306ed8e3 drivers: dma: stm32u5 do not reset the dma channel when suspending
There is no need to reset the channel else DMA config is lost and
channel should be enabled again in case of resume.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-08 14:59:01 +00:00
Georgij Cernysiov
581a50e000 drivers: usb: stm32: Simplify Kconfig help message
The USB_DC_STM32 help message started to miss some
STM32 MCU families. Overtime, the message will
get bigger if we continue to list family names.
Removed family names to simplify the message and
avoid periodic modifications.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-12-08 09:58:58 +00:00
Maciej Zagrabski
e31c0d0ff4 Revert "drivers: gpio: STM32U5 independant IO supply"
This is already fixed in zephyrproject-rtos/hal_stm32#147.

This reverts commit 5b4ad9127f.

Signed-off-by: Maciej Zagrabski <mzi@trackunit.com>
2022-12-08 09:56:35 +00:00
Patryk Duda
f7fca220ba drivers: bbram: Introduce BBRAM shell
Add 'bbram' command which is very convenient tool for examining and
modyfying BBRAM content.

Examples:

Write one byte:
$ bbram write backup_regs 0x1 0xaa

Write many bytes (starting from 0x13):
$ bbram write backup_regs 0x13 0xa 0xb 0xc 0xd 0xe 0xf 0xaa 0xab 0xac

Read whole BBRAM:
$ bbram read backup_regs

Read many bytes (4 bytes starting from address 0x14 in this case):
$ bbram read backup_regs 0x14 4

Read one byte (from 0x14 address):
$ bbram read backup_regs 0x14

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-08 16:47:09 +09:00
Patryk Duda
e02456a52d drivers: bbram: Introduce STM32 BBRAM driver
STM32 battery-backed RAM is organized in 4 byte registers. Number of
registers can vary between models from 5 to 32 registers.

Usually, the registers are part of RTC. On some variants they are part
of tamper module. On STM32F1 the registers are in separate module. For
now, only backup registers from RTC are supported.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-08 16:47:09 +09:00
Bartosz Bilas
e077fb73ec drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt
`spi_is_ready` function is being deprecated in favor of
`spi_is_ready_dt` so let's replace the old usage in the tree.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-12-07 09:40:23 -06:00
Patryk Duda
a9ed11ab8d drivers: counter: Add __fallthrough in STM32 counter driver
STM32 counter driver uses switch statement in which cases don't end
with break or return intentionally.

Affected switches in counter driver check status of all timer channels
(maximum 4 channels), but the number of channels is not determined
during compilation. In switch, we jump to channel with highest number
and then check other channels with lower numbers.

Compiler can warn about it, so this patch adds information that it was
intentional.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-07 14:26:42 +00:00
Maciej Zagrabski
ec7237c38a drivers: gsm_ppp: replace DT_INST with DT_DRV_INST
Replace error prone DT_INST with proper DT_DRV_INST.

Signed-off-by: Maciej Zagrabski <mzi@trackunit.com>
2022-12-07 10:29:34 +00:00
Lucas Tamborrino
b196edf55d drivers: spi: esp32xx: Fix buffer length for DMA
Fixes #52588

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-12-07 10:13:38 +00:00
Grixa Yrev
4fe862e396 drivers: lpuart: enable rs485 mode
NXP LPUART IP supports rs485 mode when transceiver driver enable
using RTS. Allow setting rs485 mode up via the "nxp,rs485-mode"
dts property. "nxp,rs485-de-active-low" dts property can be used
for set RTS polarity.

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
2022-12-07 10:12:14 +00:00
Francois Ramu
2ed292e1be drivers: stm32: do not enable the HSI48 locally
The HSI48 is enabled by clock control driver.
It is no more done by each driver that requires this clock
However when using rng or sdmmc or bluetooth/ipm or usb,
the HSI48 clock must be present in the DTS.
Add a warning for this particular check but keep the deprecated
HSI48 clock enable : keeping for legacy but to remove later.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-07 10:03:11 +00:00
Francois Ramu
8eb55b3416 drivers: clock_control: some stm32 have a HSI48 fixed clock
For the stm32 devices that have a HSI48 clock,
the driver enables it, like any other fixed clock,
if needed and supported by the serie.
For stm32L0, SYSCFG VREFINT is also required.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-07 10:03:11 +00:00
Michał Barnaś
23a04b8b0a gpio: cleanup the nct38xx driver
Reorganize includes and fix the indentation of code.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-12-06 10:10:36 -05:00
Michał Barnaś
59766b52be gpio: add support for get_config and get_direction in nct38xx
This commit adds support for get_config and get_direction functions
for the nct38xx IO expander family.
Also applies the clang-format changes.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-12-06 10:10:36 -05:00
Michał Barnaś
c11af96135 gpio: fix the nct38xx driver
This commit fixes the comment and adds the missing assignment of
return value from i2c read byte command in the nct38xx driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-12-06 10:10:36 -05:00
Daniel DeGrasse
7d1f435a2a drivers: ipc: Enable messaging unit driver for iMX.RT multicore SOCs
Enable MU messaging unit driver for RT11xx socs.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-12-05 19:54:37 +01:00
Gerard Marull-Paretas
649a8195b3 drivers: regulator: pca9420: refactor mode handling
- Similar to what was done for other parts of the driver, remove any
  register specification from Devicetree (modesel-reg/mask)
- Keep all the information in the driver, and define modes as "numbers",
  e.g. PCA9420_MODE0: 0, PCA9420_MODE1: 1, etc.
- Bindings provide IC defaults now (all modes allowed 0/1/2/3 and
  initial mode set to 0).
- When mode is controlled via the MODESEL0/1 pins (ie directly by an iMX
  MCU using the dedicated PMIC_MODE0/1 pins), the driver will not allow
  to select a mode (it is not possible). This mode is now enabled by
  setting `nxp,enable-modesel-pins` in Devicetree. When enabled, all the
  allowed modes are configured to be selectable via pins. When disabled,
  mode can be set via I2C (using TOP_CNTL3 MODE0/1_I2C fields)

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-05 19:10:55 +01:00
Xinyang Tan
535f5a6c04 shell: support setting help string for each entry in a dictionary command
Add support for setting the help description for each entry in a dictionary
command. Currently the syntax string alone may not provide sufficient
description of its entry. This commit also helps keep the help messages
consistent with existing style.

Signed-off-by: Xinyang Tan <xinyang.tan@delve.com>
2022-12-05 18:40:46 +01:00
Bjarne von Horn
e24e6454e9 drivers: ethernet: stm32: initialization routine for the new driver
Setup has to be adapted, too

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
aa5353a901 drivers: ethernet: stm32: Enable receiving with new driver
Use the new API in the receive method

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
202abc9acc drivers: ethernet: stm32: Transmit frames larger than one buffer
Now, multiple tx buffers can be used to send packets,
so that the packet size can exceed tx buffer size.

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
1a9420af8d drivers: ethernet: stm32: Enable transmitting with new driver
Use the new API in the transmit method

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
ac1821bb21 drivers: ethernet: stm32: Add Error Callback
The new HAL API provides a different error propagation method

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
1771f58a5b drivers: ethernet: stm32: Add transmit callbacks
These callbacks are also used by the stm32cube HAL driver

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
853bca1031 drivers: ethernet: stm32: Add receive callbacks
Callbacks which will be used by stm32cube driver

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
ae87d8c74f drivers: ethernet: stm32: Disable autonegation for new api
As it is not supported

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
ee43d13b77 drivers: ethernet: stm32: Make tx semaphore available for new api
The new HAL API also has a TxCpltCallback, so we need the semaphore too.

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
aa78951016 drivers: ethernet: stm32: Additional structures for new HAL driver
They allow managing the tx and rx buffers from both
driver parts (zephyr and stm32cube)

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
f9158ab5ea drivers: ethernet: stm32: Add Kconfig to select new HAL API
STM32H7X and STM32F4X ETH HAL Drivers now provide a new api.
This commit only adds a new Kconfig option

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
dcec4608d8 drivers: ethernet: stm32: check tx packet size before locking mutex
The transmit mutex is not needed while checking the packet size,
so we acquire the lock after checking the size and
return early if it is too big.

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Mark Watson
5381e0b716 drivers: usb: usb_dc_nrfx: add usbd worker thread name.
I added a thread name to the usbd worker thread.

Signed-off-by: Mark Watson <mwatson@prosaris.ca>

Fixes: #43330
2022-12-05 18:03:39 +01:00
Tomasz Moń
22168bd45c drivers: usb_dc_nrfx: Do not uninit on detach
It is possible for nrfx usbd driver to send NRFX_USBBD_EP_ABORTED during
endpoint disable. The event is passed to event handler registered with
nrfx_usbd_init(). The nrfx_usbd_uninit() removes the registered event
handler, replacing it with NULL. If any event is sent after uninit, the
NULL pointer is executed and device crashes.

Do not uninit nrfx usbd driver on detach so it is possible for the
usb_disable() to disable all the endpoints.

Fixes: 460ca86527 ("drivers: usb_dc_nrfx: Always allow endpoint disable")

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-12-05 15:50:43 +01:00
Henrik Brix Andersen
b4912ea997 drivers: pwm: mcux: ftm: fix pwm capture timer overflow count edge cases
Depending on the timing of the edges of the signal to be captured, a timer
overflow interrupt flag may appear in the same ISR as a channel event (1st
or 2nd edge capture complete) flag. Change the timer overflow math to
compensate the timer overflow count based on whether the channel event
happened before or after the overflow flag occured.

For continuous PWM period captures, only the very first edge of the first
period requires an interrupt to be captured. Subsequent "first edges" are
the same edges as the second edge of the previous period. Depending on the
timing of the captured signal, enabling the 1st edge interrupt in this case
can cause the overflow count for subsequent first edges to be captured at
the wrong point in time.

Fixes: #52452

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-12-05 08:06:44 -06:00
Dylan Hung
f5794923a1 drivers: reset: add Aspeed AST10x0 reset control
AST10x0 series SOCs provide the reset controller through the syscon
hardware block.  The current driver supports the reset line assert,
deassert and status for the hardware IPs embedded in the SOC.  Each
reset line has an ID that can simply map to a bit in syscon registers
RESET_CTRL0_ASSERT (group 0) or RESET_CTRL1_ASSERT (group 1). Write bits
to RESET_CTRL0_DEASSERT or RESET_CTRL1_DEASSERT will clean the
corresponding bits in RESET_CTRL0_ASSERT or RESET_CTRL1_ASSERT
registers.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
2022-12-05 14:36:16 +01:00
Georgios Vasilakis
0bdc2811c2 drivers: entropy: PSA crypto RNG driver default
Enable the PSA RNG driver by default. This option
will only be enabled when BUILD_WITH_TFM is enabled
and a device with the required compatible field
(zephyr,psa-crypto-rng) is defined in the device tree.
When a vendor includes such a device and enables the
ENTROPY_GENERATOR subsystem it is fair to assume
that wants to use the PSA Crypto RNG driver.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
2022-12-05 14:20:52 +01:00
Andriy Gelman
9b43e3ac0f drivers: serial: uart_xmc4xxx: Fix write to fifo with more than one byte
Currently only the first byte was written when pushing more than
one byte into the fifo.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-12-05 11:03:22 +01:00
Daniel DeGrasse
95d8943c69 drivers: regulator: support for regulator mode APIs in regulator shell
Add support for regulator mode related APIs to regulator shell, so that
the user can select new operation modes for the regulator and configure
target voltages

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-12-04 19:56:34 +01:00
Daniel DeGrasse
9d1bcc6126 drivers: regulator: cleanup device_is_ready and atoi usage
Cleanup regulator shell to use strtol() over atoi(), as strtol features
error detection. Remove device_is_ready() checks, and replace them with
NULL checks as device_get_binding() calls device_is_ready() interally

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-12-04 19:56:34 +01:00
Gerard Marull-Paretas
8fb0f3e3f1 drivers: regulator: pca9420: use standard I2C API
The I2C API already provides APIs to read/modify registers, so there is
no need to provide custom wrappers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-02 16:18:05 +01:00
Johann Fischer
1083e61163 drivers: udc: add USBFSOTG UDC driver for Kinetis SoCs
Add USBFSOTG UDC driver for Kinetis SoCs.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-02 12:55:18 +01:00
Johann Fischer
1f11fbc1aa drivers: udc_nrf: do not abuse HAL events for the driver's concerns.
HAL events were also used for the shim driver's concerns
during the prototyping of API. Fix it now and use specific
shim driver events. That also allows new transfers to be
triggered from a single point.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-02 12:55:18 +01:00
Johann Fischer
292951da4b drivers: udc_nrf: implement method to distiguish hal and shim events
Implement method to distiguish hal driver and UDC shim driver events.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-02 12:55:18 +01:00
Johann Fischer
1fa31bbc30 drivers: usb: add new USB device controller API (UDC API)
Add new USB device controller API and nRF USBD controller driver.
The new UDC API brings support for multiple instances and asynchronous
transfer model, transfers use net_buf and store methadata in the
user data area.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-02 12:55:18 +01:00
TOKITA Hiroshi
9f12f2cd51 drivers: display: st7735r: Add rgb-is-inverted property
Set the inverted value of pixel format setting in MADCTL register to
current_pixel_format in display capabilities structure
if rgb-is-inverted enabled.

This make enables support for a module that mismatches the RGB setting
in the MADCTL register and the actual display color format.
(Such as Longan Nano built-in LCD module.)

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-02 11:32:25 +01:00
Jay Vasanth
b15f01ddce drivers: led: Microchip XEC LED driver using BBLED controller
Implement a LED driver for Microchip XEC using the breathing,
blinking LED controller. The driver supports LED on, off, and
blink API's. The BBLED block uses the 32768 Hz clock domain
allowing the module to operate in light and deep sleep states.
Blink frequency is 32768 divided by 256 * (prescale + 1) where
prescale is a 12-bit value. Duty cycle is specified by an 8-bit
value where 0 = full off, 127 is 50%, and 255 is full on.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-12-02 11:31:50 +01:00
Carlo Caione
cc427b4bb0 cache: Fix libraries and drivers
Fix the usage to be compliant to the new cache API.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-12-01 13:40:56 -05:00
Carlo Caione
74e1b1781a cache: aspeed: Rework driver
To be compliant to the new cache API.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-12-01 13:40:56 -05:00
Carlo Caione
189cd1f4a2 cache: Rework cache API
The cache operations must be quick, optimized and possibly inlined. The
current API is clunky, functions are not inlined and passing parameters
around that are basically always known at compile time.

In this patch we rework the cache functions to allow us to get rid of
useless parameters and make inlining easier.

In particular this changeset is doing three things:

1. `CONFIG_HAS_ARCH_CACHE` is now `CONFIG_ARCH_CACHE` and
   `CONFIG_HAS_EXTERNAL_CACHE` is now `CONFIG_EXTERNAL_CACHE`

2. The cache API has been reworked.

3. Comments are added.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-12-01 13:40:56 -05:00
Declan Snyder
b5708e273b drivers: entropy: Fix MCUX CAAM Entropy
Re-enable the CAAM for entropy
now that the HAL driver has been fixed

Job descriptors must be accessed coherently
between CAAM DMA and core.

The M4 Cores still do not work
because of mpu/cache/kconfig arch complications,
disable caam for M4 cores in DTS

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-12-01 17:57:12 +01:00
Ruibin Chang
a56504a434 ITE drivers/pwm/it8xxx2: don't gate pwm clock when set cycle
When pwm_it8xxx2_set_cycles() is called, we disable the pwm clock
at the beginning and enable it at the end, so there is a more than
1ms pwm low pulse when every time changing the cycle. The low pulse
would let some fans go to idle mode, so we don't gate the pwm clock.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-12-01 15:49:37 +01:00
Tomasz Leman
56284d7017 drivers: dmic: add dependency for runtime pm
Adding dependency for runtime power management needed by power domains.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-11-30 17:46:17 -05:00
Tomasz Leman
f659d46e9d drivers: dmic: enable runtime power mgmt in intel dmic
Enable Zephyr device runtime power management mechanisms in Intel DMIC
driver. This allows Zephyr to track usage reference for power domain
gating.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-11-30 17:46:17 -05:00
Tomasz Leman
d9a416f38d power_domain: intel_adsp: code update
This patch contains several small changes to the intel adsp power
domain.

- include missing header,
- replacing sys_write32/sys_read32 with sys_write16/sys_read16 since
  DfPWRCTL is a 16 bit register,
- renaming struct to be more representing what it is,
- passing register address, not a value to the sys_read/sys_write
  functions,
- pd_intel_adsp_init is now returning actual status.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-11-30 17:46:17 -05:00
Peter Maxwell Warasila
55ce3026c9 drivers: flash: stm32l5_u5: refactor flash_stm32_page_layout() for clarity
While diagnosing a problem on the STM32U585 in this function in
flash_stm32l5_u5.c, I had difficulty sussing out the flow of the
function and conditional logic.

This refactor seeks to improve clarity through a simplified flow control
using an early return to short circuit logic on subsequent calls to the
function and slightly more thorough comments.

Tested using tests/drivers/flash on the b_u585i_iot02a and in a
proprietary application and board which uses the STM32U585 and littlefs.

Signed-off-by: Peter Maxwell Warasila <madmaxwell@soundcomesout.com>
2022-11-30 17:30:36 +01:00
Peter Maxwell Warasila
ed3ad75a7a drivers: flash: stm32l5_u5: fix L5/U5 difference in FLASH_PAGE_NB
In flash_stm32_page_layout, the FLASH_PAGE_NB macro is used to set the
page count in the flash layout returned to the caller. On STM32L5
platforms this is defined in stm32l5xx_hal_flash.h to be (FLASH_SIZE /
FLASH_PAGE_SIZE). However, on STM32U5 platforms the macro is defined in
the soc headers (such as stm32u585xx.h) define the macro as
(FLASH_BANK_SIZE / FLASH_PAGE_SIZE). This results in the flash layout
only reflecting the first bank on STM32U5 platforms with the maximum 2
MB of flash.

This commit resolves this discrepancy by directly calculating the number
of pages by dividing FLASH_SIZE by FLASH_PAGE_SIZE.

Tested on a proprietary board using the STM32U585 which mounts a
littlefs partition in the last 256 kB of its 2 MB of flash.

Signed-off-by: Peter Maxwell Warasila <madmaxwell@soundcomesout.com>
2022-11-30 17:30:36 +01:00
Gerard Marull-Paretas
a29bdc262c drivers: regulator: drop async enable
Drop the async enable function. This feature is rarely/never used,
complicates driver design, and doesn't really follow the sync/async API
design/naming used in other areas. In the future we can introduce
regulator_enable_async if needed, with support from the driver class (no
onoff). Note that drivers like PCA9420 did not implement any
asynchronous behavior. regulator-fixed implemented in the past
asynchronous behavior using work queues, an overkill for most GPIO
driven regulators. Let's keep things simple for now and extend the API
when needed, based on specific usecases.

In the current implementation, reference counting is managed by the
driver class. \isr-ok attribute is dropped, since calls are potentially
blocking. Note that drivers like PCA9420 already violated such rule.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-30 15:49:30 +01:00
Gerard Marull-Paretas
e0c8de1e39 drivers: regulator: fixed: simplify implementation
Remove regulator-fixed-sync specialization, create a single driver that
is always synchronous. The asynchronous part is rarely/never used, so
let's keep things simple for now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-30 15:49:30 +01:00
Sylvio Alves
831ecd4096 driver: wifi: esp32: disable optimization by default
Do not set wifi optimizations by default in order
to free up IRAM room region. In case higher throutput
is necessary, one can enable this flags to optmize it.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-11-30 13:40:10 +01:00
Sylvio Alves
b7b8830c7c driver: wifi: esp32: remove build warning
Removes strnlen implicit declaration when newlibc
is enabled.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-11-30 13:40:10 +01:00
Manuel Arguelles
4fbf940019 drivers: counter: support NXP S32 System Timer Module
NXP S32 System Timer module includes a 32-bit count-up timer and four
32-bit compare channels with a separate interrupt source for each
channel. The timer is driven by the module clock divided by an 8-bit
prescale value.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-11-30 11:29:39 +01:00
Jay Vasanth
38ad230aec drivers: pinctrl: Microchip XEC PINCTRL add invert pin
Microchip XEC GPIO pins support inverting the output of
alternate pin functions. This feature may be useful for
those peripherals that do not implement output inversion
in the peripheral. GPIO control register pad input and
parallel input register values are not affected by the
function output invert feature. GPIO interrupt detection
of an output is inverted if the invert polarity is enabled.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-11-30 11:29:22 +01:00
Jonas Otto
d3415e2ce1 drivers: spi_mcux_lpspi: fix baudrate change when switching devices
When configuring an LPSPI module for a new device with different baud rate,
the module needs to be disabled for the baud rate change to take effect.
This adds the necessary call to LPSPI_Enable before initializing the
module.

Fixes #51177

Signed-off-by: Jonas Otto <jonas@jonasotto.com>
2022-11-30 11:28:22 +01:00
Gaël PORTAY
ffed8388e7 drivers: spi_context: fix some LOG_DBG warnings
This casts the char * buffers to void * before giving them to the
LOG_DBG function to fix a warning at runtime.

Signed-off-by: Gaël PORTAY <gael.portay@gmail.com>
2022-11-29 22:52:40 -08:00
Adrian Bonislawski
a45caf868f drivers: dai: add Intel HDA dai
add Intel HDA DAI driver
Long device list in dtsi needs to be refactored in the future

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-11-29 19:42:33 -05:00
Ederson de Souza
9c55195235 drivers/mm: Only remap unused RAM on Kconfig on Intel ADSP MTL
Remapping by default can confuse things that dynamically manage RAM,
such as newlib heap - since unused memory will be powered off by
default. So this patch shields this behaviour behind a non-default
Kconfig.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-11-29 18:03:09 -05:00
Gerson Fernando Budke
e68f568f86 drivers: counter: Enable support to stm32l5 mcu
Add driver entries to enable stm32l5 rtc driver.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2022-11-29 13:40:27 +00:00
Georgij Cernysiov
2b0727d550 drivers: clock_control: stm32h7: add PLL2 support
Adds PLL2 support.

The driver configures and enables PPL2 when
it is enabled in the DTS.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-11-29 11:54:52 +01:00
Gerard Marull-Paretas
a78bdbce89 dt-bindings: regulator: pca9420: reorganize headers/macros
pca9420_i2c.h has neem remamed to pca9420.h (device only has I2C, so
it's kind of redundant to have i2c in the header name).

pmic_i2c.h was again not generic but designed specifically for PCA9420.
All its macros have been renamed, s/PMIC/PCA9420, and moved to the
pca9420.h header.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
709f7c88f7 drivers: regulator: pca9420: store common config in parent device
Store all common configuration settings in the parent device. This
change should save ROM, since it avoids duplication.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
9219d3d2b5 drivers: regulator: pca9420: fix VIN current limit setting
The driver had a conceptual issue regarding current limitation. PCA9420
is able to limit the current flowing through VIN, ie input current. This
is a global setting, not individual to each regulator. This patch
creates a new DT property: nxp,vin-ilim-microamp to specify such limit.
It is applied when the device is initialized.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
dcd63d288f drivers: regulator: pca9420: refactor voltage range handling
Voltage ranges were hardcoded in Devicetree, however, things can be
significantly simplified by using the recently introduce linear ranges
API. All values are now computed using information stored in the driver,
so there is no need to store any lookup table in ROM. Code should now
both be faster in average and consume less ROM.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
1caedf12dd drivers: regulator: pca9420: do not expose registers in DT
Regulator registers were set for each BUCK/LDO in DT, likely because of
the way the devices were instantiated. When using a generic iterator,
ie, DT_INST_FOREACH_CHILD, there's no way to differentiate the child
being _parsed_. Since instantiation happens now based on child node
names, we are able to know which registers each devices gets assigned at
the driver level. This greatly simplifies Devicetree, and it actually
removes information that is not strictly hardware description from it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
9235ab90cc drivers: regulator: pca9420: remove unused modesel offset
The property was not used, and not defined in the bindings either.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
f4713fb7fb drivers: regulator: pca9420: fixed child instantiation
Right now the PCA9420 driver instantiates by iterating over all
children. This is somewhat problematic, for a few reasons:

- Since instantiation is generic code, we're forced to put internal
  details on Devicetree, e.g. reg-masks. After this change, this will no
  longer be necessary.
- We take all children, regardless of what is defined in DT.

While we have no means to validate Devicetree node names as in Linux
dtschema, this approach allows us to have per-child specific
initialization code. This is somewhat similar to the Linux approach.

Note: nodelabels have been removed, since they were not used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
9f1d25a2d1 drivers: regulator: pca9420: do not use DT_PROP_OR for booleans
DT_PROP() will evaluate to 0 when a boolean property is missing, so
there is no need to use DT_PROP_OR(..., false). Using _OR also has
side-effects, such as no errors when property is not defined in the
bindings.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
f89405ca8d drivers: regulator: pca9420: use standard regulator-min|max-microvolt
regulator.yaml provides now standard properties for minimum/maximum
voltage.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
d4566ce2b6 drivers: regulator: pca9420: sort includes
Sort includes: stdc, Zephyr.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
ac7c8c810a drivers: regulator: pca9420: fix voltage|current_range types
- voltage/current needs to be stored using int32_t
- reg_val is a 8-bit unsigned register value
- Also removed __packet, it is not required here

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
7569de6af9 drivers: regulator: pca9420: rename some internal structs/funcs
Rename some internal structures/functions to clearly indicate they
belong to the PCA9420 driver.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
af590c4500 drivers: regulator: pca9420: improve instantiation code
- Constify configuration and curr. limits/voltage range/modes arrays
- Use common argument names: node_id, inst to make code more readable
- Improve macro names to make things clear

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Francois Ramu
acd582e456 drivers: flash: stm32 ospi flash driver for stm32l4plus mcus
Adaptation of the ospi nor flash driver for stm32l4 plus
where the peripheral is slighty different.
Configure the OSPIM peripheral for mcu embeddingthis peripheral
in front their octospi instances.
Add LOG for read access command like for write access.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-29 09:32:22 +00:00
Patryk Duda
b9f495282e drivers: flash: Do not unlock CR at the end of initialization
Unlocking CR at the end of initialization was added in commit
a9183cd518. It was probably copied
from previous flash driver implementation.

Unlocking and locking CR in write and erase functions was added in
commit 6e4cdb0c99. Since we always unlock
the register before writing or erasing, and lock it after the operation
is finished, there is no need to unlock it after initialization.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-11-29 09:50:28 +01:00
Arsen Eloglian
3659c2db4b intel_common: clean up & rename cavs_* to adsp_*
ADSP common definitions has been fixed
and changed from CAVS_* to  ADSP_*

Signed-off-by: Arsen Eloglian <ArsenX.Eloglian@intel.com>
2022-11-28 17:45:20 -05:00
Evgeniy Paltsev
d2488d2160 ARC: control shared (common) interrupts via IDU
Control shared interrupts enabling/disabling via IDU.
With that we can easily enable and disable them for all cores
in one place.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2022-11-28 17:44:54 +01:00
Jaska Uimonen
f13b6bc125 drivers: dai: intel: dmic: fix periodic start
This fixes an issue with periodic_start feature that is only
present in newest dmic hw (starting from ACE).

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-11-28 17:43:58 +01:00
Andrei Emeltchenko
c0440c4706 drivers: eth_e1000: Allow several instances
Allow to enable several e1000 instances.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-28 13:19:51 +01:00
Andrei Emeltchenko
54bb10cf20 drivers: eth_e1000: Remove zero hadrcoded TDBAH, RDBAH
Though at the moment the driver works with high registers initialized
to zeroes it does make sense to do it right way. The double 16 shifts
are used to suppress warnings with 32 bit shift.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-28 13:19:51 +01:00
Mulin Chao
0893ca8c2f driver: gpio: npcx: correct the usage of npcx voltage flags
In npcx ec series, two detection levels, 3.3V (default) and 1.8V are
supported during gpio configuration. But the current implementation
always selects default detection level whether NPCX_GPIO_VOLTAGE_1P8 is
set. This PR is a fix for this issue.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-11-28 09:56:33 +00:00
Attie Grande
5f9cab9e80 drivers: flash: sam0: Resolve write issues in the first row
Previously, while writing close to the start of flash (i.e: in the first
row), the write was never committed - due to zero being used as the
"empty buffer" marker.

This patch also incorporates some performance improvements, as well as
observing any errors reported by `flash_sam0_commit()`.

Fixes #52309

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-11-28 10:49:09 +01:00
Dawid Niedzwiecki
2d93f03c25 driver: gpio: rt1718s: Add RT1718S GPIO driver
RT1718S is an i2c-based TCPC chip that supports 3 additional GPIOs.
The pins can be used for USB-C operations e.g. handling FRS, but they
can also work as usual GPIOs.

Add a driver for the RT1718S GPIO and a handler for an alert signal from
the chip. The handler reads the alert register once asserted and calls
the GPIO interrupt handler if needed(Vendor-defined alert).

gpio_rt1718s.c file and "richtek,rt1718s" node collect common properties
and data for all RS1718S functionalities. The file can be extended for
TCPC driver. rt1718s.h file also defines inline functions with i2c
operations common for all drivers. The common header and source files
can be moved to tcpc directories once the tcpc driver is added since it
is the main functionality.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2022-11-28 10:48:53 +01:00
Brian Dunlay
a9ac0a884e drivers: wifi: eswifi: Offload sockets regression
This change fixes a regression from commit 1cbc0acd.

Socket offload uses a dummy socket context, and setting
the socket state in this dummy context is invalid.

Fixes #52317

Signed-off-by: Brian Dunlay <brian@nubix.io>
2022-11-28 10:48:10 +01:00
Armando Visconti
20ea61be35 drivers/sensor: lsm6dso: Add drdy_pulsed property in DT
Add drdy_pulsed property in Device Tree in order to select how
data ready irq should behave (either pulsed or latched mode).
Moreover change/fix the API called to set drdy irq mode.
(fix #51944)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2022-11-25 20:03:21 +01:00
Artur Lipowski
c88e157c46 clock_control: stm32: Add extern C to allow including from C++.
The stm32_clock_control_init is needed for implementation of custom
pm_state_exit_post_ops.

Signed-off-by: Artur Lipowski <Artur.Lipowski@hidglobal.com>
2022-11-25 20:03:10 +01:00
Tomasz Moń
12e244b184 drivers: usb_dc_native_posix: Allow endpoint disable after detach
There is no reason to prevent endpoint disable after detach.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-11-25 20:02:42 +01:00
Tomasz Moń
460ca86527 drivers: usb_dc_nrfx: Always allow endpoint disable
There is no point in allowing endpoint disable only when device is
attached and ready. Remove the pointless check as it is actually harmful
and prevents endpoints disable on USB stack disable.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-11-25 20:02:42 +01:00
Théo Battrel
e458f5aae6 Bluetooth: Use Zephyr standard log system instead of bluetooth/common/log
The `bluetooth/common/log.h` and `bluetooth/common/log.c` files have been
removed. Files that were using them have been updated to use
`zephyr/logging/log.h` instead.

Those replacement have been done consequently:
- `/BT_DBG/LOG_DBG/`
- `/BT_ERR/LOG_ERR/`
- `/BT_WARN/LOG_WRN/`
- `/BT_INFO/LOG_INF/`
- `/BT_HEXDUMP_DBG/LOG_HEXDUMP_DBG/`
- `/BT_DBG_OBJ_ID/LOG_DBG_OBJ_ID/`

Also, some files were relying on the `common/log.h` include to include
`zephyr/bluetooth/hci.h`, in those cases the include of `hci.h` has
been added.

For files that were including `common/log.h` but not using any logs,
the include has been removed and not replaced.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2022-11-25 17:08:36 +01:00
Andrzej Głąbek
02653e13cf drivers: clock_control_nrf: Fix releasing/stopping of HFCLK
Routines called by users to release (and perhaps stop) the HFCLK
cannot synchronize with only the `hfclk_users` atomic variable,
because a thread can be preempted right after it clears the proper
bit in that variable but before the HFCLK is actually requested to
stop, and another user can then request the HFCLK to start. This can
result in HFCLK being stopped right after it was requested to start
and in `hfclk_users` holding an incorrect value.
Fix this by locking interrupts in those routines until the HFCLK is
stopped.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-11-25 10:45:50 +01:00
Johan Hedberg
7feb7ef914 pcie: shell: Use pcie_scan() for scanning for devices
Use the new pcie_scan() API instead of doing a brute-force scan.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-24 15:23:28 +01:00
Johan Hedberg
e4b8e97c1a pcie: Convert pcie_bdf_lookup() to use pcie_scan()
Use the commmon scanning framework instead of doing a custom brute-force
scan.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-24 15:23:28 +01:00
Johan Hedberg
b7343b28ac pcie: Convert PCIe device scanning to use pcie_scan() API
Take advantage of the new PCIe scanning API for doing the initial lookup
of PCIe devices specified for a given board.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-24 15:23:28 +01:00
Johan Hedberg
57c150af0c pcie: Add API for scanning for available endpoints
This adds a generic API to be used for scanning for available PCI
endpoints. It takes a more detailed approach than the "brute force"
based scanning that's so far been used in Zephyr, buy inspecting the
host controller node and bridge nodes, and only scanning for busses and
devices that are actually expected to exist.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-24 15:23:28 +01:00
Johan Hedberg
a2c8fdca33 pcie: Add helper macro to identify valid identifiers
PCI(e) host controllers behave in different ways (some more buggy than
others) in what value they use to indicate that an endpoint is not
present. In most cases the VID/DID is all ones (PCIE_ID_NONE) but in
others it's all zeroes, and some may even have the VID all zeroes and
the DID all ones, or vice-versa.

Add a macro to easily test for all these possibilities. The "all ones"
and "all zeroes" cases have been verified to exist on actual HW
supported by Zephyr, however the test for the mixed cases is simply
based on what Linux considers valid values (drivers/pci/probe.c in the
Linux kernel tree).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-24 15:23:28 +01:00
Andrei Emeltchenko
18aee8703b drivers: eth_e1000: Fix build warning for x86_64
This patch allows to build Ethernet driver eth_e1000 for x86_64
boards.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-24 15:23:11 +01:00
Jaska Uimonen
43fe2bba37 drivers: dma: gpdma: reduce logging verbosity
Reduce logging verbosity in status call from INF to DBG as the function
can be called any given time i.e. eveything is fine even if the read and
write pointers don't differ.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-11-24 15:22:30 +01:00
Dat Nguyen Duy
6d866b62bf drivers: spi: introduce SPI driver for NXP S32
This introduces SPI driver for NXP S32 platform

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2022-11-24 09:37:24 +01:00
Adrian Warecki
7aaaffe623 dma: dwdma: Remove unused defines
There was no reference to the DW_DMA_BUFFER_PERIOD_COUNT,
so it was removed.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2022-11-23 15:36:31 -05:00
Adrian Warecki
cb8b1b511c dma: adsp: gpdma: Add support for get_attribute
Added the new intel_adsp_gpdma_get_attribute function that returns
dma controller attributes.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2022-11-23 15:36:31 -05:00
Adrian Warecki
ed1976f614 dma: hda: adsp: Add support for get_attribute
Added the new intel_adsp_hda_dma_get_attribute function that
returns dma controller attributes.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2022-11-23 15:36:31 -05:00
Adrian Warecki
ea85ce2693 dma: gpdma: Read linear link position in status function
Added reading of the linear link position in the status function.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2022-11-23 15:36:31 -05:00
Anas Nashif
cffe98d9de crc: Make the build of crc function dependent on a Kconfig
Add CONFIG_CRC for building CRC related routines.
CRC routines are now being built for each application, whether used or
not and are add in the build system unconditionally.

Keep CONFIG_CRC enabled by default for now and until all users have
converted to use the new option.

Partial fix for #50654

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-23 13:30:00 +01:00
Henri Xavier
b54ba9877f arm64: implement arch_system_halt
When PSCI is enabled, implement `arch_system_halt` using
PSCI_SHUTDOWN.

Signed-off-by: Henri Xavier <datacomos@huawei.com>
2022-11-23 11:37:08 +01:00
Francois Ramu
e00f91da41 drivers: serial: uart driver for stm32U5 suspends dma channel
When DMA transfer is enabled on the stm32U5,
the UART Tx channel must be suspended before stopping.
This will let the on-going transfer ends properly

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-23 11:32:27 +01:00
Francois Ramu
0300b34cf0 drivers: serial: stm32 UART driver do not start Rx timer if null
This commit is optimizing the uart isr execution to avoid starting
the Rx timeout if it is null. In anycase the async_timer_start
function is checking the tiemout value. This will just save some
execution lines.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-23 11:32:27 +01:00
Francois Ramu
939b274507 drivers: serial: stm32 uart async is valid for stm32U5 serie
The UART_ASYNC is supported on the stm32U5 serie through the
GPDMA driver.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-23 11:32:27 +01:00
Francois Ramu
1299c78c18 drivers: dma: stm32u5 dma drivers has a suspend function
Gives the stm32u5 dma driver a suspend function to
enhance the dma API.
This is a particular feature of the stm32U5 GPDMA
to suspend a channel.
A delay is required  ;1ms is compatible with both stm32u5 platforms.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-23 11:32:27 +01:00
Francois Ramu
6500c2377c drivers: dma: stm32u5 dma keep initial DMA_InitStruct
There is no reason to set DMA_InitStruct with same fields
as the LL_DMA_StructInit sets.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-23 11:32:27 +01:00
Arsen Eloglian
c67666ae1b board: rename dtsi node 'lps' to 'dfpmcch'
dfpmcch covers lps memory mapping.
Making lps a part of dfpmcch.

Signed-off-by: Arsen Eloglian <ArsenX.Eloglian@intel.com>
2022-11-22 20:03:06 -05:00
Jan Krautmacher
6be9666ba2 drivers: eth: Enable LLDP on STM32
With the current LLDP implementation in Zephyr the support for it has to
be enabled in the ethernet driver. This commit adds exactly this
capability to the STM32 HAL based ethernet driver.

Signed-off-by: Jan Krautmacher <jan@krautmacher.org>
2022-11-22 14:28:46 +00:00
Francois Ramu
b71a301106 drivers: clock_control: stm32f7 flash latency with overdrive
The Flash latency depends on the sysclock
In case of the stm32F7 the regulator overdrive mode is set
depending on the sys clock freq.
The overdrive must be set before the first LL_SetFlashLatency.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-22 14:27:38 +00:00
Francois Ramu
0da1323b95 drivers: flash: stm32 ospi can read the SFDP table from the DTS
When the SFDP table is provided by the DeviceTree with sfdp-bfp property
It is NOT read from the octoFlash.
If no table exists in the DTS and flash read SPDP fails,
the device init fails.
Availability of this sfdp_read API is conditional
on selecting CONFIG_FLASH_JESD216_API.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-22 14:26:57 +00:00
Francois Ramu
6143579c85 drivers: flash: stm32 ospi driver with read ID from octoflash
This commit adds the jedec216 read JEDEC ID function API.
The ospi commands are issued to the octo flash device or
by the DTS jedec-id property.
Availability of this API is conditional
on selecting CONFIG_FLASH_JESD216_API.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-22 14:26:57 +00:00
Francois Ramu
9fbe27bc32 drivers: flash: ospi for stm32 mcu
Fixes command configuration to have samples/drivers/spi_flash
passed on stm32l562 and stm32u585 disco kits.
In OctoSPI STR/DTR and SPI/STR modes,
to determine the address_width, checking the jesd216_bfp_addrbytes
on JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_3B4B or _VAL_4B.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-22 14:26:57 +00:00
Francois Ramu
687330acca drivers: clock_control: stm32u5 enables the EPOD
With the stm32U5, when the sysclock is > 55 MHz, the EPOD booster
must be configured before the PLL1 is enabled (see refMan).
This is the case when sysclock is on PLL1 sourced by MSIS or
HSE higher than 16MHz.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-22 12:08:50 +00:00
Francois Ramu
c81dba6d45 drivers: dma stm32U5 GPDMA keeps the channel busy if overriden
For the stm32U5 serie, the busy flag is handled as other serie.
When the DMA is overriden by other HAL drivers, the busy flag
is not considered.
Refer to https://github.com/zephyrproject-rtos/zephyr/pull/47645
There is no Mux for this GPDMA and fixed 16 channels.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-22 12:00:00 +00:00
Francois Ramu
e24c5256ba drivers: flash: stm32 octospi NOR flash with DMA on stm32u5x
This commit set the stm32 octospi drivers for the stm32u5x
when DMA (GPDMA) is transferring.
Valid for octospi1 or octospi2.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-22 12:00:00 +00:00
Gerard Marull-Paretas
4de1d9a591 drivers: watchdog: npm6001: initial version
Driver for the watchdog embedded in the nPM6001 PMIC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-22 11:05:19 +01:00
Gerard Marull-Paretas
eaadea5508 drivers: gpio: npm6001: initial driver
Add GPIO driver for the GPIO controller embedded in the nPM6001 PMIC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-22 11:05:19 +01:00
Philipp Schilk
6a93975dd7 drivers: sensors: Fix MAX30101 Kconfig description.
Fixes a small typo in the MAX30101 Kconfig file.
The MAX30101_LED3_PA config option mistakenly referd to LED2 in it's
comment.

Signed-off-by: Philipp Schilk <schilk.philipp@gmail.com>
2022-11-22 13:07:03 +09:00
Andrzej Głąbek
595fbf9b97 drivers: uart_nrfx_uarte: Remove redundant HW_RX_COUNTING_ENABLED calls
Merge three adjacent `if (HW_RX_COUNTING_ENABLED(data))` blocks into
a common one.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-11-22 12:46:38 +09:00
Andrzej Głąbek
9628ecdc39 drivers: uart_nrfx_uarte: Fix call to HW_RX_COUNTING_ENABLED()
Since the macro references `data->async->hw_rx_counting`, it cannot
be called when `data->async` is NULL, and this could happen when the
PM_DEVICE_ACTION_RESUME action was requested for an instance that uses
the interrupt-driven API while for another instance that uses the
asynchronous API the hardware counting of bytes was configured.
Prevent this by calling the macro from a proper `if` block.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-11-22 12:46:38 +09:00
Carles Cufi
4796ffee7a drivers: mm: Move mm_drv_intel_adsp_mtl_tlb to zephyr/
This file was mistakenly placed in include/ instead of include/zephyr.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-11-21 20:43:50 +09:00
Nick Ward
de9a665b31 drivers: sensor: vcnl4040: other small improvements
Fixes the double up test of int_gpio.port.
Addition of VCNL4040_ALS_INT_EN macros.
Use of BIT() macro where it makes sense.
MISRA improvements.

Signed-off-by: Nick Ward <nick.ward@ftpsolutions.com.au>
2022-11-20 12:12:23 +01:00
Nick Ward
3abd63c093 drivers: sensor: vcnl4040: use mutex for locking
Saves some flash and we get priority inheritance.

Also removes lock from vcnl4040_handle_int() as it
is always called from the same thread.

Signed-off-by: Nick Ward <nick.ward@ftpsolutions.com.au>
2022-11-20 12:12:23 +01:00
Nick Ward
db8ecd5ec8 drivers: sensor: vcnl4040: fix sensor register init
The driver has a read register, modify value, write value flow due to
needing to modify nibbles of registers at different times.  The issue
this driver previously had was new incoming configurations from the
driver would be corrupted by previous configurations written into the
vcnl4040 (when there's been no power off). This would be in the case
when a device continuously power on and a developer is tweaking the
vcnl4040's configuration or when deploying firmware updates with
a new vcnl4040 configuration.

Signed-off-by: Nick Ward <nick.ward@ftpsolutions.com.au>
2022-11-20 12:12:23 +01:00
Nick Ward
d8c107e166 drivers: sensor: vcnl4040: fix I2C write function
The driver was using the i2c_transfer_dt() API incorrectly by not using the
I2C_MSG_STOP flag in the flags field.

The I2C write function can be written more simply with the basic I2C write
API so this commit also switches the code to the basic I2C write API to fix
this bug.

Signed-off-by: Nick Ward <nick.ward@ftpsolutions.com.au>
2022-11-20 12:12:23 +01:00
Aaron Massey
28b8123887 fuel_gauge: Sample sbs gauge driver with tests
Add a sample sbs gauge driver with feature parity and basic tests
comparison to its sensor counter-part. Includes a simple stub test that is
extended upon.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2022-11-19 17:56:05 -05:00
Robert Lubos
387a66131e net: pkt: Introduce minimum length requirement to net_pkt_get_frag()
net_pkt_get_frag() and a few other functions did not specify the
allocated fragment length, incorrectly assuming that fixed-sized
buffers are always used.

In order to make the function work properly also with variable-sized
buffers, extend the function argument list with minimum expected
fragment length parameter. This allows to use net_buf_alloc_len()
allocator in variable buffer length configuration, as well as verify if
the fixed-sized buffer is large enough to satisfy the requirements
otherwise.

Update the existing codebase to provide the expected fragment length,
based on the context.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-11-19 07:39:32 -05:00
Andrei Emeltchenko
4378017ad0 edac: ibecc: Correct indication of -ENODATA
According to IBECC spec ECC Error log register is only valid when
ECC_ERROR_CERRSTS or ECC_ERROR_MERRSTS bits are set.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-19 14:18:40 +09:00
Jan Hilsdorf
a429528e3d drivers: serial: convert Zephyr constants to rpi-hal constants
rpi-hal function "uart_set_format" expects data width in the range
of 5..8. So I created a new function “uart_rpi_set_format” which
contains common parts of “uart_rpi_configure”.

Signed-off-by: Jan Hilsdorf <jan.hilsdorf@gmail.com>
2022-11-19 14:18:00 +09:00
Johan Hedberg
a96016d747 drivers: ivshmem: Remove unnecessary BDF lookup code
There was a bunch of BDF lookup code in the ivshmem driver originating
from issues with not being able to have multiple PCIE_BDF_NONE entries
in DTS. Now that devices are always looked up based on VID/DID this
should not be an issue, and hence the additional code is not needed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-19 14:17:16 +09:00
Marcin Szkudlinski
84c09433b5 mtl: soc: TLB driver provides required size of L3 storage buffer
TLB driver knows the required number of bytes for HPSRAM
storage during power off state.

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2022-11-18 13:00:04 -05:00
Marcin Szkudlinski
3ee8bf7053 mtl: soc: add TLB driver context save to platform PowerManagement
Connect the TLB context save to MTL suspend power flow

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2022-11-18 13:00:04 -05:00
Marcin Szkudlinski
540f6d1dc5 mtl: drivers: tlb driver cleanup
a small cleanup in the code, preaparation for memory context save

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-11-18 13:00:04 -05:00
Kiril Petrov
5801ab2231 drivers: sensors: lis2dh: add attr to set HP filters
Add ability to set High Pass filter on AOI function on interrupt 1 or 2.

Signed-off-by: Kiril Petrov <retfie@gmail.com>
2022-11-18 10:46:52 -06:00
Adrian Bonislawski
fa57cd613b drivers: dai: ssp: clear RSE bits on ACE
On ACE RSE bits should be cleared unconditionally
if ssp is no longer in use

This will allow to successfully disable SSP in
dai_ssp_pm_runtime_dis_ssp_power()
and enable it correctly in the next run

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-11-18 12:01:24 +00:00
Michał Barnaś
94458f88b9 ec_host_cmd: add eSPI peripheral for the host commands
This commit adds the support for host commands being transported
by the eSPI subsystem.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-11-18 10:11:40 +01:00
Michał Barnaś
959d3b87fb ec_host_cmd: move the host_cmd_periph.h to subdirectory
Move the header file to corresponding directory which refers to
submodule name instead of root of drivers directory.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-11-18 10:11:40 +01:00
Michał Barnaś
1563cda9dd ec_host_cmd: remove syscalls for this subsystem
The functions for ec_host_cmd_periph are only used by statically defined
kernel thread and should never be used from other subsystem, especially
from userspace. This commit removes the syscalls prefixes from these
functions and leaves them as inline call to API implementations from
peripheral.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-11-18 10:11:40 +01:00
Jason Yuan
6ff0b79d74 drivers: gpio: Add TCA6424A driver
The driver supports 24 gpio pins which are numbered sequentially from
0 to 23.

Signed-off-by: Jason Yuan <jasonyuan@google.com>
2022-11-18 10:10:11 +01:00
Dominik Ermel
7c2924f4bc mgmt/mcumgr: Move transport headers to transport subdir
The MCUmgr transport headers have been moved to
zephyr/mgmt/mcumgr/transport/

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-11-17 15:31:17 +01:00
Chris Friedt
22fe674a9c drivers: fpga: ice40: add support for the Lattice iCE40 series
Add support for the Lattice iCE40 series FPGAs.

Fixes zephyrproject-rtos#48317

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2022-11-17 09:17:44 -05:00
Krzysztof Chruscinski
336c1ad7d2 drivers: tiemr: nrf_rtc_timer: Add test function for shifting time
RTC is 24 bit width and k_timer is 64 bit. It is hard to test corner
cases but RTC hardware feature can help here. There is a task which
moves counter to 0xfffff0 which is close to overflow. However, there
is an internal driver state that also needs to be aligned to shift
the time properly. Adding optional function which triggers overflow
and updates internal state. This can be used for testing corner cases.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-11-17 11:24:23 +01:00
Benjamin Perseghetti
3906860a8f drivers: fxas21002 enablement for SPI and I2C
Added support for fxas21002 sensor over SPI and I2C.
Made the fxas driver APIs generic for I2C and SPI.
Tested with fxas21002 sensor on RDDRONE.

Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
Co-authored-by: Sumit Batra <sumit.batra@nxp.com>
2022-11-16 10:18:46 -06:00
Benjamin Perseghetti
2870b38379 drivers: fxos8700 enablement for SPI and I2C
Added support for fxos8700 sensor over SPI and I2C.
Made the fxos driver APIs generic for I2C and SPI.
Tested with fxos8700 sensor on RDDRONE.

Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
Co-authored-by: Sumit Batra <sumit.batra@nxp.com>
2022-11-16 10:18:46 -06:00
Jaroslaw Stelter
5f7a6ae817 drivers: gpdma: Fix ownership programming for ACE
There is no DSPRA registers (0x71a60) in SOC Intel ACE.
Therefore this space should be not accessed. It is valid only
for some Intel CAVS SOC versions.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-11-17 00:34:45 +09:00
Jamie McCrae
2b472e2d20 drivers: regulator: regulator_shell: Fix missing include
Fixes a missing include for the atoi() function.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-11-17 00:34:34 +09:00
Ranjani Sridharan
33687cd403 drivers: dai: intel: ssp: Fix log level typo
Print all SSP registers at level info.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-11-16 11:21:32 +01:00
Robert Lubos
1d7a077e11 net: ppp: Revert interface management changes
This reverts changes introduced in commit
dd535f611d, as they broke the gsm_ppp
driver integration with PPP L2. Apparently, a more thorough
refactoring is needed to use the new interface management scheme with
PPP.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-11-16 11:21:24 +01:00
Benedikt Schmidt
5fc743e5f9 drivers: spi: fix return value of spi_transceive for STM32 slaves
Return correctly the number of received bytes for a
spi_transceive on a STM32 SPI slave.
Fixes #52216

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2022-11-16 11:19:43 +01:00
Artur Hadasz
f610743ef8 drivers: ieee802154_nrf5: Removed CSL placeholder window
Since nRF IEEE 802.15.4 radio driver is now capable of calculating CSL
phase based on provided anchor time and CSL period, the CSL placeholder
window is no longer necessary. This commit removes it and switches to
the new calculation method.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2022-11-16 11:19:33 +01:00
Johan Hedberg
fb2f686c68 drivers: virtualization: ivshmem: Convert to use dynamic BDF lookup
Use the new PCIe core infrastructure for looking up the BDF at runtime
based on the VID/DID values.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-16 11:18:43 +01:00
Johan Hedberg
cb1e4509fe drivers: pci: ptm: Convert to use dynamic BDF lookup
Use the new PCIe core infrastructure for looking up the BDF at runtime
based on the VID/DID values.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-16 11:18:43 +01:00
Johan Hedberg
ed726fcce9 drivers: pci: ptm: Fix missing DT_DRV_COMPAT
The ptm.c driver never defined DT_DRV_COMPAT, so the various DT macros
never expanded to anything useful.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-16 11:18:43 +01:00
Johan Hedberg
3c762f845e drivers: i2c_dw: Convert to use dynamic BDF lookup
Use the new PCIe core infrastructure for looking up the BDF at runtime
based on the VID/DID values.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-16 11:18:43 +01:00
Johan Hedberg
e9b39efe9e drivers: can: kvaser_pci: Convert to use dynamic BDF lookup
Use the new PCIe core infrastructure for looking up the BDF at runtime
based on the VID/DID values.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-16 11:18:43 +01:00
Johan Hedberg
c905b4dded drivers: eth_e1000: Convert to use dynamic BDF lookup
Use the new PCIe core infrastructure for looking up the BDF at runtime
based on the VID/DID values.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-16 11:18:43 +01:00
Johan Hedberg
fcfff0633e drivers: uart_ns16550: Convert to use runtime PCIe BDF lookup
Convert the ns16550 driver to use the new centralized runtime BDF lookup
of PCIe devices.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-16 11:18:43 +01:00
Johan Hedberg
0eed096f99 pcie: Add support for centralized lookup of BDF values
The BDF values can differ on the same platform, based on e.g. BIOS
configuration, and in the case of qemu the command line parameters. It's
therefore more reliable to always look up the BDF value based on the
known Vendor and Device IDs.

This patch introduces such a framework, and allows the incremental
update of PCIe drivers to start taking advantage of it.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-16 11:18:43 +01:00
Armin Brauns
53a3ff0dff drivers: mcp230xx: make config struct const
`struct device::config` is a `const void *`, so this struct does not need
to be mutable.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2022-11-15 19:10:14 -05:00
Armin Brauns
1cfd54db7e drivers: mcp230xx: fix for multiple instances
Parts of the macro used `inst`, others `n` for the instance number; only
`n` was actually defined (so `inst` expanded to the empty string, causing
name errors with more than one instance).

Unify everything to `inst`.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2022-11-15 19:10:14 -05:00
Armin Brauns
6468a4458b drivers: mcp230xx: formatting
It's a formatting cleanup. Not much to explain here, but CI requires a body
text.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2022-11-15 19:10:14 -05:00
Henrik Brix Andersen
1885bee7c3 drivers: eeprom: add fake EEPROM driver
Add a FFF-based fake EEPROM driver which can be used either as a stub or a
mock for testing.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-11-15 09:43:42 -06:00
Gregers Gram Rygg
f9b5138097 drivers: flash: spi_nor: add macronix high performance mode
Add property mxicy,mx25r-power-mode to jedec,spi-nor binding for
controlling low power/high performance mode on Macronix MX25R* Ultra Low
Power flash devices.

- "low-power" configures the flash in ultra low power mode.
- "high-performance" configures the flash in high performance mode.

Signed-off-by: Gregers Gram Rygg <gregers.gram.rygg@nordicsemi.no>
2022-11-15 14:58:26 +01:00
Kristofer Jonsson
0a02a7adc1 drivers: misc: Add an Ethos-U NPU driver
Add a driver for the Arm Ethos-U NPU, including a Devicetree entry for
the mps3_an547 platform.

Signed-off-by: Kristofer Jonsson <kristofer.jonsson@arm.com>
Signed-off-by: Fredrik Knutsson <fredrik.knutsson@arm.com>
2022-11-15 14:47:43 +01:00
Henri Xavier
0f2d763099 pcie: Write MSI-X vectors using sys_write32
It was previously written as regular members of a struct, which
allows the C compiler to do things the way it wants. On ARM64, gcc
would typically write field by pairs (`STP`), which
would generate aborts.

By using `sys_write32`, we force it the right way.

Signed-off-by: Henri Xavier <datacomos@huawei.com>
2022-11-15 12:20:21 +00:00
Ryan Erickson
746293e44f modem: hl7800: Fix re-init after firmware update
After a firmware update, DNS needs to be reconfigured.
Fix debug log for AT command strings.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-11-15 12:18:26 +00:00
Ryan Erickson
e01f977da1 modem: hl7800: Fix +CCID response to handle EID
For SIM cards that support eSIM, the +CCID response
will contain the ICCID and the EID.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-11-15 12:17:20 +00:00
Adrian Bonislawski
fcbb8bb4fe dma: gpdma: disable interrupt
GPDMA should work with disabled interrupts in ctrl_lo
This also helps with stability in SOF scenarios

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-11-15 12:16:23 +00:00
romain pelletant
8aa4164518 drivers: usb_dc_stm32: implement usb_dc_detach()
Implement support to detach USB device.

Signed-off-by: romain pelletant <romainp@kickmaker.net>
2022-11-15 12:15:54 +00:00
Akos Melczer
d7d6a84b36 drivers: serial: rpi_pico: added functions for runtime uart configuration
Added functions for runtime uart configuartion for raspberry pico

Signed-off-by: Akos Melczer <webmastertd000@gmail.com>
2022-11-15 12:12:47 +00:00
Yonatan Schachter
f633b17c7c drivers: flash: Add flash driver for rpi_pico series
Add a flash driver for the rpi_pico

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-11-15 12:12:00 +00:00
Gerard Marull-Paretas
af722062c1 drivers: sensor: ina23x: s/irq-gpios/alert-gpios
The sensor uses the ALERT terminology (pin can be configured to trigger
on certain events such as conversion ready or overvoltage alerts). The
"IRQ" name is not clear.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-15 10:23:17 +01:00
Gerard Marull-Paretas
d5734bc003 drivers: sensor: ina23x: specify current LSB in uA and fix units
Specify the units of the current LSB in microamperes, so that we can
measure low maximum currents. Right now it was specified in
milliamperes, but ignored and always hardcoded to 1mA in the driver.
This makes the driver pretty much useless when the maximum current to be
measured is in a range of e.g. 20-50mA.

This patch also removes some unnecessary ifdeffery: since we write the
calibration register, we can always provice measurements with the right
units. It is also wrong to provide sensor readings that do not match
with the units specified by the channel. After this change voltage is
always reported in V, current in A and power in W.

Note that power measurement had the current LSB hardcoded in the
calculation (assuming 1mA/LSB), this has been fixed as well.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-15 10:23:17 +01:00
Gerard Marull-Paretas
d7e1e44320 drivers: sensor: ina23x: improve voltage reading code
Adjusted LSB factor to be un uV/LSB to make calculations more clear.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-15 10:23:17 +01:00
Gerard Marull-Paretas
a79f5b87c0 drivers: sensor: ina23x: s/rshunt/rshunt-milliohms
Following dtschema practices, add phyisical units to the shunt resistor
value: milliohms.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-15 10:23:17 +01:00
Gerard Marull-Paretas
af03ad33e1 drivers: sensor: ina23x: remove redundant build asserts
With the recent introduction of DT_HAS* Kconfig helpers, such build
asserts are highly unlikely, so just remove them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-15 10:23:17 +01:00
Gerard Marull-Paretas
a34158f386 drivers: sensor: ina23x: delete redundant Doxygen docs
Driver had Doxygen stubs for sensor interface calls. First, most were
incomplete, outdated or just wrong. Second, implementations just need to
make sure to adhere to the error codes documented in the public
interface (sensor API in this case).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-15 10:23:17 +01:00
Gerard Marull-Paretas
35eabfcdf0 drivers: ina23x: fix includes
- Add many missing includes so that headers are self-contained
- Sort includes properly (locals first, stdc, zephyr, etc.)

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-15 10:23:17 +01:00
Gerard Marull-Paretas
f7cb0933fc drivers: regulator: s/uV/uv and s/uA/ua
Zephyr coding style uses all-lowercase.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas
6d744d3dd2 drivers: regulator: use int32_t for voltages/currents
Right now we had a mix of int (signed) and uint32_t (fixed-width
unsigned integer). Use int32_t for all cases, both values may be either
positive/negative, and we have a defined range when using fixed-width
integers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas
561eb2b5b5 drivers: regulator: s/pmic/pca9420
The "pmic" driver was in reality a driver for NXP PCA9420 PMIC. There's
no "universal PMIC". While the driver may work for other NXP PMICs, it
is clearly not generic for other vendors PMIC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas
6dd395ddeb drivers: regulator: shell: drop PMIC conditional options
The regulator API supports all voltage/current ops, so there's no need
to guard them under "PMIC". If a particular driver doesn't support the
operations it will just return -ENOSYS and the command will fail.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas
ec3c566f8c drivers: regulator: convert all API calls to use ops
The previous "consumer" API was designed without API ops, meaning only a
single implementation (singleton) was possible. This was inconsistent
with all other APIs, and, a problem in systems where more than a single
PMIC IC is present.

Note that all "consumer" ops are optional, so this won't break any
existing drivers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas
74e40f88ae drivers: regulator: move consumer.h to regulator.h
In Zephyr all regulator APIs are consumer APIs. There's no point in
adding a separate header file. Our current implementation is also
inconsistent with Linux, where enable/disable are also part of the
consumer.h API.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Tomasz Moń
c011646081 drivers: flashdisk: check partition constraints
Fail with error if any of flashdisk partition assumptions are not met:
  * uniform page size through the whole partition
  * flashdisk starts at page boundary
  * flashdisk ends at page boundary

Read-only flashdisks are not subject to above conditions because the
cache buffer is not used for read-only flashdisks.

The checks can be disabled via Kconfig option to save code space.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-11-14 16:37:04 +01:00
Tomasz Moń
8981015335 drivers: flashdisk: support read-only flashdisks
Force cache-size to 0 and treat flashdisk as read-only when backing
partition has read-only flag set. This allows users to save RAM when the
application does not write to the flashdisk, e.g. when a predefined FAT
filesystem is used.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-11-14 16:37:04 +01:00
Ranjani Sridharan
2bb63a2170 dma: dw: Fix compilation errors with CONFIG_DMA_DW_SUSPEND_DRAIN
This code was likely never used.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-11-12 22:27:10 -05:00
Milind Paranjpe
7a1cd99555 drivers: usb: mcux: mark endpoint unoccupied on disable
In usb_dc_ep_disable() mark an endpoint as unoccupied in addition to
being disabled. This allows the endpoint to get enabled properly
with a subsequent call to usb_dc_ep_enable()

See: zephyrproject-rtos/zephyr#51685

Signed-off-by: Milind Paranjpe <mparanjpe@yahoo.com>
2022-11-11 15:10:26 -06:00
Gerard Marull-Paretas
442fae1b38 drivers: pinctrl: fix lookup when there are no states
Right now it is possible that some devices define 0 pinctrl states in
devicetree, because pinctrl-N entries may still be optional for backward
compatibility. If the programmer makes a mistake and forgets them,
application could experience runtime crashes because
pinctrl_lookup_states assumes you have at least one state, so it does
not perform any bounds checking. Change the while condition so that it
is skipped if states count is zero.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 13:15:02 +01:00
Johan Hedberg
54513c70d1 drivers: can: kvaser_pci: Fix incorrect RAM context struct type
The can_kvaser_pci_data_##inst type was supposed to be
can_kvaser_pci_data and not can_kvaser_pci_config. This got unnoticed
because there were no struct members to pre-initialize, and a reference
to the struct was stored using a void pointer.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-11 12:10:09 +01:00
Gerard Marull-Paretas
b1552001bf drivers: gpio: npcx: fix usage of deprecated voltage macros
The NPCX driver did use deprecated voltage macros. Define vendor
specific flags instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 11:00:26 +01:00
Gerard Marull-Paretas
109d4e4e78 drivers: gpio: it8xxx2: fix usage of deprecated voltage macros
The pin get function was using deprecated macros. Note that the set
implementation already uses vendor specific flags.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 11:00:26 +01:00
Lukas Gehreke
1bd931ab66 drivers: usb_dc_rpi_pico: fixed buffer status handling
The buf_status register is 32 bit wide but was saved in a
uint8_t. This caused some buffers never to be handled which
results in the pico getting stuck in the interrupt handler.

Signed-off-by: Lukas Gehreke <lk.gehreke@gmail.com>
2022-11-11 08:50:09 +00:00
Jeppe Odgaard
afd6eb35f9 modem: ppp: gsm: extract access technology
Some modems supports multiple access technologies.
The access technology of the serving cell can be extracted from the
+CEREG command, which is already sent to the modem.

The parse function is extended to also parse the access technology value.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/51153.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2022-11-11 08:41:13 +00:00
Daniel Leung
bbb2f8277a uart: ns16550: move command macro to public header
This moves the CMD_SET_DLF command macro to public header
so application can use it without weird include path to
include the "private" header file under drivers/serial.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-11-10 22:40:21 -05:00
Jay Vasanth
acf473f850 driver: peci: mec: enable peci in ec subsystem register
Ensure that PECI block is enabled in the EC Subsystem by clearing
the PECI_DIS (peci disable) register

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-11-10 22:39:43 -05:00
Guillaume Gautier
2604951989 drivers: flash: Use dts to configure STM32 OSPI manager clock
Instead of calling __HAL_RCC_OSPIM_CLK_ENABLE() to enable the OSPI
manager clock, we now use a new clock binding in the dts.

In order to avoid confusion between the different clocks, the driver
is modified to select the clock based on their names instead of indexes.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-11-10 11:28:18 +00:00
Guillaume Gautier
58f82bf243 drivers: counter: Remove unused Kconfig symbols for stm32 rtc
Remove a set of Kconfig symbols for configuring the RTC on STM32
that are no longer useful

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-11-10 11:27:49 +00:00
Guillaume Gautier
3bfc22ac73 drivers: counter: Add support for STM32 RTC source from dts
Add support for STM32 RTC source from dts

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-11-10 11:27:49 +00:00
Guillaume Gautier
a332ee3172 drivers: clock_control: clock_stm32: Add support for lse bypass
Add support for LSE bypass for all STM32 series

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-11-10 11:27:49 +00:00
Gregers Gram Rygg
c9e07fc385 drivers: flash: spi_nor: fix flash busy during init
After a soft-reset of the host controller the flash device is not reset.
This can cause the flash device to still be busy writing or erasing when
the host controller boots and initializes the flash. The often results
in errors and the flash device not being initialized.

This fix polls the status register until the WIP flag is off before
initializing the flash device.

Fixes #51713

Signed-off-by: Gregers Gram Rygg <gregers.gram.rygg@nordicsemi.no>
2022-11-10 11:11:11 +01:00
Erwan Gouriou
4a0032ddc1 drivers: clock_control: stm32_mux: Fix src clock configuration
In order to configure domain clock, clock_control_configure should be
used instead of clock_control_on which is only useful for bus clock gating.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-11-10 09:30:09 +01:00
Théo Battrel
f16738b62b Bluetooth: Move crypto toolbox functions from smp.c to their own files
Move functions defined in the Cryptographic toolbox of the Bluetooth
specification inside their own files in the following folder:
`zephyr/subsys/bluetooth/bt_crypto`. The functions were previously
implemented in `zephyr/subsys/bluetooth/host/smp.c`.

The cryptographic toolbox functions can now be accessed from outside of the
host.

In addition to that, tests for each cryptographic toolbox functions have
been added.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2022-11-10 09:28:28 +01:00
Daniel Skatt
a94263784b gpio_mcp23sxx_fix: spi_msg and multiple inst
Fixed how data is read in mcp23sxx_read_port_regs
The data is now stored in an array to get the
actual data from spi

Signed-off-by: Daniel Skatt <daniel.skatt@gmail.com>
2022-11-09 15:55:39 -05:00
Daniel Skatt
f921ff1fc8 gpio_mcp23sxx_fix: spi_msg and multiple inst
Changed SPI message from 2 seperate to 1
Fixed problem using multiple instances

Signed-off-by: Daniel Skatt <daniel.skatt@gmail.com>
2022-11-09 15:55:39 -05:00
Ranjani Sridharan
2fb01e412f dma: dw: Fix return value in dw_dma_stop
Do not throw away the errors.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-11-09 21:42:13 +01:00
Marco Argiolas
be4ee1edef drivers: sensor: sensor_shell: fix channel name collision
Channel SENSOR_CHAN_GAUGE_FULL_CHARGE_CAPACITY was returned in place of
SENSOR_CHAN_GAUGE_FULL_AVAIL_CAPACITY, due to their matching names.
Ensuring that the channel names are unique fixes the issue.

Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
2022-11-09 09:44:27 -06:00
TOKITA Hiroshi
c5c0a1ae75 drivers: gpio: gd32: add dependency on the EXTI
The GPIO pin interruption depends on the EXTI.
Add "select" to clarify the dependency.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-11-09 06:26:41 -05:00
Krzysztof Chruscinski
31b25400ff drivers: timer: nrf_rtc_timer: Prevent prolonged timeout setting
CC setting algorithm is handling a case when CC is too soon (next
tick from now). It was setting CC to one tick further in the future
if that was detected. Step was repeated if counter incremented during
setting CC and CC was behind the counter because of risk of setting
CC too late. In certain scenarios we might spend a lot of time in
that loop, especially if optimization is turned off. Test shown that
loop was executed dozens of time (up. to 700us). To prevent
prolonged execution whenever CC setting fails we set CC to one more
tick further in future.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-11-09 10:46:19 +01:00
Tim Lin
0789442132 ITE: soc: chip_chipregs: Access registers using structure method
Access registers using structure method.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-11-09 10:44:29 +01:00
Tim Lin
b3f46ccaec ITE: cleanup: soc: chip_chipregs: Rename the structure name of register
Rename the structure of flash_it8xxx2_regs to smfi_it8xxx2_regs.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-11-09 10:44:29 +01:00
Ranjani Sridharan
5f9c20db5a drivers/dai/intel/ssp: Skip setting config when playback/capture is active
The reference count, dp->sref, is never incremented for the SSP DAI as
we use the runtime PM API's to probe/remove the DAI during
resume/suspend. Therefore, use the DAI state to check if the DAI is
active in any direction before proceesing to set the config. This fixes
the IO errors seen during simultaenous playback and capture on the same
SSP.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-11-09 09:27:51 +00:00
Ashwini M Shinde
0f6c7e3d9c drivers: i2c: Support for i2c 10-bit addressing for STM32 target
Fixes #51060. Support for i2c 10-bit addressing in STM32 slave driver

Signed-off-by: Ashwini M Shinde <AshwiniMShinde@eaton.com>
2022-11-09 09:07:35 +00:00
Perry Hung
9b5bc03f86 drivers: can: sam: select CACHE_MANAGEMENT for SAM M_CAN
A regression was introduced in ef804d8408
when the M_CAN driver was swapped to use the generic dcache API, but
cache management was not enabled on SAM devices.

Enable cache management on SAM devices when CAN_SAM is selected.

Signed-off-by: Perry Hung <perry@genrad.com>
2022-11-08 15:41:10 -05:00
Michał Barnaś
bcd4230d04 espi: auto enable the ESPI SAF XEC based on the device tree
The SAF XEC driver for eSPI was not enabled by default so sample
code for espi was failing. This commit changes the behavior to match
current scheme of enabling the drivers based on the status of required
device tree nodes.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-11-08 20:13:22 +00:00
Ryan McClelland
9b7d71e044 drivers: adc: fix ref_internal for ads1x1x
The ADS1x13 does not have a PGA, and will have a fixed
internal reference voltage of 2048mV. This sets the internal
referece voltage for the ads1x1x to 2048 and adjust the gain
configuration to scale.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2022-11-08 11:33:25 -06:00
Nikodem Kastelik
56cab3b268 drivers: mbox: nrfx: align implementation to nrfx 2.10 API
New API version changes the signature of user callback
in the nrfx_ipc driver.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2022-11-08 10:48:38 +01:00
Nikodem Kastelik
54941e055c drivers: ipm: nrfx: align implementation to nrfx 2.10 API
New API version changes the signature of user callback
in the nrfx_ipc driver.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2022-11-08 10:48:38 +01:00
Armando Visconti
2217608c1c drivers/sensor: Call the correct stmemc API to set drdy_pulsed
Call lis2dw12_data_ready_mode_set() API in order to properly
set CLTR7.drdy_pulsed bit.
(Fix #51488)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2022-11-08 10:45:32 +01:00
Milind Paranjpe
21da8c27bf drivers: usb: mcux: Deinit then Init endpoint HAL during config
The USB device subsystem driver's set_interface() function calls
usb_dc_ep_configure() followed by usb_dc_ep_enable(). When
switching between alternate settings of a configuration's
interface, set_endpoint() can be followed by reset_endpoint() on
an endpoint. Some time later, set_endpoint() can be called again
on the same endpoint. This results in the HAL's
kUSB_DeviceControlEndpointInit function being called twice in a
row, which causes a memory allocation error. A simple solution is
to call the HAL's kUSB_DeviceControlEndpointDeinit function
before calling kUSB_DeviceControlEndpointInit. This overcomes the
memory allocation error.

Signed-off-by: Milind Paranjpe <mparanjpe@yahoo.com>
2022-11-08 09:43:44 +00:00
Tom Burdick
74b9699213 spi: SAM support SPI transfers with DMA
For larger transfers DMA can be used enabling other tasks
to continue running. A threshold of 32 byte transfers
is about right and is defined threshold value for using DMA.

This does not currently support multiple SPI transactions changing
chip select with DMA (though the hardware supports this) currently.
Instead opting for the simpler first change of enabling one shot
DMA SPI transfers for those where the size warrants it.

Adds the loopback binding option to enable the spi_loopback test.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-11-08 09:37:59 +00:00
Guy Morand
2419505e35 drivers: pwm: pwm_mcux_sctimer: Fix stopping PWM
By Starting the timer when period was set to 0, the SCTimer was giving
control of the pin back to the timer and over-riding the value written
to base->OUTPUT register. Consequently, the PWM timer was never
stopped and still using the previously configured period.

The PWM now correctly stops when setting the period to 0.

Signed-off-by: Guy Morand <guy.morand@bytesatwork.ch>
2022-11-07 10:10:37 -06:00
Jakub Dabek
b052143077 memory manager: Add runtime memory discovery
Add runtime physical memory discovery. This allows platforms with
different physical memory sizes to use the same driver for memory
management.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2022-11-07 06:44:05 -05:00
Dino Li
8665db1dab espi: it8xxx2: reset PLTRST# virtual wire signal during eSPI reset
The PLTRST# virtual wire signal's reset signal is eSPI Reset#.
But it8xxx2 didn't enable the feature by default. This change
will enable the feature at default.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-11-07 09:50:27 +01:00
Dat Nguyen Duy
da04197fdf drivers: gpio_s32: expose gpio_utils.h
Expose gpio_utils.h to follow updates in #51526

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2022-11-04 17:44:08 -04:00
Dat Nguyen Duy
6664953f12 drivers: gpio: support GPIO input with interrupt for NXP S32Z27
Add support input interrupts for GPIO pins on NXP S32Z27
SoC. The driver will convert GPIO pin to respective
interrupt line that will be processed by External
Interrupt Controller.

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2022-11-04 17:44:08 -04:00
Dat Nguyen Duy
607358b084 drivers: interrupt_controller: initial support for NXP S32Z27 EIRQ
Add initial support for the NXP S32Z27 SIUL2 External
Interrupt Controller. Each SIUL2 node has a child node
will act as an interrupt-controller that processes external
interrupt signals.

This driver is required to manage GPIO interrupts.

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2022-11-04 17:44:08 -04:00
Stancu Florin
42915e498e drivers: ti: cc13xx/cc26xx: implement ADC driver
New ADC driver for the TI CC13xx/CC26xx family.

ADC channel configurations are translated from Zephyr constants to
simplelink driverlib ones (e.g., sample times use a lookup table).

Async mode was also implemented & tested.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2022-11-04 17:31:59 -04:00
Kamil Serwus
cad62fae61 soc: atmel: add base support for C2x SOC
Adds Atmel SAMC20 and SAMC21 soc. C series is based on Cortex-M0+.
C21 contains CAN interface.

The init routines are same for SAMC20 and SAMC21. They use one
clock OSC48M without configuration.

The code is inspirated from atmel_sam0/samd21.

Signed-off-by: Kamil Serwus <kserwus@gmail.com>
2022-11-04 16:03:01 +01:00
Francois Ramu
d4889366ba drivers: dma: stm32 dma driver supporting the stm32mp1 serie
Add the support of the stm32MP1 family for DMA peripheral.
This dma driver is similar to the stm32H7.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-04 10:16:56 +01:00
Henrik Brix Andersen
ace688b075 drivers: eeprom: mchp_xec: add missing kernel.h include
Add missing kernel.h include.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-11-04 08:59:24 +00:00
Kai Vehmanen
2dc9257ae1 drivers: dmic: remove invalid assert on dmic->created
struct dai_intel_dmic never had a "created" member, so this assert seems
to be accidentally left in the code. Remove it to allow building builds
with dmic driver with asserts enabled.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-11-04 08:59:11 +00:00
Ryan Erickson
35df759e20 modem: hl7800: ensure net_if_down is triggered and not ignored
Trigger network dropped based on socket error notifications.
This debounces the network state and only triggers
the network interface to go down if the network
really drops or causes socket problems.
This will ensure upper networking stack layers can
cleanup broken sockets properly.

Debounce DNS resolver refresh.
Only trigger DNS resolver refresh if the DNS address changes.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-11-04 08:54:50 +00:00
Henrik Brix Andersen
39bb5cd06a drivers: eeprom: emulator: fix size_t format specifier
Fix the format specifier for logging size_t values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-11-03 16:38:48 -05:00
Andrei Emeltchenko
1f0a425622 drivers: e1000: Use lookup() instead of probe()
For PCI Ethernet driver it makes sense to use lookup(id) instead of
probe(bdf, id). Even when using different Qemu parameters we may get
different BDF for e1000 device.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-03 09:54:56 -05:00
Andrei Emeltchenko
1763ce7486 drivers: e1000: Add BUILD_ASSERT() for IRQ allocation
Add BUILD_ASSERT() to indicate that dynamic IRQ allocation is not
supported.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-03 09:54:56 -05:00
Andrei Emeltchenko
b5fd1b22c0 drivers: e1000: Change PCIE BDF for Q35 qemu
Since moving to Qemu Q35 machine the drivers with hardcoded BDF stop
working. Correct e1000 BDF.

Fixes #51829

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-03 09:54:56 -05:00
Sylvio Alves
f5dc229bc5 drivers: wifi: esp32: add softap config
In order to allow proper softAP mode, wifi
libraries and wpa supplicant requires this kconfig
to be enable.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-11-03 10:24:14 +01:00
Tim Lin
cffcc1901e ITE: drivers/i2c: Fix mutex bug
When an error occurs, the driver will miss unlocking a mutex.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-11-03 09:01:07 +00:00
Declan Snyder
0acfefed77 drivers: Add NXP CSS entropy driver
Add entropy driver using NXP CSS
Add Kconfig and DTS binding for the NXP CSSv2

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-11-02 16:54:10 -05:00
Pieter De Gendt
1ccd609376 drivers: flash: spi_flash_at45: Add device_is_ready for GPIO outputs
Verify that the GPIO port is ready before configuring.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-11-02 16:12:14 -05:00
Pieter De Gendt
850e6bd23e drivers: flash: spi_flash_at45: Use gpio_pin_set_dt helper
Replace occurrences of gpio_pin_set with the _dt helper.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-11-02 16:12:14 -05:00
Jaska Uimonen
1f6d6deaef sparse: fix sparse warnings found in sof compilation
Add proper sparse_force cast to assigments into sparse_cache pointers.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-11-02 14:34:20 -04:00
Henrik Brix Andersen
f30a5969d0 drivers: can: make the fake CAN driver generally available
Make the fake CAN controller driver available for use in tests outside of
the CAN shell test.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-11-02 08:19:33 -07:00
Théo Battrel
c9d68a5a4f Bluetooth: Move out string related function of common/log.h
Functions related to string manipulation that were defined in
`common/log.h` has been moved to the `common/bt_str.h` file and their
implementation in `common/bt_str.c`.

Files that were using those functions has been updated consequently.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2022-11-02 13:28:57 +01:00
Guy Morand
a124203929 drivers: gpio: gpio_mcux_lpc: Use arbitrary amount of IRQ
Zephyr implementation is limited to 4 IRQ per GPIO bank when up to 8 is
theoritically possible.

It is now possible to use until 8 IRQ per GPIO bank. This can be
achieved with minimal effort in a device tree overlay:

&gpio0 {
	interrupts = <4 2>,<5 2>,<6 2>,<7 2>,<32 2>,<33 2>;
};

&gpio1 {
	interrupts = <34 2>,<35 2>;
};

Signed-off-by: Guy Morand <guy.morand@bytesatwork.ch>
2022-11-02 10:34:00 +01:00
Pieter De Gendt
8254be215b drivers: pwm: pwm_sam: Add inverted polarity support
Set CPOL bit in Channel Mode Register if the PWM polarity is inverted.

Fixes #51544

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-11-02 10:33:01 +01:00
Pieter De Gendt
469b76c17f drivers: pwm: pwm_sam: Add alias definition for different SoCs
The PWM definitions for Atmel SAM SoCs can differ slightly.

This commit adds support for the PWM defines used by SAM4S.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-11-02 10:33:01 +01:00
Tomasz Moń
3a71d88b82 drivers: flashdisk: make disk access thread-safe
Protect runtime flashdisk data with mutex to avoid race conditions.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-11-02 10:31:58 +01:00
Tomasz Moń
a4c59a335e drivers: flashdisk: implement basic write caching
Cache written data to avoid rewriting same flash page multiple times
when writing subsequent flash pages. The cache is used for reads to
account for reading not yet committed (i.e. dirty) page data. Speeding
up reads is not intention of this patch and therefore the read path
does not modify cache state.

Fixes: #30212

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-11-02 10:31:58 +01:00
Henrik Brix Andersen
566c64f0c0 drivers: can: loopback: guard against out-of-bounds filter IDs
Guard against out-of-bounds filter IDs when removing RX filters.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-11-02 10:31:48 +01:00
Henrik Brix Andersen
efd0d3ba96 drivers: can: loopback: add log message for full TX msgq
Emit a debug log message if the TX message queue is full.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-11-02 10:31:48 +01:00
Henrik Brix Andersen
728138023b drivers: can: loopback: rename receive function
Rename the CAN loopback driver receive function to make the code easier to
understand. Add proper check against NULL for RX callback function
pointers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-11-02 10:31:48 +01:00
Henrik Brix Andersen
a5e534a283 drivers: can: loopback: process TX callbacks in non-loopback mode
The TX callbacks must be processed regardless of the device being in
loopback mode or not.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-11-02 10:31:48 +01:00
Declan Snyder
3b2456dd6e drivers: disk: Default SDMMC Kconfig based on DT
Set default of DISK_DRIVER_SDMMC Kconfig based on the devicetree.
This should avoid having to set the kconfig at the board level
in order to use sdmmc.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-11-02 15:43:49 +09:00
Kumar Gala
d2326fe187 drivers: power_domain: Update drivers to use devicetree Kconfig symbol
Update power_domain drivers to use DT_HAS_<compat>_ENABLED Kconfig
symbol to expose the driver and enable it by default based on
devicetree.

We remove one reference in prj.conf that is no longer needed.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-11-02 15:41:17 +09:00
Kumar Gala
e11074d2a7 drivers: timers: riscv: don't leak Kconfig symbols
Add if check around RISC-V machine specific kconfig symbols so they
aren't exposed to everyone.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-11-02 15:40:59 +09:00
Maureen Helm
0ddc2a9b65 drivers: sensor: Remove brackets from sensor info shell command output
Brackets were originally used in the sensor info shell command output to
make it obvious when a field is a null string, however they incorrectly
suggest that a field is an array. Remove the brackets and conditionally
print "(null)" instead.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-11-02 15:40:24 +09:00
Henrik Brix Andersen
abf82013ac drivers: can: add support for configuring CAN emulation in QEMU
Add support for configuring CAN emulation support in QEMU. For now, the
only supported CAN controller is the single-channel Kvaser PCIcan PCI card.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-11-01 15:22:31 -04:00
Henrik Brix Andersen
58e12726bf drivers: can: add driver for the Kvaser PCIcan CAN controller PCI card
Add driver for the Kvaser PCIcan CAN controller PCI card for use with QEMU.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-11-01 15:22:31 -04:00
Henrik Brix Andersen
3c99a1e015 drivers: pcie: reintroduce support for I/O BARs
Reintroduce support for accessing I/O BARs which was removed in
43d84147d9.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-11-01 15:22:31 -04:00
Tom Burdick
c548c1be1e timer: Revert "timer: HPET is also a lock free readable timer"
This seems to have caused CI failures and its unclear why just yet
so revert instead.

This reverts commit cbee9e9fdd8060d0ca4e91037b3f99f631e4b1a5.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-11-01 23:15:23 +09:00
Erdem Efe
0e05686d52 sensor: freefall added to lis2dw12 sensor driver.
lis2dw12 supports freefall detection and set related parameters

Signed-off-by: Erdem Efe <erdemefe1@gmail.com>
2022-11-01 08:25:24 -05:00
Guillaume Gautier
5b4ad9127f drivers: gpio: STM32U5 independant IO supply
Fix the enabling of the independant IO supply.
Function LL_PWR_EnableVddIO2 is called LL_PWR_EnableVDDIO2 on U5.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-11-01 12:00:25 +01:00
Kumar Gala
0a7c25e649 drivers: timer: intel_adsp: Update driver to use dts Kconfig symbol
Update Intel ADSP timer driver to use DT_HAS_<compat>_ENABLED Kconfig
symbol to expose the driver and enable it by default based on
devicetree.

We remove setting 'default y' for the timer driver in
Kconfig.defconfig.series as that is now handled in the driver Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-11-01 09:03:17 +00:00
Jeppe Odgaard
625efd8447 drivers: modem: gsm: Fix set gsm->state in gsm_ppp_stop
The driver should set the `gsm->state` to GSM_PPP_STOP when
`gsm_ppp_stop()` is run. This commit fixes that.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/51505

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2022-11-01 08:59:59 +00:00
Tom Burdick
2001d43f96 timer: HPET is also a lock free readable timer
Mark the timer as having a lock free read of the cycle count
so that spin lock debugging can include lock time asserts.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-10-31 21:28:29 -04:00
Kumar Gala
f389f702cb drivers: ipm: Update drivers to use devicetree Kconfig symbol
Update IPM drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-31 16:45:56 -05:00
Flavio Ceolin
13bedbe1c9 intel: ace15: Enabling sha driver by default
Enable intel-adsp-sha driver y default when it is enabled in DT.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-10-31 12:45:33 -07:00
Flavio Ceolin
77a2aaa93e crypto: intel-sha: Rename to intel,adsp-sha
Rename DT binding to intel,adsp-sha.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-10-31 12:45:33 -07:00
Flavio Ceolin
da520fe6fb crypto: intel-sha: Fix assorted warnings
There were multiple warnings due implicit type conversions.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-10-31 12:45:33 -07:00
Flavio Ceolin
6ad8b4626f crypto: intel-sha: Support multiple instances
Support multiple DTS instances in the C code, also
just initialize devices that are not disabled.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-10-31 12:45:33 -07:00
Paul Jans
e35ce37443 drivers: ethernet: enc28j60: Added carrier status update functionality
Expanded the enc28j60 driver to update its carrier status
whenever the Ethernet cable is plugged in or out. I used the
enc424j600 driver as reference, as this driver already
included this functionality. The driver will now take
the interface offline whenever the cable is not plugged in
and stop sending packets. The respective events are also
generated for use in the application. I tested it locally
on my nRF52840 based gateway board using the enc28j60 network
chip. Everything worked as expected.

Signed-off-by: Paul Jans <paul.jans.1999@hotmail.com>

Fixes #51214
2022-10-31 17:03:18 +01:00
Parthiban Nallathambi
12eb38c5a5 sensor: dht: fix code stlying
fix indent, change space to tab

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2022-10-31 09:28:05 -05:00
Maureen Helm
97defe7095 drivers: sensor: Add shell command to get sensor info iterable section
Adds a new conditional shell command to the sensor shell to get data
from the sensor info iterable section, such as vendor and model name,
for all sensors.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-10-31 11:21:37 +01:00
Maureen Helm
eee3d8f566 drivers: sensor: Add sensor info iterable section
Adds an iterable section in ROM to hold constant information, such as
vendor and model name, for all enabled sensor driver instances. This
will be used by the future sensor subsystem to enumerate all available
sensors in the system.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-10-31 11:21:37 +01:00
Martin Jäger
d5168a8d96 drivers: i2c: esp32: set timeout to allow clock stretching
The ESP32 series MCUs allow to set a timeout which triggers an error
if the SCL line is unchanged for the specified amount of time.

By default, the ESP-IDF HAL sets the timeout to an arbitrary value of
10 times the bus cycle.

This is not sufficient for chips like the TI bq76952, which pulls the
SCL line low (clock stretching) for several 100 µs.

The timeout should also not be dependent on the chosen bitrate, as it
is defined by the time a chip needs for internal calculation before it
can provide requested data or continue communication.

This commit adds a property to devicetree to allow configuration of
the scl timeout. This value is set via direct register access, as the
ESP-IDF HAL does not provide access to the enable bit and does not
give any information about the maximum size of the timeout (defined
in I2C clock cycles in the register).

Fixes #51351

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-10-31 16:41:57 +09:00
Martin Jäger
1529968884 drivers: i2c: esp32: fix indentation
No functional changes.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-10-31 16:41:57 +09:00
Jay Vasanth
37874f8f67 drivers: spi: fix formatting in mec172x ldma driver
fix leading white space and use tabs instead of space
in mec172x spi ldma driver.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-10-28 14:29:46 -05:00
Jay Vasanth
d0fe965b9f drivers: espi_saf: Add Microchip MEC172x eSPI SAF version 2 driver
Microchip MEC172x has a modified eSPI SAF hardware implementation.
Hardware changes include multiple clock dividers for each SPI
flash device and data transfer using QMSPI local DMA.
espi reset interrupt is made a higer priority in MEC172x devicetree
because espi reset event resets all espi hardware and we don't
to want to service any other espi interrupt blocks when espi reset
occurs.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-10-28 14:29:46 -05:00
Jay Vasanth
0976343513 drivers: SPI: MEC172x QMSPI clock fix
Microchip MEC172x QMSPI expanded its clock divider register
field from 8 to 16 bits. QMSPI source clock is on the fast
peripheral domain therefore get the frequency from the clock
control driver.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-10-28 14:29:46 -05:00
Jay Vasanth
49e22b825a drivers: clock-control: Microchip MEC172x adjust clock based on OTP
Microchip MEC172x CPU and fast peripheral (QMSPI and PK) are
clock source is based upon an OTP setting. Add logic to adjust
clock source based on OTP value. If the OTP value is ever changed
this fix will allow calcluation of correct clock rate.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-10-28 14:29:46 -05:00
Damian Nikodem
b953ff1418 drivers: dmic: enable dmic mono configuration
DMIC configuration should allow to use mono source mode.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2022-10-28 13:42:28 +02:00
Johann Fischer
b26fca430c drivers: flashdisk: remove all DISK_FLASH* Kconfig options
Remove all obsolete DISK_FLASH* Kconfig options.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-10-28 12:45:58 +02:00
Tomasz Moń
050e74e0a1 drivers: flashdisk: use instance specific buffers
Allocate cache buffer for every flashdisk instance instead of using one
globally shared buffer.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-10-28 12:45:58 +02:00
Tomasz Moń
fb30d8221d drivers: flashdisk: use devicetree to obtain flash partition info
Use devicetree to obtain information for all zephyr flash disks.

Co-authored-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-10-28 12:45:58 +02:00
Carles Cufi
8e4d499fa0 treewide: Use CONFIG_*_ENDIAN instead of __BYTE_ORDER__
In order to avoid using multiple sources of truth for the platfom's
endianness, convert the in-tree code to use the (BIG|LITTLE)_ENDIAN
Kconfig variables exclusively, instead of the compiler's
__BYTE_ORDER__.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-10-28 19:23:46 +09:00
Ayan Kumar Halder
2174501a10 Arm: GICv3: Enable reading GICR_TYPER via two sys_read32() on AArch32
GICR_TYPER is a 64 bit register. On AArch32 when one uses sys_read64(),
this results in ldrd instruction. When Zephyr runs as a VM, 'LDRD'
instruction on an emulated MMIO region gets trapped to the hypervisor as
data abort.

Refer the following paragraph from ARM DDI 0487G.b ID072021 :-

Section - "ISS encoding for an exception from a Data Abort",
"For other faults reported in ESR_EL2, ISV is 0 except for the following
stage 2 aborts:

AArch32 instructions where the instruction:
— Is an LDR, LDA, LDRT, LDRSH, LDRSHT, LDRH, LDAH, LDRHT, LDRSB, LDRSBT,
LDRB, LDAB, LDRBT, STR, STL, STRT, STRH, STLH, STRHT, STRB, STLB, or STRBT
instruction."

As 'LDRD' is not in the list, so ISV==0. This implies that Arm could not
decode the instruction for the hypervisor (in EL2) to execute it.

Thus, we have abstracted this read into arm_gic_get_typer().
For AArch64, we use sys_read64() as before.
For AArch32, we use sys_read32() twice to read the lower and upper 32 bits
of GICR_TYPER.

Thus, we ensure that when the access is trapped for AArch32, Arm generates
a valid ISS so that hypervisor can execute it.

Signed-off-by: Ayan Kumar Halder <ayankuma@amd.com>
2022-10-28 10:36:36 +02:00
Martin Tverdal
0cf6cac77e Bluetooth: extended adv reports with legacy content discardable
To avoid legacy extended adv repots blocking important
events or work, mark them as discaradble.

Signed-off-by: Martin Tverdal <martin.tverdal@nordicsemi.no>
2022-10-28 07:55:44 +00:00
Tim Lin
fc45aed16d ITE: drivers/i2c: Print the error messages when I2C transfers fail
Print the error messages about the state of the host register
when the I2C transfers fail. This is useful for debugging.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-10-28 07:55:31 +00:00
Damian Nikodem
bedc2e7ab4 drivers: dmic: remove soft_reset from dmic init flow
DMIC does not need to use SOFT_RESET bit to start collecting data if
periodic_start bit is enabled.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2022-10-28 09:51:35 +02:00
Damian Nikodem
39c2007b04 drivers: dmic: update dmic flow initialization
DMIC configuration should allow the use of periodic start.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2022-10-28 09:51:35 +02:00
Jaska Uimonen
2389e446ab dma: gpdma: fix cfg_hi and cfg_lo initialization
If cfg_hi and cfg_lo are not set to zero in config setting, different
dma slot value is bitwise ORred to the previous set value. Thus fix it.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-10-27 17:09:27 +02:00
Neil Armstrong
3b407a1987 drivers: entropy: Add the PSA Crypto Random entropy driver
This adds an entropy driver calling the PSA Crypto psa_generate_random()
API to get random bytes.

Currently this only uses the TFM provided psa_generate_random().

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-10-27 16:32:05 +02:00
Balaji Kulkarni
7f1a5cce12 drivers: gpio: expose gpio_utils.h to external GPIO drivers
Expose "gpio_utils.h" header for external GPIO drivers.

Fixes #48609.

Signed-off-by: Balaji Kulkarni <balaji.kulkarni92@gmail.com>
2022-10-27 15:38:51 +02:00
Maureen Helm
a9b223b26b drivers: sensor: Refactor drivers to use SENSOR_DEVICE_DT_INST_DEFINE
Refactors all sensor drivers to use SENSOR_DEVICE_DT_INST_DEFINE, which
is a sensor-specific variant of DEVICE_DT_INST_DEFINE that provides a
common place to instantiate additional data structures for the future
sensor subsystem and/or sensor driver stats.

This approach was inspired by I2C_DEVICE_DT_INST_DEFINE to streamline
adding I2C stats support across all I2C drivers.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-10-27 09:27:14 +00:00
Mahesh Mahadevan
d13ffceb62 timer: nxp: Update OS-Timer to use wakeup-source flag
Enable the OS Timer to be a wakeup source only if
configured through device tree property.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-10-27 11:03:13 +02:00
Henrik Brix Andersen
58afbc8f26 drivers: can: mcp2515: add support for multiple device instances
Add support for multiple MCP2515 CAN controller device instances.

Fixes: #51458

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-10-27 11:03:05 +02:00
Mehdi Zemzem
e8457de662 drivers: sensor: iis2dh: Add macro DT_DRV_COMPAT to iis2dh_trigger.c
Without this define, the structure iis2dh_device_config
is defined incorrectly.

The structure is defined in iis2dh.h file as follows:
struct iis2dh_device_config {
	struct spi_dt_spec spi;
	struct i2c_dt_spec i2c;
	uint8_t pm;
	struct gpio_dt_spec int_gpio;
};

without the macro

the structure is defined as
struct iis2dh_device_config {
 uint8_t pm;
 struct gpio_dt_spec int_gpio;
};

which results in accessing the wrong data when
calling iis2dh_init_interrupt
function (or any other functions in this file)

Signed-off-by: Mehdi Zemzem <mehdi.zemzem2@gmail.com>
2022-10-26 15:58:26 -05:00
Kumar Gala
66417f7036 interrupt_controller: intc_esp32: Convert CONFIG_MP_NUM_CPUS handling
Move runtime checks to use arch_num_cpus() and build checks
to use CONFIG_MP_MAX_NUM_CPUS.  This is to allow runtime
determination of the number of CPUs in the future.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-26 12:00:45 +02:00
Keith Packard
c0d95492fc drivers/net: Increase recv_cb buffer to prevent snprintk overflow
While the 'count' value "should" never be larger than two digits,
increase the size of the snprintk buffer to be large enough to hold
the longest possible value.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-10-26 12:00:04 +02:00
Kamil Serwus
c707f1ed28 drivers: adc: sam0: fix compliation for feature SAMs for C21.
C21 doesn't have ADC_REFCTRL_REFSEL_AREFB and have different APBs.

Signed-off-by: Kamil Serwus <kserwus@gmail.com>
2022-10-25 15:48:13 -07:00
Henrik Brix Andersen
f8a88cdb27 drivers: can: use flags fields for can_frame and can_filter structs
The can_frame and can_filter structs support a number of different flags
(standard/extended CAN ID type, Remote Transmission Request, CAN-FD format,
Bit Rate Switch, ...). Each of these flags is represented as a discrete bit
in the given structure.

This design pattern requires every user of these structs to initialize all
of these flags to either 0 or 1, which does not scale well for future flag
additions.

Some of these flags have associated enumerations to be used for assignment,
some do not. CAN drivers and protocols tend to rely on the logical value of
the flag instead of using the enumeration, leading to a very fragile
API. The enumerations are used inconsistently between the can_frame and
can_filter structures, which further complicates the API.

Instead, convert these flags to bitfields with separate flag definitions
for the can_frame and can_filter structures. This API allows for future
extensions without having to revisit existing users of the two
structures. Furthermore, this allows driver to easily check for unsupported
flags in the respective API calls.

As this change leads to the "id_mask" field of the can_filter to be the
only mask present in that structure, rename it to "mask" for simplicity.

Fixes: #50776

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-10-25 16:32:10 +02:00
Kumar Gala
a12b7734de interrupt_controller: gic: Rework usage of CONFIG_MP_NUM_CPUS
Replace usage of CONFIG_MP_NUM_CPUS with CONFIG_MP_MAX_NUM_CPUS for
init and declaration as we phase out CONFIG_MP_NUM_CPUS usage.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-25 10:52:17 +02:00
Théo Battrel
fdd0a26348 Bluetooth: Remove BT_HEXDUMP_DBG
Replace unnecessary `BT_HEXDUMP_DBG` with `LOG_HEXDUMP_DBG`.

`BT_HEXDUMP_DBG` did an extra cast to `const uint8_t *` on its first
argument. This was probably the reason it was introduced. But the
current definition of `LOG_HEXDUMP_DBG` does this cast for us.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2022-10-25 10:48:17 +02:00
Gerard Marull-Paretas
c022dd7756 drivers: mipi_dsi: mcux: add missing soc.h
It looks like this platform is using soc.h to declare some display APIs,
imxrt_pre/post_init_display_interface(). This likely deserves a better
design, but for now let's fix compiler warnings.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-24 12:44:57 +02:00
Gerard Marull-Paretas
eafc6e7851 drivers: display: rm68200: add missing kernel.h include
Kernel API was being used (k_sleep) without including Kernel headers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-24 12:44:57 +02:00
Sam Hurst
1a5e2c9c13 usb-c: Remove VBUS measurement and control
A USB-C VBUS driver will be used to measure VBUS
instead of accessing the measurement hardware
directly.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-10-22 18:38:35 -04:00
Sam Hurst
f4b2457322 drivers: usb-c: Update TCPC driver to use devicetree Kconfig symbol
Update TCPC driver to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-10-22 18:38:35 -04:00
Sam Hurst
505892f1bb usb-c: Add USB-C VBUS ADC driver
This commit adds a VBUS driver the uses an ADC connected
to a voltage divider to measure VBUS.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-10-22 18:38:35 -04:00
Sam Hurst
9659819365 usb-c: tcpc: Changes the @return tag to @retval
The "@return" command should be used for the arbitrary return
description, and "@retval <return value>" for the description
of named return value

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-10-22 18:38:35 -04:00
Sam Hurst
050323f00f stm32: Use DT_NUM_INST_STATUS_OKAY for num IRQ sources
Use DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) to determine
number of potential interrupt sources. This mitigates
the wasting of memory on devices with mutliple UCPD ports
but only one UCPD port is used.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-10-22 18:38:35 -04:00
Sam Hurst
99e07709ff boards: arm: Update STM32 UCPD nodes with pin control
Assign the pins for the STM32G071b and STM32G081b STM32
UCPD peripherals so the UCPD driver can properly
configure the device.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-10-22 18:38:35 -04:00
Sam Hurst
3dd07aebdd usb-c: Change dir name from usbc to usb_c
For improved readability, change dir name from
usbc to usb_c

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-10-22 18:38:35 -04:00
Henrik Brix Andersen
fa54e3aa1d drivers: can: sja1000: remove unused variables
Remove unused variables from the CAN SJA1000 driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-10-22 14:37:18 +09:00
Jun Lin
305e198e45 driver: i2c: npcx: do bus recovery when the transaction timeout
When there is a timeout for an i2c transaction, the i2c driver should do
the recovery logic to make the bus and driver state machine go back to
idle. Otherwise, it will cause the following transaction to fail because
the state machine keeps in an inappropriate state.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-10-22 14:36:50 +09:00
Peter Marheine
d4549ed808 it8xxx2: generalize ILM support
Executing code out of RAM on IT8xxx2 requires that the relevant
addresses be mapped onto the CPU's instruction memory bus, referred to
by ITE documentation as Instruction Local Memory (ILM). ILM mappings
configure blocks of RAM to be used for accesses to chosen addresses when
performing instruction fetch, instead of the memory that would normally
be accessed at that address.

ILM must be used for some chip features (particularly Flash
self-programming, to execute from RAM while writing to Flash), and has
historically been configured in the Flash driver. The RAM for that was
hard-coded as a single 4k block in the linker script.  Configuring ILM
in the flash driver is confusing because it is used by other SoC code as
well, currently in code that cannot depend on the Flash being functional
or in hand-selected functions that seem performance-critical.

This change moves ILM configuration to a new driver and dynamically
allocates RAM to ILM in the linker script, allowing software use of the
entire 64k RAM depending on configuration.  This makes ILM configuration
more discoverable and makes it much easier to correctly support the
CODE_DATA_RELOCATION feature on this SoC.

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
2022-10-21 20:31:47 +02:00
Bernardo Perez Priego
810809f96b driver: adc: npcx: enable adding work queue for adc comparator
ADC comparator driver submits notifications into system work queue, this
change will make driver to use dedicated work queue instead by using
`CONFIG_ADC_CMP_NPCX_WORKQUEUE`.

Dedicated work queue and priority are configurable as well.

Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>
2022-10-21 10:29:30 -05:00
Krishna T
3cc1a6e9b2 drivers: net: loopback: Optimize packet drop
If we are dropping packets, then drop then early without the clone, this
improves zperf performance.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-10-21 13:15:05 +02:00
Krishna T
3b2243dd0c drivers: net: loopback: Fix typo
Fix a typo in the comment.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-10-21 13:15:05 +02:00
Krishna T
c23823a996 drivers: net: loopback: Make MTU configurable
This is useful to test higher packet sizes to simulate L2
Ethernet/Wi-Fi.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-10-21 13:15:05 +02:00
Kumar Gala
a1195ae39b smp: Move for loops to use arch_num_cpus instead of CONFIG_MP_NUM_CPUS
Change for loops of the form:

for (i = 0; i < CONFIG_MP_NUM_CPUS; i++)
   ...

to

unsigned int num_cpus = arch_num_cpus();
for (i = 0; i < num_cpus; i++)
   ...

We do the call outside of the for loop so that it only happens once,
rather than on every iteration.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-21 13:14:58 +02:00
Andrzej Kuros
bc78a03ca0 i2c_shell: add command to configure bus speed
Possibility to configure i2c speed through I2C_SHELL
command `i2c speed`.

Signed-off-by: Andrzej Kuros <andrzej.kuros@nordicsemi.no>
Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2022-10-20 16:02:32 +02:00
Gerard Marull-Paretas
64ea7f61ba include: add missing errno.h
Some files were using errno codes without including errno.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-20 22:52:09 +09:00
Gerard Marull-Paretas
17c5696f71 include: add missing zephyr/sys_clock.h
Some files were using definitions from sys_clock.h, e.g. MSEC_PER_SEC
without including the header.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-20 22:52:09 +09:00
Gerard Marull-Paretas
4010ac103e include: add missing zephyr/irq.h include
Some files were using the IRQ APIs, e.g. irq_lock() without including
zephyr/irq.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-20 22:52:09 +09:00
Gerard Marull-Paretas
b1a0d0ae86 include: add missing zephyr/kernel.h
Some files were using the Kernel APIs/types without including
zephyr/kernel.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-20 22:52:09 +09:00
Jun Lin
42bb67ca85 driver: UART: npcx: remove unnecessary guard CONFIG_UART_INTERRUPT_DRIVEN
Currently, uart_npcx_pm_policy_state_lock* functions are guarded by
CONFIG_UART_INTERRUPT_DRIVEN && CONFIG_PM. However, it is unnecessary to
guard them with CONFIG_UART_INTERRUPT_DRIVEN as the polling mode UART
driver also uses these functions.
This commit removes it and leaves those functions guarded by CONFIG_PM
only.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-10-20 15:42:17 +02:00
Andriy Gelman
890e84a6aa drivers: flash: soc_flash_xmc4xxx: Add missing kernel.h header
Fixes build of flash_shell sample after commit
a6a4400b86.
west build -p -b xmc45_relax_kit samples/drivers/flash_shell

Also include stdint.h.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-10-20 15:41:39 +02:00
Jun Lin
82a887c98d driver: eSPI: npcx: support multiple bytes mode for Port80
eSPI PUT_IOWR_SHORT protocol can send 1/2/4 bytes of data in a single
transaction. This allows the host to send max 32-bits Port80 code
at one time. This CL sets bits OFS0_SEL~OFS3_SEL in the DPAR1 register
to let the EC hardware put the full Port80 code to DP80BUF FIFO.
It also groups the N-byte code into a single 32-bits variable when
necessary by analyzing the offset field in the DP80BUF register.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-10-20 15:41:22 +02:00
Michal Sieron
702caf1c7e samples: boards: Add Qomu board sample
First pads are being configured for use by the FPGA.
Then CPU loads usbserial bitstream.
Finally it reenables clocks, sets up USB PID and waits for device to
enumerate.

Also disable software resets in used clocks.

Signed-off-by: Michal Sieron <msieron@antmicro.com>
2022-10-20 15:41:09 +02:00
Michal Sieron
88e8b69daf drivers: serial: Add QuickLogic USBserialport_S3B support
USB interface that may be used to send messages from a USB host to
the M4 processor in the S3B, and vice-versa.

Signed-off-by: Michal Sieron <msieron@antmicro.com>
2022-10-20 15:41:09 +02:00
Kumar Gala
fc95ec98dd smp: Convert #if to use CONFIG_MP_MAX_NUM_CPUS
Convert CONFIG_MP_NUM_CPUS to CONFIG_MP_MAX_NUM_CPUS as we work on
phasing out CONFIG_MP_NUM_CPUS.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-20 22:04:10 +09:00
Robert Lubos
5798a7b359 drivers: wifi: esp_at: Align driver with iface status upgrade
Align the offloaded esp_at driver with interface state handling update.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-10-20 10:00:31 +02:00
Robert Lubos
3e8c39a41b drivers: modem: wncm14a2a: Align driver with iface status upgrade
Align the offloaded wncm14a2a driver with interface state handling
update.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-10-20 10:00:31 +02:00
Robert Lubos
04b3098f71 drivers: modem: hl7800: Align driver with iface status upgrade
Align the offloaded hl7800 driver with interface state handling update.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-10-20 10:00:31 +02:00
Robert Lubos
dd535f611d net: ppp: Align PPP driver/L2 with iface state upgrade
Align PPP drivers/L2 with interface state handling update. Use the
carrier on/off notification instead of bringing the interface up/down to
update the interface state.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-10-20 10:00:31 +02:00
Robert Lubos
b279bfd2dd net: ethernet: Align Ethernet drivers/L2 with iface state upgrade
Align Ethernet/Wi-Fi drivers/L2 with interface state handling update.

For drivers, that did not support carrier detection, no changes are
needed.

Driver that did support carrier detection, are updated to set the
carrier state to OFF by default, instead of setting the
NET_IF_NO_AUTO_START flag. This allows to postopne the actual
NET_EVENT_IF_UP notification until driver detects that carrier is ready.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-10-20 10:00:31 +02:00
Michał Zając
f93c68239e wifi: eswifi: fix random crash due to work->handler set to NULL
This fixes a random crash caused by race condition in the eswifi
driver used by the disco L475 iot1 board.

Signed-off-by: Michał Zając <m.zajac@avsystem.com>
2022-10-19 16:06:49 +02:00
Nick Kraus
48fce027a0 drivers: gpio: Add Open-Drain Support
Adds open drain support to atmel,sam-gpio drivers, by writing to the
PIO_MDER or PIO_MDDR registers during gpio configure.

Signed-off-by: Nick Kraus <nick@nckraus.com>
2022-10-19 16:06:40 +02:00
Wouter Cappelle
984b612c48 drivers: uart: stm32 async uart driver should free next buffer
When disabling async rx, the next buffer is not free-ed by
the stm32 uart driver.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-10-19 16:05:25 +02:00
Felipe Neves
5760fcc8ab soc: xtensa: esp32_net:
Fixes boot sequence for esp32_net, also reflect the changes in the
esp32 ipm driver.

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2022-10-19 16:03:00 +02:00
Gerard Marull-Paretas
2043d921e0 drivers: clock_control: stm32: add missing headers
clock_stm32_ll_common.h was missing <stdint.h> and <zephyr/device.h>. It
turns out things worked because <zephyr/init.h> has a forward
declaration of struct device.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-19 16:01:28 +02:00
Tom Burdick
94251ac843 timer: APIC timer count is a lock free accessor
Selects the hidden Kconfig to note that the APIC timer's cycle count
accessor is a lock free path and may use the spin lock time limit check.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-10-18 14:14:12 +02:00
Tom Burdick
6277386591 timer: cAVS cycle count is lock free
Select the Kconfig option noting that the cavs (intel adsp)
timer driver provides a lock free cycle count accessor and
therefore can be used with a spin lock time limit assert.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-10-18 14:14:12 +02:00
Tom Burdick
872e3553f9 kernel: Option to assert on spin lock time
Spin locks held for any lengthy duration prevent interrupts and
in a real time system where interrupts drive tasks this can be
problematic. Add an option to assert if a spin lock is held for
a duration longer than the configurable number of microseconds.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-10-18 14:14:12 +02:00
Arnaud Pouliquen
fb43a48065 drivers: ipm: fix infinite TXF interrupt
The TXF interrupt mask is not properly set. In this case the
interrupt line is not cleaned, leading to the re-entrance
in the interrupt handler.

the issue is linked to the management of the IPCC_CxTOCySR value.
The TXF interrupt is triggered when the IPCC_CyMR is channel bit is
set to 0 and the IPCC_CxTOCySR associated bit move from 1 to 0.

The fix is to check if the IPCC_CxTOCySR channel bit is 0 instead of 1.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2022-10-18 14:13:34 +02:00
Serhiy Katsyuba
99071f99df drivers: dma: Fix for DW DMA link list alignment
For Intel ACE1.x the GPDMA link list structure should be aligned
to 64 bytes to avoid the link list entry fetch crossing the 64 bytes
address alignment.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2022-10-18 14:13:01 +02:00
Daniel DeGrasse
842ee0acf3 drivers: regulator: support regulator-boot-on for PMIC driver
Add support for regulator-boot-on to PMIC driver. Many PMIC devices will
be enabled at boot, so this property allows the regulator framework
to correctly track their state.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-18 14:12:52 +02:00
Daniel DeGrasse
f10ec43808 drivers: regulator: add mode specific configuration functions for PMIC
Add mode specific PMIC configuration functions, to allow consumers to
configure target voltages of each regulator mode. This will allow users
to enable or disable, as well as set target voltages for regulator modes
without actually entering that mode.

This feature can be useful for power managment applications where the
consumer may want to switch the regulator to low power mode at a later
time.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-18 14:12:52 +02:00
Daniel DeGrasse
92c40db91f drivers: regulator: remove mode awareness from PMIC
Remove mode awareness from PMIC voltage setting, current setting, and
enable/disable functions. Concepts such as regulator consumers do not
work well with multiple modes, so support for changing voltages or
disabling regulators in each mode has been removed.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-18 14:12:52 +02:00
Simen S. Røstad
b231415343 ADXL362: Do not clear last bits of 16-bit inactivity time value
The inactivity time registers identified by `ADXL362_REG_TIME_INACT_L`
and `ADXL362_REG_TIME_INACT_H` accepts a 16-bit value. (8 in each).
Without this change the last 5 bits of the register value
will be cleared.

Clearing the last bits of the register value greatly reduces the maximum
inactivity time that can be set.

Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
2022-10-18 14:11:53 +02:00
Anas Nashif
bdf161a181 drivers: intc_dw: fixed misnumbered value of reserved slots in structure
The number of unused elements should be 199, not 99. mistyped in
previous commit.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-17 13:37:09 -04:00
Henrik Brix Andersen
5f8983f2ec drivers: can: npl: ensure CANFD_FDF flag is defined
Linux kernels before v5.14 do not define the CANFD_FDF flag. The flag is
disregarded within the Linux kernel. It is just there for being able to
reuse the canfd_frame struct for classic CAN frames in Linux user-space
applications.

Define the CANFD_FDF flag locally if not already defined to allow compiling
against older Linux kernel headers.

See the following Linux kernel commit for further details:
02546884221279da2725e87e35348290470363d7

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-10-17 17:04:16 +02:00
Florian Grandel
b674ed6b8b net: pkt: decouple from ieee802154 internals
This change implements part two of the program laid out in the TSCH RFC,
see #50336#issuecomment-1250250154 :

> Consolidate IEEE 802.15.4 options in net_pkt

This change improves decoupling of generic net core code from
IEEE 802.15.4 internals. It also simplifies IEEE 802.15.4
attribute cloning and thereby makes it easier to maintain and less
error prone (and probably even faster as individual bits are no longer
copied over separately).

This enables us to extend and design IEEE 802.15.4 L2 attributes inside
the package in isolation from the net core code which will no longer
have to be changed when introducing changes or additions to the flags.

This flexibility will be built upon in later change sets to model the
IEEE 802.15.4 attributes closer to the spec.

The solution is inspired by Linux's sk_buff->cb attribute which addresses
the same concern as the attribute introduced in this change set:
https://elixir.bootlin.com/linux/v6.0.1/source/include/linux/skbuff.h#L871

As the inline comment says: The cb attribute can be made a union or even a
uint8[something] in the future, if further L2s need a control block, too.
Right now such full indirection would make the code overly abstract, so
I chose to compromise with maintainability in mind.

Care has been taken to ensure that this changes does not introduce
additional padding into the net package. To maintain zero-padding, future
changes to the net packet struct will have to ensure that the
IEEE 802.15.4 struct is 4-byte aligned (iff the IEEE 802.15.4 struct
continues with max uint32_t scalar members) which is no deviation from
the previous implementation.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-17 16:54:37 +02:00
Florian Grandel
93647ed52b drivers: ieee802154: nrf: wrapped pkt attribute access
Nordic's IEEE 802.15.4 radio driver adapter layer had a few raw accesses
to net packet attributes.

Packet attributes should never be accessed directly, though, but only
through the dedicated accessor methods provided by the net core.

This change replaces raw accesses to packet attributes by their
respective wrapper functions.

This also is a necessary precondition to the isolation and
encapsulation of IEEE 802.15.4 specific packet attributes which will be
introduced in a later commit of this change set.

Fixes: #51264

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-17 16:54:37 +02:00
Florian Grandel
62ed153a86 drivers: ieee802154: don't allocate rx pkt from tx pool
Several IEEE 802154 drivers allocated RX packets from the TX pool.

This may seem like a minor problem at first sight but it may become
problematic if the pool is used to distinguish package types as is the
case in some code paths, e.g. for packet priority or determination of
the packet buffer pool.

This bug also has the potential of starving the TX pool capacity which
even may make devices vulnerable to DoS attacks as sending may be
prohibited by addressing enough RX packets to a device to let it run out
of TX capacity.

Fixes: #51261

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-17 16:54:37 +02:00
Gerard Marull-Paretas
178bdc4afc include: add missing zephyr/irq.h include
Change automated searching for files using "IRQ_CONNECT()" API not
including <zephyr/irq.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-17 22:57:39 +09:00
Krzysztof Chruscinski
e322447109 logging: Initial multidomain support
Adding multidomain support by introducing log_link module which
acts as a receiver of log messages created by another domain.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-10-17 10:16:53 +02:00
Cyril Fougeray
9bc639dd59 drivers: flash: stm32: allow to overwrite zeros
On stm32g0, stm32g4, stm32l4, stm32l5, stm32u5,
and stm32wbx, it is allowed to write a zeroed dword
on unerased flash.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2022-10-17 10:14:32 +02:00
Lukas Gehreke
6fa4d722a6 drivers: serial: uart_pl011: implemented pinctrl
Added pinctrl to pl011 uart driver. This makes it usable
with the rp2040.

Signed-off-by: Lukas Gehreke <lk.gehreke@gmail.com>
2022-10-17 10:13:46 +02:00
Kumar Gala
c778eb2a56 smp: Move arrays to use CONFIG_MP_MAX_NUM_CPUS
Move to use CONFIG_MP_MAX_NUM_CPUS for array size declarations instead
of CONFIG_MP_NUM_CPUS.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-17 14:40:12 +09:00
Andrzej Puzdrowski
1c3b9c91c8 drivers/flash/gd32_vX: add missing kernel header
Added missing zephyr/kernel.h inclusion

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-10-17 14:39:39 +09:00
Gerson Fernando Budke
b3c5dcf1c6 drivers: usb: usb_dc_sam0: Add missing kernel include
Fix warnings and undefined symbols reported by CI.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-10-17 14:38:53 +09:00
Jay Vasanth
ae9de20222 drivers: spi: Added MEC172x full duplex qmspi driver
Add MEC172x full duplex qmspi driver version to support full
duplex transfers as expected by the Zephyr spi driver model.
On every spi clock we transmit one bit and receive one bit.
This driver will work with Zephyr SPI NOR driver.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-10-14 14:09:51 -05:00
Ryan McClelland
ce6da0fb51 i3c: fix ccc setmrl/setmwl helper addr
i3c CCC SETMRL/SETMWL were using the static addr, the
dynamic address must be used

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2022-10-14 12:27:39 -04:00
Andriy Gelman
7f00371948 drivers: uart_xmc4xxx: Add fifo support
Adds fifo support for tx/rx.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-10-14 15:06:19 +02:00
Andriy Gelman
5313598f6a drivers: uart_xmc4xxx: Add interrupt driven support
Add interrupt driven support.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-10-14 15:06:19 +02:00
Andriy Gelman
9b7e5b3696 drivers: uart_xmc4xxx: Use consistent struct name
Use consistent struct names for data and config.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-10-14 15:06:19 +02:00
Francois Ramu
9e18d19269 drivers: eeprom: add missing include to nxp eeprom driver
The include <zephyr/kernel.h> is missing from eeprom driver,
causing build error. This is fixing it like PR # 51246 or #51220.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-10-14 14:24:44 +02:00
Martin Jäger
93681feaba drivers: can: sja1000: configure PHY from devicetree
The phys property was not considered during initialization of the
driver config, so that the transceiver was not enabled properly
in case it has an enable/standby pin.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-10-14 14:24:00 +02:00
Lucas Tamborrino
c0a2b9bbc4 drivers: spi: esp32xx: remove unnecessary log
Remove unnecessary log in init_dma function.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-10-14 09:56:38 +02:00
Martin Jäger
2a035f775b drivers: can: esp32_twai: add support for newer MCUs
Newer ESP32 series MCUs like the ESP32-C3 contain some register changes
incompatible to the original ESP32 and the SJA1000.

The additions in this commit consider these changes and fix the
incompatibilities in the TWAI front-end for the SJA1000 driver.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-10-14 09:55:09 +02:00
Martin Jäger
f936d68916 drivers: can: sja1000: use generic can_set_timing API
This is a preparation to use the custom implementation in ESP32 TWAI
frontend for newer ESP32 series chips like the ESP32-C3, which have
timing registers incompatible with the SJA1000.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-10-14 09:55:09 +02:00
Manuel Arguelles
48c4b93b12 drivers: gpio: add support for NXP S32 devices
Implement GPIO driver minimal API's for NXP S32 devices, based on SIUL2
peripheral. SIUL2 allows to control the pins electrical characteristics
such as internal pull resistors, pin direction and more.

GPIO driver API's for interrupts will be implemented in a future patch.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-10-14 09:51:14 +02:00
Dat Nguyen Duy
3e8f854506 drivers: serial: support NXP S32 LINFlexD UART
This patch introduces support for NXP S32 LINFlexD peripheral operating
in UART mode. Polling and interrupt-based serial API's are supported.

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-10-14 09:51:14 +02:00
Manuel Arguelles
cdd7c5a572 drivers: pinctrl: add NXP S32 SIUL2 driver
Introduce Pinctrl driver for SIUL2 module present on NXP S32 devices,
which provides control over all pins, such as function selection and
electrical characteristics that appear on external chip pins.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-10-14 09:51:14 +02:00
Daniel DeGrasse
635506ec27 drivers: regulator: fix pmic regulator disable function
PMIC regulator disable function was unconditionally disabling the PMIC
regulator when the disable API was called, which does not match the
expected behavior when using the onoff service. Fix this error.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-13 17:15:54 -05:00
Marek Pieta
ea38e742b8 drivers: uart_native_posix: Fix reading file input
If the read function returns value of zero, there is no more data
in the file and the function should return value of -1.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2022-10-13 16:21:08 -04:00
Marco Peter
e104e031b7 include: add missing include
kernel.h is missing from eeprom driver.

Signed-off-by: Marco Peter <marco.peter@joylab.ch>
2022-10-13 08:24:11 -04:00
Kyle Cooke
9892af1464 drivers: flash: soc_flash_nrf: Account for ticker in timeout
We have been encountering timeout issues when erasing large flash
 sections (before receiving an image via mcuboot) from this semaphore
 take:
5af0fbc2e3/drivers/flash/soc_flash_nrf_ticker.c (L225-L233)

I think this is because this constant is based on the time taken to erase
 the chip but doesn't take account of the fact it is being done by a
 ticker. If I understand correctly the ticker is a timeshare mechanism
 so the actual max erase time is some factor based on how much time is
 given to the task by the ticker.

This multiplies the max timeout by 1.5

Signed-off-by: Kyle Cooke <cookekyle97@gmail.com>
2022-10-13 16:06:08 +09:00
Keith Short
2f2c0176e5 include: fix includes for IT8xxx2 SoC
Fix missing includes for IT8xxx2 drivers.

Signed-off-by: Keith Short <keithshort@google.com>
2022-10-12 16:10:05 -04:00
Keith Short
fbdc34e0b1 include: fix includes for NPCX drivers
Add include of kernel.h for drivers using Kernel APIs.

Signed-off-by: Keith Short <keithshort@google.com>
2022-10-12 16:10:05 -04:00
Keith Short
a328bc0183 include: fix native_posix_counter includes.
Add limits.h and irq.h to fix build errors for boards/tests that include
the zephyr,nativer-_posix-counter driver.

Signed-off-by: Keith Short <keithshort@google.com>
2022-10-12 16:10:05 -04:00
Guillaume Gautier
aba432348b drivers: Cleans variable scopes for STM32 drivers
Fix the scope of some variables in various STM32 drivers including:
 - SDMMC
 - DMA
 - OSPI/QSPI Flash
 - Interrupt controller

The variables are set static instead of global and const if appropriate.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-10-12 18:41:48 +02:00
Florian Grandel
631f117ed1 drivers: ieee802154: document endianness
The IEEE 802.15.4 radio driver encodes attributes in:

* little endian for everything that is close to the protocol as
  IEEE 802.15.4 frames are little endian encoded.

* mixed big and little endian in its configuration where extended
  addresses are being represented. These inconsistencies are unfortunate
  but cannot be easily fixed in a backwards compatible way so will be
  left untouched in this change.

Endianness was almost nowhere documented which explains these
inconsistencies and led to several bugs where assignments of different
byte order are not converted (or sometimes converted, sometimes not).

This change documents intended endianness within the realm of the
IEEE 802.15.4 radio driver code. Conversion bugs are fixed in a separate
commit.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Pierre-Emmanuel Novac
105cca639d drivers/ethernet: stm32: Make PTP clock optional
STM32F107 has an Ethernet MAC but no PTP clock, so remove hard requirement
on PTP clock definition in preparation for STM32F107 Ethernet MAC support.

Signed-off-by: Pierre-Emmanuel Novac <piernov@piernov.org>
2022-10-12 18:40:49 +02:00
Daniel DeGrasse
f37c8cc77e drivers: regulator: add support to PMIC regulator driver for modes
Add support for setting the target mode for a PMIC regulator. Some
regulators support multiple modes, each with distinctive voltage and
current configuration data. This function allows the consumer to switch
the PMIC into a new mode. The PMIC can then be configured to use a new
set of voltages.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-12 18:40:24 +02:00
Daniel DeGrasse
30d71d5457 drivers: regulator: move I2C reg reads to regulator_read_register
Move I2C register reads to regulator_read_register in regulator driver,
to enable better abstraction of regulator I2C reads

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-12 18:40:24 +02:00
Daniel DeGrasse
f367897bce drivers: regulator: refactor PMIC binding to use physical PMIC IC
Refactor binding to use root PMIC IC, so that properties can be shared
between regulator devices. Each individual regulator output is still
created as an individual device, since the regulator API aligns with
these devices better than the PMIC IC itself.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-12 18:40:24 +02:00
Pawel Czarnecki
6cc8f31310 drivers: counter: add missing includes
Add missing irq.h, spinlock.h and kernel.h headers

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-10-13 00:07:37 +09:00
Adrian Warecki
ed661a6c69 dai: dmic: Add missing include header
The code was missing #include <zephyr/kernel.h> which
caused a compilation error. Missing header has been added.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2022-10-12 10:08:54 -04:00
Jordan Yates
23fbdf35b1 bluetooth: hci: spi: propagate vendor specific events
Propagate vendor specific events that are not handled by the SPI driver
up the host stack, so that `bt_hci_register_vnd_evt_cb` can work
correctly.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-10-12 18:47:48 +09:00
Enjia Mai
dcda15d17d drivers: timer: use sys_read64 to read HPET counter on 64 bits cpu
For 32 bit processor to read the 64 bits hpet counter, the HPET spec
2.4.7 suggest to read HPET counter high and low then checking the
high bits to decide if it rollovers or not.

But this logic seems to cause problem for 64 bits processor under SMP,
there is a possible one tick earier under tickless mode. It is likely
to be the cache coherence issue, because a mfence instruction before
reading the timer works.

So we change to read the 64 bits counter by sys_read64 on 64bit
processor to prevent this issue.

Fixes #49611

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-10-12 18:47:19 +09:00
Manuel Arguelles
e7384974c8 drivers: gpio: xlnx: add missing headers
Add missing headers for sys_* and IRQ related API's.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-10-12 17:41:11 +09:00
Gerard Marull-Paretas
e42f58ec94 init: s/ARCH/EARLY, call it just before arch kernel init
The `ARCH` init level was added to solve a specific problem, call init
code (SYS_INIT/devices) before `z_cstart` in the `intel_adsp` platform.
The documentation claims it runs before `z_cstart`, but this is only
true if the SoC/arch takes care of calling:

```c
z_sys_init_run_level(_SYS_INIT_LEVEL_ARCH);
```

Which is only true for `intel_adsp` nowadays. So in practice, we now
have a platform specific init level. This patch proposes to do things in
a slightly different way. First, level name is renamed to `EARLY`, to
emphasize it runs in the early stage of the boot process. Then, it is
handled by the Kernel (inside `z_cstart()` before calling
`arch_kernel_init()`). This means that any platform can now use this
level. For `intel_adsp`, there should be no changes, other than
`gcov_static_init()` will be called before (I assume this will allow to
obtain coverage for code called in EARLY?).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-12 17:16:27 +09:00
Christopher Friedt
582f77ea38 drivers: serial: gecko: fix impmlicit declaration of IRQ_CONNECT
Previously, the build was failing due to implicit declaration
of `IRQ_CONNECT`. Simply include `<zephyr/irq.h>` to fix.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2022-10-11 21:25:59 -04:00
Anas Nashif
3d85ae37b6 arm: add missing includes
Add missing includes that were previously included indirectly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 18:37:53 -04:00
Anas Nashif
1e7548eeda intel_adsp: add missing headers
add headers previously included indirectly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 18:37:53 -04:00
Anas Nashif
c75ac38f6c drivers: intc_dw_ace: use CONFIG_DW_ICTL_ACE
Use CONFIG_DW_ICTL_ACE instead of a version kconfig.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
b4a44fdcb4 drivers: intc_dw_ace: rename functions
No need for version functions, this will be used by multiple versions of
ACE.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
ede94516b0 drivers: intc_dw_ace: rename file
No need for the version in the file name, this will be used by multiple
versions of ACE.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
6c3277eada intel_adsp: ace: rename namespace: MTL -> ACE
MTL is just one platform and this code is going to be used in multiple
platforms currently under development, so reduce the confusion and move
to a common namespace.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
0869e62539 intel_adsp: cleanup ace_v1x-regs.h more and prep for removal
File still not being removed due to out-of-tree usage. We will drop it
once the external code has stopped referencing it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
52297422fc timer: intel_adsp: use DTS for hardware information
Convert timer driver to use a light weight syscon and DTS and convert
register information to use offsets and sys_read/sys_write instead of
structs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
059dc41cc6 intel_adsp: put interrupt defines in own headers/cleanup namespace
Cleanup soc.h and move interrupt defines into own headers. Rename some
of the defines for ACE to have a unified namespace.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
100090832d drivers: intc: ace: use DW structure already defined in the driver
The DW register block was duplicated into the ACE header while we had
the same thing in the driver. Move everything to the driver as the first
step with further improvements planned on top of this.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Gerard Marull-Paretas
140f014bed drivers: clock_control: mcux_syscon: fix define collision
mcux HAL pollutes namespace with stuff like ARRAY_SIZE, MIN, MAX, etc.
Luckily it only defines them if not already defined, so we can play with
include order to "fix" the problem. Move the infamous soc.h (which
includes HAL) after other Zephyr includes.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
e4fdc2761a drivers: pinctrl: it8xxx2: add missing chip_chipregs.h
Include was missing for some register definitions.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
1992699e07 drivers: gpio: it8xxx2: add missing chip_chipregs.h/soc_common.h
Register definition header was missing, SoC common header as well (for
ite_intc_get_irq_num).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
ac63bca423 include: add missing sys_clock.h include
Some headers made use of types defined in sys_clock.h (e.g. k_timeout_t)
without including it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
357b362824 include: add missing sys/time_units.h include
Some files using time_units.h API did not include it, e.g. for
sys_clock_hw_cycles_per_sec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
edfa4f1324 include: add missing sys/arch_interface.h include
Some files were using arch interfaces (e.g. arch_curr_cpu) without
including necessary headers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
597dd5901c include: add missing spinlock.h include
Some files are using the spinlock API without including the necessary
headers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
4649e2347e include: add missing soc.h include
Some SoCs define stuff in soc.h, used in drivers or SoC code. Note that
soc.h is not introduced here as a catch-all header. soc.h optimizations
or removal is out of the scope of this patch.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
4ba74c2ec9 include: add missing limits.h include
Some files used definitions found in limits.h (e.g. INT_MAX) without
including it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
6a0f554ffa include: add missing kernel.h include
Some files make use of Kernel APIs without including kernel.h, fix this
problem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
acc8cb4bc8 include: add missing irq.h include
Some modules use the IRQ API without including the necessary headers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
e63b0bb3fe include: add missing errno.h include
With the incoming removal of kernel.h/types.h from init.h, lots of files
start to show compile errors because they relied on indirect
definitions, including errno.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
f7a5b47dff include: add missing devicetree.h include
Some files make use of DT APIs without including devicetree.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
34a6848887 include: add missing arch/cpu.h include
The sys* ops like sys_clear_bit are indirectly included via arch CPU
header. Other stuff like find_msb_set end up included via this header as
well.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
David Leach
9e5ee5d998 drivers: gpio: remove pinmux dependency in lpc11u6x Kconfig
Previous commit removed pinmux from the platform but neglected to
remove the dependency in this Kconfig resulting in build failures
when target application configures GPIO support.

Fixes #51144

Signed-off-by: David Leach <david.leach@nxp.com>
2022-10-11 08:25:46 -05:00
Anas Nashif
3db1c59f44 ipm: intel_adsp: use memory window from DTS
Use memory window setup from DTS.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 08:28:25 -04:00
Anas Nashif
9cd53958ce intel_adsp: mem_window: rename defines CAVS_ -> ADSP_
Fix namespacing of memory window defines. Not all platforms are CAVS
based anymore.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 08:28:25 -04:00
Anas Nashif
46af0620b3 console: move winstream console to drivers/
This was all done as part of the soc and called from the soc. Define
this type of console under drivers/console and use it in the SoCs
supporting that via SYS_INIT instead of calling the console code
directly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 08:28:25 -04:00
Immo Birnbaum
29a9ffe777 drivers: ethernet: xlnx_gem: fix dev data access missed by #41918
Fixes a compiler error in eth_xlnx_gem_stats() caused by the
automated replacement of device run-time data pointer accesses
by #41918. The device run-time data access in eth_xlnx_gem_stats()
was likely missed as this function is not usually compiled - its
existance depends on CONFIG_NET_STATISTICS_ETHERNET being set.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-10-11 11:15:20 +02:00
Ole Morten Haaland
667a3f9de9 qspi: stm32: Add support for reset cmd on init
If the flash is used in 4-byte addressing, reading SFDP will fail after
a system reset if the flash isn't power cycled or hardware reset, since
Zephyr will try to use 3-byte addressing while the flash (still) expects
4-byte addressing.

This commit adds the ability to send a reset command to the flash as part
of initialization, which complements the existing reset-gpio
functionality, and is useful on low-pincount flashes which do not have a
hardware reset.

Signed-off-by: Ole Morten Haaland <omh@icsys.no>
2022-10-11 11:14:46 +02:00
Carles Cufi
e50a859625 drivers: sensor: qdec_nrfx: Fix build with no optimizations
The build of this driver fails when `CONFIG_NO_OPTIMIZATIONS=y` is set:

error: expression in static assertion is not constant
   98 |  BUILD_ASSERT(steps > 0, "only positive number valid");

error: expression in static assertion is not constant
   99 |  BUILD_ASSERT(steps <= 2048, "overflow possible");

Fix this by using a simple macro to avoid the compiler from getting
confused.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-10-11 11:07:28 +02:00
Dipak Shetty
e97e24e7a6 drivers: flash_mcux_flexspi_nor: Add block erase
Change reduces time consumed when a block needs to be erased.
The change was tested on a mimxrt1060_evk board.

Signed-off-by: Dipak Shetty <dipak.shetty@zeiss.com>
2022-10-10 13:23:12 -05:00
Daniel DeGrasse
9d7039f9e9 drivers: regulator: add regulator shell
Add shell for interacting with regulator devices, to enable
users to test power management settings quickly and verify that their
regulator is functioning as expected. Also allows users to interact with
regulator PMIC devices

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-10 13:13:27 -05:00
Gerson Fernando Budke
5c484e28f9 drivers: eth: sam0: Fix missing devicetree dependency
The #48905 introduce a regression on gmac ethernet driver. The GMAC
driver matches two compatibles. This add missing compatible for SAM0
variant.

Fixes: #50970.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-10-10 11:23:35 -05:00
Anisetti Avinash Krishna
8df2568a20 soc: x86: Clean up GPIO related defines
Clean up and refactor x86 SoC headers in preparation of adding
new platforms in the future.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2022-10-10 19:17:03 +03:00
Jay Vasanth
f87acb5bdd soc: arm: microchip: add common mec_gpio.h
add common mec_gpio.h to allow access to common gpio_regs
structure for both mec15xx and mec17xx, used in pinctrl driver

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-10-08 18:32:33 +02:00
Peter Mitsis
d308ca5695 drivers: timer: adsp: Improve elapsed ticks calculations
It is better to use 64-bit variable types for calculating the number
of elapsed ticks than 32-bit variable types. This guards against the
propagation of calculation errors should the lower 32-bits of the timer
counter roll over multiple times before the timer ISR is serviced.

(Such a scenario can easily occur when pausing the system for an
extended period of time with a debugging device such as a Lauterbach.)

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2022-10-07 18:34:50 -04:00
Robert Lubos
b76c35d809 modules: mbedtls: Replace select statement with depends on for EC
Instead of using "select" on certain EC configurations, which is
considered unsafe for various reasons, use a "depends on" and rely on
the user to set a proper configuration in the config file.

Update the respective project configurations to comply with the new
configuration scheme.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-10-07 15:12:42 +02:00
James Johnson
0eaff5a11d drivers: sensor: add ams AS621x Temperature Sensor driver support
Added support for the AMS AS621x series of temperature sensors as a
variant of the TI TMP108 temperature sensor.

Signed-off-by: Jared Baumann <jared.baumann8@t-mobile.com>
Signed-off-by: James Johnson <james.johnson672@t-mobile.com>
2022-10-07 10:01:47 +02:00
Jun Lin
ea066d35b0 driver: eSPI: drop interrupts enabling during driver initialization
Host interface interrupts should be enabled explicitly via eSPI API
after the eSPI configuration and callbacks are set.
If we enable them during driver initialization and the host sends a eSPI
transaction before the eSPI configuration and callbacks are set, we may
encounter unexpected behavior.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-10-07 10:01:09 +02:00
Esteban Valverde
c4be0c51de drivers: ethernet: adding support for Cyclone V SoC DK ethernet
Adding support for Cyclone V SoC ethernet device.

Signed-off-by: Esteban Valverde <esteban.valverde.vega@intel.com>
2022-10-06 20:19:43 -07:00
Nick Kraus
05f3e87280 drivers: serial: Runtime Configure for SAM USART
Implements dynamic configuration for the atmet,sam-usart driver and
enables the new API calls if CONFIG_UART_USE_RUNTIME_CONFIGURE is set.

Signed-off-by: Nick Kraus <nick@nckraus.com>
2022-10-06 22:37:54 +00:00
Nick Kraus
48559f6e2f drivers: serial: Runtime Configure for SAM UART
Implements dynamic configuration for the atmet,sam-uart driver and
enables the new API calls if CONFIG_UART_USE_RUNTIME_CONFIGURE is set.

Signed-off-by: Nick Kraus <nick@nckraus.com>
2022-10-06 22:37:54 +00:00
Franciszek Zdobylak
64feccf23d drivers: flash: shell: Add flash shell tools
This commit adds two new commands to flash shell tools: flash load and
flash page_info.

Signed-off-by: Franciszek Zdobylak <fzdobylak@internships.antmicro.com>
2022-10-06 22:35:57 +00:00
Gerard Marull-Paretas
d1686dfbfb drivers: gpio: it8xxx2: log error instead of printing
printk must not be used to log, we have log API for that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-06 15:35:00 +02:00
Gerard Marull-Paretas
97ef197d05 include: add missing zephyr/ prefix
Some files still manage to get into the tree without the zephyr/ include
prefix (likely because they lack CI coverage).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-06 10:41:02 +02:00
Jaska Uimonen
ec0ec72428 drivers: dai: intel: dmic: misc fixes and changes
Fix misc issues and warnings found with sof native drivers compilation.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-10-05 12:41:45 +02:00
Jaska Uimonen
88941a1f71 drivers: dai: intel: dmic: add cavs15 and 25 support
Add support for older platforms like cavs15 and 25 into intel dmic dai.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-10-05 12:41:45 +02:00
Jaska Uimonen
4ee1386fd2 drivers: dai: intel: dmic: use fifo address from devicetree
Use fifo address from device tree to create the device structs.
Also modify shim initialization as it was changed from array to
int. Fix cosmetic tab in device init macro.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-10-05 12:41:45 +02:00
Attie Grande
de18f97f42 drivers: i2c: sam0: Resolve spurious trailing 0xff on reads
Previously, the I2C bus would have an extended idle period on write
operations, and a spurious trailing byte on read operations (after a
final NACK).

This patch relocates the issuance of the stop condition from the driving
thread's context, into the ISR.

Thanks to @benediktibk for discovery and initial patch.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-10-04 19:16:02 +00:00
Jay Vasanth
f6e2cb9b84 drivers: uart: microchip: add support for mec15xx
update uart mchp xec driver to support mec15xx and add
pinctrl support for mec15xx uart

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-10-04 09:21:58 -05:00
Andrei Emeltchenko
a657abae23 espi: Fix gpio_manage_callback() logic
espi_manage_callback() returns -EINVAL if it could not remove
callback. However if the list is empty success is returned when trying
to remove callback.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-10-04 14:10:05 +00:00
Andrei Emeltchenko
005a4d8a31 gpio: Fix gpio_manage_callback() logic
gpio_manage_callback() returns -EINVAL if it could not remove
callback. However if the list is empty success is returned when trying
to remove callback.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-10-04 14:10:05 +00:00
Andrei Emeltchenko
9de7cb4147 eeprom: shell: Add device autocompletion support
Add autocompletion for device names.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-10-04 14:08:09 +00:00
Jan Hilsdorf
c888d6a365 drivers: pwm: rpi_pico: Use “pico_channel” instead of “ch”
pwm_set_chan_level uses slice channels A(=0) or B(=1) and not Zephyr
channel (0..15). So PWM doesn't work for channels > 1. There is already
a function (pwm_rpi_channel_to_pico_channel) which does the right thing,
but it isn't used for pwm_set_chan_level.

Signed-off-by: Jan Hilsdorf <jan.hilsdorf@gmail.com>
2022-10-04 10:36:20 +02:00
Lucas Tamborrino
a29ebef6ce drivers: spi: esp32c3: add DMA support
Add SPI DMA support for esp32c3.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-10-04 10:35:14 +02:00
Lucas Tamborrino
a11a103518 drivers: spi: esp32/s2: add DMA support
Add SPI DMA support for esp32/s2.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-10-04 10:35:14 +02:00
Gerard Marull-Paretas
cfd3560e1b device: s/Z_DEVICE_DT_DEV_NAME/Z_DEVICE_DT_DEV_ID
Rename Z_DEVICE_DT_DEV_NAME to Z_DEVICE_DT_DEV_ID to make it more clear,
as the macro is generating a token that identifies the created struct
device.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-04 10:13:34 +02:00
Bartosz Bilas
57310cba87 arm: nxp: take PWM prescaler from device tree
Replace the hardcoded kPWM_Prescale_Divide_128
driver prescaler with the ones defined in the dtsi file
that allow overriding them by the user.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-10-03 15:04:31 -05:00
Nick Ward
0ad0af70ef drivers: pwm: Use a common initialization priority
As per other peripheral driver types.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2022-10-03 15:24:38 -04:00
TOKITA Hiroshi
fd1dfceb95 drivers: watchdog: Add GD32 Window watchdog timer driver
Add support for GD32 Window watchdog timer.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-10-03 18:07:16 +02:00
TOKITA Hiroshi
3b6e9743b7 drivers: watchdog: Add GD32 Free watchdog timer driver
Add support for GD32 Free watchdog timer.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-10-03 18:07:16 +02:00
Andriy Gelman
072a428f78 drivers: flash: Add xmc4xxx flash drivers
Add xmc4xxx flash drivers.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-10-03 13:56:49 +02:00
Josia Strack
ba7eb1025a drivers: gpio: Add driver for pcf8574
Adds a driver for pcf8574 via i2c.

Signed-off-by: Josia Strack <josia.strack@ithinx.io>
2022-10-03 13:56:32 +02:00
Wojciech Slenska
003ee34593 drivers: adc: stm32: removed duplicated code
The same code exist few lines above, this is probably merge error.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2022-10-03 10:20:21 +02:00
Anas Nashif
a5bd666f4e lib: notify: build sys-notify conditionally.
Add a new Kconfig and build this code conditionally, so we do not end up
with this file being built for each zephyr app.

Partial fix for #50654

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-03 10:18:15 +02:00
Anas Nashif
a81b322828 lib: onoff: add a config for on-off and build conditionally
Do not build this service unconditionally.

Partial fix of #50654

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-03 10:18:15 +02:00
Jun Lin
a55c9f8ce7 driver: kscan: npcx: add driver support for kscan
Add keyboard scan driver support.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-10-03 10:14:51 +02:00
Pieter De Gendt
ff8a90b1de drivers: gpio: Add SDL emulated GPIO support
This commit adds a driver to simulate GPIO state and interrupts
using the keyboard when using SDL.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-10-03 10:12:03 +02:00
Pieter De Gendt
bd71698a66 drivers: gpio: pca953x: select I2C
Select I2C instead of depending on it, following upstream policy.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-10-03 10:12:03 +02:00
Pieter De Gendt
70e99fe575 drivers: sensor: lis2dh: Configurable latch and mode for any movement
Add 2 properties to configure the "any movement" event.
* Ability to disable the interrupt latch
* Select movement mode

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-10-03 10:11:45 +02:00
Valerio Setti
1b78f2dfbd drivers: sensor: adding driver for STM32 quadrature encoder
This driver configures STM32's internal timers in order to use
the quadrature encoder mode.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-10-03 10:10:31 +02:00
Peter Marheine
5eb75b81f7 arm: rename default RAM region from 'SRAM' to 'RAM'
It's useful for RAMABLE_REGION to have a uniform name when
CODE_DATA_RELOCATION is supported, because otherwise the build system
needs to be aware of how the region name differs between architectures.
Since architectures tend to prefer one of 'SRAM' or 'RAM' for that
region, prefer to use 'RAM' as the more general term.

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
2022-10-03 10:09:53 +02:00
Dominik Chat
67c6f26c93 sensor: Refactor bmi270 driver data names
Make driver data names consistent in code.

Signed-off-by: Dominik Chat <dominik.chat@nordicsemi.no>
2022-10-03 10:06:46 +02:00
Dominik Chat
6cbb84c3ee sensor: dts: Add SPI capability to bmi270 driver
Added SPI bus support for BMI270 gyroscope driver.

Signed-off-by: Dominik Chat <dominik.chat@nordicsemi.no>
2022-10-03 10:06:46 +02:00
Adrian Bonislawski
87954ad12f drivers: dai: alh: fill fifo depth in dai properties
This will fill missing field in dai properties

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-10-01 14:54:43 -04:00
Adrian Bonislawski
4968b687c0 drivers: dai: dmic: fill fifo depth in dai properties
This will fill missing field in dai properties

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-10-01 14:54:43 -04:00
Adrian Bonislawski
c3659da65a drivers: dai: alh: set rate and channels from config blob
This will use config blob to set rate and channels params

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-10-01 14:54:43 -04:00
Adrian Bonislawski
e7f32329ba drivers: dai: alh: enable ownership control for ACE
Enable ownership control for ACE by default

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-10-01 14:54:43 -04:00
Adrian Bonislawski
40db94b8a4 drivers: dai: ssp: enable power control for ACE
Enable power control for ACE by default

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-10-01 14:54:43 -04:00
Ederson de Souza
edd524b4e3 drivers/mm: Add API to query memory regions
Some systems may need to query the available memory regions in runtime.
For those, this patch adds a simple API that memory management drivers
can implement to provide such discovery.

A small test also added to exercise the default, empty implementation.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-10-01 14:52:29 -04:00
Grant Ramsay
897952370e drivers: ethernet: Add ESP32 Ethernet driver
This is to enable ESP32 Ethernet support

Signed-off-by: Grant Ramsay <grant.ramsay@hotmail.com>
2022-10-01 14:51:28 -04:00
Grant Ramsay
113f868ddf drivers: mdio: Add ESP32 MDIO driver
The MDIO driver is required to for ESP32 Ethernet

Signed-off-by: Grant Ramsay <grant.ramsay@hotmail.com>
2022-10-01 14:51:28 -04:00
Adrian Bonislawski
e5e7ee88a3 dma: gpdma: fix channel config
This will use DW_CFGH_DST instead of DW_CFGH_DST_PER
to correctly setup cfg_hi. This is critical for ALH transfer.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-30 15:18:20 +00:00
Adrian Bonislawski
9bb0b6dba2 dma: gpdma: fix llp config
This will setup llp config properly with dma_slot

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-30 15:18:20 +00:00
Adrian Bonislawski
feffb245fa dma: hda: fix buffer address for hda link
This will set correct buf address for hda link in&out

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-30 15:18:20 +00:00
Adrian Bonislawski
7eeeff5ce9 dma: hda: trigger link commit at dma_start
This will trigger link commit immediately after start
to fix hda start flow.
Applies to link out only.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-30 15:18:20 +00:00
Adrian Bonislawski
8c90c40c0e dma: hda: add suspend api for hda link
For HDA link suspend is exactly the same as stop
but the same api is used also to control gpdma with unique suspend

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-30 15:18:20 +00:00
Andrei Emeltchenko
2e56f955db trivial: Remove empty files
Remove empty files.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-30 09:41:55 +00:00
Dino Li
db50a7aca7 drivers: gpio: it8xxx2: add support for GPIO_DISCONNECTED flag
This change was made to support the flag.
fixes: #50681

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-09-29 14:33:53 +00:00
Daniel Leung
4bbd3c7ef5 interrupt_controller: intc_dw_ace_v1x: fix multi-level IRQs
Zephyr encodes multi-level interrupts in a certain way, and
the driver is not utilizing the encoding correctly. So fix
it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-29 10:15:53 +00:00
Thad House
f37db90541 drivers: Correct tx and rx error counts in mcan
TX and RX error counts are swapped in the mcan driver.

Signed-off-by: Thad House <thadhouse@fb.com>
2022-09-28 20:34:36 +00:00
Adrian Bonislawski
62b01ff061 drivers: dai: ssp: fix mdivr register for ACE platform
Set correct offsets for CAVS&ACE

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-28 14:07:19 +00:00
Sylvio Alves
82bd341018 drivers: gpio: esp32: fix error when using input only pins
Input pins in ESP32 (34 to 39) have no pull-up / pull-down internally.
Current behavior is that gpio driver fails when "disabling it", which
should not happen. It need to fail only when enabling this feature.

Fixes #50615

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-28 07:52:29 +00:00
GUITTER Pierrick
2ef94ec479 drivers: gsm_ppp: fix modem_cmd_handler_tx_lock
Remove modem_cmd_handler_tx_lock lock when CONFIG_GSM_MUX
is disabled, as modem_cmd_handler_tx_unlock is under the same
conditions.

Signed-off-by: GUITTER Pierrick <pguitter@silicom.fr>
2022-09-27 14:12:57 +00:00
Dino Li
68d08980af it8xxx2: intc: make sure IER disabling to take effect.
Add fake read to synchronize interrupt enable register (IER)
of SOC before enabling global interrupt.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-09-27 10:05:09 +00:00
Jan Peters
a80fa5163b drivers: serial: uart_mcux_lpuart: fix IRQ-driven API with ASYNC_API
this allows usage of the interrupt-driven API when CONFIG_UART_ASYNC_API
is enabled.

Signed-off-by: Jan Peters <peters@kt-elektronik.de>
2022-09-27 10:04:10 +00:00
Jose Alberto Meza
bccc4e62f2 drivers: adc: xec: Handle incomplete ADC channel conversions
Report an error when the ADC # channels conversion is not
complete.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-09-26 08:07:37 +00:00
Marcin Niestroj
1b0d97574a wifi: esp32: remove unused ESP32_WIFI_{SSID,PSK}
Those Kconfig options are no longer used after ESP32 WiFi driver was
converted to Zephyr WiFi mgmt and the removal of platform specific
`samples/boards/esp32/wifi`.

Fixes: d524015f82 ("samples: boards: remove esp32 wifi sample code")

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-26 08:05:58 +00:00
Marcin Niestroj
35ba982d84 wifi: esp32: make ethernet carrier on after ESP32_WIFI_EVENT_STA_START
Driver is not ready to handle NET_REQUEST_WIFI_CONNECT wifi_mgmt events
before ESP32_WIFI_EVENT_STA_START event is received. Revert back to setting
NET_IF_NO_AUTO_START flag for interface and call net_eth_carrier_on() after
ESP32_WIFI_EVENT_STA_START event is received. This makes it possible for an
application to wait for network interface to be ready, e.g. with:

  while (!net_if_is_up(iface)) {
     k_sleep(K_MSEC(100));
  }

before making a connect request with:

  net_mgmt(NET_REQUEST_WIFI_CONNECT, iface ...).

Fixes: 7d9edc8bf0 ("wifi: esp32: add support to wifi api mgmt")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-26 07:58:09 +00:00
Henrik Brix Andersen
6d08944ac1 drivers: can: mcp2515: abort transfers before entering configuration mode
Abort any pending transmissions before entering configuration mode and
notify the senders.

Poll for mode change completion instead of assuming mode changes take
immediate effect. This is needed for successfully entering configuration
mode with recently aborted transmissions.

Fixes: #50545

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
f239c3d0e9 drivers: can: stm32: abort transfers after entering init mode
Abort any pending transmissions after entering init mode and notify the
senders.

Fixes: #50545

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
6cf34d0d33 drivers: can: mcan: notify of aborted transmission on can_stop()
Notify of any aborted transmission when entering init mode via can_stop().

Fixes: #50545

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
b8eb11de3b drivers: can: mcux: flexcan: abort transfers before entering freeze mode
Abort any pending transmissions before entering freeze mode and notify the
senders.

Fixes: #50545

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
94d4638ccc drivers: can: sja1000: notify of aborted transmission on can_stop()
Notify of any aborted transmission when entering reset mode via can_stop().

Fixes: #50545

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
a99a55eefb drivers: can: npl: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
50d77ab854 drivers: can: mcan: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

This saves approximately 500 bytes of SRAM on the lpcxpressso55s16 board
when running in default configuration.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
d3427d991a drivers: can: rcar: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
10cd28a61a drivers: can: loopback: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
4165186d13 drivers: can: stm32: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
78d6ba5ce3 drivers: can: mcp2515: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
eb06e6aed0 drivers: can: sja1000: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
fcf7c6e6d1 drivers: can: mcux: flexcan: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

This saves approximately 500 bytes of SRAM on the frdm_k64f board, while on
the mimxrt1024_evk board the saving is approximately 2.5 kbytes of SRAM,
both when running in default configuration.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
d6fc3f6596 drivers: can: provide default callback to can_send() if NULL
Provide a default, internal callback to CAN controller drivers
implementation of can_send() if no callback was provided by the caller.

This allows for simplifying the CAN driver implementations of can_send() as
these no longer need special handling for callback/no callback operation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Francois Ramu
dca9c2b165 drivers: adc: stm32f3 adc driver set common clock to HCLK
Set the synchronous clock mode to HCLK/1 (DIV1) or HCLK/2 (DIV2)
Both are valid common clock setting values.
The HCLK/1 (DIV1) is possible only if the ahb-prescaler = <1>
in the RCC_CFGR (see DTS).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-23 10:47:23 +00:00
William MARTIN
8bbe016f46 drivers: Fix BMI270 initialization
On power on reset, after disable advanced power safe mode,
you need to wait a delay before write again in the device.
The missing wait produce random initialization failure.
See §4.4 of the datasheet "bst-bmi270-ds000.pdf"

Signed-off-by: William MARTIN <william.martin@power-lan.com>
2022-09-23 12:08:24 +02:00
Tomasz Moń
8c7eba346a driver: usb_dc_sam_usbhs: Restore EP0 after detach
SAM V71 Xplained Ultra failed to re-enumerate on the bus after device
detach-attach sequence. The device was recognized by the host, but it
was not responding to control transfers, i.e. it was not acknowledging
SETUP data. Make device acknowledge SETUP data by reconfiguring EP0
when necessary.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-09-23 11:52:18 +02:00
Tomasz Moń
37705bc554 driver: usb_dc_sam_usbhs: Actually set detach bit
Device physically detaches when the DETACH bit is set. Fix the
assignment to actually set the bit instead of clearing it.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-09-23 11:52:18 +02:00
Gerhard Jörges
1e87837f2a drivers: spi: pl022: fix dropping RX bytes
If the thread that submits data over spi is interrupted by a higher
priority thread while pushing data to the tx fifo the hardware pushes
data to spi and frees up space in the fifo. In this case more than
8 Bytes are written to the tx fifo and bytes in the rx fifo get lost
before they are collected in the rx while loop.
To avoid this, the tx loop is exited after a maximum of 8 bytes and the
rx loop will run until it collected all bytes from the rx fifo.

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2022-09-22 17:16:45 +02:00
Francois Ramu
6507afd07e drivers: adc: driver for stm32wl configure sampling
This Commit makes the adc configuration correct
for using the adc with 12b conversion on the stm32wl.
TriggerSource must be set to SW.
The ADC clock must be disabled by clock gating during CPU1 sleep/stop.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-22 15:06:20 +00:00
Tim Lin
3474ba919f ITE: drivers/i2c: FIFO2 can be selected to support channel of B or C
FIFO2 can be selected to support channel of B or C by dtsi.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-09-22 14:58:42 +00:00
Tim Lin
c30ec3ba4d ITE: drivers/i2c: Rename the parameter in data struct
Rename the parameter in data struct to avoid confusion.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-09-22 14:58:42 +00:00
Tim Lin
de1fc0ca89 ITE: drivers/i2c: Fix the bug of msgs in I2C transfer
1. To explicitly set the MSG_START flag on the first message.
2. Remove redundant declare.
3. Using data->msgs->flags is the correct address instead of
   msgs->flags.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-09-22 14:58:42 +00:00
Fabio Baltieri
7b64f63139 drivers: kscan_ite_it8xxx2 fix wrong comment reference
The note refers to the wrong API, that has been replaced by a pinctrl
call, update the comment.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-09-21 13:54:54 -05:00
Daniel DeGrasse
5980aa0196 drivers: gpio: gpio_mcux_igpio: handle gpio-reserved-ranges property
Add code to handle parsing the gpio-reserved-ranges property present on
iMX GPIO controllers, so that gpio controllers with gaps in their pin
indexing can still have pinmux settings applied correctly.

Fixes #50142

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-09-21 13:50:26 -05:00
Antoniu Miclaus
9dda350e24 drivers: sensor: adxl372: update driver
Handle SPI/I2c interface in the dts.

Support multiple instances.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
2022-09-21 18:40:06 +00:00
Erwan Gouriou
2d740d42e0 drivers: timer: stm32_lptim: Change clock source config check sanction
A specific check is implemented lptim driver in order to ensure global
platform clock/tick configuration is in line with recommendations.
To respect portability principles, don't error out when a config
conflict is detected but generates a warning instead.
Also, since these are only recommendations, provide an option to override
the check. Besides automatically override when ZTEST is enabled, as some
kernel tests specifically configure tick freq to 100.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-21 18:39:07 +00:00
Jay Vasanth
d6ba6a5fac spi: mec15xx: add pinctrl for mec15xx/mec1501 qmspi
Remove pinmux calls and add pinctrl support for mec15xx
and mec1501 qmspi. Update board dts, pinmux and driver files.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-09-21 18:05:32 +00:00
Jay Vasanth
a2de15e5cc adc: mec15xx: add pinctrl for mec15xx/mec1501 adc
Remove pinmux calls and add pinctrl support for mec15xx
and mec1501 adc. Update board dts, pinmux and driver files.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-09-21 18:05:32 +00:00
Jay Vasanth
d684425d4d i2c: mec15xx: add pinctrl for mec15xx/mec1501 i2c
Remove pinmux calls and add pinctrl support for mec15xx
and mec1501 pwm. Update board dts, pinmux and driver files.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-09-21 18:05:32 +00:00
Jay Vasanth
e46c56e117 espi: mec15xx: add pinctrl for mec15xx/mec1501 espi
Remove pinmux calls and add pinctrl support for mec15xx
and mec1501 espi. Update board dts, pinmux and espi driver
files.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-09-21 18:05:32 +00:00
Jaxson Han
f11e6d9c23 drivers: gicv3: Refine the rdist matching function
Introduce a function to do the matching job. Add the config for some
platforms to match the mpdir with aff0 only.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2022-09-21 15:21:29 +02:00
Jaxson Han
2866e2a4cc drivers: gicv3: Introduce aff0 matching config for rdist
Some platforms only use aff0 to match mpdir and GICR.aff. Introduce
GIC_V3_RDIST_MATCHING_AFF0_ONLY to set the matching method only using
aff0. With this config enabled, the matching function will find the
target redistributor by comparing the aff0 only.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2022-09-21 15:21:29 +02:00
Tomasz Moń
0d4aa49766 drivers: usb_dc_nrfx: Do not uninit endpoints on detach
Sometimes it is desired for the USB device to detach and reattach itself
to the host. USB device controller driver interface supports detach with
usb_dc_detach() function. Subsequently the device can be reattached to
the bus by calling usb_dc_attach().

USB device stack sets the control transfer callbacks in usb_enable().
Nordic usb_dc_detach() implementation inadvertedly overwrote registered
callbacks with zeroes by clearing endpoint configuration structure. This
lead to a NULL pointer dereference during enumeration after device has
reattached inself to the host.

Preserve the callbacks by removing the eps_ctx_uninit() function.
Endpoints runtime data is initialized in usb_dc_attach() so this should
pose no problems.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-09-21 12:56:39 +02:00
Enjia Mai
24f989cd90 drivers: ioapic: fix the cast for the offset
The cast for the offset variable will make incorrect register
access when it is over 0x80. Change the char cast to unsigned
char to fix it.

Fixes #49803.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-21 12:28:30 +02:00
Francois Ramu
4c36f3aeaf drivers: adc: stm32 driver enabling adc for the stm32U5
The ADC of the stm32U5 should also waits for the ready Flag
before enabling the peripheral, then wait for the ready Flag
set.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-21 08:57:58 +00:00
Henrik Brix Andersen
5ec7acca86 drivers: can: rcar: remote transmission request filters are not supported
The receive path for the Renesas R-Car CAN controller supports two RX
FIFOs, which are currently configured for standard 11-bit CAN ID data
frames in FIFO0, and extended 29-bit CAN ID data frames in FIFO1.

As this leaves no room for matching remote transmission request (RTR)
frames, have the driver return -ENOTSUP instead of silently accepting RTR
filters.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-21 08:50:47 +00:00
Erwan Gouriou
e1cb0845b4 drivers: gpio: stm32: Apply GPIOG specific code to U5 series
In STM32U5 as well it is required to enable VDD before use.
Difference is that U5 enables this under PWR_SVMCR_IO2SV flag.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-20 10:00:02 +00:00
Steven Slupsky
32f4f8d987 drivers: usb: usb_dc_sam0: fix memory leak
The usb_dc_sam0 driver is leaking memory when the usb device is detached
using usb_disable().

When a device is detached, the driver does not reliably deallocate the
descriptor bank memory. Therefore, upon the next attach and configure,
another block of memory is allocated. After several connect /
disconnect sequences, the usb interface becomes unresponsive.

This commit adds a static function to release all memory allocated
to the ep descriptors when usb_dc_detach() is called.  Since detach is
called from usb_disable(), this releases the memory when the
interface is disabled.

Avoid calling k_free() if buffer pointer is already
set to NULL.

Fixes #49177

Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
2022-09-19 15:20:53 -05:00
Sylvio Alves
e4969ec52e drivers: esp32: add check for absolute alarm configuration
ESP32 counter based on Timer or RTC misses the
COUNTER_ALARM_CFG_ABSOLUTE flag check.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-19 18:37:28 +02:00
Andrzej Głąbek
6d8172f4e9 drivers: pinctrl_nrf: Configure QSPI CSN pin as output set high
... so that the pin keeps the inactive state of the CSN line when it is
not controlled by the QSPI peripheral and the driver is not suspended.

Currently, the nrf_qspi_nor shim deinitializes the nrfx_qspi driver
after each operation, what leaves the pin uncontrolled until a new
operation is requested (and the nrfx_qspi driver is initialized again)
or the driver is suspended (and the pin is put into low-power state).
This can cause the flash chip to needlessly consume current when there
is no pull-up resistor on its CSN line and the line appears active.
Prevent this by keeping the pin in a defined (inactive) state.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-09-19 15:30:02 +02:00
Andrzej Głąbek
3a6584b0ae drivers: i2c_nrfx_twim: Fix compilation with disabled PINCTRL
This is a follow-up to commits 9974bb043f
and 00ecc66677.

Add one missing `#ifdef CONFIG_PINCTRL` and remove a no longer needed
one to restore the possibility to use this driver without PINCTRL.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-09-19 12:52:16 +02:00
Mahesh Mahadevan
4c30c82ead clock: mcux: Use FSL_FEATURE_MCG_FFCLK_DIV to conditionalize
Use the FSL_FEATURE_MCG_FFCLK_DIV define to decide if we should
call the api to get Fixed Frequency Clock.

This fixes Issue #49924

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-09-16 13:21:04 -05:00
Francois Ramu
9926b90bf6 drivers: uart: stm32 uart driver must include ll_exti with CONFIG_PM
Missing include to compile correctly when the
CONFIG_PM && IS_UART_WAKEUP_FROMSTOP_INSTANCE are defined

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-16 10:49:18 +00:00
Andrzej Puzdrowski
102583ab7f drivers/flash: move JESD216 option into FLASH
This option is part of FLASH API configuration.
I moved it where it belongs.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-09-16 08:41:40 +00:00
Jeremy Bettis
bf845a273b gpio_emul: Fail at build time if ngpios is too big
Add BUILD_ASSERT to check max val of ngpios. If someone sets ngpios to
more than 32, and acts on pin 32 or higher, memory corruption will
result. This is only a problem with the emulator, real hardware
will have limits that are probably much smaller.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2022-09-16 09:02:01 +01:00
Thomas Stranger
5521c53848 drivers: wifi: esp32: sp32_wifi_ap_enable: fix ret value overwritten
The return values of esp_wifi_set_mode(), and esp_wifi_set_config() were
overwritten once esp_wifi_start() is executed.

This commit fixes that by ORing the return value to the others.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-15 17:26:31 +01:00
Sylvio Alves
b801a83d92 drivers: gpio: esp32: fix missing rtcio pin mapping
PR #49550 missed adding proper RTCIO pin mapping
in a few rtcio functions calls, which causes board
to crash. This fixes it.

Closes #50238

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-15 17:26:18 +01:00
Thomas Stranger
fc33325fc7 drivers: can: native_posix_linux: drop rx frames while stopped
The driver should drop rx frames while in stopped state.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-15 16:20:04 +00:00
Thomas Stranger
0c365ac0ea drivers: can: mcan: don't enabled trasceiver in init
With the move to start/stop functions the transceiver is not expected
to be enabled after driver initialization.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-15 16:19:32 +00:00
Francois Ramu
0e119b53c6 drivers: serial: stm32 uart driver set EXTI line for wakeup from lowPower
The USART or LPUART, especially on stm32wl, must set the EXTI
lines corresponding to the wakeUp source.
This LL_EXTI_LINE_xx is given by the Device Tree property.
This makes the system exiting lowpower stop mode on EXTI irq.
The LL_EXTI_LINE_x is exactly the bit(X) set.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-15 15:02:47 +00:00
Xinyang Tan
904181a6a9 drivers: flash: spi_nor: fix driver initialization error
Fix the issue that the initialization will fail when both
CONFIG_SPI_NOR_SFDP_RUNTIME and CONFIG_SPI_NOR_IDLE_IN_DPD are enabled.
The cause of this problem is simply calling the wrong function.

Fixes #33015

Signed-off-by: Xinyang Tan <xinyang.tan@delve.com>
2022-09-14 16:13:35 +01:00
Lauren Murphy
85445474f2 boards, dts: fix filenames and dts refs for adsp clock
Changes filenames and DTS references from CAVS clock to
ADSP clock.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2022-09-14 07:23:08 -04:00
Lauren Murphy
1983a4c50c boards, dts: fix namespace for intel adsp cavs, ace
Fixes namespace for Intel ADSP CAVS and ACE boards.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2022-09-14 07:23:08 -04:00
Attie Grande
c75fe75a23 drivers: lora: Return error from lora_send()
Previously, the lora_send() function would have returned zero regardless
of any error encountered while waiting for the transmit to complete.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-09-14 09:34:40 +00:00
Henrik Brix Andersen
6f1ff5ea83 drivers: can: shell: add CAN start/stop shell commands
Add shell commands for starting/stopping a CAN controller.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-13 16:06:50 +00:00
Henrik Brix Andersen
180cdc105e drivers: can: add start and stop CAN controller API functions
Up until now, the Zephyr CAN controller drivers set a default bitrate (or
timing) specified via devicetree and start the CAN controller in their
respective driver initialization functions.

This is fine for CAN nodes using only one fixed bitrate, but if the bitrate
is set by the user (e.g. via a DIP-switch or other HMI which is very
common), the CAN driver will still initialise with the default
bitrate/timing at boot and use this until the application has determined
the requested bitrate/timing and set it using
can_set_bitrate()/can_set_timing().

During this period, the CAN node will potentially destroy valid CAN frames
on the CAN bus (which is using the soon-to-be-set-by-the-application
bitrate) by sending error frames. This causes interruptions to the ongoing
CAN bus traffic when a Zephyr-based CAN node connected to the bus is
(re-)booted.

Instead, require all configuration (setting bitrate, timing, or mode) to
take place when the CAN controller is stopped. This maps nicely to entering
"reset mode" (called "configuration mode" or "freeze mode" for some CAN
controller implementations) when stopping and exiting this mode when
starting the CAN controller.

Fixes: #45304

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-13 16:06:50 +00:00
Florian Grandel
2a6d82b2d8 drivers: console: rtt_console: undefined reference
Disabling PRINTK with RTT enabled caused a compile error (undefined
reference to __printk_hook_install').

Fixes: #50108

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-09-12 15:08:47 +01:00
Daniel Leung
34ccd88c12 sensor: lps22hh: extend to support being on I3C bus
This extends the lps22hh driver to support being on I3C bus.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00
Daniel Leung
eb9cd9242c sensors: stmemsc: add I3C access functions
This adds I3C access functions so that STM sensors connected
on I3C bus can utilize I3C.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00
Daniel Leung
3e8f97009d i3c: add I3C controller driver for MCUX
This adds a very basic driver to utilize the I3C IP block
on MCUX (e.g. RT685). Note that, for now, this only supports
being the active controller on the bus.

Origin: NXP MCUXpresso SDK
License: BSD 3-Clause
URL: https://github.com/zephyrproject-rtos/hal_nxp
Commit: 2302a1e94f5bc00ce59db4e249b688ad2e959f58
Purpose: Enabling the I3C controller on RT685.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00
Daniel Leung
66a9a15104 i3c: add a global workqueue for IBI
Adds support for a global workqueue so drivers can defer
IBI callbacks instead of doing it in interrupt context.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00
Daniel Leung
ce7058d2f5 drivers: i3c: introduce I3C API for controllers
This introduces the I3C API for I3C controllers. Currently,
this supports one controller per bus under Zephyr.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00
Ivan Herrera Olivares
2c2b8c3422 SD: Implement sdhc_card_busy in SDHC SPI-driver
Currently, the sdhc_card_busy function is unimplemented in the
SDHC SPI-driver. This causes some functions which rely on f_sync(),
such as fs_close(), to fail as it will timeout the busy-check. This PR
implements sdhc_card_busy by checking if the MISO-line is kept high to
check if the SD-card is idle (not busy).

Solves https://github.com/zephyrproject-rtos/zephyr/issues/49982

Signed-off-by: Ivan Herrera Olivares <ivan.herreraolivares@uantwerpen.be>
2022-09-09 16:32:52 -04:00
Hu Zhenyu
3f9131ff5f tests: Enable the counter_basic_api test on mec172x board
1. enable timer5 on dts
2. Replace all BTMR_Type with struct btmr_regs, to make it compatiable
   on both mec 15 and 17
3. As MEC15 and MEC17 have different ways to access the register, use
   "#if defined" to access counter_cfg->girq_id on different board.

Signed-off-by: Hu Zhenyu <zhenyu.hu@intel.com>
2022-09-09 16:32:07 -04:00
Nick Kraus
dd1d367f34 driver: usb_dc_sam_usbhs: Initialize Endpoint FIFO
Ensure that the FIFO of each endpoint is initialized during endpoint
configuration, to prevent a NULL FIFO from being encountered during the
first call to usb_dc_ep_write() for a given endpoint.

Signed-off-by: Nick Kraus <nick@nckraus.com>
2022-09-09 16:31:43 -04:00
Mulin Chao
839031271f driver: espi: npcx: add the controller attached flash sharing API
Add the flash channel support by implementing the controller attached
flash sharing APIs, including flash_read, flash_write, and flash_erase.
For flash_read, the max data payload the module can support is 64 bytes
in one transaction.
For flash_write, the max data payload the module can support is 16
bytes in one transaction.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-09-09 16:30:51 -04:00
Andriy Gelman
888a17cfda drivers: serial: uart_xmc4xxx: Use pinctrl driver
Use xmc4xxx pinctrl in uart driver.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-09-09 16:28:41 -04:00
Andriy Gelman
5feae0eafc drivers: pinctrl: Add pinctrl driver for xmc4xxx
Add pinctrl driver for infineon xmc4xxx devices.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-09-09 16:28:41 -04:00
Andriy Gelman
105cd84eb7 drivers: serial: uart_xmc4xxx: Get input source from dts
Get input source config from devicetree.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-09-09 16:28:41 -04:00
Pierre-Emmanuel Novac
0e510cc2a6 drivers/clock_control: stm32: Configure and enable PLL2
DT node "st,stm32f105-pll2-clock" already exists but was not actually used
and PLL2 was not being configured.
PLL2 is available on STM32F105/F107 and should be turned off after turning
off PLL and turned on before turning on PLL again since PLL2 can be
used as a source for PLL. Source for PLL2 is always HSE.

Signed-off-by: Pierre-Emmanuel Novac <piernov@piernov.org>
2022-09-09 16:28:15 -04:00
Flavio Ceolin
45465708f0 soc: intel_adsp: Add ACE soc series
ACE15_MTPM is one SOC from the ACE series. Organize
it following cavs pattern.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-09-09 16:03:59 -04:00
Jamie McCrae
c56b45c3e8 mgmt: mcumgr: Fix output packet to frame issue on serial transport
Fixes an issue with outgoing mcumgr frames that are larger than the
transport MTU size whereby they would wrongly be split up into multiple
frames with multiple start frame headers, which affected SMP over
console transports.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-09-09 19:47:12 +00:00
Gerson Fernando Budke
6d5cdc17b4 drivers: ieee802154: rf2xx: Add support to Sub-Giga
Add support to at86rf212[b] sub-giga devices. This work enables use of
pages 0, 2 and 5 in accordance with IEEE-802.15.4/2003/2006/2011. The
proprietary speeds can be object of future work.

Note: It is recommended that user define a power table for better
performance, low emissions and to save power. A reference power table
can be found in the datasheet and should be used for tests only and
not on a final product.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-09-09 10:31:35 -07:00
Gerson Fernando Budke
65960c4d32 drivers: ieee802154: rf2xx: Move power table to devicetree
The current version of power table is hardcoded in the driver which is a
problem when use devices in production. This change remove all hardcode
from driver and reimplement the feature to allow people create a table
which is defined in devicetree. The big advantage is that each board can
define their own table based on lab tests and allows use of FEM devices
inclusive.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-09-09 10:31:35 -07:00
Huifeng Zhang
68b10e8572 drivers: intc_gicv3: fix gic_rdists[cpu] points to a wrong address
In old way, gic_rdists[cpu] is calculated via MPIDR_TO_CORE(), but in
real hardware, MPIDR_TO_CORE() isn't a value increment from 0 one by
one, and that will lead gic_rdists[cpu] to point to a wrong address.

GICv3 provides the register GICR_TYPER[1] and it has a field named
Affinity_Value. This field can help to determine where gic_rdists[cpu]
should point.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2022-09-09 16:36:37 +00:00
Andrei Emeltchenko
b6c50f5347 i2c: Print more flags for i2c_dump
Add more usable information for i2c_dump_msgs() helper.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-09 10:13:12 -05:00
Andrei Emeltchenko
69d1b21d47 i2c: shell: Add help to command description
Makes i2c shell usable by showing command syntax.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-09 10:13:12 -05:00
Mahesh Mahadevan
9966181510 drivers: usb: mcux: Restructure driver for SDK updates
1. Move the defines from usb_dc_mcux.h to usb_device_config.h
   and fsl_os_abstraction.h. These headers are used by
   the SDK USB driver. usb_dc_mcux.h header file is not longer
   needed and hence deleted.
2. Delete the Zephyr implementation of the usb_device_struct
   driver and use the one implemented inside the SDK USB
   driver. This requires updating the references to
   usb_device_struct inside the USB driver
3. Move defines and structures used by the driver
   out of the header file that is included by the SDK and
   into the MCUX USB driver.
4. Use end point defines provided by Zephyr instead of adding
   them locally.
5. Add a Kconfig to set the thread stack size
6. Move code to enable interrupts back to usb_attach function.
   Interrupts should be enabled after the init is successful,
   else we see errors of the ISR getting called before the
   init is complete causing Faults
6. Update west.yml to update the NXP HAL to get the updated
   SDK USB driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-09-09 09:44:46 -05:00
Mahesh Mahadevan
c5f44f94f8 drivers: usb: Update MCUX controller identification
Use device tree to identify the controller type

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-09-09 09:44:46 -05:00
Thomas Stranger
81bf4f98f7 drivers/w1: driver for ds2485 1-Wire master
This commit introduces the 1-wire master driver for maxim ds2485.

The ds2485 master has nearly the same (1-wire) feature set and
i2c-interface as the ds2477.
Therefore the common parts are extracted, but to avoid
any nda troubles only the ds2485 specific part is included.

Compared to older 1-wire masters, the ds2485 supports higher level
commands, supporting multi byte operations, search next, automatic crc
calculation.

In this driver only basic read and write operations are supported,
further hardware features are not yet utilized by the driver.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-09 14:11:30 +00:00
Erwan Gouriou
d62450886b drivers: timer: stm32_lptim: Initialize static global variable
In some configurations, a udf instruction may be generated
when compiling code where static global variable lptim_clock_freq is
used as a divisor.
To avoid this, initialize variable on declaration so that compiler
could see that it can't be used uninitialized in this division.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-09 14:09:22 +00:00
Kumar Gala
cc2c05a90c drivers: timer: Update drivers to use devicetree Kconfig symbol
Update timer drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-09 09:58:48 +00:00
Gerson Fernando Budke
fba21ecfd9 drivers: disk: sdmmc: Enable STM32L5X support
* Enable hardware flow control on Kconfig
 * Enable HSI48 clock on sdmmc_stm32 driver

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2022-09-09 09:56:51 +00:00
Francois Ramu
1816e0c7ea drivers: clock_control: stm32 fixed LSE system clock enable
On some stm32 mcus, the LSE is enabled as system clock (LSESYS)
only when the LSEON and LSERDY are both set.
The bit LSESYSEN is set in the RCC BDCR register
and the driver is waiting for the LSESYSRDY to be set.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-09 09:27:11 +00:00
Francois Ramu
7b95803218 drivers: serial: stm32 uart check baudrate register value
The baudrate register (BRR) of a stm32 USART cannot be lower than 16.
The baudrate register (BRR) of a stm32 LPUART cannot be lower than 0x300
and greater than 0xFFFFF.
Add assertion to check the range.
This could be the case when configuring a baudrate of 9600 on usart
clocked by LSE (32768Hz).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-09 10:11:23 +02:00
Diwakar C
6c6c496a82 espi: driver: Config spare espi vw register to OCP index
USBC port (Port 0/1/2/3) OCP (Over Current Protection) status
should be sent to PCH over eSPI VW index 0x50h. But there is
no dedicated VW register mapped to VW index 0x50h.
In this patch, configuring spare VW register SMVW06 to OCP VW
index 50h.

Signed-off-by: Diwakar C <diwakar.c@intel.com>
2022-09-09 10:11:02 +02:00
Martin Jäger
77e4c6515a drivers: can: native_posix_linux: initial implementation
This driver provides an interface to SocketCAN interfaces of the Linux
system running a Zephyr application with the native_posix board. These
interfaces may be virtual or actual CAN buses.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-09-09 10:08:59 +02:00
Ederson de Souza
67a6837efd drivers/mm: Remove redundant ifdef for MTL ADSP TBL implementation
An `ifdef CONFIG_SOC_SERIES_INTEL_ACE1X` currently always evaluates to
true, as `drivers/mm/mm_drv_intel_adsp_mtl_tlb.c` is only built when
`CONFIG_MM_DRV_INTEL_ADSP_MTL_TLB=y`, which depends on
`CONFIG_SOC_SERIES_INTEL_ACE1X`. So remove the ifdef.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-09-08 18:03:33 -04:00
Ederson de Souza
03a947850d drivers/mm: Get some bit configurations from DTS instead of SoC version
Migrate information to DTS and get it from there on the code. Note that
for CAVS 15, the information is not migrated as there's no DTS entry for
it. It can be brought back (in the DTS) if TLB support is enabled for
it.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-09-08 18:03:33 -04:00
Ederson de Souza
c1dc2683b9 drivers/dai/intel/ssp: Get number of SSP ports from Kconfig
Instead of using SoC versions, define the information about base and
extended ports on Kconfig, and use this information from there.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-09-08 18:03:33 -04:00
Ederson de Souza
79980f250c drivers/dai/intel/ssp: Decide about clock gating based on Kconfig
Instead of using version of the SoC, declare on Kconfig the need for it,
and use this information to decide upon enabling the code or not.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-09-08 18:03:33 -04:00
Henrik Brix Andersen
b01ea7c0c9 drivers: can: transceiver: Update drivers to use dts Kconfig symbol
Update the GPIO-controlled CAN transceiver driver to use the
DT_HAS_CAN_TRANSCEIVER_GPIO_ENABLED Kconfig symbol to expose the driver and
enable it by default based on devicetree.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-08 15:30:23 +00:00
Jeremy Bettis
da9448396c drivers/serial: Make serial_test a proper emul
Add emulator functionality to the serial_test driver, so that it can be
used to simulate a device on the other end of the uart.

If you don't set the buffer-size property in the dts node, there should
be effectively no change from the previous behavior.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2022-09-08 15:26:41 +00:00
Jeremy Bettis
672c7e5caf drivers/serial: clang-format serial_test.c
Format serial_test.c with clang-format.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2022-09-08 15:26:41 +00:00
Francois Ramu
b6ee1dfe6e drivers: flash: octo spi for stm32 with DMA
Introducing the dma transfer (also through dmamux)
to transfer data to/from the NOR octo-flash
With a DMAMUX, the DMA channel is given by the DTS.
Note that STM32U5X does not support DMA here.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-08 10:07:21 +00:00
HaiLong Yang
51363ae7c2 drivers: flash: introduce gd32 fmc driver
This supports three types GD32 FMC flash memory. GD32 FMC v1,
GD32 FMC v2 and GD32 FMC v3.

GD32 FMC v1 for small flash memory, flash size can be up to 512KB.

GD32 FMC v2 for large flash memory, flash size can be up to 3072KB.

GD32 FMC v3 not use page but sector as minimum block, flash size can
be up to 3072KB.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2022-09-08 10:13:05 +02:00
Daniel DeGrasse
04773864a8 drivers: sdhc: add SD host controller driver for LPC SDIF
add SD host controller driver for LPC SDIF IP block, using NXP SDIF
HAL driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-09-08 10:06:28 +02:00
Marcin Niestroj
326c685986 drivers: mcux_lpuart: clear Received Overrun Flag
According to i.MX RT1060 Reference Manual:

  While the OR flag is set, no additional data is stored in the data
  buffer even if sufficient room exists. To clear OR, write logic 1 to
  the OR flag.

Clear OR (Overrun) flag whenever it is set, so that data continues to be
received after potential data overrun.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-07 16:46:30 -05:00
Pieter De Gendt
bcbd8ff7ff drivers: pwm: pwm_mcux: Add WAIT/debug run options to devicetree
Add properties to allow PWM to keep running in WAIT or debug modes.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-09-07 16:28:10 -05:00
Pieter De Gendt
eb78a884d7 drivers: pwm: pwm_mcux: Add inverted polarity support
Add support for the PWM_POLARITY_INVERTED flag.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-09-07 16:28:10 -05:00
Andrei Emeltchenko
3f36584c72 i2c: shell: Update outdated help
Mention currently supported operations in I2C shell.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-07 16:04:39 -04:00
Andrei Emeltchenko
95037b996d i2c: shell: Remove forward declaration
Remove unneeded forward declaration.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-07 16:04:39 -04:00
Pierre Marzin
1d2752f4ee drivers: pwm: add Renesas R-Car driver
Add R-Car Gen3 PWM driver.

Clock diviser is automatically adjusted according to requested period
and duty-cycle in order to obtain as much accuracy as possible.
Indeed, in order to improve PWM accurancy, the PWM clock has to fit
the requested period. So use the given period_cycle to define if the
clock as to be adapted. In such case, increase/decrease the clock
diviser to adapt the period_cycle and be sure that it fits into the
10 bits counter of the PWM controller.

Tested on H3ULCB on pwm0 and pwm4.

Signed-off-by: Pierre Marzin <pierre.marzin@iot.bzh>
2022-09-07 15:50:49 +02:00
Erwan Gouriou
ec6f932ad2 drivers/timer: stm32 lptim: Fix frequency check
Aim is to error out on misconfifurations, not the other way round.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-07 15:39:16 +02:00
Francois Ramu
e133ebfe2e drivers: sdmmc: stm32 enables HSI48 MHz clock by default
For some stm32 devices, the SDMMC clock selection is HSI 48MHz
by default (reset value). It must be enabled before acccessing
the peripheral.
The ErrorCode is reported when Init fails.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-07 15:35:10 +02:00
Kevin Wang
c01dcacb6f drivers: spi: add Andes atcspi200 driver
Support the Andes atcspi200 spi driver

Signed-off-by: Kevin Wang <yunkai@andestech.com>
2022-09-07 15:34:47 +02:00
Francois Ramu
86ede2b679 drivers: spi : driver with DMA for the stm32u5
This commit is the adaptation of the stm32 SPI driver with DMA
transfer for the stm32u5 soc.
Use the DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_spi)
also valid for the stm32U5 serie.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-07 15:34:35 +02:00
Thomas Stranger
16242e9c32 drivers/w1: add 1-wire shell
This commit implements shell support for 1-Wire.
Commands for bus-reset, bit-, byte-, and block- communication,
as well as search and configuration are implemented.

- write_byte, and write_block perform a reset before,
in case the option "-r" is passed.
- using read_io_options() function to parse the reset option,
as this allows to easily add further options in the future.
- configuration type can be specified either as number or as name.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-07 15:33:52 +02:00
Gerard Marull-Paretas
8081d7f2a4 drivers: s/DT_CHILD(DT_DRV_INST(n), ...)/DT_INST_CHILD(n, ...)
Use instance version of DT_CHILD when possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-06 08:45:25 -07:00
Piotr Kmiecik
0acd68247f drivers: ace_v1x wallclock driver
Wallclock driver with functionality required by ACE v1x base firmware.

Signed-off-by: Piotr Kmiecik <piotrx.kmiecik@intel.com>
2022-09-06 17:44:03 +02:00
TOKITA Hiroshi
f3fd686b96 drivers: adc: shell: Support RaspberryPi Pico ADC
Add ADC shell support for RaspberryPi Pico.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-09-06 17:11:19 +02:00
TOKITA Hiroshi
6df65f569d drivers: adc: Add support for RaspberryPi Pico ADC
Introducing RaspberryPi Pico ADC driver.
This driver was created with reference to the adc_emul implementation.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-09-06 17:11:19 +02:00
Tatsuroh Hayashi
cc434a9fe1 drivers: counter: STM32F1RTC support
Add RTC support of STM32F1 family.

Fixes #31175

Signed-off-by: Tatsuroh Hayashi <tatzu884@gmail.com>
2022-09-06 09:43:54 -05:00
Pierre-Emmanuel Novac
7ac8dd87e4 drivers/clock_control: stm32: Configure MCO1 on STM32F1
MCO1 is also available on STM32F1 series (on top of STM32F4), allow
selection of MCO1 source with CLOCK_STM32_MCO1_SRC_* Kconfig parameters.
Available MCO1 sources are slightly different between STM32F4
(LSE, HSE, HSI, PLLCLK) and STM32F103 (HSE, HSI, PLLCLK/2, SYSCLK), and
STM32F105/F107 have a few more (EXT_HSE, PLL2CLK, PLLI2SCLK, PLLI2SCLK/2).
MCO1 on STM32F1 does not have a configurable divider (unlike STM32F4),
HAL call only configures source.
STM32F1 do not have MCO2.

Signed-off-by: Pierre-Emmanuel Novac <piernov@piernov.org>
2022-09-06 09:57:35 +02:00
Gerard Marull-Paretas
64eb350e5e drivers: spi: gd32: use clock control API
Use the clock control API to enable/get rate of SPI clocks.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
0aadc2dd44 drivers: serial: gd32: use clock control API
Use the clock control API to enable the UART clock.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
22e64fddfd drivers: pwm: gd32: use clock control API
Use the clock control API to enable/get rate of timer clocks.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
4fcc1dae0d drivers: i2c: gd32: use clock control API
Use the clock control API to enable/get rate of I2C clock.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
455b95b6c2 drivers: gpio,pinctrl: gd32: use clock control API
Use the clock control API to enable peripheral clocks. Note that both
GPIO and pinctrl drivers are updated at once since they share some IP
blocks.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
8d100f4f98 drivers: dma: gd32: use clock control API
Use the clock control API to enable DMA clock.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
8693a0b63f drivers: dac: gd32: use clock control API
Use the clock control API to enable peripheral clock.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
86654dbeae drivers: adc: gd32: use clock control API
Use the clock control API to turn on ADC clocks. Note that clock
selection is not yet implemented, so we still rely on custom rcu
properties for that.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
1c7138fbb1 drivers: adc: gd32: fix ADC clock source retrieval
The clock source is specified via rcu-clock-source in DT.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
4aa31b4526 drivers: clock_control: gd32: initial support
This patch adds a clock control driver for GD32 platforms. It is
important to note that the driver is only able to handle peripheral
clocks, but not "system clocks" (e.g. PLL settings, SYS_CK, etc.).  On
some similar platforms (STM32) this task is embedded in the same clock
driver, performed at init time but with no options to do any
manipulation at runtime via the API calls. The clock control API as-is
is really orthogonal to "system clocks", and it is arguably a bad idea
to embed system clock init code in a clock control driver. It can be
done at SoC level still using Devicetree as a source of hardware
description/initial configuration.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Declan Snyder
4baf7b9552 drivers: entropy: Disable CAAM driver
Temporarily disable CAAM driver because of bug in init on rt11xx

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-09-06 09:56:48 +02:00
Vinayak Kariappa Chettimada
3e5ea793b7 drivers: flash: nrf: Fix ticker stop user id value
Ticker stop callback are executing in ULL_HIGH priority,
correct the value to 1U instead of 0U which is for LLL
execution context of the Bluetooth Controller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-09-05 17:36:48 +02:00
Vinayak Kariappa Chettimada
67cf435ae1 drivers: flash: nrf: Fix ticker stop synchronization
Fix usage fault due to spurious ticker timeout expiry post
enqueuing of ticker stop operation.

Use ticker operation callback to handle completion of ticker
stop operation and then give the semaphore to thread to
notifying the completion of flash operation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-09-05 17:36:48 +02:00
Sylvio Alves
7fdde112d1 wifi: esp32: update enum naming reference
Due to Zephyr's WiFi updates, common private
enums used in `hal_espressif` are now being used.

This updates private internal values to meet hal_espressif
changes.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-05 15:32:34 +00:00
Sylvio Alves
a8cacfa530 wifi: esp32: add config to enable automatic DHCPV4 negotiation
ESP32 wifi connection uses Zephyr's net stack. Once WiFi connects
in station mode, is requires the application to handle DHCPv4
negotiation. This PR adds support to automatic negotiation by
handling the dhcpv4 calls in driver layer.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-05 15:32:34 +00:00
Sylvio Alves
7d9edc8bf0 wifi: esp32: add support to wifi api mgmt
Moved all MBEDTLS dependencies from prj.conf
to Kconfig as WiFi depends on it.

Update esp32 wifi driver to enable `samples/net/wifi`
to work. Commands as such as `wifi connect` and `wifi scan` are now
available.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-05 15:32:34 +00:00
Thomas Stranger
402752c07c drivers/can: move STM32FD clock divider configuration to dts
Remove the CAN_STM32FD_CLOCK_DIVISOR configuration option,
and add configuration via dts property clk-divider instead.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-05 14:44:45 +00:00
Thomas Stranger
09f45840f1 drivers/can: stm32fd fix not applied clock divider
The configurable CAN clock divider CAN_STM32FD_CLOCK_DIVISOR
was not applied during initialization, because write protection
was not disabled.

While the clock divider was not applied, it was still used in clock rate
calculation, therefore resulting in incorrect bus speed setup.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-05 14:44:45 +00:00
Thomas Stranger
a5cc6c2e16 drivers/can: stm32_fd: convert domain clk src sel. from kconfig to dts
Use domain clocks if they are defined in dts.

Until now domain clock sources could be selected via kconfig.
STM32 platform now can configure domain clock sources via
clock control driver, therefore this commit makes use of it.

The configuration is shared between canfd instances, so a domain clock
has to be defined for only one instance. Otherwise, only the
configuration from the latest initialized instance will remain.

The dependency on clock source PCLK1 for CAN_STM32FD_CLOCK_DIVISOR
was removed, because the divider also divides other clocks.
Note that setting that divider does not work at all at the moment,
because the write protection is not disabled.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-05 14:44:45 +00:00
Florian Grandel
c57650c403 net: context: clean up net_context_get()
* reduced cyclomatic complexity
* group validation by family to make the validation easier to understand
and extend
* change preprocessor markup where possible to allow for complete code
elimination when features (esp. IP) are disabled
* renamed net_context_get/set_ip_proto() to net_context_get_proto()

While the latter is formally part of the public API and might therefore
have to be deprecated rather than renamed, it is considered internal API
by the net developers, see
https://github.com/zephyrproject-rtos/zephyr/pull/48751#discussion_r942402612

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-09-05 14:35:17 +00:00
Florian Grandel
e608e92112 net: context: properly namespace can-related methods
The net_context_set/get_filter_id() methods are CAN specific and should
say so.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-09-05 14:35:17 +00:00
Gerard Marull-Paretas
79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Erwan Gouriou
54302ac67d drivers: flash: stm32 ospi: Limit bytes read from DT SFDP table
In case SFDP table is provided via device tree, take care not reading
more than expected by the function caller as the result is written
in a structure which size is predefined by one specific byte in the
table, and could be smaller than the table size.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-05 10:17:21 +02:00
Jiafei Pan
8700d925b3 drivers: serial: remove soc.h from iuart
soc.h has been removed for ARM64 SoC platforms and it is also needed by
ARM32, so remove it from related drivers.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-09-05 10:17:13 +02:00
Jiafei Pan
1cf9858b4f drivers: pinctrl: remove soc.h from pinctrl_imx
soc.h has been removed for ARM64 SoC platforms and it is also needed by
ARM32, so remove it from related drivers.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-09-05 10:17:13 +02:00
Jiafei Pan
af0c47f7d8 drivers: clock_control: remove soc.h from mcux_ccm
soc.h has been removed for ARM64 SoC platforms and it is also needed by
ARM32, so remove it from related drivers.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-09-05 10:17:13 +02:00
Jiafei Pan
66414ef6e7 drivers: pinctrl: fix imx pinctrl 64bit compatible
Make imx pinctrl driver to be aarch64 compatible.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-09-05 10:17:13 +02:00
Andrey Borisovich
2e04bfdfe0 soc: intel_adsp: Refactored IPC/IDC
Changes to code:
1. Renamed CAVS_IPC API from common/include/cavs_ipc.h to
common/include/intel_adsp_ipc.h. Renamed all API functions and structs -
added "intel_adsp_" prefix.
2. Moved definitions from intel-ipc-regs.h and ace-ipc-regs.g to SOC
specific headers include/<soc_name>/adsp_ipc_regs.h.
3. Added new common intel_adsp_ipc_devtree.h header with new
macros to retrieve IPC and IDC nodes and register addresses.
Put those new macros in code replacing hardcoded values outside of
devicetree.
4. Changed documentation of IDC and renamed IDC register struct
to have common name between all intel adsp socs.
5. Removed excessive docs description on cAVS IPC protocol.

Changes to Devicetree:
1. Renamed in all CAVS boards .dtsi files content in IPC nodes:
   - "cavs_host_ipc" node labels to "adsp_ipc" labels.
   - compatible "intel,cavs-host-ipc" renamed to
     "intel,adsp-host-ipc".
2. Added (previously missing) yaml file for "intel,adsp-host-ipc"
   compatible.
3. Renamed in all CAVS boards .dtsi files content in IDC nodes:
   - "idc" node labels to "adsp_idc" labels.
   - compatible "intel,cavs-idc" renamed to "intel-adsp-idc"
4. Renamed intel,cavs_idc.yaml file to intel,adsp_idc.yaml
   so it is suitable for both CAVS and ACE SoC family.
   Moved it from ipm bindings to ipc bindings where it belongs.

Changes to Kconfig:
1. Renamed existing Kconfig option CONFIG_CAVS_IPC to
   INTEL_ADSP_IPC.
2. For renamed INTEL_ADSP_IPC addded default value based on
   status of the "adsp-ipc" and "adsp-ipc" node.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-09-02 08:18:32 -04:00
Gerard Marull-Paretas
082043c6e8 drivers: display: intel_multibootfb: convert to DT
Convert the device to be Devicetree based. Adjusted tests and other
areas that were using old Kconfig properties.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-02 14:16:08 +02:00
Gerard Marull-Paretas
6a4409d8a0 drivers: display: intel_multibootfb: remove data accessor
config/data accessors have been removed from all (or most) in-tree
drivers, do the same here.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-02 14:16:08 +02:00
Gerard Marull-Paretas
11860face3 drivers: display: framebuffer: rework to make it self-contained
The "framebuf" driver was an incomplete driver expecting _clients_ to
implement missing functionality (i.e. init and device definition)
outside of the driver. This pattern of scattering driver code throughout
the tree is not common (if used at all). If certain drivers share
functionality, one can create a common module within the subsystem (see
e.g. ILI9XXX drivers).

The _generic_ framebuffer code was only used to implement the Intel
Multiboot framebuffer driver. This patch centralizes all the scattered
code in the subsystem and adjusts the driver name to "intel_multibootfb"
to make things clear. If there's ever another framebuffer driver that
shares code, it can be split into multiple modules.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-02 14:16:08 +02:00
Kumar Gala
576d3fe84f drivers: ec_host_cmd_periph: Update Kconfig
Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-02 11:22:39 +00:00
Andrew Hedin
715c2e63a0 modem: hl7800: Configure name for work queue
Prevent blank entry in kernel stacks shell command output.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2022-09-02 11:06:11 +00:00
Marcin Niestroj
cf4578bdda drivers: usb_dc_rpi: set thread name
Thread name is useful when debugging or using shell with
CONFIG_THREAD_NAME=y.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-02 11:00:48 +00:00
Marcin Niestroj
966738db2c drivers: usb_dc_mcux: set thread name
Thread name is useful when debugging or using shell with
CONFIG_THREAD_NAME=y.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-02 11:00:48 +00:00
Marcin Niestroj
de36a7d7f4 drivers: usb_dc_kinetis: set thread name
Thread name is useful when debugging or using shell with
CONFIG_THREAD_NAME=y.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-02 11:00:48 +00:00
Marcin Niestroj
1e982fffd2 drivers: usb_dc_rpi: create thread and connect IRQ during init
So far thread was created as part of usb_dc_attach() by k_thread_create().
This means that if following function were executed:

 * usb_enable()
 * usb_disable()
 * usb_enable()

then k_thread_create() was called second time. This results in undefined
behavior.

Fix above issue by moving k_thread_create() invocation to function called
during system initialization.

While at it, move IRQ_CONNECT() and irq_enable() invocations to init as
well.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-02 11:00:48 +00:00
Marcin Niestroj
e4480d6ab6 drivers: usb_dc_mcux: create thread and connect IRQ during init
So far thread was created as part of usb_dc_attach() by k_thread_create().
This means that if following function were executed:

 * usb_enable()
 * usb_disable()
 * usb_enable()

then k_thread_create() was called second time. This results in undefined
behavior.

Fix above issue by moving k_thread_create() invocation to function called
during system initialization.

While at it, move IRQ_CONNECT() and irq_enable() invocations to init as
well.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-02 11:00:48 +00:00
Marcin Niestroj
9de245a588 drivers: usb_dc_kinetis: create thread and connect IRQ during init
So far thread was created as part of usb_dc_attach() by k_thread_create().
This means that if following function were executed:

 * usb_enable()
 * usb_disable()
 * usb_enable()

then k_thread_create() was called second time. This results in undefined
behavior.

Fix above issue by moving k_thread_create() invocation to function called
during system initialization.

While at it, move IRQ_CONNECT() and irq_enable() invocations to init as
well.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-02 11:00:48 +00:00
Erwan Gouriou
e8e72882e1 drivers: timer: stm32: Check return of clock functions
That will speed up debugging.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-02 10:41:59 +00:00
Erwan Gouriou
7f2cb0fd22 drivers: timer: stm32: Specific handling for L0 LSI
On L0 series, LSI runs at 37KHz while LPTIM driver only supports speeds
up to 32768Hz (to avoid counter overflow). Consequence is a time running
faster than reality (x1.13)
Solution to this is the implementation of the LPTIM prescaler support.

While moving driver configuration from Kconfig to DT, this case was
not taken into account and the effect was LPTIM counter overflow which
consequence is worse than the slightly faster timer.
Reproduce the initial behavior with this piece of code that will be
removed once prescaler support is available.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-02 10:41:59 +00:00
Erwan Gouriou
16c11138d5 drivers: timer: stm32: Adapt SYS_CLOCK_TICKS_PER_SEC
When using LPTIM as tick source, tick freq (SYS_CLOCK_TICKS_PER_SEC)
needs to be adapted to get a precise tick to LPTIM freq ratio.

This adaptation was done easily using Kconfig up to now (under
soc/st_stm32/common/Kconfig.defconfig.series).
Since driver is configured using device tree, this method should
be adapted. For the LSI case (default Kconfig case), rely on the
existing mecanism, which is also still used by OOT users.
For the LSE case, force the value manually in boards forlder.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-02 10:41:59 +00:00
Erwan Gouriou
d056be2b38 drivers/timer: stm32: Re-instantiate warning message on lptim configuration
Following transition of lptim timer configuration from Kconfig to DT,
a warning message was set to inform users about this deprecation.
Due to errors in CI this message had to be removed while fixing the related
issues.
Now these issues are fixed, set the deprecation message again.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-02 10:41:59 +00:00
Erwan Gouriou
f818b0478d drivers/timer: stm32: Enable lptim driver based on dt status
Similarly to other drivers, use auto generated DT_HAS_<COMPAT> Kconfig
symbol to control use of STM32 lptim driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-02 10:41:59 +00:00
Erwan Gouriou
680574f960 drivers: ethernet: stm32_hal: Rename flag.
Last HAL udpdates came with a fix on two ethernet flags:
- ETH_PTPTS*S*R_TSSARFE > ETH_PTPTS*C*R_TSSARFE
- ETH_PTPTS*S*R_TSSSR > ETH_PTPTS*C*R_TSSSR

Update driver to be aligned with these changes.

Fixes #49763

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-02 10:37:49 +00:00
Vijay Hiremath
f262b795b8 eSPI: npcx: Enable platform specific Virtual Wire GPIOs
Added code to enable platform specific Virtual Wire GPIOs. With this
change, able to send the USB-C overcurrent Virtual Wire event to
Meterolake SOC.

Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
2022-09-02 10:36:24 +00:00
Andreas Sandberg
f62dc249a0 drivers: uc81xx: Add workaround for chips without autocopy
The UC8176 doesn't automatically copy writes to the buffer containing
the old SRAM contents. In this case, we need to manually copy data to
the back buffer.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Andreas Sandberg
c276f834e0 drivers: uc81xx: Make it possible to override PLL/VDCS
Some custom refresh profiles need to set the PLL and VDCS
registers. Add them as optional DT properties.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Andreas Sandberg
d571b3136d drivers: uc81xx: Add support for overriding LUTs
Add support for overriding display LUTs in the UC81xx driver. This
makes it possible to use different LUTs for the full and partial
refresh profiles.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Andreas Sandberg
21208aae1d drivers: uc81xx: Add a separate partial refresh profile
Add a separate profile for partial refreshes. This makes it possible
to specify a separate refresh configuration for partial and full
refreshes.

The driver now transitions to full refresh mode when blanking is
turned on. It transitions back to partial refresh mode when there is a
write while blanking is off.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Andreas Sandberg
957e22976d drivers: uc81xx: Specify overrides in a DT child node
Introduce the concept of refresh profiles which are specified as a
child node in the device tree. This makes it possible to use different
overrides for different types of refreshes (full/partial).

The only profile that is currently supported is the "full" profile.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Andreas Sandberg
35eaa1c36c drivers: uc81xx: Make busy wait implicit in most cases
Some commands need to signal that the chip is busy using the busy
pin. We generally need to wait for the chip to exit the busy state
before issuing a new command. Call uc81xx_busy_wait() from
uc81xx_write_cmd() just before issuing a new command instead to avoid
sprinkling wait calls everywhere.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Andreas Sandberg
b9ebf3397b drivers: uc81xx: Don't produce debug output while waiting
The UC81xx driver prints a debug message on every iteration of its
busy wait loop. This makes debug output almost useless. Modify this
code to print a debug message on entry and exit instead.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Sylvio Alves
7a00f7b793 west.yml: update hal to v4.4.1 base
west.yml: update hal_espressif to use latest v4.4.1 updates.
This change needs to be insync with esp32c3 timer changes, otherwise it
breaks it.

drivers: timer: update esp32c3 systimer to meet API changes.
Systimer API was refactored in hal v4.4.1, which
requires updates in esp32C3 systimer. Timer behavior is maintained
as is.

mcpwm: add v4.4.1 include reference, which was refactored as well.

driver: spi: esp32: update internal structs to meet API changes.

cmake: updated esp32 board to use HAL_ prefix as from west blobs
requirement.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-01 21:48:18 +00:00
Sylvio Alves
4928a69a06 drivers: wifi: esp32: remove supplicant init call
Supplicant start call is part of esp_wifi_init, which
would become duplicated if kept in here.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-01 21:48:18 +00:00
Sylvio Alves
61d03e1bb0 driver: intc: esp32: use hal calls in interrupt driver
Updates ESP32 to use hal interrupt funcions provided by 4.4.1
release. Removed redefinition of interrupt FLAGS.

This also includes interrupt definitions for ESP32C3

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-01 21:48:18 +00:00
Sylvio Alves
b80c277796 clock: esp32: update clock init functions
Add device specific clock initialization, which uses
reset reason cause information to proper define
peripherals clock state.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-01 21:48:18 +00:00
Christopher Friedt
13a2294f9d sys_clock: define NSEC_PER_MSEC
NSEC_PER_MSEC should be defined along with the rest of the
per-sec macros in sys_clock.h. Currently, it's defined
multiply in a few separate locations.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-09-01 16:29:25 -04:00
Boon Khai Ng
c3dd728c26 drivers: flash: Add Cadence QSPI NOR Flash Driver
This patch is to enable new driver, Cadence QSPI NOR
flash for Intel SoC FPGA Agilex Family

Signed-off-by: Boon Khai Ng <boon.khai.ng@intel.com>
2022-09-01 14:30:59 -04:00
Adrian Wojak
fb57a4876f drivers: sensor: lsm6dsl: disable high performance in initialization
To reduce energy consumption for accel and gyro frequencies 52 Hz and
lower, disable high performance mode by default.
It doesn't affect for higher frequencies.

Signed-off-by: Adrian Wojak <adrian.wojak@grinn-global.com>
2022-09-01 13:19:08 -05:00
Erwan Gouriou
aa8a89a216 drivers: sensors: hts221: Fix trigger mode
1. Use #ifdef around CONFIG_HTS221_TRIGGER instead of #if

2. According to binding (which is in line with datasheet), name of the pin
used for trigger mode should be drdy, not irq.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-01 13:15:14 -05:00
Yong Cong Sin
411079cf1d drivers: adc: stm32: teardown internal channel after read
Internal channel should be torn after ADC read, this is
especially the case for VBAT, where the connection of internal
channel will introduce current drainage.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-09-01 12:29:58 +00:00
Wei-Tai Lee
0f8d12d4ed drivers: i2c: add Andes atciic100 driver
Add I2C driver for Andes atciic100. Driver supports I2C target mode and
tested on adp_xc7k_ae350 in runtime.

Signed-off-by: Wei-Tai Lee <wtlee@andestech.com>
2022-09-01 10:29:12 +02:00
Anas Nashif
88fb9ee727 ipm: split kconfig options into multiple files
Main Kconfig becoming too busy, split it into vendor specific files
where it makes sense.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-09-01 10:28:16 +02:00
Kumar Gala
45a436f372 drivers: disk: sdmmc: Update Kconfig
Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-01 10:26:19 +02:00
Kumar Gala
1bee3326ad drivers: dai: Update drivers to use devicetree Kconfig symbol
Update dai drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-01 10:26:06 +02:00
Kumar Gala
3cc8183c52 drivers: gpio: Cleanup Kconfig.test
Use DT_HAS_VND_GPIO_ENABLED for GPIO_TEST similar to what we
do for SPI_TEST, I2C_TEST, etc.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-01 10:25:57 +02:00
Kumar Gala
91fedca6e2 drivers: lora: Update drivers to use devicetree Kconfig symbol
Update lora drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-01 10:25:51 +02:00
Kumar Gala
8423f23b9c drivers: intc: Update drivers to use devicetree Kconfig symbol
Update intc drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-01 10:25:36 +02:00
Kumar Gala
10d39b0356 drivers: serial: rtt: Remove DT_COMPAT_<compat> defines
We auto-generate DT_COMPAT_<compat> defines so we dont need to
explicitly define them anymore.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-31 21:57:52 +00:00
Kumar Gala
25cb2bff74 drivers: wifi: Update drivers to use devicetree Kconfig symbol
Update Wifi drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-31 21:57:06 +00:00
Florian Grandel
c3b080166e drivers: ieee802154: introduce consistent MTU definition
This change applies the newly introduced consistent MTU definition to
all IEEE 802.15.4 radio drivers.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-08-31 21:52:37 +00:00
Bartosz Bilas
d6cf6e7bb2 dt-bindings: sensor: ina237: rename the operating modes
Adjust the names of the operating modes to match them
with the datasheet and INA230 pattern. While at it add
the missing INA237_OPER_MODE_TEMP_TRIG mode.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-08-31 21:51:14 +00:00
Yannick Thesen
754c578d79 drivers: sensor: Added driver for the Würth Elektronik WSEN-HIDS sensor.
Added driver for the WSEN-HIDS humidity and temperature sensor.

Signed-off-by: Yannick Thesen <Yannick.Thesen@we-online.de>
2022-08-31 21:47:58 +00:00
Andrzej Kaczmarek
bd5edb6775 drivers: flash: Add driver for smartbond
This adds flash driver for Renesas SmartBond(tm) family.

This technically uses QSPI controller but since default and most
commonly used configuration is to boot from external QSPI flash (DA1469x
do not have built-in flash) and that flash is mapped into memory space,
it can be represented as internal flash.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2022-08-31 20:32:03 +02:00
Andrzej Kaczmarek
6ba6e713cb drivers: serial: Add driver for smartbond
This adds serial driver for Renesas SmartBond(tm) family. Both polling
and interrupt APIs are supported.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2022-08-31 20:32:03 +02:00
Andrzej Kaczmarek
f19252567c drivers: pinctrl: Add driver for smartbond
This adds pinctrl driver for Renesas SmartBond(tm) MCU family.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2022-08-31 20:32:03 +02:00
Andrzej Kaczmarek
6af5533ca5 drivers: gpio: Add driver for smartbond
This adds GPIO driver for Renesas SmartBond(tm) family.

Driver supports pin configuration (input/output) and interrupts on edge.
Interrupts on level are not supported by hardware.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2022-08-31 20:32:03 +02:00
Nils Larsen
a3bae01e74 drivers: sdhc: add clock init for USDHC2-block of NXP i.MX-processors
The missing init is added analog to existing init of USDHC1 block.

Signed-off-by: Nils Larsen <nils.larsen@posteo.de>
2022-08-31 13:21:17 -05:00
Kumar Gala
0ee0269848 drivers: mm: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-31 11:17:37 -05:00
Kumar Gala
fab8d25fd3 drivers: mm: Add dts binding specific for ADSP Meteor Lake TLB
Add a specific compatiable and binding for intel,adsp-mtl-tlb.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-31 11:17:37 -05:00
Stephanos Ioannidis
e9b29a6f83 drivers: spi: psoc6: Fix spi_psoc6_transceive calls
The commit 4c20403629 updated the
`spi_psoc6_transceive` function signature but forgot to update its
usages.

This commit updates the `spi_psoc6_transceive` function invocations
to properly provide the callback and user data parameters.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-09-01 01:02:50 +09:00
Stephanos Ioannidis
a25257fcef drivers: spi: sifive: Migrate spi_context_{complete,lock} usage
This commit updates the SiFive SPI driver to reflect the
`spi_context_complete` and `spi_context_lock` function signature
changes introduced in the commit
4c20403629.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-09-01 01:02:50 +09:00
Stephanos Ioannidis
da570f871f drivers: spi: mchp_mss_qspi: Migrate spi_context_{complete,lock} usage
This commit updates the Microchip MSS QSPI SPI driver to reflect the
`spi_context_complete` and `spi_context_lock` function signature
changes introduced in the commit
4c20403629.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-09-01 01:02:50 +09:00
Stephanos Ioannidis
068006e1dc drivers: spi: litespi: Migrate spi_context_complete usage
This commit updates the LiteSPI SPI driver to reflect the
`spi_context_complete` function signature change introduced in the
commit 4c20403629.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-09-01 01:02:50 +09:00
Stephanos Ioannidis
fedf0faac0 drivers: spi: gecko: Migrate spi_context_complete usage
This commit updates the Gecko SPI driver to reflect the
`spi_context_complete` function signature change introduced in the
commit 4c20403629.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-09-01 01:02:50 +09:00
Stephanos Ioannidis
c4840535b6 drivers: spi: gd32: Migrate spi_context_{complete,lock} usage
This commit updates the GD32 SPI driver to reflect the
`spi_context_complete` and `spi_context_lock` function signature
changes introduced in the commit
4c20403629.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-09-01 01:02:50 +09:00
Gerard Marull-Paretas
fe561f02db drivers: clock_control: nrf: fix unused variable warning
prev_temperature was only used if USE_TEMP_SENSOR is true. Make its
definition conditional.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-01 00:47:41 +09:00
Gerard Marull-Paretas
0612dd433d drivers: clock_control: nrf: fix temperature sensor usage
The temperature sensor was only needed when
CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP > 0. Implementation did
not reflect this dependency correctly, and sensor sampling code was
always compiled. Also removed CONFIG_MULTITHREADING checks, since this
driver is only compiled if CONFIG_MULTITHREADING=y.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-31 14:11:44 +02:00
Gerard Marull-Paretas
0cd311c4a1 include: fix files using legacy include paths
Some files were still using the already deprecated include path, fix
this.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-31 06:49:00 -04:00
Henrik Brix Andersen
b0c1b9715f drivers: can: shell: add command for showing CAN controller information
Add a "can show <device>" command for showing information about a CAN
controller.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-31 10:45:35 +02:00
Henrik Brix Andersen
2f73225aa8 drivers: can: rewrite the CAN shell module
Rewrite the CAN shell module to catch up with the added CAN controller API
functionality.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-31 10:45:35 +02:00
Adam Wojasinski
63ab9b3c6d drivers: Replace deprecated nrfx API
This commit replaces API that became deprecated with the release
of nrfx2.9 - see CHANGELOG in zephyrproject-rtos:hal_nordic repository

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2022-08-31 10:43:14 +02:00
Gerard Marull-Paretas
d19875e510 drivers: intc: gic: use DT_FOREACH_CHILD_STATUS_OKAY_SEP
Remove the need for an auxiliary macro by using
DT_FOREACH_CHILD_STATUS_OKAY_SEP.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Gerard Marull-Paretas
9c8cd560f0 drivers: gpio: xlnx_ps: use DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP
Simplify driver by using DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP (avoids
DT_DRV_INST and auxiliary macro).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Gerard Marull-Paretas
1bc794c7d4 drivers: gpio: nct38xx: use DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP
Simplify driver by using DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP (avoids
both DT_DRV_INST and auxiliary macro).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Gerard Marull-Paretas
40542638fd drivers: led: gpio: use DT_INST_FOREACH_CHILD_SEP_VARGS
Avoid auxiliary macros by using DT_INST_FOREACH_CHILD_SEP_VARGS

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Gerard Marull-Paretas
44552df4f5 drivers: led: pwm: use DT_INST_FOREACH_CHILD_SEP
Remove the need for auxiliary macros by using DT_INST_FOREACH_CHILD_SEP.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Kumar Gala
310190ca01 drivers: crypto: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-30 10:43:12 +00:00
Jun Lin
ab9febcf3c driver: i2c: npcx: add recover_bus API support
Add I2C bus recovery support by emitting 9 SCL clock pulses.
It implements the equivalent logic of the i2c_unwedge function in the
ChromiumOS legacy-EC.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-08-30 10:26:19 +02:00
Holger Schurig
331572b3f2 drivers: sensors: fix DRDY usage
hts221_trigger.c is pulled in by the CMakeLists.txt file when
CONFIG_HTS221_TRIGGER is defined. Therefore make the source in hts221.c use
the some define.

This removes also the (wrong) warning

    <inf> HTS221: Cannot enable trigger without drdy-gpios

even when "drdy-gpios" is defined in the device-tree.

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
2022-08-30 10:26:09 +02:00
Sylvio Alves
20c3256016 net: wifi: Allow to use offloaded wifi_mgmt API with native stack
wifi drivers that depends on native ethernet stack cannot perform
wifi API calls missing availability. This changes adds the ethernet_api
interface in wifi_mgmt so that it becomes possible.

Naming "offload" in "struct net_wifi_mgmt_offload" is kept because
Zephyr still has no supplicant to handle a full non-offloaded driver.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-08-29 17:31:17 +02:00
Gerard Marull-Paretas
d55bc1f7ba drivers: spi: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
0337905c7a drivers: serial: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
2c740b4392 drivers: pwm: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
7002351b58 drivers: i2c: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
5aa5af8ec2 drivers: gpio: gd32: use reset API
Use the reset API to restore the peripheral to its initial state before
configuring it.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
382c1f2338 drivers: dma: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
e779767b25 drivers: dac: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
6894a6c7ed drivers: adc: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
28b59890a6 drivers: reset: gd32: add initial support
Add a new reset driver for GD32 platforms. This driver controls the
reset registers from the RCU peripheral. It can be used to restore
peripherals to their initial state when initializing a device.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Sylvio Alves
3c50237460 drivers: gpio: esp32: fix config function to allow changes
Current implementation misses disabling input/output mux
once GPIO has already been configured. It means that after 1st
configuration, if GPIO is reconfigured, it won't disable previous
definitions, causing unexpected behavior.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-08-26 21:27:50 -04:00
Gerard Marull-Paretas
ac89fce3be drivers: gpio: sx1509b: select I2C
Select I2C instead of depending on it, following latest upstream policy.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-26 10:06:43 -07:00
Kumar Gala
0a57488719 drivers: dma: Update drivers to use devicetree Kconfig symbol
Update DMA drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-26 14:27:23 +00:00
Tom Burdick
4c20403629 spi: callback API for asynchronous transcieve
Adds a new spi_transcieve_cb API which enables asynchronous
SPI transactions with callback notification.

The exist spi_transcieve_async API remains and uses the new
spi_transcieve_cb API to provide a k_poll_signal notifier.

The driver API changes to provide a callback and userdata
parameter to async transcieve. All drivers in the tree
have been updated to the change.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-26 09:29:48 -04:00
Wei-Tai Lee
00b97feb56 drivers: hwinfo: add Andes hwinfo driver
Add hwinfo driver for Andes.

Signed-off-by: Wei-Tai Lee <wtlee@andestech.com>
2022-08-26 11:55:55 +02:00
Jimmy Zheng
a2cc4b702f drivers: counter: add Andes atcpit100 counter driver
atcpit100 counter driver support 4 32-bit PIT channel, using channel 3 as
the default counter.

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
2022-08-26 11:55:36 +02:00
Gerard Marull-Paretas
223cc3c6bd drivers: pinctrl: nrf: add support for disconnecting a pin
It was not possible to disconnect a pin using the nRF pinctrl driver.
That is, it was not possible to set PSEL to 0xFFFFFFFF (indicating pin
is not connected). This can be useful in certain scenarios, e.g. a
bootloader configures all signals of a certain peripheral but
application then needs to disconnect certain signals.

A new DT macro has been introduced to accomplish this:
NRF_PSEL_DISCONNECT. It can be used like this to explicitely disconnect
a peripheral signal:

```
&pinctrl {
	uart0_default: uart0_default {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 1)>,
				<NRF_PSEL_DISCONNECTED(UART_RX)>;
		};
	};
};
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-25 14:38:26 -07:00
Andrei Emeltchenko
7c81ee9d18 pcie: shell: Add help and argument check
Use SHELL_CMD_ARG() for argument check and add help, looking like:

...

$ pcie -h
  pcie - PCI(e) device information
  Subcommands:
    ls  :List PCIE devices
         Usage: ls [bus:device:function] [dump]

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-08-25 21:14:51 +00:00
Andrei Emeltchenko
d46c7595d9 pcie: shell: Verify command parameters
Exit on wrong parameter for pcie ls command.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-08-25 21:14:51 +00:00
Andrei Emeltchenko
e224e4c4fe i2c: shell: Fix SHELL_CMD_ARG() parameter count
The command uses 1 optional parameter and this parameter can be at
maximum MAX_I2C_BYTES.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-08-25 21:08:20 +00:00
Francois Ramu
f106465741 drivers: flash: ospi driver erase command on 24bits in SPI mode
When configuring the octo-flash in SPI/STR mode, the address size
must be on 24bits (and not on 32bits).
Despite the dev_data->address_width which is always seen as 4, the
erase command must reduce the AddressSize for this transfer mode.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-25 21:05:27 +00:00
Kumar Gala
324ee290f8 drivers: i2s: Update drivers to use devicetree Kconfig symbol
Update I2S drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-25 15:03:11 -05:00
Yves Vandervennet
6b66d7f266 flash: nxp: enabling lpc55s36's FMC
This commit enables the SoC's flash memory controller.

 - added lpc55s36 specific code in the NXP MCUX driver
   to take advantage of the SoC's check-before-read
   capability
 - enabled the FMC node in the SoC's dtsi (iap)
 - added the flash controller chosen node to the board's dts

Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
2022-08-25 10:24:41 -05:00
Daniel DeGrasse
d70db21760 drivers: flash: soc_flash_lpc: enable support for lpc54xxx IAP
Add support for LPC54xxx IAP flash driver to soc_flash_lpc.c
Driver is tested on M4 core only, and is therefore disabled on the M0 core.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-25 08:26:53 -05:00
Daniel DeGrasse
03cc56d5f8 drivers: flash: flash_mcux_flexspi_hyperflash: Fix incorrect printf format
Use correct printf format specifier for LOG_DBG calls using offsets, as
these offsets are long int and thus require the %lx format specifier rather
than %x.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-25 08:26:53 -05:00
Kumar Gala
2ac45e09db drivers: usb: device: Update drivers to use devicetree Kconfig symbol
Update usb device drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-25 08:05:54 -05:00
Flavio Ceolin
180f50feda intel_adsp: gpdma: Fix driver initialiaziation
cavs15 does not need to request ownership of the dma controller.

Fixes #49203

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-08-24 18:08:39 -04:00
Henri Xavier
dfededeadf cache: Fix build warning 'No SOURCES given to Zephyr library'
Following 4806e1087e ,
the following warning appears for some boards (e.g. `qemu_cortex_a53`)
```
CMake Warning at /zephyr/CMakeLists.txt:798 (message):
  No SOURCES given to Zephyr library: drivers__cache

  Excluding target from build.
```

Allow this driver to have no sources.

Signed-off-by: Henri Xavier <datacomos@huawei.com>
2022-08-24 10:36:40 +00:00
TLIG Dhaou
546218ad2b drivers: sensor: stm32_temp add the ts cal resolution to the driver
Add the ts cal resolution in the driver in order to calculate temperature
value.

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-08-24 11:35:45 +02:00
TLIG Dhaou
7b102a9993 drivers: adc: stm32 init the Regular group for stm32wl
The stm32wl mcu requires the REG group of the ADC
to be initialized before starting the conversion.

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-08-24 11:35:45 +02:00
TLIG Dhaou
df364cc372 drivers: adc: stm32 init the Regular group for stm32u5
The stm32u5 mcu requires the REG group of the ADC
to be initialized before starting the conversion.

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-08-24 11:35:45 +02:00
Martí Bolívar
0c198f97a1 drivers: entropy: fail mcux CAAM init on error
Commit d556a0c8a6
("drivers: entropy: Add entropy driver for MCUX CAAM")
added a shim entropy driver whose initialization function
always returns 0, even when the underlying HAL API fails.

This is wrong; if the device initialization function fails, it must
return nonzero by contract. Papering this over with an assert is not
enough. Fix it by returning -ENODEV on error.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-08-24 10:07:28 +02:00
Caspar Friedrich
598de06165 drivers: ds2484: Fix wrong early exit during suspend/resume
The sleep pin is optional and the driver checks for availability during
runtime. Currently the logic is inverted and therefore the driver exits
early if the pin is actually available. This pr fixes this behavior.

Also: Add `fallthrough` flags to switch/case

Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
2022-08-24 10:06:58 +02:00
Francois Ramu
8bc8b8eec1 drivers: dma: stm32 Kconfig with the new DT_HAS_<COMPAT>_ENABLED.
This commit is converting the DMA kconfig for the stm32 dma driver
with new macro DT_HAS_<COMPAT>_ENABLED.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-24 10:05:32 +02:00
Francois Ramu
3fafe7fdee drivers: dma: new dma peripheral driver for stm32u5
It includes the definition for the DMA peripheral of this type,
present on stm32U5 devices.
A particular DMA_STM32U5 config is selected for that purpose.
The driver is derived from the existing dma_stm32.c
The GPDMA is counting channels (0-15) ; stream offset is 0.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-24 10:05:32 +02:00
TLIG Dhaou
402ebb3df0 drivers: counter: Patch for the stm32 counter
Fix the TIM_Typedef types.

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-08-23 20:08:35 +02:00
TLIG Dhaou
cc9b6bb0b4 drivers: ethernet: patch for the stm32 drivers
This commit is a patch to fix the ETH buffer redefined in many files.

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-08-23 20:08:35 +02:00
Tim Lin
822c37745e soc: it8xxx2: pull more function into ram code section
Pull more function into ram code section to effectively improve
access speed and performance.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-08-23 10:16:36 +02:00
Tim Lin
cb041d062f ITE: drivers/i2c: Add I2C FIFO mode
Adding I2C FIFO mode can reduce the time between each byte to
improve the I2C bus clock stretching during I2C transaction.
The I2C master supports two 32-bytes FIFOs, channel A and C
are supported now.

I2C FIFO mode of it8xxx2 can support I2C APIs including:
i2c_write(), i2c_read(), i2c_burst_read.

Test:
1. tests\drivers\i2c\i2c_api --> pass
2. Reading 16 bytes of data through i2c_burst_read() can reduce
   0.52ms(2.4ms->1.88ms) compared to the original pio mode when the
   frequency is 100KHz.
3. It is normal to read sensor data through I2C on Nereid's platform.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-08-23 10:16:36 +02:00
Carlo Caione
4806e1087e cache: Fix cache API calling from userspace
When a cache API function is called from userspace, this results on
ARM64 in an OOPS (bad syscall error). This is due to at least two
different factors:

- the location of the cache handlers is preventing the linker to
  actually find the handlers
- specifically for ARM64 and ARC some cache handling functions are not
  implemented (when userspace is not used the compiler simply optimizes
  out these calls)

Fix the problem by:

- moving the userspace cache handlers to a their logical and proper
  location (in the drivers directory)
- adding the missing handlers for ARM64 and ARC

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-08-23 10:14:17 +02:00
Ravik Hasija
4a18e6f581 drivers: gpio: Updating driver to Enable Multiple Interrupts.
Change Summary:
- Updating GPIO_CFG_IRQ define to enable multiple interrupts to
  accomodate for IP configuration where each pin when interrupted
  can trigger CPU interrupt.
- Removing gpio_dw_unmask_int define as it is NO OP

Signed-off-by: Ravik Hasija <ravikh@fb.com>
2022-08-22 19:38:37 +02:00
Bartosz Bilas
755c0d57e8 drivers: sensor: ina237: add support for triggered mode
Add missing support for the triggered mode using GPIO
interrupt alert pin. It uses mode detection at runtime
which allows working multiple sensors with different
modes simultaneously.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-08-22 19:38:06 +02:00
Kumar Gala
98922a0269 serial: uart_cc13xx_cc26xx: Remove dead code
Remove unused/referenced UART_CC13XX_CC26XX_DEVICE_INIT macro.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-22 12:40:17 -04:00
Tim Lin
001aa3a351 ITE: drivers/i2c_enhance: CQ mode isn't allowed to enter power policy
I2C CQ mode cannot enter power policy during transfer.

test: tests\driver\i2c\i2c_api--> pass

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-08-22 16:30:45 +00:00
Gerard Marull-Paretas
a202341958 devices: constify device pointers initialized at compile time
Many device pointers are initialized at compile and never changed. This
means that the device pointer can be constified (immutable).

Automated using:

```
perl -i -pe 's/const struct device \*(?!const)(.*)= DEVICE/const struct
device *const $1= DEVICE/g' **/*.c
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-22 17:08:26 +02:00
Gerard Marull-Paretas
5825c8c5ab drivers: i2c: ll_stm32: s/clock/clk
Fix reported compliance issue: WARNING: Violation to rule 21.2 (Should
not used a reserved identifier) - clock

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-22 17:08:26 +02:00
Henrik Brix Andersen
fda3f54002 drivers: can: return -ENETUNREACH from can_send() if in bus off state
Change the error code for can_send() when the CAN controller is in bus off
state from -ENETDOWN to -ENETUNREACH.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-22 14:33:17 +00:00
Andrzej Głąbek
32a87215d7 drivers: pinctrl_nrf: Fix nrf_pin_configure() implementation
This is a follow-up to commit fd07675574.

The above commit was supposed to introduce overriding of the S0S1
drive setting with S0D1 for TWI/TWIM peripherals, but since it did
not properly update the `nrf_pin_configure()` function (the `drive`
parameter was only added in the function signature, but then it was
not used...), the drive setting was in fact not overridden.
This commit corrects this embarrassing oversight.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-08-22 16:17:59 +02:00
Francois Ramu
0f0a3743d2 drivers: adc: stm32U5 channel preselection
The stm32U5 LL function name differs from stm32H7 serie but must
still be enabled in the PCSEL.
This is done with the LL_ADC_SetChannelPreselection function
until the LL changes its name.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-22 10:23:53 +00:00
Francois Ramu
d9b78e0959 drivers: entropy: stm32 rng driver configuration for NIST
The driver is writing the DTS nist-config to the RNG periph.
following the validation sequence described by the RefMan.
It depends on the he RNG IP version and is present on some
mcu devices : all with CONDRST bit.
Depends on the RNG CR Autoreset.
Takes the Health test control Register if property is given.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-22 10:22:20 +00:00
Francois Ramu
2fd6f76301 drivers: entropy: stm32 driver waits for the CondRst reset
For the stm32 mcu with a CONDRST bit in its RNG_CR
for conditioning Soft Reset, the driver must wait for
the bit to be 0 after disabling. This could take
about 2 AHB clock cycles + 2RNG clock cycles.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-22 10:22:20 +00:00
Kumar Gala
5851a7b7de drivers: gpio: xlnx_ps: Fix compiler warning
Recent change to constify struct devices pointers introduced a
compile warning in gpio_xlnx_ps driver.  Update driver to fix a
case that got missed in the constification that fixes the warning.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-20 11:32:37 -05:00
Immo Birnbaum
1738e9e928 drivers: serial: uart_xlnx_ps: switch over to DEVICE_MMIO API
Switch the Xilinx PS UART device driver over to the use of the
DEVICE_MMIO_... macros instead of just using the physical base
address from the device tree.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-08-19 20:41:26 +00:00
Kumar Gala
de894f8aab dts: Replace DT_LABEL(node) with DT_PROP(node, label)
Toward deprecated DT_LABEL() macro, replace the handful of cases
that use DT_LABEL(node) with DT_PROP(node, label).

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-19 06:49:50 -05:00
Jaska Uimonen
108b76eb16 drivers: dai: intel: ssp: add dai index to config
Dai index should be added to config as it can be queried by the
application like sof. Also check for dynamically allocated params
when returning the config.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-08-19 12:09:14 +02:00
Jaska Uimonen
6b8c387246 drivers: dai: intel: dmic: use dai dir enum
Use dai direction enum instead of internal define.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-08-19 12:09:14 +02:00
Jaska Uimonen
7299e1798f drivers: dai: intel: alh: add dai index to config
Dai index should be added to config as it can be queried by the
application like sof.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-08-19 12:09:14 +02:00
Adam Zelik
d0bb17ab37 drivers: timer: Increase default user-allocable channel count to 3
Increase the default user-allocable number of RTC channels to meet
the nrf_802154 driver requirements.

Signed-off-by: Adam Zelik <adam.zelik@nordicsemi.no>
2022-08-19 12:08:59 +02:00
Gerard Marull-Paretas
e0125d04af devices: constify statically initialized device pointers
It is frequent to find variable definitions like this:

```c
static const struct device *dev = DEVICE_DT_GET(...)
```

That is, module level variables that are statically initialized with a
device reference. Such value is, in most cases, never changed meaning
the variable can also be declared as const (immutable). This patch
constifies all such cases.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
f9ab078dd0 drivers: serial: pipe: init device at compile time and check if ready
Initialize UART pipe device at compile time, allowing to constify the
device pointer. Also fix device ready check (was checking for NULL, an
always true condition when using DEVICE_DT_GET).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
9db97fc08f drivers: intc: miwu: remove redundant declarations
Remove redundant definitions by defining at the top before variable is
used. Also constify device array.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
4c575fa37d drivers: intc: ioapic: initialize vtd device at compile time
Initialize the vtd device at compile time. Also removed unnecessary
macro hackery. As a result, vtd pointer can be constified.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
a3b01b00d4 drivers: gpio: npcx: remove redundant declarations
Remove redundant declarations by definining and initializing before
variables are used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
6b1e4baee4 drivers: counter: mcux_qtmr: initialize timer devices at compile time
Initialize timer devices at compile time. This allows to constify the
array of timer devices.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
a0039a8134 drivers: console: initialize uart devices at compile time
A few drivers could initialize chosen UART at compile time, allowing to
constify device pointer.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
82e75f8c3a drivers: clock_control: nrf: initialize temp sensor at compile time
Initialize temperature sensor at compile time, allowing to constify
device pointer.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
9dcd5a78df drivers: bluetooth: hci: initialize uart device at compile time
The UART device can be initialized at compile time, allowing to constify
the device pointer. Also fix return value to -ENODEV if device is not
ready.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Henrik Brix Andersen
590cd5cb72 drivers: can: rename can_state enumerations
Rename the can_state enumerations to contain the word STATE to make their
meaning more clear:
- CAN_ERROR_ACTIVE  => CAN_STATE_ERROR_ACTIVE
- CAN_ERROR_WARNING => CAN_STATE_ERROR_WARNING
- CAN_ERROR_PASSIVE => CAN_STATE_ERROR_PASSIVE
- CAN_BUS_OFF       => CAN_STATE_BUS_OFF

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 21:41:11 +00:00
Henrik Brix Andersen
7e3814b262 drivers: can: expand return values reported by the CAN timing functions
Expand the error return values reported by the CAN timing calculation
functions to be able to distinguish between an an out of range
bitrate/sample point, an unsupported bitrate, and a resulting sample point
outside the guard limit.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 21:39:16 +00:00
Henrik Brix Andersen
2b99b05d0a drivers: can: move bitrate limit checks to arbitration/data functions
Move the check for the maximum allowed CAN bitrate to the corresponding
can_calc_timing()/can_calc_timing_data() function.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 21:39:16 +00:00
Andrzej Głąbek
ec1ae253aa drivers: i2c_tca954x: Fix transfer function
This is a follow-up to commit e1c0a494b3.

The `tca954x_transfer()` function cannot call `i2c_transfer_dt()`,
because the I2C device address used in the transaction must be the one
passed as the `addr` parameter, not the address of the TCA954xA switch
itself. Hence, this commit restores the call to `i2c_transfer()`.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-08-18 15:14:16 -05:00
Tom Burdick
efc0928570 dma/hda: Use the correct register block size for each IP block
Previous versions were using, incorrectly, the host in/out regblock size
of 40 bytes for all peripherals when in fact the link in/out regblock size
is 20 bytes in size.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-18 14:54:57 -05:00
Andrzej Głąbek
ca4d8cf4ab drivers: sensor: mpu9250: Fix initialization routine
Fix a call that writes Register 29 - Accelerometer Configuration 2.
Due to an obvious copy-paste mistake in the code, this register was
written with a DLPF setting from devicetree intended for gyroscope,
not for accelerometer (and the latter was effectively ignored).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-08-18 16:08:23 +02:00
Fabio Baltieri
8c55073d59 gpio: move gpio_cmsdk_ahb.h from drivers to include/drivers
Move gpio_cmsdk_ahb.h out of drivers/gpio and into include/drivers/gpio.
This is used by few board files so it should be in include.

This allows to remove few odd
"zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)".

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:13:14 +00:00
Fabio Baltieri
bf47c2a763 drivers: drop few unused pinmux.h include
Drop few unused include pinmux header from drivers that don't seem to be
using it anymore.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:13:14 +00:00
Fabio Baltieri
681372bb3d board: v2m_beetle: drop CONFIG_PINMUX=y
There's no actual pinmux subsystem driver for v2m_beetle, and
CONFIG_PINMUX is only used as a proxy to build pinmux.c.

Drop the config and change the file to be built unconditionally (same as
mps2_an521 and mps2_an385.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:13:14 +00:00
Benjamin Björnsson
7bd1451a18 drivers: mdio: mdio: Update mdio_shell to use DEVICE_DT_GET
Update mdio_shell to use DEVICE_DT_GET to remove usage of
device_get_binding.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-08-18 11:32:02 +00:00
Jan Kuliga
2ddd221120 bme680: Rework setting the spi_mem_page accordingly to the datasheet
According to the BME680 datasheet, only the spi_mem_page bit can be
changed in its 8-bit register. Therefore we shouldn't just write 0s
to the remaining bits, but update the register content in read-modify-write
fashion instead.
Rework the bme680_set_mem_page(), bme680_init() and register-access
macros.

Signed-off-by: Jan Kuliga <jtkuliga@gmail.com>
2022-08-18 12:44:18 +02:00
Piotr Kmiecik
2ce143a3e5 drivers/counter: return 64-bit value
Extend the API to add the possibility
to return value of 64-bit counter.

Signed-off-by: Piotr Kmiecik <piotrx.kmiecik@intel.com>
2022-08-18 12:42:30 +02:00
Fabio Baltieri
0cba9cb8e9 drivers: sensor: max17055: add VFOCV support
Add support for reading the VFOCV register, which contains the model
estimated open circuit voltage for the cell.

Link: https://pdfserv.maximintegrated.com/en/an/AN6358.pdf
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:39:20 +02:00
Aymeric Aillet
df7ca2a24e drivers/clock/rcar: Move ASSERT to module clock function
ASSERT was failing when `r8a7795_cpg_mssr_start_stop` was
called for a "core" clock.

This ASSERT statement and "mstpcr" table of registers are
only meant to be used when starting or stopping a "module" clock.

Moved ASSERT statement to `rcar_cpg_mstp_clock_endisable`
as well as "reg" & "bit" calculation.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-08-18 12:31:12 +02:00
Kumar Gala
9a7e4b162d pwm: stm32: Remove support for deprecated st,prescaler prop
Remove code that supported deprecated st,prescaler devicetree property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-18 10:20:32 +02:00
Andrei Emeltchenko
054b6d7287 pcie: shell: Replace shell argument with sh
Fix Zephyr coding guidelines warnings.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-08-18 10:19:49 +02:00
Andrei Emeltchenko
3029d2fba8 pcie: shell: Add dump and BDF string arguments
Add argument dump for dumping first 16 PCI configuration space
registers same way lspci -x is doing. Also parse bdf string as
argument. pcie can be called following way:

  uart:~$ pcie 0:1f.4
   ...
  uart:~$ pcie 0:1f.4 dump
   ...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-08-18 10:19:49 +02:00
Henrik Brix Andersen
d1d48e8304 net: socketcan: rename SocketCAN header from socket_can.h to socketcan.h
Rename the SocketCAN header from socket_can.h to socketcan.h to better
match the naming of the functionality.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
Henrik Brix Andersen
2431060116 drivers: can: mcux: flexcan: rename internal funtions to not use zcan
Rename the NXP FlexCAN driver internal functions and macros to not use
"zcan", "zframe", and "zfilter" to avoid confusion after "struct can_frame"
and "struct can_filter" renaming.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
Henrik Brix Andersen
bcd936b3b1 drivers: can: mcp2515: rename internal funtions to not use zcan
Rename the mcp2515 driver internal functions to not use "zcan" to avoid
confusion after "struct can_frame" renaming.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
Henrik Brix Andersen
13c75417ba drivers: can: remove z prefix from public CAN API types
Remove the "z" prefix from the public CAN controller API types as this
makes them appear as internal APIs.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
TOKITA Hiroshi
a7721aa30d drivers: spi: pl022: Support interrupt based transfer
Add interrupt based transfer feature for the PL022 SPI.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-08-18 10:18:16 +02:00
TOKITA Hiroshi
da32e26a3d drivers: spi: Add basic support for PL022
Add fundamental feature support for PL022 SPI peripheral.
This commit implements synchronous transfer with 8bit-MSB format.

Optional functions are not currently implemented yet.

- interrupt based transfer is not implemented yet.
- DMA transfer is not implemented yet.
- Slave mode is not implemented yet.
- Currently support only 8-bit data transfer.

Hardware limitation:

- LSB-first format is not supported by hardware.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-08-18 10:18:16 +02:00
Declan Snyder
84f3a0a8c6 drivers: Fixes MCUX clock assignment
In clock_control_mcux_syscon.c,
add a break statement.

Fixes #48367

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-08-17 17:53:06 -05:00
Daniel DeGrasse
2a53abd511 drivers: soc_flash_mcux: remove dependency on CONFIG_HAS_MCUX_IAP
Remove flash driver dependency on CONFIG_HAS_MCUX_IAP for determining
if the SOC uses an NXP IAP flash controller, and instead use the
devicetree compatible to determine this.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-17 22:02:15 +00:00
Kumar Gala
8160f052d4 drivers: regulator: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-17 09:58:55 -05:00
Brian Dunlay
9f94db1805 drivers: eswifi: fix spi initialization
This change reverts a portion of a prior change that results
in an uninitialized eswifi_spi_data struct to be passed to
the `is_spi_ready` function.
See commit 48c87f2bf8

Signed-off-by: Brian Dunlay <brian.dunlay@gmail.com>
2022-08-17 12:10:02 +02:00
Crist Xu
17089a2e14 drivers: kscan_touch: enable the touch panel for rt1170
Enable the touch panel for the rt1170_evk

Signed-off-by: Crist Xu <crist.xu@nxp.com>
2022-08-17 12:07:44 +02:00
Gerard Marull-Paretas
f3017aa787 drivers: gpio: make gpio_utils.h a self-contained header
gpio_utils.h header relied on other files including its dependencies.
This patch adds all necessary includes to make it self-contained.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-17 08:14:57 +00:00
Kumar Gala
ecd6632f36 drivers: bbram: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-16 18:08:42 -05:00
Yves Vandervennet
6f8ee2cdf7 flash: nxp: removal of deprecated binding nxp,lpc-iap
The binding 'nxp,lpc-iap' is no longer used, which is confirmed
by running:

$ find ${ZEPHYR_BASE}/dts/arm/nxp -type f | egrep -e '\.dts(i)*$' | \
  xargs grep -nH nxp,lpc-iap

Changes in this commit:
 - remove DT_HAS_NXP_LPC... in drivers/flash/Kconfig.mcux
 - remove schema file for nxp,lpc-iap

Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
2022-08-16 13:45:08 -05:00
Yves Vandervennet
da3d0b3492 flash: nxp: updating drivers, Kconfig and device trees with new bindings
The lpc and mcux drivers' DRV_COMPAT is updated for the new bindings
introduced in the previous commit. The drivers' Kconfig files also
reflect this change (DT_HAS_ENABLED_NXP_...).
The SoC device trees are updated with the new bindings

Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
2022-08-16 13:45:08 -05:00
Tim Cooijmans
4c285fc53c drivers: lora: Add support for setting sync-word and iq-inverted
Add support for setting sync-word and iq-inverted in lora_modem_config. By
being able to set the sync-word it's possible to send "raw" public-network
packets using lora_send and using iq-inverted both uplink and downlink
messages can be sent.

Signed-off-by: Tim Cooijmans <timcooijmans@gmail.com>
2022-08-16 18:06:18 +02:00
Felipe Neves
d94dc98fd6 soc: xtensa: esp32_net: fixes include paths
that were changed with zephyr prefix  after rebasing.
Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2022-08-16 18:06:02 +02:00
Felipe Neves
a5379b71f8 drivers: ipm: ipm_esp32: remove hardcoded nodelabels
by making shared memory property  of IPM binding.

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2022-08-16 18:06:02 +02:00
Felipe Neves
4bff7ecab3 drivers: ipm: esp32: added IPM driver
implemented by software for esp32 dual core
variants.

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2022-08-16 18:06:02 +02:00
Maureen Helm
0514c3b139 drivers: sensor: Fix apds9960 device pointer initialization
Fixes a bus fault observed in samples/boards/reel_board/mesh_badge
caused by dereferencing an uninitialized device pointer in the apds9960
sensor driver. The device pointer needs to be initialized regardless of
how CONFIG_APDS9960_TRIGGER is configured.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-08-16 14:11:30 +00:00
Kumar Gala
e5de3ac656 drivers: reset: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-16 09:10:37 -05:00
Pieter De Gendt
e328c2bb7d drivers: memc: Introduce Atmel SAM SMC/EBI driver
Add a driver to support external memory connected to the SMC port
for Atmel SAM devices.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-08-16 12:53:50 +02:00
Andreas Sandberg
a43fd92c4e drivers: ssd16xx: Make SSD1673 registers optional
The SSD16xx driver currently hard-codes a couple of register overrides
that aren't relevant or even correct for many devices. Make them
optional device tree properties instead.

Note that this changes the behavior for panels that expect
SSD16XX_CMD_DUMMY_LINE and SSD16XX_CMD_GATE_LINE_WIDTH to be set by
the driver. This fixes a bug where the incorrect value
was written to all SSD16xx panels except for GDEH0213B1 and GDEH029A1.

The overlay files for devices that need dummy line and gate line width
to be specified have been updated as a part of this commit.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-08-16 11:32:26 +02:00
Andreas Sandberg
532ab8c13d drivers: ssd16xx: Make voltage overrides optional
The OTP in most SSD16xx-based displays normally contain default
VCOM/GDV/SDV values. Make all of these optional in the device tree.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-08-16 11:32:26 +02:00
Andreas Sandberg
aa68ebf1d4 drivers: ssd16xx: Add a helper for uint8 writes
Many register writes only use 8 bits of data. A common pattern in the
driver is to assign a constant to a temporary variable and write that
to the device. Simplify this pattern by adding a helper function that
writes an uint8 to a device.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-08-16 11:32:26 +02:00
Andreas Sandberg
0c343344eb drivers: ssd16xx: Refactor activation
Device activation always follows the same sequence, we first write the
SSD16XX_CMD_UPDATE_CTRL_2 register followed by
SSD16XX_CMD_MASTER_ACTIVATION. Create a helper function that performs
both of these actions.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-08-16 11:32:26 +02:00
Daniel Leung
ca4c2c9b7f console: uart_mux: uart_mux_send to return number of bytes sent
This changes the return value of uart_mux_send() to return
how many bytes sent instead of simply zero for any bytes sent.
This would make it consistent with other UART send commands where
they return number of bytes sent.

Fixes #48470

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-08-16 08:28:03 +00:00
Kumar Gala
210044b788 drivers: peci: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-16 08:26:11 +00:00
Hari Haran Babu
470c447cd7 Revert "drivers: ethernet: w5500: Toggle reset gpio"
This reverts commit 17f8f62789.

Signed-off-by: Hari Haran Babu <hariharan@linumiz.com>
2022-08-15 17:48:57 +00:00
Jordan Yates
2df6ac09de bluetooth: hci: spi: minimum reset duration
Add the option to specify the minimum duration that the `reset-gpios`
pin is held low on boot. This lets devices with additional capacitance
on the reset line still reboot the Bluetooth controller.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-08-15 14:33:01 +02:00
Kumar Gala
d36125654e drivers: ethernet: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using 'select SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-15 14:32:45 +02:00
Kumar Gala
150332be1a drivers: ethernet: remove duplicate CMake entry
Building for dsa_ksz8xxx.c was listed twice.  Remove duplicate.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-15 14:32:45 +02:00
John Kjellberg
6076991fdb drivers/disk: sdmmc: Add DMA support.
This fixes underrun issues when hardware flow control can't be used.

Only tested on STM32F4.

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>

...
2022-08-15 14:31:35 +02:00
Flavio Ceolin
b39d897b09 adsp: gpdma: Move gpdma code to driver
DMA controller ownership can be done in the driver
initialization, it does not need to be part of the SoC. It simplify
the code and remove duplicated definitions.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-08-15 08:21:53 +00:00
Thomas Stranger
a50814dc9d drivers: w1: use select SERIAL in Kconfig for w1-zephyr-serial driver
Use 'select SERIAL', as a serial driver is supported by practically
all boards, and avoids using extra overlays in samples and tests.

The pattern of using select was introduced for SENSORS in df81fef944,
and the only 1-wire I2C sensor was converted in 465b7615a9.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-08-14 09:08:19 -05:00
Kumar Gala
baaf904885 video: Move to using select in Kconfig for I2C bus
Move to using select I2C' instead of 'depends on'
(see commit df81fef944 for more
 details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-14 09:05:36 -05:00
Kumar Gala
b37f393079 drivers: audio: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using 'select I2C'/'select I2S' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-14 09:05:09 -05:00
Kumar Gala
6573f9e195 drivers: syscon: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-14 09:04:33 -05:00
Kumar Gala
01c4e02240 kscan: sdl: Convert driver over to devicetree
Move kscan SDL driver to be based on devicetree.  This is similar to
how the display SDL driver works.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 17:54:03 -05:00
Navin Sankar Velliangiri
9315aef26d drivers: hwinfo: Exclude SYSCON driver on LPC51U68
The hwinfo_mcux_syscon driver isn't relavant for LPC51U68 SoC
series. Add a Kconfig exclusion so the driver isn't available
on LPC51U68 SoC.

Signed-off-by: Navin Sankar Velliangiri <navin@linumiz.com>
2022-08-12 16:15:42 -05:00
Navin Sankar Velliangiri
6ed5653365 drivers: gpio: gpio_mcux_lpc: Allocate no of gpio ISR using macro
Allocate no of gpio ISR using macro INPUTMUX_PINTSEL_COUNT.

Signed-off-by: Navin Sankar Velliangiri <navin@linumiz.com>
2022-08-12 16:15:42 -05:00
Erwan Gouriou
f2b3be172b drivers: timer: lptim: Remove deprecation warning
It appears that some in tree boards still enable lptim w/o configured
domain clocks.
Remove this deprecation message the time a clean up is done fully.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 14:25:51 -05:00
Erwan Gouriou
6b14c4bdb0 drivers: uart: stm32: Enable wakeup source only if supported
LL_USART_EnableInStopMode may not be available on some series.
Since PM is not enabled on those series and might never be, use a
shortcut for this case.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 11:43:48 -05:00
Bo Svangård
93e8d9a16a fix: boards: sam0: uart: fix collision_detect parsing
fix collision detect property from devicetree parsing

Signed-off-by: Bo Svangård <bo.svangard@sylog.se>
2022-08-12 17:40:48 +02:00
Jamie McCrae
9433555f0d drivers: sensor: adxl372: Fix default bus issue
The adxl372 device does not select the correct bus that it is on, which
causes undefined operation (usually a fault). This driver should not be
using Kconfig to determine which bus to use, that should be done by
dts, however this works as a quick fix in the interim until the driver
can be fixed properly.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-08-12 17:39:28 +02:00
Kumar Gala
e438da8a36 adc: Move to using select in Kconfig for I2C & SPI busses
Move to using 'select SPI'/'select I2C' instead of 'depends on'
(see commit df81fef944 for more
 details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 17:39:21 +02:00
Kumar Gala
e4db24b891 drivers: sdhc: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 17:39:15 +02:00
Kumar Gala
45a80d3442 drivers: mipi_dsi: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 10:23:31 -05:00
Kumar Gala
18a1db193d drivers: dac: Update Kconfig for 'select I2C/SPI'
* Move to using 'select I2C/SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 16:18:35 +02:00
Ryan Erickson
3c3a857f79 modem: hl7800 fix runtime log level control
mdm_hl7800_log_filter_set uses LOG_MODULE_NAME which
is undefined.
log_source_id_get() will fail to get the correct source id.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-08-12 16:18:27 +02:00
Kumar Gala
19801debc5 peci: ite_it8xxx2: Move interrupt select to driver Kconfig
The driver really should select PECI_INTERRUPT_DRIVEN instead
of doing it in the SoC Kconfig.defconfig.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 14:16:59 +01:00
Kumar Gala
89f356a0ff peci: ite_it8xxx2: Rename compatiable to match other compatiables
All the of the ITE it8xxx2 devicetree compatiables are of the form
ite,it8xxx2-<DEV>.  However the PECI device was ite,peci-it8xxx2,
rename the compatiable to match the pattern used everywhere else.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 14:16:59 +01:00
Kumar Gala
465b7615a9 drivers: w1: Move to using select in Kconfig for I2C bus
Move to using select I2C' instead of 'depends on'
(see commit df81fef944 for more
 details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 14:15:53 +01:00
Henrik Brix Andersen
c11326300f drivers: can: remove option for configuring CAN-FD max DLC
Remove the Kconfig option for configuring the maximum value of the CAN-FD
Data Length Code in order to ensure standard compliance.

Allowing users to configure the max DLC allows the user to save a number of
bytes per CAN frame in RAM, but it also renders the Zephyr CAN-FD
implementation non-compliant with the CAN-FD standard.

There are no guarantees that a Zephyr CAN-FD node will not receive a CAN
frame with a DLC higher than the Kconfig limit, which opens up for all
sorts of bugs when trying to handle received CAN-FD frames.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-12 14:15:10 +01:00
Henrik Brix Andersen
c3c1bc1ae5 drivers: can: utils: change can_utils_filter_match() return type to bool
Change the return type for can_utils_filter_match() to bool and add
documentation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-12 14:14:52 +01:00
Francois Ramu
cb196fe02b drivers: gpio: stm32F1x serie does not provide the pin get config
The stm32F1x serie does not provide the pin_get_config function,
Even if the CONFIG_GPIO_GET_CONFIG is set, the -ENOSYS error code
is returned by the z_impl_gpio_pin_get_config().

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-12 14:13:37 +01:00
Francois Ramu
99f8579c0b drivers: gpio: stm32 driver uses a structure to hold the pin configuration
Define a pin structure to carry the pin configuration elements
such as push/pull, opendrain, input/output, high/low.
This structure will give the gpio_flags_t to the gpio_stm32_get_config.
Only the stm32F1x serie does not provide the pin config get function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-12 14:13:37 +01:00
Francois Ramu
bb299b1194 drivers: gpio stm32 driver also get the pin state
In the stm32 gpio driver, the gpio_stm32_get_config function
also returns the pin state HIGH or LOW) to match gpio_pin_get_config
This is valid with CONFIG_GPIO_GET_CONFIG.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-12 14:13:37 +01:00
Kumar Gala
78745b2de9 flash: nios2_qspi: Convert driver to be devicetree based
Do simple conversion of driver to have driver enabled by devicetree
in Kconfig and struct device created based on basic devicetree
data.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 08:11:42 -04:00
Kumar Gala
9e9aab3bcf drivers: can: Move to using select in Kconfig for SPI bus
* Move to using 'select SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:34:31 +02:00
Kumar Gala
a96ef8a631 drivers: misc: ft8xx: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using 'select SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:34:21 +02:00
Kumar Gala
d9882ff422 eeprom: Move to using select in Kconfig for I2C & SPI busses
Move to using 'select SPI'/'select I2C' instead of 'depends on'
(see commit df81fef944 for more
 details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:34:16 +02:00
Kumar Gala
f835bc21f5 drivers: pm_cpu_ops: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:34:10 +02:00
Kumar Gala
6124ccfccf drivers: ethernet: provide Kconfig means to disable ethernet drivers
There are several test cases that create fake ethernet devices and
expect the fake device to be the only ethernet device enabled.  Some
tests handle this be explicitly disabling actual ethernet drivers,
but this doesn't scale well.

Change drivers/ethernet/Kconfig to utilze a menuconfig option that
wraps all the drivers.  This allows us for those test cases that
don't want any actual ethernet drivers to disable them with a
simple CONFIG_ETH_DRIVER=n.

Note, the fake ethernet devices utilize CONFIG_ETH_INIT_PRIORITY so
we have it outside of the 'if ETH_DRIVER' block.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:33:43 +02:00
Kumar Gala
616342d58b drivers: ieee802154: Move to using select in Kconfig for SPI bus
* Move to using 'select SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:33:02 +02:00
Erwan Gouriou
e89e4b529e drivers: serial: stm32: Don't block PM if pinctrl sleep state is absent
When dealing with pm action 'suspend', driver applies device pinctrl sleep
state.
Using PM_DEVICE modes should allow to save more current consumption, and
applying pinctrl sleep state is one of the gains, but sleep state not being
available on a device is not a sufficient reason to block PM transition
to lower power mode.
If this pin state is not provided for the device, warn but don't block
pm transition. This will save some time to users setting up this feature
for the first time. Warning will give the opportunity to users to fine
tune their setup in a later step.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 08:51:38 +01:00
Erwan Gouriou
a439c04eb4 drivers: serial: stm32: Implement PM_DEVICE mode support
Implement PM_DEVICE support and treatment of _pm_action hook.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 08:51:38 +01:00
Erwan Gouriou
4422de5692 drivers: serial: stm32: Add wakeup capability support
Add wakeup capability support.
wip comment

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 08:51:38 +01:00
Erwan Gouriou
bbac316be7 drivers: timer: stm32: Use dt to configure LPTIM domain clock
Instead of relying on Kconfig, use dt inputs to configure LPTIM domain
clck (LSI/lSE).
Clock control dedicated APIs are used for configuration and get the
frequency of domain clock in use.
Constants macros used previously to store frequency and time base are
converted to static global variables.

Some code was set up specifically to keep compatibility with targets
that still use Kconfig to configure domain clock. This will be removed
after a deprecation period.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 08:50:29 +01:00
Erwan Gouriou
7f6d3e5336 drivers: timer: stm32: Use dt instance for LPTIM bus clock
Continue conversion of LPTIM driver to device tree based configuration.
Get clock configuration from device tree and use clock_control API for
bus clock configuration

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 08:50:29 +01:00
Erwan Gouriou
f8b1a18271 drivers: timer: stm32: Use dt instance for LPTIM base address /IRQ
Start converting LPTIM driver to device tree based configuration and
support of other instances.
First: get base address and IRQ using dt instance

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 08:50:29 +01:00
Declan Snyder
d556a0c8a6 drivers: entropy: Add entropy driver for MCUX CAAM
Added entropy shim driver for MCUX CAAM and Kconfig symbol

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-08-11 17:14:43 -05:00
Tom Burdick
006d9ffceb i2c: mcux transfer with callbacks
Implements i2c_transfer_cb for the mcux driver

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-11 14:12:13 -04:00
Tom Burdick
a45ece6984 i2c: Adds i2c_transfer_async API for I2C
i2c_transfer_async is the asynchronous version of i2c_transfer where
the completion of the transfer is notified to the caller using a callback.

This can be used in conjuction with the common callbacks and datatypes
in async.h for directly doing an async transfer with an IPC object
to notify a thread.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-11 14:12:13 -04:00
Kumar Gala
db0a8c63fe drivers: led: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using select I2C' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-11 17:46:43 +02:00
Benjamin Bigler
b9c6ca1d43 drivers: clock_control: stm32u5: Fix frequency calculation overflow
STM32u5 pllout frequency calculation overflows. Fix by changing
order of operations

Signed-off-by: Benjamin Bigler <benjamin.bigler@securiton.ch>
2022-08-11 17:46:33 +02:00
Benjamin Bigler
a6a774c9f1 drivers: clock_control: stm32h7: Fix frequency calculation overflow
STM32h7 pllout frequency calculation overflows. In the
worst case pllsrc_freq can be 50Mhz and plln_mul 512 which will cause
an overflow of the intermediate result which leads to wrong frequency
returned. As no intermediate result can be bigger than 960MHz only the
order of operations is changed.

Signed-off-by: Benjamin Bigler <benjamin.bigler@securiton.ch>
2022-08-11 17:46:33 +02:00
Gerson Fernando Budke
9562e3f794 drivers: flash: sam: Fix driver support
The current atmel sam flash driver was develop based on the cortex-m7
version of smart arm microcontroller. The driver support write
protection and cache functions which is not supported by other cortex-m
variants. This fixes current driver implementation and devicetree
entries for all sam variants.

Notes:
 * The cortex-m3 doesn't have support erase pages flash command and
   because of that the driver still not not compatible. Keep it disabled
   until a patch be send. The hwinfo driver is not affected by this
   restriction.
 * The sam4l variation requires a specific driver because uses another
   flash controller (flashcalw). Added another compatible to
   differentiate and keeped node disabled until a driver be available.

Fixes #48516

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-08-11 07:41:09 -05:00
Erwan Gouriou
341844979e drivers: clock_control: stm32: LSE Propagation
When supported, LSE propagation should be enabled

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-11 13:22:58 +01:00
Declan Snyder
462d87c619 drivers: entropy: cleaned up mcux code
cleaned up some code in 3 mcux entropy drivers,
removing unnecessary void casts and function declarations

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-08-11 12:20:12 +02:00
Krzysztof Chruscinski
13ae1c1c9e drivers: serial: nrf: Tweak default values for workaround
Relax a bit default values used for DK serial workaround.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-08-11 12:15:11 +02:00
Wojciech Slenska
aebd68ea41 drivers: counter: stm32u5 family compatibility
In STM32U5X family there is no EXTI line for RTC.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2022-08-11 07:24:27 +01:00
Bryce Wilkins
405ebc0cd0 drivers: spi: Set spi context for mcux flexcomm spi slave configuration
This is a bug fix. A pointer to the spi configuration is not saved when
the spi driver is configured for slave operation and it can lead to
runtime errors.

Signed-off-by: Bryce Wilkins <bryce.wilkins@gmail.com>
2022-08-10 22:01:11 -05:00
TOKITA Hiroshi
a70627a621 drivers: sensor: adxl345: Correct converting counts to sensor value
Sensor value unit is [m/s^2].
Currently calcs as [g/1000] unit.

Correcting calculation to convert [m/s^2].
Store the integer part to val1, and the fractional part to val2.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-08-10 10:54:16 -05:00
Romain Mahoux
4618ad53c7 drivers/apbuart: fix polling mode
Header file generation from device tree was failing in pulling mode.
Restrict the interrupt node usage to interrupt mode only.

Signed-off-by: Romain Mahoux <romain@mahoux.fr>
2022-08-10 16:11:11 +02:00
Francois Ramu
317ce524f8 drivers: clock control: stm32U5 set flash latency before clocks
As mentionned here, setting flash latency before any clock setting,
and especially before the PLL.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-10 14:32:14 +02:00
Francois Ramu
7edcd8d364 drivers: clock control: stm32U5 set regulator voltage before clocks
The regulator voltage should be set before the clocks are enabled.
This is especially the case when the MSIS at 48MHz is selected as
SYSCLK.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-10 14:32:14 +02:00
TOKITA Hiroshi
eca3b1067e dts: riscv: gd32vf103: Use IRQ7 for interrupt of riscv_machine_timer
IRQ7 is placed on the second element of interrupt definition.
Select it by DT_INST_IRQ_BY_IDX() explicitly.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-08-10 13:08:27 +02:00
Stephanos Ioannidis
681eec4cd8 drivers: counter: Fix infinite recursion in alarm cancel function
This commit fixes an infinite recursion in the
`z_vrfy_counter_cancel_channel_alarm` function.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-10 13:07:58 +02:00
Krzysztof Frydryk
8dd57467cc drivers: dai: Enable Zephyr runtime power mgmt in Intel SSP driver
Enable Zephyr device runtime power management mechanisms in Intel SSP
driver. This allows Zephyr to track usage reference for power
domain gating.

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2022-08-10 11:58:45 +02:00
Krzysztof Frydryk
078de4e021 power_domain: Intel ADSP: Add power gating mechanism for Intel ADSP devices
This adds power domain gating mechanisms for Intel ADSP devices.

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2022-08-10 11:58:45 +02:00
Kumar Gala
287043cddb drivers: kscan: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using select I2C' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-09 23:37:46 -05:00
Kumar Gala
f2fa572561 entropy: remove Kconfig.defconfig* setting of entropy drivers
Now that entropy drivers are enabled based on devicetree
we need to remove any cases of them getting enabled by
Kconfig.defconfig* files as this can lead to errors.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-09 23:37:33 -05:00
Henrik Brix Andersen
b5a79fa4ad drivers: watchdog: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
5a61e664b7 drivers: usb: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
e9f4c91a02 drivers: timer: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
d6776fe169 drivers: spi: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
9456eca5c0 drivers: serial: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
78dd25e79e drivers: sensor: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
9c1833b2e8 drivers: sdhc: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
c8a5d058aa drivers: pwm: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
9c626a07d4 drivers: memc: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
59fc838532 drivers: ipm: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
5a7eb0ccfc drivers: intc: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
2e1f25f355 drivers: i2s: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
e84636d010 drivers: i2c: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
9c71615f83 drivers: gpio: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
c1a35b7b39 drivers: flash: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
5ade8908a7 drivers: ethernet: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
88614ecf4f drivers: espi: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
d0e34899a6 drivers: entropy: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
dc0b907f4b drivers: dma: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
31681269c0 drivers: display: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
e7df446f64 drivers: disk: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
d4a2f316cb drivers: dac: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
987ec97663 drivers: crypto: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
e885ead428 drivers: counter: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
035c7d2190 drivers: can: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
68230cb1a7 drivers: adc: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Francois Ramu
0852cf9eee drivers: flash: ospi for stm32 mcu
Fixes command configuration to have samples/drivers/spi_flash
passed on stm32l562 and stm32u585 disco kits.
In OctoSPI STR/DTR and SPI/STR modes

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-09 15:59:18 +01:00
Julien D'Ascenzio
a703cbe9ce drivers: timer: stm32 lptim fix long time interrupt locking
The waiting of the flag ARROK could be quite long (100µs-200µs in my
test). During this time, the interrupts are locked that is not
recommended. To avoid this, we manage the update of the autoreload value
in interruption

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2022-08-09 12:31:28 +02:00
XiNGRZ Chan
7109632046 drivers: spi_esp32_spim: Add support for IOMUX mode
In order to work on a clock speed higher than 20 MHz, IO MUX is required.

Co-authored-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
Signed-off-by: XiNGRZ Chan <hi@xingrz.me>
2022-08-09 12:31:23 +02:00
Erwan Gouriou
ec37ced258 drivers: bluetooth: stm32wb: Cleanup unused definition
This definition is not used anymore, clean it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-09 12:31:16 +02:00
Erwan Gouriou
946304e799 drivers: bluetooth: stm32wb: Put HCI messages under CONFIG_BT_HCI_HOST
HCI message sending in this hci driver as these actions require hci_host
to be available and could be performed by the remote host if required.
Explicit this dependency using CONFIG_BT_HCI_HOST.
This is is required to be able to compile BT_HCI_RAW mode.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-09 12:31:16 +02:00
Erwan Gouriou
41422f99fe drivers: bluetooth: hci: stm32wb: Take advantage of host drivern reset
Don't perform HCI reset in the driver but get the host to perform it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-09 12:31:16 +02:00
Gerard Marull-Paretas
a7c3e7e84a doxygen: remove redundant usages of def
The def command Indicates that a comment block contains documentation
for a #define macro. This is useful if the comment block documents a
macro not adjacent to it, e.g.

```c
/**
 * @def MAX(x,y)
 * @brief Computes the maximum of @a x and @a y.
 */
 #ifdef XXX
 #define MAX(x,y) ...
 #endif
```

However, it is not necessary if the comment is adjacent to the
definition, e.g.

```c
/**
 * @brief Computes the maximum of @a x and @a y.
 */
 #define MAX(x,y) ...
```

This patch removes all unnecessary def entries in-tree.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-09 12:29:28 +02:00
Daniel DeGrasse
d29e34c7c9 drivers: eth_mcux: remove interrupt clearing code
Remove code that clears spurious interrupt flags, as this step is
not required.

Performance change (as tested with iperf on RT1050)
TCP RX: 50.8Mbps->50.6Mbps
TCP TX: 46.2Mbps->49.5Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Daniel DeGrasse
ee4a338bfd drivers: eth_mcux: move intermediate driver buffers into DTCM
move intermediate driver buffers into DTCM, to reduce copy latency

Performance change (as tested with iperf on RT1050)
TCP RX: 48.6Mbps->49.1Mbps
TCP TX: 40.7Mbps->40.8Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Daniel DeGrasse
5dd5fab2b6 drivers: eth_mcux: remove TX thread and allow for multiple TX buffers
remove the TX thread, as this thread can become starved and unable to
reclaim TX buffers from the hardware. Instead reclaim buffers in ISR.
Change eth_tx function to first take from the tx_buf_sem, so that multiple
TX buffer descriptors can be used effectively.

Performance change (as tested with iperf on RT1050)
TCP RX: 44.6Mbps->48.6Mbps
TCP TX: 38.1Mbps->40.7Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Daniel DeGrasse
af62fbc105 drivers: eth_mcux: move dma buffers and buffer descriptors to DTCM
Move dma buffers and buffer descriptors to DTCM, to improve hardware
and software access speed during network TX/RX

Performance change (as tested with iperf on RT1050)
TCP RX: 40.6Mbps->44.6Mbps
TCP TX: 36.8Mbps->38.1Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Daniel DeGrasse
f595279bd7 drivers: eth_mcux allow network buffers to be cached
Do not force network buffers into noncacheable memory, as these buffers
are internal to the driver and not used by the hardware.

Performance change (as tested with iperf on RT1050):
TCP RX: 23.7Mbps->40.6Mbps
TCP TX: 22.3Mbps->36.8Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Attie Grande
51b22060c9 drivers: i2c: sam0: Lock bus before referencing messages
The I2C bus lock did not previously enclose the referencing of the
transfers to conduct. If two attempts are made to use the bus at a
similar time, then one set of messages may have been transferred twice.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-08-09 12:29:13 +02:00
Kumar Gala
63769bd1c1 drivers: display: Remove unnecessary Kconfig settings
Have the display enabled in devicetree will now get the driver
enabled by default when CONFIG_DISPLAY=y is set.  So we can remove
setting driver enabling Kconfig values in various .conf and
defconfig files.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-09 12:27:44 +02:00
Kumar Gala
902f42f491 drivers: display: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using 'select SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-09 12:27:44 +02:00
Bartosz Bilas
e0101e244d drivers: pinctrl: stm32: Kconfig: add missing dependency
Add a missing `PINCTRL_STM32` dependency
for `PINCTRL_STM32_REMAP_INIT_PRIORITY` option to use
that option only when STM32 pinctrl driver is being used.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-08-08 14:17:45 +02:00
Erwan Gouriou
1ef9e9eb9b include: drivers: stm32 clock_control: Replace OPT by DOMAIN
In the continuation of the previous commit, replace _OPT_ by _DOMAIN_
in macros relating to this feature.
hen, adapt drivers and tests to this new wording.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-08 14:17:07 +02:00
Kumar Gala
5a4d1f7ac3 i2c: shell: Remove prefix filtering of device list
The I2C shell would filter the list of devices it knows about to
ones that have a device name that starts with "I2C_".  It was the
case that the majority of I2C bus controller devices happened
to be named with the "I2C_" prefix, however there is no guarantee
that is the case.  With the remove of label properties from the
devicetree this is even more true.

For now remove the prefix filter and just return the full list
of devices.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-08 10:51:51 +02:00
Lucas Tamborrino
ffa1c92131 drivers: sensor: esp32: pcnt driver
Add new pcnt peripheral driver.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-08-08 10:51:41 +02:00
Kumar Gala
df81fef944 drivers: sensor: Convert Kconfig bus 'depends on' to 'select'
This change in pattern is meant to address a misconfiguration issue
that can occur for sensors that support being on multiple busses
like I2C & SPI.

For example, you can have a configuration in which such a sensor is
on the I2C bus in the devicetree and the sensor is enabled.  However
the application configuration enables CONFIG_SPI=y and CONFIG_I2C=n
and this will cause the sensor driver to be built by default, however
since we don't have the I2C bus enabled the driver will not compile
correctly.

Previously we had been adding to board Kconfig.defconfig something
like:

	config I2C
		default y if SENSOR

This pattern doesn't scale well and may differ from what an application
specific need/use is.

So instead move to a pattern in which we leave the default enablement
up to the devicetree "status" property for the sensor.  We then have
the Kconfig move from 'depends on <BUS>' to 'select <BUS>' and in
the case of drivers that support multiple busses we have the Kconfig
be: 'select <BUS> if $(dt_compat_on_bus,$(<DT_COMPAT>),<BUS>) for
each bus type the sensor supports.

This removes the need to add Kconfig logic to each board and enables
the bus subsystem and bus controller driver if the sensor requires
it by default in the build system.

Fixes: #48518

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-08 06:58:18 +01:00
Ayan Kumar Halder
25ed2875a8 serial: uart_pl011: Fix compile error for CONFIG_UART_INTERRUPT_DRIVEN=n
When the uart is configured in non interrupt mode, then the mmio address
should be provided via DEVICE_MMIO_ROM_INIT.

Signed-off-by: Ayan Kumar Halder <ayankuma@amd.com>
2022-08-08 06:57:45 +01:00
Reto Schneider
1c1801ee7f drivers: eeprom: Fix format strings
Building for native_posix_64 exposes faulty format strings.

Changes in this commit also ensure that the shell code gets built in CI,
thus this kind of problem can not be introduced again later on.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2022-08-07 14:29:36 +01:00
Bryce Wilkins
5ff80ef2b1 drivers: spi: Add default char to mcux flexcomm spi driver
Adds optional device tree property to specify a default character
to clock out when the TX buffer pointer is NULL. If the property is
not set the existing behavior (default char of 0x00) is used.

I verified the expected behavior using an i.MX RT685 board and
logic analyzer that the def-char character is transmitted when
TX buffer pointer is NULL.

Signed-off-by: Bryce Wilkins <bryce.wilkins@gmail.com>
2022-08-05 09:28:39 -05:00
Stephanos Ioannidis
4004475e7f drivers: timer: nrf_rtc_timer: Fix assert conditions
This commit fixes the incomplete assert conditions for the `chan`
argument passed to the nRF RTC timer functions.

Note that the `chan` argument for this driver is of a **signed**
integer type, so it is necessary to check that its value is
non-negative.

This fixes the warnings generated by the GCC 12 such as:

  error: array subscript -1 is below array bounds of '...'

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-05 15:15:34 +02:00
Florian Grandel
4f8c952c4a drivers: ieee802154: Make raw mode and l2 mutually exclusive
Activating both, the IEEE 802.15.4 raw mode /and/ the L2 mode is not
possible and in fact leads to a build error.

It should therefore not be possible to activate both options at the same
time. This is achieved by only offering the (rather exotic) raw mode
once the L2-support for the IEEE 802.15.4 has been switched off.

Fixes: #48715

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-08-05 15:04:43 +02:00
Andriy Gelman
af6179d567 drivers: gpio: Add xmc4xxx drivers
Adds gpio drivers for xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-05 13:00:21 +02:00
Gerard Marull-Paretas
a6058dc4b1 drivers: ieee802154: IEEE802154 depends on NETWORKING
Previous to this change, each individual driver option depended on
NETWORKING. Instead, move dependency one level up.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-05 12:56:47 +02:00
Gerard Marull-Paretas
352c9c34ee drivers: ieee802154: depend on DT status and default to y
Make all drivers default to 'y' and dependent on being enabled in DT.
This will allow simplifying many samples/tests.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-05 12:56:47 +02:00
Gerard Marull-Paretas
bbda65a99a drivers: counter: increase COUNTER_INIT_PRIORITY
Some counter devices depend on buses (e.g. I2C for Maxim DS3231). Bus
devices are tipically initialized with KERNEL_INIT_PRIORITY_DEVICE as
well, so there's no guarantee counter will be initialized be initialized
before without manually tweaking priorities.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-05 12:55:51 +02:00
Bartosz Bilas
e7eee79e7e drivers: modem: gsm: adjust logs level
Let's switch to the LOG_DBG for +CREG, +CESQ and +CSQ
AT commands responses because they flood the console so much.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-08-05 11:43:11 +01:00
Jay Vasanth
8014a026d1 drivers: eeprom: MEC172x - Add read/write APIs support
Add functions to support EEPROM read and EEPROM write.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-08-04 18:36:18 +02:00
Jay Vasanth
ccb77af3b7 eeprom: Add Microchip eeprom driver skeleton
Prepare for Microchip eeprom driver addition. Update
dtsi, kconfig, cmake and relevant soc files for eeprom
driver addition.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-08-04 18:36:18 +02:00
Glauber Maroto Ferreira
af5310d500 esp32: drivers: counter: update build references
Updates build references of the Counter API
implementation based on Espressif's General
Purpose Timers to differentiate from the one
based on RTC.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-08-04 15:30:18 +02:00
Pieter De Gendt
114c133fde drivers: sensor: bq274xx: Add interrupt trigger for data ready
Add an optional data ready trigger for the BQ274XX fuel gauge.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-08-04 14:17:55 +02:00
Lucas Tamborrino
b44572aaec drivers: i2c: esp32: fix node identification
This PR fixes the instances indexing in the driver's
initialization macros.

The use of DT_INST macros along with other node identifiers
was preventing the driver from initialize correctly in some
cases.

The driver requires the signal mux number value. Hence the need
to use the SoC's peripheral number information and DT_NODELABEL
macro for node id.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-08-04 13:45:23 +02:00
Yong Cong Sin
b707785411 drivers: modem: gsm: Goto fail state if iface errors after setup
Patches the driver such that if the iface errors after init, the
driver will enter FSM error state.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-04 13:43:45 +02:00
Yong Cong Sin
a0a80c350c drivers: modem: gsm: Make the precedence explicit
Add brackets to make the precedence of if conditions
explicit.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-04 13:43:45 +02:00
Yong Cong Sin
7685301df6 drivers: modem: gsm: If condition should be bool
Compare these variables properly so that the condition in an if
statement will be boolean.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>

Update gsm_ppp.c
2022-08-04 13:43:45 +02:00
Yong Cong Sin
e5fb94e4a0 drivers: modem: gsm: Cast unhandled functions to void
The return value of these functions are not handled,
cast them to void to make that explicit.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-04 13:43:45 +02:00
Yong Cong Sin
4b59ba8fe3 drivers: modem: gsm: Test against NULL
Test these pointer against NULL explicitly

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-04 13:43:45 +02:00
Yong Cong Sin
21bf04c29b drivers: modem: gsm: Rename r to ret
Rename the variable `r` to `ret` for better consistency
with the rest of the driver.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-04 13:43:45 +02:00
Yong Cong Sin
f5d646e204 drivers: modem: gsm: FSM implementation
Introduce FSM implemention for the gsm_ppp driver.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-04 13:43:45 +02:00
Dat Nguyen Duy
eb0428a64a drivers: intc_gicv3: configuring affinity to PE
For Arm Cortex-family processors that only support single
sercurity state, (GICD_CTRL.ARE is set to '1'), so need to
set SPI's affinity for the PE which it is enabled.

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2022-08-04 13:43:29 +02:00
Gerard Marull-Paretas
e6a345f967 drivers: ieee802154: uart_pipe: make driver DT-based
Use Devicetree to describe the UART UPIPE IEEE 802.15.4 driver. This
allows to remove usage of IEEE802154_UPIPE_DRV_NAME in preparation for
the removal of NET_CONFIG_IEEE802154_DEV_NAME.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
d904b5d908 drivers: ieee802154: uart_pipe: split Kconfig
As all other drivers, keep uart_pipe driver Kconfig settings into its
own file.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
1d6862c4e9 drivers: ieee802154: rf2xx: remove unused IEEE802154_RF2XX_DRV_NAME
The option is no longer used (driver is DT-based).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
2df965f490 drivers: ieee802154: nrf5: make driver DT-based
Use Devicetree to describe the radio and IEEE 802.15.4. This allows to
remove usage of IEEE802154_NRF5_DRV_NAME in preparation for the
removal of NET_CONFIG_IEEE802154_DEV_NAME.

All SoC files have been updated with the addition of an ieee802154 node
(disabled and only on those SoCs that define ieee802154-supported. The
peripheral has been enabled in the nRF52840DK board (used for testing
ieee802154).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
7d5272db62 drivers: ieee802154: kw41z: make driver DT-based
Use Devicetree to describe the radio and IEEE 802.15.4. This allows to
remove usage of IEEE802154_KW41Z_DRV_NAME in preparation for the removal
of NET_CONFIG_IEEE802154_DEV_NAME.

KW41Z files have been updated with the addition of radio and an
ieee802154 nodes The peripheral has been enabled in the frdm_k41z board
(used for testing ieee802154).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
dc0728fb2a drivers: ieee802154: cc2520: drop IEEE802154_CC2520_CRYPTO_DRV_NAME
The crypto driver is used internally, so there's no real need to expose
its name as a Kconfig option. Just drop it in favor of a plain string
with the same previous value.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
fb9dbdd60e drivers: ieee802154: cc13x2_cc26x2_subg: make driver DT-based
Use Devicetree to describe the radio and IEEE 802.15.4. This allows to
remove usage of IEEE802154_CC13XX_CC26XX_SUBG_DRV_NAME in preparation
for the removal of NET_CONFIG_IEEE802154_DEV_NAME.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
fa16891625 drivers: ieee802154: cc13x2_cc26x2: make driver DT-based
Use Devicetree to describe the radio and IEEE 802.15.4. This allows to
remove usage of IEEE802154_CC13XX_CC26XX_DRV_NAME in preparation for the
removal of NET_CONFIG_IEEE802154_DEV_NAME. All boards used in testing
have been updated to enable the peripheral in DT as well.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
1ff6577e30 drivers: ieee802154: cc1200: make driver DT-based
Use Devicetree to describe the radio and IEEE 802.15.4. This allows to
remove usage of IEEE802154_CC1200_DRV_NAME in preparation for the removal
of NET_CONFIG_IEEE802154_DEV_NAME.

In this case, the driver already had bindings, however, it was still
using NET_DEVICE_INIT.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Yong Cong Sin
588277c43a drivers: adc: stm32: Disable ADC before setting common path
According to the reference manual, the ADC should not be
converting when setting the common path, we disable the adc
directly in this driver for the sake of simplicity.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-03 18:43:20 +02:00
Yong Cong Sin
36a73d7704 drivers: adc: stm32: Use k_usleep variant
Convert these k_sleep calls to use the k_usleep instead.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-03 18:43:20 +02:00
Yong Cong Sin
d4205f46dd drivers: adc: stm32: remove unnecessary VREFINT path
Remove unnecessary VREFINT path connection during the init.
Internal paths should be setup before reading the channel.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-03 18:43:20 +02:00
Yong Cong Sin
4ae32b1020 drivers: adc: stm32: Move adc_stm32_setup_channels to start_read
Move the `adc_stm32_setup_channels` function to `start_read`
so that we can guarantee that the internel path is connecte
before reading.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-03 18:43:20 +02:00
Gerard Marull-Paretas
149fe06341 drivers: arc/designware: remove unused <soc.h>
The <soc.h> header is not required by a few ARC/Designware drivers, so
remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-03 07:46:14 -04:00
Gerard Marull-Paretas
5f40a9f40f soc: arc: synopsys: move secure timer0 definition to DT
Use Devicetree to describe secure timer0 instead of hardcoding values in
<soc.h>.

DT files have been structured to match the following requirements: In
case of sectimer0 - it's should be only enabled for:

- emsdp_em7d_esp.dts
- em_starterkit_em7d.dts
- nsim_sem_mpu_stack_guard.dts
- nsim_sem.dts

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-03 07:46:14 -04:00
Gerard Marull-Paretas
44250fe3d3 soc: arch: synopsys: move timer0/1 IRQ information to DT
timer0/1 IRQ information was hardcoded in soc.h, however, Devicetree is
nowadays a better place to describe hardware. Note that I have followed
existing upstream Linux code to do these changes.

Ref.
- https://elixir.bootlin.com/linux/latest/source/arch/arc/boot/dts/
  hsdk.dts
- https://elixir.bootlin.com/linux/latest/source/Documentation/
  devicetree/bindings/timer/snps,arc-timer.txt

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-03 07:46:14 -04:00
Nickolas Lapp
3feebd6571 Nordic nRF GPIO: Fixup race condition in GPIO pin Toggle
This PR fixes up a race condition which could cause GPIO writes to be
dropped when one thread was toggling a gpio on a port, and a different
thread was also modifying a (different) gpio on the same port.

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
2022-08-03 12:39:02 +02:00
Tom Burdick
13aae8c61a i2c: NPCX Port use correct device define macro
I2C has its own set of device define macro wrappers to provide
automatic stats tracking when enabled for the device class. This
particular driver happened ot be missed in the transition.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-03 05:05:23 +01:00
Gerard Marull-Paretas
732c00e29a drivers: timer: riscv_machine_timer: fix compatible comment
The andestech,machine-timer comment was incorrectly set to
neorv32-machine-timer.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-03 05:03:50 +01:00
Martin Jäger
c56b1dbca1 drivers: can: stm32: rework filter handling
The previous driver implementation aimed to maximize the amount of
filters, which resulted in a fairly complex implementation.

Background: The bxCAN assigns a number to the filters in the order they
appear in the filter banks. This number is used to match messages in
the FIFO with their filter. If the scale or mode of a filter bank is
changed, all following filter numbers get an offset and the assigned
callbacks have to be shifted accordingly.

The required additional space for the shifting operations resulted in
non-deterministic behaviour and the maximum number of filters could not
be determined at compile-time, which made several tests like
tests/drivers/can/api fail.

This implementation uses a more simple but reliable approach for
filtering and and reserves fixed space for extended and standard ID
filters in the available banks (configurable via Kconfig).
The list mode is not used, which may reduce the total number of usable
filters depending on the application.

The maximum amount of filters is 14 if all filters use ext. IDs,
28 if all use std IDs and something in between if mixed IDs are used.

Also see issue #47986 for more detailed background information.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-08-03 05:02:09 +01:00
Martin Jäger
3524958083 drivers: can: stm32: naming clean-up
Namespace local functions, enums, structs and defines with stm32/STM32
to distinguish them from global CAN API.

Also rename some internal conversion functions to make their meaning
more clear and delete unused defines.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-08-03 05:02:09 +01:00
Bryce Wilkins
b5a95bad3d drivers: hwinfo: Fix mcux device id
This fixes an issue where the unique device identifier is incorrectly
copied from an address on the AHB bus to memory using memcpy.

I verified corrected behavior by comparing `hwinfo devid` command
output to memory view of the SoC using the debugger.

Signed-off-by: Bryce Wilkins <bryce.wilkins@gmail.com>
2022-08-02 13:40:04 -05:00
Fabio Baltieri
24d09d363c include: fix the remaining legacy #include paths
Add the "zephyr/" prefix to various #include statements that are
preventing the CI form running with LEGACY_INCLUDE_PATH=n.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-02 16:41:41 +01:00
Kai Vehmanen
0aa116a914 drivers: dai: intel: reduce log clutter in ssp_trigger
With addition of DAI_TRIGGER_COPY, the trigger callback may
be called at a very high rate.

Reduce the logging level from INF to DBG for the logs in
dai_ssp_trigger().

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-02 07:11:51 -04:00
Christoph Coenen
81694a25ed segger: Resolve circular include dependencies
Zephyr kernel is dependent on trace.
Trace is dependent on segger rtt.
Segger rtt MUST NOT be dependent on zephyr kernel.

Move lock functions from header into c file to avoid circular
dependency. This fix needs an update of the segger repository.

Fixes #43887.

Signed-off-by: Christoph Coenen <ccoenen@baumer.com>
2022-08-02 13:09:21 +02:00
Kumar Gala
3c35faae36 drivers: ethernet: sam_gmac: Convert to using dts for I2C EEPROM
Introduce a simple binding for atmel,24mac402 EEPROM that the SAM
GMAC ethernet driver can utilize to get MAC address out of.  We
introduce a 'mac-eeprom' phandle into GMAC ethernet devicetree
node that will provide a pointer to the MAC eeprom to utilize.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-02 13:02:42 +02:00
TOKITA Hiroshi
3a1d188a9e drivers: dma: Add GD32 DMA driver
Add support for GD32 DMA

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-08-02 09:13:21 +02:00
Kamil Gawor
e6da6e9133 drivers: bluetooth: hci: Add BT_HAS_HCI_VS selection for RPMSG.
Add explicit selection of the BT_HAS_HCI_VS for
the BT_RPMSG HCI driver. When the HCI over RPMSG
is used this dependency will not be solved automatically.
It is required to handle correctly Bluetooth identity
initialization.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2022-08-02 09:13:12 +02:00
Gerard Marull-Paretas
3a19948510 drivers: intc: litex: remove machine timer IRQ usage
This platform does not use RISC-V machine timer, however, the interrupt
controller had references to its IRQ. Remove them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-02 09:12:31 +02:00
Gerard Marull-Paretas
1c41423210 drivers: timer: riscv_machine_timer: obtain registers/IRQ from DT
Obtain machine timer addresses and IRQ from Devicetree. Note that driver
supports multiple compatibles because mtime/mtimecmp registers are
implemented in different ways depending on the vendor. That means
Devicetree representations can be slightly different and so code to
collect the information needs to treat each compatible differently.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-02 09:12:31 +02:00
Fabio Baltieri
21900c4c33 drivers: sensor: max17055: fix TTE and TTF time units
The unit for SENSOR_CHAN_GAUGE_TIME_TO_EMPTY and
SENSOR_CHAN_GAUGE_TIME_TO_FULL are defined in
zephyr/drivers/sensor.h as being in minutes.

Change the max17055 implementation to match the API spec, fix the
annotation for time register units.

Link: https://datasheets.maximintegrated.com/en/ds/MAX17055.pdf
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-01 14:49:59 -05:00
Krzysztof Chruscinski
0f9f18843f drivers: serial: nrfx_uarte: Add workaround for bytes dropping
Add workaround for development kits on which interface chip (segger chip)
is dropping bytes when they are sent in bursts. Issue has been seen on
DK which have multiple virtual com ports on the USB.

A workaround is adding periodic busy waits to introduce gaps in the
transmission.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-08-01 18:06:46 +02:00
David Jablonski
855a489a1c usb_dc_stm32: fix init on soft reset
Soft resetting a STM32 device currently does not reset the USB
connection, which causes a few problems: The endpoints do not respond
anymore, and within zephyr any kind of status information like
CDC_SET_CONTROL_LINE_STATE is also missing as they are not
re-negotiated.

This is fixed by stopping the USB device from zephyr side, right after
initialising the USB device.

Signed-off-by: David Jablonski <dayjaby@gmail.com>
2022-08-01 18:03:42 +02:00
Pieter De Gendt
bef0010e69 drivers: memc: mcux_flexspi: Always try to apply pinctrl state
This commit fixes an issue introduced in 5ee9392 where FlexSPI
pinctrl states where applied based on the SoC type.
However multiple FlexSPI instances can be active, some of which
are not pre-configured from ROM.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-08-01 18:03:10 +02:00
Kumar Gala
84575930f5 i2c: Remove unncessary HAS_I2C_DW Kconfig symbol
The HAS_I2C_DW was to limit Kconfig visibility to only platforms
that utilize the I2C DW IP.  The Kconfig for I2C_DW depends on
DT_HAS_SNPS_DESIGNWARE_I2C_ENABLED which will cause the same
visbility limitation to only platforms that have I2C DW devicetree
nodes.  Thus we can remove HAS_I2C_DW and its references.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-01 18:01:44 +02:00
Caspar Friedrich
ddb1971fe3 drivers: w1: Add driver for Maxim DS2484 Single-Channel 1-Wire Master
This adds a driver for Maxims DS2484 Single-Channel 1-Wire master
driver. The DS2484 features an extra pin to enable sleep modes which
is available if the pin is configured in the device tree.

Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
2022-08-01 10:33:10 +02:00
TOKITA Hiroshi
49522c061f drivers: spi: gd32: support interrupt-driven mode
Add supporting interrupt-based asynchronous operation for GD32 SPI.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-08-01 10:32:33 +02:00
Krzysztof Frydryk
6254274420 ssp: Use sampling rate from config
Use sampling rate passed in config instead of a default one when using
config blob.

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2022-08-01 10:31:42 +02:00
Conor Paxton
aba67c3329 drivers: gpio: add Microchip PolarFire SoC GPIO driver
This patch adds driver support for Microchip PolarFire
SoC GPIO.

Signed-off-by: Conor Paxton <conor.paxton@microchip.com>
2022-08-01 10:29:21 +02:00
Jay Vasanth
3e0f738cb2 mec15xx: pinctrl for both mec15xx and mec17xx
Changes to compile pinctrl driver for both mec15xx
and mec17xx. Also add mec15xx pinctrl dtsi

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-08-01 10:28:23 +02:00
Henrik Brix Andersen
aeb9fd68e7 drivers: can: add ESP32 TWAI CAN controller driver
Add ESP32 TWAI CAN controller driver. The TWAI is register-compatible with
the NXP SJA1000 CAN controller.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-07-30 17:32:04 +01:00
Henrik Brix Andersen
491e831436 drivers: can: add NXP SJA1000 common driver backend
Add a common driver backend for NXP SJA1000 compatible CAN controllers.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-07-30 17:32:04 +01:00
Kumar Gala
a529c4511d drivers: flash: Update drivers to use devicetree Kconfig symbol
Update flash drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-30 08:27:13 -05:00
Erwan Gouriou
8325752e27 drivers: clock_control: stm32u5: Get MSIS freq from SoC registers
MSIS frequency at boot time can be different from the one we intent to
set from device tree configuration.
In order to avoid issues, read MSIS configuration from registers to get
the actual freq rather than the devicetree one which may be not yet
configured (which is the case at startup).

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-07-30 08:23:35 -05:00
Erwan Gouriou
eb52d8dca2 drivers: clock_control: stm32u5: Switch to HSI only when needed
When configuring PLL, we should first make sure we're not running on PLL,
and if running on PLL, first switch to a fixed clock before proceeding
with PLL configuration.
Current code is doing the switch systematically which is not useful as
default startup case is to use MSI as sysclk source.
So add a test before doing this switch.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-07-30 08:23:35 -05:00
Erwan Gouriou
98e6789cd9 drivers: clock_control: stm32u5: Update condition on PLL1R values
Unlike stated in 57df225b396e43358aac4cc998ed2e99fdb57780, RM0456.pdf
reference manual mentions about PLL1R that "Only division by 1 and even
division factors are allowed."
Though, in reference manual, there is one issue on PLL1R values
description, which should actually be:
0000000: pll1_r_ck = vco1_ck
0000001: pll1_r_ck = vco1_ck / 2 (default after reset)
0000010: Not allowed
0000011: pll1_r_ck = vco1_ck / 4
...
This description will be fixed.

Reflect this in binding and driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-07-30 08:23:35 -05:00
Kumar Gala
0779a932f4 drivers: w1: Update drivers to use devicetree Kconfig symbol
Update w1 drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-29 14:25:27 +02:00
Martin Jäger
c40ec11ab4 drivers: dac: update drivers to use devicetree Kconfig symbol
Update dac drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-29 14:11:18 +02:00
Sylvio Alves
4120601a6c soc: esp32: allow wifi and net stack into spiram
This PR adds a KConfig option that allows moving
all .noinit content related to wifi a net stack into external
ram. This free dram space to application.

Linker script files are also modified so that the content
are mapped into external ram.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-07-29 14:11:00 +02:00
Jun Lin
ec4f700202 driver: PECI: npcx: add driver support for Nuvoton npcx family
This commit add the PECI driver for Nuvoton npcx family to support PECI
APIs.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-07-29 14:09:17 +02:00
Kumar Gala
dc3e86e7dc drivers: i2c: Update drivers to use devicetree Kconfig symbol
Update i2c drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-28 16:12:43 -05:00
Jun Lin
ed12786ee0 driver: clock_control: npcx: fix the power down of eSPI module
This power down bit of eSPI module is loacted in the bit 7 of PWDWN_CTL6
register rather than the bit 4. This commit fixs the incorrect setting.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-07-28 19:54:34 +01:00
Andrzej Głąbek
e99b323aa2 drivers: pwm_nrfx: Improve tracking of PWM peripheral usage
This is a follow-up to commit 63d6cfd654.

Use a bit mask to store information about channels that need to be
driven by the PWM peripheral instead of inspecting the `seq_values`
array each time.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-07-28 20:52:41 +02:00
Gerard Marull-Paretas
3dd0904ea6 drivers: ieee802154: cmake: remove TI compile definitions
Compile definitions are now injected by the HAL automatically.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-28 20:51:55 +02:00
Gerard Marull-Paretas
307415664d soc: riscv: sifive-freedom: remove unused pinmux definitions
These definitions are now part of the pinctrl DT headers, remove them
from soc.h

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-28 20:50:57 +02:00
Kumar Gala
fbc0289733 drivers: bluetooth: hci: spi: Replace DT_INST_LABEL
As we phase out label properties from devicetree the devicetree
node may not have a label so utilize DEVICE_DT_NAME instead
which will use a label if it exists and the node name if not.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-28 20:50:38 +02:00
Anas Nashif
728d8eb2c0 intel_adsp: rename clock registers due to possible conflict
SOF using the same defines and in some cases generating conflicts.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-28 14:11:23 -04:00
Dylan Hung
b374bd0a5d drivers: clock_control: add Aspeed AST10x0 clock control
AST10x0 series SOCs provide the clock controller through the syscon
hardware block.  The current driver supports the clock gating capability
for the hardware IPs embedded in the SOC.  Each clock source has a
clock ID that can simply map to a bit in syscon registers CLK_STOP_CTRL0
(group 0) or CLK_STOP_CTRL1 (group 1).  There are some clock sources
that don't have associated clock gating control, which are always on,
are grouped to into group 2.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
2022-07-28 08:30:27 +02:00
Andrzej Głąbek
d5222f318d drivers: pwm_nrfx: Fix PWM_NRFX_CH_VALUE() macro
This is a follow-up to commit 63d6cfd654.

Revert unwanted PWM_NRFX_CH_POLARITY_MASK to PWM_NRFX_CH_COMPARE_MASK
replacement that was accidentally done in the above commit.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-07-27 17:03:38 +00:00
Francois Ramu
b165f10795 drivers: flash: octospi drivers for stm32h7 serie
With the introduction of the OSPI NOR flash controller
the stm32H7 serie requires the HAL MDMA in anycase.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-27 18:46:25 +02:00
Andreas Sandberg
61306aedb4 drivers: ssd16xx: Add an API to read raw RAM contents
Add the ssd16xx_read_ram() function that can be used to read the raw
contents of the two display RAM in the controller. This function is
similar to display_read(), but lets the caller specify the RAM to
operate on. The intention is that this can be used to read out the
contents of the old frame buffer after a partial refresh that
automatically swaps the black/red buffers.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:47 +02:00
Andreas Sandberg
8312db7734 drivers: ssd16xx: Implement basic read support
Read operations only work on SPI controllers that support half
duplex. To enable read operations, set the device mode to half duplex
by adding the following to the device's DTB node:

  duplex = <SPI_HALF_DUPLEX>;

If read requests will fail with -ENOTSUP if the device isn't in half
duplex mode.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:47 +02:00
Andreas Sandberg
25cff5edc3 drivers: uc81xx: Avoid using auto sequencing
The UC8179 supports automatic power management where the DC-DC is
enabled automatically. This is not supported on the UC8176. Explicitly
call PON/DRF/POF from uc81xx_update_display instead. This ensures that
the DC-DC is only enabled while actually updating the display for all
supported chips.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:02 +02:00
Andreas Sandberg
f4a6c75087 drivers: uc81xx: Fix incorrect UC8176 CDI layout
The CDI register in UC8176 and UC8179 have different layouts. Add a
helper function to the quirks structure to handle CDI updates.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:02 +02:00
Andreas Sandberg
f6bbbc3c7d drivers: uc81xx: Use device-specific compatibles
The UC8176 and UC8179 chips that exist in tree have subtly different
register layouts. Use separate compatible strings for these chips and
a quirks structure that describe device-specific behavior.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:02 +02:00
Andreas Sandberg
8f0093aaf8 drivers: Rename GD7965 to UC81xx
The GD7965 driver is really just a vendor name for the UltraChip
UC8179. Rename the driver to UC81xx since there are other chips in the
family (e.g., the UC8176) with an almost identical register interface.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:02 +02:00
Thomas Stranger
0d7abdf012 drivers/clock_control: stm32 common fix STM32_SRC_PLLCLK calculation
Some Series were calculating the pll output frequency from an
clock source index instead of the clock source frequency.

This commit resolves this issue for l0, l1.

get_pllout_frequency() is only used for PLLCLK, therefore remove it.
F2, F4, and F7 have several pll dividers and might decide to implement
these as clock sources won't need PLLCLK.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-27 18:44:49 +02:00
Glauber Maroto Ferreira
dbbfcfc22d esp32: driver: counter: add RTC-based implementation
add RTC-based implementation of the counter driver.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-07-27 09:48:33 +02:00
Kumar Gala
47bb8c14dc drivers: clock_control: Update drivers to use devicetree Kconfig symbol
Update clock_control drivers to use DT_HAS_<compat>_ENABLED Kconfig
symbol to expose the driver and enable it by default based on
devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-27 09:47:16 +02:00
Kumar Gala
83a2b590fe drivers: clock_control: nxp: Fix building MCG on KW40Z/KW41Z
The KW40Z/KW41Z don't have a Fixed Freq MCG clock so the code
associated with that in get_rate fails to build.  ifdef around
the code with enum kCLOCK_McgFixedFreqClk so things work
correctly.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-27 09:47:16 +02:00
Kumar Gala
8b101e236d drivers: clock_control: Remove old ESP32C3 code
The ESP32 clock control for ESP32C3 was unified into a single
driver a while back.  However the files associated with the
ESP32C3 didn't get removed than.  Remove them now.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-27 09:47:16 +02:00
Simon Hein
d0921018fc drivers: Fix coding guidelines MISRAC:2012 Rule 14.4 do-whiles/Zero checks
MISRA C:2012 Rule 14.4 (The controlling expression of an if statement
and the controlling expression of an iteration-statement shall have
essentially Boolean type.)

Use `do { ... } while (false)' instead of `do { ... } while (0)'.
Use comparisons with zero instead of implicitly testing integers.

The commit is a subset of the original auditable-branch commit:
5d02614e34a86b549c7707d3d9f0984bc3a5f22a

Signed-off-by: Simon Hein <SHein@baumer.com>
2022-07-26 15:30:24 -04:00
Kumar Gala
35d93ef7bc drivers: i2c: esp32: Rework SDA/SDL pins as gpios in devicetree
For the !SOC_I2C_SUPPORT_HW_CLR_BUS in which we implement bus
reset via GPIOs, change the devicetree properties to be actual
gpio properties and update the code to reflect this.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-26 12:10:58 -05:00
Thomas Stranger
1dd76ac08c drivers/clock_control: stm32u5: typo hsi, hse clock source
A typo prevented the usage of hsi and hse as direct clock source.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-26 07:40:42 -05:00
Andrzej Głąbek
63d6cfd654 drivers: pwm_nrfx: Refactor pwm_set_cycles to fix on/off issues
This commits refactors implementation of the pwm_set_cycles function
to fix the following issues:
- when a channel was already set with a non-zero pulse width, setting
  cycles for another one required specifying a matching period value,
  even if that value was to be ignored anyway when the channel was to
  be set to constant inactive or active level; due to this limitation,
  it was not possible to e.g. use the LED driver API and turn off a LED
  while another one (within the same PWM instance) was blinking
- the above limitation also applied when a channel was set with a pulse
  width equal to period (duty 100%); even though such channel was not
  in fact using the PWM peripheral, other channels within the same PWM
  instance were forced to use the same period
- after a PWM generation was started for a channel, it was not possible
  to change its pulse width before two PWM periods passed (while it
  should be possible to change it after every period); this was caused
  by a looping mechanism that was unnecessarily activated in the PWM
  peripheral

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-07-26 11:11:13 +00:00
Kumar Gala
737b1fa25a drivers: gpio: sam: Fix Kconfig default for SAM4L
In update the Kconfig to depend on devicetree, the SAM4L
driver was missing a 'default y'.

Also remove unnecessary 'depends on GPIO'.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-26 08:49:38 +02:00
Benjamin Björnsson
506cff9a27 drivers: console: ipm_console: Update driver to use DEVICE_DT_GET
Update driver to use DEVICE_DT_GET to remove usage of device_get_binding.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-26 08:49:20 +02:00
Thomas Stranger
b2b67258f9 drivers/clock_control: stm32u5 add pll2, pll3 support(setup/clk-src)
This commit adds required code to setup pll2 and pll3 as defined
in dts. Also these plls can now be used as alternate clock sources.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-25 15:57:12 -07:00
Thomas Stranger
8ae3f0bfd5 dts/bindigns/clock: allow stm32u5 DIVQ & DIVR PLL divider values to be 1
This commit changes the range for stm32u5 pll divider values
to allow divider value of 1.
- DIVQ is allowed to beconfigured 1 for all PLL instances
- DIVR can be 1 for PLL2 and PLL3, but is not valid for PLl1.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-25 15:57:12 -07:00
Francois Ramu
7f894f781b drivers: dma: stm32 dma channel with the busy flag
This commit controls the stream busy flag of the dma channnel
Set as true : stream is busy each time the channel is
started or reloaded.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-25 21:02:13 +00:00
Francois Ramu
5412c2126d drivers: dma stm32 keep the channel busy if overriden
When the channel is overriden by the HAL,
the dma irq must always be handled (even if not busy).
Only when the dma channel is not overriden by the HAL
the irq is exiting when the channel is no more busy.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-25 21:02:13 +00:00
Anas Nashif
43371d0414 intel_adsp: move cavs to be a series
Intel ADSP CAVS is now a proper series with all CAVS SoCs running under
it. This will give us to Intel ADSP series:
- CAVS
- ACE v1.x

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-25 16:50:24 -04:00
Anas Nashif
e33bb9b6c5 drivers: dmic: remove old intel dmic driver
We now have another intel dmic driver under DAI.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-25 13:14:49 -04:00
Jan Kuliga
a10e5547df serial: uart_pipe: Get rid of redundant check in uart_pipe_isr().
The uart_pipe_isr() double-checks whether rx interrupt occured by
calling uart_irq_is_pending() first. Get rid of that function call since
it is redundant (i.e. nothing more is done or checked inside that
conditional).

Signed-off-by: Jan Kuliga <jtkuliga@gmail.com>
2022-07-25 13:02:22 -04:00
Aurelien Jarno
808603f47c drivers: adc: stm32: wait for internal channels stabilization
The VREFINT and TEMPSENSOR internal channels have a stabilization time
after they are enabled. Right now this just causes the first measure to
be a bit off, however with PR #47691 which stops the internal channels
after each readout, this is something important to respect. Fortunately
the stabilization time is available as constants in the HAL, so just
wait the time specified by the constants.

Note that the VBAT internal channel does not have any stabilization
time.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-25 15:17:35 +02:00
Kumar Gala
ce2635f410 drivers: virt: ivshmem: Convert to use DEVICE_DT_GET_ONE
Replace Kconfig (IVSHMEM_DEV_NAME) based named device_get_binding
with DEVICE_DT_GET_ONE.  Since there is only one driver for ivshmem
use the qemu,ivshmem for that.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-25 15:16:05 +02:00
David Leach
88ba2fe3a9 drivers: lpuart: clear noise status flag on errors
The LPUART driver activates the "noise" error interrupt but
neglects to clear the error bit when the interrupt occurs. This
causes the device to freeze. Clear the "noise" status to avoid
the lockup and track instances of this as a UART_ERROR_PARITY.

fixes #47568

Signed-off-by: David Leach <david.leach@nxp.com>
2022-07-25 15:14:43 +02:00
HaiLong Yang
efa0973473 drivers: i2c: improve gd32 i2c driver stability
This split the repeated START condition to STOP + START conditions.

The old implement may cause undefined behavior for gd32 i2c, like
enter STOP condition accidentally.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2022-07-25 15:14:21 +02:00
Kumar Gala
b2dacedbe8 drivers: memc: Update drivers to use devicetree Kconfig symbol
Update memc drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-25 15:14:08 +02:00
Tobias BA
2c183f269b drivers: crypto_stm32: include soc.h in driver
include soc.h in crypto driver for stm32 for fixing
build errors when enabling cryp/AES nodes in devicetree

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/47379
Signed-off-by: Tobias BA <ext-tba@trackunit.com>
2022-07-25 11:05:15 +00:00
Kumar Gala
0fa7907f3e drivers: pinctrl: Update drivers to use devicetree Kconfig symbol
Update pinctrl drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-25 05:46:42 -05:00
Maximilian Deubel
d8e0dd1804 ADXL372: add names for KConfig choices
This patch adds names to the KConfig choices of the ADXL372 driver.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2022-07-25 09:33:54 +00:00
Fabio Baltieri
c370c0299b drivers: gpio: nrfx: ensure ch variable stays allocated during use
Inside gpio_nrfx_pin_interrupt_configure, the "ch" variable is allocated
inside the "if", but then it gets dereferenced and the pointer saved in
trigger_config, which is used in the outer context.

This works fine right now, but that memory location could possibly be
reused by another automatic variable if the code gets changed.

Moving it in the function context to avoid any potential problem.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-07-25 09:40:22 +02:00
Kumar Gala
2245bf89b7 drivers: entropy: Update drivers to use devicetree Kconfig symbol
Update entropy drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-25 09:39:10 +02:00
Kumar Gala
0f1ed0f4a0 drivers: counter: Update drivers to use devicetree Kconfig symbol
Update counter drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-25 09:38:57 +02:00
Alex Sergeev
269f664a98 drivers: i2c: gd32: Use correct FAST speed
Fixed bug where configured FAST speed causes FAST_PLUS speed to be applied.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2022-07-25 09:38:41 +02:00
Kumar Gala
0be3a7604b drivers: spi: Update drivers to use devicetree Kconfig symbol
Update spi drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-25 09:38:30 +02:00
Kumar Gala
957e263120 drivers: gpio: Update drivers to use devicetree Kconfig symbol
Update gpio drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-23 09:26:09 -05:00
Kumar Gala
5eca3922d5 drivers: regulator_pmic: Fix compile issue
The regulator-pmic node is a child of the I2C device.  When this
was converted to i2c_dt_spec that was missed.

Also fixed a few minor formatting issues.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-23 09:23:37 -05:00
Kumar Gala
bdff3e76e5 drivers: watchdog: Update drivers to use devicetree Kconfig symbol
Update watchdog drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-22 14:06:00 +00:00
Kumar Gala
3aa0a174b8 drivers: serial: nrfx: Update drivers to use devicetree Kconfig symbol
Update serial drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-22 07:51:44 -05:00
Kumar Gala
d734f273ba drivers: adc: Update drivers to use devicetree Kconfig symbol
Update adc drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-22 07:51:24 -05:00
Kumar Gala
885087b328 drivers: pwm: Update drivers to use devicetree Kconfig symbol
Update pwm drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-22 07:50:44 -05:00
Mulin Chao
9267655f42 driver: gpio: npcx: Support GPIO_VOLTAGE_1P8 flag
This CL configures low-voltage (1.8V) detection via GPIO driver with
GPIO_VOLTAGE_1P8 flag. It also adds support for this flag in
pin_get_config() function.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-07-22 10:33:03 +02:00
Mulin Chao
a5fee4c6de driver: scfg: npcx: cleanup low-voltage detection configuration
Cleanup npcx low-voltage (1.8V) detection configuration. It removes
unused soc utilities, macros, and DT node. We will configure this
feature by GPIO driver with GPIO_VOLTAGE_1P8 flag later.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-07-22 10:33:03 +02:00
Kumar Gala
f0441fba58 drivers: sensor: Update drivers to use devicetree Kconfig symbol
Update sensor drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-22 02:20:18 -05:00
Anas Nashif
2af59e7d44 intel_adsp: unify timer registers and simplify timer driver
Declare clock control in the shim header per SoC and remove ifdeffry
from the driver simplifiying it and making it ready for the next
platform.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-21 17:55:41 -04:00
Anas Nashif
af3d5331a1 intel-adsp: migrate cavs-mem.h to adsp_memory.h
Move header and make it soc specific.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-21 17:55:41 -04:00
Anas Nashif
423264b96b intel_adsp: make shim header soc specific
using once single header to support multiple socs and product
generations is error prone and not easily maintained.

Over time we have been adding conditional code in headers and extending
structs  to support new HW features which becomes a problem.

Goal is to keep platform headers in sync with hardware specification and
allow of introduction of new platforms and hardware features by just
introducing a new SoC with its own set of headers.

This is now just a copy of existing cavs-shim.h with slight changes,
goal is to clean this up long term and sync with hardware datasheets and
align on naming as well.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-21 17:55:41 -04:00
Kumar Gala
2d88414c4e drivers: serial: pl011: Remove unused Kconfig symbols
The driver has be DT_INST based for a while so the Kconfig
symbols CONFIG_UART_PL011_PORT0<n> aren't used.  So lets
remove them.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-21 16:40:28 +00:00
Kumar Gala
894e8814af drivers: serial: rv32m1_lpuart: Remove unused Kconfig symbols
The driver has be DT_INST based for a while so the Kconfig
symbols CONFIG_UART_RV32M1_LPUART_<n> aren't used.  So lets
remove them.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-21 16:40:28 +00:00
Benjamin Björnsson
45adae9118 drivers: gpio: gpio_fxl6408: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-21 06:07:02 -05:00
Henrik Brix Andersen
bda6455234 drivers: eeprom: Update drivers to use devicetree Kconfig symbol
Update EEPROM drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-21 06:03:04 -05:00
Henrik Brix Andersen
8746b2cb33 drivers: can: Update drivers to use devicetree Kconfig symbol
Update CAN drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol to expose
the driver and enable it by default based on devicetree.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-21 06:02:28 -05:00
Jaroslaw Stelter
fe5ed68356 soc: ace_v1x: check physical memory bounds on page unmap.
This patch fix issue with unmapping of virtual addresses mapped
to non-existing physical memory. MTL TLB table is initialised with
1:1 mapping, however virtual space is much wider than available
physical space. We should not try to free and manage of power for
non-existing physical pages.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-07-21 05:32:03 -04:00
Kumar Gala
7d5215ff19 drivers: serial: Update drivers to use devicetree Kconfig symbol
Update serial drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-21 10:29:06 +02:00
Ryan Erickson
3d7f267d4a modem: hl7800: Fix TCP server closed interrupting TX/RX
If TCP server closed notification is received it
could interrupt the TCP socket RX or TX data sequence.
Remove the SOCK_SERVER_CLOSED state and instead
use a unique error code to know if the socket
has been closed by the server.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-07-21 10:28:38 +02:00
Anas Nashif
554eb03cb9 kconfig: guard usbc logging macros
Logging kconfig options should only appear when this driver is being
used.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-20 18:28:43 +02:00
Anas Nashif
3133666c9a kconfig: guard grove lcd logging macros
Logging kconfig options for this lcd should appear when the hardware is
enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-20 18:28:43 +02:00
Daniel DeGrasse
cb3d1313e5 drivers: lpuart: prevent spurious transmission complete interrupts
Correct issue where transmission complete interrupt was not disabled when
using interrupt driven serial API with power management enabled,
resulting in continuous spurious interrupts that effectively locked
the system.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-07-20 09:29:38 -05:00
Pieter De Gendt
d01934f9e9 drivers: sensor: bq274xx: convert lazy load Kconfig option to dts property
This change allows per-instance configuration of lazy loading and
fixes build issue.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-20 08:39:45 -05:00
Tim Lin
d7ccea6357 ITE: drivers/i2c: Add command queue mode not allowed condition
If the transaction of write or read is divided into two transfers
(not two messages), the command queue mode does not support.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-07-20 11:08:56 +02:00
Benjamin Björnsson
f195b910b2 drivers: gpio: gpio_pcal6408a: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-19 22:53:37 +00:00
Kumar Gala
8fb2210cfb emul: remove name param from bus register APIs
Rework the <BUS>_emul_register calls to not pass the name param.  The
name param is only used for logging and we can get it from the
struct <BUS>_emul instead.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 15:52:36 -05:00
Gerard Marull-Paretas
20177daa0f drivers: spi: nrfx_spi(m|s): add common init function
Having a per-instance init function makes code cluttered and hard to
read. Just create a per-instance IRQ connect function (required to
resolve IRQ_CONNECT parameters at compile time).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
a8b444f956 drivers: spi: nrfx_spi(m|s): s/_DEVICE/_DEFINE
Use SPI_NRFX_SPI(M|S)_DEFINE, since the macro _defines_ a device.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
7d42a8ff18 drivers: spi: nrfx_spim: remove unused definitions
SPIM_NRFX_MISO_PULL_DOWN and SPIM_NRFX_MISO_PULL_UP were not used,
delete them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
e5ba80733a drivers: spi: nrfx_spi(m|s): drop NRFX_SPI(S|M)_INSTANCE usage
Stop using NRFX_SPI(S|M)_INSTANCE helper so that peripheral address from
Devicetree is used. We should not rely on HAL for hardware description
but Devicetree.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
2cfb5012db drivers: spi: nrfx_spim: move rx delay to DT
Move the RX (MISO) delaying capability information to Devicetree. It is
done using 2 properties:

- rx-delay-supported: enabled on SPI nodes that support delaying RX.
  This property can be used by the driver to determine if this
  capability is supported or not on a given instance.
- rx-delay: the actual RX delay value

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
ee8d8b3c6e drivers: spi: nrfx_spis: max buffer length is SoC specific
The maximum transfer buffer length is SoC specific, not instance
specific. This patch defines MAX_BUF_LEN at driver level in a SoC
specific manner instead of using HAL values that are instance specific
but that always take the same value depending on the SoC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
72cc583dc9 drivers: spi: nrfx_spim: max chunk length is SoC specific
The maximum transfer chunk length is SoC specific, not instance
specific. This patch defines MAX_CHUNK_LEN at driver level in a SoC
specific manner instead of using HAL values that are instance specific
but that always take the same value depending on the SoC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
3c6649f631 drivers: spi: spi_nrfx_spi(m|s): move ORC to DT
Specify the overrun character in Devicetree. Since 0xFF is the most
common value, DT property contains such default.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
4ad3a96059 drivers: spi: nrfx_spim: move maximum frequency parameter to DT
Devicetree is the natural place to describe hardware, so move the
maximum frequency the SPI can work with to Devicetree instead of relying
on values from HAL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
717f81795b drivers: spi: nrfx_spim: use DT_IRQN
Driver was not using Devicetree to obtain the SPIM IRQ number.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Andreas Sandberg
fa6fe0274c drivers: gd7965: Use packed structs where appropriate
There are a few registers that map nicely onto structs. Switch from
using index constants and byte arrays in those cases.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Andreas Sandberg
544c0b22dd drivers: gd7965: Make tcon/cdi/pwr/softstart optional
Some panels using this driver don't provide tcon/cdi/pwr/softstart
values in their reference code. It is normally expected that the right
values will be loaded from OTP in such cases. Make these values
optional to support such panels.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Andreas Sandberg
dc860cd6aa drivers: gd7965: Make it possible to use multiple instances
Add instance-specific data and config structs, and remove all other
global variables.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Andreas Sandberg
376973423f drivers: gd7965: Remove the need to use heap memory
The GD7965 driver uses malloc to allocate a single line buffer when
clearing the display. This buffer is used to clear the display line by
line. This as two problems. First, it means that the driver introduces
an unnecessary requirement to support heap allocations. Second, it
causes a lot of weird and unnecessary SPI transactions that look like
partial updates without the actual refresh. This is very inefficient
since the same action can be performed in a single SPI transaction.

Add a gd7965_write_cmd_pattern() helper function that writes a pattern
of a specified length to a register in the device.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Andreas Sandberg
589b83a745 drivers: gd7965: Lock the SPI bus
The protocol used by the GD7965 driver requires that SPI transactions
are split into two phases, a command phase and a data phase, to change
the state of a GPIO signaling commands/data.

We currently don't lock the bus which means that other drivers could
potentially take over the bus and introduce unpredictable delays
between the command and data phase.

Add the necessary locking.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Kumar Gala
7d95eb0ac9 drivers: espi_emul: Fix formatting
Fix formatting of emul_espi_driver_api initializer

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 13:21:45 -05:00
Aaron Massey
fc98549952 emul: Use DEVICE_DT_GET instead of DT_LABEL
DT nodes aren't guaranteed to define a label property. But emulated bus
controllers currently make use of this property to dispatch to the
associated emulator.

Have emulated bus controllers use DEVICE_DT_GET(node_id) to dispatch to
right target peripheral emulator. This also change makes emul_get_binding
and device_get_binding synonymous in behavior with respect to their
parameters.

This also strictly enforces a 1:1 correspondence between invocations of
DEVICE_DT_DEFINE and EMUL_DEFINE.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2022-07-19 11:43:30 -05:00
Aaron Massey
76ae0ba270 emul: Remove or declare unused args
In several locations of the emulator code there are unused function
arguments that were never caught.

Declare these as unused or remove the unused function parameters entirely.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2022-07-19 11:43:30 -05:00
Aaron Massey
9d7b9dc807 emul: Simplify emulator bus initialization and API
Allow emulator creators to write an init function that can be used
across multiple busses so as to reduce the boilerplate and cognitive
load in creating an emulator.

Part of this change includes allowing access to the emul struct from a
field in a {bus}_struct api (e.g. i2c_struct), which removes the need for
sporadic usages of CONTAINER_OF to access the emul struct.

Overall, this change simplifies and reduces the amount of boilerplate
code to get a device emulator up and running, thus reducing excise work
to writing tests.

TEST=twister on accel,espi, and eeprom drivers tests

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2022-07-19 11:43:30 -05:00
Aaron Massey
1028459afd emul: Run clang-format
Run clang-format on all files touched by improved emulator API pull-request
that allowed access to the target device emulator from its bus api without
CONTAINER_OF usage.

drivers/i2c/i2c_emul.c
drivers/spi/spi_emul.c
include/zephyr/drivers/emul.h
include/zephyr/drivers/espi_emul.h
include/zephyr/drivers/i2c_emul.h
include/zephyr/drivers/spi_emul.h
subsys/emul/emul.c
subsys/emul/emul_bmi160.c
subsys/emul/espi/emul_espi_host.c
subsys/emul/i2c/emul_atmel_at24.c

TEST=twister on accel,espi, and eeprom drivers tests

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2022-07-19 11:43:30 -05:00
Kumar Gala
f6013818ec drivers: video: Update drivers to use devicetree Kconfig symbol
Update video drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 09:39:49 -07:00
Kumar Gala
6f5e75ba31 samples: usb: dfu: Fix building of sample on a few platforms
Fix building this sample on bl5340_dvk_cpuapp_ns and
pinnacle_100_dvk.  On these boards the NORDIC_QSPI_NOR
driver needs to be enabled for the sample to build.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 15:29:41 +00:00
Kumar Gala
d77389464b drivers: sensor: shell_battery: Convert to DEVICE_DT_GET
Move to using DEVICE_DT_GET so we can phase out DT_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 08:45:13 -05:00
Benjamin Björnsson
4e841aea8d drivers: regulator: regulator_pmic: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-19 12:28:55 +00:00
Benjamin Björnsson
6098e1894b drivers: sensor: ms5607: Update driver to use spi_dt_spec
Simplify driver by using spi_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-19 12:28:29 +00:00
Benjamin Björnsson
e6f9ef4cc7 drivers: sensor: ms5607: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-19 12:28:29 +00:00
Gerard Marull-Paretas
cad6865aaa drivers: i2c: nrfx_twim: constify twim_config
The twim_config structure is no longer modified at runtime, so it can be
placed in driver's config (const).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
9974bb043f drivers: i2c: nrfx_twim: disable and restore state for bus recovery
TWIM peripheral needs to be disabled for bus recovery, otherwise SCL/SDA
lines will not be released. This patch makes sure to disable peripheral
if active, and, restore its state afterwards (including pin
configuration).

It is worth to note that a better solution would be to:

1. Define scl/sda pins as `-gpios` in DT
2. Use GPIO API in the driver to perform recovery (as some other drivers
   do)
3. Potentially use a "gpio" pinctrl state for this case

Unfortunately HAL is doing everything under the hood, so we have little
options to improve this unless we don't use it for such case. GPIO based
recovery should likely be generalized as many drivers seem to replicate
such _algorithm_.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
6f26fa2912 drivers: i2c: nrfx_twim: enable device runtime PM
Enable device runtime PM on the I2C driver. Note that this mechanism
replaces the old nrfx_twim_enable/disable calls with
pm_device_runtime_get/put, which means that driver will not save power
unless CONFIG_PM_DEVICE_RUNTIME=y.

Some quick measurements on thingy_52 running the samples/sensor/hts221
show a decrease of ~2-3uA in average when enabling device runtime PM.
Note that the driver already had implicit PM before, so the change for
users will be ~none, except that they now must enable the PM subsystem
features. While this case is not the best example, the PM subsystem will
turn to be beneficial as a whole when all devices in the board implement
it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
81f1bbacf4 drivers: i2c: nrfx_twim: drop init_twim shim
The function was just a shim to nrfx_twim_init, call it directly
instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
a1f6163a58 drivers: i2c: nrfx_twim: create common init function
The device definition macro defined per-device init function, resulting
in a cluttered and hard to extend init function. Create a per-instance
IRQ connect function instead, which is called at init time by a common
function.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
00ecc66677 drivers: i2c: nrfx_twim: enable/disable when resuming/suspending
The driver already implemented some sort of runtime PM by
unconditionally calling nrfx_twim_disable/enable. Perform the same
operations in the PM callback instead of doing a full init/deinit every
time.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
d3251c28aa drivers: i2c: nrfx_twim: remove redundant deinit_twim shim
The shim had no value, just call nrfx_twim_uninit directly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
9d649a5a74 drivers: i2c: nrfx_twim: drop twim_initialized usage
The driver re-initialized itself on the twim_transfer call if it wasn't.
This condition was likely added because of some manual/custom PM
schemes. Drop it in preparation for runtime PM.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
7fad89f020 drivers: i2c: nrfx_twim: avoid init/deinit to update frequency
nrfx HAL does not support updating frequency at runtime, which means we
need to do a full init/deinit to update it when it is a matter of a
simple register write. Fix this by using the lower level HAL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Kumar Gala
e99652b67d drivers: ieee802154: cc2520: Convert to DEVICE_DT_INST_DEFINE
Move driver to use {NET_}DEVICE_DT_INST_DEFINE.  This lets us
remove the IEEE802154_CC2520_DRV_NAME Kconfig symobl.

We also update the ieee802154 build_all test to actually enable
the CC2520 driver.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 10:32:21 +02:00
Kumar Gala
5cca6ed087 drivers: ieee802154: b91: Convert to DEVICE_DT_INST_DEFINE
Move driver to use {NET_}DEVICE_DT_INST_DEFINE.  This lets us
remove the IEEE802154_B91_DRV_NAME Kconfig symobl.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 10:32:09 +02:00
Freddie Yang
eca27824f3 drivers: fix race condition in SPI-based HCI driver
Give the semaphore after transceiving the message.

Signed-off-by: Freddie Yang <freddie.yang325@outlook.com>
2022-07-19 10:31:36 +02:00
Henrik Brix Andersen
b407b5697f drivers: can: loopback: add CAN-FD loopback support
Add support for CAN-FD frames in the CAN loopback driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-18 18:43:36 +02:00
Benjamin Björnsson
4b30008f5b drivers: gpio: gpio_cy8c95xx.c: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-18 18:43:17 +02:00
Benjamin Björnsson
ff327c419d drivers: gpio: gpio_pca953x: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-18 18:43:03 +02:00
Benjamin Björnsson
21cf889c87 drivers: led: tlc59108: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-18 18:42:52 +02:00
Tomislav Milkovic
0fe2c1fe90 everywhere: Fix legacy include paths
Any project with Kconfig option CONFIG_LEGACY_INCLUDE_PATH set to n
couldn't be built because some files were missing zephyr/ prefix in
includes
Re-run the migrate_includes.py script to fix all legacy include paths

Signed-off-by: Tomislav Milkovic <milkovic@byte-lab.com>
2022-07-18 16:16:47 +00:00
Benjamin Björnsson
0649679b98 drivers: sensor: bmp388: Rename spi variable
Rename variable for consistency across drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-18 10:24:35 -05:00
Benjamin Björnsson
b6c8148e7e drivers: sensor: bmp389: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-18 10:24:35 -05:00
Henrik Brix Andersen
657f34d073 drivers: can: mcan: increase maximum supported bitrate
According to the Bosch M_CAN datasheet, the M_CAN IP supports up to
8Mbit/s.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-18 14:30:47 +00:00
Sylvio Alves
f0623f88be drivers: serial: esp32c3: fix duplicated definition
Removes redefinition when uart interrupt is enabled.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-07-18 09:13:49 -05:00
Andrew McRae
008859a6ba drivers: sensor: npcx_tach: Remove underflow LOG_INF
A LOG_DBG already exists for the underflow check,
and given that reading 0 edges is a valid case, remove
the noisy underflow log.

Signed-off-by: Andrew McRae <amcrae@google.com>
2022-07-18 09:11:04 -05:00
Henrik Brix Andersen
588f06d511 drivers: can: loopback: check frame ID type and RTR bit in filters
Check the frame ID type and RTR bit when comparing loopback CAN frames
against installed RX filters.

Fixes: #47904

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-18 13:24:54 +00:00
Henrik Brix Andersen
3e5aaf837e drivers: can: mcux: flexcan: fix handling of RTR frames
When installing a RX filter, the driver uses "filter->rtr &
filter->rtr_mask" for setting the filter mask. It should just be using
filter->rtr_mask, otherwise filters for non-RTR frames will match RTR
frames as well.

When transmitting a RTR frame, the hardware automatically switches the
mailbox used for TX to RX in order to receive the reply. This, however,
does not match the Zephyr CAN driver model, where mailboxes are dedicated
to either RX or TX. Attempting to reuse the TX mailbox (which was
automatically switched to an RX mailbox by the hardware) fails on the first
call, after which the mailbox is reset and can be reused for TX. To
overcome this, the driver must abort the RX mailbox operation when the
hardware performs the TX to RX switch.

Fixes: #47902

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-18 13:24:54 +00:00
Henrik Brix Andersen
5e74f72220 drivers: can: mcan: acknowledge all received frames
The Bosch M_CAN IP does not support RX filtering of the RTR bit, so the
driver handles this bit in software.

If a recevied frame matches a filter with RTR enabled, the RTR bit of the
frame must match that of the filter in order to be passed to the RX
callback function. If the RTR bits do not match the frame must be dropped.

Improve the readability of the the logic for determining if a frame should
be dropped and add a missing FIFO acknowledge write for dropped frames.

Fixes: #47204

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-18 13:24:54 +00:00
TOKITA Hiroshi
189c8a82d4 drivers: sensor: adxl345: Add support SPI connection
Support SPI connection for ADXL345.
It works as well as an I2C connection.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-07-18 10:37:14 +00:00
Attie Grande
7ded40de84 soc: atmel_sam0: The ADC reference is locked while enabled for SAML21
For SAML21-based parts, the REFCTRL register is locked while the ADC is
enabled. Permit some parts to declare that they need the ADC to be
disabled before modifying REFCTRL.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-07-18 10:35:46 +00:00
Martin Jäger
e448561f95 drivers: serial: esp32_usb: improve Kconfig documentation
Clarify that this driver does not use the Zephyr USB stack, but the
one built into the Espressif MCU.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-16 16:17:11 +00:00
Martin Jäger
802f749697 drivers: serial: esp32_usb: remove UART config
The built-in USB serial peripheral is a virtual serial and does not
allow to be configured like a normal UART.

Removing the unused UART config parameters.

Also reducing initialization to single-instance only.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-16 16:17:11 +00:00
Martin Jäger
e8250ea17b drivers: serial: esp32_usb: clean-up
The struct serial_esp32_usb_pin, the uart_reg.h header and the
two defines are not used or required.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-16 16:17:11 +00:00
Martin Jäger
014f878e88 drivers: serial: esp32_usb: remove peripheral number
This peripheral is single-instance only, so there is no peripheral
number required.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-16 16:17:11 +00:00
Martin Jäger
0088641994 drivers: serial: esp32: remove unused stubs.h include
This include is only required if typeof() macro is used, which
is not the case for the serial / uart driver.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-16 16:17:11 +00:00
Tomasz Duda
5f84be56ae gpio_shell: support for input pull down/up
Add pull up/down in gpio shell.

Signed-off-by: Tomasz Duda <tomaszduda23@gmail.com>
2022-07-15 17:43:54 -05:00
Benjamin Björnsson
704e366fcf drivers: sensor: iis2mdc: Move bus union inside device config
Simplify driver by moving auxiliary bus union inside device config.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 15:35:54 +02:00
Benjamin Björnsson
bbff6eb592 drivers: sensor: iis2mdc: move driver to use i2c_dt_spec and spi_dt_spec
Simplify driver by using i2c_dt_spec and spi_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 15:35:54 +02:00
Benjamin Björnsson
e304695d2f drivers: led: ht16k33: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 15:35:33 +02:00
Jimmy Ou
78f876ef03 drivers: display: max7219: add driver
This commit implements the display interface for the MAX7219 LED Display
drivers.

Signed-off-by: Jimmy Ou <yanagiis@gmail.com>
2022-07-15 10:10:48 +02:00
Benjamin Björnsson
e1c0a494b3 drivers: i2c: i2c_tca954x: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 10:05:40 +02:00
Benjamin Björnsson
59ecc97b82 drivers: counter: rtc_mcp7940n: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 10:05:28 +02:00
Kumar Gala
dad7c3a240 drivers: misc: ft8xx: Convert to DEVICE_DT_INST_DEFINE
Move driver to use DEVICE_DT_INST_DEFINE.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-15 10:02:43 +02:00
Benjamin Björnsson
a372be6eda drivers: gpio: stmpe1600: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 10:00:44 +02:00
Benjamin Björnsson
ed84e45526 drivers: dac: dac_mcp4725: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 10:00:36 +02:00
Bartosz Bilas
9da5538f92 drivers: dac: mcp4728: set explicitly init priority
Since this DAC is connected via I2C bus the init priority
value must be higher than the default 50 so it can be initialized
later than the bus itself so add a dedicated init config
symbol for that.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-15 09:59:51 +02:00
Bartosz Bilas
5cf7adeb5b drivers: dac: mcp4725: set explicitly init priority
Since this DAC is connected via I2C bus the init priority
value must be higher than the default 50 so it can be initialized
later than the bus itself so add a dedicated init config
symbol for that.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-15 09:59:51 +02:00
Bartosz Bilas
035c75200e drivers: dac: dacx3608: set explicitly init priority
Since this DAC is connected via I2C bus the init priority
value must be higher than the default 50 so it can be initialized
later than the bus itself so add a dedicated init config
symbol for that.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-15 09:59:51 +02:00
Bartosz Bilas
43b38b348b drivers: dac: dacx0508: set explicitly init priority
Since this DAC is connected via SPI bus the init priority
value must be higher than the default 50 so it can be initialized
later than the bus itself so add a dedicated init config
symbol for that.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-15 09:59:51 +02:00
Adrian Bonislawski
0f90e8ed58 drivers: dmic: add gain ramping and unmute delay
This will add dmic gain ramping and unmute delay using
DAI's pre_copy trigger

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-07-14 16:25:39 -04:00
Marcin Szkudlinski
ae8b17d2bb Drivers: dmic-dai: Driver for Intel DMIC
This is a driver for Intel Digital Microphone

TODO:
 - volume rampup
 - TPLG config

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2022-07-14 16:25:39 -04:00
Johann Fischer
5e5ea9a21d drivers: use unsigned int for irq_lock()
irq_lock() returns an unsigned integer key.
Generated by spatch using semantic patch
scripts/coccinelle/irq_lock.cocci

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-07-14 14:37:13 -05:00
Tom Burdick
c225cf3b8a dma: HDA rename prefix from cAVS to ADSP
HDA is a common IP used across the entire ADSP line and deserves
a name respecting that alongside similiar IP drivers such as the
ADSP GPDMA driver.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-07-14 17:53:46 +00:00
Yannis Damigos
f845d9ac02 drivers: spi_esp32_spim: Support more CS pins per SPI instance
Support more CS pins per SPI instance

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2022-07-14 15:51:00 +00:00
Bjarki Arge Andreasen
52dd2bb3a3 drivers/modem: Patch fix for sock id and fd
There is is an error in the way that the sock id is
determined. A unique fd is reserved and assigned appropriatly, but
the id, which should correspond to a socket number within the modem,
is set to an invalid, and identical for all sockets, value, and then
not used appropriatly in the drivers, instead, the sock_fd is used,
which can be any value really, it is not related to the socket number
in any way.

This results in the drivers only working if the reserved fd happens
to be between base_socket_num and (socket_len - 1)

This patch assignes the id to the index of the socket + the
base_socket_num, the socket at index 0 will get the id 1 if the
base_socket_num is 1, and the modem_socket_from_id should then
be used to get a pointer to the socket, since the id is not
neccesarily equal to the index.

The FIXME has been solved by adding a note both at the start
of the modem_socket_get function and inside the Kconfig file
for the MODEM_SOCKET option description. It is not an error,
but the user must be aware that it uses the POSIX file
descriptors, for which only 4 are allocated by default.

This patch fixes the bug, without breaking the brittle modem
drivers which currently are built around this bug.

The modem drivers should be updated to use the id as the
socket num instead of the sock_fd after this fix has been merged.

The "socket # needs assigning" has been removed, as that is what
this patch is doing

I also added comments to the id and sock_fd in the modem_socket
structure to help developers use the id and fd appropriately.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2022-07-14 16:23:33 +02:00
Kumar Gala
861b14bd2e drivers: eeprom_emulator: Remove dead code
Remove unused PART_DEV_NAME macro.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:40:07 +02:00
Benjamin Björnsson
2259c6771f drivers: sensor: fxas21002: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-14 10:39:40 +02:00
Kumar Gala
3caaf8c935 drivers: crypto: ataes132a: Convert to devicetree
Move driver to be devicetree based and use struct i2c_dt_spec.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:37:26 +02:00
Kumar Gala
e8624849c3 drivers: adc: adc_ads1119: Convert to use DEVICE_DT_INST_DEFINE
Convert driver to use DEVICE_DT_INST_DEFINE.  Its already devicetree
based so trivial change over to use DEVICE_DT_INST_DEFINE.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:32:27 +02:00
Kumar Gala
5cdfd12726 drivers: clock_control: beetle: Use devicetree for clock control
Add simple clock control node in devicetree for beetle to handle
relationship between drivers (uart, timers, gpio) and clock controller
device.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:50 +02:00
Kumar Gala
762eadc15d drivers: gpio: dw: rework init to use DT_INST_FOREACH_STATUS_OKAY
Use DT_INST_FOREACH_STATUS_OKAY to reduce duplicated code for each
instance.

We make interrupts optional since they aren't always available.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:42 +02:00
Kumar Gala
8a97bbd1f5 drivers: gpio: dw: determine instances from devicetree
Remove Kconfig symbols that determine which instances and just use
the number of enabled instance in the devicetree to determine which
instances to build.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:42 +02:00
Kumar Gala
4773bb45b0 drivers: gpio: dw: Remove dead clock gate code
Remove dead clock gate code and associated PM code as the platforms
that used the clock gate code are no longer supported in Zephyr.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:42 +02:00
Kumar Gala
ef78470e4a drivers: gpio: dw: Remove dead shared IRQ code
The shared IRQ code has been broken for several releases and no one
seems to have noticed.  The platforms that this was used on are not
supported in Zephyr anymore so remove the code.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:42 +02:00
Kumar Gala
0b5b74da82 drivers: video: video_mcux_csi: Use phandle for devicetree sensor ref
Replace sensor_label property in devicetree with just a sensor phandle
property.  This is more generic and allows driver to use DEVICE_DT_GET
instead of device_get_binding.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:27 +02:00
Lucas Tamborrino
80fbef9677 drivers: pwm: esp32: mcpwm driver
Add new mcpwm peripheral driver

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-07-14 10:29:26 +02:00
Henrik Brix Andersen
5c16ba05c2 drivers: can: mcux: flexcan: add triple sampling mode support
Add support for triple sampling mode to the NXP FlexCAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 19:06:59 +02:00
Henrik Brix Andersen
97d9ab8c18 drivers: can: shell: add support for setting triple sampling mode
Add support for setting triple sampling mode.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 19:06:59 +02:00
Benjamin Björnsson
05a6c0fe68 drivers: sensor: stm32_temp: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-13 19:06:41 +02:00
Henrik Brix Andersen
7b6ca29941 drivers: can: mcux: mcan: add pinctrl support
Add pinctrl support to the NXP LPC driver front-end.

Fixes: #47742

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 18:10:52 +02:00
Tom Burdick
3824024f77 dma: hda link driver fixups
Fixes configured DMA direction for HDA link in/out drivers.

Adjusts the number of channels for link in/link out to safe value
that seems to work on all tested parts.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-07-13 10:55:17 -04:00
Jaroslaw Stelter
afb156a1eb soc: ace_v1x: unmap entire unused virtual space
This patch corrects the initial unmapping of unused l2 memory
to unmap until the end of virtual address space instead
of unmapping until the end of l2 physical memory.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-07-13 09:46:48 -05:00
Jaroslaw Stelter
8b598539f2 soc: ace_v1x: correct the move_region behavior
This patch introduces sys_mm_drv_move_region implementation
which stops usage of the sys_mm_drv_simple_move_region.
The sys_mm_drv_simple_move_region is unsuitable becuase
it iterates through physical pages in linear fashion.
The new implementation queries the tlb for each virtual
page of the requested region to find the physical page
to be remapped.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-07-13 09:46:48 -05:00
Andreas Sandberg
237de99da4 drivers: ssd16xx: Refactor busy pin handling
The SSD16xx driver needs to wait for the chip to complete commands
before issuing new commands. The datasheet doesn't specify which
commands cause the chip to raise the busy pin. The current driver has
ssd16xx_busy_wait() calls after commands that are known to take a long
time. This is very fragile and scatters a lot of boiler plate around
the driver.

Include an ssd16xx_busy_wait() call in ssd16xx_write_cmd() instead of
after commands that are suspected to take a long time. This makes the
driver more robust and is more in line with the expectations set out
in the data sheet.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-13 15:57:04 +02:00
Benjamin Björnsson
597be4d4f7 drivers: sensor: ak8975: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-13 15:53:26 +02:00
Jaroslaw Stelter
cf24124efa mm: introduce update memory flags api
There are cases when attributes of mapped virtual memory need
to be updated. E.g. in case there is loadable library/module
code loaded to the l2 memory then memory needs to be read-write.
After the code is loaded and is ready to be executed then
attributes of mapped memory should be updated to
read-only/executable without loosing memory contents.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-07-13 15:53:14 +02:00
Glauber Maroto Ferreira
2bc16b9918 soc: esp32: drivers: counter: code refactor
Refactors counter driver code, bringing:

- more readability through the removal of abused macros
- better use of the devicetree, by moving peripheral node's
info defined on macros and Kconfigs to dts bindings
- less dependence from dynamic allocations, making counter
instances fully statically-allocated
- better use of DT_INST_* macros

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-07-13 15:53:04 +02:00
Henrik Brix Andersen
e143c8b916 drivers: can: stm32: list one-shot capability
List the one-shot capability as supported.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 15:51:39 +02:00
Pieter De Gendt
bdf3322de8 drivers: display: display_mcux_elcdif: Rework double framebuffer
Improved the eLCDIF driver implementation:
* Optional (working) double framebuffers
* Statically allocated framebuffer(s)
* Removed obsolete Kconfig entries

Also modified the mimxrt1170 EVK default config.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-13 07:58:58 -05:00
Benjamin Björnsson
9ed194a00b drivers: sensor: ak8975: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-13 05:39:37 -05:00
Henrik Brix Andersen
d22a9909a1 drivers: net: canbus: move CAN bus network driver to drivers/net
Move the CAN bus network driver from drivers/can to drivers/net as it
implements a network driver, not a CAN controller driver.

Use a separate Kconfig for enabling the CAN bus network driver instead of
piggybacking on the SocketCAN Kconfig. This allows for other
(e.g. out-of-tree) SocketCAN transports.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 10:34:51 +02:00
Andreas Sandberg
4a09967517 drivers: ssd16xx: Implement blanking support
Implement support for display blanking by inhibiting display refresh
while blanking is on. Writes to the display are still sent to the
internal RAM in the display controller. Once blanking is turned off,
the contents of the RAM are written to the display. This behavior is
makes it possible to compose a frame buffer in the display controller
without flickering.

Other e-paper drivers such as the GD7965 already implement this
behavior.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-13 10:27:45 +02:00
Henrik Brix Andersen
ef804d8408 drivers: can: mcan: use generic dcache API
Use the generic dcache API for doing cleaning and invalidating data cache.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 10:18:30 +02:00
Tim Lin
04c6d7569f ITE: drivers/i2c: Add command queue mode
Adding command queue mode can reduce the time between each byte to
improve the I2C bus clock stretching during I2C transaction.

I2C command queue mode of it8xxx2 can support I2C APIs including:
i2c_write(), i2c_read(), i2c_burst_read.

Test:
1. tests\drivers\i2c\i2c_api --> pass
2. Reading 16 bytes of data through i2c_burst_read() can reduce
   0.72ms(2.54ms->1.82ms) compared to the original pio mode when the
   frequency is 100KHz.
3. krabby platform can boot normally.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-07-13 10:15:32 +02:00
Kumar Gala
ca2f491b22 modem: wncm14a2a: Update driver to use gpio_dt_spec
Simplify the implementation by using gpio_dt_spec.

As part of this use logical values of 0/1 for gpio_pin_set_dt
and handle any inversions as GPIO flags that might be required
at a board level (in dts config).

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-13 10:15:06 +02:00
Andreas Sandberg
d33b89befe drivers: spi: spi-bitbang: Add support for half duplex
Implement support for half duplex communication in the bit bang SPI
driver. The SPI driver will use the MOSI pin is for both TX and RX
operations when using half duplex mode.

In half-duplex mode, the driver configures the MOSI pin as an input
pin for input only transactions. Transactions that are bidirectional
are forbidden. After an SPI transaction, the MOSI pin is left as an
input if it was an RX transaction or an output after a TX
transaction. Like before, the MOSI pin is initialized as an
(inactive) output pin when the bus is initialized.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-13 10:15:00 +02:00
Henrik Brix Andersen
bb08e4251a drivers: can: add API for getting supported capabilities
Add API function for getting the supported capabilities of a CAN
controller. This allows for writing portable CAN applications.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 10:13:56 +02:00
Henrik Brix Andersen
7a5f96d844 drivers: can: shell: add support for setting one-shot mode
Add support for setting one-shot mode.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 10:13:42 +02:00
Henrik Brix Andersen
c0cba8f21a drivers: can: stm32: switch to supporting CAN_MODE_ONE_SHOT
Switch from using a driver-specific, compile-time devicetree one-shot
property to supporting the newly added CAN_MODE_ONE_SHOT flag for
enabling/disabling one-shot mode at run-time.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 10:13:42 +02:00
Kumar Gala
1eeae77621 sensors: ak8975: remove passthrough support for MPU9150
Remove the support for enabling passthrough mode support for MPU9150
on the AK8975.  We don't have a proper MPU9150 driver and the MPU9150
has been EOL.  So its highly unlikely this code is being used.

Additonally we remove the device tree binding for the MPU9150 since
we don't have a proper driver for it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-12 17:57:18 -05:00
Michał Barnaś
4978717d44 gpio: implement pin_get_config in stm32 driver
This commit adds support for pin_get_config function in stm32 driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś
7a7fdffdfd gpio: implement pin_get_config in gecko driver
This commit adds support for pin_get_config function in gecko driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś
634944ac66 gpio: implement pin_get_config in ite driver
This commit adds support for pin_get_config function in ite driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś
0f60d5ae30 gpio: implement pin_get_config in npcx driver
This commit adds support for pin_get_config function in npcx driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś
f9c9d537a8 gpio: implement pin_get_config in emul driver
This commit adds support for pin_get_config function in emul driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś
b1ba284b83 gpio: add function to get current configuration
Add gpio_pin_get_config function to gpio_driver_api.
This function is used to read current configuration of pin.
The gpio_pin_get_config checks if driver implements this function and
returns -ENOSYS if it isn't implemented.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Bartosz Bilas
819079a2c6 drivers: dac: mcp4728: fix indentation of the help section
The help section must start with 2 spaces so let's
add them.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-12 16:35:59 +00:00
Bartosz Bilas
e5a0c19f0e drivers: dac: mcp4728: remove not neccessary DAC guard
It is guarded by the parent so this symbol does not need it.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-12 16:35:59 +00:00
Gerard Marull-Paretas
0aea96dbca drivers: pwm: minor formatting enhancements
Some formatting tweaks to improve the outcome of clang-format.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
c82d71e7ff drivers: pwm: npcx: remove unused include <assert.h>
<assert.h> is not used, so remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
dac7093529 drivers: pwm: npcx: use register type
Custom accessors like HAL_INSTANCE() have been gradually removed
in-tree. Instead, store a pointer with the right type (struct pwm_reg
*).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
f9ff805e3b drivers: pwm: add log level to LOG_MODULE_REGISTER
LOG_MODULE_REGISTER accepts log level as an argument.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
45ca8090c0 drivers: pwm: mcux: fix register casting
Register was wrongly casted to (void *) in one case, and unnecessarily
casted in another case.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
4df3b22934 drivers: pwm: mchp_xec: fix include list
Include what is needed, and sort includes properly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
a0ff40ca4b drivers: pwm: imx: remove redundant DEV_BASE accessor
The base variable type stored in config already has the right type. Such
kind of accessors have been removed in many other places.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
6bd248d005 drivers: pwm: gecko: fix non-local includes
HAL includes are not local, so use <> instead of "".

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Guillaume Lager
f6f52d3842 drivers: adc: Add ADS1119 driver
The driver support both synchronous and asynchronous reading.

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2022-07-12 12:29:45 +02:00
Guillaume Lager
ac1eab55ef drivers: adc: Add runtime adc context initialization function
In some case the structure enclosing the adc context
can be quite big, making static initialization quite
resource consuming

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2022-07-12 12:29:45 +02:00
Benjamin Björnsson
6c82570f62 drivers: sensor: ccs811: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-12 12:28:53 +02:00
Benjamin Björnsson
bf4b30e848 drivers: sensor: iis3dhhc: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-12 10:56:15 +02:00
Benjamin Björnsson
0364f3ae4d drivers: sensor: ti_hdc: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-12 10:18:29 +02:00
Pieter De Gendt
850cdc9196 drivers: memc: mcux_flexspi_hyperram: Fix multiple log module definition
Enabling the FlexSPI HyperRAM results in a build error, due to a logging
module re-definition. Fixed by changing the log module name.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-12 09:54:07 +02:00
Daniel DeGrasse
5dcb5e0f67 drivers: ethernet: mcux: Increase available RX buffers
increase available RX buffers to MCUX ethernet driver.
improves measured performance on RT1050 EVK zperf download
from 500Kbps to 22Mbps.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-07-12 09:53:56 +02:00
Maximilian Deubel
3d2b04c9a8 ADXL362: add dynamic inact time setting
This patch extends the adxl362 driver by adding an option
to change the inactivity detection timeout at runtime.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2022-07-11 18:19:45 +00:00
Peter Ujfalusi
e243122c1e dma/cavs_hda: Configure DGMBS only for host DMA configuration
The DGMBS should be only set for the host side and not on the link DMA.

Fixes: #46632
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-07-11 18:04:54 +00:00
Kiril Petrov
44f651d315 drivers: nordic_nrf_temp: nrfx: Fix build warning into temp_nrf5_init
Building lwm2m_client with CONFIG_NET_L2_OPENTHREAD=y leads to
following warning during build:

west build -s samples/net/lwm2m_client -b nrf52840dk_nrf52840 -- \
				-DCONFIG_NET_L2_OPENTHREAD=y

zephyr/drivers/sensor/nrf5/temp_nrf5.c:115:10:
warning: zero-length gnu_printf format string [-Wformat-zero-length]
115 |  LOG_DBG("");

Signed-off-by: Kiril Petrov <retfie@gmail.com>
2022-07-11 17:57:12 +02:00
Gerard Marull-Paretas
c2d699ec2d drivers: spi: sifive: remove CONFIG_SIFIVE_SPI_0_ROM
CONFIG_SIFIVE_SPI_0_ROM (default y) was an option to disable spi0 if
used to access SPI Flash ROM. However, its design had a problem: it
relied on instance numbers. You had to set status okay for spi0 to make
it work (incongruent with the purpose of the option itself). This patch
makes things simpler: if such SPI0 is not available, simply keep it
disabled in DT. Bindings have been updated to mention this case.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-11 17:56:55 +02:00
Gerard Marull-Paretas
457fa9d463 drivers: flash: shell: remove unused soc.h
The flash shell included soc.h for no reason, remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-11 17:56:55 +02:00
Kumar Gala
97281913f5 modem: hl7800: Cleanup gpio assert/deassert
Use logical values of 0/1 for gpio_pin_set_dt and handle any
inversions as GPIO flags that might be required at a board level.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-11 07:46:22 -05:00
Kumar Gala
6100eadd4b modem: hl7800: Update driver to use gpio_dt_spec
Simplify the implementation by using gpio_dt_spec.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-11 07:46:22 -05:00
Carlo Caione
5d104f20ab riscv: Introduce API for CLIC and PLIC
Introduce a new interface for CLIC and PLIC to be used by the drivers.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-07-11 14:31:39 +02:00
Carlo Caione
56466a14e1 riscv: Decouple CLIC and PLIC
Try to decouple CLIC and PLIC as much as possible.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-07-11 14:31:39 +02:00
Carlo Caione
31c5dc2230 Kconfig: Introduce RISCV_HAS_CLIC
Introduce a new RISCV_HAS_CLIC symbol for platforms using CLIC,
reorganize the Kconfigs and make the Nuclei ECLIC depending on the new
symbol.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-07-11 14:31:39 +02:00
Aurelien Jarno
2ea4516a4a drivers/flash: stm32g0: Prepare for unaligned accesses in flash writes
When using the settings subsystem, the data argument argument passed to
flash_stm32_write_range() might not be 8-bytes aligned, causing an
unaligned memory access fault.

Fix that the same way as it was done for the STM32L4 in commit
652efa530f.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-11 13:28:45 +02:00
Gerard Marull-Paretas
2533b13cd2 drivers: gpio: nrfx: add custom drive flags
Now that we have 8 bits reserved for vendor specific GPIO flags,
introduce a new set of flags for nRF platforms to configure pins drive
mode. These new flags are equivalent to the previous existing ones, but
use a naming scheme the fits better with vendor hardware capabilities.

The table below shows the equivalence between old and new flag

| Old flags                 | New flags             |
|---------------------------|-----------------------|
| `NRF_GPIO_DS_DFLT_LOW`    | `NRF_GPIO_DRIVE_S0`   |
| `NRF_GPIO_DS_DFLT_HIGH`   | `NRF_GPIO_DRIVE_S1`   |
| `NRF_GPIO_DS_ALT_LOW`     | `NRF_GPIO_DRIVE_H0`   |
| `NRF_GPIO_DS_ALT_HIGH`    | `NRF_GPIO_DRIVE_H1`   |
| `NRF_GPIO_DS_DFLT`        | `NRF_GPIO_DRIVE_S0S1` |
| `NRF_GPIO_DS_ALT`         | `NRF_GPIO_DRIVE_H0H1` |
| `NRF_GPIO_DS_DFLT_LOW \|` | `NRF_GPIO_DRIVE_S0H1` |
| `NRF_GPIO_DS_ALT_HIGH`    |                       |
| `NRF_GPIO_DS_ALT_LOW \|`  | `NRF_GPIO_DRIVE_H0S1` |
| `NRF_GPIO_DS_DFLT_HIGH`   |                       |

Documentation has been written to explain in more detail the meaning of
the flags and how they can be used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-11 13:22:24 +02:00
Gerard Marull-Paretas
e29055a225 drivers: gpio: nrfx: remove custom DS flags
The naming of the custom DS flags is not clear for nRF platforms. This
patch removes all the NRF_GPIO_DS* flags. New flags will be
re-introduced in a follow-up commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-11 13:22:24 +02:00
Francois Ramu
085cdd9277 drivers: adc: stm32f1 adc driver enable peripheral
This commit avoid re-enabling the ADC,
because this starts conversion.
According to the RefMan (RM0008) of the stm32F10x mcu,
enabling the ADC will start the conversion
if the ADC is already enabled. "Conversion starts when
this bit holds a value of 1 and a 1 is written to it."
That's not what we want.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-11 10:49:01 +02:00
Flavio Ceolin
ad8ae7f735 dma: intel: Merge cavs and ace gpdma
cAVS and ACE gpdma driver have several similarities. This commit merge
this two drivers into a single one for Intel ADSP devices.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-07-11 10:21:17 +02:00
Flavio Ceolin
d8c7aed261 dma: ace: Add ace gpdma driver
Add ace gpdma driver.

Co-authored-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-07-11 10:21:17 +02:00
Bruno Achauer
bc8419e20a drivers/timer/apic_tsc: Select the 64-bit cycle counter in deadline mode
When using the APIC imer in TSC deadline mode, also enable reading the
full 64-bit cycle counter value (via the k_cycle_get_64() call).

Signed-off-by: Bruno Achauer <bruno.achauer@intel.com>
2022-07-08 21:59:06 -04:00
Andrzej Głąbek
e530ba9152 drivers: i2c: nrfx: Fix i2c_recover_bus implementation for PINCTRL
When PINCTRL is enabled, the SCL and SDA pin numbers are not available
in configuration structures used for nrfx drivers initialization.
In this case, these pin numbers need to be obtained from peripheral
registers.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-07-08 20:05:49 +00:00
Tom Burdick
572ccd531d intel_adsp: Use device tree to enable/disable each HDA driver
Uses the dt_compat_enabled Kconfig preprocessor to set defaults
for each HDA driver.

Each direction is uniquely selectable which can be useful when building
with SOF where only some directions may wish to be enabled at any given
time.

By default, given the device tree (intel_cavs.dtsi) only the host
directions are enabled but an overlay may adjust that as needed.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-07-08 14:33:06 -04:00
Fabio Baltieri
151d840f1e driver: timer: stm32_lptim: only set LSE drive if supported
Not all platforms support setting the LSE driving capability, causing
the build to fail for platform such as the STM32L072 if compiled with
CONFIG_STM32_LPTIM_CLOCK_LSE=y.

Adding an #ifdef guard around the call to skip it if not defined in the
HAL.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-07-08 11:48:07 +00:00
Mulin Chao
6f108d7f76 driver: gpio: npcx: Add checking whether pad's configuration is valid
In npcx series, not all GPIO pads support Multi-Input Wake-Up Unit
(MIWU) functionality. Hence, this CL adds checking whether GPIO's pad
configuration is valid first before using it.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-07-08 12:05:09 +02:00
Yuriy Vynnychek
99479ecbda drivers: adc: introduce new Telink B91 ADC driver
ADC driver basic support for Telink B91 SoC.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-07-08 11:07:18 +02:00
Benjamin Björnsson
78af3f39ec drivers: sensor: ism330dhcx: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-08 10:57:18 +02:00
Kumar Gala
244519b497 i2c: xec: Update driver to use gpio_dt_spec
Simplify the implementation by using gpio_dt_spec.  Mostly
gpio_dt_spec is used as a common struct and lets us move
away from DT_INST_GPIO_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-08 10:57:03 +02:00
Francois Ramu
95c00f4d7a drivers: clock_control: no PLLEN on some stm32 soc
Some stm32 devices, like stm32F4, do not have
a PLL Enable bit on the PLLP nor PLLQ divider
in their PLL config register (PLLCFGR).
The result is a empty function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-08 10:48:54 +02:00
Francois Ramu
388c36e5d6 drivers: clock: get_pllsrc_frequency for stm32f2/f4/f7
The function get_pllsrc_frequency is added
with possible source HSI or HSE.
With STM32_PLL_P_ENABLED or STM32_PLL_Q_ENABLED,
this function is used by the clock control driver.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-08 10:48:54 +02:00
Piotr Dymacz
20cb405e17 drivers: adjust cc13xx_cc26xx drivers for hal_ti update
The TI SimpleLink SDK got updated to version '4.40.04.04' in 'hal_ti'.
This introduced renames of some functions in HAL and has to be reflected
in Zephyr drivers which make use of them.

This renames 'PRCMPowerDomainStatus' to 'PRCMPowerDomainsAllOn' in all
affected 'cc13xx_cc26xx' drivers.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-07-08 09:37:43 +02:00
Kumar Gala
92ad49e173 drivers: flash: spi-nor: Set driver Kconfig default based on dts
Change Kconfig default to be based on if the devicetree has the
jedec,spi-nor driver enabled.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-08 09:36:43 +02:00
Adrian Bonislawski
ef2644d40d dma/cavs_hda: add missing hda link files to CMakeLists
This patch will allow to build hda link in&out files

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-07-07 15:04:31 -04:00
Pieter De Gendt
90af62243e drivers: hwinfo: shell: Add missing reset cause strings
The hwinfo shell commands was missing human readable names for
* RESET_HARDWARE
* RESET_USER
* RESET_TEMPERATURE

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-07 17:59:19 +00:00
Benjamin Björnsson
e0cc66ab6f drivers: sensor: amg88xx: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-07 09:21:34 -05:00
Mulin Chao
851e357aa4 pinctrl: npcx: add pinctrl support for psl pads
This CL introduces how to configure PSL (Power Switch Logic) pads
properties such as input detection mode/polarity, pin-muxing and so
on via pinctrl mechanism. It includes:

1. Add two pinctrl properties and their enums for PSL input
   detection configuration.
    psl-in-mode:
      - "level"
      - "mode"
    psl-in-pole:
      - "low-falling"
      - "high-rising"

2. Add macro functions to get PSL input detection and pin-muxing
   configurations from 'pinmux', 'psl-offset' abd 'psl-polarity'
   properties.

Here is an example to configure PSL_IN2 as the PSL detection input and
its mode and polarity.

/* A falling edge detection type for PSL_IN2 */
&psl_in2_gp00 {
	psl-in-mode = "edge";
	psl-in-pol = "low-falling";
};

A device will be introduced later which uses this pinctrl node to
configure PSL input detection settings and how to turn off VCC1 power
rail by PSL_OUT.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-07-07 14:12:52 +00:00
Joep Buruma
7e0fff24c7 drivers: pwm: add pwm driver for rpi_pico
Add pwm driver implementation for rpi pico family.
Adds myself as codeowner of drivers/pwm/*rpi_pico*

Signed-off-by: Joep Buruma <burumaj50@gmail.com>
2022-07-07 15:17:26 +02:00
Martin Jäger
2ed42b3555 drivers: serial: esp32_usb: Add USB serial / JTAG interface
This peripheral combines a hardware-based USB CDC ACM serial interface
and a JTAG interface.

It is present in the ESP32-C3.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-07 13:14:00 +00:00
Yann Roth
c640392211 typo: fix LSM6DSL_SHIFT_MD2_CFG_INT2_WU
The register MD2_CFG contains INT2_WU and not INT1_WU

Signed-off-by: Yann Roth <yannroth@msn.com>
2022-07-07 10:16:35 +02:00
Pieter De Gendt
e381170282 uart_pipe: Remove obsolete UART_PIPE_ON_DEV_NAME Kconfig
The UART pipe device is selected with devicetree chosen zephyr,uart-pipe

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-07 09:59:49 +02:00
Pieter De Gendt
aba4c4ea3e uart_pipe: move driver from console to serial
The uart_pipe driver is not dependent on any console driver,
however a serial driver is required.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-07 09:59:49 +02:00
Flavio Ceolin
e4a3e2d8b6 intel_adsp: Unify cavs and ace timers
These two timers were sharing pretty much the same code. Actually
mtl timer was a "superset" of cavs timer. Just merge them into a
single one called intel audio dsp timer (intel_adsp_timer).

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-07-06 15:11:07 -04:00
Anas Nashif
b330a05539 intel_adsp: add a new series to support Meteorlake
Meteorlake support as part of the Intel ADSP family.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Co-authored-by: Michal Wasko <michal.wasko@intel.com>
Co-authored-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
Co-authored-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Co-authored-by: Enjia Mai <enjia.mai@intel.com>
Co-authored-by: Flavio Ceolin <flavio.ceolin@intel.com>
Co-authored-by: Tomasz Leman <tomasz.m.leman@intel.com>
Co-authored-by: Bonislawski Adrian <adrian.bonislawski@intel.com>
Co-authored-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
Co-authored-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-07-06 15:11:07 -04:00
Anas Nashif
17a0f81bfc intel_adsp: meteorlike: add timer driver
Add timer driver based on CAVS driver and adapted for Meteor Lake.

Co-authored-by: Michal Wasko <michal.wasko@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 15:11:07 -04:00
Anas Nashif
b951a0ebed drivers: Add ACE V1X interrupt controller
Add Designware Interrupt Controller for ACE v1x platform

Co-authored-by: Ederson de Souza <ederson.desouza@intel.com>
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 15:11:07 -04:00
Anas Nashif
3ccafb1af3 intel_adsp: meteorlake: add memory driver
Add TLB driver specific for Meteorlake.

Add missing kconfig resource and fix include path
add hpsram power up and ref counter

Use memblock to track physical page usage in mtl tlb driver. The
applications that will be using the tlb memory driver should not
track the physical page mapping to virtual address space:
 - adds an option to use the phys argument value of 0 to tell the
   driver to autonomously assign physical pages upon map request
 - makes the tlb driver use memblock to track mapped physical pages

Co-authored-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Co-authored-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Co-authored-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
Co-authored-by: Michal Wasko <michal.wasko@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 15:11:07 -04:00
Benjamin Björnsson
092251017f drivers: sensor: stts751: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 18:00:21 +00:00
Benjamin Björnsson
0ce4d8b2da drivers: sensor: stm32_vbat: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 18:00:02 +00:00
Kumar Gala
1cce353536 drivers: eswifi: Remove unused 'csn' field from struct
The 'csn' field is not being used so remove it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-06 12:42:45 -05:00
Anas Nashif
49b36ead95 drivers: add mising braces to single line if statements
Following zephyr's style guideline, all if statements, including single
line statements shall have braces.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 11:00:45 -04:00
Benjamin Björnsson
1cd8a0fb34 drivers: sensor: lsm9ds0_gyro: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 09:49:32 -05:00
Benjamin Björnsson
ccf9292a52 drivers: sensor: iis2dh: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 09:11:06 -05:00
Benjamin Björnsson
6e62bd070f drivers: sensor: bmg160: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 09:09:38 -05:00
Benjamin Björnsson
2cff424bea drivers: sensor: tmp007: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 09:07:33 -05:00
Kumar Gala
48c87f2bf8 wifi: eswifi: spi: Move spi bus into config
Move 'struct spi_dt_spec bus' into the config struct so it
can be const and than possibly placed in ROM.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-06 08:45:25 -05:00
Kumar Gala
c4f5439221 wifi: eswifi: Update driver to use gpio_dt_spec
Replace eswifi_gpio with gpio_dt_spec.  We can replace devicetree
label based access with this change as we try and phase out the
usage of the 'label' property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-06 08:45:25 -05:00
Francois Ramu
a20aa34301 drivers: dma: no irq when stopping dma channel
when the dma channel is stopped, the irq is no more
relevant ; clear any irq but do not process it.
Fix Typo on comments and add LOG_DBG on channel increment.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-06 11:19:47 +00:00
Andreas Sandberg
f5932657dd drivers: ssd16xx: Fix CS glitch
The SSD16xx uses a separate pin to indicate if an SPI transfer is a
command or data. This means that driver needs to split most SPI
transactions into two distinct transactions, one for commands and one
for data. The driver currently doesn't request SPI_HOLD_ON_CS which
means that the chip select will be released momentarily between the
command and data phase.

Update the driver to request SPI_HOLD_ON_CS and SPI_LOCK_ON to lock
the bus and complete both phases of a command in one atomic operation.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-06 11:14:49 +02:00
Andreas Sandberg
f922a580f7 drivers: ssd16xx: Remove unused include
Remove the unused zephyr/display/cfb.h include.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-06 11:14:49 +02:00
Andreas Sandberg
a05e8dcc5e drivers: spi: spi-bitbang: Fix CS glitch in transceive
spi_context_cs_configure_all() is currently called from
spi_bitbang_transceive(). This causes a glitch when combined with
SPI_HOLD_ON_CS is used.

Move the initialization to spi_bitbang_init which is what the other
SPI drivers seem to do.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-06 11:11:14 +02:00
Andreas Sandberg
65252ffd95 drivers: spi: spi-bitbang: Initialize CS GPIOs
The SPI bitbang driver doesn't correctly initialize the list of CS
GPIOs. As a consequence, SPI buses using the bitbang driver won't
drive CS low. Add the missing initialization.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-06 11:11:14 +02:00
Aurelien Jarno
869c60e208 drivers: sensor: stm32_vbat: get vref-mv through the ADC API
Get the vref-mv through the ADC API instead of the device tree. This
saves 8 bytes of SRAM and will be future proof in case, one day, support
for a variable vref is added.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-06 11:10:42 +02:00
Aurelien Jarno
fd8042d88f drivers: adc: stm32: remove vref_mv from adc_stm32_cfg
The value is unused in this structure is unused and can be accessed
through the adc_ref_internal() function.

This saves 4 bytes of SRAM.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-06 11:10:42 +02:00
Aurelien Jarno
ef05063e62 drivers: adc: stm32: enable battery voltage input without CONFIG_STM32_VBAT
Allow the battery voltage to be read through the ADC even if the
CONFIG_STM32_VBAT driver is not enabled.

I guessed this part of code is conditionally compiled depending on
CONFIG_STM32_VBAT because this feature, and hence the
LL_ADC_CHANNEL_VBAT constant is not available on all families. As the
feature is already checked at runtime (as the same driver supports
multiple instances), we can conditionally compile it depending on
LL_ADC_CHANNEL_VBAT instead.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-06 11:10:42 +02:00
Richard Yim
1b4e5b8d35 ITE drivers/pwm: fix target frequency below 324Hz on it8xxx2
after the second times will not operating in correct output frequency.

Signed-off-by: Richard Yim <yimjiajun@icloud.com>
2022-07-06 11:04:02 +02:00
Jamie McCrae
a20eb66742 drivers: watchdog: Add Raspberry Pi Pico watchdog driver
This adds basic support for the watchdog timer on the RP2040 MCU and
Raspberry Pi Pico development board

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2022-07-06 10:52:29 +02:00
Kumar Gala
927d6b620d video: ov2640: cleanup unused struct fields
When we moved to gpio_dt_spec forgot to remove the older
fields used for gpio related access.  Remove them as they
are used by the driver anymore.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-06 10:50:01 +02:00
Jun Lin
d4abe64766 driver: i2c: npcx: clear FIFO status before a transaction starts
When an I2C transaction completes, the driver should clear all the FIFO
status. Otherwise, it has the chance to break the operation of the next
transaction. This commit sets the CLR_FIFO bit in the SMBFIF_CTS
register to clear all the FIFO status at the beginning of an I2C
transaction.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-07-06 10:46:28 +02:00
Rodrigo Cataldo
089ed23a32 drivers: pcie: fix inverted translation for PCIe controller
Invert the physical address given to pcie_ctrl_region_translate() to
match the PCI BAR layout. Previously, physical addresses for memory
space BAR were exposed to bit 3 (prefetchable bit) and 2 (1 type bit) of
the header.

Signed-off-by: Rodrigo Cataldo <rodrigo.cataldo@huawei.com>
2022-07-06 10:45:54 +02:00
Benjamin Björnsson
251755e21d drivers: sensor: iis2dh: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 10:43:10 +02:00
Benjamin Björnsson
5c9f5a12f4 drivers: sensor: iis2dh: Update driver to use spi_dt_spec and i2c_dt_spec
Move driver to use spi_dt_spec and i2c_dt_spec for SPI and I2C bus
access, respectively.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 10:43:10 +02:00
Benjamin Björnsson
619c0ee17b drivers: sensor: iis2dh: Change parameter list of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 10:43:10 +02:00
Pieter De Gendt
8bef504163 drivers: display: st7789v: Support 3-line serial interface
The sitronix ST7789V serial interface can operate with 3- or 4-line
protocol.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-06 10:42:15 +02:00
Kumar Gala
51b4df60a2 drivers: ethernet: eth_mcux: Replace use of DT_INST_LABEL
As we work to phase out devicetree 'label' properties, convert
driver to just use ETH_0/ETH_1 instead of DT_INST_LABEL for
logging purposes.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-05 22:24:09 -05:00
Thomas Stranger
3d70711c04 drivers: sensor: add support for ds18b20 1-wire temperatue sensor
This commit adds support for the ds18b20 1-wire temperature sensor.

The sampling resolution of the sensor can be set in DT.
In case only a single device is on the bus, the driver issues
skip_rom commands. However, in case DT defines several devices,
the driver will use match_rom commands and therefore it is necessary
to set the rom_id of the device via the sensor attribute interface before
being able to sample sensor values.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-05 23:06:45 +02:00
Thomas Stranger
d668281b4a drivers: w1: add zephyr-serial driver
The zephyr-serial w1 driver introduced in this commit implements
all routines for the w1 api on top of the zephyr serial driver.
W1 bit read, write, and reset operations are executed by issuing
polling zephyr serial byte read and write operations.

The driver should be usable on most platforms in zephyr that have
implemented support for the polling procedures of the serial driver.
As not all serial drivers are implemented exactly the same minor
additional quirks may be needed on some platforms.
The most notable difference of polling serial driver implementations
seems to be that some return immediately from poll_out after the
transmission was started(e.g. STM32) and others wait until
the transmission was completed before returning from poll_out
(e.g. NRF). While this has influence on the timeout, both types
are supported by this driver because the driver waits for a
configurable time period until it terminates the read.

The driver needs an appropriate open drain interface to be able
to communicate with slaves.
In the simpliest case this might be achived by configuring the mcu pins
in open-drain configuration with a (sufficiently small) pull-up to 3V3/5V.
Otherwise an external circuit needs to provide this interface.

Overdrive and Standard Speed modes are supported by this driver.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-05 23:06:45 +02:00
Thomas Stranger
ae8543269a drivers: w1: add vnd,w1 driver for ci testing
This commit adds the vnd,w1 dummy host driver used for ci builds of
1-wire devices.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-05 23:06:45 +02:00
Thomas Stranger
bb4f7b5a31 drivers: w1 introduce 1-wire net layer api
This commit introduces a new api for the net layer of Dallas
1-wire protocol.
For single drop configurations w1_read_rom, and w1_skip_rom commands are
provided.
For multidrop configurations w1_match_rom, w1_resume_command,
w1_search_rom, and w1_search_alarm routines are provided as well.
Additionally, the reset_select routine, conditionally depending on the
bus configuration, either executes a match_rom, or a skip rom command.
A w1_write_read command simplifies the typical scenario of addressing
a device, writing a few bytes to the device and reading back the answer.

Additionally w1_crc8, and w1_crc16 are added as wrappers around the
zephyr in-tree crc8 and crc16_reflect implementations.
The former may be used to verify the validity of the rom id, while the
latter is used for integrity checking of many eeprom, and authenticator
commands.

The general search command does not support filtering on
the family code.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-05 23:06:45 +02:00
Thomas Stranger
d63cf82a46 drivers: w1 introduce 1-wire api and common code
This commit introduces a new api for the Dallas 1-wire protocol.
The api includes link functions for read and write operations on
bit, byte, and block level, as well as functions to reset and
lock the bus.

The bus configuration is derived from the device tree and can be
queried using w1_slave_count routine.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-05 23:06:45 +02:00
Enjia Mai
89a9eab652 drivers: console: add a minimal EFI console driver to support printf
Add a minimal EFI console driver to support printf, this console driver
only supports console output. Otherwise the printf will not work.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-07-05 16:52:32 -04:00
Benjamin Björnsson
c2861ffda2 drivers: sensor: th02: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 15:41:10 +00:00
Benjamin Björnsson
f5b9635e31 drivers: sensor: adxl345: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 15:39:33 +00:00
Benjamin Björnsson
1d0e5e17d3 drivers: sensor: ams_iAQcode: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 15:39:15 +00:00
Teik Heng Chong
f551c29576 drivers: serial: Uart ns16550 get clock frequency from clock manager
This patch is to enhance the uart ns16550 driver to get clock frequency
from clock manager or devicetree if clock_frequency is defined.

Signed-off-by: Teik Heng Chong <teik.heng.chong@intel.com>
2022-07-05 15:38:54 +00:00
Teik Heng Chong
89075f42bb drivers: clock_control: Use Agile clock sub system as clock id
This patch is to direct use Agile clock sub system as clock id

Signed-off-by: Teik Heng Chong <teik.heng.chong@intel.com>
2022-07-05 15:38:54 +00:00
Benjamin Björnsson
803fdf6a46 drivers: sensor: vcnl4040: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 09:14:50 -05:00
Benjamin Björnsson
b4dffbfb40 drivers: sensor: mcp9808: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 09:10:06 -05:00
Benjamin Björnsson
b2b7665b9c drivers: sensor: mpu6050: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 09:08:43 -05:00
Benjamin Björnsson
1409a8f86b drivers: sensor: lis3mdl: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 09:06:13 -05:00
Benjamin Björnsson
131aedc769 drivers: sensor: isl29035: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 09:02:05 -05:00
Benjamin Björnsson
0ab5e7964c drivers: sensor: bmc150_magn: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 08:59:13 -05:00
Benjamin Björnsson
3f42a6a75f drivers: sensor: hmc5883l: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 08:57:59 -05:00
Benjamin Björnsson
ff7aa22217 drivers: sensor: adt7420: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 08:53:08 -05:00
Benjamin Björnsson
d0a5f5a08d drivers: sensor: adxl362: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 08:51:13 -05:00
Benjamin Björnsson
4e0dbc7c14 drivers: sensor: bma280: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 08:49:07 -05:00
Andrzej Głąbek
fd07675574 drivers: pinctrl_nrf: Use S0D1 drive by default for TWI/TWIM pins
The default S0S1 drive setting is not suitable for TWI/TWIM pins.
Override it with S0D1 as for some SoCs (e.g. nRF52833) without
this the peripheral will not work properly.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-07-05 13:52:19 +02:00
Benjamin Björnsson
b552a003b6 drivers: sensor: dps310: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:43:15 +02:00
Benjamin Björnsson
acb22c72e7 drivers: sensor: lsm303dlhc_magn: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:42:21 +02:00
Benjamin Björnsson
6f6fba5e73 drivers: sensor: bmm150: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:31:45 +02:00
Benjamin Björnsson
d4cf841622 drivers: sensor: dht: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:30:45 +02:00
Benjamin Björnsson
5983d8b762 drivers: sensor: grove: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:28:43 +02:00
Benjamin Björnsson
927633a819 drivers: sensor: hp206c: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:27:40 +02:00
Benjamin Björnsson
21b371f531 drivers: sensor: lps22hb: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:25:57 +02:00
Benjamin Björnsson
33634e4539 drivers: sensor: lps25hb: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:25:33 +02:00
Benjamin Björnsson
b48c760e3d drivers: sensor: lsm6ds0: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:24:39 +02:00
Benjamin Björnsson
a94db52f55 drivers: sensor: lsm9ds0_mfd: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:24:07 +02:00
Benjamin Björnsson
e2690f033e drivers: sensor: max44009: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:23:44 +02:00
Benjamin Björnsson
6d2d34bdad drivers: sensor: mpr: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:22:55 +02:00
Benjamin Björnsson
8d08148c7f drivers: sensor: ms5837: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:22:31 +02:00
Benjamin Björnsson
6746da203b drivers: sensor: nrf5: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:22:17 +02:00
Benjamin Björnsson
82018dfd9c drivers: sensor: opt3001: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:21:34 +02:00
Benjamin Björnsson
b568372c73 drivers: sensor: pms7003: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:21:03 +02:00
Benjamin Björnsson
97ca9ce0be drivers: sensor: si7006: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:20:40 +02:00
Benjamin Björnsson
08d86ff251 drivers: sensor: si7055: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:20:25 +02:00
Benjamin Björnsson
d116187fd7 drivers: sensor: si7060: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:20:12 +02:00
Benjamin Björnsson
454c7a1916 drivers: sensor: sx9500: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:11:09 +02:00
Bartosz Bilas
a7ecf70353 drivers: adc: adc_stm32: fix comment indendations
Fix indentations of `adc_stm32_oversampling` function comments
to have everything aligned properly.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-07-05 04:24:34 -05:00
Francois Ramu
1654f81740 drivers: adc: stm32g0 fix sampling time due to errata sheet
According to the ES0418 about the ADC of the stm32G071
or other stm32g0x devices:
for sampling time set to 1.5 or 3.5 cycles,
the sampling in a single ADC conversion or in the first
conversion of a sequence takes one extra cycle.
Minimizing to 7.5 is fine.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-04 17:32:10 +00:00
Alexandre Duchesne
b4034adec7 hal: gigadevice: Update gd32f4xx to firmware 3.0.0
Fix to support gd32f4xx update to firmware 3.0.0

Signed-off-by: Alexandre Duchesne <alexandre.duchesne@rtone.fr>
2022-07-04 18:07:51 +02:00
Chris Collins
3a0f8a3d45 drivers: usb: device: stm32: Use macros for frequencies
Rather than explicitly setting out the frequnecy in full, use the MHZ()
macro.

Signed-off-by: Chris Collins <chris@realsimgear.com>
2022-07-04 18:07:06 +02:00
Chris Collins
f1e4d7bbef drivers: usb: device: stm32: Configure USB Prescaler for F103
- If the HAL headers expose the USBPRE flag, then we're probably
  dealing with a F103 - using the same fundamental logic as the
  code for the OTG models, set-up the USB Prescaler correctly.

- Fixes #47146

Signed-off-by: Chris Collins <chris@realsimgear.com>
2022-07-04 18:07:06 +02:00
Aymeric Aillet
81cc1abe75 drivers: i2c: tca954X: Enable driver if needed
TCA954X driver was not enabled since introduction of
new compatibility fields.

We now set I2C_TCA954X depending on related "okay"
compat fields in DT.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-07-04 16:53:41 +02:00
Kumar Gala
e23fa30e7e drivers: wifi: winc1500: Update driver to use gpio_dt_spec
Simplify the implementation by using gpio_dt_spec.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 16:50:20 +02:00
Kumar Gala
a9978398f3 drivers: wifi: winc1500: use spi_dt_spec
Simplify driver implementation by using spi_dt_spec.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 16:50:20 +02:00
Thomas Stranger
eb44da9879 drivers/clock_control: stm32 g0, g4, l4, remove get_pllout_frequency()
After replacing STM32_SRC_PLLCLK by the STM32_SRC_PLL_x sources
this function is no longer needed and are therefore removed.

Also, those functions returned a wrong frequency.
They should have used get_pllsrc_frequency() instead of get_pll_source()
to get the input frequency.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
ddf3f2d735 drivers/clock_control: stm32 common allow pll also when it is not sysclk
The SOC specific implementations of the clock_stm32_ll_common driver
included the PLL specific functions only when PLL was selected as sysclock.

This commit changes the condition from "STM32_SYSCLK_SRC_PLL"
to "defined(STM32_PLL_ENABLED)".
As a result the pll could also be used as peripheral clock source
in case it is not the sysclock.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
15430252bf drivers/clock_control: stm32 common pll src support(g0,g4,l4,l5,wb,wl)
This commit adds support to select pll outputs as peripheral clock
sources to the stm32 common driver.
With this commit they are only available on
STM32G0, STM32G4, STM32L4, STM32L5, STM32WB, and STM32WL.

Support for STM32F2, and STM32F4, which also have p,q,r dividers,
is not enabled in this commit.

Also, stm32_clock_control_get_subsys_rate is extended to return
the configured frequency in case they are enabled, otherwise 0.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
c959b58bf1 drivers/clock_control: stm32 common: enable PLL_P/Q and set PLL_P div
This commit configures the PLL_P divider for SOCs compatible to the
stm32_ll_common driver in case a value was defined via a dts property.

Additionally, in case the divider value is defined in the device
tree, the respective pll output is enabled during initialization
in set_up_plls().

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
2801c9969a drivers/clock_control: fix stm32 common pll_q divider setup
In the stm32_ll_common driver the PLL_Q divider should not
be directly written to RCC->PLLCFGR->PLLQ, but should be
translated to the matching register value.
i.e. shifting the value to the correct position of the register
is not enough.

This commit makes sure the divider value taken from device tree, is
correctly translated ot the matching register register value by
converting it to a STM32CUBE LL definition LL_RCC_PLLQ_DIV_xx.

Typcial divider to register value mapping:
G0, WB, WL:
Dividers 2-8 mapped to register values 1-7(0 reserved).
G4, L4, L5:
Dividers 2,4,6,8 mapped to reg values 0,1,2,3.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
c112afa6a7 drivers/clock_control: stm32 common move pllx defines to common header
All these series share the same defines, and while they are not used
by all socs of the common-driver, this is not exptectd to lead to
any conflict.
By moving the defines they can also be used in clock_stm32_ll_common.c

Additionally, the stm32g0 pll_div define was renamed to pllm
in order to match the other series.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
d5146e65c7 dt-bindings/clock: remove STM32_SRC_CLOCK_MIN / MAX definitions
The STM32_SRC_CLOCK_MIN and STM32_SRC_CLOCK_MAX defines
are not really needed because non valid clock sources are already
filtered out by the precompiler.

Only STM32_SRC_CLOCK_MIN was used once in code and can be replaced.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Jedrzej Ciupis
8ed202b43d drivers: ieee802154: fix freeing Rx buffer
This commit fixes a bug where an already received Rx frame could not be
processed by the IEEE 802.15.4 driver.

In the current implementation, buffer is marked as free and released to
the buffer pool after `nrf_802154_buffer_free_raw` finishes executing.
However, delays caused by thread scheduling might result in a new frame
being already received and provided to the driver before
`nrf_802154_buffer_free_raw` returns. Such a situation ends in an
assertion now.

This commit changes that behavior by marking the buffer as free before
calling `nrf_802154_buffer_free_raw`.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2022-07-04 16:39:14 +02:00
Jedrzej Ciupis
c5df601ed5 drivers: ieee802154: print serialization error on nRF5340
This commit increases verbosity of serialization error handler for
nRF5340 application core. The handler prints the error code now.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2022-07-04 16:39:14 +02:00
Ryan McClelland
86bb6abbd0 adc: ads1x1x: run clangformat
run clangformat on adc_ads1x1x.c

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2022-07-04 16:28:43 +02:00
Ryan McClelland
3d7fc77678 adc: ads1x1x: macro cleanup
clean up the unique macros using existing macros

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2022-07-04 16:28:43 +02:00
Kumar Gala
123c088c4a drivers: serial: uart_native_posix: Replace use of DT_INST_LABEL
As we work to phase out devicetree 'label properties, convert
driver to just use dev->name instead of DT_INST_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 14:26:30 +00:00
Erwan Gouriou
890d42759b drivers: spi: stm32: Use 'st,stm32h7-spi' compatible input when possible
Instead of using or'ed list of Kconfig options listing the compatible
series with what can be called "stm32h7 variant", use the matching
compatible information.
This will prevent to update the driver next time that a compatible series
is ported into zephyr.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-07-04 14:23:34 +00:00
Jose Alberto Meza
b4d82289e1 drivers: spi: xec: mec172x: Reflect update device tree properties
Propagate update device tree properties.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-07-04 16:18:42 +02:00
Matthias Freese
938eae3372 drivers: gpio: ti: add gpio extender sn74hc595
Add driver for spi based gpio extender ti sn74hc595.

Signed-off-by: Matthias Freese <m.freese@web.de>
2022-07-04 16:10:37 +02:00
Aleksandar Markovic
9b0a506cf0 wifi: esp_at: Fix Coverity issues related to ESP_MAX_DNS
If the preprocessor constant ESP_MAX_DNS is defined as 0,
Coverity reports a condition that can never be true, and some
dead code as well. This also violates MISRA rules on dead code.

This is caused by this segment in drivers/wifi/esp_at/esp.h:

 #if defined(CONFIG_WIFI_ESP_AT_DNS_USE)
 #define ESP_MAX_DNS	MIN(3, CONFIG_DNS_RESOLVER_MAX_SERVERS)
 #else
 #define ESP_MAX_DNS	0
 #endif

Fix this by never setting ESP_MAX_DNS to 0, as is the currently
case. Define ESP_MAX_DNS only if it is configured through
CONFIG_WIFI_ESP_AT_DNS_USE and CONFIG_DNS_RESOLVER_MAX_SERVERS:

 #if defined(CONFIG_WIFI_ESP_AT_DNS_USE)
 #define ESP_MAX_DNS	MIN(3, CONFIG_DNS_RESOLVER_MAX_SERVERS)
 #endif

Since CONFIG_DNS_RESOLVER_MAX_SERVERS is 1 or greater, ESP_MAX_DNS
will always be greater than 0.

If, on the other hand, ESP_MAX_DNS is not defined, relevant
functions will be reduced to empty stubs, since in that case
they do not make sense.

There could be a cleaner solution to this, but this one is the
least intrusive (involves less code changes).

Coverity-CID: 219490
Coverity-CID: 219513
Coverity-CID: 219520
Coverity-CID: 219524

Signed-off-by: Aleksandar Markovic <aleksandar.markovic.sa@gmail.com>
2022-07-04 16:06:41 +02:00
Steven Lemaire
c40dc7d380 drivers: entropy: gecko: add driver using Secure Element module of EFR32
Some EFR32 SoCs use a secure element subsystem to manage
security features (i.e., TRNG, secure bootloader or cryptographic
functions).

This driver relies on the SE Manager high-level API provided by Silicon
Labs. The API interacts with the SE subsystem, provides helper functions
to achieve cryptographic operations and ensures that only one operation
is running at a time by using mutexes and semaphores.

Instead of relying on the SE Manager from Silicon Labs, one could
recreate the behaviour of the Manager and put the code in the crypto
driver folder and create a dependency for other drivers using the crypto
manager (e.g., keys, entropy).

I went for the SE Manager API as it is already there and supported by
Silicon Labs.

Tested using the random subsystem.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2022-07-04 15:47:35 +02:00
TLIG Dhaou
9a27cc3867 drivers: clock_control: clock stm32 set up the hsi div clock source
Add the hsi divider as a clock source when is ready.


Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-07-04 15:20:06 +02:00
Francois Ramu
764dbbf355 drivers: flash: stm32 ospi driver configures peripheral clock
The clock of the octospi peripheral is directly defined
by the DTS and configured by the clock_control_on function.
No specific stm32cube function is required then.
The clock control is taking this clock source to calculate
the clock rate.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-04 15:18:50 +02:00
Benjamin Björnsson
d96f361175 drivers: sensor: ens210: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-04 14:07:52 +02:00
Kumar Gala
0cb22dfa1d drivers: disk: sdmmc_stm32: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 06:40:02 -05:00
Kumar Gala
82c65315d3 drivers: ppp: Move to DTS for uart device
Move from using Kconfig NET_PPP_UART_NAME to a devicetree chosen
property ("zephyr,ppp-uart").  This is similar to a number of other
functions like "zephyr,shell-uart" or "zephyr,bt-uart".

As part of this we rework the init code a little to use
DEVICE_DT_GET for the modem gsm-ppp case.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 12:43:23 +02:00
Kumar Gala
3cbf653b0e counter: native_posix: Convert driver to use DT_INST
Rather than using a devicetree node label, utilize the driver
compat and thus DT_INST which is standard means for most drivers.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 12:42:54 +02:00
Marcin Niestroj
ec116a97cc drivers: adc: stm32: suppress stm32h7 build warning
There is a build warning of unused `adc_stm32_oversampling_ratioshift`
function: [-Werror=unused-function]. This makes twister fail, as all
warnings are treated as errors.

Fix that by ifndef'ing adc_stm32_oversampling_ratioshift().

Fixes: c57a41c5d2 ("drivers/adc: stm32: do not disable the ADC if
  resolution is unchanged")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-07-04 09:49:40 +02:00
Kumar Gala
75f44cf991 drivers: usb: usb_dc_stm32: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 09:49:29 +02:00
Kumar Gala
e70933d7dc drivers: sensor: sx9500: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 09:49:01 +02:00
Kumar Gala
5c93b3d79a drivers: sensor: sx9500: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 09:49:01 +02:00
HaiLong Yang
cd8e8f3826 drivers: adc: introduce gd32 adc driver
This driver based on single conversion mode with regular channel.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2022-07-04 09:48:32 +02:00
Kumar Gala
998c03a603 drivers: lora: sx126x: Replace use of DT_INST_LABEL
As we work to phase out devicetree 'label' properties, convert
driver to just use sx126x instead of DT_INST_LABEL for logging
purposes.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-02 18:11:10 -05:00
Jordan Yates
f12d36a51e lorawan: move REQUIRES_FULL_LIBC dependency
Move the `REQUIRES_FULL_LIBC` dependency from `config LORA` to
`config LORAWAN`. The commit that added the `select` (f590d4fa) mentions
that this is required by `loramac-node`, which is only used by LoRaWAN,
not the base LoRa code.

This results in small FLASH savings when compiling the samples, but can
result in larger savings in more complex applications:
```
// With REQUIRES_FULL_LIBC
west build -b 96b_wistrio zephyr/samples/drivers/lora/send/
[162/162] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       37708 B       128 KB     28.77%
            SRAM:        8832 B        32 KB     26.95%
        IDT_LIST:          0 GB         2 KB      0.00%

// Without REQUIRES_FULL_LIBC
[181/181] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       37444 B       128 KB     28.57%
            SRAM:        8832 B        32 KB     26.95%
        IDT_LIST:          0 GB         2 KB      0.00%
```

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-02 14:16:18 +02:00
Jeppe Odgaard
4503377cac drivers: modem: delay after each AT command
Change logic in `modem_cmd_handler_setup_cmds` and
`modem_cmd_handler_setup_cmds_nolock` to always sleep
after each sent AT command.

The issue was found using a logic analyzer while debugging 'NO CARRIER'
from a BG95 modem while being in data mode.
The reason 'NO CARRIER' occured was due to crosstalk to DTR which
terminated data mode.

The logic analyzer also revealed that without the delay the next AT
command is sent before the whole 'OK\r\n' is received. This is not
addressed in this commit.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/47082

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2022-07-02 14:15:49 +02:00
Maureen Helm
627c253cab drivers: gpio: Change DW driver to use depends on instead of select
In prepration for configuring I2C/SPI defaults at the board level,
change the DesignWare GPIO driver's clock gate option to depend on clock
control instead of selecting clock control. This breaks a Kconfig
dependency loop when adding the following to a board's
Kconfig.defconfig:

config SPI
	default y if SENSOR

There aren't any in-tree users that enable the clock gate option, so
there aren't any places in-tree that now need to enable the clock
control driver. Out-of-tree users that set CONFIG_GPIO_DW_CLOCK_GATE=y
will now also need to set CONFIG_CLOCK_CONTROL=y.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-07-02 06:03:33 -04:00
Maureen Helm
7954fab248 drivers: sensor: Use dt_compat_enabled for magnetometer drivers
In preparation for extending samples/sensor/magn_polling to support
additional magnetometer drivers, enable these drivers by default when
the sensor driver class is enabled (CONFIG_SENSOR=y) and a compatible
devicetree node is enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-07-02 06:03:33 -04:00
Maureen Helm
b789c11775 drivers: sensor: Change fxos8700 default mode from accel-only to hybrid
The fxos8700 device supports 3 modes: accelerometer-only,
magnetometer-only, or hybrid (accelerometer and magnetometer) modes. The
accelerometer-only mode is register compatible with mma8451q, mma8652fc,
and mma8653fc, which allows the fxos8700 driver to be used with these
devices as well.

Most in-tree boards can use hybrid mode because they have the fxos8700
device, therefore we change the driver default to match the common case.
For the handful of boards that have an mma86xx or mma84xx device, we
override the driver default to accelerometer-only mode. As a result, we
can enable the magn_polling sample application for the fxos8700 driver
without having to add a bunch of board-specific configuration overlays
for hybrid mode.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-07-02 06:03:33 -04:00
Maureen Helm
c969547527 drivers: i2c: Fix deprecated use of I2C_MODE_MASTER in mcux lpi2c driver
The I2C API recently updated terminology to replace "master" with
"controller", but this instance in the mcux lpi2c driver was missed.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-07-01 15:37:12 -05:00
Kumar Gala
287acdbb9d i2c: sam0: Set driver Kconfig default based on devicetree
Change Kconfig default to be based on if the devicetree has the
atmel,i2c-sam0 driver enabled.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 15:05:55 -05:00
Kumar Gala
d200321767 video: mcux_csi: Set driver Kconfig default based on devicetree
Change Kconfig default to be based on if the devicetree has the
nxp,imx-csi driver enabled.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 14:56:33 -05:00
Andrei Emeltchenko
0466ac2bb1 drivers: wncm14a2a: Remove unneeded assignment
Assignment is not needed here.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-07-01 21:36:01 +02:00
Andrei Emeltchenko
4628dc60c8 drivers: wncm14a2a: Remove setting unused error code
Function returns void.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-07-01 21:36:01 +02:00
Andrei Emeltchenko
4015b91226 drivers: wncm14a2a: Remove unused variable
Remove dead code.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-07-01 21:36:01 +02:00
Kumar Gala
51c7777529 drivers: video: ov2640: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:39:37 +00:00
Kumar Gala
32d27153ba drivers: video: ov2640: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:39:37 +00:00
Kumar Gala
745752a374 drivers: video: ov7725: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:39:20 +00:00
Kumar Gala
0d245c90ef drivers: video: ov7725: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:39:20 +00:00
Kumar Gala
d29c8a45ff drivers: video: mt9m114: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:38:55 +00:00
Benjamin Björnsson
8f1ba96b7d drivers: sensor: ism330dhcx: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 16:35:03 +00:00
Benjamin Björnsson
0fb0f1a937 drivers: sensor: ism330dhcx: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 16:35:03 +00:00
Benjamin Björnsson
a30a150a71 drivers: sensor: ism330dhcx: Change parameter of functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 16:35:03 +00:00
Benjamin Björnsson
7e943fc06e drivers: sensor: ism330dhcx: Remove unused struct
Simplify driver by removing unused struct declaration.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 16:35:03 +00:00
Jeppe Odgaard
41ff2373e1 drivers: modem: gsm: set AT+IFC if hw-flow-control is enabled
If hw-flow-control is set in the uart section of the device tree source,
it is read by gsm_ppp.c and AT+IFC=2,2 is sent to the modem.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/46928.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2022-07-01 16:32:17 +00:00
Aymeric Aillet
eaa278b305 drivers/can/rcar: Cleanup
CAN R-Car driver code cleaning by uncrustify.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-07-01 16:24:55 +00:00
Aymeric Aillet
b6701c0c45 drivers/can/rcar: Add delay to mode switching
Fix issue #45168.

When setting high bit timing, the controller is timing
out when trying to switch from an internal mode to another.
To fix this issue, we add some delay when switching modes.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-07-01 16:24:55 +00:00
Aymeric Aillet
f2a039e8bb drivers/can/rcar: Fix setting bit timing
Fix issue #45169.

With this CAN controller, changing bit timing has to be done in controller
reset mode, resetting some registers to their default values.
TCR register, that is enabling loopback mode is one of these.
Because of this reset, the controller switch back from loopback
to normal mode without the test suite being notified, preventing
receiving sent frames afterwards.

To fix this issue, we are now storing useful registers values before
switching to reset mode and restoring these values in halt mode
before going back in operation mode.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-07-01 16:24:55 +00:00
Bartosz Bilas
9c251fc9ac nxp_imx: rt: add XBARA Inter-Peripheral Crossbar Switch Kconfig option
Add missing MCUX XBARA module Kconfig option.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-01 16:23:11 +00:00
Kumar Gala
2c60426639 drivers: sensor: tmp007: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 10:20:55 -05:00
Kumar Gala
d184190863 drivers: sensor: tmp007: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 10:20:55 -05:00
Benjamin Björnsson
9d726c2226 drivers: sensor: stts751: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 09:59:28 -05:00
Benjamin Björnsson
d32d681882 drivers: sensor: stts751: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 09:59:28 -05:00
Benjamin Björnsson
a663aa4e2a drivers: sensor: stts751: Change parameter of read/write functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 09:59:28 -05:00
Benjamin Björnsson
d2aeb94630 drivers: sensor: lis2dh: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 09:34:41 -05:00
Ryan Erickson
5495dae455 drivers: modem: hl7800: Add runtime control of log level
Default mode must be debug or it can't ever be enabled.
Allow debug log messages to be printed when using
mdm_hl7800_send_at_cmd API.
Add logging to active bands and network coverage commands.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-07-01 16:30:30 +02:00
Aurelien Jarno
f00ddfeb76 drivers: sensor: stm32_temp: drop ts-cal-offset property
According to the formulas found in the reference manuals of the SoC
families using the "st,stm32-temp-cal" version of the temperature sensor
(i.e. G0, G4, H7, L0, L1, L4, L5, U5, WB, WL), the temperature is
computed with the following formula:

T = ((TS_CAL2_TEMP - TS_CAL1_TEMP) / (TS_CAL2 - TS_CAL1))
    * (TS_DATA - TS_CAL1) + TS_CAL1_TEMP

What is called ts-cal-offset in the stm32_temp driver is therefore the
same value as TS_CAL1_TEMP1. Use it directly instead of defining another
property.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-01 11:38:02 +02:00
Aurelien Jarno
52893d5f0f drivers: sensor: stm32_temp: use the ADC reference voltage
The stm32_temp driver defines the ts-voltage-mv property to determine
the reference voltage of the ADC in the temperature computation. However
this information is already available in the device tree at the ADC
level (even with the same default value). Use it through the ADC API
instead of duplicating the information.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-01 11:38:02 +02:00
Benjamin Björnsson
616f2fb36e drivers: sensor: iis3dhhc: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 11:37:24 +02:00
Benjamin Björnsson
da63820203 drivers: sensor: iis3dhhc: Remove SPI from driver data struct
Remove SPI related things from driver data struct for consistency
with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 11:37:24 +02:00
Benjamin Björnsson
e6b87cc275 drivers: sensor: iis3dhhc: Change parameter of read/write functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 11:37:24 +02:00
Dino Li
7c7611d17d it8xxx2: intc: Look for pending interrupt
The AIVECT (All Interrupt Vector Register) register provides us a quick
way to determine SOC interrupt number. But sometimes we get interrupt
number 0 from the register and caused assertion of unhandled interrupt.
To avoid the assertion, we look for all ISRs (Interrupt Status Register)
and IERs (Interrupt Enable Register) to find the highest priority pending
interrupt and return it to caller.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-07-01 11:36:55 +02:00
Ryan Erickson
bf37acc3c0 modem: hl7800: Fix socket error race condition
Using a global error flag could lead to an error on one
socket appearing as an error with a separate socket instance.
Socket errors moved into the socket context.
Continue to use global error flag for commands not
related to sockets.
For TCP sockets closed by the server, don't try and close
the socket again when offload_put is called.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-07-01 11:36:44 +02:00
Aurelien Jarno
d576b7f3d3 drivers: i2c_ll_stm32_v2: add support for second target address
The Zephyr API supports multiple I2C targets addresses, and the STM32
I2C v2 implementation allows to define up to 2 targets addresses.

This patch adds support for a second I2C target address. It adds a new
config entry in the i2c_stm32_data structure, and uses the fact that
both addresses can be enabled and disabled independently. In the
interrupt, the target being addressed is determined using the address
match code from the interrupt status register.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-01 11:35:28 +02:00
Francois Ramu
726c0ea5bd drivers: adc: stm32 internal channel for VBat measurement
It allows the path for VBATEN on stm32 series
to monitor the Vbat voltage, in case of CONFIG_STM32_VBAT
Add the common Vref value as a property of the ADC.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-01 11:34:17 +02:00
Francois Ramu
32222e07a4 drivers: sensor: add a stm32 sensor driver for the internal VBat
Similar to the internal temperature sensor of the stm32
this driver controls the Vbat monitoring in Volts,
using an ADC internal input and the stm32-vbat node of the DTS.
The ref voltage is given by the ADC.
Note that stm32F1x does not propose the feature.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-01 11:34:17 +02:00
Maxim Adelman
c9ad6dbc7e drivers: gpio: gpio_mcux_lpc: fix lost interrupts
if ISR is called for an event on pin X but
another event occurs on pin Y in between the call
to GetStatus() and ClrStatus(), pin Y event wil get
cleared without being processed

Signed-off-by: Maxim Adelman <imax@fb.com>
2022-06-30 15:19:53 -05:00
Andrzej Głąbek
0a9a638f09 drivers: gpio_nrfx: Fix handling of GPIO_DISCONNECTED
The driver returns -EIO when a pin to be disconnected was not earlier
configured as input or output, what is not in line with the GPIO API.
This commit changes the driver to return 0 in such case.
Also -EIO is incorrectly returned when an interrupt trigger cannot be
configured in the nrfx_gpiote driver. This commit corrects this value
to -EINVAL.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-06-30 18:27:33 +02:00
Kumar Gala
5f7790fc23 sensor: iis2mdc: spi: Fix use of deprecated spi_cs_control field
The gpio_dev field of struct spi_cs_control is deprecated.  The
driver was already using SPI_CONFIG_DT_INST, so we should be
using the associated gpio member of spi_cs_control.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 11:19:40 -05:00
Andrzej Głąbek
22f524d874 drivers: gpio_nrfx: Add support for gpio_port_get_direction
Add implementation of this new GPIO API function.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-06-30 18:12:54 +02:00
Kumar Gala
06bd942191 misc: ft8xx: convert to gpio_dt_spec
Convert SPI usage to `struct gpio_dt_spec`.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 04:30:21 -05:00
Kumar Gala
a2ffdaf2b9 misc: ft8xx: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 04:30:21 -05:00
Kumar Gala
e63643d212 drivers: serial: lpc11u6x: Remove DT_LABEL usage
Remove DT_LABEL usage that is needed for device_get_binding, replace
this with DEVICE_DT_GET.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 10:32:33 +02:00
Kumar Gala
78b1d950be drivers: i2c: lpc11u6x: Remove DT_LABEL usage
Remove DT_LABEL usage that is needed for device_get_binding, replace
this with DEVICE_DT_GET.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 10:32:33 +02:00
Kumar Gala
93f2fedc12 drivers: gpio: lpc11u6x: Remove DT_LABEL usage
Remove DT_LABEL usage that is needed for device_get_binding, replace
this with DEVICE_DT_GET.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 10:32:33 +02:00
Tom Burdick
88ca215eed i2c: Update API terminology
Updates the API and types to match updated I2C terminology. Replaces master
with controller and slave with target.

Updates all drivers to match the changed macros, types, and API signatures.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-06-29 17:51:31 +02:00
Kumar Gala
355da1dd84 drivers: sdhc: Rework SPI config initialization
Move to using SPI_CONFIG_DT_INST macro to initialization the
struct spi_config cfg_a.  This fixes an issue with how the old
code was initializing the deprecated fields of spi_cs_control.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-29 14:59:43 +00:00
Lucas Tamborrino
1333787d8f drivers: pwm: refactor esp32 pwm ledc driver
Use hal function for low level access.
Use device tree for hardware configuration.
Support for esp32s2.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-06-29 14:48:25 +00:00
Lucas Tamborrino
02675bbc80 dts: esp32: full ledc configuration in binding
This commit moves the hardware configuration for ledc
peripheral to the device-tree instead of Kconfig.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-06-29 14:48:25 +00:00
Aurelien Jarno
c57a41c5d2 drivers/adc: stm32: do not disable the ADC if resolution is unchanged
In case the resolution is already correct (probably the common use
case), do nothing instead of disabling the ADC.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-29 14:43:29 +00:00
Aurelien Jarno
897554bd39 drivers/adc: stm32: avoid disabling and reenabling the ADC multiple times
The ADC is currently disabled and re-enabled multiple time during each
read. Enabling the ADC is not a free operation on some series and some
internal channels like VREFINT take even longer. This patch improve the
situation by removing the calls to adc_stm32_enable(), replacing it by a
single call just before triggering the conversion.

This also open the possibility to not reconfigure the ADC if it is
already configured, implemented in the following patches.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-29 14:43:29 +00:00
Aurelien Jarno
c9d3efabe7 drivers/adc: stm32: streamline code to disable ADC
This avoid repeating (slight different) code.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-29 14:43:29 +00:00
Jamie McCrae
4e20669aa9 drivers: sensor: sm351lt: Fix global thread triggering bug
This fixes a bug in the sm351lt driver whereby global triggering will
cause an MPU fault due to an unset pointer.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2022-06-29 14:40:53 +00:00
Kumar Gala
a52f7a4e3a drivers: ieee802154: mcr20a: Remove unused variable
Since the driver uses spi_dt_spec there is no need for an explicit
spi_cs_control variable.  The variable is unused.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-29 06:02:28 -05:00
Anas Nashif
ab24be5552 drivers: timer: provide timer irq to tests
As with previous commit, make the timer irq a simple integer variable
exported by the timer driver for the benefit of this one test
(tests/kernel/context).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-06-29 10:31:00 +02:00
Andy Ross
fb3b434438 drivers: timer: update TIMER_IRQ for tests/kernel/context
This test has gotten out of control.  It has a giant #if cascade
enumerating every timer driver in the Zephyr tree and extracting its
interrupt number.  Which means that every driver needs to somehow
expose that interrupt in its platform headers or some other API.

Make it a simple integer variable exported by the timer driver for the
benefit of this one test.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-06-29 10:31:00 +02:00
Francois Ramu
80dd57a49d drivers: flash: stm32 ospi driver align erase on sector size
When erasing the flash, the size to erase must be
compared to a multiple of SECTOR_SIZE.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-06-29 10:30:04 +02:00
Dmytro Firsov
f4cea5da70 xenvm: drivers: xen: add Xen grant table driver
This commit introduces driver for granting access for own grant
table and for mapping/unmapping foreign gref. Grant tables are used
for data exchange between Xen domains via shared memory page(s) (e.g.
for sharing ring buffer with driver data) This functionality is
widely used and needed for implementing PV backend/frontend drivers.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2022-06-28 22:34:26 -04:00
Henrik Brix Andersen
a833d87994 drivers: serial: xilinx: uartps: add pinctrl support
Add pinctrl support to the Xilinx Zynq-7000/ZynqMP PS UART driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-06-28 20:46:11 +02:00
Henrik Brix Andersen
66998e7445 drivers: serial: xilinx: change prompt to reflect supported SoCs
Change the Kconfig prompt for the Xilinx Zynq-7000/ZynqMP PS UART driver to
indicate whichs SoCs it supports.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-06-28 20:46:11 +02:00
Henrik Brix Andersen
23857d9b8e drivers: pinctrl: add pinctrl driver for the Xilinx Zynq-7000
Add pinctrl driver for the Xilinx Zynq-7000 series SoCs.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-06-28 20:46:11 +02:00
Henrik Brix Andersen
ea433a4803 drivers: ethernet: xlnx: gem: do not lock/unlock the SLCRs
Do not lock/unlock the System Level Control Registers (SLCRs) in the Xilinx
GEM ethernet driver. The SLRCs are unlocked once at boot time.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-06-28 20:46:11 +02:00
Kumar Gala
02060f7f72 sensor: pms7003: Convert to DEVICE_DT_GET
Move to using DEVICE_DT_GET so we can phase out DT_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 13:54:32 -04:00
Kumar Gala
5d8f958b4e sensor: pms7003: Fix compile errors with driver
We get type mismatch errors because of use of K_MSEC.  As the timeout
is defined in terms of milliseconds and k_uptime_get() returns
milliseconds we can just remove K_MSEC usage.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 13:54:32 -04:00
Aymeric Aillet
9a7040303a drivers: clock: rcar: Rename global includes file
Rename r-car clock driver global include file
in order to match other files names.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-06-28 18:11:44 +02:00
Aymeric Aillet
14ff2b1f88 drivers: clock: rcar: Deploy a driver for each soc
This commit rewrite renesas R-Car clock driver in order
to be able to support any new SoC easier.

This work is so creating a clock driver per soc alongside a
common driver for all reneasas r-car boars.

- drivers: create a driver per soc
  - create a common driver
  - create a common header used by soc & common driver
  - create a soc specific driver calling for common driver

- dts: use new compatible
  - use old yaml as common yaml
  - create a new "child" yaml to define the new compatible field
  - change compatible in device tree

As in Linux, the driver can support both r8a77951 and r8a77950
SoC's so we decided to name the new driver as in Linux with Zephyr
prefix : "clock_control_r8a7795_cpg_mssr.c".

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-06-28 18:11:44 +02:00
Aymeric Aillet
d8f66b7343 dts: rcar: Rework clock definition
This commit is reworking clock definition in
order to match linux filetree and definition
as much as possible.

- dt-bindings: rework renesas clocks dt-bindings
  - regroup renesas related dt-bindings in a folder
  - rename renesas rcar common dt-binding to match linux name
  - add soc specific dt-binding matching linux name
  - soc dt-bindings are defining clocks matching linux names

- dts: use new clocks names
  - move clocks definitions in SoC layer for each core clock entry

- driver: use new clocks names

As seen in this commit, we are declaring clocks for "R8A7795" SoC
to match linux names.
Linux is not declaring "R8A77951" SoC specific files because
its also supporting the first H3 SoC version numbered "R8A77950".

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-06-28 18:11:44 +02:00
Jeppe Odgaard
8d71e8f5de drivers: led_strip: ws2812: allow settings cpol and cpha
Some boards require settings cpol and/or cpha.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/44980
2022-06-28 16:50:26 +02:00
Gerard Marull-Paretas
88f9039747 drivers: pwm: b91: fix non-local headers include
pwm.h and clock.h are HAL headers, so use <> instead of "" (for locals).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-28 16:17:46 +02:00
Gerard Marull-Paretas
4324974281 drivers: pwm: b91: fix multi-instance support
Driver was in a weird state: it made use of
DT_INST_FOREACH_STATUS_OKAY, however, it had an assertion to support a
single instance and used instance 0 properties.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-28 16:17:46 +02:00
Kumar Gala
97f0570c67 drivers: sensor: vcnl4040: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Added check to vcnl4040_trigger_set to handle case of trigger
mode enabled but the devicetree doesn't have an int_gpios property.

Also, moved up the checking/handling of gpio port device in
vcnl4040_trigger_init so that if we error out its before we
setup any threads and such.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 08:22:24 -05:00
Kumar Gala
a31c6070de drivers: sensor: vcnl4040: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 08:22:24 -05:00
Khor Swee Aun
04b7e8ed15 drivers: serial: uart_altera_jtag: Fix wrong register address used
Fix wrong control register address used in uart_altera_jtag_init
function which caused memory corruption.

Signed-off-by: Khor Swee Aun <swee.aun.khor@intel.com>
2022-06-28 07:34:29 -04:00
Kumar Gala
9dfbae0ba5 wifi: eswifi: Convert to DEVICE_DT_GET
Move to using DEVICE_DT_GET so we can phase out DT_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 11:09:03 +02:00
Benjamin Björnsson
6318d29035 drivers: sensor: max17055: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-28 11:07:57 +02:00
Benjamin Björnsson
805ad30324 drivers: sensor: max17055: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-28 11:07:57 +02:00
Kumar Gala
ed738ed096 drivers: sensor: ti_hdc: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for DRDY GPIO handling.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 11:07:50 +02:00
Kumar Gala
c738c99b33 drivers: sensor: ti_hdc: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 11:07:50 +02:00
Erwan Gouriou
bced529f78 include: stm32: clock_control: Ease usage of STM32_DT_CLOCKS macro
STM32_DT_CLOCKS was designed to take a device tree node label name as
argument: STM32_DT_CLOCKS(uart1)
Change its implementation to take a node identifier instead:
STM32_DT_CLOCKS(DT_NODELABEL(uart1)).

This make its usage more flexible since the argument can now be extracted
from other DT macros such as DT_PARENT. Then, the following can be done:
STM32_DT_CLOCKS(DT_PARENT(child_node_label)).

Since it is now possible implement STM32_DT_INST_CLOCKS using
STM32_DT_CLOCKS.

Finally, update existing STM32_DT_CLOCKS users and convert
STM32_INST_CLOCK_INFO users to STM32_CLOCK_INFO.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-06-28 11:07:29 +02:00
Huifeng Zhang
eb949061ce drivers: timer: arm_arch_timer: assign a initial value to last_cycle
On FVP platform, when parameter 'bp.refcounter.use_real_time' is set
to 1, cntvct_el0 isn't count from 0 and may cause overflow issue in
first timer compare interrupt.

'bp.refcounter.use_real_time' is 0 by default.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2022-06-28 11:06:31 +02:00
Huifeng Zhang
79d076be7f drivers: timer: arm_arch_timer: Fix round up issue
Fast hardware with slow timer hardware can trigger and enter an
interrupt and reach 'sys_clock_set_timeout' before the counter has
advanced.

That defeats the "round up" logic such that we end up scheduling
timeouts a tick too soon (e.g. if the kernel requests an interrupt
at the "X" tick, we would end up computing a comparator value
representing the "X-1" tick!).

Choose the bigger one between 1 and "curr_cycle - last_cycle" to
correct.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2022-06-28 11:06:31 +02:00
Loris Schmit
e1c2f2cfb6 drivers: mpu9250: magnetometer data read fix
The magnetometer data read from AK9863 is assumed to be big endian
(like the accelerometer & gyroscope data).
However it is in little endian, which means the appropriate byteorder
function is sys_le16_to_cpu().
See the MPU925 register map:
https://3cfeqx1hf82y3xcoull08ihx-wpengine.netdna-ssl.com/wp-content/uploads/2017/11/RM-MPU-9250A-00-v1.6.pdf
At 5.6 HXL to HZH: Measurement Data

Signed-off-by: Loris Schmit <loris.schmit@inovex.de>
2022-06-28 11:06:06 +02:00
Erwan Gouriou
343fdddfdd drivers: i2c: stm32: Use device tree as single source of compatibility
Some text in help section was documenting the compatibility of driver
variants with stm32 series.
This is duplicate of information versus device tree which should be
used as single source of information for hardware description.
Remove these lines, so we don't have to touch this driver each time
a series is added.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-06-27 15:43:14 -05:00
Benjamin Björnsson
8f5d247a71 drivers: sensor: sm351lt: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:59:53 -05:00
Benjamin Björnsson
935bf6fa25 drivers: sensor: sm351lt: Move variable declaration
Move variable declaration inside if-def to remove compiler
warning when building the driver without trigger.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:59:53 -05:00
Benjamin Björnsson
3e4e4eaf75 drivers: sensor: si7060: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:57:34 -05:00
Benjamin Björnsson
0f7751049f drivers: sensor: si7060: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:57:34 -05:00
Benjamin Björnsson
4e30743d28 drivers: sensor: si7055: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:49:45 -05:00
Benjamin Björnsson
7937345afd drivers: sensor: si7055: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:49:45 -05:00
Benjamin Björnsson
00fac1e91b drivers: sensor: si7006: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:48:06 -05:00
Benjamin Björnsson
f8aef61793 drivers: sensor: si7006: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:48:06 -05:00
Benjamin Björnsson
5eb99ac36c drivers: sensor: shtcx: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:46:06 -05:00
Benjamin Björnsson
dd5cf763ab drivers: sensor: shtcx: Remove wrapper functions
Remove wrapper functions for getting i2c bus and i2c bus
address. This is done here to make it easier to move this
driver to i2c_dt_spec while still having clear separation
between commits.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:46:06 -05:00
Benjamin Björnsson
fa75491aca drivers: sensor: sht3xd: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:43:51 -05:00
Benjamin Björnsson
238d5ad291 drivers: sensor: sbs_gauge: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:40:19 -05:00
Benjamin Björnsson
04ce7bca33 drivers: sensor: opt3001: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:38:56 -05:00
Benjamin Björnsson
b4b02c1b42 drivers: sensor: opt3001: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:38:56 -05:00
Benjamin Björnsson
e3e1bd19a3 drivers: sensor: ms5837: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:36:31 -05:00
Benjamin Björnsson
762db471c0 drivers: sensor: ms5837: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:36:31 -05:00
Benjamin Björnsson
96b460d546 drivers: sensor: mpr: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:34:13 -05:00
Benjamin Björnsson
e84aa19c86 drivers: sensor: mpu6050: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:31:14 -05:00
Benjamin Björnsson
62c4cf91e6 drivers: sensor: mpu6050: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:31:14 -05:00
Benjamin Björnsson
9d8f852729 drivers: sensor: mcp9808: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:28:20 -05:00
Benjamin Björnsson
34238059a5 drivers: sensor: mcp9808: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:28:20 -05:00
Benjamin Björnsson
ba90450974 drivers: sensor: max44009: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:23:48 -05:00
Benjamin Björnsson
c4ac3613fb drivers: sensor: max44009: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:23:48 -05:00
Benjamin Björnsson
220d136235 drivers: sensor: max30101: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:20:09 -05:00
Benjamin Björnsson
00e22733a1 drivers: sensor: max17262: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:18:27 -05:00
Benjamin Björnsson
c71ee90ec2 drivers: sensor: isl29035: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:10:44 -05:00
Benjamin Björnsson
6c8161a00d drivers: sensor: isl29035: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:10:44 -05:00
Benjamin Björnsson
1e51107577 drivers: sensor: isl29035: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:10:44 -05:00
Kumar Gala
892b43f038 drivers: sensor: th02: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-27 10:01:59 -05:00
Kumar Gala
1f34441c2d drivers: sensor: wsen_itds: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.  Since
the driver can support multiple instances its possible that some
have irq's in dts and some don't.  So we add a check in
itds_trigger_set to make sure we have a GPIO device if we are
trying to set a trigger.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-27 09:47:06 -05:00
Kumar Gala
ce41b3c82f drivers: sensor: wsen_itds: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-27 09:47:06 -05:00
Benjamin Björnsson
dbff3f0124 drivers: sensor: lsm6ds0: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 09:42:55 -05:00
Benjamin Björnsson
45b70fc8cf drivers: sensor: lsm303dlhc_magn: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 09:40:16 -05:00
Benjamin Björnsson
129e7d5cda drivers: sensor: lsm9ds0_gyro: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 09:38:06 -05:00
Benjamin Björnsson
2710355553 drivers: sensor: lsm9ds0_gyro: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 09:38:06 -05:00
Benjamin Björnsson
bbd7b3fe72 drivers: sensor: lsm9ds0_gyro: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 09:38:06 -05:00
Benjamin Björnsson
d35c55d437 drivers: sensor: lps22hb: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 09:34:37 -05:00
Benjamin Björnsson
692b0ead74 drivers: sensor: lsm9ds0_mfd: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 12:47:44 +02:00
Ederson de Souza
b56088ba6d drivers/clock_control: Add cAVS clock driver
Simple driver that allows one to choose the clock speed of xtensa cores.
It's basically a shim layer on top of SOC level driver.
Also, a really simple test case was added, mainly to ensure things are
build and are sane.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-06-27 12:42:04 +02:00
Benjamin Björnsson
1a0159518b drivers: sensor: lsm6dsl: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-24 20:29:54 +02:00
Benjamin Björnsson
07587e7826 drivers: sensor: lsm6dsl: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-24 20:29:54 +02:00
Benjamin Björnsson
bae6af4acc drivers: sensor: lsm6dsl: Remove unused variable and label
Remove variable and label that are not used to remove compiler
warnings.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-24 20:29:54 +02:00
Benjamin Björnsson
20b1fdb39c drivers: sensor: lm75: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-24 20:29:46 +02:00
Aurelien Jarno
b2f969e562 drivers: usb: device: stm32: only disable the ULPI clock for USB FS
On SoCs with two USB controller, Zephyr selects the FS one, and in that
case the ULPI clock needs to be disabled in sleep mode for the
controller to work.

On SoCs with a single USB HS controller, this operation is not needed.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-24 20:25:52 +02:00
Aurelien Jarno
e19be674fc drivers: usb: device: stm32: fix disabling the ULPI clock on STM32H7X
The ULPI clock uses slightly different names on STM32H7X as those
SoC can have more than one USB controller.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-24 20:25:52 +02:00
Aurelien Jarno
a9f044e0d2 drivers: usb: device: stm32: fix a wrong comment STM32H7X and ULPI clock
On STM32H7X SoCs, both USB controllers are HS capable, however it is not
possible to connect an ULPI PHY to the USB2 one, which limit it to FS.
Therefore the ULPI clock in sleep mode has to be disabled for USB2 in
all cases. The ULPI clock for USB1 is already disabled when needed in
the usb_dc_stm32_clock_enable() function like for other SoCs.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-24 20:25:52 +02:00
Aurelien Jarno
58674926a9 drivers: usb: device: stm32: do not manually enable the clock on STM32H7
Do not manually enable the USB clock on STM32H7, as it is already done
in usb_dc_stm32_clock_enable() using the values in the device tree.

This partially fixes the build for STM32H7 devices with a single USB
controller.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-24 20:25:52 +02:00
Aurelien Jarno
278bf9883f drivers: usb: device: stm32: do not disable ULPI clock in run mode
The ULPI clock is disabled by default in run mode, there is no need to
disable it again. It is however enabled by default in sleep/low power
mode, so it needs to be disabled.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-24 20:25:52 +02:00
Alex Kolosov
ef418aab40 drivers: serial: telink_b91: fix uart unknown state after boot from mcuboot
mcuboot may use a uart as logger. After application boot from mcuboot,
uart remains in some unknown state. It could leads to some unpredictable
uart behaviour. This commit fixes the issue by resetting of uart state
at the beginning of uart init.

Signed-off-by: Alex Kolosov <rikorsev@gmail.com>
2022-06-24 20:25:33 +02:00
Christopher Friedt
f88264d7ca drivers: gpio: mcux: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt
00004fb976 drivers: gpio: sifive: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt
1d823c77c9 drivers: gpio: litex: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt
22d2fc1e64 drivers: gpio: eos_s3: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt
3f96752005 drivers: gpio: cc13xx_cc26xx: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt
9526437e64 drivers: gpio_emul: support gpio_port_get_direction
Support querying the direction of emulated GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt
27c431ff7e api: gpio: add gpio direction query functions and driver api
Some services require the ability to query whether a GPIO pin
is configured as an input, output, both, or neither prior to
performing any operations at the service level. This is done
in order to reduce state tracking within the service.

To that end, this change adds
* `gpio_port_get_direction()`
* `gpio_pin_is_input()`, and
* `gpio_pin_is_output()`

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Benjamin Björnsson
d4f00fe3c4 drivers: sensor: ccs811: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:52:26 -05:00
Benjamin Björnsson
3ac870b03b drivers: sensor: ccs811: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:52:26 -05:00
Benjamin Björnsson
15aefccf17 drivers: sensor: ccs811: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:52:26 -05:00
Benjamin Björnsson
3b2f21e291 drivers: sensor: bmi270: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:46:01 -05:00
Benjamin Björnsson
fc7e67966a drivers: sensor: bmi270: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:46:01 -05:00
Benjamin Björnsson
8c2a6e34a8 drivers: sensor: bmc150_magn: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:40:03 -05:00
Benjamin Björnsson
c145539b54 drivers: sensor: bmc150_magn: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:40:03 -05:00
Benjamin Björnsson
f06ea0e12e drivers: sensor: dht: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:34:28 -05:00
Benjamin Björnsson
4edf96d40b drivers: sensor: dps310: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:32:19 -05:00
Benjamin Björnsson
481fe82fa9 drivers: sensor: dps310: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:32:19 -05:00
Benjamin Björnsson
b22c6a8867 drivers: sensor: hmc5883l: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:24:43 -05:00
Benjamin Björnsson
be1e512aad drivers: sensor: hmc5883l: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:24:43 -05:00
Benjamin Björnsson
d4731daaf6 drivers: sensor: lps25hb: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 15:46:00 -05:00
Dmytro Firsov
d48f99f01f xenvm: evtchn: fix undefined value during event handling
This commit fixes issue with undefined value during position calculations.
Shift for positions may be >32, so we need to explicitly use unsigned long
casting to prevent unexpected behavior during event handling.

Thanks @jgrall for suggestion.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2022-06-23 13:09:40 -04:00
Dmytro Firsov
5f4fd311fc xenvm: evtchn: use proper barrier during events handling
This commit fixes barrier usage in Xen event channel driver. Previously
compiler_barrier() was used and it did not prevent processor from
re-ordering of the write operations, that is needed for correct event
handling. It is now changed to data memory barrier (dmb()), which will
work as expected in this situation.

Thanks @jgrall for suggestion.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2022-06-23 13:09:40 -04:00
Maximilian Deubel
1c1c72ea08 ADXL362: Add separate activity/inactivity triggers
This patch modifies the ADXL362 driver to use the new
SENSOR_TRIG_MOTION trigger for activity detection
and SENSOR_TRIG_STATIONARY for inactivity detection.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2022-06-23 10:28:34 -05:00
Krzysztof Chruscinski
041f0e5379 all: logging: Remove log_strdup function
Logging v1 has been removed and log_strdup wrapper function is no
longer needed. Removing the function and its use in the tree.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 13:42:23 +02:00
Francois Ramu
7f10bd6340 drivers: flash: stm32 qspi driver setting dma priority
This adds a table to set the dma channel priority from the DTS
The config bits are converted through the table_priority
to match the DMA_Priority_level of the stm32cube HAL.
Fixes #46725

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-06-23 09:11:15 +02:00
John Kjellberg
27179a53f8 drivers/disk: sdmmc: Fix build for STM32F4
Closes #46734

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>
2022-06-23 09:10:43 +02:00
Abramo Bagnara
d1d5acd2cd coding guidelines: comply with MISRA C:2012 Rule 8.2
MISRA C:2012 Rule 8.2 (Function types shall be in prototype form with
named parameters.)

Added missing parameter names.

Signed-off-by: Abramo Bagnara <abramo.bagnara@bugseng.com>
2022-06-22 17:17:39 -04:00
Dmytro Firsov
a76b492f04 xenvm: evtchn: expand Xen event channel driver functionality
This commit adds new functions, which can be used for Xen event channel
management (allocation, interdomain binding etc.). Such functionality
is needed for Xen PV driver development in Zephyr.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2022-06-22 17:53:45 +02:00
Benjamin Björnsson
73ca3c72bc drivers: sensor: adxl345: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 14:37:07 +02:00
Benjamin Björnsson
82901bd563 drivers: sensor: fxos8700: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 12:27:17 +02:00
Benjamin Björnsson
47b3e65290 drivers: sensor: fxos8700: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 12:27:17 +02:00
Benjamin Björnsson
1e44af1e2c drivers: sensor: lis3mdl: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 12:27:02 +02:00
Benjamin Björnsson
37b59c3427 drivers: sensor: lis3mdl: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 12:27:02 +02:00
Benjamin Björnsson
e06359f616 drivers: sensor: fxas21002: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 12:25:52 +02:00
Benjamin Björnsson
5f4be73ba0 drivers: sensor: fxas21002: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 12:25:52 +02:00
Martin Jäger
1bd9e366be drivers: can: stm32: support for dual CAN instances
CAN1 and CAN2 share the memory for the filter banks.

This commit adds an offset for filters installed for CAN2, allowing to
use both CAN instances simultaneously.

The hardware allows to freely split the avalable 28 filters between
CAN1 and CAN2. In order to simplify the driver implementation, it only
supports an equal split of 14 filters per instance. This is the same
amount of filters as available in MCUs with only a single CAN.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-06-22 12:25:26 +02:00
Martin Jäger
c02454ef03 drivers: can: stm32: rework internal functions
Remove two functions which were only called from one place and did
not improve readibility of the code.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-06-22 12:25:26 +02:00
Martin Jäger
b666afa13e drivers: can: stm32: use DT_INST_FOREACH for driver setup
This commit unifies the driver initialization for can1 and can2
instances so that a single macro can be used.

Enabling the master clock for can2 as introduced in 8ab81b02 had to
be moved to devicetree in order to have the same CAN_STM32_CONFIG_INST
macro for all instances.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-06-22 12:25:26 +02:00
Wojciech Slenska
e757f188c8 drivers: serial: atmel_sam: Added hw flow control
Patch added hw flow control to usart driver

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2022-06-22 12:24:22 +02:00
Henrik Brix Andersen
b7624bc5cf drivers: i2c: mcux: lpi2c: add bus recovery support
Add I2C bus recovery support to the NXP MCUX LPI2C driver. Since the LPI2C
peripheral block does not natively support I2C bus recovery, recovery is
performed using GPIO bitbanging.

Fixes: #42574

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-06-22 12:24:08 +02:00
Gerard Marull-Paretas
4946a15f15 soc: arm: gigadevice: use common API headers
Stop relying on <soc.h> to access HAL APIs. Use generic, per-API headers
instead. Note that <soc.h> has been left as is for now, since ARM MPU
relies on a fragile chain of includes/type definitions.

This change should improve compilation efficiency, as we no longer pull
APIs that are not needed. A similar approach is followed by STM32
drivers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-06-22 18:41:19 +09:00
Andrei Emeltchenko
662cea4638 edac: shell: Update Copyright to 2022
Update Copyright.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-06-22 10:28:44 +03:00
Andrei Emeltchenko
8390ae5d70 edac: shell: Do not show error on ENODATA
In a case with ENODATA do not show error.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-06-22 10:28:44 +03:00
Andrei Emeltchenko
d0d87a213b edac: shell: Refactor edac shell
Removing code duplicates.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-06-22 10:28:44 +03:00
Andrei Emeltchenko
75eba3fdb9 edac: shell: Update edac shell comments
Update edac shell comments reflecting devmem move from edac to a
special shell module.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-06-22 10:28:44 +03:00
Andrei Emeltchenko
179cf801c3 edac: ibecc: Exclude logging lcov branch
Make code 100% lcov covered.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-06-22 10:28:44 +03:00
Andrei Emeltchenko
0caed0e5e7 edac: ibecc: Remove outdated comments
The issue with logging is fixed in PR #31535

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-06-22 10:28:44 +03:00
Maximilian Deubel
ad3d8e8581 ADXL362: fix write to FIFO_SAMPLES register
This patch removes a superfluous write to the INTMAP1 register
that happens because the byte count was previously wrong.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2022-06-21 10:48:52 +02:00
Thomas Stranger
8891943117 drivers/clock_control: stm32: clock_control_on: check cc-sub_system
This commit adds a check for the validity of the "sub_system" param in
clock_control_on.

While for clock_control_off there was a check if the clock_subsytem
parameter is in range of STM32_PERIPH_BUS_MIN and STM32_PERIPH_BUS_MAX
this check was missing for clock_control_on.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-06-21 10:48:46 +02:00
Jun Lin
d4a5203c18 driver: adc: npcx: prevent sleep when ADC is operating
Entering deep sleep mode stops the source clock of the ADC module and
could corrupt the ongoing ADC conversion. This commit lets ADC driver
acquire the PM lock during the ADC operation (either single conversion
or repetitive scan) and release it when the ADC conversion stops.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-06-21 10:47:15 +02:00
TLIG Dhaou
cefd74f044 drivers: can: stm32: fix return type missed
the return is missing at the end of function which causes compilation
warning and block the build on github.
"warning: control reaches end of non-void function [-Wreturn-type]
   92 | }| ^"

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-06-20 11:34:18 -04:00
Benjamin Björnsson
0f62594f65 drivers: sensor: ens210: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-20 08:46:01 -05:00
Benjamin Björnsson
5afcea07b2 drivers: sensor: ens210: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-20 08:46:01 -05:00
Kumar Gala
e3f991b7b8 drivers: sensor: ams_iAQcore: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-20 08:25:32 -05:00
Benjamin Björnsson
6cff868c70 drivers: sensor: fdc2x1x: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-20 08:18:55 -05:00
Benjamin Björnsson
9bb7c9771f drivers: sensor: fdc2x1x: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-20 08:18:55 -05:00
Aurelien Jarno
e245a213df drivers: flash: stm32h7x: simplify wait_write_queue()
wait_write_queue() get passed a device and an offset to compute the
sector number and verify it is valid. However both operations are
already done by the caller, so let's pass directly the
flash_stm32_sector_t value instead.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-20 09:18:23 -04:00
Aurelien Jarno
c337b9f80b drivers: flash: stm32h7x: use barriers to ensure the writes are flushed
The STM32H7 flash driver read-back a register after writing it to ensure
it is flushed. This is very fragile and might break if a new compiler
version slightly reorder the instructions. Instead use a __DSB()
barrier like done on other STM32 SoC, which ensures that the registers
and the data writes are flushed at the compiler level, but also at the
Cortex-M7 level.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-20 09:18:23 -04:00
Aurelien Jarno
67bceb0257 drivers: flash: stm32h7x: use max-erase-time instead of hard-coded timeout
As the erase time for a sector differs by a few order of magnitude for the
various SoCs of the STM32H7 family, use the just added max-erase-time
property from the device tree instead of the hard-coded 4 seconds value.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-20 09:18:23 -04:00
Stephanos Ioannidis
11d27f12ad drivers: gpio_esp32: Drop IRAM_ATTR from forward declarations
This commit drops the `IRAM_ATTR` macro from the function declarations
because:

1. `IRAM_ATTR` macro makes use of the `__COUNTER__` preprocessor macro,
   which increments for every macro invocation and causes the section
   specified in the forward declaration to not match that of the
   function definition.

2. Section attributes need not be specified for forward declarations.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-20 10:28:06 +02:00
Tim Lin
19724ba002 ITE: drivers/i2c: Enable I2C interrupt after completing configuration
Fix the flow of I2C enable interrupt. We should enable the interrupt
after I2C configuration is completed to avoid pending interrupts and
cause errors irq.

Test port:
i2c_ite_it8xxx2: i2c0
i2c_ite_enhance: i2c4
Test:
tests\drivers\i2c\i2c_api --> pass

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-06-20 10:24:27 +02:00
Benjamin Björnsson
534988ffcf drivers: sensor: bmm150: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 11:09:19 -05:00
Dan Higginbotham
922e83ecf9 drivers/clock_control: stm32_common: Fixed PLL configuration
-Kept getting an error on STM32g0xx chips that didn't have q-divisor.
-Changed to set prescaler only if it's being used.

Signed-off-by: Dan Higginbotham <daniel@dedesignworks.com>
2022-06-17 10:36:54 -05:00
Benjamin Björnsson
94861280f6 drivers: sensor: bq274xx: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 08:52:44 -05:00
Benjamin Björnsson
0c42b0f1a6 drivers: sensor: bq274xx: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 08:52:44 -05:00
Benjamin Björnsson
4974a2d165 drivers: sensor: bmg160: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 08:48:40 -05:00
Benjamin Björnsson
0db8f22892 drivers: sensor: bmg160: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 08:48:40 -05:00
Benjamin Björnsson
67d53d9232 drivers: sensor: bma280: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for gpio access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 10:18:16 +02:00
Benjamin Björnsson
3be45afe79 drivers: sensor: bma280: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 10:18:16 +02:00
Stephanos Ioannidis
745b7d202e drivers: i2c: Fix infinite recursion in driver unregister function
This commit fixes an infinite recusion in the
`z_vrfy_i2c_slave_driver_unregister` function.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-17 02:19:51 +09:00
Kumar Gala
7a9a5f525f drivers: sensor: apds9960: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-16 10:51:42 -05:00
Kumar Gala
cf947c5b13 drivers: sensor: apds9960: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-16 10:51:42 -05:00
Kumar Gala
fa74cadbf0 drivers: sensor: hp206c: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Also removed unused gpio.h header include.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-16 10:37:59 -05:00
Kumar Gala
ef6146d802 drivers: sensor: adt7420: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-16 10:35:48 -05:00
Kumar Gala
6563245300 drivers: sensor: adt7420: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-16 10:35:48 -05:00
Aurelien Jarno
6209f4cb6e drivers: clock_control: stm32h7: wait for VOS change
After changing the voltage scale, wait for it to be applied before
returning.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-16 11:26:35 +02:00
Gerard Marull-Paretas
bd39b63760 drivers: can: stm32: use clock control API for FDCAN driver
The FDCAN clock was being enabled using HAL APIs instead of the generic
clock control API.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-16 11:26:18 +02:00
Georgij Cernysiov
bf974902bf drivers: flash: stm32: ospi: writing single, dual and quad modes
Support writing to NOR-Flash over OSPI using
the following modes:

* 1-1-1
* 1-1-4
* 1-4-4

Supports 4-Byte opcodes conversion for write opcodes.

Allows users to set what write/program opcode is used
in the DTS (not for OPI mode).
Will use some default PP opcodes based on the mode.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-06-16 10:29:15 +02:00
Georgij Cernysiov
f278db7071 drivers: flash: stm32: ospi: support SFDP quad enable requirements
Adds support for `quad enable requirements` DTS property.

Parses SFDP:BFP DW15 (QER related) and uses it (if available),
it bypasses the DTS property.

Automatically enables quad mode (if required).

Supports every DW15 QER modes.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-06-16 10:29:15 +02:00
Georgij Cernysiov
871ded0e65 drivers: flash: stm32: ospi: read/erase single, dual and quad modes
Adds support to read and erase NOR-Flash over OSPI using
the following modes:

* 1-1-2
* 1-2-2
* 1-1-4
* 1-4-4

Supports 4-Byte opcodes conversion and gets address width
from the SFDP:BFP.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-06-16 10:29:15 +02:00
Georgij Cernysiov
e6ec77a243 drivers: flash: spi_nor: adds missing PP and Read cmd defines
Adds:
* PP and Read 4-Byte command defines
* PP 1-1-2 define
* Missing 1-2-2 (0xBB) and Read Fast (0x0B) command defines

Re-arranges the commands so that they stay in order.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-06-16 10:29:15 +02:00
Benedikt Schmidt
36b9da8874 drivers/disk: sdmmc: stm32: configurable SDMMC bus width
Make the SDMMC bus width for STM32 configurable.
Fixes #45021.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2022-06-16 10:28:26 +02:00
Kumar Gala
f78a081066 drivers: ethernet: dsa_ksz8xxx: use NET_DEVICE_DT_DEFINE_INSTANCE
Move to using NET_DEVICE_DT_DEFINE_INSTANCE instead of
NET_DEVICE_INIT_INSTANCE as the driver is devicetree based and it
lets us remove DT_LABEL usage in the driver itself.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-15 17:05:33 -05:00
Thomas Stranger
38b23fd825 drivers: shtc3: fix normal mode measurement time.
The measurement time in normal mode was too short.
With this commit the maximum value of the datasheet is applied.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-06-15 17:02:27 -05:00
Gerard Marull-Paretas
985bdcd076 drivers: serial: ns16550: simplify reg-shift code
The driver supported getting register shift from Devicetree, from a
custom definition in SoC headers (fragile) or, it took a default value.
This change simplifies things by making reg-shift property required in
all instances.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-15 16:59:02 -05:00
Piotr Binkowski
5774228819 drivers: serial: sam0: fix baudrate assignment to config_cache in init
Fix baudrate field assignment in config_cache in uart_sam0_init

Signed-off-by: Piotr Binkowski <p.binkowski@cthings.co>
2022-06-15 16:57:57 -05:00
Martin Jäger
8ab81b02dd drivers: can: stm32: enable can1 clock also for can2
For devices with more than one CAN peripherals, CAN1 is the master and
its clock has to be enabled also if only CAN2 is used.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-06-15 09:13:34 +02:00
Gerard Marull-Paretas
fd2052d524 drivers: remove redundant <zephyr/zephyr.h> includes
Files including <zephyr/kernel.h> do not have to include
<zephyr/zephyr.h>, a shim to <zephyr/kernel.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-15 09:13:11 +02:00
Abramo Bagnara
ada9ca4c93 coding guidelines: comply with MISRA C:2012 Rule 7.2
MISRA C:2012 Rule 7.2 (A `u' or `U' suffix shall be applied to all
integer constants that are represented in an unsigned type)

Added missing `U' suffixes in constants that are involved in the
analyzed build, plus a few more not to introduce inconsistencies
with respect to nearby constants that are either unused in the
build (but implicitly unsigned) or are used and are immediately
converted to unsigned.

Signed-off-by: Abramo Bagnara <abramo.bagnara@bugseng.com>
2022-06-14 13:36:14 -04:00
Kumar Gala
61c2b35335 drivers: sensor: amg88xx: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-14 09:21:21 -05:00
Kumar Gala
1fbc9632c1 drivers: sensor: amg88xx: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-14 09:21:21 -05:00
Luca Fancellu
58efbc6f4f drivers: xen: keep track of missed events on event channels
The current implementation for events channel is using an empty
callback for every unbind channel and the interrupt is clearing
every event and calling the callback.
However in a scenario where a domain fires a notification when
another has not yet bind the channel, the event will be missed.

To address this limitation, this commit is keeping track of
missed event channel notification when the empty callback is
used, a function to retrieve and clear the missed event is
introduced.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
2022-06-14 09:31:03 +02:00
Jedrzej Ciupis
847f68ae10 drivers: ieee802154: nrf: set TX power selectively
This commit extends Nordic's ieee802154 driver with the possibility to
set Tx power for every transmission separately.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2022-06-14 09:30:43 +02:00
Jedrzej Ciupis
644da741f4 net: pkt: add IEEE 802.15.4 TX power field
This commit extends the `struct net_pkt` structure with
`ieee802154_txpwr` field that contains signed value of the desired
transmission power of a IEEE 802.15.4 frame in dBm.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2022-06-14 09:30:43 +02:00
Anas Nashif
2d87948818 drivers: ipm/spi/intc: remove Intel S1000 support
Remove intel_s1000_crb support. The board is no longer available or
supported in the zephyr tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-06-13 16:19:51 -04:00
Anas Nashif
8d04b86dc6 pinmux: remove s1000 i2s driver
Remove intel_s1000_crb pinmux driver. The board is no longer available
or supported in the zephyr tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-06-13 16:19:51 -04:00
Anas Nashif
fa843d308e i2s: remove s1000 i2s driver
Remove intel_s1000_crb drivers. The board is no longer available or
supported in the zephyr tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-06-13 16:19:51 -04:00
Keith Packard
c4d71b3fc0 drivers/flash: Use array instead of char for _ram_code_start
When defined as 'char', the compiler notices that the memcpy targeting that
address will write more than one byte which generates a warning. Use an
array instead so that the compiler doesn't assume a specific size.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-14 01:50:36 +09:00
Keith Packard
7c6fe0735d drivers/adxl372: Fix computation of sensor value
Sensor value computation was creating a 64-bit integer value, passing
that to 'abs' and assigning that to an int32_t result and then sanity
checking the result. If the computation goes badly wrong, then the range
reduction of 64-bit to 32-bit values could generate a falsely in-range
value.

Instead, perform the computation in 64-bits, range check that value and
then assign to a 32-bit variable.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-14 01:50:36 +09:00
Keith Packard
0970cda906 drivers: Report correct errno in uart_native_posix driver
This driver carefully saved the errno value from the failing call and
then didn't use it in the ERROR report, using the potentially invalid
current errno value (which may have been set by the close call).

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-14 01:50:36 +09:00
Kumar Gala
9bdf81102f led_strip: ws2812: Remove dead code
Remove unused WS2812_GPIO_CLK macro that references DT_LABEL.  The
WS2812_GPIO_CLK macro isn't used anywhere so remove it since we
want to minimal DT_LABEL references in drivers.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-13 12:12:18 +02:00
Wojciech Slenska
363989a40d drivers: i2c: sam_twi: Implement bus locking
Added bus locking mechanism, this patch resolves deadlocks
for more than one device on i2c bus, it is based on i2c_sam0 code.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2022-06-13 12:11:41 +02:00
Naga Sureshkumar Relli
248047323e drivers: spi: Add support for Polarfire SOC QSPI
This patch adds driver for the Microchip Polarfire SOC MSS QSPI
controller.
The interrupts of the MSS QSPI are routed through PLIC(Platform level
interrupt controller).

Tested with generic spi-nor flash driver(spi_flash) with both Fixed
flash configuration and Read flash parameters at runtime(using SFDP).

Signed-off-by: Naga Sureshkumar Relli <nagasuresh.relli@microchip.com>
2022-06-13 12:11:28 +02:00
Chay Guo
a4c9e13ea8 boards: arm: Enable flash for storage on mimxrt595_evk
- The MX25UM51345G flash is connected to FLEXSPI PortA for
  mimxrt595_evk.
- Updated flexspi_mx25um51345g driver to support DTR OPI mode.
- Tested with tests/drivers/flash.

Signed-off-by: Chay Guo <changyi.guo@nxp.com>
2022-06-13 12:10:57 +02:00
Chay Guo
c846537820 boards: arm: Add wdog support on mimxrt595_evk
Add watchdog support to the mimxrt595 platform.
The mimxrt595 platform is excluded from the watchdog
test case because the test case uses variables in the
noinit section that need to be retained through a reset
but the rt595 does not retain this memory through a
reset.

Signed-off-by: Chay Guo <changyi.guo@nxp.com>
2022-06-13 12:10:57 +02:00
Chay Guo
b47a8a428f drivers: clock_control: mcux_lpc_syscon_clock: Add flexcomm16 suppport
Added FlexCOMM16(HS SPI1) clock for MIMXRT5xx.

Signed-off-by: Chay Guo <changyi.guo@nxp.com>
2022-06-13 12:10:57 +02:00
Artur Hadasz
2094bfa183 drivers: ieee802154: nrf5: Fix DRX_ADJUST workaround
This PR introduces a fix for DRX window being triggered to early during
CSL. Fixes were also introduced in the nrf 802154 radio
driver, so removed the unneeded DRX_ADJUST constant.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2022-06-13 12:09:57 +02:00
Bartosz Bilas
c343da5161 nxp_imx: rt: add ADC External Trigger Control Kconfig option
Add missing ADC External Trigger Control module Kconfig option.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-06-10 09:48:50 +02:00
Kumar Gala
bb03af637c drivers: gpio: remove unused HAS_DTS_GPIO Kconfig symbol
All the gpio drivers are based on devicetree and thus we always set
HAS_DTS_GPIO, thus we don't need this Kconfig option anymore.  Remove
uses as its safe to assume DTS is supported for GPIO.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-10 09:47:31 +02:00
Kumar Gala
5c905fd094 drivers: clock_control: mcux_sim: Remove dead code
The define NXP_KINETIS_SIM_LABEL is not used so lets remove it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-10 09:47:21 +02:00
Kumar Gala
04622c8b6f edac: shell: Remove use of DT_LABEL
Remove DT_LABEL usage that is needed for device_get_binding, replace
this with DEVICE_DT_GET.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-10 09:46:15 +02:00
Kumar Gala
7bb17e6fb7 lora: shell: Remove use of DT_LABEL
Remove DT_LABEL usage that is needed for device_get_binding, replace
this with DEVICE_DT_GET.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-09 22:01:00 -05:00
Keith Packard
9b2aed731a drivers/wifi/esp_at: Increase sprintk buffers to hold parameter types
This driver uses stack buffers to hold AT command strings which are
generated at runtime using sprintk. The buffers are only sized for the
expected range of values, not the full possible range given the datatypes
involved. Values outside this expected range could cause a buffer overflow.

To mitigate this, increase the size of each buffer to hold the full range
of each parameter type.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-09 11:33:09 +02:00
Keith Packard
87367afa80 drivers/modem: Increase sprintk buffers to hold parameter types
These drivers use stack buffers to hold AT command strings which are
generated at runtime using sprintk. The buffers are only sized for the
expected range of values, not the full possible range given the datatypes
involved. Values outside this expected range could cause a buffer overflow.

To mitigate this, increase the size of each buffef to hold the full range
of each parameter type.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-09 11:33:09 +02:00
Chay Guo
08641f0616 driver: sensor: mcux_acmp: add discrete mode
The ACMP on i.MXRT11xx support discrete mode,
updated the driver to support discrete mode configuration.

Signed-off-by: Chay Guo <changyi.guo@nxp.com>
2022-06-09 11:30:49 +02:00
Moritz Fischer
8f16b05999 drivers: watchdog: cmsdk_apb: Drop dependency
The Kconfig encodes a dependency on SOC_FAMILY_ARM
even though there is no actual dependency.

This is generic ARM IP and can be used in any SoC.

Signed-off-by: Moritz Fischer <moritzf@google.com>
2022-06-08 15:57:01 -05:00
Kumar Gala
23bcc0d107 drivers: watchdog: remove unused HAS_DTS_WDT Kconfig symbol
All the watchdog drivers are based on devicetree and we dont utilize
HAS_DTS_WDT anywhere so we can remove it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-08 16:44:01 -04:00
Marek Metelski
d046ea281c drivers: gsm_ppp: Fix null pointer dereference in log message
Log message references gsm->context.data_rssi which is NULL
when CONFIG_MODEM_SHELL=n. Use gsm->minfo.mdm_rssi which is
internally used when accessing RSSI value.

Signed-off-by: Marek Metelski <marek@metelski.dev>
2022-06-07 19:04:48 +02:00
Marek Metelski
7ade471a47 drivers: gsm_ppp: Wait for NET_IF_DOWN in gsm_ppp_stop only if iface was up
Check if ppp iface was actually up before taking it down and waiting
for NET_EVENT_IF_DOWN. This allows to call gsm_ppp_stop() even if
the PPP was never started, which previously caused the call to lock
forever. This case is useful, for example, if the modem didn't attach
to network in desirable time and user wants to abort PPP setup.

Signed-off-by: Marek Metelski <marek@metelski.dev>
2022-06-07 18:57:18 +02:00
Hari Haran Babu
17f8f62789 drivers: ethernet: w5500: Toggle reset gpio
add toggle reset gpio in w5500_init function

Signed-off-by: Hari Haran Babu <hariharan@linumiz.com>
Signed-off-by: Marcel Graber <marcel@clever.design>
2022-06-07 18:56:31 +02:00
Hari Haran Babu
d8e3affe7b drivers: ethernet: w5500: keep thread blocking in command read-back
add changes for command read-back and change from k_sleep to k_busy_wait
which will allow other threads to wakeup

Signed-off-by: Hari Haran Babu <hariharan@linumiz.com>
Signed-off-by: Marcel Graber <marcel@clever.design>
2022-06-07 18:56:31 +02:00
Luca Fancellu
d62645200b driver: pl011: use new device model to map MMIO
Use the new device model introduced by device_mmio.h to map
pl011 MMIO space.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
2022-06-07 11:54:13 +02:00
Marcin Niestroj
b27bf92234 modem: ublox-sara-r4: do not truncate outgoing datagrams
Do not truncate outgoing datagrams if they do not fit in maximum handled
packet size. Set EMSGSIZE errno and return -1 instead.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-07 11:52:52 +02:00
Piotr Dymacz
360d70a91e drivers: flash: introduce on-chip flash driver for TI CC13xx/CC26xx
This includes a basic driver for built-in flash on the Texas Intruments
SimpleLink CC13xx/CC26xx SoC series.

The driver makes use of driverlib HAL from TI's SDK and was tested on
two LaunchXL development boards with CC1352R and CC2652R SoCs:

- CC1352R1 LaunchXL
- CC26x2R1 LaunchXL

Tests were done using:

- flash shell sample (samples/drivers/flash_shell)
- littlefs filesystem sample (samples/subsys/fs/littlefs)*
- MCUboot (bootloader/mcuboot/boot/zephyr)*

  * additional changes in DTS for the boards were required (partitions
    table) and are not part of this changeset (will be introduced later)

Some additional information about the implementation:

1. TI's Technical Reference Manual for CC13x2 and CC26x2 points out that
   "An individual 64-bit word can be programmed to change bits 1 to 0"
   but it seems this 'alignment' requirement is handled internally by
   the ROM function and thus 'write-block-size' is set to 1.

2. Interrupts, VIMS and line buffers are disabled during flash content
   update (write or erase) and restored afterwards as recommended by TI.

3. Only RAM to flash write is supported (source of data to be written to
   flash can't point to flash).

4. The driver doesn't take care of flash sector protection disable as
   that functionality is handled by CCFG. Write or erase requests which
   refer to a protected area will fail.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-06-06 14:01:27 -07:00
Sean Madigan
8d9ca6ab1c drivers: clock_control: Calibration default on if not BOARD_ENABLE_CPUNET
To prevent both net and app core calibrating.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2022-06-06 22:45:44 +02:00
Aleksandar Markovic
4b0252eab3 drivers: modem: Fix Coverity issue in ublox-sara-r4.c
Coverity reported unused value for a variable "ret" in the function
send_socket_data(). Indeed there were two subsequent assignments
to "ret", meaning that the first one was unused.

The root cause of the problem is not checking the value of "ret"
after correctly invoking a function within send_socket_data(). Fix
this by adding appropriate checks.

Coverity-CID: 215249

Signed-off-by: Aleksandar Markovic <aleksandar.markovic.sa@gmail.com>
2022-06-06 22:45:05 +02:00
Marcin Niestroj
df5d1f220b modem: simcom-sim7080: do not send fragmented data as multiple datagrams
Check if there are multiple non-empty data fragments passed to sendmsg()
function. If positive, then set EMSGSIZE errno and return -1, as that case
is not handled properly with current implementation.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 10:26:53 -07:00
Marcin Niestroj
032b90845e modem: simcom-sim7080: fix handling failed fragment send in sendmsg()
If one data fragment was not sent successfully in sendmsg(), then
attempting to send the rest does not make any sense, as it would introduce
hole in data stream.

Currently if one fragment was not sent successfully, then there is a
'break' in inner loop, but that moves the execution to sending the
following data fragments.

Return early in case of fragment sending failure, so that there are no more
send attempts.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 10:26:53 -07:00
Bjarki AA
ab00842e42 drivers/modem: add user_data to modem_cmd_handler_data
added user_data field to modem_cmd_handler_data

this allows for multiple instances of modem drivers which use
the modem cmd handler. currently, the only identifiable
parameter passed to the modem command handlers is the
modem_cmd_handler_data struct.

The added user_data variable allows for the a modem driver to
pass its dev or data pointer to the modem_cmd_handler_data
struct to be retrieved from within the modem command callbacks.

Signed-off-by: Bjarki AA <baa@trackunit.com>
2022-06-06 17:59:35 +02:00
Marcin Niestroj
ec6026ccdd modem: remove 'modem_pin' abstraction
All drivers using 'modem_pin' abstraction were converted already, so remove
its implementation now.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 17:58:52 +02:00
Marcin Niestroj
41c618dbf7 modem: simcom-sim7080: use 'gpio_dt_spec' instead of 'modem_pin'
Move away from 'modem_pin' abstraction as it has not obvious value compared
to generic 'gpio_dt_spec'.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 17:58:52 +02:00
Marcin Niestroj
9353b6e98a modem: ublox-sara-r4: use 'gpio_dt_spec' instead of 'modem_pin'
Move away from 'modem_pin' abstraction as it has not obvious value compared
to generic 'gpio_dt_spec'.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 17:58:52 +02:00
Marcin Niestroj
10ebfb3877 modem: quectel-bg9x: use 'gpio_dt_spec' instead of 'modem_pin'
Move away from 'modem_pin' abstraction as it has not obvious value compared
to generic 'gpio_dt_spec'.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 17:58:52 +02:00
Marcin Niestroj
9ec661b206 wifi: esp_at: use 'gpio_dt_spec' instead of 'modem_pin'
Move away from 'modem_pin' abstraction as it has not obvious value compared
to generic 'gpio_dt_spec'.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 17:58:52 +02:00
Marcin Niestroj
1ae3302b78 wifi: esp_at: use UART device pointer directly instead of label
UART device pointer is already used directly when configuring modem
interface. Convert the case when UART is reconfigured when 'target-speed'
DT property is specified.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 17:58:37 +02:00
Marcin Niestroj
774a3cd756 drivers: spi: spi_nrfx_spim: fix !LEGACY_INCLUDE_PATH
Add missing zephyr/ prefix to fix CONFIG_LEGACY_INCLUDE_PATH=n build.

Fixes: d64dc771f3 ("drivers: spi: spi_nrfx_spim: utilize EasyDMA property
  from devicetree")

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 12:07:22 +02:00
Marcin Niestroj
8d66185249 drivers: serial: uart_nrfx_uarte: fix !LEGACY_INCLUDE_PATH
Add missing zephyr/ prefix to fix CONFIG_LEGACY_INCLUDE_PATH=n build.

Fixes: f6a880a2f9 ("drivers: serial: uart_nrfx_uarte: utilize EasyDMA
  property from dts")

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 12:07:22 +02:00
Jonathan Hahn
a34c7d680b drivers: serial: removes unused TIMEOUT constant
The TIMEOUT constant is unused since
da210ba0ba,
so removed it.

Signed-off-by: Jonathan Hahn <Jonathan.Hahn@t-online.de>
2022-06-06 12:07:01 +02:00
Krzysztof Frydryk
93e9b5c49d Drivers: crypto_intel_sha: Add support for hw intel sha driver
Adds support for intel ADSP SHA hw accelerator.

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2022-06-06 12:05:12 +02:00
Lucas Tamborrino
9f77cc5a89 drivers: pwm: fix esp32 pwm led driver
Fix mapping between channel and gpio.

Remove obsolete functions.

Closes #46167

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-06-05 14:49:12 +02:00
Ryan Erickson
d4a16768bf modem: hl7800: Enable multi-user callbacks
Change callback registration so it can support multiple users.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-06-05 14:48:47 +02:00
Gerard Marull-Paretas
46ee043a39 drivers: pm_cpu_ops: psci: remove redundant <soc.h> include
<soc.h> was not required.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-05 14:48:40 +02:00
Gerard Marull-Paretas
63c15efa62 drivers: clock_control: agilex: remove redundant soc.h include
<soc.h> has been traditionally been used as a proxy to HAL headers,
register definitions, etc. Nowadays, <soc.h> is anarchy. It serves a
different purpose depending on the SoC. In some cases it includes HALs,
in some others it works as a header sink/proxy (for no good reason), as
a register definition when there's no HAL... To make things worse, it is
being included in code that is, in theory, non-SoC specific.

This patch is part of a series intended to improve the situation by
removing <soc.h> usage when not needed, and by eventually removing it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-05 14:48:40 +02:00
Gerard Marull-Paretas
7de5f47e1a drivers: serial: pl011: improve include list
<soc.h> was included because some CMSIS helpers (__DMB/__ISB) were
needed. In ARM SoCs, inclusion of CMSIS headers depends mainly on how
HALs decide to do it, being usually an inefficient and fragile include
chain. Note that on ARM64 we're in a better position, as those are
defined in-tree.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-05 14:48:40 +02:00
Gerard Marull-Paretas
4cafd8df7e drivers: serial: ns16550: remove redundant soc.h include
<soc.h> has been traditionally been used as a proxy to HAL headers,
register definitions, etc. Nowadays, <soc.h> is anarchy. It serves a
different purpose depending on the SoC. In some cases it includes HALs,
in some others it works as a header sink/proxy (for no good reason), as
a register definition when there's no HAL... To make things worse, it is
being included in code that is, in theory, non-SoC specific.

This patch is part of a series intended to improve the situation by
removing <soc.h> usage when not needed, and by eventually removing it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-05 14:48:40 +02:00
Gerard Marull-Paretas
92f488497f drivers: serial: ns16550: use MMIO device depending on Kconfig option
Add a new selectable Kconfig option to decide wether the device driver
is a MMIO device or not. Previous to this patch, the decision was maded
based on the existence of a definition in <soc.h>. The design was
fragile, as code compiled anyway if the definition was not present.

All platforms/boards that had the definition in <soc.h> select the
Kconfig option in their respective defconfig files.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-05 14:48:40 +02:00
Peter Marheine
95fb984f0b driver: i2c: npcx: prevent sleep during I2C transactions
Deep Sleep mode stops SMB module clocks which could interrupt ongoing
I2C transactions, so have the I2C driver acquire a PM lock at the
beginning of a transaction and release it at the end in order to ensure
the module remains active.

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-06-05 14:47:58 +02:00
Daniel DeGrasse
2675fb4ce3 drivers: gpio: pca95xx: do not write to output regs if pin is input
Remove unconditional write to PCA95xx output registers in setup_pin_dir,
and only write to output registers if selected pin is configured as
an output.

Fixes #45774

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-06-05 14:47:41 +02:00
Arsen Eloglian
d4c1c1ebef ssp: SSCR reset - hardware specific flow
hardware specific flow using bit 20 (SSCR2_SFRMEN)  for reset

Signed-off-by: Arsen Eloglian <ArsenX.Eloglian@intel.com>
2022-06-05 14:45:59 +02:00
Yuriy Vynnychek
e36d481893 drivers: flash: Improve Telink B91 Flash Write and Erase APIs
- Fixed from Flash to Flash write issue (added heap usage).
- Speed up Flash Erase operation (based on erase size).

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-06-05 14:45:38 +02:00
Mahesh Mahadevan
d801323e23 drivers: hyperflash: Use write-block-size property
Use the write-block-size devicetree property instead
of a #defined value

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-06-05 14:45:18 +02:00
Yuriy Vynnychek
cca221e928 drivers: bluetooth: hci: introduce new Telink B91 HCI driver
Telink B91 Bluetooth HCI driver basic support.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-06-05 14:45:10 +02:00
Loic Poulain
9b3e6042d9 wifi: eswifi: Fix socket offload TCP server
- The listen callback was not implemented.
- EOF packet not reported
- accept cb was broken

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2022-06-05 14:44:46 +02:00
Loic Poulain
8923fc3186 wifi: eswifi: Implement listen helper
The listen helper will be used by eswifi socket offload layer.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2022-06-05 14:44:46 +02:00
Loic Poulain
2bcd469ca2 wifi: eswifi: Fix missing peer addr family on TCP connect
The sin_family was not filled properly.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2022-06-05 14:44:46 +02:00
Marcin Niestroj
14ca35b859 modem: quectel-bg9x: remove unwanted space after comma in AT cmd
Remove unwanted space in AT+QICSGP command just after comma and before
password.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-05 14:42:46 +02:00
Maximilian Deubel
3530fc088b ADXL362: Add DTS properties for low-power modes
This patch adds DTS properties for using wake-up mode
and the autosleep function to the ADXL362 driver.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2022-06-05 14:42:40 +02:00
Jay Vasanth
b22b206438 driver: i2c: MEC15xx: improve debug logging
Add extra parameters for logging to improve debugging

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-06-05 14:42:11 +02:00
Jay Vasanth
fad437973c driver: i2c: mec15xx: recover from error for LAB
For lost arbitration error condition add recover from
error logic to reset the i2c controller

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-06-05 14:42:11 +02:00
Andriy Gelman
0fc92370fa drivers: uart_xmc4xxx: Remove unnecessary cast
The compiler will perform an implicit cast from unsigned char to uint16_t.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-06-05 14:29:26 +02:00
Andriy Gelman
aa91500aee drivers: uart_xmc4xxx: Check that receive buffers have data in poll_in
As per XMCLib documentation we need to check that data has been received
before reading the buffers.

Fixes test_uart_poll_in test in tests/drivers/uart/uart_basic_api.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-06-05 14:29:26 +02:00
Andriy Gelman
4c2ff6dc2f drivers: uart_xmc4xxx: Don't recast to uint16_t* when returning value
Casting to uint16_t* can cause an unaligned usage fault when c is not
aligned to 2 bytes and can unintentionally overwrite data when c has a 1
byte memory size. Also there's no need to cast to uint16_t* because
returned words are 8-bit characaters as setup in the configuration.

Fixes the following usage fault error in tests/drivers/uart/uart_basic_api:
START - test_uart_poll_in
Please send characters to serial console
E: ***** USAGE FAULT *****
E:   Unaligned memory access
E: r0/a1:  0x00000000  r1/a2:  0x2000078f  r2/a3:  0x0c00453c
E: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x0c003de5
E:  xpsr:  0x41000000
E: Faulting instruction address (r15/pc): 0x0c003de4
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x20000118 (unknown)
E: Halting system

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-06-05 14:29:26 +02:00
Dylan Hung
c880db1725 cache: Add Aspeed AST10x0 external cache driver
The CPU in Aspeed AST10x0 SOC is a ARM Cortex-M4 which doesn't internal
cache memory.  Aspeed implements an integrated system level cache to
accelerate instruction and data memory accesses.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
2022-06-05 14:28:50 +02:00
Mark Holden
44c388fb33 coredump: drivers: Add coredump device
Add a pseudo device diver with device tree bindings for coredump.
The device tree bindings exposes memory address/size values to be
included in any dump. And the driver exposes an API to add/remove
dump memory regions at runtime.

Signed-off-by: Mark Holden <mholden@fb.com>
2022-06-05 14:28:34 +02:00
Ole Morten Haaland
5fd2457561 drivers: wifi: winc1500: Update function name
The close function was renamed in the hal to avoid a name clash with an
internal POSIX function.

Signed-off-by: Ole Morten Haaland <omh@icsys.no>
2022-06-05 14:27:58 +02:00
Adam Wojasinski
d64dc771f3 drivers: spi: spi_nrfx_spim: utilize EasyDMA property from devicetree
This commit aligns SPIM shim to utilize memory-region property from
nordic,nrf-uarte compatible. The memory-region is not required
property that enables user to specify placement of dma buffers
in memory region. It is done by assigning to memory-region property,
phandle to node with zephyr,memory-region and mimo-sram compatible.

When memory-region property is not specified for given
instance, buffer is placed in default RAM region with other data.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2022-06-05 14:27:29 +02:00
Adam Wojasinski
f6a880a2f9 drivers: serial: uart_nrfx_uarte: utilize EasyDMA property from dts
This commit aligns UARTE shim to utilize memory-region property from
nordic,nrf-uarte compatible. The memory-region is not required
property that enables user to specify placement of dma buffers
in memory region. It is done by assigning to memory-region property,
phandle to node with zephyr,memory-region and mimo-sram compatible.

When memory-region property is not specified for given
instance, buffer is placed in default RAM region with other data.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2022-06-05 14:27:29 +02:00
Adrian Bonislawski
638cfbbdbf drivers: dai: add ALH dai driver
The ALH is an intermediary device, which acts as a hub and provides an
abstracted support for numerous sound interfaces (e.g. SoundWire).

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-06-05 14:27:15 +02:00
Jamal Davis
54c311e5b3 drivers: led: lp5562: Allow support for multiple instances
Driver originally only allowed one instance to be created.
Updated to allow for multiple.

Signed-off-by: Jamal Davis <jamaldavis@fb.com>
2022-06-05 14:16:25 +02:00
Shawn Nematbakhsh
3386b853ac drivers: spi_sifive: Optimize xfer to minimize downtime between frames.
The SPI peripheral on SiFive parts uses FIFOs for Rx and Tx (FIFO size
undocumented, but empirically found to be 8 bytes on FE310, likely
identical on FU540 / FU740). Make use of these FIFOs in order to
continuiously feed Tx data as available.

Verified to transmit 1 MHz SPI @ 200 MHz coreclk / tlclk on FE310
continuously without downtime between frames.

Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
2022-06-05 14:14:59 +02:00
Shawn Nematbakhsh
e17d5ed282 drivers: spi_sifive: Use uint8_t data/buffer types to match spi_context.
spi_context uses uint8_t buffers, and HW rxdata / txdata registers only
contain 8 bits of data (along with b31 full / empty flag), so uint8_t is
appropriate.

Suggested-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
2022-06-05 14:14:59 +02:00
Yong Cong Sin
c7267dc26a drivers: modem: gsm: remove mux_enabled flag and checks
mux_enabled check in the gsm_configure is unnecessary since it
is init and scheduled by gsm_ppp_start which means that the
mux must be disabled. The IS_ENABLED(CONFIG_GSM_MUX) check
should be good enough to determine whether or not the
mux_enable function should be ran.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-06-05 14:13:45 +02:00
Yong Cong Sin
b7eb2202e3 drivers: modem: gsm: introduce lock
After the introduction of start/stop & rssi query work, these
additional functions can be invoked from different threads.

Things can quickly become hard to analyze when an interrupt
fires during one of these functions and upon return the
scheduler schedules another thread and run another function.

This PR introduces a simple mutex lock that guarantees thread
safety. Similar implementation can be found in hl7800 driver,
which has lots of public APIs that can be invoked from different
threads.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>

Update gsm_ppp.c
2022-06-05 14:13:45 +02:00
Yong Cong Sin
975bc85b14 drivers: modem: gsm: move the rssi query an individual function
Move the rssi query part out from the rssi_handler work item as
an individual function, so that it can be used directly without
referencing the work.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-06-05 14:13:45 +02:00
Sylvio Alves
7c2305612d drivers: i2c: fix esp32 fifo rx value
Fix #46112 introduced a regression regarding rx fifo length.
This fixes it so that the last byte is not placed in
wrong buffer index.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-06-02 12:56:33 +02:00
Lucas Tamborrino
092406b08d esp32: drivers: i2c: fix command sequence
Closes #45008

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-05-31 10:38:43 +02:00
Michal Sieron
dc98691c97 drivers: i2s: i2s_litex: Calculate offsets from DT
To support both 8-bit and 32-bit Control/Status register variants, register
offsets need to be calculated from device tree.

Updated register data in device tree to the 32-bit CSR variant.
Renamed defines to be similar to other LiteX drivers.

Changed frequencies in clock-outputs nodes, so i2s/litex sample works.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-27 15:27:11 -07:00
Michal Sieron
17a2c6d647 drivers: ethernet: eth_liteeth: Update driver
Correct width when accessing LITEETH_RX_LENGTH register.

Also update register data in device tree to the 32-bit CSR variant.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-27 15:27:11 -07:00
Michal Sieron
e088d05159 drivers: i2c: i2c_litex: Use LiteX HAL
LiteX HAL should be used when accessing Control/Status registers to provide
compatibility between different data widths of CSRs.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-27 15:27:11 -07:00
Michal Sieron
9f6c531da0 drivers: spi: spi_litespi: Update driver registers
Make driver take register info from device tree so it can work with both
8-bit and 32-bit CSRs.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-27 15:27:11 -07:00
Andrzej Puzdrowski
95d867e8ed drivers/flash/nrf_qspi_nor: fix for missing device deactivation.
anomaly_122_init() and anomaly_122_uninit() procedures implement
proper activate and deactivate procedures which are required for
achieve low power consumption.
The real workaround for the anomaly is buried inside hal function
nrf_qspi_disable() is called indirectly by the anomaly_122_uninit().

Therefore anomaly_122_init/uninit should be called for any
nrf QSPI device.

This patch renames functions and make call to them mandatory.
This fixes increased power consumtion issue on nRF53 device when
qspi was used.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-05-27 15:23:12 -07:00
Fabio Baltieri
e24314f10f include: add more missing zephyr/ prefixes
Adds few missing zephyr/ prefixes to leftover #include statements that
either got added recently or were using double quote format.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-27 15:20:27 -07:00
Dino Li
5a1c084447 driver/serial: ns16550: set NS16550 as default variant
This add UART_NS16550_VARIANT_16550 configuration inside the choice
of UART_NS16550_VARIANT_NS16750 and UART_NS16550_VARIANT_NS16950.
The configuration is enabled by default to make NS16550 device to get
correct FIFO size configuration (16 bytes).

fixes #45783

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-05-27 11:55:31 -07:00
Andrei-Edward Popa
d82c10f197 include: drivers: changed API function names for reset controller
assert API function needed to be changed because of newlib assert
macro name conflict

Signed-off-by: Andrei-Edward Popa <andrei.popa105@yahoo.com>
2022-05-26 13:02:19 -07:00
Gerson Fernando Budke
5b7734c926 drivers: adc: sam0: Fix adc_reference implementation
The current sam0 adc driver not implement correctly the adc_reference
enum values. This try homonize adc input referece by tracking VDDANA
at ADC_REF_VDD_1. The ADC_REF_VDD_1_2 were fixed with correct INTVCCx
channel selection.

Fixes #45443

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-05-25 13:36:10 -07:00
Trent Piepho
094345629b drivers/sensor: lsm6dso: Add support for lsm6dso32
This sensor is virtually identical to the lsm6dso.  The only difference
is the accelerometer ranges are double those of the lsm6dso.

Use the same driver.  The difference is detected by using "st,lsm6dso32"
as the first compatible entry, followed by "st,lsm6dso".

An bit flag in the existing accel_range config field is used to check if
the chip is the doubled range or not.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2022-05-25 13:16:04 -07:00
Trent Piepho
5edd4221ad drivers/sensor: lsm6dso: Refactor common config out of I2C/SPI macros
Move common settings out of the SPI and I2C instantiation macros and
into a common macro, which the aforementioned two macros can then use.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2022-05-25 13:16:04 -07:00
Trent Piepho
c269692b1d drivers/sensor: lsm6dso: Remove LE to CPU conversions
In ST HAL v2.00, the functions to get the raw sensors values, e.g.
lsm6dso_acceleration_raw_get(), convert from little-endian to CPU.

Previous versions of ST HAL didn't do this.

The conversion here in the driver is converting a second time.  It's not
an issue on a LE system, the conversion is a no-op, but on a BE system
it would be broken.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2022-05-25 13:16:04 -07:00
Janco Kock
d611284271 drivers: ethernet: w5500: Check W5500 int pin after processing interrupt
Check if W5500 int pin is still active after processing the interrupt.
If not doing correctly, the W5500 driver can deadlock because it is not
receiving any more interrupts.

Signed-off-by: Janco Kock <jancokock@gmail.com>
2022-05-25 21:46:17 +02:00
Michael Schmitz
043a31a1c6 drivers: pwm: esp32: rename internal channel to avoid redeclaration
Unifying the method signature introduced a redeclaration of variables,
fixes redeclaration of variables by renaming the inner ones

Signed-off-by: Michael Schmitz <michaelschmitz@live.de>
2022-05-25 14:21:12 +02:00
Georgij Cernysiov
e8dece902f drivers: flash: stm32_ospi: fix includes
Adds `zephyr/...` prefix to `toolchain.h` include.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-25 11:13:40 +09:00
Filip Kokosinski
70c978bb97 soc/riscv/sifive-freedom/fe310: use correct SYS_CLOCK_HW_CYCLES_PER_SEC
This commit introduces changes in three places in order to fix the
problem with timer-related tests on FE310-based boards:
* tests/kernel/sleep/kernel.common.timing
* tests/kernel/tickless/tickless_concept/kernel.tickless.concept
* tests/kernel/workq/work_queue/kernel.workqueue

The first change is the modification of the SYS_CLOCK_HW_CYCLES_PER_SEC
value back to 32768 Hz to match FE310's datasheet description.

The second change is CLINT frequency reduction in Renode simulation
model to 16 MHz to correspond with the oscillator frequency given by the
FE310's datasheet and the HiFive1 board schematic. This fixes the first
two tests.

The last change is reducing the MIN_DELAY define to 100. This causes the
RISC-V machine timer driver to update the mtimecmp register more often,
which in turn addresses the `work_queue/kernel.workqueue` problem with
work items finishing prematurely, causing the above-mentioned test to
fail.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-05-24 08:58:43 -07:00
Erwan Gouriou
af483c37fc drivers/clock_control: stm32u5: Wrong bus check in _get_rate()
Checking that provided pclken->bus fits bus range in
clock_control_get_rate() is wrong as it could actually be a source
clock and hence not belong to this range.
Also, this kind of check is just not needed since this function should
not be used before call to clock_control_on() or clock_control_configure()
which do the required verification.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-24 08:51:52 -07:00
Tomislav Milkovic
fc7598fa04 drivers: can: can_stm32h7: Fix min timings
Assertions in can_mcan failed because the driver expects values
strictly greater than 0

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-05-24 08:49:41 -07:00
Mahesh Mahadevan
70dbf7e695 drivers: uart_imx: Fix the poll_in function
Current poll_in function implementation blocks when there is
no data available. The Zephyr documentation for poll_in
expects the function to return -1 when no data is available.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-23 15:00:14 -05:00
Mahesh Mahadevan
649bb3bb44 drivers: counter: Update CTimer to fix alarm setting
1. Make sure the relative alarm value is set correctly
2. Add a Kconfig to give user the option of reserving
   a CTimer channel for implementing the set_top_value
   function

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-23 08:38:59 -05:00
Armando Visconti
f91471640e drivers/sensor: lsm6ds0: Fix typo when configuring FS at 16G
Fixed a typo when selecting LSM6DS0_ACCEL_FULLSCALE_16G.
(Fixes #45583)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2022-05-23 15:16:15 +02:00
Fabio Baltieri
69a13bbb5d drivers: pwm_nrfx: fix incoherent config struct name
Fix the instance config structure name so that it's coherent with the
data one (missing underscore after the instance idx).

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-20 19:22:20 -07:00
Mulin Chao
0f18c4c4ab pinctrl: npcx: config pwm open-drain without enabling STORE_REG
Config pwm open-drain mode without enabling STORE_REG. This CL
collects all active PWM's base address and related index in an
array. Then, pinctrl driver configs its open-drain mode by
finding the corresponding 'channel' index.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-20 12:36:22 +02:00
Jose Alberto Meza
d2361e8441 drivers: sensor: mchp_tach: Correct spelling header
Correct spelling in copyright.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-05-20 12:35:37 +02:00
Chris Collins
ce84c782dc drivers: usb: device: stm32: fix disconnect-gpios configuration.
For some reason, rather than testing for the presence of
disconnect-gpios in the devicetree, the STM32 USB Device driver was
relying on a hidden Kconfig flag to be set.

This patch removes the Kconfig option completely and simply tests for
the DT property - if it's set, you obviously know what you're doing and
obviously need the pull-up GPIO behaviour.

Signed-off-by: Chris Collins <chris@realsimgear.com>
2022-05-19 11:28:38 -07:00
Nickolas Lapp
521e093cde I2S_MCUX: Fixup I2S MCUX Audio PLL Rate Calculation and Reg Writes
This PR Fixes the Audio PLL Rate Calculation (there was an additional
divide / 8 which is not necessary and does not appear in similar
calculations in example code from the SDK).

Additionally, it adjusts the SAI .dtsi to more correctly configure the
mclk rate, and adds comments specifying what the regististers mean.

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
2022-05-19 11:01:53 -05:00
Evgeniy Paltsev
3b0517bbd3 ARC: HSDK: remove pinmux_hsdk driver
Pinmux is depricated (see #39740) and shouldn't be used anymore

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2022-05-18 17:20:26 +02:00
Daniel DeGrasse
f7986835e8 drivers: gpio: gpio_mcux_igpio: add workaround for non contiguous pins
some iMX RT SOCs have non contiguous sets of gpio pins available, which
caused issues when selecting appropriate pinmux for these parts. Add
workaround code to adjust offset of pinmux settings when configuring
these pins.

Fixes #44391

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-18 10:55:22 +02:00
Christoph Heller
382ee011d5 drivers: flash: stm32h7x: Fix wrong flash write offset
The flash_stm32_write_range() function of the STM32H7x flash
driver partially uses a wrong flash program word size for certain
SOC types when calculating the flash write offset. If the used
SOC is not having a flash program word size of 256 bits / 32 bytes
the written data might get corrupted, as the flash write offset
value does not match the number of bytes that were actually
written.

Fixes #45568

Signed-off-by: Christoph Heller <chris@metanetics.de>
2022-05-18 10:54:36 +02:00
Sylvio Alves
f3d2dd2b6c soc: esp32: move phy tx power to soc config
PHY TX power configuration must be added into soc level.
It was previously hardcoded in hal_espressif, which was removed.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-05-17 18:11:50 +02:00
Sjors Hettinga
ae31773ddd drivers: net: loopback: Add counting of number of dropped packets
When the loopback drops driver packets, the number of dropped
packets is counted and can be requested externally.

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
2022-05-16 16:55:51 +02:00
Wael Barakat
4b3fe99b83 drivers: gpio: nrf: fix pin number used in getting GPIOTE channel
Incorrect GPIOTE channel was being freed because the pin number
being used is not the absolute pin but the pin within the port.

Signed-off-by: Wael Barakat <waelsbarakat@gmail.com>
2022-05-16 09:41:04 +02:00
Felipe Neves
44631ebada drivers: wifi: esp_at: add support for firmware
V2.1 for ESP At and make it to coexist
with the current versions.

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2022-05-15 21:34:32 +02:00
Keiya Nobuta
5d662ae3f8 drivers: kscan: Add CAP1203 driver
Add driver for Microchip CAP1203 3-Channel Capacitive Touch Sensor

datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/00001572B.pdf

Signed-off-by: Keiya Nobuta <nobuta.keiya@fujitsu.com>
2022-05-15 21:31:54 +02:00
Andrzej Głąbek
77edc2c852 dts: Include ADC DT binding headers from nRF SoC dtsi files
Add inclusions of header files with devicetree related ADC definitions
to the nRF SoC dtsi files so that those definitions can be used also
for nRF SoC based boards.
Provide definitions of nRF ADC and SAADC analog inputs suitable
for use in devicetree.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-05-13 12:46:06 -07:00
Nazar Palamar
d940d23c10 modules: hal_infineon: added initial Kconfig and CMakeLists.txt
- added initial Kconfig
- added initial CMakeLists.txt (root, core-lib,  mtb-pal-cat1)
- updated module, driver and soc to use CONFIG_USE_INFINEON_xx
  defines from modules/hal_infineon/Kconfig

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2022-05-13 21:34:59 +02:00
TOKITA Hiroshi
7e4cf8308d drivers: display: st7735r: added inversion-on property
Add 'inversion-on' property to st7735r.
Issue INVON(21h) command on initializing if inversion-on was enabled.
As a result of this command, the display color is inverted.
Otherwise, INVOFF(20h) will be issued.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-05-13 11:04:21 -07:00
Georgij Cernysiov
4f10178f3d drivers: flash: stm32: qspi: use ternary and asserts in quad prepare
Use ternary operation and asserts to reduce the footprint
and code size.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
c54e7d162a drivers: flash: stm32: qspi: remove flag_quad_io_en field
There is no need in the `flag_quad_io_en` field.
When QE enabling failed, then the driver `init` fails as well.

There is no way to use qspi in quad mode if qe is not enabled.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
a8e0699972 drivers: flash: stm32: qspi: always include gpio header
Always include gpio header.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
13af1ca9f1 drivers: flash: stm32: qspi: support SFDP quad enable requirements
Parses SFDP QER related DW15 to use as the source for QER.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
685f2098c4 drivers: flash: stm32: qspi: support DTS quad enable requirements
Adds support for DTS quad_enable_requirements property.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
706697168b drivers: flash: stm32: qspi: move prepare cmd is enable check
Moves IS_ENABLE check from prepare program and read to the caller.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
bbdfe6d9e0 drivers: flash: stm32: qspi: support 1-4-4 and 1-1-4 quad read modes
Adds support for 1-4-4 and 1-1-4 read modes.

SFDP is used to query for available read instructions, then the
fastest one is used.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
0216353263 drivers: flash: stm32: qspi: support DTS writeoc
Adds support for DTS writeoc.

Uses 1-4-4 mode by default (as the original driver).

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
4ef6b82681 drivers: flash: stm32: qspi: minor cleanup
Removes double line and log output regarding
device initialization.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
c2dfeb11c1 drivers: flash: jesd216: correct comment mistake
Corrects type name in the comment for the DW15 QER field.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
b43741cd5d drivers: flash: spi_nor: add SR3 read and write defines
Adds Status Register 3 read and write opcode defines.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
22c8022b54 drivers: falsh: spi_nor: add PP_1_1_4 and rename 4PP
* Renames 4PP define to PP_1_4_4
* Adds PP_1_1_4 define

That matches linux kernel defines a bit more.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
78ecf65267 drivers: flash: spi_nor: remove not used QE bit define
Removes unused QE bit define.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Thomas Altenbach
cc51031445 drivers/entropy: stm32: fix inter-core race condition
On STM32WB and dual-core STM32H7 MCUs, the RNG peripheral is shared
between the cores and its access is protected by a hardware semaphore.
Locking was not performed in the current entropy driver, leading to a
race condition when multiple cores concurrently used the RNG. This
commit implements the necessary logic for locking the HSEM during entropy
generation on multi-core STM32 MCUs. It also reconfigures the RNG in case
the configuration was changed by the other core, as this can happen e.g
on STM32WB MCUs.

Signed-off-by: Thomas Altenbach <taltenbach@witekio.com>
2022-05-13 10:28:53 -05:00
Peter Johanson
43b77a2191 drivers: usb: Add RP2040 USB device support.
Add USB device driver for Rasberry Pico family of controllers.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
2022-05-13 16:28:27 +02:00
Jonathan Hahn
05cc2e1ac3 drivers: serial: add pin inversion to stm32 u(s)art
Additional properties are added to stm32 u(s)art to allow
for signal inversion.

Signed-off-by: Jonathan Hahn <Jonathan.Hahn@t-online.de>
2022-05-13 08:45:55 -05:00
Jordan Yates
993cad1b4a wifi: esp_at: cleanup sockets at network close
Some sockets (UDP sockets at least) do not generate "<N>,CLOSED"
messages when the WiFi network drops. As a result the networking stack
thinks these sockets are still open after the network has dropped, and
after any subsequent reconnections.

This affects the DNS resolver library in particular, which leaves UDP
sockets open permanently by default.

Manually close these sockets when the network drops to ensure a clean
state the next time the network connects.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-13 14:53:48 +02:00
Jordan Yates
a2c0bd8dd1 wifi: esp_at: notify receivers on async close
`esp_close_work` can be queued from the `on_cmd_closed`, which clears
`ESP_SOCK_CONNECTED` and sets `ESP_SOCK_CLOSE_PENDING`, but does no
further work. The receive callback should still be run with no data when
the socket is closed through this mechanism.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-13 14:53:48 +02:00
Jordan Yates
c28874657b spi: spi_b91: use new DT_INST_STRING_TOKEN macro
Use the dedicated `DT_INST_STRING_TOKEN` macro instead of manually
retrieving `DT_DRV_INST`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-13 14:17:08 +02:00
Yasushi SHOJI
f14e9e408b serial: xilinx: uartlite: Fix bus fault
Xilinx AXI UART Lite v2.0[1] has the following clause for both RX and TX
FIFO respectively:

    When a read request is issued to an empty FIFO, a bus error (SLVERR) is
    generated and the result is undefined.

    When a write request is issued while the FIFO is full, a bus
    error (SLVERR) is generated and the data is not written into the FIFO.

To protect this, we have:

    xlnx_uartlite_read_status(dev) & STAT_REG_RX_FIFO_VALID_DATA, and
    xlnx_uartlite_read_status(dev) & STAT_REG_TX_FIFO_FULL

but these are not enough for multi-threaded apps.  Consider two threads
calling poll_out(), it is always possible for a thread to be swapped out
right after reading the status register, the other thread fill the TX FIFO,
and the original thread is swapped back to write more data to the FIFO
because previously read status doesn't indicate the FIFO is full.

To close this race condition, this commit uses a spinlock for each FIFO.
This ensures that only one thread accesses the FIFO even for SMP cases.

This closes #45302.

[1] https://docs.xilinx.com/v/u/en-US/pg142-axi-uartlite

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2022-05-12 19:05:15 -04:00
Daniel DeGrasse
ddee8d7f4e drivers: pwm_imx: add pin control support
Add pin control support to pwm_imx driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse
7299a2994a drivers: i2c_imx: add pin control support
Add pin control support to i2c_imx driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse
c4a7985064 drivers: uart_imx: add pin control support
Add pin control support to uart_imx serial driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse
694637a83c drivers: uart_mcux_iuart: add pin control support
Add pin control support to mcux_iuart driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse
0f7145e037 drivers: gpio_imx: Add pin control support
Add pin control support to gpio_imx driver, so that GPIO pin muxes will
be selected when the use configures a pin as GPIO.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse
a4ad9d4c60 drivers: gpio_mcux_igpio: add additional SOC pin control settings
Add additional pin controller settings for iMX application core SOCs, as
well as a "fallback" pin control setting.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse
bc841e1fb7 drivers: pinctrl: refactor pin control support for imx rt
Refactor iMX RT pin control support to use more generic names, as the
IOMUXC peripheral is present on non RT iMX application cores.
Additionally, make selection of the pin control driver occur at the SOC
level.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Francois Ramu
084dc3f0dd drivers: flash: ospi factorized for stm32 devices
Simplifies the driver and Gives a generic function to prepare the Regular
commands for each instruction.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Francois Ramu
16754378fb drivers: flash : introduce a new driver for the OCTOSPI
This is the stm32 octospi driver based on the exisitng quadspi
 for stm32 devices and source code from the STM32Cube.
This drivers initialized the peripheral and the NOR memory
in SPI or OctoSPI mode with STR or DTR data Transfer rates.
The NOR-flash can provide the SDFP table directly (if supported)
or through the DeviceTree.
 Limitation: no DMA transfer.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Francois Ramu
712d2537be drivers: flash: JESD216 ospi command for SFDP
Includes the 16bit command to read the SFDP in the NOR flash.
according to the JEDEC standard.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Francois Ramu
5b029377ab drivers: flash: spi nor header includes definition for OSPI commands
With the introduction of the OSPI NOR flash controller
more octal commands and parameters are defined.
It completes the existing SPI commands

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Jose Alberto Meza
3ebe2a8e80 drivers: pinctrl: xec: Prevent glitch for QMSPI on MAF
Whenever EC bootloader already configured a pin as output and
high, any further reconfiguration via pinctrl driver causes a
glitch in said pin with current sequence.

Defer pin direction configuration to be last operation over
gpio control register to avoid the glitch.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-05-12 14:49:45 -05:00
Jordan Yates
9d58fa7ac9 wifi: esp_at: log message on async close
Log a message when the modem asynchronously closes a link. This is
useful information to the user as it can explain the root cause of later
failures.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-12 15:27:01 -04:00
Mulin Chao
33c7119e87 drivers: espi: host_subs: add pinctrl driver support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in npcx eSPI and host_subs driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
7ef371b2e7 drivers: adc: add pinctrl driver support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in npcx adc driver. Please notice users need to
configure the corresponding pinctrl nodes in 'pinctrl-0' property in the
adc0 DT node. For example, if ADC0 and ADC2 channels are selected for
the application, please add the follwoings in your board DT layout file.

&adc0 {
	status = "okay";
	/* Use adc0 channel 0 and 2 for 'adc_api' driver tests */
	pinctrl-0 = <&adc0_chan0_gp45
		     &adc0_chan2_gp43>;
	pinctrl-names = "default";
};

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
22f9036577 drivers: sensor: npcx_tach: add pinctrl driver support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in npcx tachometer driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
95f6dc6c35 drivers: ps2: add Zephyr pinctrl support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in ps2 driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
8f65bdabab drivers: pwm: add pinctrl driver support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in pwm driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
a4b07c396d drivers: i2c: add pinctrl driver support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in i2c driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
8efc935288 drivers: uart: add pinctrl driver support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in uart driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
d53d574bf0 drivers: pinctrl: npcx: add initial pin-controller driver
This CL is the initial version for npcx pinctrl driver and introduces
pinctrl nodes for both IO-pads and peripheral devices for each npcx
series. Users can set pin configuration via these nodes in the board
layout DT file. It also wraps all configurations related to pin-muxing
in pinctrl_soc.h. Regarding the other pin properties, we will implement
them later.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mahesh Mahadevan
8157e4bebf display: Update ELCDIF driver to use a config
Update the MCUX ELCDIF driver to use CONFIG_MCUX_ELCDIF_POOL_BLOCK_NUM
for the number for frame buffers to allocate.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-12 09:26:50 -05:00
Mahesh Mahadevan
450a1c0982 drivers: display: Add support for Raydium RM68200
Add support for the Raydium RM68200 MIPI DSI panel.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-12 09:26:50 -05:00
Mahesh Mahadevan
27800c2fd7 drivers: mipi: Add MIPI DSI driver for MXRT devices
Add a MIPI DSI driver for the MIPI controller on
NXP MXRT SoC'sUpdate MIPI_DSI

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-12 09:26:50 -05:00
Gerard Marull-Paretas
83cfd295b9 drivers: mipi_dsi: initial support for MIPI-DSI drivers
Add initial support for MIPI-DSI drivers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-05-12 09:26:50 -05:00
Andrzej Głąbek
36845b6168 drivers: adc_common: Add missing gain values in adc_gain_invert()
This is a follow-up to commits e15bdaa1bd
and 07bf22cc94.

The above two commits added some enumerated gain values and those
are not currently handled by the inverting function. Add the missing
entries to the conversion array in the function.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-05-12 09:22:39 +02:00
Tomislav Milkovic
a5429ac988 drivers: display: temporary fix for PLLSAI on STM32F7
Temporary fix to configure PLLSAIR multipliers for correct
LTDC pixel clock on STM32F746G Discovery board

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-05-12 09:21:46 +02:00
Jun Lin
51978d9d61 driver: eSPI: npcx: workaround the errata rev1_2, No.3.10
Enabling an eSPI channel (r.g. Peripheral Channel, Virtual Wire Channel,
etc.) during an eSPI transaction might (with low probability) cause the
eSPI_SIF module to transition to a wrong state and therefore response
with FATAL_ERROR on an incoming transaction.
This CL workarounds this issue by clearing the bit 4 of NPCX eSPI
specific register#2.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-05-12 09:21:24 +02:00
Jan Peters
8a4aeeb11e drivers: gpio: fix gpio_emul driver to allow multiple instances
A missing semicolon caused compiler errors when more than one emulated
gpio device was defined in the device tree.

Signed-off-by: Jan Peters <peters@kt-elektronik.de>
2022-05-12 09:21:14 +02:00
Artur Lipowski
bb8575962d stm32: Allow UARTs to use alternate clocks.
Add support for an alternate clock. If available,
alternate clock is enabled and used to get the
device clock rate.
Based on: #45053.

Signed-off-by: Artur Lipowski <Artur.Lipowski@hidglobal.com>
2022-05-11 14:58:37 -05:00
Peter Maxwell Warasila
3c09c21fda drivers: serial: uart_stm32: tx/rx swap in init()
Previously, the uart_stm32 driver was extended in #44487 to support
swapping the tx and rx pins of supported STM32 UART peripherals.
However, the original change applied this configuration during the
call to the uart_stm32_configure() function. This has now been added to
the uart_stm32_init() function to ensure this behavior on startup for
ports like the virtual com port.

Signed-off-by: Peter Maxwell Warasila <madmaxwell@soundcomesout.com>
2022-05-11 14:45:34 -05:00
Georgij Cernysiov
b11fcc8e0c drivers: display: stm32_ltdc: fix set orientation API
Refactors invalid switch into if statement.
Fixes orientation set return value for normal
display orientation.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-11 10:49:23 +02:00
Ruibin Chang
f3204b7326 ITE drivers/pwm: don't divide-by-zero
Make sure cxcprs isn't zero, or we will have
divide-by-zero on calculating actual_freq.

Test:
1.tests/drivers/pwm/pwm_api pattern
2.GPA0(pwm0) output 79201Hz, 324Hz, 100Hz, 1Hz waveform

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-05-11 10:49:13 +02:00
Henrik Brix Andersen
9bd97eb0b8 drivers: can: add CAN_MODE_FD
Add support for enabling/disabling CAN-FD frame transmission/reception at
run-time.

Fixes: #45303

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-11 10:47:54 +02:00
Henrik Brix Andersen
3f97d11afd drivers: can: convert enum can_mode to a bit field
Convert the can_mode enum to a bit field to prepare for future extensions
(CAN-FD mode, transmitter delay compensation, one-shot mode, 3-samples
mode, ...).

Rename the existing modes:
- CAN_NORMAL_MODE   -> CAN_MODE_NORMAL
- CAN_SILENT_MODE   -> CAN_MODE_LISTENONLY
- CAN_LOOPBACK_MODE -> CAN_MODE_LOOPBACK

These mode names align with the Linux naming for CAN control modes.

The old CAN_SILENT_LOOPBACK_MODE can be set with the bitmask
(CAN_MODE_LISTENONLY | CAN_MODE_LOOPBACK).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-11 10:47:54 +02:00
Henrik Brix Andersen
2f7c01ba21 drivers: can: rename API functions from timing_*_data to timing_data_*
Rename the CAN data phase API functions to timing_data_* for consistency:
- can_get_timing_min_data() -> can_get_timing_data_min()
- can_get_timing_max_data() -> can_get_timing_data_max()
- .timing_min_data -> timing_data_min
- .timing_max_data -> timing_data_max

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-11 10:47:54 +02:00
Henrik Brix Andersen
18890828b8 drivers: can: split CAN classic and CAN-FD syscalls
Split CAN classic and CAN-FD syscalls into two:
- can_set_timing() -> can_set_timing() + can_set_timing_data()
- can_set_bitrate() -> can_set_bitrate() + can_set_bitrate_data()

Fixes: #45303

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-11 10:47:54 +02:00
Georgij Cernysiov
d2a792dd39 drivers: clock_control: stm32h7: add stm32h730xx
Add STM32H730xx SoC.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-11 10:47:43 +02:00
Daniel DeGrasse
7e89ce9f19 drivers: serial: enable pin control for lpc11u6x serial driver
Enable pin control api for lpc11u6x serial driver, and remove pinmux api
usage.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-10 17:27:44 -05:00
Daniel DeGrasse
069280c8a4 drivers: i2c: i2c_lpc11u6x: enable pin control
Enable pin control for lpc11u6x i2c driver, and remove pinmux usage from
board level DTS files.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-10 17:27:44 -05:00
Daniel DeGrasse
8e07e21424 drivers: clock_control: convert lpc11u6x syscon driver to pinctrl
convert lpc11u6x syscon clock driver to pin control, and remove all
pinmux usage from driver and syscon dts node.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-10 17:27:44 -05:00
Daniel DeGrasse
1916fb21dd drivers: pinctrl: update lpc pinctrl driver for lpc11u6x
Update pin control driver for lpc11u6x. This SOC does not have a HAL,
so fsl_clock is not available. It also lacks a slew-rate field in the
IOCON register, so this property must be optional.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-10 17:27:44 -05:00
Daniel DeGrasse
81c209dc2d drivers: gpio_lpc11u6x: use pio nodes to configure pin mux for gpio
switch gpio driver to use pio nodes to configure pin control settings,
and stop using pinmux driver within gpio driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-10 17:27:44 -05:00
Jordan Yates
e5c391fad6 power_domain: gpio: improve logging
Improve the power domain logging by making the log level configurable
and boosting the log level of the messages printed when the domain turns
on and off.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-10 17:59:56 -04:00
Esteban Valverde
b9313cab1b drivers: counter: Setting I2C as depends in DS3231 config file
When using DS3231 counter, its enablement should depend on I2C

Signed-off-by: Esteban Valverde <esteban.valverde.vega@intel.com>
2022-05-10 13:29:47 -04:00
Esteban Valverde
03ec46889b drivers: usb: Adding support to GIC_V1 in dc_dw USB driver
Adding support for the GIC_V1 to the dc_dw USB driver
to be used by Cyclone V SoC FPGA Development Kit

Signed-off-by: Esteban Valverde <esteban.valverde.vega@intel.com>
2022-05-10 13:29:47 -04:00
Esteban Valverde
797b6784bb drivers: serial: modify ns16550 to use extended FIFO
Cyclone V SoC FPGA supports 128Byte FIFO for UART communication,
this modification adds a feature to use 128byte FIFO serial UART

Signed-off-by: Esteban Valverde <esteban.valverde.vega@intel.com>
2022-05-10 13:29:47 -04:00
Erwan Gouriou
09217865ce drivers/clock_control: stm32_common: Implement clock source selection
Similarly to what was done on U5 and H7 clock_control drivers, enable
device clock source selection.
This is done by:
-providing implementation for clock_control_configure().
-updating clock_control_get_rate() to support various possible clock
sources (SYSCLK, PLLCLK, LSE, LSI, HSI, HSE).
-providing enable_clock() to verify requested clock source exists and
is enabled.
-adding LSI and LSE device tree based initialization to
set_up_fixed_clock_sources().

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
c2ee8209ab drivers/clock_control: stm32_common: Remove unused definitions
STM32WL_DUAL_CORE and RCC_CALC_MSI_RUN_FREQ are not used anymore.
Clean up those definitions

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
e579027d20 include/dt-bindings/clock: stm32: Factorize Clock source binding accessors
Rename and factorize clock source bindings accessors by moving them
in common header file stm32_clock_control and remove them from
include/dt-bindings/clock/stm32XY_clock.h files

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
424f937c2b drivers/clock_control: stm32u5: Add support for optional clocks config
This change updates stm32u5 driver to support configuration of
optional clocks on peripherals.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
b22dd170e6 drivers/clock_control: stm32h7: Add support for CKPER clock mux
Add support for CKPER clock mux.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
d71b89b398 drivers: clock_control: Add STM32 clock multiplexer driver
Add a clock multiplexer driver.
Its only function is to select a clock input.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
0b65c1c619 drivers/spi: stm32: Use alt clock freq if available
Add support for an alternate clock. If available,
alternate clock is enabled and used to get the
device clock rate.

Fixes #41650

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
833eda84d3 drivers/clock_control: stm32h7: Add support for alt clocks
Add support for alternate clocks configuration.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Michal Sieron
eff89c6b24 drivers: timer: litex_timer: Fix sys_clock_cycle_get functions
e8e88dea incorrectly changed registers
used in `sys_clock_cycle_get(32|64)` functions.

This commit fixes that.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-10 18:41:20 +02:00
Bernardo Perez Priego
2fc78a9b39 drivers: adc: Add threshold_reg_offset to NPCX adc config structure
ADC threshold control register offset is provided by devicetree, this
change will add this property into `adc_npcx_config` structure and
update macro to access register accordingly. Driver behavior is not
meant to be impacted.

Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>
2022-05-10 18:40:24 +02:00
Bernardo Perez Priego
aa875b3766 drivers: adc: Add threshold_count to NPCX adc config structure
Number of supported ADC thresholds is provided by devicetree, this
change will add this property into `adc_npcx_config` structure and
replace macro usage. Driver behavior is not meant to be impacted.

Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>
2022-05-10 18:40:24 +02:00
Jordan Yates
95d8deb572 modem: modem_iface_uart_async: added
Adds a communications backend based on the asynchronous UART API,
instead of the interrupt-driven UART API. The primary advantage of this
backend is an improved robustness to dropping bytes under high interrupt
or critical section loads.

Under all loads system efficiency is improved by:
 * Reducing the time spent writing out individual bytes.
 * Reducing the number of UART interrupts fired.
 * Waking up the RX thread much less often.

When utilising this backend over `nordic,nrf-uarte` on a nRF52840, the
baudrate of an esp-at modem could be pushed to at least 921600 without
dropping bytes, compared to a maximum of 230400 with the interrupt API.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-10 10:44:04 +02:00
Jordan Yates
5228de3af5 modem: choice symbol for UART backend
Add a choice symbol that is used to select which UART backend to use.
This allows backends that don't use the interrupt API to be implemented.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-10 10:44:04 +02:00
Jordan Yates
a6081eeedf wifi: esp_at: fix pointer logging
Use the proper `%p` printf specifier when printing memory addresses,
instead of casting to an integer, which may not be the same size as a
pointer.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-10 10:44:04 +02:00
Jordan Yates
a9087936ac serial: test: update selected symbols
Pretend that the serial test driver supports the interrupt and async
API's, as these can be required for various drivers. Also select
`SERIAL_HAS_DRIVER` so that the serial library will be included.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-10 10:44:04 +02:00
Jordan Yates
7a86ee50fd serial: litex: remove irrational dependency
Depending on `!SERIAL_SUPPORT_INTERRUPT` to enable the driver does not
make any sense, as this is a symbol selected by drivers to signify that
they support interrupts. Simply not selecting this symbol is enough to
convey the desired intention.

This fixes Kconfig problems when the driver is compiled together with
a dummy serial driver which does select `SERIAL_SUPPORT_INTERRUPT`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-10 10:44:04 +02:00
Georgij Cernysiov
64c804ad3b drivers: uart_stm32: fix device is ready for tx dma in async init
Fixes TX DMA device is ready check in async initialization function.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-09 11:55:20 -05:00
Gerard Marull-Paretas
0e5bc82b84 drivers: pinctrl: it8xxx2: update include paths
Use the <zephyr/...> prefix.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-09 12:45:29 -04:00
Gerard Marull-Paretas
e00ad413d9 drivers: hwinfo: mcux: update include paths
Use the <zephyr/...> prefix.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-09 12:45:29 -04:00
Gerard Marull-Paretas
4b91c2d79f asm: update files with <zephyr/...> include prefix
Assembler files were not migrated with the new <zephyr/...> prefix.
Note that the conversion has been scripted, refer to #45388 for more
details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-09 12:45:29 -04:00
Daniel DeGrasse
5ee93929b9 drivers: memc: don't check pin control return code
Some SOCs, such as the RT1064 and RT1024, use internal flash and don't
define pinmux settings for the flexspi. Don't check the return code of
pinctrl_apply_state, because the flexspi driver will fail to initialize
when the pin mux settings are simply not required.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-09 08:54:30 -05:00
Daniel DeGrasse
e2fe582d62 drivers: sdhc: Add SD response type masks
Add SD response type masks, to allow drivers to mask out the
SPI or SD native mode response type based on the SD host controller
mode they use.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-09 08:46:29 -05:00
Henrik Brix Andersen
ebbb4b67b9 drivers: can: sam: use UPLL clock instead of PLLA clock
Use the UPLLCK clock for the CAN controller as recommended by the Atmel SAM
E70 data sheet.

Move the configuration of the clock prescaler from Kconfig to devicetree
and limit it to the values recommended by the SAM E70 datasheet.

Fixes: #45012

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-09 09:27:40 +02:00
Andrzej Głąbek
5d9e31e739 drivers: pinctrl_nrf: Add missing break statements
This is a follow-up to commit fd7633126e.

For some reason the above commit added several switch cases without
required break statements. In effect, the same pin could get assigned
to multiple signal lines in QDEC or QSPI peripherals if not all pins
were defined for them in devicetree, and consequently these peripherals
could not work properly.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-05-09 09:26:34 +02:00
Ryan Erickson
ab9715031c modem: hl7800: fix UART shutdown
Allow CTS line to determine UART shutdown for any sleep mode.
This allows lower average current consumption for LITE
HIBERNATE mode.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-05-06 20:17:23 +02:00
Gerard Marull-Paretas
fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Kamil Piszczek
d87552a128 drivers: bluetooth: hci: rpmsg: use chosen to abstract ipc instance
Added chosen syntax in Device Tree to abstract the IPC device that is
used with the IPC service module in the Bluetooth HCI RPMsg driver.
Ported affected boards to declare this alias.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2022-05-06 14:15:27 +02:00
Daniel DeGrasse
58a2b15972 drivers: hwinfo: implemented hardware info support for RT11xx SOC
RT11xx SOC uses same system reset controller as RT10xx series. Add
support for SRC on RT11xx

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-06 11:33:26 +02:00
Jordan Yates
9b59721ab3 power_domain: gpio: update include paths
Update the Zephyr include paths to be compatible with removing
`CONFIG_LEGACY_INCLUDE_PATH` in the future.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-06 11:33:10 +02:00
Jordan Yates
d1ab0f6b6e power_domain: gpio: use on-off and startup time
Respect the configured values for how long the domain takes to turn on,
and how long the domain needs to be off for before it can be repowered.

As these actions can block, guard the transition function with
pm_device_action_can_block. To avoid system PM being able to turn the
domain off but not back on again, guard the entire implementation.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-06 11:33:10 +02:00
Jordan Yates
31ad7e2bd4 power_domain: gpio: remove unused strings
Remove unused power domain transition strings.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-06 11:33:10 +02:00
Tim Lin
4cf45f4770 ITE: drivers/pinmux: Remove it8xxx2 pinmux driver
Remove the driver related it8xxx2 pinmux.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
bd8afe7ef0 ITE: drivers/kscan: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
3670977158 ITE: drivers/peci: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
5551872047 ITE: drivers/sensor: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
8ecd5bb2f7 ITE: drivers/pwm: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
64ff1a8efe ITE: drivers/i2c: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
74321f11d6 ITE: drivers/adc: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
07d9a4292d ITE: drivers/serial: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
efaeed6cb2 ITE: drviers/pinctrl: Add pinctrl driver for IT8XXX2
Add pinctrl driver for ITE IT8XXX2.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Maureen Helm
f4a0854481 drivers: dai: Use dt_compat_enabled for Intel SSP driver default
Enables the Intel SSP driver by default when the DAI driver class is
enabled (CONFIG_DAI=y) and a compatible devicetree node
("intel,ssp-dai") is enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-05-06 11:32:04 +02:00
Michal Sieron
72a2ec253e clock_control: litex: Use register names
Use `DT_REG_ADDR_BY_NAME` and `DT_REG_SIZE_BY_NAME` to access register
properties from dts.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-06 11:31:54 +02:00
Michal Sieron
bd892bd963 ethernet: eth_liteeth: Add and use register names
Adds addresses and names for individual CSR registers to device tree.
This way liteuart driver no longer depends on CSR data width being 8
bits.
Also when register names or their number changes, then overlay generated
by LiteX will be incompatible with one defined here.
This should make finding breaking changes easier.

I also appended `_ADDR` suffix to defines, to distinguish them from
normal values like `LITEETH_EV_RX`.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-06 11:31:54 +02:00
Michal Sieron
081e201219 serial: uart_liteuart: Add and use register names
Adds addresses and names for individual CSR registers to device tree.
This way liteuart driver no longer depends on CSR data width being 8
bits.
Also when register names or their number changes, then overlay generated
by LiteX will be incompatible with one defined here.
This should make finding breaking changes easier.

I also appended `_ADDR` suffix to defines, to distinguish them from
normal values like `UART_EX_TX`.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-06 11:31:54 +02:00
Michal Sieron
e8e88dead9 timer: litex_timer: Add and use register names
Adds addresses and names for individual CSR registers to device tree.
This way timer driver no longer depends on CSR data width being 8 bits.
Also when register names their number changes, then overlay generated by
LiteX will be incompatible with one defined here.
This should make finding breaking changes easier.

I also updated register names to those used in current LiteX and
appended `_ADDR` suffix to defines which lacked them.

Because register `total` was renamed to `value` and `update_total` to
`update_value` I updated variables accordingly as well.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-06 11:31:54 +02:00
Dino Li
3f6be01484 it8xxx2: espi/kbc: read kbc event type before read input buffer
Host might send command or data immediately after EC read the
KBC input buffer (IBF gets cleared).
This change make sure EC won't get wrong event type in IBF ISR.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-05-06 11:31:13 +02:00
Georgij Cernysiov
1520820bff drivers: pwm: stm32: fix PWM channel disabling
Move period and pulse computation to right before
the channel enable code.

That fixes the inability to disable the channel by
providing the period of 0.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-05 14:36:56 -05:00
Peter Maxwell Warasila
c91a70e130 driver: can: stm32fd: add stm32u5 clock selection
The STM32u% series of processors has a unique set of clock sources for
the FDCAN peripheral. This brings the selection in line with the
existing can_stm32fd clock selection Kconfigs.

This change was tested on a proprietary board using the STM32U5 series
which exposes the CAN pins of the SOC using a transciever on a live CAN
bus as well as on the nucleo_g474re board from ST in loopback mode.

HSE and PLL1Q tests run and all passed.

PLL2P is not currently supported by the clock drivers for STM32U5, and
as such is currently untested. When this support is added, the driver
should be able to use this clock without issue.

When changes from #42097 are merged this fix should be deprecated in
favor of using the methods outlined there.

Signed-off-by: Peter Maxwell Warasila <madmaxwell@soundcomesout.com>
2022-05-05 14:35:37 -05:00
Henrik Brix Andersen
64c9fadc7c drivers: pwm: rv32m1: tpm: add pinctrl support
Add pinctrl support to the OpenISA RV32M1 TPM PWM driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-05 13:34:39 -05:00
Henrik Brix Andersen
c83a0d5d1f drivers: spi: rv32m1: lpspi: add pinctrl support
Add pinctrl support to the OpenISA RV32M1 LPSPI SPI driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-05 13:34:39 -05:00
Henrik Brix Andersen
7b33d4af6c drivers: i2c: rv32m1: lpi2c: add pinctrl support
Add pinctrl support to the OpenISA RV32M1 LPI2C I2C driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-05 13:34:39 -05:00
Henrik Brix Andersen
738e9f57f9 drivers: serial: rv32m1: lpuart: add pinctrl support
Add pinctrl support to the OpenISA RV32M1 LPUART serial driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-05 13:34:39 -05:00
Henrik Brix Andersen
9ba953d13a drivers: gpio: rv32m1: configure pin mux as GPIO
Set the PCR[MUX] field to kPORT_MuxAsGpio as part of configuring a GPIO
pin. This removes the need to explicitly call pinmux_pin_set() in board
code.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-05 13:34:39 -05:00
Henrik Brix Andersen
1dc3b237fa drivers: pinctrl: add OpenISA RV32M1 pinctrl driver
Add OpenISA RV32M1 pinctrl driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-05 13:34:39 -05:00
Tom Burdick
6913da9ddd logging: cAVS HDA based logger
Adds a log backend that maintains a ringbuffer in coordination
with cAVS HDA.

The DMA channel is expected to be given some time after the logger
starts so a seperate step to initialize the dma channel is required.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-05-04 18:56:13 -04:00
Daniel DeGrasse
2551a75c9e boards: imx_rt: Don't default FLASH_MCUX_FLEXSPI_XIP to enabled
Do not default FLASH_MCUX_FLEXSPI_XIP to enabled when code is not
located in flash, this will cause issues if code is executing from ITCM,
as the zephyr_code_relocate macro will relocate the flash driver code
into itcm, and overwrite the zephyr image.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-04 10:46:03 -05:00
Ryan Erickson
b8aa44ec46 modem: hl7800: do not query SIM if not present
Do not query SIM card parameters if the SIM
card is not present.
This shortens the driver initialization time
significantly if a SIM card is not present.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-05-04 09:49:17 -05:00
Daniel Leung
170c9026cb counter: cmos: use device tree to instantiate driver
This changes the CMOS RTC driver to use device tree to
instantiate the driver instance.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-05-04 09:42:26 -05:00
Bernardo Perez Priego
4c34331b4c drivers: sensor: Store sensor trigger structure reference for client use
Store sensor trigger structure reference provided on `trigger_set`, and
pass reference back to client when trigger callback is invoked.

This will enable client to use `CONTAINER_OF()` inside its trigger
callback code.

Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>
2022-05-04 09:22:52 -05:00
Andrei Emeltchenko
f6069aa8fa edac: ibecc: Add support for EHL SKU13, SKU14, SKU15
Add support for missing EHL SKUs. The information about SKUs is
already public and available in Linux kernel:
https://github.com/torvalds/linux/blob/
38f80f42147ff658aff218edb0a88c37e58bf44f/drivers/edac/
igen6_edac.c#L197-L208

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-05-04 08:05:02 -05:00
Jan Peters
253cec5c95 drivers: counter: add driver for NXP QTMR counters
The driver is implemented using the MCUXpresso SDK.

Signed-off-by: Jan Peters <peters@kt-elektronik.de>
2022-05-03 20:41:23 -05:00
Jay Vasanth
b7f60b2354 drivers: ps2: Microchip XEC PS2 driver add PINCTRL support
Add optional PINCTRL support to the Microchip XEC PS2 driver
shared between MEC15xx and MEC172x families.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-05-03 14:13:20 -05:00
Jay Vasanth
60a41f6878 drivers: ps2: Microchip XEC PS2 add MEC172x support
Update the Microchip XEC PS2 driver to support MEC172x.
NOTE: MEC15xx has two PS2 controllers and
MEC172x has one.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-05-03 14:13:20 -05:00
Jay Vasanth
bacf4ff730 drivers: ps2: Standarize device tree and structure
Standardize PS2 device tree properties. Standardize device
structure usage. Abstract GIRQ and PCR register access.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-05-03 14:13:20 -05:00
Daniel DeGrasse
e8f7181c50 drivers: flash_mcux_flexspi_mx25um51345g: move all device data to RAM
since the flexspi driver interacts with the flash device, storing
device data in flash can cause RWW hazards when running in XIP mode.
Move all device data to RAM to limit these RWW hazards.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-03 13:38:55 -05:00
Daniel DeGrasse
836f0f5ee5 drivers: flash_mcux_flexspi_hyperflash: move all device data to RAM
since the flexspi driver interacts with the flash device, storing
device data in flash can cause RWW hazards when running in XIP mode.
Move all device data to RAM to limit these RWW hazards.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-03 13:38:55 -05:00
Daniel DeGrasse
7aa883b5df drivers: flash_mcux_flexspi_nor: Move all device data to RAM
Move all device data to RAM. Since the flexspi driver accesses the
flash device that is being used for XIP, various RWW hazards can occur
if the flexspi driver is interacting with the flash device, while
running in XIP mode.

Fixes #45182

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-03 13:38:55 -05:00
Bernardo Perez Priego
cfe4d51b4f drivers: sensor: Add adc-comparator binding and implementation for NPCX
Comparator will monitor signal though ADC channel, based on
user configuration, callback will be triggered.
This will enable comparator functionality for nuvoton MCU utilizing its
ADC threshold detection feature. Implementation is exported through
sensor trigger API. Use of CONFIG_ADC_CMP_NPCX is required.

Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>
2022-05-03 08:51:53 -05:00
Sam Hurst
3122a2c8b8 drivers: adc: Refactor code to remove warning
Refactor code so that an unused variable 'adc' warning
is not generated when building for CONFIG_SOC_SERIES_STM32G4X
and not using adc1 or adc5.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-05-03 09:37:28 +02:00
Henrik Brix Andersen
41a77be91c drivers: can: mcan: add shared initializer macros
Add shared initializer macros for struct can_mcan_config and struct
can_mcan_data.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-03 09:36:34 +02:00
Henrik Brix Andersen
5b3712a9ac drivers: can: mcan: refactor to get rid of wrapper functions
Refactor the Bosch M_CAN shared driver functions to get rid of the
front-end driver wrapper functions.

This requires flipping the relationship between shared config/data
structs and front-end config/data structs. Front-end drivers can now
store a pointer to their custom config/data structs in the .custom
fields of the can_mcan_config and can_mcan_data data structures.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-03 09:36:34 +02:00
Henrik Brix Andersen
7ea0951052 drivers: can: mcan: rename private header file
Rename the private header file for the Bosch M_CAN shared driver code
from can_mcan_int.h to can_mcan_priv.h to follow the common naming
scheme.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-03 09:36:34 +02:00
Mahesh Mahadevan
8566b00df3 drivers: counter: Add error checking to MCUX CTImer
Improve the error checking for the set_top_value function.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-02 13:33:54 -05:00
Daniel DeGrasse
a24f9f2e5a drivers: pinctrl: update help text for mcux rt pinctrl driver
update help text for mcux rt pinctrl peripheral driver, to clarify it
does not support RT600/RT500 parts and only RT1xxx series parts.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-02 13:28:10 -05:00
Daniel DeGrasse
dc9c886683 drivers: gpio: gpio_mcux_lpc: add pinmux setting support for IOPCTL
add support for setting pinmux when using IOPCTL peripheral, as well as
setting pin configuration properties.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-02 13:28:10 -05:00
Daniel DeGrasse
d5b719e084 drivers: pinctrl: add pin control driver for NXP RT600/RT500 SOCs
add pincontrol headers for IOCON peripheral present on NXP iMX RT600
and RT500 SOCs, and update LPC pin control driver for iMX RT family
differences.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-02 13:28:10 -05:00
Sylvio Alves
7022dcfd95 drivers: flash: esp32: add flash encryption support
Add flash encryption function check to redirect
flash write and read calls properly.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-05-02 10:30:24 -05:00
Sylvio Alves
6c6b688b91 driver: spi: esp32: update flash driver to use hal
This modification is required to enable flash encryption.
Using hal implementation of spi_flash calls maintains
compability amongs different socs while offering
latest esp-idf enhancements.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-05-02 10:30:24 -05:00
Francois Ramu
c2db84ee8a drivers: watchdog: stm32 iwdg starts with timeout install
It Follows the sequence to configure and launch the IWDG watchdog
for the stm32 mcus

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-02 10:27:44 -05:00
Francois Ramu
005968a81f drivers: dma: stm32 driver is using the STM32_DMA_STREAM_OFFSET
Includes the definition of the STM32_DMA_STREAM_OFFSET
depending on the peripheral to adjust the first DMA channel
in the list of streams.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-02 10:57:15 +02:00
Jun Lin
788714de20 driver: clock_control: npcx: don't gate the eSPI clock if eSPI is defined
In the EC application, the system may jump between two built Zephyr
images when necessary. If we gate the eSPI clock at initialzation, it
will make the eSPI configuration which established by previous image
break and lost the communication between EC and host.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-05-02 10:56:36 +02:00
Daniel DeGrasse
102f4c25f8 drivers: disk: remove legacy SDMMC SPI driver
remove existing SDMMC SPI driver, since it is replaced by the SPI mode
SD host controller driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse
c91d473ead drivers: imx_usdhc: change DT_COMPAT string to imx-usdhc
with the legacy USDHC driver fully removed from the tree, the
nxp,imx-usdhc binding can now be used for the new SD host controller
driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse
409cc23022 drivers: disk: remove legacy nxp USDHC driver
all in tree SOCs with the USDHC peripheral have now been converted to
use the new SD host controller USDHC driver, so remove legacy NXP disk
USDHC driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse
a3182ced7a drivers: sdhc: add SD SPI mode host controller driver
Add SDHC driver implementing spi mode support for SD cards. This driver
implements the standard SD host controller APIs, and sets the host
property "is_spi" to indicate to the SD subsystem the card will be
running in SPI mode.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse
a18338bf45 soc: rt11xx: Enable USDHC SD host controller on RT1170
Enable SD host controller driver for RT1170, so the EVK can use the new
SD subsystem.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse
a79f485487 drivers: disk: add SDMMC zephyr disk driver
Add generic sdmmc zephyr disk driver, which uses the SDMMC subsystem

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse
6aaa2b5d33 drivers: sdhc: Implement NXP USDHC SDHC driver
Implement SDHC driver for NXP USDHC peripheral, supporting all api calls
available in the sdhc driver. This implementation leverages NXP's HAL,
and simply implements a shim layer over the HAL itself.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Michal Sieron
5098aaa2d1 hwinfo: hwinfo_litex: Make compatible with both 8 and 32-bit CSRs
LiteX CSRs can only be accessed on addresses aligned to 4 bytes.
That's why in 32-bit CSRs case there is bit shifting needed.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
2485c0232b pwm: pwm_litex: Use LiteX HAL
Removed register sizes from config struct, as they are known.
This allowed to remove driver specific function reading from CSR and use
`litex_write*` functions from LiteX HAL.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
0bfa223c68 entropy: entropy_litex: Use LiteX HAL
Use `litex_read` instead of separate implementation in driver.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
34a4b2b916 serial: uart_liteuart: Use LiteX HAL
Use LiteX HAL functions instead of `sys_read*` or `sys_write*`
functions.
They use them inside, but choose which one to use according to
configured CSR data width.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
e3db9a49c8 ethernet: eth_liteeth: Avoid bitwise operations
With universal LiteX HAL working, there is no need to perform multibyte
reads and writes using bitwise operations.
Just use appropriate `litex_read*` or `litex_write*` function.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
0c738b7f79 ethernet: eth_liteeth: Use LiteX HAL
Use LiteX HAL functions instead of `sys_read*` or `sys_write*`
functions.
They use them inside, but choose which one to use according to
configured CSR data width.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
b9c836b70a timer: litex_timer: Use LiteX HAL
Use LiteX HAL functions instead of `sys_read*` or `sys_write*`
functions.
They use them inside, but choose which one to use according to
configured CSR data width.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
2e9154a418 soc: litex-vexriscv: Rewrite litex_read/write
Changes signature so it takes uint32_t instead of pointer to a
register.
Later `sys_read*` and `sys_write*` functions are used, which cast
given address to volatile pointer anyway.

This required changing types of some fields in LiteX GPIO driver and
removal of two casts in clock control driver.

There was a weird assert from LiteX GPIO driver, which checked whether
size of first register in dts was a multiple of 4.
It didn't make much sense, so I removed it.

Previous dts was describing size of a register in terms of subregisters
used. New one uses size of register, so right now it is almost always
4 bytes.

Most drivers don't read register size from dts anyway, so only changes
had to be made in GPIO and clock control drivers.

Both use `litex_read` and `litex_write` to operate on `n`bytes.
Now GPIO driver calculates this `n` value in compile time from given
number of pins and stores it in `reg_size` field of config struct like
before.

Registe sizes in clock control driver are hardcoded, because they are
tied to LiteX wrapper anyway.

This makes it possible to have code, independent of CSR data width.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Benedikt Schmidt
86469b1d0b drivers: clock_control: Make LSE driving configurable
Make the LSE driving capability configurable for the STM32 series.
Fixes #44737.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2022-04-29 16:11:34 +02:00
Yong Cong Sin
fbd0cd01d5 drivers: sensor: stm32_temp: setup channel before adc_read
Currently the driver only setup the ADC to read from the
internal temperature channel on init. However, it is possible
that some other application that uses the ADC can setup the
ADC to read from some other channel and therefore subsequent
stm32_temp_sample_fetch will fail to read the targeted channel.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-04-29 16:10:51 +02:00
Yong Cong Sin
94624dc0c5 drivers: sensor: stm32_temp: No need to calibrate ADC
The ADC should be calibrated on init, there is no requirement
to calibrate ADC again on stm32_temp_init, remove it.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-04-29 16:10:51 +02:00
Adrien Rouault
bc47f66062 drivers: lora: sx127x: fix missing reset gpio instantiation
Instantiate the value of `sx127x` reset GPIO

Signed-off-by: Adrien Rouault <adrien.rouault@nemeus.fr>
2022-04-29 15:30:10 +02:00
Henrik Brix Andersen
44f3f2e49b drivers: can: initialize CAN transceivers prior to CAN controllers
Change the default initialization priority for CAN transceiver from 70 to
45 to initialize them before the CAN controllers (with default a
initialization priority of 50).

Fixes: #45219

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-04-29 12:34:28 +02:00
Francois Ramu
41efe865ed drivers: dma: stm32 dma driver valid override control
This change is controlling of function parameters before
configuring the STM32_DMA_HAL_OVERRIDE mode.
Then, in case the DMA channel is not valid (wrong ID) or busy,
an error occurs before overriding the DMA channel.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-04-29 08:56:55 +02:00
Esteban Valverde
426c1f6aff drivers: i2c: Fix get_regs() to happen after DEVICE_MMIO_MAP
Fixing a bug where get_regs() was being executed before MMIO mapping
moving the declaration of reg_base after DEVICE_MMIO_MAP

Signed-off-by: Esteban Valverde <esteban.valverde.vega@intel.com>
2022-04-29 08:56:49 +02:00
Daniel DeGrasse
b0ec63fe01 drivers: led_pwm: fix build error
Remove stray parenthesis causing build error in led_pwm driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 08:56:42 +02:00
Leonard Pollak
35b55175cc drivers: sensor: bme680: Add SPI interface
This enables the SPI interface for the BME680 sensor driver.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2022-04-28 18:11:50 +02:00
Leonard Pollak
4e804bfa73 drivers: sensor: bme680: prep work
Consolidate the initialization routines and change the include guard to
conform with the coding guidelines as a preparation for the following
commits which add support for the SPI interface.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2022-04-28 18:11:50 +02:00
Leonard Pollak
8e7907aa6f drivers: sensor: bme680: fix constants
This fixes the constant for the mem page and replaces a
magic number with the already defined `BME680_LEN_COEFF2` constant.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2022-04-28 18:11:50 +02:00
Carlo Caione
69b28bfd07 pm: policy: Consider substates for state lock functions
Extend the current pm_policy_state_lock_*() functions to support
substates.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-04-28 16:32:23 +02:00
Gerard Marull-Paretas
04836af2a9 drivers: pwm: shell: fix pwm_set calls
PWM has a single set function now, macros like PWM_USEC() can be used to
specify other units than nanoseconds. This conversion was missed during
API updates.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 09:08:41 -04:00
Gerard Marull-Paretas
61f2ed8356 drivers: pwm: shell: fix struct variable name
The pwm field in struct args_index was missed when pwm was renamed to
channel in all drivers. As a result, the PWM shell could no longer be
built.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 09:08:41 -04:00
Jamie McCrae
9a50c70113 drivers: watchdog: it8xxx2: Prevent Kconfig option being wrongly shown
The it8xxx2 watchdog Kconfig options are always shown, for every type
of device, they should only be shown when an it8xxx2 device is being
targeted.

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2022-04-28 14:18:16 +02:00
Derek Snell
16a09b026e drivers: i2s: mcux_sai: fixed SAI driver
Includes several driver fixes and improvement to leverage
scatter/gather mode of DMA.  Loads multiple DMA blocks into TCDs.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Derek Snell
60dd576975 drivers: i2s: mcux_sai: fixed driver message pool sizes
Fixed bug if CONFIG_I2S_RX_BLOCK_COUNT and CONFIG_I2S_TX_BLOCK_COUNT
are different sizes.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Derek Snell
4ff7df43a2 drivers: i2s: mcux_sai: fixed RX not completing end of stream
RX FIFO watermark setting causing issue where last 16 words received
were stuck in FIFO, and not requesting DMA to move to buffer.  Fixed by
setting watermark to 0.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Derek Snell
984619b033 drivers: i2s: mcux_sai: fixed macro name for SAI_HAS_ON_DEMAND_MODE
corrected driver after HAL PR
https://github.com/zephyrproject-rtos/hal_nxp/pull/147

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Derek Snell
b052e657b8 drivers: i2s: mcux_sai: fixed i2s_mcux_config()
driver config settings were getting overwritten by APIs that set
default settings, like SAI_GetClassicI2SConfig().  Moved config code
after those APIs.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Derek Snell
5df8ead428 drivers: i2s: mcux_sai: allow TX FIFO to drain before disabling
i2s_tx_stream_disable() was disabling SAI transmitter before FIFO
could complete transmission.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Derek Snell
56903cab63 drivers: i2s: mcux_sai: add control for purging buffers
stream_disable()'s should not always purge buffers.
And i2s_rx_stream_disable() needs separate control for
purging in_queue and out_queue since app owns buffers
after placed in out_queue for i2s_read()

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Marek Janus
6505cbc085 drivers: dac: add mcp4728 driver
MCP4728 is a 12-bit, Quad Digital-to-Analog Converter with EEPROM Memory.
Controlled via I2C interface.

Signed-off-by: Marek Janus <marek.janus@grinn-global.com>
2022-04-28 14:17:34 +02:00
Gerard Marull-Paretas
ae91933c4a drivers: pwm: always use nanoseconds for set
In order to be consistent with what is possible in Devicetree, always
take a period in nanoseconds. Other scales or units may be specified by
using, e.g., the PWM_MSEC() macros (all of them converting down to
nanoseconds). This change then deletes the "_nsec" and "_usec" versions
of the pwm_set call.

Note that this change limits the period to UINT32_MAX nanoseconds,
~4.3s. PWM is, in generali, used with periods below the second so it
should not be a problem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas
2bc6279866 drivers: led: led_pwm: use pwm_dt_spec
Simplify the driver by using pwm_dt_spec.

TODO: decide if pwm_dt_spec should also store period.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas
10ee44c94b drivers/samples/tests: remove usage of deprecated PWM APIs
Use the new API calls that remove pin naming.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas
e2852ef985 drivers: pwm: use new API naming (no pin)
Use the API names without `_pin`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas
95b56cdffd drivers: pwm: remove _pin from API calls
In a first place, the PWM API operates on "channels", not "pins". While
the API calls could have been changed by _channel, this patch takes the
approach of just dropping _pin. The main reason is that all API calls
operate by definition on a channel basis, so it is a bit redundant to
make this part of the name. Because the `_dt` variants of the calls are
going to be introduced soon, the change to `_channels` + `_dt` would
make API function names quite long.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas
fbf73334f3 drivers: pwm: make all drivers use channel variable name
The variable indicating the PWM channel is now names "channel" instead
of "pwm", adjust all drivers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas
6f39b08343 drivers: pwm: gecko: fix access to timer register
The timer registers are accessible via the device config field, driver
code was wrong in one case (pwm is the variable indicating PWM channel).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas
aa37dedcaf drivers: pwm: ite_it8xxx2: remove wrong ARG_UNUSED
The pwm arg is used in the function, so placing ARG_UNUSED is wrong.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas
c11516ae90 drivers: pwm: ite_it8xxx2: add missing braces
Multiple if/else blocks had missing braces, add them as this violates
Zephyr coding guidelines.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Mahesh Mahadevan
5a5c1ae76d drivers: counter: Update NXP CTimer to implement set_top_value
Implement the set_top_value. This reserves one of the Match channels
to set the top value and to reset the counter.
Therefore the number of channels available to the user is reduced by 1.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-04-28 10:26:54 +02:00
Lukasz Maciejonczyk
5d5dcfa0b9 drivers: ieee802154_nrf5: fix target time for indirect transmission
After change in RD into 64-bit time, target time must be express in
absolute 64-bit time. Upper layer e.g. OpenThread still utilizes only
LSB of the RD time therefore the conversion is required.
Make sure that target time is absolute 64-bit target time.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-04-28 10:25:38 +02:00
Hake Huang
07d6adde51 driver: adc: fix build error for adc_dma
fsl_sim.h is not required as SDK upgrade

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-04-27 11:15:43 -05:00
Maxime Vincent
307a60e217 drivers/sensor: lis2dw12: add drdy pulsed/latched config
Add DT option to configure the data ready interrupt mode.
Latched is the default; pulsed can be enabled through
the drdy-pulsed DT, if desired.

Signed-off-by: Maxime Vincent <maxime@veemax.be>
2022-04-26 15:53:58 -04:00
Maxime Vincent
bf1334bafb drivers/sensor: lis2dw12: add threshold interrupt support
Add optional threshold interrupt support.
Implemented using SENSOR_TRIG_THRESHOLD sensor trigger type.
The features can be optionally enabled through Kconfig,
or disabled for smaller code size.

Signed-off-by: Maxime Vincent <maxime@veemax.be>
2022-04-26 15:53:58 -04:00
Maxime Vincent
652ab7f2d4 drivers/sensor: lis2dw12: add fds + hp_ref support
Add FDS (Filtered Data Type Selection) + High-Pass reference mode support
(FDS in CTRL6, HP_REF_MODE in CTRL7)
Values are configurable through DT per instance.

Signed-off-by: Maxime Vincent <maxime@veemax.be>
2022-04-26 15:53:58 -04:00
Maxime Vincent
2d2a708bc8 drivers/sensor: lis2dw12: add low_noise support
Add low_noise support. (LOW_NOISE in CTRL6)
Value is configurable through DT per instance.

Signed-off-by: Maxime Vincent <maxime@veemax.be>
2022-04-26 15:53:58 -04:00
Maxime Vincent
47021a608d drivers/sensor: lis2dw12: add bw_filt support
Add bandwidth filter support. (BW_FILT in CTRL6)
Value is configurable through DT per instance.

Signed-off-by: Maxime Vincent <maxime@veemax.be>
2022-04-26 15:53:58 -04:00
Huifeng Zhang
bd55003f70 driver: uart_pl011: refine creating device instance code
Old code only create one pl011 device instance though there are two or
more pl011 device defined in devicetree. This patch can fix this issue.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2022-04-26 14:20:57 -05:00
Marcin Niestroj
03d0b982a4 drivers: sensor: lis3mdl: return -ENOTSUP on unsupported channels
sensor_channel_get() API should return -ENOTSUP when requested channel
is not supported. This behavior allows to use `sensor get DEVNAME` shell
command easily, as all unsupported channels are filtered out.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-26 13:14:44 -05:00
Herman Berget
bfbbaf2cdb Bluetooth: Fix compilation for entropy_bt_hci
An application with the following config fails to link on nrf53 app
core:

```
CONFIG_BT=y
CONFIG_BT_HCI_RAW=y
CONFIG_ENTROPY_GENERATOR=y
```

This happens because `entropy_bt_hci.c` uses functions from
`hci_core.c`, which is only compiled if `BT_HCI_HOST` is selected.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-26 09:00:03 +02:00
Maureen Helm
5769dffc01 drivers: mm: Use dt_compat_enabled for Intel ADSP TLB driver default
Enables the Intel TLB driver by default when the MM driver class is
enabled (CONFIG_MM_DRV=y) and a compatible devicetree node
("intel,adsp-tlb") is enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-04-25 11:41:31 -07:00
Xavier Chapron
bfcb181b49 drivers: gpio: pca95xx: Add support for PCAL95xx
Introduce has-interrupt-mask-reg DTS property for nxp,pca95xx driver.
This additionnal property allow to specify that the gpio expander has an
interrupt mask register that must be configured by the driver.
This allow to use this driver with PCAL95xx.
This fixes issue #44834.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2022-04-22 14:19:21 -05:00
Jose Alberto Meza
09ca5cc9cb drivers: espi: Correct default eSPI to UART mapping
Correct default mapping for eSPI UART virtual port to SoC UART
for MEC172x.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-04-22 10:46:18 -05:00
Daniel DeGrasse
557a0c766c drivers: lpuart: enable loopback mode
NXP LPUART IP supports loopback mode, where TX is internally connected
to RX input. Allow setting loopback mode up via the "nxp,loopback" dts
property.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-22 09:44:19 +02:00
Daniel DeGrasse
17d9bea474 drivers: edma: allow transfer descriptors to be placed in SRAM
SOCs using the EDMA IP that supported caching must locate EDMA transfer
control descriptors (TCDs) in non cacheable memory. For M7 cores, this
can simply use the "nocache" section. For M4 cores, where the nocache
section does not exist, the chosen SRAM section must be a tightly
coupled memory block which cannot be cached. Add a note to all boards
with M4 SOCs that support caching explaining this issue, and enable EDMA
driver to locate TCDs in SRAM.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-22 09:44:19 +02:00
Daniel DeGrasse
fdc247fed3 drivers: mcux_lpuart: make async api use common LPUART ISR
LPUART driver should use shared ISR for all possible use cases,
including ASYNC API, so that multiple features requiring ISR can be
enabled simultaneously.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-22 09:44:19 +02:00
Andrzej Głąbek
5609bc48dd drivers: pwm_nrf5_sw: Add support for PWM_POLARITY_INVERTED flag
Add support for inverting of PWM channel outputs in the pwm_nrf5_sw
driver by properly handling the `PWM_POLARITY_INVERTED` flag.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-22 09:43:26 +02:00
Andrzej Głąbek
c23a449bfb drivers: pwm_nrf5_sw: Treat pwm parameter as PWM channel, not SoC pin
Align with other PWM drivers and treat the `pwm` parameter (described
ambiguously as "PWM pin") of the `pwm_pin_set_cycles` function as a PWM
channel, not an SoC pin. This will also make the driver consistent with
the `pwm-cells` property definition in the "nordic,nrf-sw-pwm" binding
and with related `DT_PWMS_*` macros.
The change described above requires also providing a way to specify
SoC pins that are to be assigned to the PWM channels. Hence, the commit
introduces in the "nordic,nrf-sw-pwm" binding the `channel-gpios`
property that replaces the `channel-count` one.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-22 09:43:26 +02:00
Andrzej Głąbek
e7a075f460 drivers: pwm_nrfx: Add support for PWM_POLARITY_INVERTED flag
Add support for inverting of PWM channel outputs in the pwm_nrfx driver
by properly handling the `PWM_POLARITY_INVERTED` flag.
The dts properties that were used so far for inverting of the outputs
("nordic,invert" and "chX-inverted") are kept as they are needed for
setting of the initial polarity, i.e. for setting the inactive state
of the outputs before any PWM signal generation is requested for them.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-22 09:43:26 +02:00
Andrzej Głąbek
dbdbc79b36 drivers: pwm_nrfx: Treat pwm parameter as PWM channel, not SoC pin
Align with other PWM drivers and treat the `pwm` parameter (described
ambiguously as "PWM pin") of the `pwm_pin_set_cycles` function as a PWM
channel, not an SoC pin. This will also make the driver consistent with
the `pwm-cells` property definition in the "nordic,nrf-pwm" binding
and with related `DT_PWMS_*` macros.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-22 09:43:26 +02:00
Johannes Meister
7d1c15d09e drivers: peci: xec: Handle PECI command PING properly
Handle PECI command PING properly, also get Write FCS Byte as a check.
Now it is possible to perform a PECI Ping without crashing the bus or
blocking it for subsequent PECI transactions.
It is also possible to check whether the Ping was sucessful
or not with the Write FCS Byte.

Signed-off-by: Johannes Meister <johannes.meister@kontron.com>
2022-04-21 07:45:45 -05:00
Erwan Gouriou
e476fcff78 include/dt-bindings: clocks: stm32h7: Use _C1_ registers offset
STM32H7 series offer alias addresses to access some registers that could
be accessed by the M4 core on dual core variants.
For instance RCC_AHB3ENR could be accessed at following offsets:
- 0x0D4: Accessible from both cores
- 0x134: Accessible from C1 (M7) core
- 0x194: Accessible from C2 (M4) core (if any)

For most single core H7 variants, the two first addresses were accessible,
but for some others (stm32h7ax/stm32h7bx), only the 'C1 accessible'
was available.

This fact used to be hidden by the use of LL API to access these registers,
providing the required abstraction (an mainly using the first alias
when possible to simplify implementation).

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
f6c665bac3 drivers/clock_control: stm32u5: Fix on flash latency procedure
Instead of computing hclk freq use for flash latency setting after
setting the PLLs, do it right at the beginning of the function.
Indeed, first step of PLL configuration is to switch back sysclock
to HSI source (in case it was initially PLL).
In that case, flash latency is theoretically set in consistency with PLL
driver hclk. So we should "measure" hclk freq at that step rather than
once sysclock is back on HSI.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
efd8ee465c drivers/clock_control: stm32 common: Remove intermediate hclk variable
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC is the actual hclk freq (ie core clock);
Remove use of intermediate new_hclk_freq to fix and simplify code.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
18b3fcd86d drivers/clock_control: stm32 common: Set flash latency code under switch
Some specific F1 variants don't handle flash latency.
Put flash latency dealing code under dedicated switch.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
b636e4c799 drivers/clock_control: stm32 common: Use new bus clock bindings
Make use of new bus clocks bindings and make subsequent code
simplifications.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
92a741c2ae drivers/clock_control: stm32: style edits on set_up_fixed_clock_sources()
Review code style in set_up_fixed_clock_sources() for better
readability.
Use of 'if (IS_ENABLED(STM32_MSI_ENABLED))' inside '#if STM32_MSI_ENABLED'
is redundant but intentional as it is in line with remaining part of the
function (HSE/HSI cases).

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
693ba04796 dts: stm32: Add rcc prop undershoot-prevention
On some parts,  it could be required to use steps before applying
highest frequencies.
This was previously done as part of LL_PLL_ConfigSystemClock_FOO
utility functions which are no more used.
Use device tree to mention when this is required and implement it
in stm32_clock_control_init().

Additionally, fix the calls tp LL_RCC_SetAHBPrescaler, which require
use of ahb_prescaler helper.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
c4ff7d1e19 drivers/clock_control: stm32_common: Add elementary PLL configuration step
Introduce a set_up_pll configuration function and make PLL configuration
an elementary step of the whole system clock configuration.

To implement this new, function make use of the existing series specific
files which allows series specific configuration when required.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
f94ad7538e drivers/clock_control: stm32 common: Group fixed clocks init
Group fixed clocks inits in a unique set_up function.
Each clock is initialized depending on its dts status.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
f6db7afb60 drivers/clock_control: stm32 common: Use DT macros for bus prescalers
Simplify and clean up driver code using STM32 clocks DT based macros.

Added STM32_FLASH_PRESCALER macro for this purpose.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
30f0af97f8 drivers/clock_control: stm32 common: Factorize flash latency setting
Make use of LL_SetFlashLatency in all cases to update flash latency.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
4b062ca15e drivers/clock_control: stm32 common: Factorize freq bus setting
Factorize setting of frequency for busses.
Additionally, factorize SysCoreClock update.

The operations are now done twice in case of PLL since they are part
of LL utils PLL configuration function, but they are removed in next
commits.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
d04802283b drivers/clock_control: stm32 common: Don't disable fixed clocks
Each clock should be configured individually by device tree,
don't disable them blindly.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
8594be2cb3 drivers/clock_control: stm32u5: Use fixed clocks set up to configure PLLs
Take advantage of previous work to configure PLL and remove
usage of LL_PLL1_ConfigSystemClock_FOO utils functions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
e97d608282 drivers/clock_control: stm32u5: Clean up fixed clocks functions.
Now that fixed clocks are enabled in a single function, a
bunch of functions could now be removed.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
ebb1d79e8f drivers/clock_control: stm32u5: Move clock init to a single function
Move fixed clocks initialization to a single function.
Benefit is they could now be enabled independently of the
main clock configuration based on dts status and then be
used by peripherals even is not part of the main clock tree.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
30b3a5ffe7 drivers/clock_control: stm32u5: Centralize regu voltage setting
Similar to other general settings, centralize regu voltage
setting.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
6dfe13120c drivers/clock_control: stm32u5: Centralize flash_latency update
Flash latency setting could be factorized in a single location,
rather than split in each clock setting function.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
7175da2645 drivers/clock_control: stm32u5: Don't disable other clocks
Don't disable other clocks after a clock is configured.
This should be left to the API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
41ecdb9d14 drivers/clock_control: stm32u5: Factorize bus prescalers settings
Move prescaler settings to the clock_control_init function.
At this step they will be set up twice in PLL case, this will
be fixed in a next step.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
2efcabbc4c drivers/clock_control: stm32u5: Update SystemCoreClock at a single place
Move update of CMSIS variable SystemCoreClock at a single place
in a more direct way.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
0c60fcd40d drivers/clock_control: stm32u5: Use new clock bindings
This change updates stm32u5 driver to make use of new clock bindings.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
bc37d41051 drivers/clock_control: stm32h7: Fixes on function declarations
Fix minor issues on some functions headers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
61a9016f88 drivers/clock_control: stm32h7: Change clock bus bindings values
Set bus binding values using registers offset values.
As a consequence update driver to take this into account
in clock_on and clock_off functions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Thomas Altenbach
c5ebea590f drivers/flash: stm32h7: fix fault when cache disabled
Add a check to avoid invalidating the cache when the latter is disabled.
Indeed, doing so can lead to a bus fault.

Signed-off-by: Thomas Altenbach <taltenbach@witekio.com>
2022-04-21 13:05:08 +02:00
Jordan Yates
f280114f0e console: semihost_console: use semihost API
Update the semihost_console implementation to use the semihost API
instead of manually constructing the supervisor calls.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-04-21 13:04:52 +02:00
Jordan Yates
070422db46 arch: common: dedicated SEMIHOST symbol
Control the usage of semihosting with a dedicated symbol, instead of
implying semihosting from the usage of `SEMIHOST_CONSOLE`. This allows
semihosting to be used without the semihost console.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-04-21 13:04:52 +02:00
Mateusz Sierszulski
06e4f36b4b fpga controller: drivers: add ZynqMP driver
This commit adds support for fpga driver on ZynqMP SoC.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2022-04-21 13:00:57 +02:00
Henrik Brix Andersen
e4c93c3a60 drivers: can: mcp2515: do not soft-reset device when changing timing
Do not soft-reset device when changing timing parameters as the
soft-reset will discard the configured CAN controller mode.

Fixes: #44837

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-21 13:00:46 +02:00
Henrik Brix Andersen
45d4909024 drivers: can: stm32fd: rename CONFIG_CAN_STM32_CLOCK_DIVISOR
Rename CONFIG_CAN_STM32_CLOCK_DIVISOR to
CONFIG_CAN_STM32FD_CLOCK_DIVISOR to match driver Kconfig name.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-21 13:00:20 +02:00
Henrik Brix Andersen
322b436b30 drivers: can: stm32fd: add clock source selection
Add support for selecting the CAN clock source. Change previously
hardcoded value of PCLK1 to HSE.

Fixes: #44985

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-21 13:00:20 +02:00
Andreas Pettersson
cd9c82bff2 drivers: sensor: lsm6dso: Remove usage of undefined variable
Remove usage of undefined variable, and remove unused variable.

Fixes issue https://github.com/zephyrproject-rtos/zephyr/issues/42588

Signed-off-by: Andreas Pettersson <andreaspettersson95@gmail.com>
2022-04-20 08:59:35 -05:00
Glauber Maroto Ferreira
7064e31101 esp32: drivers: uart: remove uart_num
When using pin states, uart_num is no
longer required.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
84c6edd247 esp32: driver: pinmux: driver removal
Removal of ESP32's pinmux driver since it
was deprecated by pinctrl.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
5e549b57b6 esp32: drivers: gpio: remove pinmux dependency
Refactor the GPIO driver code to remove dependency
from the pinmux API.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
9354749cb5 esp32c3: drivers: spi: removal of unused definitions
Clean up of pin signals definitions previously used
by the pinmux driver, now deprecated by the use of
the pinctrl API.

Refactor device tree macros usage to make usage of
SPI instances more general.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
00bdbb52c5 esp32c3: drivers: pinctrl: initial support
add initial pinctrl driver support for ESP32C3.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
52dbd305da esp32s2: drivers: i2c: tweak FSM-related logic
Differently from ESP32, the ESP32-S2 SoC has native
hal support to reset its own I2C FSM in case of failure.
This commit removes warnings related to unused reset
logic, which does not really apply to ESP32-S2.

It also removes code and data structures related to pin
information from the build when the target SoC supports
hardware mechanisms to reset the I2C FSM.

Finally, it checks at compile time if the preconditions
for correct bus recovery are being met.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
6303118260 esp32s2: drivers: spi: removal of unused definitions
Clean up of pin signals definitions previously used
by the pinmux driver, now deprecated by the use of
the pinctrl API.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
2b44028777 drivers: pinctrl: esp32s2: initial support
add initial pinctrl driver support for ESP32S2.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
bcf79464fa esp32: drivers: i2c: use pinctrl
though using pinctrl's subsystem, the I2C driver
keeps pin information in case of communication
failure. This information is needed in case of
FSM failure.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
40a80d236e drivers: spi: esp32: use pinctrl API
and removes references/usage of old pinmux properties.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
a9aef448ab drivers: serial: esp32: use pinctrl API
and removes references/usage of old pinmux properties.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
135f4f772a drivers: pinctrl: esp32: initial support
add initial pinctrl driver support for ESP32.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Robert Lubos
7946988b16 net: sockets: Add separate macro for registering offloaded sockets
Add a separate macro for registering offloaded sockets implementation,
along with information in the structure whether the implementation is
offloaded or not. This allows to differentiate between native and
offloaded socket implementations, which is critical for binding socket
API with an interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-04-20 11:27:05 +02:00
Robert Lubos
fa8ba73833 net: if: Connect interface with offloaded socket implementation
Instead of keeping a boolean informing whether a network interface is
offloaded at socket layer or not, keep a pointer to a function which
allows to create an offloaded socket. Native interfaces keep this as
NULL, while for offloaded interfaces it allows to connect an offloaded
socket implementation with an interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-04-20 11:27:05 +02:00
Daniel DeGrasse
916c059f3d drivers: pinctrl: update lpc pin control implementation to use offsets
update pin control implementation to use offsets for pin registers
instead of pin/port combination, to permit additional flexibility for
lpc devices with non contiguous register layouts. Update LPC55s69 pin
control names to align with newly generated pin control header.

This change also requires an update to the NXP HAL to use the new pin
control headers with offsets.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-19 15:53:50 -05:00
Henrik Brix Andersen
17dcc73944 drivers: can: mcp2515: fail when trying to set unsupported mode
Do not silently ignore attempts to set an unsupported mode. Return
-ENOTSUP instead.

Fixes: #44706

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-19 11:47:49 +02:00
Henrik Brix Andersen
3d433cca26 drivers: can: add missing can_get_max_filters() syscall handler
Add missing syscall verification handler for can_get_max_filters().

Fixes: #44687

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-19 11:47:40 +02:00
Henrik Brix Andersen
d311af4bf4 drivers: can: mcan: report error on no available extended CAN-ID filters
Only add the filter ID offset for extended CAN-ID filters if the filter
was added successfully. Raise log level from info to warning if filter
addition failed but only log it once.

Fix bounds check for removing an extended CAN-ID filter.

Fixes: #44721

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-19 11:47:40 +02:00
Henrik Brix Andersen
51053932a3 drivers: can: mcux: flexcan: fix mailbox allocation for errata 5461/5829
Commit a50b69dfb7 introduced a work-around
for FlexCAN errata 5461 and 5829, but neglegted to take the RX mailbox
offset into account when calculating maximum number of mailboxes
allocated for RX/TX.

Fixes: #44724

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-19 11:47:40 +02:00
Henrik Brix Andersen
085ee2b0b8 drivers: can: stm32: remove can_get_max_filters() support for now
Remove support for the optional API function can_get_max_filters() from
the STM32 bxCAN driver for now.

The function returns the Kconfig value for the maximum number of filters
but the true number of supported filters may be different due to the
filter nature of the STM32 bxCAN driver implementation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-19 11:47:40 +02:00
Georgij Cernysiov
cf9df290da drivers: memc: stm32: add FMC NOR/PSRAM driver
Adds STM32 FMC NOR/PSRAM controller driver.

The implementation follows FMC SDRAM driver
approach and uses HAL API. Tested on H7 series.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-04-19 11:47:06 +02:00
Henrik Brix Andersen
d5f3f20edb drivers: can: allow calling can_set_bitrate() from userspace
Add syscall to allow calling can_set_bitrate() from userspace.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-18 17:23:28 -07:00
Tom Burdick
2f320730a1 dma/cavs_hda: Adds link in/link out compatibles
Adds hda link in and out drivers. The link in and link
out channels of HDA have small differences
with the host channels. Updates the existing
cavs_hda drivers and code to account for these
differences.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-18 19:19:40 -04:00
Vaishnav Achath
98f1a98cf5 drivers: pinmux: remove cc13xx_cc26xx pinmux driver
all the consumers of the obsolete pinmux driver is
updated to use pinctrl API, this commit removes
the pinmux driver and assosciated sections.

Signed-off-by: Vaishnav Achath <vaishnav@beagleboard.org>
2022-04-18 18:19:46 -04:00
Vaishnav Achath
ace77c71e9 drivers: CC1XX/CC26XX based boards: transition to pinctrl driver
This commit has the necessary changes to update the consumers
of pinmux driver(SPI, I2C, UART) and update the board specific
files to use the pinctrl interface.

Signed-off-by: Vaishnav Achath <vaishnav@beagleboard.org>
2022-04-18 18:19:46 -04:00
Vaishnav Achath
e2ed8cf130 drivers: pinctrl: add CC13XX/CC26XX pinctrl driver
Add pinctrl driver for CC13XX/CC26XX family of SoCs
to facilitate transition from pinmux to pinctrl.

`IOCPortConfigureSet()` from TI hal driverlib used to
implement the generic pinctrl driver.

Signed-off-by: Vaishnav Achath <vaishnav@beagleboard.org>
2022-04-18 18:19:46 -04:00
Oliver Stäbler
74c1d35900 drivers: i2c: flexcomm: Add i2c slave support
Add i2c slave support to mcux_flexcomm driver.

Signed-off-by: Oliver Stäbler <oliver.staebler@bytesatwork.ch>
2022-04-15 14:07:30 -05:00
Georgij Cernysiov
3650664875 drivers: pwm: stm32: support counter modes
Adds support for different timer counter modes.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-04-15 11:59:16 -07:00
Georgij Cernysiov
366bf47c27 drivers: pwm: stm32: remove obvious comments
Removes obvious comments from the PWM
configuration struct.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-04-15 11:59:16 -07:00
Ruibin Chang
7b43deedd5 ITE drivers/watchdog: clean up the #ifdef
Use if(IS_ENABLED(...)) {...} instead.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-04-15 10:35:35 -07:00
Ruibin Chang
4aa6e98292 ITE drivers/kscan: clean up it8xxx2 kscan driver
1.Declare the member type to match the kscan_it8xxx2_regs, so
we needn't to transform the local structure in the function.
2.Stop using DRV_CONFIG, DRV_DATA, DRV_REG macros.
3.Delete unused register defines.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-04-15 10:35:35 -07:00
Bartosz Bilas
e4950bc729 drivers: serial: xen: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
6f6ef91fa7 drivers: watchdog: it8xxx2: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
7c77e7ee08 drivers: sensor: qdec_sam: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
f5f110bb36 drivers: pcie: iproc: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
fbb275d246 drivers: interrupt_controller: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
4e59730728 drivers: i2s: litex: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
ec9122b649 drivers: gpio: sx1509b: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
e627d409af drivers: gpio: pca95xx: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
1afccdf3f1 drivers: ethernet: stm32_hal: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
6540964e55 drivers: espi: xec_v2: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
4c033df0f5 drivers: espi: xec: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
c51210beb0 drivers: dma: mcxuc_edma: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
55d4282e44 drivers: dac: sam0: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Nickolas Lapp
f1b0b458b0 uart_mcux_lpuart: Enable Asynchronous UART API.
This PR enables the Ansynchronous UART API for using the MCUX drivers.
It is tested on the RT1062EVKB.

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
2022-04-14 15:21:58 -05:00
Nickolas Lapp
c959ae81d6 dma_mcux_edma: Fixup Scatter-Gather EDMA Mode
This PR fixes up the Scatter-Gather EDMA mode for the MCUX EDMA Driver,
as well as enabling the dma reload feature for the same EDMA Driver.

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
2022-04-14 15:21:58 -05:00
Immo Birnbaum
673b79440f drivers: ethernet: xlnx_gem: remove unnecessary "EOF" comments
remove unnecessary EOF comment lines at the end of each file.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-04-14 14:43:52 -05:00
Tom Burdick
06cc6fe7a0 dma: dw: Use a LLI pool per device
Multiple instances of the device would have inadvertently shared the
LLI pool potentially causing nasty bugs.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-14 15:06:02 -04:00
Jaska Uimonen
8d38b64fdc drivers: dai: add dai driver subdir and ssp driver
Add Intel ssp driver using dai interface.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-04-14 11:42:08 -04:00
Henrik Brix Andersen
ce18e41400 drivers: can: mcux: flexcan: only initialize the FlexCAN IP once
Only initialize the FlexCAN IP core once since initialzing it has the
side effect of resetting the IP core and thus clearing previous settings
such as RX filters.

Fixes: #44680

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-14 09:06:11 +02:00
Francois Ramu
bf49a04dcf drivers: flash: stm32 definition of all registered bitfield
redefine all the stm32 flash register bit Name from
FLASH_NSCR_xxx to FLASH_STM32_FLASH_NSCR_xxx
in all the zephyr drivers.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-04-13 13:55:34 -07:00
Francois Ramu
623b0418b6 drivers: flash for the stm32l5x or stm32u5 serie with max 2MB
Adds the stm32u5 flash controller driver for this serie
to the existing stm32l5 flash driver part
Only 1 or 2 MB devices exist today (4MB is possible in the future).
This flash controller driver is adapted from the flash_stm32l5.c

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-04-13 13:55:34 -07:00
Francois Ramu
269adf5ca8 drivers: flash stm32 flash driver includes stm32u5 serie
This adds the stm32U5 soc family to the flash driver
The flash controller has particular register names in the Non-Secure
area to be adapted for the driver.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-04-13 13:55:34 -07:00
Attie Grande
cfad60d4dd spi: sam0: fix fast-rx path, and refresh comments
The SAM0 fast-path implementation was broken, and partially fixed in
commits 8181eed and 8a99bd0...

This patch resolves an issue where the MSB is always zero on SAML21
parts, and appears to follow suit with the previous patches.

This patch also refreshes the commentary, and removes mention of the
"interleaved" operation that is no longer used - which appears to have
been problematic in the past.

In addition to this, it also resolves an off-by-one error in both the
fast_rx and fast_rxrx paths, which would have been tripped when
transmitting a zero-byte buffer.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-04-13 13:32:45 -07:00
Henrik Brix Andersen
fba27b4bde drivers: can: change sample point for can_set_bitrate() at high bitrates
CAN in Automation (CiA) 301 v4.2.0 recommends a sample point location of
87.5% percent for all bitrates. However, some CAN controllers have
difficulties meeting this for higher bitrates.

Change can_set_bitrate() to use a sample point of 75.0% for bitrates
over 800 kbit/s, 80.0% for bitrates over 500 kbit/s, and 87.5% for all
other bitrates. This is in line with the sample point locations used by
the Linux kernel.

Regard a sample point error of more than +/- 5.0% as an error in setting
the bitrate. Previously, any sample rate error was accepted without
providing any feedback to the caller. This is in line with the CAN
sample point calculation criteria used by the Linux kernel.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-13 13:28:06 -07:00
Diogo Correia
70e1f97ca4 drivers: sensor: bmi160: fix waiting time before reading CHIP_ID
Value changed from 100us to 150us. Value was not enough upon softreset.
This value was arbitrarily chosen and should be changed if more
information on the subject is provided.

Fixes #43794

Signed-off-by: Diogo Correia <dcorreia@protonmail.com>
2022-04-13 12:57:31 -07:00
Hu Zhenyu
2824696d11 dts: mec172xevb_assy6906: Add pwm-0 alias to mec172xevb dts file
Enable tests/drivers/pwm/pwm_api test case on both west and twister

Signed-off-by: Hu Zhenyu <zhenyu.hu@intel.com>
2022-04-13 12:02:46 -05:00
Jay Vasanth
32bc328f8b espi: mec172x kbc: Enable custom configs
Enable custom configs for KBC IBF event data and KBC
OBF callback from ISR.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-13 08:52:57 -05:00
Jay Vasanth
b530be4591 espi: mec172x: kbc0_ibf_isr: read sts before data
Read KBC Status register before reading KBC Data register
in kbc0_ibf_isr; since read data will clear status.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-13 08:52:57 -05:00
Jay Vasanth
3abfb58741 espi: mec172x: Read ACPI EC data in IBF ISR
Handle ACPI EC0 and ACPI EC1 IBF ISR by reading input
data in the ISR

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-13 08:52:57 -05:00
Jay Vasanth
9431e7d128 espi: mec172x: (ACPI EC0 / custom) opcodes support
Add support for ACPI EC0 and custom opcodes

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-13 08:52:57 -05:00
Jay Vasanth
e24e643977 espi: align Mec172x ec_host_cmd_sram buffer
Make ec_host_cmd_sram[] buffer align on a 8-byte
boundary

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-13 08:52:57 -05:00
Jay Vasanth
a6f7158617 drivers: i2c: Microchip MEC172x support device tree clock frequency
Modify the Microchip MEC172x I2C driver to use the device tree I2C
clock-frequency property and driver initialization time. Also, fixed
missing idle scaling register programming.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-12 13:27:14 -05:00
Dominik Ermel
92b299ff28 drivers/flash/flash_shell: Check for read error before verification
The cmd_write contains write verification that compares what has
been written with what it can read; the flash read operation
status was not checked which means that the bus or communication
problem was reported the same way as malformed write.
There have also been some optimization done by removal
of multiplications.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-12 10:05:40 -05:00
Dominik Ermel
35616d1e63 drivers/flash/flash_shell: Write buff size dependent on shell
The commit changes default buffer size for flash write operations
to be CONFIG_SHELL_ARGC_MAX dependent; there is no point to define
buffer longer than number of write bytes that will be extracted
from command line arguments.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-12 10:05:40 -05:00
Dino Li
13a2e8200e it8xxx2: intc: ensure IER disabling to become effective
We put disabling SOC interrupt enable register (IER) sequence in
between disable and enable core's global interrupt to prevent race
condition.
After core interrupt enable instruction has been executed, the new
configuration of IER has not yet been fully processed due to
asynchronization between core and SOC's source clock.

If SOC interrupt is fired under the above condition, we will get
IRQ number 0 in ISR due to IER disabling taken effect.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-04-12 09:55:12 +02:00
Andrzej Głąbek
42275c263b drivers: pwm_nrf5_sw: Use the PPI FORK feature when available
This way, when RTC is used as the generator, one PPI channel per each
configured PWM channel can be saved.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-12 09:51:53 +02:00
Andrzej Głąbek
d683ad0300 drivers: pwm_nrf5_sw: Correctly use all channels provided by generator
Use compare channel 0 in the generator for handling the PWM period.
This way all other channels offered by the generator can be easily
used for handling pulses on particular PWM channels.
So far the driver allowed to configure more than 3 channels for certain
TIMER instances, but since channel 3 was always used for the period,
the generation could not work in such setups.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-12 09:51:53 +02:00
Andrzej Głąbek
f73618906d drivers: pwm_nrf5_sw: Correctly use allocated GPIOTE channels
The driver improperly uses the PWM channel index to reference
the GPIOTE channel to be used for the PWM signal generation.
Consequently, the PWM signal on a given channel can be correctly
generated only if both those indexes are by chance the same.
Fix this by switching to use the stored index of the actually
allocated GPIOTE channel.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-12 09:51:53 +02:00
Lingao Meng
37e561f42e Bluetooth: Host: Add choice select whether BT RX
Change CONFIG_BT_RECV_IS_RX_THREAD into a
choice:CONFIG_BT_RECV_CONTEXT with the following options
(names can be discussed further of course):

    CONFIG_BT_RECV_BLOCKING
    CONFIG_BT_RECV_WORKQ_BT
    CONFIG_BT_RECV_WORKQ_SYS

This way users would be able to choose what to run most of
the BLE stack on, they wouldn't be forced to a single model.

We would default to CONFIG_BT_RECV_BLOCKING so that we wouldn't
need to change the system workqueue stack size by default, instead
asking users to do so if they select the CONFIG_BT_RECV_WORKQ_SYS option

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-04-11 10:58:09 +02:00
Georgij Cernysiov
2dca9d859a drivers: memc: stm32: add support for st,mem-swap
Implements H7 FMC binding memory remap
or swap configuration.

Enables:
* sdram-sram - swaps the NOR/PSRAM and SDRAM banks.
* sdramb2 - remaps SDRAM bank 2.

Does nothing for 'disabled' value (default mapping, reset state).

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-04-09 12:58:57 +02:00
Mateusz Sierszulski
6d56b82942 drivers: fpga: connect dts node with fpga driver
This commit connects the eos_s3 fpga driver with fpga dts node.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2022-04-08 15:54:33 -07:00
Marcin Niestroj
bc5432bd43 wifi: simplelink: implement 'is_supported' socket offload cb
Check if requested socket family, type and protocol are all supported by
the driver, instead of blindly acknowledging every possible variant.

Reuse switch statements checking valid parameter values that were
already part of simplelink_socket() function, by creating 3 helper
functions for conversion of each parameter (family, type and protocol)
from Zephyr to Simplelink values.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:51:24 -07:00
Marcin Niestroj
9531db73d0 wifi: eswifi: implement 'is_supported' socket offload cb
Check if requested socket family, type and protocol are all supported by
the driver, instead of blindly acknowledging every possible variant.

There is explicit support for UDP, TCP and TLS on top of IPv4.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:51:24 -07:00
Marcin Niestroj
f9e2fad7e3 modem: quectel-bg9x: implement 'is_supported' socket offload cb
Check if requested socket family, type and protocol are all supported by
the driver, instead of blindly acknowledging every possible variant.

There is explicit support for TCP on top of IPv4 and IPv6.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:51:24 -07:00
Marcin Niestroj
61dfdf1d60 modem: sim7080: implement 'is_supported' socket offload cb
Check if requested socket family, type and protocol are all supported by
the driver, instead of blindly acknowledging every possible variant.

There is explicit support for UDP and TCP on top of IPv4 and IPv6.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:51:24 -07:00
Marcin Niestroj
a0c5c176a0 modem: ublox-sara-r4: implement 'is_supported' socket offload cb
Check if requested socket family, type and protocol are all supported by
the driver, instead of blindly acknowledging every possible variant.

There is explicit support for UDP, TCP and TLS on top of IPv4 and IPv6.
TLS seems to be supported only in 1.2 version, so allow just that
version.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:51:24 -07:00
Marcin Niestroj
a905ceb99e wifi: simplelink: use NET_SOCKETS_OFFLOAD_PRIORITY
Use NET_SOCKETS_OFFLOAD_PRIORITY instead of
NET_SOCKETS_OFFLOAD_PRIORITY, so that by default offloaded sockets will
be used instead of native sockets.

Addiitonally this allows to select relative priority of offloaded TLS
versus native TLS when used together with NET_SOCKETS_TLS_PRIORITY.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:50:11 -07:00
Marcin Niestroj
fe90e4932b wifi: eswifi: use NET_SOCKETS_OFFLOAD_PRIORITY
Use NET_SOCKETS_OFFLOAD_PRIORITY instead of
NET_SOCKETS_OFFLOAD_PRIORITY, so that by default offloaded sockets will
be used instead of native sockets.

Addiitonally this allows to select relative priority of offloaded TLS
versus native TLS when used together with NET_SOCKETS_TLS_PRIORITY.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:50:11 -07:00
Marcin Niestroj
19b75f47c0 modem: quectel-bg9x: use NET_SOCKETS_OFFLOAD_PRIORITY
Use NET_SOCKETS_OFFLOAD_PRIORITY instead of
NET_SOCKETS_OFFLOAD_PRIORITY, so that by default offloaded sockets will
be used instead of native sockets.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:50:11 -07:00
Marcin Niestroj
aae48b5c32 modem: sim7080: use NET_SOCKETS_OFFLOAD_PRIORITY
Use configurable NET_SOCKETS_OFFLOAD_PRIORITY instead of hardcoded value
in the driver itself. This allows to select relative priority of
offloaded TLS versus native TLS when used together with
NET_SOCKETS_TLS_PRIORITY.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:50:11 -07:00
Marcin Niestroj
6e81f891c6 modem: ublox-sara-r4: use NET_SOCKETS_OFFLOAD_PRIORITY
Use configurable NET_SOCKETS_OFFLOAD_PRIORITY instead of hardcoded value
in the driver itself. This allows to select relative priority of
offloaded TLS versus native TLS when used together with
NET_SOCKETS_TLS_PRIORITY.

Drop the build assert, as always prioritizing offloaded TLS over native
TLS should be application developer choice.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:50:11 -07:00
Konstantinos Papadopoulos
b8604024f7 drivers: display: stm32_ltdc temporary patch for LTDC clock
LTDC clock on F4/F7 series, is generated from PLLSAI which yet is not
implemented into Zephyr.

Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
2022-04-08 15:49:42 -07:00
Konstantinos Papadopoulos
5e519fef40 drivers: ILI9341 add interface control registers
This enables the option through dts to drive the display
with RGB interface.

Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
2022-04-08 15:49:42 -07:00
Mikkel Jakobsen
0b0c2e78e0 drivers: sensor: add icm42670 6-axis accelerometer driver
the icm42670 from Invensense/TDK is a 6-axis accelerometer with
gyroscope and temperature sensing capabilities.

this initial driver does not support the devices 2K FIFO or many of the
other advanced features. Instead, only basic features are implemented.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-04-08 15:49:08 -07:00
Jiafei Pan
07c6ad3349 divers: clock_control: refine multiple uart instance support
Refine the code to support multile uart instance.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-04-08 10:31:04 -05:00
Julien D'Ascenzio
2a510361a3 drivers: watchdog: iwdg_stm32: fix wdg install timeout
In the function iwdg_stm32_install_timeout, the test on watchdog ready
was inverted. So, if 2 successive calls were made to this function, the
value of the prescaler or counter reload was not taken into account.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2022-04-08 09:59:34 -04:00
Alexander Wachter
e24b087918 drivers: can: socketCAN: Move socket code to own file
Move the code for socket instanciation from each driver
to a generic driver, that makes an instance of a socketCAN
net device for the chosen node.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2022-04-08 09:31:51 +02:00
Lukasz Maciejonczyk
e661f6e96a drivers: ieee802154_nrf5: fix rx failure error propagation for CSL
For delayed reception only NRF_802154_RX_ERROR_DELAYED_TIMEOUT is
expected to happen, others rx errors should be handled in regular
manner.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-04-08 09:31:17 +02:00
Lukasz Maciejonczyk
55c3afab1c drivers: ieee802154_nrf5: add log for rx failure
Some failures are possible and expected from fime to time e.g.
NRF_802154_RX_ERROR_TIMESLOT_ENDED. Add informational log for the frame
reception failure to differentiate the specific case.
It can be helpful for analizing failure in network trafic.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-04-08 09:31:17 +02:00
Nicolas Pitre
5d929bac43 console: semihosting: add RISC-V support
The RISC-V version is supported by qemu and openocd.
Tested on qemu only.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2022-04-08 09:30:11 +02:00
Mahesh Mahadevan
a8f8c1c185 drivers: display: Add blanking support for NXP ELCDIF driver
Implement the blanking_on and blanking_off API functions for
NXP's MCUX ELCDIF display driver

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-04-07 16:37:50 -05:00
Titouan Christophe
93d06330c5 drivers: sensor: vl53l0x: add support to reprogram I2C address
The I2C address of the VL53L0X distance sensor can only be programmed
over the I2C bus. To do this:

1. The sensor is powered off or in standby mode
2. Power up the sensor, it boots with a default I2C address (0x29)
3. The I2C master sends a configuration command to set the new address
4. The sensor now communicates at the new address

In case there are more than one such sensor on the bus, they all have
the same address when starting up. We therefore need to first apply
step 1. on all of them. Then, sensor by sensor apply steps 2. to 4.

Because simple designs may not need to reprogram the address, we
introduce a new configuration option CONFIG_VL53L0X_RECONFIGURE_ADDRESS

If this setting is disabled, then the driver behaves as before.

If CONFIG_VL53L0X_RECONFIGURE_ADDRESS is enabled, then the driver does
the following:

- In vl53l0x_init(), apply step 1. This is done when the driver is
  brought up when starting the system
- in vl53l0x_start(), apply steps 2. to 4. This is done when fetching
  a sample, if the sensor has not been started yet.

Also, as cosmetic changes:
- add parenthesis around sub conditions in call to __ASSERT_NO_MSG
- gracefully handle unknown sensor channels in vl53l0x_channel_get

Signed-off-by: Titouan Christophe <moiandme@gmail.com>
2022-04-07 14:30:01 -05:00
Titouan Christophe
b2172b4251 drivers: sensor: vl53l0x: add driver support for multiple sensors
Up until now, the vl53l0x driver only supported a single device, ie.
the first entry st,vl53l0x in the device tree. To be able to use
multiple sensors at the same time, create one driver data instance per
vl53l0x node in the device tree. Also split the constant driver config
from the runtime data.

Because the vl53l0x address is only configurable with an I2C command,
and is not persisted if the sensor is rebooted, multiple sensors can
be handled only if either:
- They are on different I2C buses
- Their addresses are coonfigured (by some external code) before
  vl53l0x_init is called

Also use the i2c_dt_spec and gpio_dt_spec APIs, as it makes
the code more concise and readable.

Finally, to distinguish the logs mesages from different sensors,
prefix the text with the sensor name.

Signed-off-by: Titouan Christophe <moiandme@gmail.com>
2022-04-07 14:30:01 -05:00
Titouan Christophe
e24899a485 drivers: sensor: vl53l0x: wait only 2ms for tboot
As per the VL53L0X datasheet, in 2.9.1 "Power up and boot sequence",
time to boot is 1.2ms max, so we only have to wait at most 2ms.

Signed-off-by: Titouan Christophe <moiandme@gmail.com>
2022-04-07 14:30:01 -05:00
Titouan Christophe
1267d51dda drivers: sensor: vl53l0x: run uncrustify
Apply uncrustify on the driver source code before going further

Signed-off-by: Titouan Christophe <moiandme@gmail.com>
2022-04-07 14:30:01 -05:00
Joakim Andersson
2dae1823ab hwinfo: Add dependency handling for HWINFO_NRF in nonsecure
The limitation on HWINFO_NRF depending on not nonsecure was removed in
52be3030aa.
This caused problems when TF-M was not enabled.

This happens on the thingy53_nrf5340_cpuapp_ns board since this board
is not supported by TF-M.

Introduce proper dependency handling for the soc secure functions
to make HWINFO_NRF unavailable when no secure services exist in
nonsecure.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-04-07 11:02:52 -04:00
Khor Swee Aun
0431d10b10 drivers/serial: Extend Altera Jtag Uart driver support
Extend Altera Jtag Uart driver support without Altera HAL driver
by default. uart_altera_jtag_hal.c renamed to uart_altera_jtag.c and
new config, CONFIG_UART_ALTERA_JTAG_HAL is introduced to allow driver
to use Altera HAL driver when needed.

Signed-off-by: Khor Swee Aun <swee.aun.khor@intel.com>
2022-04-07 06:58:16 -04:00
Jordan Yates
ad25e77698 serial: uart_nrfx_uarte: async compilation warning
Only compile in async related code when at least one UARTE instance has
enabled async mode. This fixes an "unused function" warning when
`CONFIG_UART_ASYNC_API` is enabled but no UARTE instances has async
enabled. This is possible when the async API is being used for an RTT
UART driver.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-04-07 11:53:29 +02:00
Henrik Brix Andersen
9f4bb75af6 drivers: can: handlers: copy outbound argument structs
Pass a copy of outbound argument structs to the implementation functions
as recommended for Zephyr system calls.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-07 09:38:18 +02:00
Henrik Brix Andersen
ad34c670d8 drivers: can: handlers: unify naming of local argument copies
Unify the naming scheme for local copies of user provided arguments.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-07 09:38:18 +02:00
Gerard Marull-Paretas
8ff797b850 drivers: pwm: litex: remove redundant config 'helper'
All these sort of helpers were removed from tree a while ago, this one
was missed as it uses a custom name.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-07 09:35:05 +02:00
Gerard Marull-Paretas
e3fde6b01a drivers: pwm: sifive: remove redundant checks
If dev was null, caller would have faulted before since dev->api needs
to be accessed before reaching this point. Also, a well-defined device
will never have a NULL dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-07 09:35:05 +02:00
Gerard Marull-Paretas
ccc12be0a5 drivers: pwm: return -ENOTSUP if inactive level is not supported
The API spec states that calling pin_set() with period set to 0 is
equivalent to set the PWM channel to an inactive level. Some drivers
treat this input as invalid (-EINVAL), however, it's an unsupported
feature. Maybe it's due to copy&paste effect? This changes error message
to be clear and changes return value to -ENOTSUP for this case.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-07 09:35:05 +02:00
Gerard Marull-Paretas
0c908706fb drivers: pwm: remove duplicated pulse > period checks
The API call checks for this condition before calling the pin_set driver
OP call, so drivers don't have to do this check now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-07 09:35:05 +02:00
Daniel DeGrasse
e4becf1c7b drivers: i2s: i2s_mcux_flexcomm: add pinctrl support to lpc i2s driver
Add pinctrl support to i2s flexcomm driver for lpc.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Daniel DeGrasse
415b2bdac0 drivers: pwm: pwm_mcux_sctimer: Add pinctrl support for lpc pwm
add pinctrl support for lpc sctimer pwm driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Daniel DeGrasse
c637d7d672 drivers: spi: spi_mcux_flexcomm: add pinctrl support to lpc spi driver
add pinctrl support for spi_mcux_flexcomm driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Daniel DeGrasse
1d33b6b86b drivers: i2c: i2c_mcux_flexcomm: enable pinctrl for i2c flexcomm driver
enable pinctrl for i2c flexcomm driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Daniel DeGrasse
f8828a4434 drivers: gpio: gpio_mcux_lpc: Add pinmuxing control to gpio driver
Add pinmux control to gpio driver for LPC, so that pin control can work
correctly.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Daniel DeGrasse
58008b3085 drivers: serial: Add pinctrl support to usart flexcomm driver
Add pinctrl support to LPC USART flexcomm driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Daniel DeGrasse
c133e357ef drivers: pinctrl: Add LPC IOCON pinctrl driver
Add lpc iocon pinctrl driver. Driver handles IOCON clock initialization as
well as IOCON pin configuration

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Kai Vehmanen
91516a2be3 drivers: intc: intc_cavs: use correct per-core register set for all ops
Current code uses per-core register to check interrupt status and
dispatch handlers. However to disable/enable the interrupt, core
zero register is always used.

While the handlers in _sw_isr_table are common for all cores,
the status bits should still be handled separate for each core.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-04-06 22:00:14 -04:00
Adrian Bonislawski
cd11910201 dma/cavs_hda: Support channel filtering
Support channel filtering to find the requested channel
if filter_param provided

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-04-06 14:08:01 -04:00
Casper Meijn
c33d1b55f8 drivers: display: st7789v: Add multi-instance support
Replace the config and data struct with a macro. Execute the macro
for each instance.

Signed-off-by: Casper Meijn <casper@meijn.net>
2022-04-06 10:58:26 +02:00
Casper Meijn
ac9cd9e89a drivers: display: st7789v: Remove compile time reset selection
Replace the compiletime `#if` with a runtime decision. This makes
a multi-instance driver possible.

Signed-off-by: Casper Meijn <casper@meijn.net>
2022-04-06 10:58:26 +02:00
Casper Meijn
7f5c5cf317 drivers: display: st7789v: Move params to struct config
Move the const configuration parameters to `struct st7789v_config`.

Signed-off-by: Casper Meijn <casper@meijn.net>
2022-04-06 10:58:26 +02:00
Henrik Brix Andersen
81152d0aae drivers: can: handlers: verify timing parameter access
Verify read access to the timing and timing_data parameters in
z_vrfy_can_set_timing() and pass a copy of these structs to the
implementation as recommended for Zephyr system calls.

Remove unnecessary typecasts.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-05 10:33:08 -07:00
Henrik Brix Andersen
c389594e12 drivers: can: mcp2515: correct min/max timing values
The MCP2515 requires phase segment 2 to be at least 2 time quanta.

The prescaler has a 6 bit register, allowing for real-world prescaler
values between 1 and 64.

Fixes: #44484

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-05 10:33:08 -07:00
Henrik Brix Andersen
a1e33d8868 drivers: can: mcan: fix bounds check for data phase prescaler
Fix the bounds check for the data phase prescaler timing parameter. The
maximum allowed value is 0x20, not 20 decimal.

Fixes: #44483

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-05 10:33:08 -07:00
Henrik Brix Andersen
47119333e1 drivers: can: mcan: allow sjw == CAN_SJW_NO_CHANGE
Take CAN_SJW_NO_CHANGE into account when bounds checking the sjw timing
parameter values.

Fixes: #44482

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-05 10:33:08 -07:00
Shawn Nematbakhsh
c74526919d soc: riscv: sifive-freedom: Get coreclk and peripheral clock from DTS.
Rather than specify input clock for each peripheral individually, instead
specify the relevant clocks in DTS.

This will enable easier support for non-default coreclk on fe310 in a
follow-up CL.

Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
2022-04-05 12:00:03 +02:00
Jose Alberto Meza
33fde4b10a drivers: espi: xec: mec172x: Handle eSPI bus host enable
Add eSPI bus host enable/disable events from eSPI host.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-04-05 11:19:03 +02:00
Jay Vasanth
89d6695f7c drivers: i2c: MEC15xx i2c error handling
Updates to MEC15xx i2c error handling:
1. timeout_seen handling is simplified. For all errors we
continuously poll
2. error flag is not set for timeout_seen handling and hence
recover_from_error() call is not required.
3. In i2c_xec_poll_write(), ETIMEDOUT for (START + ADDRESS) byte
is treated as default error and error_seen flag is set (instead
of timeout_seen flag)

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-05 11:18:56 +02:00
John Kjellberg
81d1be76ea drivers/disk: sdmmc: stm32: DMA header requested on F4 serie
Even if not used DMA HAL is required in F4 SD HAL driver. Just
as for L4/F7 series that have been added before.
Add it for this specific serie.

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>
2022-04-05 11:17:08 +02:00
Ruibin Chang
f6965ac930 ITE drivers/timer: clean up sys_clock_set_timeout()
Setting event timer count at least 1 hw count, it's redundant,
so I clean up this else {} case. And add the comment about
the K_TICKS_FOREVER and INT_MAX case.

NOTE:
CONFIG_TIMEOUT_64BIT = y, then k_ticks_t type is int64_t.
K_FOREVER is (k_timeout_t) { .ticks = (K_TICKS_FOREVER) },
and K_TICKS_FOREVER is ((k_ticks_t) -1),
so K_FOREVER is a k_timeout_t type structure, and
the member ticks: type int64_t,
                  value (= K_TICKS_FOREVER) 0xFFFF FFFF FFFF FFFF.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-04-05 11:16:51 +02:00
Jay Vasanth
bbec77c982 drivers: peci: Microchip XEC PECI driver add PINCTRL support
Add PINCTRL support to Microchip XEC PECI driver shared by
MEC172x and MEC15xx families.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-05 11:16:41 +02:00
Jay Vasanth
9777c5e90e drivers: peci: Microchip XEC PECI driver add MEC172x support
Update Microchip XEC PECI driver to support MEC172x.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-05 11:16:41 +02:00
Jay Vasanth
822e3bb612 drivers: peci: Microchip XEC PECI driver standardize
Standarize device structure usage for mchp peci driver

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-05 11:16:41 +02:00
Alexander Mihajlovic
4ff4991e16 drivers: uart_stm32: Add support for tx/rx swap
Add a new boolean devicetree property `tx-rx-swap` to the
st,stm32-usart binding, used to control TX/RX swap during
device initialization.

Signed-off-by: Alexander Mihajlovic <a@abxy.se>
2022-04-04 13:44:23 -07:00
Henrik Brix Andersen
78a855b418 drivers: can: add missing can_set_mode() syscall handler
Add missing syscall verification handler for can_set_mode().

Fixes: #44361

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-04 09:41:35 -05:00
Joakim Andersson
52be3030aa drivers: hwinfo: Remove HWINFO_NRF limitation for non-secure config
Remove the limitiation in HWINFO_NRF not working in non-secure
configuration. Use the exposed soc_secure_read_deviceid function
that accesses the device ID through the secure services.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-04-04 11:15:28 +02:00
Joakim Andersson
4b80afdd27 drivers: ieee802154: Use secure services
Allows the setting of ieee802154 EUI64 address in non-secure processing
environment by reading the FICR device ID through the secure service.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-04-04 11:15:28 +02:00
Henrik Brix Andersen
49424574c5 drivers: can: handlers: can_get_max_bitrate() is an optional
The can_get_max_bitrate() is an optional API function. Limit validation
to the CAN device driver pointer.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-04 11:15:10 +02:00
Andrzej Głąbek
586e26e8fc soc: nrf: Use data from DTS to populate HAS_HW_NRF_* Kconfig options
Instead of selecting appropriate HAS_HW_NRF_* options for particular
nRF SoCs (and simulated nRF52 target), set their values basing on
information from devicetree.
Correct also semantics of those options so that they are set only when
a corresponding DT node is enabled. This allows using them directly in
Kconfig dependencies of Zephyr drivers for nRF peripherals. Update
appropriately these dependencies.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-02 15:14:38 +02:00
Andrzej Głąbek
cd00a3a3c9 scripts: kconfigfunctions: Redefine dt_nodelabel_has_compat()
The function in its current form is confusing because unlike other
similarly named functions (dt_nodelabel_has_prop(), dt_node_has_prop())
or devicetree macros (DT_NODE_HAS_COMPAT(), DT_NODE_HAS_PROP()), this
function takes into account the status of the checked node and returns
"y" only when the node is enabled.
This commit redefines dt_nodelabel_has_compat() so that it no longer
checks the node status, and for cases where the previous functionality
is needed, a new function named dt_nodelabel_enabled_with_compat()
is introduced as a replacement.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-02 15:14:38 +02:00
Sylvio Alves
e04172fcef drivers: spi: esp32c3: add master init call
ESP32C3 requires master init call to enable its clock
gate. Without this, SPI interface may not initialize
properly.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-04-01 13:00:16 -05:00
Dino Li
5b9db5a251 it8xxx2: re-factor idle routine
Don't leave idle state if soc isn't waked-up by an interrupt.
(We change to check interrupt controller register)

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-04-01 12:49:09 -05:00
Henrik Brix Andersen
e1290bedeb drivers: can: handlers: verify API call in z_vrfy_can_get_state()
Verify the get_state API call in z_vrfy_can_get_state(). Adjust sizeof()
arguments to match the rest of the file.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-01 12:47:04 -05:00
Henrik Brix Andersen
d64a02656d drivers: can: handlers: Remove unnecessary typecasts
Remove unnecessary typecasts from from z_vrfy_can_remove_rx_filter().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-01 12:45:39 -05:00
Henrik Brix Andersen
422a2a8204 drivers: can: handlers: verify API call in z_vrfy_can_add_rx_filter_msgq()
Verify the add_rx_filter API call in z_vrfy_can_add_rx_filter_msgq() as
this is used by the underlying implementation. Remove unnecessary
typecasts.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-01 12:45:39 -05:00
Henrik Brix Andersen
c1477f9b38 drivers: can: handlers: do not verify void pointer
Do not attempt to verify that the current thread has access to the void
*user_data argument to z_vrfy_can_send(). The size of the data is not
known and no driver code will try to dereference it (it may not even be
a valid pointer).

Remove unnecessary typecasts from z_vrfy_can_send().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-01 12:45:39 -05:00
Sjors Hettinga
951983191b drivers: net: loopback: Add interface to simulate packet drop
To allow for high level robustness tests on protocols, add an interface
to control the packet drop rate. A rate of 0 means no packet dropped, a
rate of 1 means all packets being dropped.

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
2022-04-01 12:36:14 -05:00
Ruibin Chang
a5fc945fd2 ITE drivers/timer: check HW cycles per second by build assert
ITE RTOS timer HW frequency is fixed at 32768Hz, because this
clock source is always active in any EC mode (running/doze/deep doze).

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-04-01 12:33:11 -05:00
Ruibin Chang
0ec0ac109a ITE drivers/timer: don't divide free run count
We don't need to convert the free run clock count,
that will be converted by the kernel
(base on CONFIG_SYS_CLOCK_TICKS_PER_SEC),
so we should return the HW register count value directly.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-04-01 12:33:11 -05:00
Krzysztof Chruscinski
0b4e5b6d8b drivers: serial: nrf_uarte: Fix NO_OPTIMIZATION compilation
When NO_OPTIMIZATIONS is set and asynchronous API is used but
HW counting is not enabled then linking fails because of lack of
nrfx_timer code. When optimization is enabled, linker is smart
enough to figure out that nrfx_timer is not used.

Converting decision function from static inline function to macro
which is handled correctly with optimization off.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-01 16:03:56 +02:00
Tom Burdick
9933f18ad3 dma/cavs_hda: Provide pending/free byte lengths
In status the pending/free byte lengths are now provided

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-01 09:12:20 -04:00
Tom Burdick
c0b63d6afb dma/cavs_hda: Support source/dest width setting
Support adjusting the sample size to 16bits if the source
or destination width is set 3 or less.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-01 09:12:20 -04:00
Tom Burdick
602ef3fb0e soc/intel_adsp: Require definitions for cavs_hda.h
Rather than defining them in the header, require a set of defines
be provided to cavs_hda.h as part of the expected input to the API.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-01 09:12:20 -04:00
Tom Burdick
e018a3dff7 dma/cavs_hda: DMA driver for HDA on cAVS
Adds an initial driver for HDA streams on cAVS. A common code base is
provided for all HDA streams while the drivers are identified
differently as they have small behavior differences.

Uses dma_status to describe the positions for read/write. Uses dma_reload
to inform when to move the read/write positions. This closely follows
how HDA is being used in SoF

Simple test case is provided for both drivers.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-01 09:12:20 -04:00
Dino Li
e2ce171bed it8xxx2: espi: fill OOB header at driver level
With this change, app code has not to fill/prepare OOB header.
fixes #43568

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-04-01 13:30:33 +02:00
Carles Cufi
00636682ca Bluetooth: host: Introduce a new bt_hci_le_rand() call
In order to get rid of the duplication of the code that we had until now
in the tree, consolidate the handling of multiple calls to
bt_hci_cmd_send_sync(BT_HCI_OP_LE_RAND, ...) in a single location,
namely in hci_core.

This allows all of the users of this HCI command to use a single
implementation of the iterated sending of the HCI command to fill a
buffer with random bytes.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-04-01 11:21:51 +02:00
Carles Cufi
eb0de3384d drivers: entropy: bt_hci: Add missing netbuf unref
bt_hci_cmd_send_sync() requires the caller to unref the buffer that is
sent back as a response. Add the missing call to net_buf_unref()
accordingly.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-04-01 11:21:51 +02:00
Henrik Brix Andersen
e0aaaea473 drivers: can: mcan: fix compiler warning
Fix compiler warning with CONFIG_CAN_AUTO_BUS_OFF_RECOVERY=y.

Fixes: 4e41d89c7b

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-31 18:11:13 -04:00
Jun Lin
caadb33202 driver: clock: npcx: remove the guard for npcx_clock_get_sleep_ticks
The function npcx_clock_get_sleep_ticks is currently guarded by
CONFIG_PM && CONFIG_NPCX_PM_TRACE. The other codes guarded by
CONFIG_NPCX_PM_TRACE is used to trace and will print a lot of messages.
The user who wants to use npcx_clock_get_sleep_ticks has to enable this
flag and get a lot of console spam. This commit removes the guard
CONFIG_NPCX_PM_TRACE and makes this function is available when
CONFIG_PM is defined.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-03-31 14:38:28 -05:00
Ruibin Chang
199eaac0a4 ITE drivers/sensor/vcmp: don't connect shared irq multiple times
This driver exectue connecting the shared irq one time for
every status "okay" vcmp nodes, then it will show enable
the same irq multiple times when build.

So I check whether the irq is enabled or not, if yes,
we needn't to enable again. And we will figure out the
triggered channel in vcmp_it8xxx2_isr().

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-03-31 12:20:11 -05:00
Lukasz Maciejonczyk
00a6d4cf78 drivers: ieee802154_nrf5: limit IEEE802154_NRF5_DELAY_TRX_ACC
Currently IEEE802154_NRF5_DELAY_TRX_ACC can exceed the max possible
value. Add upper bound to limit this.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-03-31 16:23:59 +02:00
Gerard Marull-Paretas
fa874db8a5 drivers: flash: shell: improve flash device choice
Store an optional reference to the zephyr,flash-controller choice. If
available and no user input is provided, it will be used as the default
flash device. If not available, error message will be more explicit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-31 13:55:10 +02:00
Henrik Brix Andersen
99964fab45 drivers: can: add missing static keywords
Add missing static keywords for functions internal to the drivers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-31 10:31:37 +02:00
Henrik Brix Andersen
21faabc314 drivers: can: handlers: fix z_vrfy_can_recover() compilation
Fix compilation (and improve checks) in z_vrfy_can_recover().

Fixes: #44348

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-31 10:31:15 +02:00
Henrik Brix Andersen
4e41d89c7b drivers: can: mcan: fix bus recovery functions
Fix the signature of the CAN bus recovery functions in the Bosch M_CAN
driver frontends.

Fixes: #44345

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-31 10:31:15 +02:00
Henrik Brix Andersen
6f910ae41e drivers: can: mcp2515: do not force CONFIG_CAN_AUTO_BUS_OFF_RECOVERY=y
Do not force CONFIG_CAN_AUTO_BUS_OFF_RECOVERY=y. Instead fix the return
type of the mcp2515_recover() function and return -ENOTSUP.

Fixes: #44344

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-31 10:31:15 +02:00
Lukasz Maciejonczyk
8c6f49c845 drivers: ieee802154_nrf5: fix delayed operation accuracy
Align clock accuracy used in CSL calculations to the value in platform.
This is recomended setting for devices working in wide range
temperature. Nevertheless it can be profiled in end product to decrease
CSL window duration and finally the power consumption.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-03-31 10:30:31 +02:00
Jay Vasanth
a94760d9b4 drivers: tach: Microchip XEC TACH driver add PINCTRL support
Add build time optional PINCTRL support to the Microchip XEC TACH
driver shared by MEC15xx and MEC172x families.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-31 10:30:17 +02:00
Jay Vasanth
b0cfaa44cd drivers: tach: Microchip XEC TACH driver add MEC172x support
Update Microchip XEC TACH driver to support MEC172x.
Standardize device tree properties between chips.
Standardize device structure usage.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-31 10:30:17 +02:00
Francois Ramu
90d1644a10 drivers: pwm: stm32 can initialize the PWM complementary output
If the dts defines the PWM complementary output, then the OCN
must be init in place of the OC state and polarity.
This is an exclusive setting for this pin.
The channel in LL_TIM_OC_SetPolarity can be the complementary one.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-31 10:28:47 +02:00
Thomas Stranger
c128a89690 can: stm32fd: correct timing min/max for prop_seg and sjw
This commit changes the timing_min_data prop_seg
initialization of st,stm32-fdcan drier to zero.
Additionally the nominal sync jump width limits
are also adopted to new values 1 and 128.

This was not tested until recently and therefore
caused the can timing test to fail on stm32g4
after PR #44197 got merged.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-03-31 10:28:14 +02:00
Ruibin Chang
78b027f765 ITE drivers/timer: fix tests/drivers/flash build error
There wasn't the build error in PR#44060,
but now tool chain isn't happy about putting the arch_busy_wait()
to __ram_code section, then it shows a build error:
https://github.com/zephyrproject-rtos/zephyr/runs/5755633537?check_suite_focus=true#step:10:933

So I remove __ram_code of arch_busy_wait(), and this will need
extra fetch code time when arch_busy_wait() code isn't in
the dynamic cache.

Verified by follow test pattern:
west build -p auto -b it8xxx2_evb tests/drivers/flash

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-03-31 16:13:19 +09:00
Ryan Erickson
69ffc1f228 modem: hl7800: add API to set bands
Add API to set LTE bands at runtime.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-03-30 11:39:06 +02:00
Ruibin Chang
43213a16a8 ITE drivers/timer: customize busy wait timer
Customize busy wait timer for micro-seconds accuracy.

Verified by follow test pattern:
west build -p auto -b it8xxx2_evb tests/kernel/timer/timer_api
west build -p auto -b it8xxx2_evb tests/kernel/timer/timer_error_case
west build -p auto -b it8xxx2_evb tests/kernel/timer/timer_monotonic
west build -p auto -b it8xxx2_evb tests/kernel/timer/starve
west build -p auto -b it8xxx2_evb tests/kernel/context
west build -p auto -b it8xxx2_evb tests/drivers/adc/adc_api

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-03-30 11:31:06 +02:00
Robert Lubos
823ac60c70 drivers: net: loopback: Increase MTU to match IPv4 MTU
net_pkt_alloc_buffer() will use the maximum packet length of
NET_IPV4_MTU in case the interface MTU is smaller than this. Because of
this, the using the loopback interface with smaller MTU leads to
additional fragmentation at the TCP layer, which impacts performace and
requires more network buffers for tests to execute.

Fix this by matching the loopback interface MTU with NET_IPV4_MTU.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-03-30 11:08:22 +02:00
Robert Lubos
e80a662ac7 drivers: net: loopback: Allocate the loopback packet from proper poll
Use the new function to allocate a packet for the RX path from the RX
packet poll.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-03-30 11:08:22 +02:00
Tomislav Milkovic
9f0fa15bb7 drivers: display: add stm32_ltdc driver
Add Kconfig for STM32 LTDC driver
Add STM32 LTDC driver C source
Update display drivers CMakeLists with the new driver
Update display drivers Kconfig with the new driver

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-03-29 18:30:02 -07:00
Henrik Brix Andersen
3874a0d1e3 drivers: can: use correct size in z_vrfy_can_get_core_clock()
Use the correct size in z_vrfy_can_get_core_clock().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-29 17:05:56 -07:00
Henrik Brix Andersen
372cee4268 drivers: can: convert can_calc_timing*() to syscalls
Convert can_calc_timing() + can_calc_timing_data() to syscalls and use
the newly added syscalls calls for determing the minimum/maximum
supported timing parameter values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-29 17:05:56 -07:00
Henrik Brix Andersen
15fde0a357 drivers: can: add syscalls for getting min/max timing values
Add CAN system calls for getting the minimum/maximum timing values
supported by a given CAN controller device driver instance:
- can_get_timing_min()
- can_get_timing_max()
- can_get_timing_min_data()
- can_get_timing_max_data();

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-29 17:05:56 -07:00
Jordan Yates
332a6f084a wifi: esp_at: reset the modem in device init
Reset the ESP modem inside the device initialisation function so that
errors can be detected through the use of `device_is_ready`.

Fixes #43891 for this driver.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-29 12:32:43 -07:00
Jordan Yates
06960750c7 wifi: esp_at: return modem reset result
Return an error code indicating whether the modem was successfully reset
or not.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-29 12:32:43 -07:00
Jordan Yates
9cd80bb732 wifi: esp_at: move network device inst macro
Move the network device instantiation macro to above the esp_init
function so that static variables declared by the macro are visible to
the init function.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-29 12:32:43 -07:00
Emil Obalski
d877e1dded ipc_service: Automatically include source files for backends
The purpose of this change is to allow to enable more than one
backend at once by removing choice from ipc-service backend Kconfig
and depending backend Kconfig option on existing of correct compatible.

Overwriting IPC_SERVICE_BACKEND option in some places is removes
as no longer needed.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2022-03-29 12:30:50 -07:00
Tom Burdick
2f792c2de5 dma/dw_common: Update dma_dw_common from sof
Ports the SOF DesignWare DMA code to Zephyr.

Effectively replaces much of what was the designware driver as this
driver enables scatter gather which the older driver did not.

* Enables cyclic transfer description lists when the cyclic config
  param is given.
* Enables linear link position usage with cAVS GPDMA.
* Passes suspend/resume, scatter/gather tests.
* Provides status updates of the transfer through dma_get_status()
* Enables reloading a cyclic transfer with dma_reload()
* Enables dma handshakes using the dma_slot config param.
* cAVS specifics remain in the dma_cavs_gpdma driver.

Co-authored-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Co-authored-by: Tom Burdick <thomas.burdick@intel.com>
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-03-29 14:33:48 -04:00
Bartosz Bilas
1d40d4fa5a drivers: spi_handlers: switch to gpio_dt_spec member
Don't use the old gpio_dev spi_cs_control's member
since it's been deprecated in favor of gpio_dt_spec.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-03-29 10:24:56 -05:00
HaiLong Yang
9d2425c186 drivers: spi: introduce gd32 spi driver
Add a simple gd32 spi driver.

Signed-off-by: HaiLong Yang <cameledyang@pm.me>
2022-03-29 10:21:15 -05:00
Daniel DeGrasse
328e0be132 drivers: memc: memc_mcux_flexspi: make pinctrl support conditional
Make pinctrl support conditional for memc flexspi driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-26 03:41:02 -05:00
Erwan Gouriou
48039bc555 drivers/pinctrl: stm32: Allow plain GPIO configuration
Based on introduction of plain GPIO configurations in STM32 pinctrl
bindings, update STM32 pinctrl/gpio drivers to make this functionality
available.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-25 15:52:02 -07:00
Erwan Gouriou
79ba037891 drivers/gpio: stm32: Clarify pin config functions headers
Before updating stm32 pinctrl/gpio drivers to support plain GPIO
feature, rework pin configuration functions headers to provide
more clarity on the arguments and the information they convey:
- pin configuration
- pin function

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-25 15:52:02 -07:00
Ruibin Chang
a21d043f5b ITE drivers/sensor: add voltage comparator driver
Add voltage comparator driver for ITE it8xxx2 chip.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-03-25 15:00:35 -07:00
Daniel DeGrasse
0f939d350d drivers: ethernet: eth_mcux: add support for resetting phy
add support for resetting phy at boot via GPIO reset pin.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
9824721680 drivers: display: display_mcux_elcdif: add backlight-gpios property
Add backlight gpios property to mcux display driver, so that the driver
can correctly initialize the backlight gpio control.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
61b83c88b8 drivers: gpio: gpio_mcux_igpio: enable pinmuxing in gpio driver
In order for pinctrl support to be complete, RT series GPIO driver must
support pinmuxing within the driver level. RT series pinmux settings do
not correspond directly to gpio port/pin numbers, so use DTS mappings to
pinctrl nodes to select and apply pinmux settings in the gpio driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
54eb607392 drivers: disk: usdhc: enable pinctrl for usdhc driver
Enable pinctrl driver for usdhc. USDHC driver uses custom pinctrl states
for fast, slow, and medium signal frequencies, as well as pin pull for
SD detection.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
5ec576fb04 drivers: display: display_mcux_elcdif: add pinctrl support
add pinctrl support for display_mcux_elcdif driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
108188312d drivers: video: video_mcux_csi: enable pinctrl
Enable pinctrl for mcux_csi video driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
459495aa84 drivers: memc: enable pinctrl for flexspi driver
Enable pinctrl for flexspi driver. Note that when flexspi is being using
in XIP mode, pinctrl settings are not required and will not be applied.
Pinctrl settings are only required when the flexspi device being used is
not the one used for XIP.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
dbb4ad8eb1 drivers: pwm: enable pinctrl for nxp imx_pwm driver
Enable pinctrl for nxp imx_pwm driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
053eaf7545 drivers: lpc_lpadc: enable pinctrl for lpadc driver
enable pinctrl for mcux lpc lpadc driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
6c0bcdc6e9 drivers: mcux-12b1-adc: enable pinctrl for mcux-12b1 adc
Enable pinctrl for mcux_12b1msps_sar adc driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
1cee7be552 drivers: pinctrl: Enable pinctrl for RT11xx series
RT11xx series has similar pin configuration peripheral to RT10xx, with
some differences in register layout. Create new pinctrl definition
header file, and reuse existing driver code for RT10xx.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
3a6919e3aa drivers: pinctrl: update rt pinctrl to support GPR register
iMX.RT parts use a GPR register for some pinmux settings. Update pinctrl
driver to support this GPR register definition.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Konstantin Mochalov
104a668fe8 drivers: sensor: mhz19b: fix all channels fetch
mhz19b_sample_fetch() from mhz19b sensor driver didn't support
SENSOR_CHAN_ALL chan parameter value, so sensor_sample_fetch() didn't
work, always returning -ENOTSUP (sensor_sample_fetch_chan() worked, if
called with SENSOR_CHAN_CO2).

This change enables mhz19b sensor to work both with
sensor_sample_fetch() and with sensor_sample_fetch_chan() with
SENSOR_CHAN_CO2.

Signed-off-by: Konstantin Mochalov <incredible.angst@gmail.com>
2022-03-25 08:22:33 -05:00
Neil Armstrong
d89efe0434 pcie: ecam: implement MSI/MSI-X interrupts setup
This implements the msi_device_setup() callback for ECAM controllers
used with an ARM GIC ITS MSI message translater.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-03-25 12:56:25 +01:00
Neil Armstrong
acd38cb30e pcie: controller: add generic controller MSI/MSI-X API core functions
Define the MSI/MSI-X APIs to be used with the Generic PCIe Controller API.

It notably adds the msi_device_setup() callback to the PCI Express
Controller API used to allocate and setup the MSI/MSI-C vectors on the
MSI message translater HW.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-03-25 12:56:25 +01:00
Neil Armstrong
318999d656 interrupt_controller: gicv3_its: add get_msi_addr API
Add get_msi_addr() callback to ITS API to retrieve the GITS_TRANSLATER
physical address to be set in the MSI message address field.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-03-25 12:56:25 +01:00
Jordan Yates
6d1a08b3a8 pm: device: move pm_device_runtime_init_* funcs
Move the `pm_device_runtime_init_*` functions from <pm/device_runtime.h>
to <pm/device.h>. The initial device state should be settable
independently of whether `CONFIG_PM_DEVICE_RUNTIME` is enabled.

This also resolves a compilation error when attempting to use these
functions without also including <pm/device.h>.

Function documentation is also updated to be more general than only
referencing runtime PM, as this also applies to system PM and manually
run actions.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-25 10:39:55 +01:00
Gerson Fernando Budke
0521aa0fbc drivers: pinmux: Drop sam0 pinmux in favor of pinctrl
Drop sam0 pinmux driver and all related entries in favor to use new
pinctrl API.

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

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
4c5e94317c drivers: rtc: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 rtc driver. It allows to
define pins to be used for tamper detection.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
8427f5e9b1 drivers: timer: Add sam0 tc32 support to pinctrl
This add support to pinctrl at Atmel sam0 timer tc32 driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
171440b029 drivers: adc: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 adc driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
978e578008 drivers: dac: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 dac driver. It updates all
boards with new pinctrl groups format and drop pinmux entries.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
8961172e6d drivers: usb: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 usb dc driver. It updates
all boards with new pinctrl groups format and drop pinmux entries.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
8c51ad6c6f drivers: pwm: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 tcc pwm driver. It updates
all boards with new pinctrl groups format and drop pinmux entries.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
63b2a38f16 drivers: i2c: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 i2c driver. It updates all
boards with new pinctrl groups format and drop pinmux entries.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
fbddf7847d drivers: spi: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 spi driver. It updates all
boards with new pinctrl groups format and drop pinmux entries.

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

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
10aa57857d drivers: pinctrl: Update Atmel sam0 driver to new API
This update current Atmel sam0 pinctrl initiative to current Zephyr
pinctrl API. It update current devicetree bindings and add the sam0
pinctrl driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
3a940cea79 drivers: dac: Add sam support to pinctrl
This add support to pinctrl at Atmel sam dac driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
0f472f6d1b drivers: sensors: Update sam qdec driver to use pinctrl
This update Atmel sam qdec sensor driver to use pinctrl driver and API.
It update board and sample with new pinctrl groups format.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
dc172849fa drivers: pwm: Update sam pwm driver to use pinctrl
This update Atmel sam pwm driver to use pinctrl driver and API. It
updates all boards with new pinctrl groups format. In addition this
remove all remaining manual pinmux at board level.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
d7c37d1f12 drivers: can: Update sam canfd driver to use pinctrl
This update Atmel sam canfd driver to use pinctrl driver and API. It
updates all boards with new pinctrl groups format. In addition this
add missing entries to run automated tests for can/canfd drivers.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
e1d88706bb drivers: i2s: Update sam ssc driver to use pinctrl
This update Atmel sam ssc driver to use pinctrl driver and API. It
updates all boards with new pinctrl groups format. In addition this
remove DEV_NAME macro at sam xdma driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
bd485ea960 drivers: adc: Update sam afec driver to use pinctrl
This update Atmel sam afec driver to use pinctrl driver and API. It
updates all boards with new pinctrl groups format. In addition, it
add overlay files to allow run samples/drivers/adc example.

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

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

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
a27304b658 drivers: i2c: Update sam drivers to use pinctrl
This update Atmel sam i2c drivers to use pinctrl driver and API. It
updates all boards with new pinctrl groups format. This add missing
i2c-0 alias into sam4l_ek board.

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

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

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
cb201430cf drivers: pinctrl: Update atmel sam driver to new api
This update current Atmel sam pinctrl initiative to current Zephyr
pinctrl API. It update current devicetree bindings and add the sam
pinctrl driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Henrik Brix Andersen
69238dbfee drivers: can: mcux: flexcan: fail init if clock device is not ready
Fail the NXP MCUX FlexCAN driver initialization of the clock controller
device is not ready.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-24 13:39:55 -05:00
Andrzej Głąbek
44adeba75e drivers: counter: Fix dt_node_bool_prop calls in Kconfig.nrfx
This is a follow up to commit a1ab8da862.

Several calls to the dt_node_bool_prop function in Kconfig.nrfx for
the counter drivers are done with wrong parameters. The function
expects a full node path, but it is provided with only the node name
component.
Fix those by using dt_nodelabel_bool_prop instead, as such function is
available now and it is more suitable for such cases.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-24 15:13:32 +01:00
Zack Cornelius
790e2bdb02 drivers: nrf_qspi_nor: Add support for S2B1 QER
Add support for S2B1 quad-enable-requirements.
Add wrsr call for various QER modes

S2B1v6 mode tested with Winbond W25Q128JV series and pp4o and read4io
commands.

Signed-off-by: Zack Cornelius <zcornelius@securityesys.com>
2022-03-24 14:54:05 +01:00
Kamil Gawor
ba6d9139bb drivers: uart_nrfx_uarte: Fix double Rx buffer releasing
Fixes a case for the asynchronous UART API where
only single buffer was attached to the UART, after
filling this buffer release event was trigger first
time and after disabling UART the release event was
triggered again for the same buffer.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2022-03-24 14:16:29 +01:00
Gerard Marull-Paretas
d965f0a578 drivers: display: ili9xxx: default based on DT compatible
Enable the ILI9XXX display driver based on DT compatible status.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-24 13:36:54 +01:00
Dino Li
0d9c1c2516 it8xxx2: pinmux: correct i2c3 alt function locate on GPF2/F3
Enable the alt function with setting both bit5@0xf016f1 and
bit6@0xf02046 bits will cause internal leakage.
Only bit6@0xf02046 bit is required to enable the alt function,
so fix it.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-03-24 08:17:16 -04:00
Jordan Yates
c064006ecc drivers: pwm: test driver
Add a dummy driver for the `vnd,pwm` compatible to allow compilation of
drivers utilising PWM when running "build_all" tests.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-24 12:56:28 +01:00
Filip Kokosinski
0a9e8a5463 drivers: pinmux: remove SiFive pinmux driver
After transitioning to the new pinctrl driver, it is now obsolete.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-03-24 10:46:34 +01:00
Filip Kokosinski
38f38e0be8 boards: FE310-based boards: transition to pinctrl driver
This commit makes the transition from the pinmux driver to the pinctrl
driver. It also modifies UART, SPI and I2C drivers used in FE310-based
boards to use the new pinctrl API.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-03-24 10:46:34 +01:00
Filip Kokosinski
a5cc185b9b drivers: pinctrl: add SiFive pinctrl driver
Add a pinctrl driver used in FE310-based boards.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-03-24 10:46:34 +01:00
Navin Sankar Velliangiri
b69dadb6e5 drivers: clock_control: lpc: syscon: Add BUSCLK support
Add support for the LPC BUS clock to the LPC SYSCON clock controller
driver.

Signed-off-by: Navin Sankar Velliangiri <navin@linumiz.com>
2022-03-24 10:44:27 +01:00
Alexandre Bourdiol
2c4d55042c drivers: bluetooth: hci: BlueNRG-MS: Hold on CS
In case of BlueNRG-MS, it is necessary to prevent SPI driver to release CS,
and instead, let current driver manage CS release.
So, add SPI_HOLD_ON_CS to operation field

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2022-03-24 10:44:15 +01:00
Alexandre Bourdiol
8538b835f3 drivers: bluetooth: hci: use logic (and not pin value) kick/release CS
Use logic (and not pin value) for kick_cs() and release_cs()
because potential pin value invertion (Active LOW)
is handled in gpio_pin_set()

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2022-03-24 10:44:15 +01:00
Mulin Chao
8a4013b2e1 drivers: adc: Set correct interrupt type and remove spurious interrupts
In npcx adc driver, we select 'Scan' (Multiple Channels Operation Mode)
mode by default. It means that selected channels in ADCCS will be
converted automatically. Then, read the measured data from CHNDAT
registers if EOCCEV (Event is set after all selected channels are
converted.) flag in ADCSTS is set.

But we enable the wrong interrupt type, INTECEN, during adc
initialization. Ec will send the interrupt after each channel in ADCCS
is converted. It has no harm to the current driver since the driver
reads all selected channels and turns off ADC converter only after
EOCCEV is set in ISR. But it does generate spurious interrupts.

This CL enables the correct interrupt type, INTECCEN, during adc
initialization. Ec only sends the interrupt after all of channels in
ADCCS are converted.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-03-24 10:43:54 +01:00
Johann Fischer
a713315f0c drivers: ssd16xx: propagate errors where possible
Fix error propagation on several places.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-23 18:40:08 +01:00
Johann Fischer
75fb9ee143 drivers: ssd16xx: rework function to clear panel buffer at init
Rework function to clear panel buffer to use less memory
and propagate the errors.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-23 18:40:08 +01:00
Johann Fischer
e36c2699e4 drivers: ssd16xx: use usual scheme struct foo *data = dev->data
Use usual scheme "struct foo *data = dev->data;".

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-23 18:40:08 +01:00
Johann Fischer
a2e7e9a0e0 drivers: ssd16xx: add multi-instance support
Get rid of all DT_INST_PROP(0,...) and rework
the driver to support multiple instances.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-23 18:40:08 +01:00
Avi Green
1d46332b39 bmi160: Added I2C to Kconfig dependency
bmi160 driver code supports i2c, but is not selectable by Kconfig

Signed-off-by: Avi Green <avigreen1978@yandex.com>
2022-03-23 10:01:47 -07:00
Xudong Zheng
2a4144d063 drivers: clock_control: nrf_clock_calibration: remove errata workaround
Workaround for errata 192 is unnecessary as it is applied within
nrfx_clock_calibration_start().

Fixes #43930

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2022-03-23 17:16:12 +01:00
Andrzej Puzdrowski
3fc7182555 drivers/flash/nrf_qspi_nor: add support for enter 4-byte addressing mode
Added basic support for enter 4-byte addressing command.
Patch  supports command 0xB7 (Enter 4-Byte Address Mode),
with or without preceding WREN.

Similar as for SPI-NOR the `enter-4byte-addr` property of
memory node is used or describing how to Enter 4-Byte Addressing
mode.
Worth to notice that along with that property the `address-size-32`
property is expected as it switch the driver to use 4-byte addressing
in operations.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-03-23 16:02:49 +01:00
Jordan Yates
80e7ad7a23 entropy: bt_hci: driver added
Adds an entropy driver that uses Bluetooth HCI commands as its source
of randomness. As this method is blocking, the ISR API is not supported.

As this method will range from relatively slow (same core Bluetooth HCI
controller) to extremely slow (UART HCI Bluetooth controller), use the
xoshiro PRNG by default for RNG generation.

Implements #37186

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-23 13:38:47 +01:00
Michał Barnaś
a1ab8da862 kconfig: fix dt_node_has_prop and add nodelabel functions
The Kconfig function "dt_node_has_prop" was using label as its
parameter, where other functions use either chosen or path.
The documentation says that the parameter is path, so this patch
makes the function as documentation says and as other functions
in the file.
The additional nodelabel functions were added as counterparts that
are using nodes labels instead of paths.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-03-23 13:25:21 +01:00
Jonathan Rico
f4ea0651ac Bluetooth: hci: rpmsg: do not drop hci buffers
This fixes an issue where we would drop the hci event if allocation from
the hci event buffer pool didn't immediately succeed.

The behavior is now to block on allocation, and warn the user every 10
seconds.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-03-23 12:54:26 +01:00
Andrei-Edward Popa
12fa630844 drivers: serial: rpi_pico: added reset support for UART devices
added reset controller for Raspberry Pi Pico UART devices

Signed-off-by: Andrei-Edward Popa <andrei.popa105@yahoo.com>
2022-03-23 12:51:39 +01:00
Andrei-Edward Popa
3d24f62c05 drivers: reset: added Reset Controller for Raspberry Pi Pico
added Reset Controller driver for Raspberry Pi Pico board

Signed-off-by: Andrei-Edward Popa <andrei.popa105@yahoo.com>
2022-03-23 12:51:39 +01:00
Andrei-Edward Popa
8645de581e drivers: added file structure for Reset Controller Driver
added needed files for reset controller driver

Signed-off-by: Andrei-Edward Popa <andrei.popa105@yahoo.com>
2022-03-23 12:51:39 +01:00
Mikkel Jakobsen
959afcc93a drivers: led_strip: add tlc5971 driver
the tlc5971 driver uses spi for controlling the global brightness
and individiual pixel brightness of a daisy chain of tlc5971
devices.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-03-23 12:50:11 +01:00
Håkon Øye Amundsen
7aeef175e8 dts: nrf_qspi_nor: add option for specifying size in bytes
If a user has a 1GB external flash it is currently not possible
to configure this through DTS. To allow for such a configuration
we add an option which specifies the size in bytes not bits.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2022-03-23 12:48:08 +01:00
Daniel DeGrasse
69ff24ce97 drivers: memc: memc_mcux_flexspi: move device data into RAM
flexspi driver should not interact with flash whenever possible, and
should never use flash while in a critical write or erase section.
Move device data to RAM to prevent this read-while-write hazard.

Fixes #44043

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 23:14:00 -05:00
Daniel DeGrasse
8d556c0623 drivers: memc: memc_mcux_flexspi_hyperram: move device data to RAM
flexspi driver should not interact with flash whenever possible, and
should never use flash while in a critical write or erase section.
Move device data to RAM to prevent this read-while-write hazard.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 23:14:00 -05:00
Daniel DeGrasse
61c3f0aa44 drivers: flash: flash_mcux_flexspi_nor: move device data to RAM
flexspi driver should not interact with flash whenever possible, and
should never use flash while in a critical write or erase section.
Move device data to RAM to prevent this read-while-write hazard.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 23:14:00 -05:00
Daniel DeGrasse
8ab17128e1 drivers: flash: flash_mcux_flexspi_mx25um51345g: move device data to RAM
flexspi driver should not interact with flash whenever possible, and
should never use flash while in a critical write or erase section.
Move device data to RAM to prevent this read-while-write hazard.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 23:14:00 -05:00
Daniel DeGrasse
6e1b8435ab drivers: flash: flash_mcux_flexspi_hyperflash: move device data to RAM
flexspi driver should not interact with flash whenever possible, and
should never use flash while in a critical write or erase section. Move
device data to RAM to prevent this read-while-write hazard.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 23:14:00 -05:00
Tim Lin
0b9c0a0b23 ITE: drivers/i2c: implement i2c specified speed option of 50 KHz
Implement i2c specified speed option of 50 KHz in ITE i2c driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-03-22 20:30:38 -04:00
Jordan Yates
840bcd802d wifi: esp_at: disable CWMODE auto connect
In the newer ESP32 AT command versions, the CWMODE command takes an
optional parameter (<auto_connect>) which controls whether the module
will automatically attempt to connect to an AP when switching modes.

This parameter defaults to enabling auto-connect if not specified.

Without this change, modules can successfully connect to an AP before
the `CWAUTOCONN=0` command is processed, resulting in a
`NET_EVENT_WIFI_CONNECT_RESULT` before `NET_EVENT_IF_UP`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-22 12:36:50 +01:00
Daniel DeGrasse
c29b602675 drivers: pwm: add pinctrl support to kinetis tpm driver
add pinctrl support for kinetis tpm driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
9e12d23f11 drivers: dac: add pinctrl support to dac_mcux_dac32 driver
add pinctrl support to dac_mcux_dac32 driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
31406c13f2 drivers: sensor: Add pinctrl support for mcux acmp sensor
Add pinctrl support for mcux acmp sensor driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
a9587deaa4 drivers: adc: adc_mcux_adc12: enable pinctrl for adc12 driver
enable pinctrl for adc12 driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
9b9450d8f3 drivers: pwm: add pinctrl support for mcux PWT driver
Enable pinctrl support for mcux pwm capture pwt driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
6545a3d0fa drivers: spi: enable pinctrl for spi_mcux_lpspi
Enable pinctrl for lpspi driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
756abe308c drivers: i2c: enable pinctrl for mcux lpi2c driver
Enable pinctrl for mcux lpi2c driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
00793592eb drivers: serial: Enable pinctrl for kinetis lpsci driver
Enable pinctrl for kinetis lpsci uart driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
180a9d221e drivers: adc: enable pinctrl for kinetis adc_16 mcux driver
Enable pinctrl for kinetis adc16 mcux driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
a7f85f1ca1 drivers: can: Enable pinctrl for mcux_flexcan
Enable pinctrl support for mcux flexcan driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
55f1d5ba73 drivers: enet: Enable pinctrl for eth_mcux driver
Enable pinctrl for ethernet mcux driver, and update kinetis DTS node to
include labelling for PTP node, to enable driver to access pinctrl
properties.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
f400aa41cd boards: remove spi pinmux setting for kinetis boards
Remove spi pinmux setting for kinetis boards with dspi, as dspi driver
supports pinctrl

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
f90c356025 drivers: spi: enable pinctrl for kinetis dspi driver
Enable pinctrl unconditionally for kinetis dspi driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
e11bed5ff2 drivers: i2c: enable pinctrl for kinetis i2c
Enable pinctrl for kinetis i2c mcux driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
6537a867e3 drivers: pwm: Enable pinctrl for kinetis ftm PWM driver
Enable pinctrl for kinetis ftm PWM driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Yong Cong Sin
23af6008be drivers: gsm_mux: Namespace macros to prevent compilation errors
Namespace the macros to prevent collision with nuvoton's hal
macros.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-22 12:34:57 +01:00
Yong Cong Sin
5707c1978a drivers: uart_mux: Change size_t log var type to %ld
Change the logging variable type to %ld to prevent compilation
errors.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-22 12:34:57 +01:00
Yong Cong Sin
0de5c085c7 drivers: gsm_mux: Change size_t log var type to %ld
Change the logging variable type to %ld to prevent compilation
errors.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-22 12:34:57 +01:00
Cezar Burlacu
27da68cfb2 hwinfo shell: reset_cause fix
`reset_cause` with no arguments will print the device id.
Change it to print the reset cause.

Tested on nucleo_f767zi.

Signed-off-by: Cezar Burlacu <cezar@embeddedp.ro>
2022-03-22 12:33:11 +01:00
Vinayak Kariappa Chettimada
2214e39821 drivers: timer: nrf_rtc_timer: Dont__disable_irq if BT_LL_SW_SPLIT
Do not use __disable_irq when Zero Latency IRQs are enabled
and the Zephyr open source Bluetooth Controller is used with
Zero Latency IRQs support.

Application shall ensure their Zero Latency IRQ ISRs do not
invoke any kernel APIs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-22 11:36:28 +01:00
Vinayak Kariappa Chettimada
4eb5c375e1 drivers: timer: nrf_rtc_timer: Add Lock Zero Latency IRQs Kconfig
Add an explicit Kconfig option to enable use of
__disable_irq() in nRF RTC timer driver to prevent higher
priority contexts (including ZLIs) that might preempt the
handler and call nrf_rtc_timer API from destroying the
internal state in nrf_rtc_timer.

Relates to commit fcda8699cb ("drivers: timer: extend
nrf_rtc_timer").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-22 11:36:28 +01:00
Jay Vasanth
7c65268f3e drivers: pwm: Microchp XEC PWM driver add PINCTRL support
Add build time optional PINCTRL support to common PWM driver
for Microchip XEC MEC15xx and MEC172x families.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-21 21:49:50 -04:00
Jay Vasanth
845c1185a2 drivers: pwm: Microchip XEC PWM add MEC172x support
Add support for MEC172x series to Microchip XEC PWM driver.
Standardize device tree properties for both SoC families.
Standardize device structure usage.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-21 21:49:50 -04:00
Ruibin Chang
cebcaeed55 ITE drivers/kscan: use wakeup interface for WUC pins
Use wakeup interface for WUC pins in it8xxx2 kscan driver.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-03-21 16:35:03 -07:00
Ruibin Chang
4b75cf8f47 ITE drivers/interrupt_controller: add wuc interface
Add wakeup controller interface for ITE it8xxx2 chip.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2022-03-21 16:35:03 -07:00
Erwan Gouriou
d66c1d9b54 drivers/adc: stm32: Update setup_channels() for G4 series
G4 series have specific LL ADC API that discriminate ADC1 and ADC5
channels. Take this into account in adc_stm32_setup_channels().

Additionally, fix this function to use LL defines as argument of macro
__LL_ADC_CHANNEL_TO_DECIMAL_NB, as good practice.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-21 16:31:27 -07:00
Gerard Marull-Paretas
c1ad91405d drivers: pinctrl: nrf: fix nordic,nrf-twi handling on nRF51/52
The NRF_TWI_Type struct doesn't have an homogeneous layout between
nRF51/52 series. This patch tries to select the right layout based on
selected SoC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-21 15:09:28 +01:00
Alex Sergeev
49edd8558b drivers: ethernet: stm32: avoid segfault if cannot get RX buffer
Avoids segfault in situations when we can't acquire an RX buffer, and VLAN
or PTP code is enabled which tries to inspect packets by adding a pkt
check.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2022-03-21 08:44:58 -05:00
Henrik Brix Andersen
03accdb6a8 drivers: can: guard against bitrate of zero
Guard against attempts to set a bitrate of zero as this will lead to
division-by-zero.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-21 10:15:45 +01:00
Derek Snell
785971b5a0 drivers: gpio: fix when 4 or less PINT IRQs
driver required PIN_INT4_IRQ.  Some devices have 4 or less PINT IRQs.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-03-21 10:15:13 +01:00
Henrik Brix Andersen
67ba9900f0 drivers: can: add struct device argument to callback functions
Include a pointer to the CAN controller device for the CAN
transmit, receive, and state change callback functions.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-19 14:31:22 -04:00
Henrik Brix Andersen
5fd079bd68 drivers: can: mcan: add generic support for can_get_max_filters()
Add generic support for can_get_max_filters() to the Bosch M_CAN
base driver and use it in all driver frontends.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-18 16:14:40 -04:00
Nazar Kazakov
f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Andrzej Głąbek
a5234f3647 soc_nrf_common: Extend and rename the NRF_DT_ENSURE_PINS_ASSIGNED macro
Extend the macro with checks for DT properties related to pin
assignments that are defined but would be ignored, depending on
whether PINCTRL is enabled or not, what presumably indicates
a resulting configuration different from what the user expects.

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

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

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-18 16:26:21 +01:00
Francois Ramu
29d0660585 drivers: adc: stm32 adc API has a valid internal reference
extend the stm32 adc api to set the ref_internal of 3.3V

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-18 10:21:13 +01:00
Henrik Brix Andersen
a2ee4a3968 drivers: can: stm32h7: fix compilation
Fix compilation of the STM32H7 CAN-FD driver front-end.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-17 18:39:52 -04:00
Francois Ramu
5d9cbbc658 drivers: pwm capture with stm32 can have no callback
When configuring the pwm capture,  the callback function might
be reset, this i not an error. However the isr should not call it
and enabling the capture should always provide a callback function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-17 16:34:54 -05:00
Tim Lin
14bac3f7ac ITE: drivers/i2c: adjust timing registers to pass SI test
Timing registers of I2C 0/1/2 can be adjusted to pass SI test.

We can control the tSU;STA and tHD;DAT simultaneously by changing
the value of the register IT83XX_SMB_4P7USL, and we can control
the tSU;DAT by changing the value of the register IT83XX_SMB_250NS
as well.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-03-17 15:53:34 -05:00
Tim Lin
f2c42663b4 ITE: drivers/i2c: I2C driver divided into two compatibles
As mentioned in #42882, the I2C of IT8XXX2 is designed for two different
IP blocks, so this PR divides this I2C driver into two compatibles.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-03-17 15:53:34 -05:00
Rodrigo Brochado
da3ec7dbfa drivers: flash: Fix regression on nrf52840 anomaly 122 workaround
A nordic hal update was made around the same time that anomaly 122 on
nrf52840 was fixed. This update introduced qspi_pins_deconfigure() in
the nrfx_qspi_uninit(). With that, the CS pin from QSPI becomes a
floating pin after anomaly 122 uninit is executed.

Set the CS pin high after the uninit to fix this.

I'm assuming that floating CS pins that are likely to experience EMI
can impact power consumption. That was the case with my custom board.

My custom board with nrf52840 and MX25R3235F running the hello_world
sample was consuming 2.3 mA before this patch, and 30 uA after
applying it.

Signed-off-by: Rodrigo Brochado <git.rodrigobrochado@gmail.com>
2022-03-17 19:04:19 +01:00
Armando Visconti
e8f93a915d drivers: sensor: lsm6dsl: FIX bugs on few registers definition
FIX bugs on few registers definition
Fixes: #43669

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2022-03-17 08:43:39 -05:00
Andrzej Głąbek
c18c5cabf1 drivers: uart_nrfx_uart: Fix incorrect uses of DT_NODE_HAS_PROP
Values of boolean DT properties need to be checked with DT_PROP(),
not DT_NODE_HAS_PROP(). Fix two such incorrect calls in the nRF UART
driver.

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

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-17 11:40:39 +01:00
Sylvio Alves
30c45b0dae intc: esp32c3: use source as interrupt value
Using IRQ as source for interrupt values can
fail when installing irq_connect_dynamic, as
IRQ can previously be enabled. This updates
the logic to use source map and allows
default irq_enable() and irq_disable() to call
esp32c3 interrupt allocator implementation.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-03-17 11:40:31 +01:00
Gerard Marull-Paretas
87b982d878 drivers: adc: shell: use DEVICE_DT_GET
ADC instances can be obtained at compile time, so use DEVICE_DT_GET.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-17 11:37:33 +01:00
Tim Lin
12ac3fde4a ITE: drviers/adc: Adjust the wait time for acquiring a semaphore
After the ADC interrupt is enabled, the interrupt will be triggered
and the ADC channel valid data will be read, so there is no time
limit here.
Refer to the timeout is also set to K_FOREVER in the function of
adc_context_wait_for_completion().

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-03-17 11:36:48 +01:00
Xavier Chapron
5cc583bf3a drivers: modem: modem_cmd_handler.c: Drop cmd from buf if args are missing
In 90c6dc5e7f, a change was introduced to
allow modem commands determine if they have enough data or not.
In a situation where some data is missing, the command should return
-EAGAIN and this should lead to another call of the command with more
data.
In this commit, the argument parser was also allowed to return -EAGAIN
to request more data due to missing arguments.

However, this can't work because in cmd_handler_process_rx_buf() before
calling process_cmd():
- we make sure that a CR/LF has been found.
- we compute match_len which can't be greater than the distance to the
  next CR/LF.
Therefore, even if the command argument parser ask for more data by
returning -EAGAIN, next call will have the same value for match_len,
meaning that the parsing of argument will result in the same missing
argument situation.
This leads to an infinite loop of parsing the same data over and over in
an infinite loop.

This commit change this behavior to always drop the data in such a
situation. The command will not be answered and will therefore timeout,
but at least, next commands will correctly parse their returned data.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2022-03-17 11:33:17 +01:00
Tim Lin
bec83df576 ITE: drivers/flash: remove flash write protection API
This API has be removed in Zephyr 2.8, and does not need to be used
as a static function. Because flash_it8xxx2_write_protection(false)
is not supported. If the IT83XX_GCTRL_EPLR register in the
flash_it8xxx2_write_protection(false) is written as 1, the flash
write region will not be protected later, only be cleared by
power-on reset.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-03-17 11:32:51 +01:00
Henrik Brix Andersen
e3f93d7680 drivers: can: stm32fd: fix compilation
Fix compilation of the STM32 CAN-FD driver front-end.

Fixes: #43899

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-17 11:07:55 +01:00
Gerard Marull-Paretas
b618bdbaad drivers: spi: cc13xx_cc26xx: remove CONFIG_PM guards
API provides no-op fallback when CONFIG_PM=n

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-16 15:26:47 +01:00
Gerard Marull-Paretas
a0ade1d856 drivers: i2c: cc13xx_cc26xx: remove CONFIG_PM guards
API provides no-op fallback when CONFIG_PM=n

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-16 15:26:47 +01:00
Gerard Marull-Paretas
5a71eeb35c pm: policy: move constraints to policy API
The pm_constraint_* APIs were effectively used by the policy manager
only. This patch renames the API to the policy namespace and makes its
naming more explicit:

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

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

All drivers and documentation have been updated accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-16 15:26:47 +01:00
Mikkel Jakobsen
0c6cf9a84e drivers: sensor: icm42605: fix arg passing bug in trigger thread
the device data struct pointer is passed to the thread function when
creating the thread, but the thread function did a int-to-pointer cast
which did not work as intended, causing exception during runtime.

now, we just pass the pointer directly without casting, which is the
pattern seen in other sensor drivers.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-03-16 08:58:06 -05:00
Mikkel Jakobsen
f502d21634 drivers: sensor: icm42605: convert to usinggpio_dt_spec
for the interrupt gpio, now use gpio_dt_spec instead of raw gpio.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-03-16 08:58:06 -05:00
Tomasz Bursztyka
9a18fdea3f drivers: Check and fix device const qualifier on ISR
Re-running the script that checks for the const qualifier missing on
struct device ISR's parameter.

The script also changes the parameter 'arg' to 'dev' when relevant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-03-16 12:33:12 +01:00
Tomasz Bursztyka
16062c2e5a drivers: constify all device instances
Run cocci script to constify device instances.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-03-16 12:33:12 +01:00
Flavio Ceolin
d2a101cf01 x86: Remove Jailhouse references in this arch
Jailhouse support in X86 was removed long time ago. Just removing some
leftovers.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-16 04:20:26 -07:00
Georgij Cernysiov
44e6fee5d7 drivers: pinmux: stm32: fix MAPR remap
- Move SWJ_CFG initialization into pinmux.
- Don't disable the AFIO clock after SWJ_CFG
  initialization.
- Apply '111' to the SWJ_CFG bits upon remap
  application, that fixes the remap usage.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-03-16 10:26:37 +01:00
Georgij Cernysiov
e17c42bd42 drivers: pinctrl: stm32: fix MAPR remap
- Move SWJ_CFG initialization into pinctrl.
- Don't disable the AFIO clock after SWJ_CFG
  initialization.
- Apply '111' to the SWJ_CFG bits upon remap
  application, that fixes the remap usage.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-03-16 10:26:37 +01:00
Georgij Cernysiov
678017bdb7 drivers: gpio: stm32: remove SWJ from Kconfig
The Serial Wire JTAG configuration is moved to
F1 pinctrl DTS.

The configuration in GPIO didn't apply to the
majority of the STM MCUs except F1.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-03-16 10:26:37 +01:00
Georgij Cernysiov
01aea842b0 drivers: gpio: stm32: remove SWJ CFG init
Removed SWJ_CFG initialization. The functionality
is moved into pinctrl / pinmux modules.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-03-16 10:26:37 +01:00
Dino Li
a39f640b54 it8xxx2: espi: add support for CONFIG_ESPI_OOB_CHANNEL_RX_ASYNC
This makes the driver to support the configuration option.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-03-16 10:26:22 +01:00
Yonatan Schachter
72c61f1005 drivers: hwinfo: Added reset cause support for RPi Pico
Added support for hwinfo's reset cause functions, for the Raspberry Pi
Pico series.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-03-16 10:24:32 +01:00
Yonatan Schachter
90b20fffa4 drivers: hwinfo: Added unique ID support for RPi Pico
Added support for hwinfo's hwinfo_get_device_id for the
RPi Pico series.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-03-16 10:24:32 +01:00
Yong Cong Sin
2befd6ef87 drivers: modem: gsm: Use Kconfig macros directly
Use the Kconfig macros of MODEM_GSM_RX_STACK_SIZE and
MODEM_GSM_WORKQ_STACK_SIZE directly without another macros.

They are well within the column limit and this make them
more obvious that they are actually configurable by Kconfig.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-16 10:23:32 +01:00
Yong Cong Sin
9ee8c12a24 drivers: modem: gsm: wait for cellular registration
The driver should check for cellular registration before
attempting to attach to packet service, otherwise it will just
fails.

This patch waits for registration for 300 seconds, configurable
by CONFIG_MODEM_GSM_REGISTER_TIMEOUT, if it isn't registered by
then, it would toggle the airplane mode using AT+CFUN & wait
again, until it is registered, or `gsm_ppp_stop` is invoked.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-16 10:23:32 +01:00
Hristo Mitrev
b64a83822c drivers: eth_smsc911x_priv: Remove obsolete macros
Back with commit a1b77fd589 huge chunk of code was automatically
refactored using a script, which in turn left some macros meaningless

Signed-off-by: Hristo Mitrev <hr.mitrev@gmail.com>
2022-03-16 10:22:55 +01:00
Gerard Marull-Paretas
9953c194b9 drivers: remove redundant DEV_NAME helpers
Just use dev->name. This change follow same principles applied when
DEV_CFG and DEV_DATA macros were removed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-15 17:31:51 -04:00
Henrik Brix Andersen
d8e88b61eb drivers: can: mcan: add transceiver support
Add support for CAN transceivers to the Bosch M_CAN CAN drivers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
000661db21 drivers: can: mcp2515: add transceiver support
Add support for CAN transceivers to the Microchip MCP2515 CAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
63358621bd drivers: can: rcar: add transceiver support
Add support for CAN transceivers to the Renesas R-Car CAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
b9a5e78deb drivers: can: stm32: add transceiver support
Add support for CAN transceivers to the ST STM32 bxCAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
43c02b1e16 drivers: can: mcux: flexcan: add transceiver support
Add support for CAN transceivers to the NXP MCUX FlexCAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
58ff3f08dd drivers: can: move can_set_bitrate() to can_common.c
Move the can_set_bitrate() function to can_common.c as it is getting
quite long for a static inline function.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
0bae208778 drivers: can: add support for getting the maximum supported bitrate
Add support for getting the maximum supported bitrate in bits/s for CAN
controller/transceiver combination and check that a requested bitrate is
within the supported range.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
0783b51ee1 drivers: can: add generic GPIO controlled CAN transceiver driver
Add generic driver for GPIO controlled CAN transceivers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Andrzej Głąbek
44feb7d527 drivers: pwm_nrfx: Add support for pinctrl
Add support for the new pinctrl API to the nRF PWM driver.
Update code of the driver and the related devicetree binding.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Andrzej Głąbek
1a01ca2adf drivers: sensor: qdec_nrfx: Add support for pinctrl
Add support for the new pinctrl API to the nRF QDEC driver.
Update code of the driver and the related devicetree binding.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Andrzej Głąbek
7d0a2ffcb7 drivers: flash: nrf_qspi_nor: Add support for pinctrl
Add support for the new pinctrl API to the nRF QSPI NOR flash driver.
Update code of the driver and the related devicetree binding.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Andrzej Głąbek
fd7633126e drivers: pinctrl: nrf: Add support for PWM, QDEC, and QSPI peripherals
Add support for configuring pins to be used by the nRF PWM, QDEC, and
QSPI peripherals.
A new custom property "nordic,invert" is added to the pin configuration
group binding to allow configuring PWM channel outputs as inverted.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Andrzej Głąbek
1c20443ce0 drivers: audio: dmic_nrfx_pdm: Add support for pinctrl
Add support for the new pinctrl API to the DMIC driver that handles
the nRF PDM peripheral. Update code of the driver and the related
devicetree binding.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Andrzej Głąbek
3966a33c5c drivers: i2s_nrfx: Add support for pinctrl
Add support for the new pinctrl API to the nRF I2S driver. Update code
of the driver and the related devicetree binding.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Andrzej Głąbek
0e2af43fc6 drivers: pinctrl: nrf: Add support for I2S and PDM peripherals
Add support for configuring pins of the nRF I2S and PDM peripherals.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Gerard Marull-Paretas
03137a6152 drivers: gpio: pca95xx: fix build errors
I introduced some errors during the gpio_dt_spec/i2c_dt_spec conversion
process. This patch fixes the issues so that driver builds.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-15 09:39:45 -07:00
Immo Birnbaum
ca33905248 drivers: gpio: Xilinx PS MIO / EMIO GPIO driver
Driver implementation for the Xilinx Processor System MIO / EMIO GPIO
controller as contained in the Zynq-7000 and ZynqMP (UltraScale) SoCs.

The driver is split up into source and header for a parent controller
device and source and header for 1..n child GPIO pin bank devices.
The parent device driver takes care of IRQ handling, the GPIO pin bank
driver provides pin / bank access according to the API defined by the
GPIO subsystem.

More than one device for this type of GPIO controller is required as
it provides access to a number of GPIO pins well in excess of the 32
pins addressable by the current GPIO API (whereever parameters or
return values come in the form of a bit mask):

- Zynq-7000: 54 MIO GPIO pins, 64 EMIO GPIO pins in 4 banks.
- ZynqMP:    78 MIO GPIO pins, 96 EMIO GPIO pins in 6 banks.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-03-15 08:44:46 -07:00
Hake Huang
8c5a4fc3b0 drivers: sai: add pinctrl support in mcux sai
enable i2s pinctrl

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-03-15 10:12:57 -05:00
Hake Huang
40f3ab9f72 drivers: uart: add pinctrl support in mcux lpuart
enable pinctrl in lpuart driver, and clean up driver instance definition
macros

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-03-15 10:12:57 -05:00
Hake Huang
3fc6353b36 drivers: pinctrl: add mcux_rt pinctrl driver
Add pinctrl driver for rt1xxx

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-15 10:12:57 -05:00
Benedikt Schmidt
09d2199589 stm32: adc: use ADC properties to configure temp and vref channels
Use the devicetree properties to determine if the dedicated temperature or
voltage reference channels should be configured for the ADC.
Fixes #43750.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2022-03-15 10:50:52 +01:00
Frank Terbeck
1f0b1403f5 stm32,i2c: Fix large I2C transactions
The stm32's I2C peripheral has a maximum transmission size. Larger trans-
action, that I2C itself allows, can be achieved be using the peripheral's
reload-mode.

In order to do that, st's low-lever drivers need to be informed according-
ly. The previous iteration of the code mishandled the next_msg_flags para-
meter, causing the issue to manifest itself.

This refactors the inner loop of i2c_stm32_transfer() into its own func-
tion. This passes the message parameter by value in order to be able to
mutate its state while keeping the original datum from the user intact
during the entire procedure.

Fixes #43235

Signed-off-by: Frank Terbeck <ft@bewatermyfriend.org>
2022-03-15 10:05:48 +01:00
Jordan Yates
ad959bc2bb wifi: esp_at: claim net_context in rx
Claim the net_context mutext associated with a socket before claiming
the socket mutex. The receive callback claims the net_context mutex
internally, which will now always succeed immediately.

The TX path claims the net_context mutex before the socket mutex, and if
we don't use the same order, we can end up in a deadlock.

Fixes #43470.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-15 10:05:36 +01:00
Andrzej Głąbek
6014be589e drivers: nrf_qspi_nor: Exit DPD at driver initialization
It may happen that after the flash chip was previously put into
the Deep Power Down mode, the system was reset but the flash chip
was not. Consequently, the flash chip can be in the DPD mode when
the QSPI driver is initialized. Some flash chips will just exit
the DPD mode on the first CS pulse, but some need to receive the
dedicated command to do it and they will not respond to any other
commands including those that the driver need to perform to complete
its initialization ("Read status register" and "Read JEDEC ID").
This commit adds sending of the "Release from Deep Power Down"
command right after initialization of the QSPI interface to avoid
the problem described above.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 09:58:46 +01:00
Daniel Leung
e186ebc314 wifi: fix build error on wifi_winc1500_nm_bsp_internal.h
Previous commit 579ca90e25 to
build wifi drivers as a library changed the include path for
the WINC1500 driver, which results in the include path being
local to the library. However, the Atmel HAL requires
wifi_winc1500_nm_bsp_internal.h to in the search path. So
change the include path to be global.

Fixes #43456

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-03-14 22:04:54 -04:00
Nazar Kazakov
9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Hristo Mitrev
8fddea97de drivers: uart_mux: Fix build issue
The build failed when CONFIG_GSM_MUX=y

Signed-off-by: Hristo Mitrev <hr.mitrev@gmail.com>
2022-03-14 09:37:42 -05:00
Maureen Helm
c3ae364467 drivers: i2s: Refactor drivers to use shared init priority
Refactors the remaining I2S drivers to use the shared driver class
initialization priority configuration, CONFIG_I2S_INIT_PRIORITY, to
allow configuring I2S drivers separately from other devices. This is
similar to other driver classes.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to be
consistent with other driver classes.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-03-14 10:37:28 -04:00
Francois Ramu
1c7c4506d8 drivers: clock_control of the stm32l0x or stm32l1x devices
Fix register bit field when clock source is MSI
on the stm32L0x or stm32L1x mcus
Use RCC_CR_MSIRGSEL bit field instead of not soc stm32wbx serie
That bit of the RCC CR is common to several stm32 mcus

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-14 08:56:19 -05:00
Attie Grande
66e8eae66a drivers: i2c: sam0: Implement bus locking
After experiencing a few deadlocks, it was discovered that this bus does
not implement any form of mutual exclusion... this patch addresses this
and resolves potential deadlocks.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-03-14 11:31:32 +01:00
MohanKumar Kumar
a2e3774e54 drivers: eth: stellaris: Fix build error
Use the correct variable name in eth_stellaris, which fixes
the build error.

Signed-off-by: MohanKumar Kumar <mohankm@fb.com>
2022-03-14 11:28:41 +01:00
Maureen Helm
41634c82cc drivers: interrupt_controller: Refactor drivers to use shared init prio
Refactors interrupt controller drivers to use the shared driver class
initialization priority configuration, CONFIG_INTC_INIT_PRIORITY, to
allow configuring interrupt controller drivers separately from other
devices. This is similar to other driver classes.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEFAULT to preserve
the existing default initialization priority for most drivers.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-03-14 11:28:06 +01:00
Maureen Helm
c8f9f53322 drivers: i2c: Refactor drivers to use shared init priority
Refactors the remaining I2C drivers to use the shared driver class
initialization priority configuration, CONFIG_I2C_INIT_PRIORITY, to
allow configuring I2C drivers separately from other devices. This is
similar to other driver classes.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-03-11 15:45:28 -08:00
Daniel DeGrasse
4f792714a8 drivers: usb_dc_mcux: Enable second USB EHCI
Enable second usb EHCI if usb2 node has status="okay" Note that this
driver is still an single instance driver, this change simply enables
the driver to work with the usb2 peripheral if that one is enabled, and
usb1 is disabled.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-11 14:50:11 -08:00
Pete Dietl
90c3693005 stm32: adc: Improve handling of voltage ref and internal temp
This change includes special handling of the internal voltage
reference and internal die temperature channels for all currently
defined STM32 models

The code now looks for specific ADC + channel ID pairs instead
of just a channel ID to determine if the caller is trying to
configure an internal channel.

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2022-03-11 11:27:55 -08:00
Henrik Brix Andersen
0bdc2983d0 drivers: can: stm32: only call state change callback if state is changed
Only call the state change callback if the state has changed. Reuse the
existing function for retrieving the CAN controller state instead of
having the same code twice.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-11 11:27:09 -08:00
Henrik Brix Andersen
00a3a0f184 drivers: can: stm32: add statistics support
Add CAN controller statistics support to the STM32 bxCAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-11 11:27:09 -08:00
Carles Cufi
af9a6a6924 drivers: clock_control: nrf: Fix missing dependency to mt
The temperature sensor used in the clock_control driver requires
multithreading, but this is not compatible with mcuboot builds with
multithreading disabled.

Fixes #41597.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-03-11 08:22:31 -06:00
Avi Green
a2190cc92b bmi160: bmi160_bus union bugfix
bmi160.c module defines DT_DRV_COMPAT, but bmi160_trigger.c doesn't.
This causes a catastrophic chain of events.
The bmi160.c module includes bmi160.h,
in which the macro DT_ANY_INST_ON_BUS_STATUS_OKAY
affects the size of bmi160_bus union.
So bmi160.c defines a bmi160_cfg struct which contains that union.
Now, in bmi160_trigger_init we get a pointer to that config struct.
The fact that this module now includes bmi160.h without
DT_DRV_COMPAT, causes it to think the union is empty.

That doesn't cause compilation error, just undefined behaviour,
In which you address an empty struct fields.

In general, I suggest that someone makes sure it doesn't happen
in other drivers as well. The problem presented here is general,
meaning that if an h file assumes someone defined DT_DRV_COMPAT
before and it doesn't,
it may lead to some weird behaviour, like the one described.

Signed-off-by: Avi Green <avigreen1978@yandex.com>
2022-03-11 07:05:12 -06:00
Peter Marheine
1cf884786b drivers: it8xxx2: fix GPIO interrupt enables
gpio_pin_interrupt_configure asserts that one of GPIO_INT_ENABLE or
_DISABLE is specified by the caller, and also that GPIO_INT_EDGE is
requested if both states (GPIO_INT_TRIG_BOTH) should interrupt. This
change corrects the misuses in it8xxx2 drivers that cause assertion
failures.

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

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Change-Id: I1aaee190ec4cf063f36e25c0c293a91d280e71bb
2022-03-11 11:00:22 +01:00
Julien Massot
03dffa5434 drivers: intc_gicv3: use BIT64_MASK instead of BIT_MASK
On 32bit compiler the BIT_MASK(32) generate a warning,
after discussion on #42226 and #42163, advise was to use
BIT64_MASK instead.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-03-11 10:59:48 +01:00
Julien Massot
dd74db46e4 arch: arm: cortex_a_r: add MPIDR and SG1R definition
These definitions are required to be able to use GICv3
interrupts controller on an ARMv8 AArch32 processor.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-03-11 10:59:48 +01:00
Francois Ramu
61bef2087f drivers: spi: stm32 spi with dma must enable cs after periph
When using DMA to transfer over the spi, the spi_stm32_cs_control
is done after enabling the SPI. The same sequence applies
in the transceive_dma function as in transceive function

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-11 10:59:05 +01:00
Jay Vasanth
3e25b36979 driver: i2c: mec15xx: i2c clk and data same group
I2C clock and I2C gpio could be on same gpio group.
Remove assertion that required them to be on different
group.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-10 16:08:37 -05:00
Peng Fan
d1b8743b37 drivers: console: add jailhouse debug console
Support jailhouse hypervisor debug console

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-03-10 14:05:00 -05:00
Peng Fan
f6b608798f clock_control: mcux_ccm: fix build warning for ARM64
Fix below warning:
"warning: cast from pointer to integer of different size"

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-03-10 12:57:37 -06:00
Peng Fan
827f472560 clock: mcux_ccm: support uart1/2/3
Add UART1/2/3 clock support, also update uart4 to read clock root
mux to get clock rate.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-03-10 12:57:37 -06:00
Peng Fan
06b8dc6790 nxp: imx: rename IMX_CCM_UART_CLK to IMX_CCM_UART4_CLK
The code is actually using uart4, so rename
IMX_CCM_UART_CLK to IMX_CCM_UART4_CLK

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-03-10 12:57:37 -06:00
Pete Dietl
060e39e75a uart: logging: Add configurable log level to UART drivers
This change adds compile-time selection of log level for
the UART drivers.

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2022-03-10 13:49:43 -05:00
Henrik Brix Andersen
d4023b3c1b drivers: gpio: move non-standard dts flags to be soc specific
Reserve the upper 8 bits of gpio_dt_flags_t for SoC specific flags and
move the non-standard, hardware-specific GPIO devicetree flags (IO
voltage level, drive strength, debounce filter) from the generic
dt-bindings/gpio/gpio.h header to SoC specific dt-bindings headers.

Some of the SoC specific dt-bindings flags take up more bits than
necessary in order to retain backwards compatibility with the deprecated
GPIO flags. The width of these fields can be reduced/optimized once the
deprecated flags are removed.

Remove hardcoded use of GPIO_INT_DEBOUNCE in GPIO client drivers. This
flag can now be set in the devicetree for boards/SoCs with debounce
filter support. The SoC specific debounce flags have had the _INT part
of their name removed since these flag must be passed to
gpio_pin_configure(), not gpio_pin_interrupt_configure().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-10 13:46:34 -05:00
Bernd Weiberg
fd8702474d drivers: fixed return code bug in eth_stm32_hal_set_config()
The function eth_stm32_hal_set_config() located in
drivers/ethernet/eth_stm32_hal.c always returns -ENOTSUP,
even if everything is fine. This commit fixes the return statement
so that the real result (ret) will be returned.

Signed-off-by: Bernd Weiberg <bernd.weiberg@siemens.com>
2022-03-10 13:44:48 -05:00
Erwan Gouriou
3a041ca5c8 drivers/bluetooth: stm32wb: Allow sequential C2 start
Set up a c2_reset procedure in order to allow sequential
open/close/open calls and keep c2_reset done at init (required
for flash access).
Move reinit out of the reset procedure, so flash could be
accessed after bt_disable().

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-10 13:28:41 -05:00
Erwan Gouriou
045c986314 drivers/bluetooth/hci: stm32wb: Implement close api
Add treatment for close api.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-10 13:28:41 -05:00
Erwan Gouriou
49b15c8306 drivers/bluetooth/hci: stm32wb: Move RX thread creation to open
In order to enable RX thread abortion on close, move creation
to from init to open.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-10 13:28:41 -05:00
Jose Alberto Meza
ee1653985d drivers: espi: xec: mec172x: Handle eSPI peripheral channel error
Handle eSPI periperal channel error to avoid continous interrupt
beyond the bus error.

Whenever an eSPI access causes an internal bus error,
PC_BUS_ERROR bit is set, it remains set until cleared by written
with an 1.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-03-10 13:25:13 -05:00
Tomislav Milkovic
7f365f46b8 drivers: clock_control: clock_stm32_ll_h7: Fix PLL3 PQR output init
Due to typo in macro name, PLL3P, PLL3Q and PLL3R outputs
are never enabled

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-03-10 09:44:52 -05:00
Tom Burdick
ad2799ed15 drivers: dma: nios2: const device driver config
Moves the nios2 msgdma driver device config struct to the device data
struct for mutable data. The config struct is expected to be const.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-03-09 14:13:02 -05:00
Tom Burdick
82449f6749 drivers: i2c: nios2: const driver config
Moves the nios2 msgdma driver device config struct to the device data
struct for mutable data. The config struct is expected to be const.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-03-09 14:13:02 -05:00
Henrik Brix Andersen
e9c9caa80d net: remove unmaintained 6LoCAN implementation
Remove the unmaintained, experimental 6LoCAN (IPv6 over CAN bus)
implementation.

Fixes: #42559

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-09 18:07:31 +01:00
Jeremy Wood
2331b76b9b drivers: lis2dh: power management
* Add support for power management.

Signed-off-by: Jeremy Wood <jeremy@bcdevices.com>
2022-03-09 10:19:22 -06:00
Henrik Brix Andersen
9fe466f4b0 drivers: can: rcar: add statistics support
Add CAN controller statistics support to the Renesas R-Car CAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-09 09:51:05 -06:00
Gerard Marull-Paretas
034b705745 drivers: counter: native_posix: use tabs in Kconfig
Kconfig used spaces instead of tabs, leading to compliance failures.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Gerard Marull-Paretas
dffaf5375c kconfig: tweak Kconfig prompts
Tweak some Kconfig prompts after the removal of "Enable...".

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Gerard Marull-Paretas
95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

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

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Andrzej Głąbek
89cc06e588 drivers: gpio_pcal6408a: Fix handling of the GPIO_INT_DEBOUNCE flag
Ignore the flag instead of rejecting it with -ENOTSUP, as this is what
the GPIO API expects from drivers that do not support debouncing.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-09 12:06:20 +01:00
Andrzej Głąbek
b2a4a3672f drivers: i2c: nrfx: Add support for pinctrl
Add support for the new pinctrl API to the I2C drivers that handle
the nRF TWI and TWIM peripherals. Update code of the drivers and
related devicetree bindings.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-09 12:05:22 +01:00
Andrzej Głąbek
32b9e65e4b drivers: spi: nrfx: Add support for pinctrl
Add support for the new pinctrl API to the SPI drivers that handle
the nRF SPI, SPIM, and SPIS peripherals. Update code of the drivers
and related devicetree bindings.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-09 12:05:22 +01:00
Andrzej Głąbek
2a87e04ce6 drivers: spi: nrfx: Clean up code
- clean up registration of the drivers with the logging subsystem
- use consistent naming of local variables accessing configuration
  and runtime data of driver instances, for easier code maintenance

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-09 12:05:22 +01:00
Andrzej Głąbek
fa22634880 drivers: pinctrl: nrf: Add support for SPI and TWI peripherals
Add support for configuring pins of the following nRF peripherals:
SPI, SPIM, SPIS, TWI, and TWIM.

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

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-09 12:05:22 +01:00
Simon Frank
4d4bc67243 gpio: mcp23s17: use gpio_driver_data not config
fix incorrect gpio driver struct used in driver data.
This should not have caused any issue as currently
sizeof(gpio_driver_data) == sizeof(gpio_driver_config).

Signed-off-by: Simon Frank <simon.frank@lohmega.com>
2022-03-08 09:20:15 -06:00
Sam Hurst
6458649137 stm32: Add STM32 USB TCPC Driver
This commit adds a USB Type-C Port Controller Driver for
the STM32 USB Type-C / USB Power Delivery (UCPD) peripheral

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-03-08 11:08:43 +01:00
Krzysztof Chruscinski
47ae656cc1 all: Deprecate UTIL_LISTIFY and replace with LISTIFY
UTIL_LISTIFY is deprecated. Replacing it with LISTIFY.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-08 11:03:30 +01:00
Yegor Yefremov
1155d4679b drivers: serial: fix typos
Typos were found with codespell utility.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2022-03-08 10:24:23 +01:00
Mikkel Jakobsen
da514737d0 drivers: sensor: icm42605: fix default kconfig issues
by default, a global trigger thread was enabled in kconfig but
the thread priority and stack size depended on a local thread
being enabled.

the local thread option was never used anywhere so it is removed.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-03-07 16:23:36 -06:00
Mikkel Jakobsen
9d3f9e3921 drivers: sensor: icm42605: make trigger mode choice named
convert choice to named choice to allow setting from Kconfig.* files

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-03-07 16:23:36 -06:00
Daniel DeGrasse
694e6493af timers: mcux_gpt_timer: Change MCUX GPT timer to use indirect ISR
Indirect ISR automatically calls power management functions, which GPT
timer direct ISR was not calling. Calling these functions means that the
kernel will recognize that it is exiting low power mode when the GPT
timer interrupt fires that wakes the SOC up, and will call
pm_power_state_exit_post_ops, which can in turn raise the clock
frequencies and voltage of the SOC as early as possible.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-07 13:53:14 -06:00
Daniel DeGrasse
6696d834cf drivers: serial: Add pm constraint setting to mcux lpuart driver
System entering sleep state before uart tx is complete can result in
characters being dropped from the transmission. Add pm constraint
setting to the lpuart driver to prevent character drops

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-07 13:53:14 -06:00
Jay Vasanth
3034693509 drivers: i2c: MEC15xx: Improved error handling
1. Check I2C Clock and Data is high through GPIO driver instead
of the I2C bitbang registers
2. i2c_xec_poll_write() and i2c_xec_poll_read() will poll to
check I2C clock and data lines are high before initiating the
transaction. The polling will be every 25us for a cumulative
max of 2.5ms
3. wait_completion() will not call recover_from_error() to reset
the controller. Instead will poll for 10ms for the PIN bit to
clear before returning error.
4. wait_completion() will send STOP if the 9th bit is NACK
5. If any errors with current transaction:
(a) Set error_seen flag.
(b) In the next transaction do the recovery process (reset the
i2c controller) if the clk and data lines are high.
Note: error_seen flag is set for Address NACK with Repeated
Start as well.
6. If timeout error occurs in wait_completion():
(a) Set timeout_seen flag;
(b) Wait till the slave will release the clock.
(c) Once slave releases clock send STOP on the bus. If the
timeout occurred while master read, read the I2C DATA register
for the hardware to proceed.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 14:13:34 -05:00
Bartosz Bilas
718225dadf drivers: ethernet: dsa_ksz8xxx: fix spi bus initialization
spi_dt_spec structure initialization should not be done
in the runtime during spi bus initialization because it
causes kernel panic.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-03-07 09:54:21 -06:00
Rafał Kuźnia
1a0fed70d5 drivers: timer: Set user RTC channel count conditionally
The RTC user channel count is increased contitionally to 2 when
nrf_802154 radio driver is enabled.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2022-03-07 09:26:52 -06:00
Rene Bredlau
876ea8d215 modem: hl7800: use correct timeouts on KTCPSND to avoid internal deadlock
The response of a KTCPSND has two phases. According to documentation by
wireless the timeout is 60 seconds. The fix respects the timeout on the
second phase, too (waiting for OK or errors from modem). Previously only
the first phase used 60 seconds and the second phase used 5 seconds.

Without this fix the hl7800 will lock the tcp stack for the current
socket indefinitely if another socket operation is performed before the
response from the modem is received.

Additionally all timeouts are adjusted to be at least one second longer
as the documented timeout from wireless. This avoids races between the
hl7800 and the driver.

Signed-off-by: Rene Bredlau <git@unrelated.de>
2022-03-07 09:24:25 -06:00
Andrzej Głąbek
70a9e2055c drivers: Remove undesirable irq_enable calls from nrfx driver shims
Shims for nrfx drivers should only connect the related IRQ handlers,
they should not enable the IRQs, as this could lead to a situation
where the interrupt handler is called before the driver had a chance
to properly initialize the peripheral and install the provided event
handler. nrfx drivers will enable the interrupts appropriately on
their own by calling the NRFX_IRQ_ENABLE macro which is implemented
in nrfx_glue.h as a call to irq_enable().
This commit fixes the above issue spotted in the following shims:
- dmic_nrfx_pdm
- clock_control_nrf
- i2s_nrfx

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-07 09:19:56 -06:00
Erwan Gouriou
d74cb2a3df drivers/clock_control: stm32h7: Simplify SysClk freq computing
Instead of reading registers query the info on sysclock configuration
from existing configuration symbols.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
2116606ce2 drivers/clock_control/stm32h7: Independent clocks configuration
Rework clock start up functions in order to allow configuration
and enabling of individual clocks.
This way, each clock defined with a "okay" status will be enabled
even if not part of the sysclock clock tree.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
ceb8579854 include/drivers/clock_control: stm32: Add XXX_ENABLED and XXX_FREQ
Add STM32_FOO_ENABLED and STM32_FOO_FREQ to STM32 fixed clocks:
HSI, HSE, MSI(S), CSI, LSI, LSE..

Replace STM32_LSE_CLOCK by STM32_LSE_FREQ and when possible
replace by new STM32_LSE_ENABLED when making sense.

Fix STM32_PLL3_FOO_ENABLE to STM32_PLL3_FOO_ENABLED

Additionally, add STM32_PLL_FOO_ENABLED definitions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
348070e4ea drivers/clock_control: stm32u5: Use LL API for LSESYS programming
Use LL API when possible.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
5a1fe914ff drivers/clock_control stm32h7: Move RCC HW semaphore unlock
PLL3 setting should also be protected CFG_HW_RCC_SEMID.
Move semaphore unlock after we're done with PLL3.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
87eba815dd drivers/clock_control: stm32h7: Complementary readability changes
- Factorize elementary clocks setup code.
- Put conditional logic on CONFIG_CPU_CORTEX_M4 outside init function

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
12404f7668 drivers/clock_control: stm32h7: Make driver more readable
Re-arrange code using benefits of IS_ENABLED.
Change some #if to #ifdef when possible.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
a911b81a2e drivers/clock_control: stm32u5: Make driver more readable
Use benefits of IS_ENABLED.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Jay Vasanth
73f24056d5 kscan: update mchp keyscan module to use pinctrl
Changes to keyscan module to support pinctrl

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
9138d81365 adc: updates to MEC172x adc to support pinctrl
Changes to adc module to support pinctrl.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
535c20e490 qmspi: MEC172x: fix unused variable warning
Fix unused variable warning when CONFIG_SPI_ASYNC
is not defined

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
99c89ebb78 qmspi: update MEC172x qmspi module for pinctrl
Changes to qmspi module to support pinctrl

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
156440f3f0 serial: update mchp uart module to use pinctrl
Changes to uart module to support pinctrl

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
f8130d5ce3 espi: updated MEC172x espi module for pinctrl
Changes to espi module to support pinctrl

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
63ac835988 i2c: update MEC172x i2c module for pinctrl
Changes to i2c module to support pinctrl

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
5cccbb13bc gpio: MEC172x: update gpio module for pinctrl
Changes to gpio module to support pinctrl

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
2cd02bd826 drivers: pinctrl: Microchip MEC172x pinctrl driver
Add core files for Microchip MEC172x pinctrl driver

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Sylvio Alves
a4a2b9f1cd pinmux: esp32: check only for pullup
Current implementation checks for pulldown and
pullup. As pinmux configuration is related to PU only,
this PR checks for PU feature instead of PD.
This also fix missing PU check when PD is present.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-03-07 10:54:18 +01:00
Dino Li
d8c2c2cbb8 it8xxx2: timer: to unified method of enabling event timer.
This enable timer and also reset it.

fixes #42851
fixes #42953

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-03-07 10:51:29 +01:00
Artur Hadasz
5451c8b70f modules: hal_nordic: 802.15.4 make possible to disable CSMA-CA
Currently if an attempt to disable CSMA-CA in by setting an
appropriate flag in another (for example application)
CmakeLists.txt it caused lots of warnings. This fix allows
higher level CMakeLists.txt to disable CSMA-CA without
warnings.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2022-03-07 10:51:21 +01:00
Francois Ramu
8e99151937 drivers: entropy: stm32 rng driver should not block if Seed error occurs
When a Seed error occurs during the random nb generation,
the driver tries to recover and exit without providing a random data
This avoids looping endlessly on the DRDY bit of the RNG status reg
because it remains 0 in case of error.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-07 10:49:19 +01:00
Andrew Hedin
c64783f29d drivers: sensors: lis2dh: Allow any movement on interrupt 1
Allow movement detection to be used on hardware
that only has one interrupt line connected.
Change hardware configuration to a bitmask.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2022-03-07 10:46:17 +01:00
Gerard Marull-Paretas
ee30559f07 soc: arm: nuvoton_npcx: s/SOC_POWER_MANAGEMENT_TRACE/NPCX_PM_TRACE
Rename CONFIG_SOC_POWER_MANAGEMENT_TRACE to CONFIG_NPCX_PM_TRACE so that
it is clear that it's a NPCX specific option.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-04 09:05:45 -06:00
Tim Lin
056738514a ITE: drivers/adc: implement ADC channels 13-16
The ADC driver of IT81302 chip can support channels 0-7 & 13-16.
This PR adds to implement ADC channels 13-16.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-03-04 09:03:04 -06:00
Gerard Marull-Paretas
cb9a279050 drivers: dma: dw_common: fix style issue
Fix a couple of issues reported by checkpatch:

ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)"

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-04 08:55:45 -06:00
Emil Lindqvist
8b4a3e2328 sensor: vcnl4040: add missing semicolon
Adding missing semicolon to vncl4040 driver

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2022-03-03 18:52:28 -05:00
Daniel DeGrasse
1fd4205eee drivers: serial: Add pinctrl support to mcux uart driver
Add pinctrl support to mcux uart driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-03 13:00:20 -06:00
Daniel DeGrasse
fc8877187e drivers: pinctrl: Add kinetis pinctrl driver
Add kinetis pinctrl driver. Driver initializes clocks for each port, and
exposes the pinctrl_configure_pins function required for pinctrl
support.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-03 13:00:20 -06:00
Kamil Piszczek
cf6a58d3f6 bluetooth: hci: rpmsg: use ipc service library
The Bluetooth HCI driver based on the RPMsg transport now uses the IPC
service module. The compatible Bluetooth sample - HCI RPMsg - has also
been migrated to the new IPC solution.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2022-03-02 17:03:01 +01:00
Carlo Caione
5e810dd34d mbox: Fix function syscall check
The syscall check is done using a wrong function name. Fix it.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-03-02 07:55:32 -08:00
Dino Li
7a9a5cec0b it8xxx2: espi: reduce h2ram pool size
This saves 1280 bytes memory space by default eSPI configurations.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-03-02 09:45:14 -06:00
Krzysztof Chruscinski
d13ab8b367 drivers: mbox: Add configurable init priority
Add configurable initialization priority.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-02 09:42:09 -06:00
Flavio Ceolin
d2a56c5047 drivers: crypto: Add multipart hash support
Add a new API to support multipart hash calculation. The API allows
split the data input to be split in small chunks.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin
64f6a5ec37 drivers: crypto: mtls: Add support for hashing
Add support for hashing on mtls driver.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin
981ea3042e drivers: crypto: Keep namespace consistent
The API to set a callback has the namespace cipher but the driver
function pointer was using the namespace crypto. As this API belongs
to the cipher subgroup, just rename the function pointer in the driver
to be consistent.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin
ce48b8c3d1 drivers: crypto: s/cipher_struct/cipher
Just give a better name to this file since now we have changed the
file where crypto driver API is defined.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin
df3d1f83f7 drivers: crypto: Rename cipher file
This file defines the crypto driver API, cipher is supposed to be just
one type of capability (other can be hash) of these drivers, just
change the file name to be consistent with it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin
d1628ba035 drivers: crypto: Add cipher namespace in some API
Add 'cipher' namespace in some in the driver API since these
operations are for cipher.

Set a namespace to make it clear that these are cipher operations,
this allow further functionalities, like hash, to be added in this
driver API.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Casper Meijn
2eb1feea91 drivers: display: st7789v: fix gpio_dt_spec initialization
The `gpio_dt_spec` structures where never initialised, therefore the driver
would always fault with "E: Reset GPIO device not ready" printed to the
console.

Fixes: 069bf6be44
("drivers: display: st7789v: use gpio_dt_spec")

Signed-off-by: Casper Meijn <casper@meijn.net>
2022-03-01 14:38:21 -06:00
Qingsong Gou
b0eb3207a9 drivers: kscan: add support for cst816s touch panel driver
Add touch panel driver support for pinetime

Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
2022-03-01 14:24:27 -06:00
Aymeric Aillet
732f829f69 drivers: pinctrl: rcar: Rework pin configuration
Rework pin configuration to meet documented procedures.
3 procedures are covered here:
  - GPIO -> Peripheral (+select peripheral function)
  - Peripheral -> GPIO
  - Change from Peripheral function 1 -> Peripheral function 2

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-03-01 12:20:25 -08:00
Jay Vasanth
8c193743ac drivers: bbram: mec: fixed compilation error
Fixed compilation error when building bbram driver
for MEC15xx

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-01 14:18:55 -06:00
YuLong Yao
344e7284c3 drivers: pinctrl_gd32_afio: add header file.
add soc.h include in pinctrl_gd32_afio.c

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2022-03-01 18:06:14 +01:00
Andy Ross
27a59ec9d5 drivers/ipm: Add ipm_cavs_host: host/DSP communication on adsp_intel
Intel Audio DSPs have "IPC" interrupt delivery and shared memory
window hardware.  The Sound Open Firmware project has historically
used the combination of these to implement a bidirectional
message-passing interface.  As it happens, this protocol is an
excellent fit for Zephyr's somewhat geriatric but still useful IPM
interface.

This implements a SOF-protocol-compatible transport that will
hopefully prove a bit more futureproof for non-Intel SOF
architectures.  It is a software-only device, built on top of the
underlying SOC APIs for the SRAM windows (in cavs-shim) and IPC
(cavs_ipc).

Note that SOF actually has two protocol variants (ipc3 and ipc4): in
both, the command header (passed as the "id" parameter in IPM) is sent
via the hardware doorbell register.  But in ipc4, the second hardware
scratch register is used to transmit the first four bytes of the
command before involving the SRAM window (in ipc3, it's ignored).
Both modes are supported by this driver, set IPM_CAVS_HOST_REGWORD to
choose the "ipc4" variant.

Finally: note that the memory layout for the windows in question is
inherited from SOF, and for compatibility (with both SOF and with the
offsets used by the host!) these can't be changed without major
surgery.  They're defined in kconfig, but should be treated as
read-only until we get a chance to rework the way Zephyr does its SRAM
window management (and probably in concert with the host drivers).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-03-01 09:59:15 -05:00
Andy Ross
ebf48d7112 drivers/ipm: Add IPM_CALLBACK_ASYNC mode
Some IPM devices support asynchronous command processing, where
acknowledgment of an IPM message can be delayed while handling
happens in a context other than the ISR that invoked the callback.
Expose this via a kconfig that can be selected by the driver, and add
a new "complete" call (a zero-overhead stub on non-supporting devices)
to signal the end of message handling.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-03-01 09:59:15 -05:00
Bartosz Bilas
a3af7007f7 drivers: sensor: iis3dhhc: convert to spi_dt_spec
Convert icm42605 driver to use spi_dt_spec helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-03-01 11:54:07 +01:00
Yong Cong Sin
d8c9033e22 drivers: console: gsm_mux: gsm_mux_state_str should be static
`gsm_mux_state_str` is only used internally and therefore
should be 'static'.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-01 11:53:15 +01:00
Mikkel Jakobsen
daeaf9b89a drivers: clock_control: add stm32h725 support
the stm32h725 has the same maximum clock frequencies as the stm32h723.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-02-28 09:15:33 -06:00
Michał Barnaś
521cb6d88a i2c: allow shell commands to operate on up to 32-bit registers
Improve shell commands to support up to 32-bit addresses.
The check if function should use 8/16/24/32-bit address is basing
on the length of address used in function parameter. To address
registers below 256 using 16-bit, one should write them left-padded
with zeroes. Address is sent in big endian.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-02-28 11:09:05 +01:00
Michał Barnaś
d9a657dee5 i2c: fix for MISRA in i2c shell commands
This commit changes the shell parameter name to meet the MISRA
check requirements.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-02-28 11:09:05 +01:00
Yong Cong Sin
6e6009ea55 drivers: modem: gsm: define retry delay in macro
Define the delay used to reschedule work when AT command failed
in a macro.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
a5394e865a drivers: modem: gsm: Define tx_lock timeout at the top
The tx_lock timeout is closely related to GSM_CMD_AT_TIMEOUT
& GSM_CMD_SETUP_TIMEOUT, and should be longer than both of
them, otherwise the gsm_ppp_stop might fail to lock the tx.

Define the timeout at the top of the driver and added a comment
to make it clear for the user.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
7a6764987e drivers: modem: gsm: remove use of preprocessor directives for rssi
The rssi_work_handle always exists in the gsm struct, so use

```
if (IS_ENABLED(CONFIG_GSM_MUX))
```
instead of

```
#if defined(CONFIG_GSM_MUX)
```

for better code readability.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
f505028280 drivers: modem: gsm: cancel rssi work only if GSM_MUX is enabled
There's no need to cancel rssi work when CONFIG_GSM_MUX isn't
enabled, since it is not scheduled.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
62c383d062 drivers: modem: gsm: rssi_work should be submitted to gsm workq
The rssi_work_handle should be submitted to the gsm workqueue
using the gsm_work_reschedule, fix that.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
cd216b17e0 drivers: modem: gsm: Reset attached flag on stop
The 'attached' flag should be reset on gsm_ppp_stop, or else
some part of the gsm_finalize_connection won't be executed
during the next gsm_ppp_start.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
db31558c7d drivers: modem: gsm: Convert gsm_finalize_connection to work
Convert gsm_finalize_connection into a work so that the caller
work won't have to run again when gsm_finalize_connection
reschedule gsm_configure_work on error.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
c063c44028 drivers: modem: gsm: Go to next state if mux_attach successfully
Currently the mux_setup set the state to the next one after
uart_mux_alloc is successful even if the mux_setup fails which
can be a problem.

Set the state after both mux_setup & uart_mux_alloc are
successful.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
ef2d51c076 drivers: modem: gsm: Remove unnecessary mux_enabled check
Remove redundant mux_enabled checks, the code execution will
not reach here if mux_enabled is false in the first place.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
2984a9c322 drivers: modem: gsm: Customize error logs to ease debugging
Customize the error logs in each connection finalization steps
so that it is easier to trace the error.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
499412a60d drivers: modem: gsm: Reorder gsm mux logs so that it will be printed
The gsm_configure will return if it fails to perform mux_enable,
therefore the disable part of the log will not be printed.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
00513c90c5 drivers: modem: gsm: Remove unused flags
The `setup_done` and `mux_setup_done` aren't being used
anywhere in the driver, therefore should be removed.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
7dc1e790a8 drivers: modem: gsm: Init rssi_work_handle on gsm_init only
Initializing rssi_work_handle on gsm_start would (re)init it
unnecessarily everytime the gsm_start is invoked, we only need
to initialize it once in the gsm_init.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
b2dd782879 drivers: modem: modem_cmd_handler: Fix missing documentations
Fix missing documentations.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Immo Birnbaum
27cefa657f drivers: xlnx_gem: remove Zynq/ZynqMP distinction for DMA placement
With the unification of OCM declaration & assignment between Zynq-7000
and Ultrascale/ZynqMP, remove the distinction between those two SoC
families so that the DMA area is always set up in the OCM regardless
of the current SoC type.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-02-28 11:04:57 +01:00
Pieter De Gendt
1e747eca0d drivers: hwinfo: sam: Introduce RSTC driver
Add a new hwinfo driver to get the reset cause on
SAM4S/SAME70/SAMV71 SoC series.

The user-nrst dts property has been added to enable external user
resets.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-02-28 10:53:57 +01:00
Jordan Yates
d9a74dda54 lora: sx126x: fix missing GPIO instantiation
Instantiate the values of `sx126x` GPIO's when they are present in
devicetree. This was missed in #42230.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-02-28 10:52:23 +01:00
Bartosz Bilas
b5497d7d2f drivers: wifi: eswifi: fix spi bus initialization
spi_dt_spec structure initialization should not be done
in the runtime during spi bus initialization because it
caues kernel panic.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/43046

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-02-28 10:52:17 +01:00
Tom Burdick
d5e6027131 dma/cavs_gpdma: Revert IRQ_CONNECT changes
It turns out XCC didn't like this change as it doesn't have a
__COUNTER__ builtin. Bummer.

This reverts commit e8389f2f53.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-02-25 22:20:31 -05:00
Ederson de Souza
d27cdd1a1e drivers/timer: Use correct timer for CPU in SMP Risc-V
With SMP, it shouldn't be assumed that there's only one CPU to set
timers.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-02-25 19:13:50 -05:00
Mahesh Mahadevan
45cc1d6fc7 drivers: display: Update the MCUX ELCDIF driver
1. Rename device data to dev_data to fix variable
   name clash
2. Use Device Tree properties to setup the display
3. Delete unused Kconfigs

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-02-25 13:35:58 -06:00
Mahesh Mahadevan
3489a39631 dts: Rename NXP LCDIF dts node
Rename fsl,imx6sx-lcdif to nxp,imx-elcdif as it
used by imxrt and imx platforms.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-02-25 13:35:58 -06:00
Ryan Erickson
34acbceef5 modem: hl7800: CTS to monitor sleep
Use CTS input to monitor HL7800 sleep state
when in SLEEP mode.
When CTS is high, shutdown the UART to
save power.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-25 10:10:22 -08:00
Ryan Erickson
48cca618fb modem: hl7800: fix +CFUN handler
Fix the +CFUN command handler to find
the end of the message properly.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-25 09:56:43 -08:00
Nicolas Pitre
c2543320d8 ring_buffer: rationalize the item-based put and get methods
Conceptually, ring_buf_item_put() and ring_buf_item_get() are specialized
versions of ring_buf_put() and ring_buf_get(). Make it so to rationalize
the code to open the way for more optimizations.

This means we need specialized wrappers on top of ring_buf_init()
accordingly, given that the core machinery is now common and byte based.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2022-02-24 14:49:00 -08:00
Yong Cong Sin
176bd02a56 drivers: modem: gsm: +CSQ shouldn't give sem_response
The +CSQ: is followed by 'OK' or 'ERROR', so its handler
should not give sem_response.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-24 13:57:48 -08:00
Yong Cong Sin
6bf44c5af5 drivers: modem: gsm: +CGATT shouldn't give sem_response & set error
The +CGATT: is followed by 'OK' or 'ERROR', so its handler
should not set error code and give sem_response.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-24 13:57:48 -08:00
Rafał Kuźnia
c8e68f62e7 drivers: timer: Increase user channel count to 3 on nRF52
Increase the default user-allocable number of RTC channels to 3,
which is the numer of physical RTC CC channels not used by Zephyr
on nRF52 series SoCs.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2022-02-24 13:50:42 -08:00
Rafał Kuźnia
81f2f36149 drivers: ieee802154_nrf5: Align shim layer to 64-bit time
The updated nrf_802154 API accepts 64-bit time in microseconds.
The shim layer is updated to use 64-bit time.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2022-02-24 13:50:42 -08:00
Henrik Brix Andersen
cf1879bfac drivers: can: remove deprecated APIs
Remove the CAN APIs deprecated in Zephyr v3.0.0.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-24 13:49:53 -08:00
Ryan Erickson
8c1387ef1a modem: hl7800: Make RSSI rate configurable
Improve ability to sleep.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-24 13:46:33 -08:00
Ryan Erickson
05e818c51c modem: hl7800: Add callbacks for sleep IO
Allows mapping of sleep signals to user
accessible test points on the development
board.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-24 13:46:18 -08:00
Simon Frank
ba7af2f780 include: sensor: sensor_value from double overflow
sensor_value_from_double had a early overflow when converting the
fractional part (val2).  This occured when input was more then
2147.493647 (inp >= INT32_MAX/1000000.0 + 0.01).

return value -ERANGE as this is what errno is set to by `strtod` and
similar posix functions.

fixes issue #39176

Signed-off-by: Simon Frank <simon.frank@lohmega.com>
2022-02-24 13:45:29 -08:00
Fabio Baltieri
eb7b3b66a2 drivers: can: mcp2515: fix build break
Fix build break introduced in 03ab730347:

/zephyr/drivers/can/can_mcp2515.c:871:55: error: 'const struct
mcp2515_config' has no member named 'int_pin'; did you mean 'int_gpio'?
  871 |   LOG_ERR("Unable to configure GPIO pin %u", dev_cfg->int_pin);

/zephyr/drivers/can/can_mcp2515.c:942:14: error: 'GPIO_DT_SPEC_INST_GET'
undeclared here (not in a function)
  942 |  .int_gpio = GPIO_DT_SPEC_INST_GET(0),
      |              ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-02-24 09:09:02 -08:00
Fabio Baltieri
824bb337d5 drivers: display: ls0xx: fix compiler warning
Fix a compiler warning introduced in 0fa2c45037:

/zephyr/drivers/display/ls0xx.c: In function 'ls0xx_init':
/zephyr/drivers/display/ls0xx.c:294:9: error: passing argument 5 of
'k_thread_create' discards 'const' qualifier from pointer target type
[-Werror=discarded-qualifiers]
  294 |         config, NULL, NULL,
      |         ^~~~~~

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-02-24 09:09:02 -08:00
Fabio Baltieri
1b370eead8 drivers: display: gd7965: fix build break
gd7965 broke after 42bbb30ecf:

/zephyr/drivers/display/gd7965.c: In function 'gd7965_init':
/zephyr/drivers/display/gd7965.c:379:23: error: passing argument 1 of
'device_is_ready' from incompatible pointer type
[-Werror=incompatible-pointer-types]
  379 |  if (!device_is_ready(&config->reset_gpio.port)) {
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       const struct device * const*

Fix all the occurrences.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-02-24 09:09:02 -08:00
Fabio Baltieri
1c2d72cfad drivers: display: st7735r: fix build break
display_st7735r broke after cd1fb2972e:

/zephyr/drivers/display/display_st7735r.c: In function 'st7735r_write':
/zephyr/drivers/display/display_st7735r.c:191:34: error: initialization
discards 'const' qualifier from pointer target type
[-Werror=discarded-qualifiers]
  191 |  struct st7735r_config *config = dev->config;
      |                                  ^~~
/zephyr/drivers/display/display_st7735r.c: In function 'st7735r_lcd_init':
/zephyr/drivers/display/display_st7735r.c:318:26: error: passing
argument 1 of 'st7735r_set_lcd_margins' from incompatible pointer type
[-Werror=incompatible-po
inter-types]
  318 |  st7735r_set_lcd_margins(dev, data->x_offset, data->y_offset);
      |                          ^~~
      |                          |
      |                          const struct device *
/zephyr/drivers/display/display_st7735r.c:60:58: note: expected 'struct
st7735r_data *' but argument is of type 'const struct device *'
   60 | static void st7735r_set_lcd_margins(struct st7735r_data *data,
      |                                     ~~~~~~~~~~~~~~~~~~~~~^~~~
/zephyr/drivers/display/display_st7735r.c: In function 'st7735r_init':
/zephyr/drivers/display/display_st7735r.c:441:24: error: passing
argument 1 of 'device_is_ready' from incompatible pointer type
[-Werror=incompatible-pointer-types]
  441 |   if (!device_is_ready(&config->reset)) {
      |                        ^~~~~~~~~~~~~~
      |                        |
      |                        const struct gpio_dt_spec *

and few others. Fix all of them.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-02-24 09:09:02 -08:00
Pete Dietl
5dddf9f0f8 drivers: sensors: Implement MAX31875 sensor
This commit implements the temperature sensor interface for
the Maxim MAX31875Low-Power I2C Temperature Sensor.

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2022-02-24 08:49:40 -06:00
Yong Cong Sin
71707745b2 drivers: modem: gsm: Kconfig: Add MODEM_GSM_TYPE to choice
Add a name for the choice of gsm modem so that it can be
default to a certain type in board's Kconfig.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-24 08:45:16 -06:00
Peter Johanson
562e79780a drivers: gpio_rpi_pico: fix pull ups and disabling interrupts
Properly set both pull up and down flags explicitly when
making changes.

Properly implement disabling interrupts on a given pin.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
2022-02-24 08:44:19 -06:00
Jose Alberto Meza
ace858bc29 drivers: espi: xec: mec172x: Fix compilation when OOB RX async is enabled
Correct MEC172x OOB register access that causes compilation error,
Use device-tree-based register access instead of HAL access
This occurs whenever CONFIG_ESPI_OOB_CHANNEL_RX_ASYNC is
enabled.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-02-24 08:40:07 -06:00
Michał Barnaś
c2f9e2b0d5 shell: fix i2c commands definitions
I2C scan and recover functions didn't have mandatory parameters
specified, which resulted in not displaying the I2C controllers in
help message. Instead, the command was executed, and argv was
dereferenced outside of the bounds, providing invalid data to
device_get_binding function.
Other functions had defined mandatory parameters without taking their
names into account, they are provided as argv[0].

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-02-24 08:29:52 -06:00
Bartosz Golaszewski
0f09360456 lvgl: change the prefix of Zephyr-specific LVGL config options
We're now using the Kconfig copied from the upstream lvgl repository. It
uses the LV_ prefix for all options while we're using LVGL_ for
Zephyr-specific ones. Make the latter consistent with upstream but also
make sure they're distinct from lvgl's by using LV_Z_ as the prefix.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@huawei.com>
2022-02-24 11:51:33 +01:00
Chris Trowbridge
52bee41bba drivers: ipm: Add support for NXP i.MX rev2 MU
With a number of the i.MX SoCs (e.g., the i.MX8M Plus), NXP has moved to
supporting the integrated Cortex-M cores with the MCUXpresso SDK (MCUX).
As a result, certain Zephyr drivers (such as the IPM driver) need to be
updated to utlize this new MCUX-based SDK.

This change adds support for the MCUX Messaging Unit driver pulled in by
this PR:
https://github.com/zephyrproject-rtos/hal_nxp/pull/130

Additionally, this change enables the new IPM_IMX_REV2 config for the
mimx8ml8_m7 SoC target which utilizes this new revision of the driver.

Signed-off-by: Chris Trowbridge <chris.trowbridge@lairdconnect.com>
2022-02-22 16:34:06 -06:00
Gerard Marull-Paretas
9df8151623 drivers: misc: grove_lcd_rgb: use custom log level
The driver was re-using the display log level, however, it is no longer
part of the display driver category.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-22 11:58:33 -08:00
Gerard Marull-Paretas
0bc64307d4 drivers: misc: grove_lcd_rgb: cleanup driver
- Cleanup list of includes
- Remove unused structs/definitions
- Make init function static (is called by system init)
- Make config/data naming and access consistent
- Remove redundant zero initialization of data

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-22 11:58:33 -08:00
Gerard Marull-Paretas
825655f0dc drivers: misc: grove_lcd_rgb: use k_sleep
The driver is sleeping in milliseconds using a custom wrapper around
k_busy_wait, move to k_sleep.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-22 11:58:33 -08:00
Gerard Marull-Paretas
498579ae25 drivers: misc: grove_lcd_rgb: use i2c_dt_spec
Modernize the driver a little bit by using i2c_dt_spec. Note that the
RGB on its own is another I2C device connected to the same bus. Ideally,
both should be defined in Devicetree, but this has not been done for
now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-22 11:58:33 -08:00
Gerard Marull-Paretas
0bb486aa29 drivers: misc: grove_lcd: port to Devicetree
The driver was never migrated to Devicetree, this patch converts the
driver to a proper Devicetree based device.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-22 11:58:33 -08:00
Gerard Marull-Paretas
9a00b99884 drivers: display: grove_lcd_rgb: move to misc
The driver does not implement a display API, it has a custom API. Having
it under display is confusing, since display API consumers may expect
they can use it. These sort of custom drivers fit better under
drivers/misc.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-22 11:58:33 -08:00
Henrik Brix Andersen
4f90a9aa86 drivers: can: mcux: flexcan: add statistics support
Add support for CAN controller statistics to the NXP MCUX FlexCAN
driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-22 11:54:27 -08:00
Henrik Brix Andersen
28b5cfd46c drivers: can: add statistics support
Add CAN controller device statistics support.

Initially the following per-device statistics are supported:
- Dominant bit transmission errors
- Recessive bit transmission errors
- Bit stuffing errors
- CRC errors
- Format errors
- Acknowledge errors

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-22 11:54:27 -08:00
Chris Trowbridge
f401be157f drivers: gpio: Add GPIO support for mimx8ml8_m7 (NXP i.MX8M Plus SoC)
The current MCUX IGPIO driver assumes that the target SoC supports
the DR_SET, DR_CLEAR, and DR_TOGGLE functionality, but some do not
(namely, the M7 core of the i.MX8M Plus SoC). Current releases of
the MCUXpresso SDK IGPIO driver contain utility functions to set,
clear, and toggle pins which include provisions to support SoCs
with and without DR_SET, DR_CLEAR, and DR_TOGGLE, and this change
switches to using these utility functions.

Additionally, this change enables GPIO support on the mimx8ml8_m7
target.

Signed-off-by: Chris Trowbridge <chris.trowbridge@lairdconnect.com>
2022-02-22 10:13:31 -08:00
Jun Lin
0bbf394ced driver: i2c: npcx: don't print the err log when SMBST is zero
In the I2C ISR, it prints the error message when SMBST is set to an
unexpected value. However, we found a spurious interrupt which caused
the SoC to enter the ISR with SMBST=0. Because the spurious interrupt
will not break the I2C operation, this commit limits the error log to
print if SMBST is not equivalent to 0 to prevent a false alert.

Signed-off-by: Andrew McRae <amcrae@google.com>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-02-22 10:09:36 -08:00
Tomislav Milkovic
b2231c9d85 drivers: clock_control: stm32h7: select max clock freq for STM32H7B3
STM32H7B3 supports max SYSCLK and AHB clock frequencies of 280 MHz,
and max APB frequency of 140 MHz

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-02-22 10:34:56 -05:00
Henrik Brix Andersen
de45e8ec72 drivers: can: use separate log modules for each driver
Use separate log modules for each CAN driver similar to other
sub-systems/driver classes.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-22 10:34:04 -05:00
Ryan McClelland
2eaede53af drivers: adc: add ads1x1x driver
This adds support for the ads101x (ads1013, ads1014, ads1015) and
ads111x (ads1113, ads1114, ads1115) family of i2c adc devices.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2022-02-22 10:49:39 +01:00
Sebastian Bøe
85c4f5dd55 kconfig: drivers: crypto: Remove EXPERIMENTAL
The crypto driver API is 6 years old, has 5 different implementations,
and is widely used.

Remove the EXPERIMENTAL marking from the API. Each implementation may
still choose to mark itself as EXPERIMENTAL.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2022-02-21 22:20:51 -05:00
Dawid Niedzwiecki
abb090094d i2c_emul: init i2c config
Initialize the i2c config of the emulator based on the clock_frequency
property.

The emulator can be used without calling the i2c_configure function, but
the i2c_get_config would return an error. With this change, it is
possible to get the config prior to the i2c_configure call.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2022-02-21 22:18:16 -05:00
Jay Vasanth
9f3d90e283 drivers: bbram: Add bbram driver for mec device
Add bbram driver for Microchip mec device

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-02-21 22:17:52 -05:00
Tim Lin
58d928932a ITE: drivers/i2c: disable pre-defined of hardware slave A
This register is a pre-define hardware slave A and can be accessed
through I2C0. It is not currently used, so it can be disabled to
avoid illegal access.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-02-21 22:16:37 -05:00
Gerard Marull-Paretas
d6c2c9eb9e drivers: memc: mcux_flexspi_hyperram: use DEVICE_DT_GET
The controller device can be obtained at compile time, so use
DEVICE_DT_GET.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
ca7f291dd4 drivers: lora: sx12xx: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
dc2c889948 drivers: lora: sx127x: use spi_dt_spec
Simplify driver implementation by using spi_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
4bcbbe571e drivers: lora: sx126x: use spi_dt_spec
Simplify driver implementation by using spi_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
a7ae33de7f drivers: led_strip: ws2812_gpio: drop redundant dev_cfg helper
Helpers like dev_cfg have been removed from all in-tree drivers, this
one was missed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
e2431fa25b drivers: led_strip: ws2812_gpio: use gpio_dt_spec
Simplify device driver implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
9395ee4a04 drivers: led: lp5562: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
97cd2a7321 drivers: led: lp503x: constify device config
Device configuration was not declared as const, fix this.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
e6830dac47 drivers: led: lp503x: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
a5b68f51ea drivers: led: lp3943: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
071b80290c drivers: kscan: ft5336: simplify device definition
Use the IF_ENABLED macro helper to conditionally initialize the int_gpio
field. This avoids duplication of initialization code.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
97eb6a3154 drivers: kscan: ft5336: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
f52b5adf81 drivers: kscan: ft5336: use gpio_dt_spec
Simplify implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
0ddb8b5d62 drivers: interrupt_controller: intc_ioapic: use DEVICE_DT_GET_OR_NULL
The device instance can be obtained at compile time. Here
DEVICE_DT_GET_OR_NULL is used as the following code seems to accept a
NULL condition, meaning instance is optional.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
b15fb9cb2f drivers: ieee802154: rf2xx: use gpio_dt_spec
Simplify the implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
ec63ea78cd drivers: ieee802154: mcr20a: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
4231c92cb8 drivers: ieee802154: mcr20a: use spi_dt_spec
Simplify driver implementation by using spi_dt_spec. Most internal
functions now take a device reference to simplify the operation, since
config did not exist before.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
5314690c3b drivers: ieee802154: mcr20a: define as DT device
The device already has a DT compatible (and uses DT properties).
Instantiate the device using the DT-based macros and remove hardcoded
name.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
adf8e4d723 drivers: ieee802154: dw1000: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
fe851d30de drivers: ieee802154: dw1000: use spi_dt_spec
Simplify driver implementation by using spi_dt_spec. Note that driver
has 2 SPI configurations, identical except the speed. For this reason,
the slow config is still kept in RAM and copied from the one obtained
via the SPI dt_spec macros. A better solution would be to have macros
that allow to override the SPI frequency, but this can be improved
later. Most internal helpers have been adjusted to accept a device
reference to make SPI (and future GPIO) transition easier.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
7c0d4f0382 drivers: i2c: slave: eeprom: use i2c_dt_spec
Simplify implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
be63d6addc drivers: i2c: gpio: use gpio_dt_spec
Simplify the implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
2c5de11a8b drivers: gpio: sx1509: use gpio_dt_spec
Simplify implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
e1992d5c54 drivers: gpio: sx1509: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
1d449c2924 drivers: gpio: pca95xx: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
80ee515c9c drivers: gpio: pca95xx: use gpio_dt_spec
Simplify implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
5af7fe66a4 drivers: flash: mcux_flexspi_nor: use DEVICE_DT_GET
Controller device can be obtained at compile time, so make
implementation more efficient thanks to that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
391112dab8 drivers: flash: mcux_flexspi_mx25um51345g: use DEVICE_DT_GET
Controller device can be obtained at compile time, so make
implementation more efficient thanks to that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
c70f296d63 drivers: flash: mcux_flexspi_hyperflash: use DEVICE_DT_GET
The controller device instance can be obtained at compile time using
DEVICE_DT_GET, so do that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
54177fd8ff drivers: ethernet: dsa_ksz8xxx: use DEVICE_DT_GET
Use DEVICE_DT_GET instead of device_get_binding, since the device
reference can be obtained at compile time.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
6c11b6c9bf drivers: ethernet: dsa_ksz8xxx: use gpio_dt_spec
The reset GPIO information can be obtained at compile time, so use
gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
cc3952e266 drivers: dma: iproc_pax: use DEVICE_DT_GET
The PCIe device can be obtained at compile time, so make code more
efficient thanks to that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
db00924764 drivers: display: ssd16xx: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec. To simplify
migration, all internal functions now take a device reference instead of
device data. As a result, the redundant config pointer in data has been
removed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
0fa2c45037 drivers: display: ls0xx: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec. As a result, the
driver data structure has become unused and so removed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
42bbb30ecf drivers: display: gd7965: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec. Note that as a
result, the driver data structure has become obsolete/unused and so has
been entirely removed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
069bf6be44 drivers: display: st7789v: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
065f8645fb drivers: display: st7789v: use spi_dt_spec
Simplify driver implementation by using spi_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
cd1fb2972e drivers: display: st7735r: use gpio_dt_spec
Simplify the driver implementation by using gpio_dt_spec. Note that most
internal functions have been changed to accept a device instance instead
of data/config references to make transition easier and to align with
most other drivers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
082f593966 drivers: dac: dacx3608: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
6067d16ce2 drivers: counter: maxim_ds3231: use gpio_dt_spec
Simplify implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
85d0ef6e55 drivers: counter: maxim_ds3231: use i2c_dt_spec
Simplify implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
aa431f636e drivers: nrf_clock_calibration: use DEVICE_DT_GET_OR_NULL
An optional reference to the temperature sensor can be obtained at
compile time, update implementation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
03ab730347 drivers: can: mcp2515: use gpio_dt_spec
Use struct gpio_dt_spec to simplify driver implementation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
b61df8281c drivers: bluetooth: hci: spi: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
cc85c6c518 drivers: bluetooth: hci: spi: use spi_dt_spec
Use spi_dt_spec to simplify driver implementation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
924a63a8e7 drivers: audio: tlv320dac310x: constify device config access
The device configuration field access was dropping const qualifier for
no reason, don't do that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
198afb71fa drivers: audio: tlv320dac310x: use i2c_dt_spec
Use struct i2c_dt_spec to simplify code. This change also allows to drop
device_get_binding usage.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
30acb4efdd drivers: audio: tlv320dac310x: use gpio_dt_spec
Use `struct gpio_dt_spec` and so remove usage of device_get_binding.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
9691d6110a drivers: audio: mpxxdtyy: drop device_get_binding
The bus device can be obtained at compile time, so use DEVICE_DT_GET
instead. Device configuration is now used to store the bus device
reference.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Sylvio Alves
bf08b5f0ed drivers: uart: esp32: fix driver initialization id number
The select uart instance used in uart driver initialization won't
work as expected because the index used was not correct. This
fixes the macro call to use proper index value.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-02-21 22:12:55 -05:00
Sylvio Alves
d29b98dbea drivers: gpio: esp32: check pin number range
As a complement of 7689abee34,
which fixed an issue where gpio number could errouneously be
set to a number greater than 32 in DTS, there is also another
situation where driver instance can be configured with a pin number
greater than 32.
This PR adds another check in GPIO driver to confirm
whether the PIN number is within valid bounds.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-02-21 22:12:55 -05:00
Andy Ross
066e4da281 drivers/xtensa_sys_timer: Change default timer ID
Use index zero, not one.  The Xtensa tools emit the timers in priority
order, and as mentioned in the kconfig warnings using high priority
timers doesn't work.  This also makes room for using software
interrupts that can preempt a timer interrupt for test purposes.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-02-21 22:10:03 -05:00
Aymeric Aillet
513389b659 drivers: adc: lmp90xxx: do not use generated macros
Do not used generated macro from devicetree subsys directly
in driver.
Remove definition of it's own "FOREACH_STATUS_OKAY".
Redefine "DT_DRV_COMPAT" for each supported compatible string.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-02-21 22:09:27 -05:00
Gerard Marull-Paretas
f8423a1b45 drivers: serial: xmc4xxx: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Dino Li
36164c29c1 espi: it8xxx2: enable configuration of Chromebook
This enables the below configuration so the AP and EC are able to
communicate over eSPI:

CONFIG_ESPI_PERIPHERAL_EC_HOST_CMD
CONFIG_ESPI_PERIPHERAL_ACPI_SHM_REGION
CONFIG_ESPI_PERIPHERAL_CUSTOM_OPCODE

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-02-21 22:01:48 -05:00
Ryan Erickson
a9804002e2 modem: hl7800: Use built in socket restore on boot
When sleep modes are used, configure sockets
to restore on boot. Letting the HL7800 manage
this means the driver does not have to do it.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-21 22:01:23 -05:00
Ryan Erickson
cdff607d74 modem: hl7800: Make sleep mode configurable
Allow application to choose between 3 different low power levels of modem.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-21 21:57:52 -05:00
Jun Lin
6faa8fcd8d driver: clock_control: npcx: power down some modules by default
This commit sets the power down bit of the module SDP, UART3, UART4,
and I3C by default. The module's driver should take the responsibility
to clear it to turn on the power. It helps reduce the power consumption
when an application doesn't use these modules.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-02-21 21:55:16 -05:00
Björn Stenberg
a59ce01118 drivers: eth: native_posix: Add support for setting ethernet MAC address
If CONFIG_ETH_NATIVE_POSIX_RANDOM_MAC=n and
CONFIG_ETH_NATIVE_POSIX_MAC_ADDR="", the MAC address can be set with a
net_mgmt call before the driver is initialized.

Signed-off-by: Björn Stenberg <bjorn@haxx.se>
2022-02-21 21:54:05 -05:00
Tim Lin
4381841bd8 ITE: drivers/adc: fix the sampling flow of ADC
The ADC sampling of it8xxx2 needs to read each channel in sequence,
so it needs to wait for an interrupt to read data in the loop
through k_sem_take().

In test_adc.c, k_timer_start() is used in the interval test, so we
need to use polling wait instead of k_sem_take() to wait, otherwise
it will cause kernel panic.

k_is_in_isr() can determine whether to use polling or k_sem_take()
at present.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-02-21 21:01:43 -05:00
Dino Li
abf6fdfed1 it8xxx2: changing PLL sequence is high priority
This makes the sequence completed before hardware devices
initialization.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-02-21 21:00:55 -05:00
Tom Burdick
e8389f2f53 dma: intel_adsp: Reduce irq setup code
Makes the IRQ_CONNECT macro statically declarable for Xtensa (nothing
prevented it except its structuring). Allows for IRQ_CONNECT usage
on a xtensa only platform to be declared statically avoiding the
fluff of setting up and enabling irqs for cavs gpdma.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-02-21 20:59:08 -05:00
Tom Burdick
1e9ada4eb9 dma: cavs: Add gpdma derivative of dw dma for cavs
Intel's adsp needs to set, at a minimum, a clocking bit before the driver
can initialize the designware dma controller. In many ways it is the
designware dmac IP but with additional registers and functionality added
on top of it. So the code structure here follows how the hardware
appears to be designed, layered on top of the designware driver.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-02-21 20:59:08 -05:00
Tom Burdick
f9acacfd11 dma: dw: Common dw dma driver functionality
Move most of the designware driver into a common compile unit with a
a header that exposes the common functionality.

This allows for derivative hardware, such as that in intel's adsp (cavs)
to use the common functionality while extending.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-02-21 20:59:08 -05:00
Jose Alberto Meza
f7b5d4b06a drivers: peci: xec: Handle corner case for PECI recovery
Handle case where PECI recovery occurs in ISR context.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-02-21 20:58:26 -05:00
Wouter Cappelle
e7d5b172d0 STM32L5: flash: enable support for DBANK == 0
STM32L5 has option to disable dual bank support.
When this is disabled, the flash page size is changed
from 2k pages to 4k pages. This PR adds support for this
diversity.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-02-21 20:56:58 -05:00
Wouter Cappelle
13faa9aa71 drivers: entropy: stm32: Add power management constraints
Add power management constraints to the entropy driver.
This prevents the hardware block to lose it's clock when
going into any stop mode of the cpu, which would cause the
clock error flag to be set while filling the pool.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-02-21 20:56:28 -05:00
Jose Alberto Meza
00304fbe2d drivers: espi: xec: support for eSPI slaves with long initializations
Add Kconfig switch to disable automatic eSPI slave boot
acknowledgement.
This allows to perform lenghty operations before continue any eSPI
handshake with eSPI master.

Required for eSPI SAF boot configuration.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-02-21 20:55:48 -05:00
Fabio Baltieri
61ef77a736 pwm: npcx: only reconfigure PWM if necessary
Currently pwm_npcx_pin_set() disables and reconfigures the PWM
controller every time its called, causing the PWM line to pulse even if
only the duty cycle is changed.

Modify the function so that controller is only disabled if any of the
configuration has to be changed, only set the new DCR otherwise.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-02-21 20:54:42 -05:00
Lukasz Maciejonczyk
57b55c382f drivers: ieee802154_nrf5: fix CSL for multicore devices
Due to serialization restrictions radio api calls cannot be nested, any
violation of this rule leads to a deadlock. This commit fixes the bug
by transferring the nested radio api call to ot_radio_workq.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-02-21 20:54:03 -05:00
Aymeric Aillet
17d5c4ca88 drivers: i2c: rcar: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.
Follows #41918.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-02-21 20:49:41 -05:00
Aymeric Aillet
e3621e6e00 drivers: serial: rcar: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.
Follows #41918.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-02-21 20:49:41 -05:00
Aymeric Aillet
bc789793be drivers: gpio: rcar: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.
Follows #41918.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-02-21 20:49:41 -05:00
Aymeric Aillet
69506e19e0 drivers: can: rcar: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.
Follows #41918.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-02-21 20:49:41 -05:00
Katsuhiro Suzuki
feaf0070fc boards: riscv: hifive_unleashed: add GPIO support
This patch adds GPIO and 96board LS (Low Speed)iexpansion  connector
support for SiFive HiFive Unleashed and also enables GPIO basic test.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2022-02-21 20:46:47 -05:00
Ruibin Chang
5f3bba54e8 ITE drivers/pwm: support tests/drivers/pwm/pwm_api
Add pwm-0 to support tests/drivers/pwm/pwm_api.

Solve tests code runtime error on it8xxx2_evb:
1.If the pwm channel target frequency is < 1, then we will
  return an error code.

2.If the target_freq is <= 324Hz, we will configure that this pwm
  channel need to output in EC power saving mode.
  In test_pwm_cycle() case, the period is 64000, then the
  target_freq is 8000000 / 64000 = 125Hz and <= 324Hz, so we will
  switch the prescaler clock source from 8MHz to 32.768kHz.
  Then the target_freq is 32768 / 64000 = 0.512Hz and < 1Hz,
  this will return an error code. In order to get the same
  target_freq, we always return PWM_FREQ in
  pwm_it8xxx2_get_cycles_per_sec().

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-02-21 20:44:41 -05:00
Jay Vasanth
f6394e0d54 Microchip: MEC172x: kscan driver
Update keyscan driver to support MEC172x device

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-02-21 20:44:17 -05:00
Jay Vasanth
4120a889a4 Microchip: MEC172x: watchdog driver
Update wdt driver to support MEC172x device

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-02-21 20:42:18 -05:00
Yong Cong Sin
e15f6f121f drivers: modem: gsm: add handler for +CME ERROR
The driver enabled extended error code (AT+CMEE=1) during
setup but is missing a handler for the +CME ERROR, fix that.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-21 20:40:22 -05:00
Sjors Hettinga
60beb291df drivers: gsm: Wait for NET_EVENT_IF_DOWN in in gsm_ppp_stop
Waits until the network interface goes down before switching the
GSM_MUX. It uses the NET_MGMT_EVENT to signal a semaphore to
contiue when closed. This allows for the LCP state machine to
properly terminate. When skipping this wait, the second time
connecting, the connection might fail.
Tested on a real modem.

Fixes GSM PPP behavior in combination with: #41802

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
2022-02-21 20:39:44 -05:00
Bartosz Bilas
db2b6de0b8 drivers: sensor: lis2dh: convert to spi_dt_spec
Convert lis2dh driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-02-21 19:43:55 -05:00
BJ Chen
59cd9fd551 ITE: drivers/peci: Add PECI driver module of ITE IT8xxx2
Added the PECI driver tested with the samples/drivers/peci.

Signed-off-by: BJ Chen <bj.chen@ite.com.tw>
2022-02-21 19:43:40 -05:00
Andrei-Edward Popa
6d5ec5a0d5 drivers: i2c: added slave support for DW
added slave mode support for I2C designware chip

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2022-02-21 19:42:07 -05:00
Andrei-Edward Popa
e1f91db622 drivers: i2c: i2c_dw: added pinctrl support
added pinctrl support for designware i2c driver

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2022-02-21 19:42:07 -05:00
Yuriy Vynnychek
a8619169c4 drivers: pinmux: remove Telink B91 driver
Removed Telink B91 driver since it is replaced by Pincrl.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Yuriy Vynnychek
f47d8568f2 drivers: spi: telink_b91: replace Pinmux by Pinctrl
Updated driver to use new Pinctrl driver.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Yuriy Vynnychek
b7f1b58810 drivers: serial: telink_b91: replace Pinmux by Pinctrl
Updated driver to use new Pinctrl driver.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Yuriy Vynnychek
4089ef71e5 drivers: pwm: telink_b91: replace Pinmux by Pinctrl
Updated driver to use new Pinctrl driver.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Yuriy Vynnychek
693833eb5e drivers: i2c: telink_b91: replace Pinmux by Pinctrl
Updated driver to use new Pinctrl driver.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Yuriy Vynnychek
b49dd6b1b4 drivers: pinctrl: introduce new Telink B91 Pinctrl driver
Pinctrl driver basic support for Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Dawid Niedzwiecki
42d1d9c17c eeprom/at2x: add config to disable handling WP
There is a part of the AT2X driver that handles controlling WP pin
connected to the EEPROM chips, but in some systems, the WP line can be
controlled by another component.

Check if any AT2X node defines wp-gpios, if not - do not compile the
code related to WP to save space.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2022-02-21 19:41:18 -05:00
Sylvio Alves
6ba6894580 drivers: wdt: esp32: code refactor to use hal calls
Update WDT driver to use hal calls, which
brings proper unification among socs.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-02-21 19:40:17 -05:00
Bartosz Bilas
46a1c2d16f drivers: sensor: ism330dhcx: convert to spi_dt_spec
Convert ism330dhcx driver to use spi_dt_spec helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-02-21 19:38:46 -05:00
Henrik Brix Andersen
7815de13c3 drivers: can: mcp2515: reduce the number of tx buffers to 1
Reduce the number of TX buffers in use on the MCP2515 from 3 to 1 in
order to avoid CAN frame priority inversion.

The MCP2515 is unable to do internal TX frame arbitration based on the
CAN-ID of the frame. Priority must be set per TX buffer and the priority
cannot be rewritten unless the frame transmission is aborted.

Fixes: #26541

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-21 19:37:35 -05:00
Henrik Brix Andersen
2bd18c6cfd drivers: can: mcan: switch from tx fifo to tx queue
Switch the Bosch M_CAN driver from TX FIFO mode to TX Queue mode in
order to avoid priority inversion of CAN frames.

Fixes: #26541

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-21 19:37:35 -05:00
Henrik Brix Andersen
64c7f75916 Revert "drivers: can: stm32: Change TX priority to chronological order"
This reverts commit 82a1661c99.

Fixes: #26541

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-21 19:37:35 -05:00
Henrik Brix Andersen
9c768d83bf Revert "drivers: can: mcux: Persuade the driver to send in chronological order"
This reverts commit ec0e199206.

Fixes: #26541

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-21 19:37:35 -05:00
Ryan Armstrong
c124f40f14 drivers: i2c: replace DEV_NAME macros
Similar to commit be32e33774, this
replaces the use of DEV_NAME macros with dev->name directly. This also
fixes #42996 for i2c_sam_twi.c in particular.

Signed-off-by: Ryan Armstrong <git@zerker.ca>
2022-02-21 19:35:55 -05:00
Andrzej Głąbek
e57d6368d0 drivers: i2c_nrfx_twim: Fix frequency configuration
Change the way this shim driver configures the I2C frequency, so that
it is possible to use also 1 MHz on nRF5340 (the nrfx driver performs
extra initialization steps for this frequency, hence it needs to be
reinitialized when the shim is reconfigured).
Correct the shim to handle selection of 1 MHz (or FAST_PLUS) bitrate
both through dts and I2C API.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-02-15 19:00:38 +01:00
Sylvio Alves
dce4f6a5f5 drivers: pinmux: esp32: check pullup/pulldown configuration
There are some pins that do not support internal pullup/pulldown.
This PR make sure to check that and return error if needed.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-02-15 12:58:37 -05:00
Sylvio Alves
7689abee34 drivers: gpio: esp32: fix pin number value
ESP32 has 2 GPIOs: gpio0 and gpio1.
Zephyr DTS model requires pin definition in dts file
from 0 to 31, meaning that when some pin within gpio1 range
is required, gpio driver needs to increament this value
by 32, required by LL API.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-02-15 12:58:37 -05:00
Hake Huang
d517947de4 driver: eth_mcux: fixing build error on rt11xx
in rt11xx series the ringbuffer is > 1

fixing: #42793

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-02-14 10:16:01 -06:00
Xabier Marquiegui
52be66919e net: gptp: convert clock sync ratio from float to double
Using clock sync ratio as double instead of float improves
synchronization smoothness

Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2022-02-11 10:03:05 -06:00
Xabier Marquiegui
62db8ca0e6 driver: eth_mcux: gptp: limit rate_adjust range
Limit gptp range_adjust range for improved performance.

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2022-02-11 10:03:05 -06:00
Xabier Marquiegui
d4c4a14737 driver: eth_mcux: gptp: enable pps output
Enable pps output for gptp accuracy measurements.

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2022-02-11 10:03:05 -06:00
Xabier Marquiegui
7454a92754 driver: eth_mcux: realtime optimizations
mcux enet driver updates:
a) add mutex to access the ptp timer variables
b) use thread for rx(cooperative) andfor tx cleanup(cooperative)
c) use a thread for ptp inner clock updater(pre-empty)

This patch fixes the following issue:

```
ENET_SendFrame error: 4004
```

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Co-authored-by: Seb Laveze <sebastien.laveze@nxp.com>
Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2022-02-11 10:03:05 -06:00
Daniel DeGrasse
0694e47f97 drivers: mcux_gpt_timer: Fix rounding error on tick boundary
GPT timer driver was announcing progress to the kernel too soon when an
announcement was requested via sys_clock_set_timeout() on a tick
boundary. Fix rounding to add a tick worth of cycles.

Fixes #42665

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-02-11 09:07:40 -06:00
Daniel DeGrasse
41a63f48fd samples: task_wdt: Increase min watchdog timeout
MCUX watchdog timer supports min window of 500ms. Increase maximum task
watchdog timeout window to 500ms by default, so that this sample can run
on iMX RT SOCs. Also update iMX RT watchdog driver to reject timeout
maximums under 500ms with a useful error message

Fixes #40153

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-02-09 14:07:26 -06:00
Gerard Marull-Paretas
83cccdf757 drivers: display: st7789v: fix function argument
The st7789v_transmit function accepts a device, not device data. As a
result, driver could not be compiled when reset GPIOs were not defined
in Devicetree.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-08 07:31:07 -05:00
Gerard Marull-Paretas
0cb5e2155e drivers: display: gd7965: fix syntax error
The configuration initializer had a syntax error (missing =). The driver
could not be compiled as a result.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-08 07:31:07 -05:00
Andrzej Głąbek
9b9de62046 drivers: spi_nrfx_spi: Fix compilation error
Fix a copy/paste mistake introduced by commit
fdc25cd44c.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-02-08 07:29:33 -05:00
Francois Ramu
2b8df6b160 tests: drivers: flash running on disco stm32 board with qspi
Restore the testcase to run on the qspi nor-flash controller
of the disco_l475_iot1 board
of the disco stm32f746 board

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-02-08 07:03:12 -05:00
Francois Ramu
2f4cfca6fd drivers: flash: stm32 qspi flash driver valid read or write operations
Like the stm32 flash driver, in case of QSPI nor flash controller
the read or write or erase returns '0' if data is of null size.
This avoids useless QPSI low level access to the controller.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-02-08 07:03:12 -05:00
Carlo Caione
9397dafa95 syscon: Compile the generic driver only when selected
Currently the generic driver is always unconditionally compiled. Fix
this by compiling it only when needed.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-02-07 09:27:41 -05:00
Andrzej Głąbek
c80589af56 drivers: uart_nrfx_uarte: Fix RX auto disabling routine
This is a follow-up to commit 11bbdb030d.

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

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

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

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

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2022-02-05 06:18:44 -05:00
Guillaume Lager
4d777b43fd drivers: modem: Fix loop variables type
int was used regardless of the type used in the
end-loop condition

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2022-02-04 11:19:28 +01:00
Wouter Cappelle
c9c32b2391 driver: entropy: stm32: Fix health dts properties
The properties from dts to driver were not translated
correctly from - to _. This PR fixes this

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-02-04 11:14:44 +01:00
Ryan Erickson
a9eead1824 modem: hl7800: only send null packet for TCP
Only TCP sockets should send a NULL packet
if the server closes the connection or there
is a socket error.
UDP sockets do not need to do this because
they are connectionless.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-04 10:57:15 +01:00
Attie Grande
24478c8a4d drivers: adc: adc_sam0: Change local variables to lower case
Local variables should not be in capitals.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-02-04 10:49:09 +01:00
Attie Grande
e4d4eaca03 soc: atmel_sam0: Implement fixup.h for ADC driver
The ADC driver now supports three different implementations. To maintain
readability, this patch implements an adc_fixup.h that permits more
generic access to relevant registers.

This patch also introduces support for a new third shape ADC - as found
in the SAML21 for example.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-02-04 10:49:09 +01:00
Attie Grande
d45a9a11b7 drivers: adc: adc_sam0: Fix interpretation of channels
Previously this was expected to be equal to 1 at all times. This doesn't
play well with the sample or other users (e.g: adc_shell). Instead, we
should count the number of active channels in the bitfield, and ensure
that only one is identified.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-02-04 10:49:09 +01:00
Yong Cong Sin
731241f8d0 kernel: workq: Fix type errors in delayable work handlers
A common pattern here was to take the work item as the subfield of a
containing object. But the contained field is not a k_work, it's a
k_work_delayable.

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

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-02 18:43:12 -05:00
Daniel DeGrasse
419dc385f2 drivers: usdhc: Add log for DAT3 detection
Add log to tell user when DAT3 detection method is in use

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-02-02 16:59:30 +01:00
Yonatan Schachter
a2aa02dbc8 drivers: gpio: Added support for raspberry pi
Added GPIO support for the RP2040 SoC. Only one
core is supported.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-02-02 16:23:35 +01:00
Yonatan Schachter
cd7bd5f450 drivers: serial: Added support for raspberry pi
Added a serial driver for the RP2040. Only polling
API is supported.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-02-02 16:23:35 +01:00
Yonatan Schachter
fd59038312 drivers: pinctrl: Added pinctrl driver for RPi Pico
Added a pinctrl driver for the Raspberry Pi Pico series

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

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

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

Signed-off-by: Marius Scholtz <mariuss@ricelectronics.com>
2022-02-01 16:19:24 -05:00
Marcin Niestroj
becc1efe51 drivers: lora: shell: fix 'long' specifier in shell_error()
Replace '%s' with '%ld', so that 'long' value is properly printed with
shell_error(). This suppresses following warning:

  zephyr/drivers/lora/shell.c:181:23: warning: format '%s' expects \
      argument of type 'char *', but argument 4 has type 'long int' \
      [-Wformat=]
    181 |    shell_error(shell, "Invalid bandwidth: %s", lval);
        |                       ^~~~~~~~~~~~~~~~~~~~~~~  ~~~~
        |                                                |
        |                                                long int

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2022-02-01 14:25:38 -06:00
Jani Hirsimäki
89978203f6 drivers: net: ppp: asynch api: use microseconds
Updated uart_rx_enable() and uart_tx() to use timeout given
in microseconds. Previously argument was given in milliseconds.
API change was done in:
https://github.com/zephyrproject-rtos/zephyr/pull/39041

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2022-02-01 13:31:20 +01:00
Joakim Andersson
d8dd0ed912 drivers: clock_control: Remove unused header file
Remove unused header file nrf_gpio.h which is not used by the
clock control driver.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-02-01 11:31:36 +01:00
Andrzej Puzdrowski
23b6e51e73 drivers/flash: remove flash_write_protection API
This API was designed to be removed in Zephyr 2.8

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-02-01 10:46:28 +01:00
Andrzej Puzdrowski
bbe4f87d09 drivers/flash/flash_ite_i8xxx2: remove write_protection handler
The handler was reworked to internal function and it
is called from the erase and the write
procedures automatically now.

This change was made due to deprecation of the flash write-protection
API.

Explanation for so late removal:
Reworked callback was introduced despite that the API had been
already deprecated at the addition time.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-02-01 10:46:28 +01:00
Andrzej Głąbek
aa3b86600d drivers: flash: nrf_qspi_nor: Fix setting of the base clock divider
On nRF53 Series SoCs, the highest SCK frequencies can only be achieved
when the HFCLK192M clock divider is changed from the default /4 setting.
Such change results in increased power consumption, so the divider needs
to be changed only for periods when it is actually necessary.
This commit modifies the driver behavior so that it changes the divider
only when a QSPI bus operation is performed.
However, when XIP accesses to the flash chip are also used, it may be
needed to keep the divider changed even when the driver is idle so that
the XIP access speed is not reduced, hence a custom API function that
allows forcing this is introduced for the driver.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-02-01 10:31:50 +01:00
Jordan Yates
fdc25cd44c spi: nrfx_spi*: only run uninit if configured
Only run the `uninit` function if the SPI instance has previously been
configured. This stops an assertion in the HAL drivers from triggering
due to running `uninit` without a previous `init`.

Fixes #42299.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-31 12:14:05 +01:00
Sylvio Alves
ef3ecbe596 uart: esp32: fix baudrate return value
HAL call function used to retrieve the configured baudrate
returns the real calculated value, which might not be exactly as
the configured. For baudrate of 115200, HAL api
returns 115201, which then causes uart_basic_api test
to fail. Instead of returning the calculated baudrate value,
returns the configured one.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-28 19:13:20 -05:00
Jeremy Wood
833d6c2315 drivers: can: m_can: fix reconfiguring bitrate
Set enable configuration change bit in can_mcan_set_timing() because
the NBTP register can only be changed if we're in init mode AND
configuration change bit is set, per MCU docs.

Signed-off-by: Jeremy Wood <jeremy@bcdevices.com>
2022-01-28 15:46:17 +01:00
Piotr Mienkowski
1ed5ba7720 drivers: i2s_sam_ssc: fix cache coherency in dma_rx_callback
Invalidate the cache before the RX data block is passed to the DMA
engine and not after it is received. If the RX data block contains
dirty cache lines they can be flushed anytime, overwriting legitimate
data that have been prefilled by the DMA module.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2022-01-28 10:07:25 +01:00
Piotr Mienkowski
a922fd1b2f drivers: qdec_sam: disable index signal
`qdec_sam` driver supports currently only position measurement and does
not support reading of the index signal. Unfortunately, the index
signal was internally enabled in the driver. If the pin to which the
index signal was connected was used by another driver it could lead to
a false detection of the signal change. Detection of the index signal
change resets the position measurement.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2022-01-28 10:07:06 +01:00
Hake Huang
b9dfe371f5 driver: i2s: fix i2s_mcux_sai build warning
remove unused args

fixing: #42179

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-01-28 10:06:53 +01:00
Hake Huang
086f6ea77a driver: clock: fix freq get error for clock audio
using the clock root api to get rate

fixing: #42179

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-01-28 10:06:53 +01:00
Piotr Mienkowski
072275217b drivers: eth_sam_gmac: fix eth_sam_gmac_set_config()
Fix handling of the return value by `eth_sam_gmac_set_config` function.
The function is used as a backend by
`net_mgmt(NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, ...)` to change the
interface MAC address at run time.

Tested on sam_e70_xplained board.

Fixes #42151

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2022-01-28 10:06:41 +01:00
Daniel DeGrasse
17979bdfb7 drivers: regulator: pmic: remove unneeded NULL check
Remove unneeded NULL check in pmic init function. Not required as
device_is_ready() will handle NULL device structs.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-28 10:06:21 +01:00
Daniel DeGrasse
3a4594e444 drivers: regulator: Remove non-const usage of config struct
Config struct in pmic regulator driver was being used as a non-constant
value when an array defined at compile time was cast to a struct used at
runtime. Move this pointer to the data struct in pmic driver.

Fixes #41951

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-28 10:06:21 +01:00
Wealian Liao
7dc9143227 drivers: nct38xx: Drop DRV_CONFIG/DRV_DATA usage
Stop using DRV_CONFIG/DRV_DATA macros and use dev->data and dev->config
instead.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-28 10:06:05 +01:00
Wealian Liao
6d6c5e1155 drivers: npcx: Drop DRV_CONFIG/DRV_DATA usage
Stop using DRV_CONFIG/DRV_DATA macros and use dev->data and dev->config
instead.

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

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-28 10:06:05 +01:00
Daniel DeGrasse
2ac1b42952 drivers: usb_dc_mcux: Move mcux callback handler out of ISR context
MCUX usb ISR was making usb callbacks directly, which caused assertion
failures when a callback attempted to lock a mutex. Move USB callback
handler to separate thread, and make ISR notify thread via message
queue.

Fixes #40638

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-28 10:05:47 +01:00
Henrik Brix Andersen
2aed5a1237 drivers: can: remove CAN_BUS_UNKNOWN CAN controller state
The CAN_BUS_UNKNOWN CAN controller state is only used to indicate that
the current CAN controller state could not be read.

Remove it and change the signature of the can_get_state() API function
to return an integer indicating success or failure.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-28 10:05:29 +01:00
Andrea Campanella
b2190fd703 drivers: serial: stm32: Add Line Break Detection
The current driver doesn't handle the LBD flag, this leads
uart_stm32_err_check to return always true if a Line Break
is detected.

This PR adds Line Break Detection and the related flag clearing,
F0 series it's excluded from the changes.

Fixes zephyrproject-rtos#41339

Signed-off-by: Andrea Campanella <andrea.campanella@helvar.com>
2022-01-28 10:05:18 +01:00
Christian Taedcke
3b271006cb drivers: spi_gecko: fix duplicated variable declaration
The commit 44679c7bd8 introduced this
duplicated declaration of the local variable data.

This commit fixes this issue.

Fixes #42117

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2022-01-27 05:23:18 -05:00
David Leach
8ab9ac2668 drivers: counter: mcux_ctimer: fix config used as non-const
The initialization code was updating the freq field in the const
declared config block at runtime because the frequency is not
known at compile time. Add a get_freq() api call to handle any
runtime requests for frequency.

fixes #41953

Signed-off-by: David Leach <david.leach@nxp.com>
2022-01-25 18:16:42 -06:00
Daniel DeGrasse
3603b6d501 drivers: dma: mcux_lpc_dma: Fix data variable name
Device 'data' variable name was incorrect due to recent treewide naming
cleanups. Fix variable name to fix build error.

Fixes #42118

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-25 14:09:30 -06:00
Tomasz Bursztyka
7bbf818cc5 drivers/dma: Fix conficting types for a variable name
Let's have dev_data for dev->data so it will not conflict with struct
call_back data variable.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-24 10:23:05 -05:00
David Leach
eb9a97299d driver: edma: Fix MCUX NULL parameter check before dereference
Coverity identified valid error where the routine does a NULL
check for two different pointers after they have been dereferenced.

fixes #39868
fixes #39874

Signed-off-by: David Leach <david.leach@nxp.com>
2022-01-22 16:56:21 -05:00
Alex Sergeev
205b7f24fd drivers: ethernet: stm32: Bugfix PTP clock read on second boundary
Current version of STM32 PTP clock reads current PTP time by querying
second and nanosecond registers sequentially. It is possible for second
to roll over between reading second and nanosecond registers, causing
returned time to be off by a second. This bugfix resolves that issue.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2022-01-21 15:27:21 -05:00
Yong Cong Sin
41bff12625 drivers: modem: gsm: Use K_KERNEL_* macros
GSM workq is a system only thread, use K_KERNEL_* macros
instead of K_THREAD_*

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-21 14:39:30 -05:00
Marius Scholtz
38d684f8f1 drivers: counter: sam: expose RC reg to DT
Exposes the RC register so that the initial value can be set in
the device tree. This is useful in the case where the timer
generates an event but an interrupt is not required.
e.g generate event to sample adc on RC register match.

Tested on Atmel SMART SAM E70 Xplained Ultra board

Signed-off-by: Marius Scholtz <mariuss@ricelectronics.com>
2022-01-21 14:25:49 -05:00
Julien Massot
71fcd696e0 drivers: gpio: rcar: set default according to dt enabled
Set GPIO_RCAR to true if renesas,rcar-gpio status is okay.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-21 14:25:25 -05:00
Julien Massot
a2fb8918ba drivers: gpio: rcar: depends on R-Car soc family
Make it consistent with other drivers, prepare for
future Gen4 introduction.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-21 14:25:25 -05:00
Julien Massot
b2811153c9 drivers: i2c: rcar: set default according to dt enabled
Set I2C_RCAR to true if renesas,rcar-i2c status is okay.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-21 14:25:25 -05:00
Julien Massot
86a2f81c14 drivers: can: rcar: set default according to dt enabled
Set CAN_RCAR to true if renesas,rcar-can status is okay.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-21 14:25:25 -05:00
Julien Massot
2d6ed8c083 drivers: serial: rcar: set default according to dt enabled
Set UART_RCAR to true if renesas,rcar-scif status is okay.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-21 14:25:25 -05:00
Sylvio Alves
aea53f41c1 esp32: fix uart and gpio driver priority to enable console
Current gpio and uart initialization level is set to
PRE_KERNEL_2, which won't let uart_console subsystem
to init its hook properly as it has same level.
Prioritize uart and gpio so that the console hooks
are properly initialized.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-21 13:16:55 -05:00
Sylvio Alves
c409a4656f drivers: uart: esp32: use DEVICE_DT_INST_DEFINE()
Current uart driver implementation is incompleted regarding the
usage of DT_INST_FOREACH_STATUS_OKAY. If uart0 and uart2 are selected,
build breaks due to peripheral number ordering, which would be
0 and 1 in this case. This fix PR fix this by re-working the macros
and setting proper uart peripheral instances in DTSI, required for signal
routing configuration.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-21 13:16:55 -05:00
Hake Huang
ef0b87c4de driver: sai: add RT11XX support
RT11xx series use CCMV2 need special processing

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-01-21 11:26:45 -06:00
Hake Huang
0525ad3d46 clock: ccmv2: add SAI CCM clocks for RT11xx
add SAI CCMV2 clocks for RT11xx series

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-01-21 11:26:45 -06:00
Immo Birnbaum
1b088adbdf drivers: serial: xlnx_ps: update referenced SoC configuration items
Update the Kconfig configuration items used to determine if the current
target is based on the Zynq-7000 SoC family as part of the re-organi-
zation of the Zynq-7000 SoC configuration data.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@Weidmueller.com>
2022-01-21 11:34:09 -05:00
Immo Birnbaum
99a6598b98 drivers: ethernet: xlnx_gem: update referenced SoC configuration items
Update the Kconfig configuration items used to determine if the current
target is based on the Zynq-7000 SoC family as part of the re-organi-
zation of the Zynq-7000 SoC configuration data.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@Weidmueller.com>
2022-01-21 11:34:09 -05:00
Sylvio Alves
b777b1dd6f counter: esp32: fix build failure and warnings
PR #41918 introduced a few warnings and build failure due to
missing data cofniguration and DEV_CFG() removal.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-21 11:27:48 -05:00
Sylvio Alves
224ec1e835 uart: esp32: move hal instance to data level
After #41918, DEV_CFG removal triggered discard qualifer warning
during build. As uart_hal functions don't required const qualifier
and uart_context_hal_t has modified data, this PR moves hal instace
to data struct instead of config struct.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-21 11:27:48 -05:00
Sylvio Alves
64755b6453 gpio: esp32: remove discard qualifier warning
After #41918, build started to warn discard qualifer
in config struct. This adds const into those structs.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-21 11:27:48 -05:00
Nazar Palamar
29eec8b3f7 Bluetooth: H4: added support for HCI vendor-specific Setup feature.
Updated H4 driver to initialize setup function. Finally bt_h4_vnd_setup
function must be implemented in vendor-specific HCI extension module if
CONFIG_BT_HCI_SETUP is enabled.

BT_HCI_SETUP feature is useful when the BT Controller requires execution
of the vendor-specific commands sequence to initialize the BT Controller
before the BT Host executes a Reset sequence.
To enable this feature the CONFIG_BT_HCI_SETUP should be enable.

Fixes #41140

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2022-01-21 15:04:15 +02:00
Nazar Palamar
c77a546f14 Bluetooth: hci: added HCI vendor-specific Setup function feature
- Added config BT_HCI_SETUP to enable HCI vendor-specific Setup feature,
- Added pointer to 'setup' function in bt_hci_driver structure.

BT_HCI_SETUP feature is useful when the BT Controller requires execution
of the vendor-specific commands sequence to initialize the BT Controller
before the BT Host executes a Reset sequence. To enable this feature the
CONFIG_BT_HCI_SETUP should be enable.

Fixes #41140

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2022-01-21 15:04:15 +02:00
Milind Paranjpe
25e6803705 drivers: flash: Eliminate warning when compiling with GCC
Address the issue mentioned in zephyrproject-rtos#7412

Using printf() with "%x" to print an off_t value produces the
following warning:

format '%x' expects 'unsigned int', argument has type 'long int'
  228 |  LOG_DBG("Erasing sector at 0x%08x", offset);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~
      |                                      |
      |                                      off_t {aka long int}

In newlib off_t is long. Even though both int and long are 4 bytes wide
in the architecture in use, GCC wants to see "%lx" to printf() a long.
Using "%"PRIx32 still produces the same warning because PRIx32
(from inttypes.h) still expands to simply an "x" and not "lx".

PR zephyrproject-rtos#40004 has solved this by casting offset to
ssize_t. The same solution is emulated here.

Signed-off-by: Milind Paranjpe <milind@whisper.ai>
2022-01-20 13:42:35 -06:00
Martin Koehler
d176158273 drivers: gpio: Fix NO_PINT_INT
Fixed #41945
NO_PINT_INT can have the same value as a specific pin.
E.G. For 1 byte pint_pin_int_t it equaled interrupt1.
Now is instead always 1 higher than the highest pin.
Expects fsl to keep setting values from 0 to
(number of connected outputs - 1)

Signed-off-by: Martin Koehler <koehler@metratec.com>
2022-01-20 13:40:18 -06:00
Sylvio Alves
eec068b8a5 soc: esp32c3: fix cpu vendor name
Build shows warning due to incompatible
CPU vendor name. This fixes it and applies
necessary changes in files.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-20 13:33:29 -05:00
Gerard Marull-Paretas
20d0260753 drivers: dma: mcux_lpc: fix variable name clash
data was already used by the struct call_back, rename device data to
`dev_data`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-20 07:41:26 -06:00
Jeremy Wood
1caa7f6cb9 drivers: can: m_can variant for STM32H7
* New m_can driver variant for STM32H7, as it uses the complete m_can
register set.
* Fix definitions for CAN_MCAN_RXF0S_F0FL, CAN_MCAN_TXEFC_EFSA_POS.

Signed-off-by: Jeremy Wood <jeremy@bcdevices.com>
2022-01-19 16:07:54 -05:00
Julien Massot
03135f4604 drivers: pinctrl: pfc_rcar: fix bank and bit parsing
Bank and Bit has been inverted at some point.
Fix that !

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-19 16:06:46 -05:00
Mahesh Mahadevan
aeabe6c70c driver: clock: Update MCUX Syscon clock control driver
1. Update to add support for Flexcomm8-13.
2. Fix the clock control driver, the enclosing #define
   was incorrect.
3. Identify HS_SPI port using the appropriate Register
   define

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-01-19 13:35:09 -06:00
Lukasz Maciejonczyk
253c59c0e5 drivers: ieee802154_nrf5: fix condition for mac keys and frame counter
For multicore devices like nRF53, shim layer part of setting mac keys
and frame counters is called on application core where
CONFIG_NRF_802154_ENCRYPTION is disabled (the define concerns radio
driver for net core). This commit replaces
CONFIG_NRF_802154_ENCRYPTION with CONFIG_IEEE802154_2015.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-01-19 14:16:23 -05:00
Henrik Brix Andersen
778e0ebd92 drivers: can: stm32fd: mark internal functions as static
Mark the internal STM32FD CAN driver functions as static.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-19 14:14:57 -05:00
Remy Luisant
6a12fb20ab timer: Add tickless support for the MIPS CP0 timer
This commit adds support for tickless operation on the MIPS CP0 timer.
The code closely follows the Xtensa and RISCV timer drivers.

All tests pass.

Signed-off-by: Remy Luisant <remy@luisant.ca>
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
2022-01-19 13:48:21 -05:00
Antony Pavlov
9175ed8244 timer: add support for MIPS CP0 timer
This commit adds a kernel device driver for the MIPS CP0 timer.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
2022-01-19 13:48:21 -05:00
Neil Armstrong
8e0f3d1e5d pcie: controller: add non-recursive pcie busses enumeration
In order to preserve stack, this replaces the single-bus enumeration
loop by a stack based non-recursive pcie hierarchy iteration.

Each stack entry contains a bridge bus enumeration state.

When a bridge endpoint is detected on the current bus, it is
configured and this new bus is pushed on top of the stack in
order to be enumerated at next loop.

When enumeration ends on the bus, the current bus state is
removed from the stack to continue enumeration on the previous
bus.

This enumeration affects a sequential bus number to each new
bus detected in the same order as Linux & U-Boot does.

In this hierarchy:
       [0         1          2   ...   31]
        |         |          |
        EP        |          |
                  |          |
        [0   1  ... 31]   [0  ... 31]
         |   |             |
         |  EP             |
         |              [0 ... 31]
     [0 ... 31]          |
      |                 EP
     EP

We will get the following BDFs enumeration order:
 00:00.0	Endpoint
 00:01.0	Bridge => Bus primary 0 secondary 1
 01:00.0	Bridge => Bus primary 1 secondary 2
 02:00.0	Endpoint
 ... Bus secondary 2 => subordinate 2
 01:01.0	Endpoint
 ... Bus secondary 1 => subordinate 2
 00:02.0	Bridge => Bus primary 0 secondary 3
 03:00.0	Bridge => Bus primary 3 secondary 4
 04:00.0	Endpoint
 ... Bus secondary 4 => subordinate 4
 ... Bus secondary 3 => subordinate 4

The gives the following primary/secondary/subordinate map:
 Bus 0 [0         1              2   ...   31]
        |         |              |
        |      [0:1->2]      [0:3->4]
   EP 00:00.0     |              |
                  |              |
  Bus 1 [0   1  ... 31]  Bus 3 [0  ... 31]
         |   |                  |
         |  EP 01:01.0          |
     [1:2->2]                [3:4->4]
         |                      |
         |            Bus 4  [0 ... 31]
Bus 2 [0 ... 31]              |
       |                     EP 04:00.0
      EP 02:00.0

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Neil Armstrong
e937eb97c4 pcie: controller: add Type 1 bridge configuration
This adds setup of Type 1 bridge endpoints in two steps, first when
endpoint is detected and secondly when enumerating the next endpoint.

First, the code configures the bus primary & secondary number and 0xff
as subordinate to redirect all PCIe messages to this bus.

Then memory & I/O base are programmed by getting the current allocation
bases.

Finally, now right away, we program the subordinate to the max bus
number under the bridge, here the same, and the memory & I/O limit,
here lower than the base.

This doesn't make the bridge totally usable, enumeration would work
bus not for nested bridges and BARs wouldn't be accessible.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Neil Armstrong
b79d66a712 pcie: controller: split out endpoint enumeration code
In order to prepare support for bridges enumeration, split out the
actual endpoint enumeration code out of the enumeration loop.

Pass a skip_next_func boolean to indicate if the current endpoint
is multifunction of not, to continue to next dev or next function.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Neil Armstrong
a1b20d3dd9 pcie: controller: prepare to enumerate bars for Type 1 endpoints
The Type 1 endpoints has 2 BARs are the same position as the Type 0
BARS 0 & 1, so reuse the generic_pcie_ctrl_type0_enumerate_bars()
for both types by passing the number of possible BARs on the endpoint.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Neil Armstrong
b2d6096eb5 pcie: ecam: implement callback to get allocation base
Implement callback to get allocation base similar to the
pcie_ecam_region_allocate callback.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Jordan Yates
ccdc009077 drivers: power_domain: gpio controlled domain
Initial implementation of a simple GPIO controlled power domain.
It exposes no API of its own, all functionality is contained inside
the runtime power management callbacks.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-19 13:35:32 -05:00
Julien Massot
a6d7adf990 drivers: can: rcar: add support for CAN_ERROR_WARNING
Add support for CAN_ERROR_WARNING CAN controller state.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-19 18:34:26 +01:00
Henrik Brix Andersen
7c41d34339 drivers: can: mcp2515: add support for CAN_ERROR_WARNING
Add support for CAN_ERROR_WARNING CAN controller state.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-19 18:34:26 +01:00
Henrik Brix Andersen
7b9996c130 drivers: can: mcan: add support for CAN_ERROR_WARNING
Add support for CAN_ERROR_WARNING CAN controller state.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-19 18:34:26 +01:00
Henrik Brix Andersen
616c03aa20 drivers: can: stm32: add support for CAN_ERROR_WARNING
Add support for CAN_ERROR_WARNING CAN controller state.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-19 18:34:26 +01:00
Henrik Brix Andersen
d66bfd7f77 drivers: can: mcux: flexcan: add support for CAN_ERROR_WARNING
Add support for CAN_ERROR_WARNING CAN controller state.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-19 18:34:26 +01:00
Gerard Marull-Paretas
435213a753 drivers: remove redundant data/config casts
Some drivers explicitely casted data/config from void * to the
corresponding type. However, this is unnecessary and, in many drivers it
has been misused to drop const qualifier (refer to previous commits).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
30971b51ba drivers: sensor: sbs_gauge: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
5efb4610cf drivers: clock_control: esp32: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
51e552a9a3 drivers: display: st7735r: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
b9319e57cb drivers: sensor: lm75: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
1aeec129fc drivers: regulator: pmic: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
50720eb0cb drivers: misc: ft8xx: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
93b3cba2f1 drivers: adc: ite_it8xxx2: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
93d48baa16 drivers: i2s: litex: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
63d696e3b8 drivers: dma: iprox_pax_v1/2: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
8398105d82 drivers: fix style issues
Fix issues reported by checkpatch.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
ee434ebdee drivers: watchdog: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
468de7eb29 drivers: spi: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
a6614968a8 drivers: serial: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
2c103a25cc drivers: sensor: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
9b92dfeca8 drivers: ieee802154: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
c5b596a0bf drivers: i2c: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
33a3be6818 drivers: flash: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
3dc5c01aee drivers: entropy: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
fb3a313f82 drivers: counter: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
ba8f7a2dd8 drivers: wifi: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data
and dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
b00150339a drivers: watchdog: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
44679c7bd8 drivers: spi: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data
and dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
1674fec5b6 drivers: serial: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
e8c15f68b2 drivers: sensor: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
1de05e6095 drivers: pwm: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
ccdaf45ba5 drivers: pinmux: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
f215b3a2f3 drivers: neural_net: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
253ab20508 drivers: mdio: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
d231c11ec8 drivers: led: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
150d4b73bb drivers: ipm: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
c2078bd3d0 drivers: interrupt_controller: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
72a0d68284 drivers: i2s: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
be32e33774 drivers: i2c: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
ae5ebe8e51 drivers: gpio: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
fb23084be1 drivers: flash: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
6f6a178390 drivers: ethernet: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
d3443cc8c1 drivers: espi: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
250fd0e23b drivers: entropy: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
f5effdde6c drivers: eeprom: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
d2118eb1bc drivers: dma: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
3b6201e23a drivers: dac: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
c4550bc931 drivers: counter: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
03cc904d60 drivers: console: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
ddf9fc4f9f drivers: clock_control: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
6378fcd0be drivers: can: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
224958c537 drivers: audio: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
6745333511 drivers: adc: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data
and dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Krzysztof Chruscinski
ec9a32481b drivers: timer: nrf_rtc_timer: Add z_nrf_rtc_timer_capture_task_address_get
Add function for getting address of RTC capture task.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-19 17:46:28 +01:00
Neil Armstrong
9463525347 pcie: controller: rename generic_pcie_ to pcie_generic_
As suggested by Tomasz Bursztyka, it's clearer to move generic after the
domain prefix, here pcie.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 09:47:59 -05:00
Neil Armstrong
6595ca1a35 pcie: controller: rename xlate to translate
As suggested by Tomasz Bursztyka, translate is clearer than xlate in
the PCIe controller functions and callbacks names.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 09:47:22 -05:00
Lukasz Maciejonczyk
7bdb1c2a82 drivers: ieee802154_nrf5: fix sleep call for csl
When the csl is active the nrf_802154_sleep() is called unnecessary.
This commit fixes it.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-01-19 09:32:02 -05:00
Daniel Leung
9e688e3956 drivers: mm: add driver for Intel Audio DSP
This adds the driver for the memory mapping hardware
on Intel Audio DSP.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-18 19:18:30 -05:00
Daniel Leung
11c3b1d379 drivers: mm: add skeleton build files and common funcs
This adds skeleton Kconfig/CMakeLists.txt and common implementation
of some sys_mm_drv_*() functions.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-18 19:18:30 -05:00
Anas Nashif
01b7800bc8 include: remove deprecated headers
Remove all deprecated headers which were moved to a different location.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-01-18 19:17:50 -05:00
Daniel DeGrasse
59f9dfae58 drivers: timer: mcux_gpt: Enable GPT timer to run in doze mode
GPT timer must continue running in low power modes, as it is the system
wakeup source. Set configuration to ensure peripheral will not stop
running in low power modes.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-18 14:09:45 -05:00
Bartosz Bilas
ca96286c22 drivers: ethernet: dsa_ksz8xxx: remove duplicated headers
drivers/spi.h header is included when CONFIG_DSA_SPI
is enabled so there is no necessity to do that once again.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-01-18 13:23:16 -05:00
Bartosz Bilas
8779972955 drivers: ethernet: dsa_ksz8xxx: convert to spi_dt_spec
Convert dsa_ksz8xxx driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-01-18 13:23:16 -05:00
Andrei Emeltchenko
c493825ac1 edac: ibecc: Add LOG_INF for indication initialization
Add LOG_INF() to indicate that IBECC driver is initialized.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-01-18 13:22:53 -05:00
Henrik Brix Andersen
296d368047 drivers: can: mcan: remove unused NUM_TX_EVENT_FIFO_ELEMENTS macro
Remove the unused NUM_TX_EVENT_FIFO_ELEMENTS helper macro. There is no
dts property for setting the TX event FIFO size.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-18 13:15:05 -05:00
Aymeric Aillet
37f5fe5e82 drivers: serial: RCar add pinctrl support
Get pin configuration from device tree to
set alternate pin function.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-01-18 13:04:53 -05:00
Ruibin Chang
40bb3d808a ITE drivers/watchdog: cleanup it8xxx2 watchdog driver
Stop using DRV_CONFIG, DRV_DATA, DRV_REG macros.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-01-18 12:14:26 -05:00
Ruibin Chang
1a11a3362e ITE drivers/watchdog: support tests/drivers/watchdog/wdt_basic_api
Add watchdog0 to support tests/drivers/watchdog/wdt_basic_api.

Solve tests code runtime error on it8xxx2_evb:

1.When run the wdt tests api, we shouldn't reduce the warning
timer time, so I add config WDT_ITE_REDUCE_WARNING_LEADING_TIME,
this config will be enabled only on platform EC.

2.Upper limit window timeouts can't be 0 when we install timeout.

3.Since we support wdt_it8xxx2_disable(), then we should support
flag WDT_OPT_PAUSE_HALTED_BY_DBG, too. Watchdog can be stopped
by IT8XXX2_WDT_EWDSCEN bit of ETWCTRL reg.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-01-18 12:14:26 -05:00
Gerard Marull-Paretas
ddc168fa78 pm: s/PM_DEVICE_(DT_(INST))_REF/PM_DEVICE_(DT_(INST))_GET
In order to align with macros used to obtain a device reference (e.g.
DEVICE_DT_GET), align the PM macros to use "GET" instead of "REF". This
change should have low impact since no official release has gone out yet
with the "REF" macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-18 12:14:06 -05:00
Daniel DeGrasse
0fddb3e458 soc: rt11xx: Enabled GPTP module clock
gPTP module clock is enabled for rt11xx. gPTP is not working correctly
on the RT10xx or RT11xx series, but this module clock needs to be
enabled

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-18 12:13:24 -05:00
Daniel DeGrasse
5fe5161721 drivers: eth_mcux: Update for RT11xx SOC
RT11xx soc has multi ring enet IP, which has different HAL functions.
Update eth_mcux driver to account for this

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-18 12:13:24 -05:00
Daniel DeGrasse
594e11a540 drivers: eth_mcux: Enable specifying PHY addr for enet module
PHY addr is not always 0 on boards with multiple PHYs. Allow specifying
via devicetree.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-18 12:13:24 -05:00
Gerson Fernando Budke
58936e7639 soc: arm: atmel_sam: samv71: Fix SPI build dependency
The SAM spi driver depends on GPIO driver to work. It seems that this
dependency chain it is not handled. This select GPIO driver when SPI
driver is enabled. It rework GPIO and SPI Kconfig to select driver by
devicetree and drop entries at Kconfig.defconfig.series file.

Fixes #41525

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-01-18 12:12:52 -05:00
Przemyslaw Bida
b5e34561eb net: openthread: Fix warinig in nrf5_config_mac_keys.
This commit fixes compilation warning (unused variable)
generated in nrf5_config_mac_keys function, when the ASSERT
macros were disabled.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2022-01-18 10:40:53 -05:00
Alexander Wachter
6e5c8a339d drivers: can: Add frontend for Atmel SAM M_CAN controller
This commit adds a frontend for the generic Bosch m_can driver
for Atmel SAM series.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2022-01-18 10:39:55 -05:00
Alexander Wachter
4e903cd4fe drivers: can: mcan: Add headers for types used in this file
Some includes that resolve types used in this file were missing.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2022-01-18 10:39:55 -05:00
Alexander Wachter
c5ad0b425e drivers: can: mcan: fix array index in cache handling param
filter_nr was renamed to filter_id. This change was not included
in the cache handling PR.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2022-01-18 10:39:55 -05:00
Benedikt Schmidt
6c60664281 drivers: clock_control: stm32h7: systick activation
Do not enable systick in the clock control initialization of
a STM32H7.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2022-01-18 10:36:07 -05:00
Attie Grande
ce07d834a5 drivers: i2c: sam0: Return the bus to idle when a transaction fails
If a transaction fails, the bus was not being returned to idle. This
increases power consumption, and can cause the following transaction to
be misinterpreted.

By issuing a STOP command on error, we can ensure that the bus returns
to idle correctly.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-01-18 10:28:31 -05:00
Attie Grande
aed55b6cb9 drivers: i2c: sam0: Ensure the bus returns to idle after a read
When calling i2c_transfer(), the bus failes to enter the idle state when
performing a read, or an unacknowledged write. This increases power
consumption, and can cause the following transaction to be
misinterpreted.

This behaviour was observed on a SAML21 part. There appears to be a race
condition between the peripheral setting CLKHOLD, and the command being
correctly set up - so now we wait for the CLKHOLD field to be set before
issuing the STOP command, and this resolves this issue.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-01-18 10:28:31 -05:00
Sylvio Alves
40ad264a47 drivers: uart: fix esp32 TX checks
This fixes both TX ready and completed uart
calls to meet valid condition.

Closes #41526
Closes #41624

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-18 10:28:00 -05:00
Henrik Brix Andersen
e8df8a5790 drivers: can: mcux: flexcan: rework transmit error handling
Rework the transmit error handling in the NXP MCUX FlexCAN driver:
- Frame transmission must be automatically retried in case of lost
  arbitration or missing acknowledge.
- Abort any pending TX frames when bus-off state is entered.
- Fail early in can_send() if in bus-off state.

Fixes: #19502

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-17 21:09:17 -05:00
Henrik Brix Andersen
b6f6069b99 drivers: can: stm32: add support for disabling automatic retransmissions
Add support for disabling automatic retransmission of CAN frames
(similar to CAN "one-shot" mode in the Linux kernel).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-17 21:09:17 -05:00
Attie Grande
36ebb7a2bc drivers: i2c: fixup comments outlining command arguments
Some comments were missing, and others were misleading. This is now
resolved.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-01-17 15:43:20 -05:00
Julien Massot
15f4bbf86b drivers: can: RCar add pinctrl support
Get pin configuration from device tree to
set alternate pin function.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-17 21:00:58 +01:00
Julien Massot
feb6e2504e drivers: pinctrl: add Renesas RCar PFC driver
Introduce Pin Function Controller for Renesas R-Car family.
This first implementation support to set a given pin as gpio
or peripheral (GPSR), to set a peripheral function to a
pin (IPSR), to set pull-up, pull-down (PUEN, PUD).
In addition this driver allows to set driving capabilies(DRVCTRL).

Pins are identified thanks to the per SoC binding for
pin definition which also contains pin alternate function
parameters.

Some pins can also have driving capabilities, some have bias
capabilities.
In order to find the correct bias and drive registers pfc_r8a77951.c
describes the different registers.
Each SoCs or package will need to define getters
for these registers: pfc_rcar_get_bias_regs() and
pfc_rcar_get_drive_regs().

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-17 21:00:58 +01:00
Tim Lin
013bc73e40 ITE: cleanup: drivers/bbram: correct the default configuration format
1. Rename DT_COMPAT_ST_BBRAM_IT8XXX2 to COMAPT_ITE_IT8XXX2_BBRAM
2. The default configuration "$( )" should be a parentheses instead
   of curly brackets. The BBRAM for it8xxx2 can be driven after
   correcting.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-01-17 11:52:13 -05:00
Tim Lin
95ba8e3fe4 ITE: drivers/bbram: add magic number to compare in initial
BBRAM content should be cleared when boot from cutoff. Compare magic
number to decide whether to clear entire BBRAM.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-01-17 11:52:13 -05:00
Maureen Helm
e0cb96c4e3 drivers: flash: Refactor drivers to use shared init priority
Refactors all of the on-chip flash drivers to use a shared driver class
initialization priority configuration, CONFIG_FLASH_INIT_PRIORITY, to
allow configuring flash drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers.

Driver-specific options for SPI-based flash drivers are left intact
because they need to be initialized at a different priority than on-chip
flash drivers.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-01-17 11:51:09 -05:00
Jedrzej Ciupis
81ea529960 drivers: ieee802154: extend support for nRF53
This commit updates the ieee802154 driver to match the current feature
set of the nRF 802.15.4 radio driver for nRF53 SoCs.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2022-01-17 11:50:38 -05:00
Alexander Wachter
41643b0fac drivers: can: stm32fd: fix type of clock rate
the rate_tmp varaiable was int, but should be const uint32_t.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2022-01-17 11:50:06 -05:00
Alexander Mihajlovic
cfce5afcd9 drivers: adc: stm32: Clear ADRDY before waiting
Clear ADRDY before enabling ADC to ensure the subsequent
wait for ADRDY does not stop prematurely in case ADRDY
was already set.

The "ADC on-off control" sections of the following reference manuals
were consulted. That gives at least one instance per series affected
by this change, even if not every affected MCU is covered.

- RM0438 (STM32L552xx and STM32L562xx)
- RM0351 (STM32L47xxx, STM32L48xxx, STM32L49xxx and STM32L4Axxx)
- RM0434 (STM32WB55xx and STM32WB35xx)
- RM0454 (STM32G0x0)
- RM0440 (STM32G4 Series)
- RM0399 (STM32H745/755 and STM32H747/757)
- RM0433 (STM32H742, STM32H743/753 and STM32H750)
- RM0453 (STM32WL5x)

Signed-off-by: Alexander Mihajlovic <a@abxy.se>
2022-01-17 11:48:30 -05:00
Alexander Mihajlovic
e521c7d49e drivers: adc: stm32: Add function to enable ADC consistently
Use a wrapper for LL_ADC_Enable that also waits for ADRDY if required
by the SoC to make sure it's properly enabled everywhere this is done.

Signed-off-by: Alexander Mihajlovic <a@abxy.se>
2022-01-17 11:48:30 -05:00
Henrik Brix Andersen
d5fb436f73 drivers: can: shell: catch up with recent CAN API naming changes
Rename CAN RX filter shell commands to catch up with the CAN API naming
changes in 8af4bb722d.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-17 11:48:02 -05:00
Francois Ramu
d65a74e2dd drivers: spi: stm32 spi drivers supports the frame format
the stm32 spi drivers now takes the DTS frame_format property
from the include/ drivers/spi.h
It will be possible to select the Motorola (default)
or TI from the DTS entry of the device,
when soc supports it, else a run time error is raised.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-17 11:46:14 -05:00
Manojkumar Subramaniam
ae0ce3a2b9 drivers: clock_control: stm32h7: Support SoC STM32H7A3XX / STM32H7A3XX-Q
clock requirement

Introduce a new group of clock setting to fit in this series of SoC

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2022-01-17 11:45:21 -05:00
Ruibin Chang
336d0f67b3 ITE drivers/kscan: support tests/driver/kscan/kscan_api
Add kscan0 to support tests/driver/kscan/kscan_api.

When running the tests code on it8xxx2_evb, it shows fatal
error: IRQ is enabled. We find that once polling_task() is
created and executed, the KSI interrupt will be enabled and
before we call irq_connect_dynamic(), so we switch both
function sequence.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-01-17 11:44:05 -05:00
Jordan Yates
8173277cc1 drivers: adc: test driver
Add a dummy driver for the `vnd,adc` compatible to allow compilation of
drivers utilising an ADC when running "build_all" tests.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-17 08:13:41 -05:00
Daniel Leung
44462723f5 timer: hpet: make legacy interrupt routing optional
On some platforms, HPET is not wired to trigger IRQ 2.
This would make HPET non-functional if the legacy
interrupt routing bit is set in the global config
register. This adds a DTS flag so the driver won't
set the bit to enable legacy interrupt.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-14 14:46:21 -05:00
HaiLong Yang
5a7aeb9439 drivers: i2c: introduce GD32 I2C driver
Add an interrupt driven i2c driver for gd32 i2c peripheral.

The transmit and reception method refer from GD32 SoCs user manual.
Particularly, reception method choose the solution B.

There have some wait for state ready logic in the driver. It cause by
i2c device internal state change slower than i2c driver.

Signed-off-by: HaiLong Yang <cameledyang@pm.me>
2022-01-14 10:42:24 -06:00
Sebastian Bøe
0cae1d8928 drivers: flash: Refactor boundary checking
We will soon need to do more boundary checking to test whether we are
reading secure or non-secure memory.

Refactor the boundary checking in preparation for this.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2022-01-14 09:57:04 -06:00
Dominik Chat
3e6ab47455 sensors: Implement MPU9250 driver
MPU9250 driver for 9-axis
gyroscope, accelerometer, magnetometer

Signed-off-by: Dominik Chat <dominik.chat@nordicsemi.no>
2022-01-14 12:33:04 +01:00
Krzysztof Chruscinski
ee43b3a51b drivers: gpio: nrf: Free channel when pin is reconfigured
GPIOTE channel was not freed when pin was reconfigured. This lead to
channel pool draining when pin was frequently reconfigured.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-14 12:28:21 +01:00
Wouter Cappelle
c3ca3aa27d sensors: STM32: Add support for L5 die temp sensor
This PR adds the different handling of temperature sensor for the
STM32L5 soc. In this soc, there are some calibration settings which
need to be applied for temperature conversion.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-01-13 10:34:10 +01:00
Wouter Cappelle
ba12740049 sensors: STM32: code formatting of stm32_temp with sample
clang format on stm32_temp.c & the sample

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-01-13 10:34:10 +01:00
Wouter Cappelle
c9e7ca3cac sensors: STM32: Prepare for different handling of temp conversions
moving the conversion from adc value to the get function
which will be used for different handling of stm32 temp sensors

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-01-13 10:34:10 +01:00
Tom Burdick
0e96f59e83 dma: Add suspend resume implementation for edma
Implement the suspend and resume transfer api calls for NXP's eDMA.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-01-12 17:33:48 -05:00
Daniel Leung
9c4fb66a8b i2s: i2s_litex: fix doc styling on two copy functions
Just minor styling changes to capitalize the first character
and removing the trailing comma on the brief doc description
on two copy functions.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Daniel Leung
bae4847b51 drivers: i2s/i2s_litex: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Daniel Leung
bff37a3a6c drivers: serial: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Daniel Leung
44ee482b0a drivers: console: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Daniel Leung
0e1d5a48a9 drivers: timer: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Daniel Leung
975e257f2c drivers: interrupt_controller: remove @return doc for void funcs
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Henrik Brix Andersen
e919db3222 drivers: can: add user_data to state change callback
Add optional user data argument to can_set_state_change_callback() to
comply with Zephyr API design guidelines.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-11 11:54:04 +01:00
Alexander Mihajlovic
673806aef1 drivers: spi: stm32: Skip pinctrl setup for subghzspi
Subghzspi instances cannot have any pinctrl configs,
they are blacklisted by the dts binding. This caused an
initialization failure of the spi_ll_stm32 driver for
subghzspi instance because no "default" pinctrl was found.

This commit solves the problem by skipping the pinctrl setup
for subghzpi devices. The use_subghzpi_nss property is used
to identify a subghzspi device, as this is a required boolean
property only available in the subghzspi binding this is a
perfect indicator for such instances.

Signed-off-by: Alexander Mihajlovic <a@abxy.se>
2022-01-11 11:52:59 +01:00
Tim Lin
263fd9d1d1 ITE: cleanup: it8xxx2: drivers/intc rename the function
The function should be renamed ite_intc_irq_polarity_set.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-01-11 11:52:35 +01:00
Tim Lin
d676b51485 ITE: drivers/i2c: add the API of get configuration
This commit adds the API of get_config that will make test of
tests/drivers/i2c/i2c_api pass on it8xxx2_evb board.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-01-11 11:51:04 +01:00
Marius Scholtz
14e15df00f drivers: arm: stm32: adc: Added Shared IRQ
Certain stm32 soc's have a single shared irq for all adc channels
on those soc's only a single channel is supported.

Added a Kconfig that enables a shared irq for stm32f2x, stm32f4x,
stm32f7x soc's. The shared IRQ uses a flag to limit the number of
interrupts defined to only 1. A shared irq handler is added which
determines which ADC instance the interrupt is for, it then calls
into the existing interrupt.

Signed-off-by: Marius Scholtz <mariuss@ricelectronics.com>
2022-01-11 11:50:43 +01:00
Gerard Marull-Paretas
1e81e7cded drivers: pwm: gd32: enable gd32vf103
Add dependency on SOC_SERIES_GD32VF103. The driver is compatible as is
with this series.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-11 11:50:35 +01:00
Gerard Marull-Paretas
cdcd11aac0 drivers: gpio: gd32: enable gd32vf103
The device implemented by this driver is also available on GD32 RISC-V
MCUs.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-11 11:50:35 +01:00
Gerard Marull-Paretas
c4269ba947 drivers: interrupt_controller: gd32_exti: enable gd32vf103
The device implemented by this driver is also available on GD32 RISC-V
MCUs.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-11 11:50:35 +01:00
Gerard Marull-Paretas
07eee1bc79 drivers: interrupt_controller: gd32_exti: isr may be unused
The gd32_exti_isr function may be unused if the GPIO driver is not
enabled but EXTI is (no IRQ will connect to it). This may be improved in
the future by requiring explicit enablement of the exti DT node.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-11 11:50:35 +01:00
Tim Lin
45b6aa4c3b ITE: drivers/i2c: add the compatibility of GPIO F2/F3 for i2c3
The default I2C channel 3 is used by alternate function of GPIO H1/H2
Krabby uses GPIO F2/F3 as I2C channel 3, so we need to add the
compatibility of the GPIO F2/F3.

TEST=test on it8xxx2_evb:
zmake configure -b zephyr/projects/it8xxx2_evb/

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-01-11 11:49:16 +01:00
Jaremy J. Creechley
3ac2ca2aa5 net: socket: extend posix compatability SO_<opts>
Adding these definitions help ease of porting POSIX applications.

They currently do nothing in the core network stack and will
return an error if used. However, they help port some POSIX
without changing these. In particular, this enables using the
Nim programming language's standard library with Zephyr.

- The values copy Linux amd64, similar to the other SO_OPTIONS
- Add SO_SNDBUF to fix simplelink wifi
- Use compat options in simplelink wifi

Signed-off-by: Jaremy J. Creechley <jaremy.creechley@panthalassa.com>
2022-01-11 11:48:16 +01:00
Jonathan Hahn
32f9dcf328 drivers: uart: Add support for st single wire mode
An additional devicetree poperty `single-wire` is added
to uart and usart bindings of stm32. The driver checks this value
during initialization and enables the single wire mode when set.

Signed-off-by: Jonathan Hahn <Jonathan.Hahn@t-online.de>
2022-01-11 11:47:47 +01:00
Gerard Marull-Paretas
10fb5789ef drivers: serial: ns16550: use pm_state_cpu_get_all
Use pm_state_cpu_get_all to obtain CPU states instead of using extra ROM
duplicating existing information already holded by the PM subsystem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-11 10:46:20 +01:00
Jani Hirsimäki
b204c26e94 drivers: net: ppp: async uart support
Implemented an option to use asyncronous uart api
(CONFIG_NET_PPP_ASYNC_UART).

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2022-01-10 09:43:10 -06:00
Henrik Brix Andersen
93c6b7413b drivers: can: add NXP LPC MCAN front-end for the Bosch MCAN driver
Add a NXP LPC MCAN-specific front-end for the generic Bosch MCAN
driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-01-10 12:00:20 +01:00
Henrik Brix Andersen
abaf7cc70d drivers: clock_control: lpc: syscon: add MCAN clock support
Add support for the LPC MCAN clock to the LPC SYSCON clock controller
driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-01-10 12:00:20 +01:00
Henrik Brix Andersen
064720a2f0 drivers: can: mcan: fix CAN_MCAN_TXEFC_EFSA_POS value
The Event FIFO start address (EFSA) field within the Tx event FIFO
configuration register (TXEFC) occupies bit 15:2.

Change the CAN_MCAN_TXEFC_EFSA_POS definition to reflect this.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-01-10 12:00:20 +01:00
Henrik Brix Andersen
8af4bb722d drivers: can: rename API functions for better consistency
Rename a few CAN API functions for clarity and consistency with other
Zephyr RTOS APIs.

CAN_DEFINE_MSGQ() becomes CAN_MSGQ_DEFINE() to match K_MSGQ_DEFINE().

can_attach_isr() becomes can_add_rx_filter() since a filter callback
function is not an interrupt service routine (although it is called in
isr context). The word "attach" is replaced with "add" since filters are
added, not attached. This matches the terminology used is other Zephyr
APIs better.

can_detach() becomes can_remove_rx_filter() to pair with
can_add_rx_filter().

can_attach_msgq() becomes can_add_rx_filter_msgq() and documentation is
updated to mention its relationship with can_add_rx_filter().

can_register_state_change_isr() becomes can_set_state_change_callback()
since a state change callback function is not an interrupt service
routine (although it is called in isr context). The word "register" is
replaced with "set" since only one state change callback can be in
place.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-10 10:44:37 +01:00
Francois Ramu
1da200bf16 drivers: spi: stm32h7 spi drivers with DMA transfer
This patch controls the SPI of the stm32H7 mcu when using
the DMA transfer. Starting and ending the transfer
are specific according to the RefMan.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-07 15:06:28 -06:00
Francois Ramu
ca3c2cf1f9 drivers: spi: stm32 spi instance of stm32H7 mcu
A generic function is used to give the register address to the DMA.
The SPI of the stm32H7 serie has two data registers for Tx and Rx
When the DMA is getting the address it differs between Rx and Tx.
As the stm32cube/stm32h7xx/drivers/include/stm32h7xx_ll_spi.h
has no such LL functions, the register address is get direclty.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-07 15:06:28 -06:00
Francois Ramu
0ce796398a drivers: spi: stm32 ll driver disable the instance after completion
The spi_stm32_complete() is checking spi flags which are valid when the
intance is still enable: disable afterwards. No more need to disable
the DMA transfer then

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-07 15:06:28 -06:00
Francois Ramu
081e2d5a54 drivers: spi: stm32 driver with dma checking spi busy status flag
Defines a function to control the spi busy state during DMA transfer.
After the DMA Tx, the spi might still have some data to Transmit.
The driver must wait for the SPI Tx before sending the next packet.
This is not required for the Rx part as the DMA Rx is already done.
Some mcus like stm32H7 have a TX complete bit, other must wait for the
TXE and BSY line.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-07 15:06:28 -06:00
Gerard Marull-Paretas
0cb9a1b4cb drivers: pwm: gd32: initial version
Initial version of a PWM driver for GigaDevice GD32 SoCs. Only PWM
output is supported for now (no capture support).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-07 14:58:27 -06:00
Wealian Liao
7add8f7fa0 drivers: adc: npcx: Fix register offset
NPCX7/9 has a different ADC register structure. NPCX7 has 3 threshold
detectors from offset 0x14 & has 10 input channels. NPCX9 has 6
threshold detectors from offset 0x60 & has 12 input channels.

This commit fixes the NPCX ADC register structure.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-07 11:21:29 -05:00
Tomasz Bursztyka
1ae95546c8 drivers/interrupt_controller: Add a VT-D option to disable src id check
Theoretically, source id check is not mandatory in the context we use
VT-D here (i.e. non VM one, just multi-vector MSI support)

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
4090962386 drivers/interrupt_controller: Add source id to VT-D interrupt remap
Change the API and apply that change where relevant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
811fc76780 drivers/interrupt_controller: Fix IRTE delivery mode on VT-D
Only allow FIXED or LOW_PRIO modes.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
92884ba44a drivers/interrupt_controller: Add VT-D context cache invalidation
Not sure this is requered as we do not mangle with domains, but let's
make sure this cache is clear.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
f44062a8e6 drivers/interrupt_controller: Fix command write in VT-D
A surprising issue: while sys_set_bit() on VTD_GCMD_REG work on
apollo_lake, it seems to create border effect on elkhart_lake: it may
reset some previous bit to 0.

So switching to full write of the register at once, which works for
both.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
49a4bb32da drivers/interrupt_controller: Enable VT-D by default under condition
VT-D will only be enabled if MSI multi-vector will also be requested,
on x86_64, for all boards BUT QEMU ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
cf18ecd09f drivers/interrupt_controller: No VT-D if no PCIE MSI multi-vector
There is no point to enable VT-D if PCIE MSI multi-vector support is not
requested, as VT-D is uniquely being used to remap MSI multi-vector
based interrupts.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
666318e9b7 drivers/interrupt_controller: Use proper destination mode on VT-D
Let's always use logical Destination ID.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
5ae4402fe0 drivers/interrupt_controller: Fix MMIO mapping
Those MMIO registers might be mapped in RAM and thus it's
really important to keep storage space for such mapping.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
0c4cecae5e drivers/interrupt_controller: Add a timeout check on VT-D QI operation
QI operation are not supposed to last forever.
It's not an actual timeout based on clock, but a dummy counter instead.
That's because system clock might not have beed initialized yet, since
VT-D's init comes first (and that same init will use QI...)

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
82961458de drivers/interrupt_controller: Simplify IRTE structure for readability
Let's avoid l/h accessors, and directly have all bits into one
structure.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
149cef11ce drivers/interrupt_controller: VT-D may manipulate the cache
Depending on a VT-D capability, it might be necessary to flush objects
from the cache.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
25640f65c9 drivers/interrupt_controller: VT-D IRTE table should be 4kb aligned
As specified by the IRTA location.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
2c904b379b drivers/interrupt_controller: Adding QI support in VT-D
Looks like it's mandatory to invalidate the Interrupt Entry Cache in
VT-D and the only way to do so is to enable Queued Interface.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
97c299e0df drivers/interrupt_controller: Align VT-D helper function name
All are 32/64 differentiated, so does vtd_read_reg.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
610aeb9d42 drivers/interrupt_controller: Intel VT-D init should happen after ioapic
Or then it will badly crash trying to set up the fault event isr
handler.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
640e651cd8 drivers/interrupt_controller: Add fault event support on Intel VT-D
IR faults are non-recoverable, so it's good to know why. Thus let's
handle the fault event and print the fault.

Other faults are printed as well.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
a8c8abd27e drivers/interrupt_controller: Write IRTE as 64bits blocks in VT-D
Looks like a source of fault if pieces of IRTE are written instead of
the whole 64 bits block it belongs to.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
2efd874dcc drivers/interrupt_controller: Make IOAPIC VT-D aware when relevant
If VT-D's interrupt remapping is in place, all IOAPIC RTEs need to get
remapped as well (or then they will be simply blocked).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
edef8e6b0d drivers/interrupt_controller: Expanding VT-D public API
Adding a way to pre-install the irg/vector on an irte and a way to get
an irte based on irq/vector.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
1a1bc0d242 drivers/interrupt_controller: Make VT-D remap generic and handle flags
This will not only be used by MSI remapping but by all relevant
interrupts.

Fix also IRTE settings:
- handle x2apic for destination id
- destination mode is always logical (as for IOAPIC)

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
2b1cbcbddc drivers/interrupt_controller: Fix VT-D remap destination on XAPIC
CPU-ID is written in a different format in case of XAPIC.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
e2b4f7e50f drivers/interrupt_controller: Fix VT-D EIME value
It's the 11th bit and not 11.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
aa6112d0af drivers/interrupt_controller: Enable xapic pass-through in intel vt-d
In XAPIC mode, it's possible to tell VT-D to let interrupt in compatible
format passing through.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
4047b793c8 drivers/interrupt_controller: Generate proper MSI address on VT-D
SHV bit depends on the number of vectors allocated.
If it's facing a multi-vector MSI array, it will set the bit.
If not the bit must be 0.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
6ed593f861 drivers/pcie: Extending parameters to pcie_msi_map
n_vector will be necessary for VT-D actually.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
25b8df0bdb drivers/pcie: Even single MSI based interrupt needs to be remapped
Refactor to handle this case. This is valid only when MSI multi-vector
feature is enabled.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
f7a2ff4f8d drivers: Fixing the 2 drivers for PCIe IRQ connection
Now these 2 drivers should be working properly in case of IRQ remapping.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
b5fecc5ff8 drivers/pcie: Add a function for dynamic PCIe IRQ connection
The is meant to fix a chicken & egg issue with MSI interrupt remapping.
Currently, drivers first connect the irq (by-passing any possible MSI
remapping), so the IRQ ends-up being remapped at the IOAPIC level which
is not what we want.

So adding a dedicated function to properly handle this case. This is
valid only for runtime dynamic IRQ connection obviously.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
fbb2f1511c drivers/pcie: Add a function to know MSI/MSI-x support of an endpoint
And since it does yet another round of pcie_get_cap() on PCIE_MSI_CAP_ID
and PCIE_MSIX_CAP_ID, let's factorize that into a utility function and
change the relevant places to use that function instead.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Herman Berget
6ede31428d Bluetooth: Host: Reassemble extended advertising reports
The host reassembles fragmented advertising reports from the controller.

Non-complete advertising reports from different advertisers may not be
interleaved. If non-complete advertising reports from an advertiser
is received while advertising reports from another advertiser is
reassembled, an error message is logged and the advertising report is
discarded. Future scan results may be incomplete.

Advertising reports from legacy PDUs or complete extended advertising
reports may be interleaved as these do not require reassembly.

If the controller sends more advertising data than fits in the
reassembly buffer, the data is truncated. Further advertising reports
from the advertiser are discarded until the final complete advertising
report is received and discarded.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-01-07 15:35:39 +02:00
Jordan Yates
c8d1e134ae gpio: emulated: default Kconfig value
Enable the emulated GPIO driver by default if instances exist in
devicetree. This removes the need to manually enable `CONFIG_GPIO_EMUL`
when `CONFIG_GPIO` is enabled.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-06 11:56:15 -05:00
Andy Ross
e4a455b25d drivers/cavs_timer: Cleanup & simplification pass
General refactoring to clean up and futureproof this driver.

Remove false dependency on CONFIG_CAVS_ICTL.  This requires the CAVS
interrupt mask API, but doesn't touch the interrupt controller driver.

Remove a racy check for simultaneous interrupts.  This seems to have
been well intentioned, but it's needless: the spinlock around the
last_count computation guarantees that colliding interrupts will
correctly compute elapsed ticks (i.e. the last will compute and
announce zero ticks, which is correct and expected).  And this opened
a tiny window where you could incorrectly ignore a just-set timeout.

Factor out the specific registers used (there are only five) into
pointer-valued macros instead of banging them directly.

Unify interrupt initialization for main and auxiliary cores.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-01-05 15:01:45 -05:00
Daniel Leung
40138c96b2 interrupt_controller: dw: use finalstatus instead of maskstatus
Instead of using maskstatus to see if an interrupt has fired,
use finalstatus instead. It has been observed that some
controllers do not update maskstatus correctly with incoming
interrupts, but finalstatus works fine.

FYI, the DW driver in Linux is also using finalstatus.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-05 15:01:45 -05:00
Erwan Gouriou
c4ae984a2d drivers/clock_control: stm32u5: Use LL API to set MSI as PLL srce
Recent changes in this function made the code now compatible
with the use of LL API to perform this configuration.
Use it to simplify the driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-01-05 14:59:34 -05:00
Dino Li
a89e60d7d8 gpio: it8xxx2: open source configuration isn't supported
This makes test of tests/drivers/gpio/gpio_api_1pin happy
on it8xxx2_evb.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-01-05 14:58:22 -05:00
Yong Cong Sin
e77d87da65 drivers: modem: gsm: Fix NULL being passed to rssi_handler
Fix hard fault due to NULL being passed as argument into
rssi_handler, which now derives the gsm_modem struct pointer from
the argument.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-05 14:57:16 -05:00
Gerard Marull-Paretas
6adda40775 drivers: pinctrl: gd32: do not disable clock
Disabling clock may conflict with concurrent usage of GPIOs and pins in
AF mode. This can be improved once a proper clock control API is in
place.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-04 20:49:00 -05:00
Gerard Marull-Paretas
b9127e48e6 drivers: gpio: gd32: initial version
Add GPIO driver for Gigadevice SoCs. The driver supports devices with
the AF and AFIO models.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-04 20:49:00 -05:00
Gerard Marull-Paretas
996a708abd drivers: interrupt_controller: initial support for GD32 EXTI
Add initial support for the GigaDevice External Interrupt Controller.
This driver is required to manage GPIO interrupts. Only EXTI lines 0 to
15 are supported for now (no LVD, RTC, etc.). Driver can be extended in
the future to add support for extra EXTI lines.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-04 20:49:00 -05:00
Lukasz Majewski
5599f1b3ab qspi: stm32: Add support for 4 IO read and program (4READ/4PP)
This change provides support for 4 IO read (via 4READ command) and
program (via 4PP). Flash memory pins SIO[0123], CLK and CS are used.

All of them are controlled by stm32 QSPI IP block.

The instruction code for fast reading as well as number of latency
cycles required are read from SFDP structure provided by flash memory.
The number of required read latency cycles when performing reading
is the sum of SPI-NOR memory mode bits and wait states (also named
as 'dummy cycles').

It also has been assumed that memory, which supports fast read (4READ),
also will support fast programming (4PP command) as this information is
not available in SFDP.

One also need to enable the QUAD IO support in board's device tree by
defining 'spi-bus-width = <4>' property. It is required as it may
happen that not all QSPI dedicated pins are used (for example only two
of them are available).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski
c1b60e7fb6 qspi: stm32: Add code to switch flash memory to use 4 SIO pins
For proper operation of QUADSPI IP block, both sides of communication;
NOR flash memory and STM32 controller need to support 4 IO
transmission.

After this change the QSPI stm32 driver is able to program NOR flash
memory to switch itself to use all 4 IO lines (SIO[0123]) to transmit
and receive data.

The QE bit (in SPI-NOR's Status Register) is the non-volatile one, so
setting it is done only once (at first boot of the device).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski
029f49fc99 spi: Provide definition for SPI-NOR flash memory control register
This commit provides define for reading the control register (CR) on
the flash memory.
In that register the information about 4B addressing is stored.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski
08b5a082f9 qspi: stm32: Extend the driver to support 4 byte addressing
After this change the stm32 quadspi driver supports the 4 bytes
addressing if the memory supports it.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski
07be9301b9 qspi: stm32: Add support for 'reset-gpios' property in 'stm32-qspi-nor'
Some flash memories connected to QUADSPI IP block on stm32[fh]7 devices
require proper reset pulse before configuration.

This patch adds two new properties - the 'reset-gpios' phandle,
which allows specifying GPIO pin for RESETn pulse and
'reset-gpios-duration', which provides the time (in ms) for reset
duration.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski
44676a9d3e qspi: stm32: Add support for 'flash-id' property in 'stm32-qspi' banks
The 'flash-id' property defines the number of QSPI's dedicated GPIO
bank (and flash ID), which will be used to communicate with flash
memory.

For example, on stm32h7xx it is possible to use 'quadspi_bk1_*' and
'quadspi_bk2_*' set of pins, so one may need to select between them
when required.

By default - pins from 'quadspi_bk1_*' bank are used, so the
'flash-id = <2>;' property, when your use case (e.g. PCB design)
requires it, forces usage of 'quadspi_bk2_*' pins.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski
4a124b1ace kconfig: stm32: Select CONFIG_USE_STM32_HAL_MDMA when QSPI is used
The stm32 HAL code for qspi (SHA1: 5c8275071ec1cf160bfe8c18bbd93):
stm32cube/stm32h7xx/drivers/src/stm32h7xx_hal_qspi.c implicitly
depends on the stm32h7xx_hal_mdma.c driver as it uses unconditionally
'HAL_MDMA_Abort_IT()' function.

To avoid build breaks - no matter if QSPI IP block works with DMA
or interrupts - the CONFIG_USE_STM32_HAL_MDMA shall be defined.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Jun Lin
803a4ff620 driver: timer: npcx: fix the racing condition when getting current uptime
In npcx_itim_evt_isr, it updates the cyc_sys_announced variable and
then calls sys_clock_announce() to update the kernel curr_tick variable.
If an ISR handler with higher priority preempts the timer ISR after the
sys_clock_announce is updated and before the sys_clock_announce() is
called, it will read the wrong time when calling k_uptime_get() because
the cyc_sys_announced and the curr_tick are not synchronized.
The commit fixes the problem by raising the timer's interrupt priority
to the highest one (i.e. 1 in npcx's configuration).

This commit also moves the computation of the delta cycle inside the
spinlock in sys_clock_elapsed() to prevent another potential racing
condition.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-04 20:46:26 -05:00
Henrik Brix Andersen
99a310b29b drivers: can: loopback: convert the CAN loopback driver to dts
Convert the CAN loopback driver from being configured via Kconfig to
multi-instance configured via devicetree.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-04 15:13:40 -06:00
Yong Cong Sin
19910666e0 drivers: modem: gsm: Cancel the work when stopped
gsm_ppp_stop should cancel possible running work items.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-01-04 15:03:06 -06:00
Yong Cong Sin
d9ea07b7bd drivers: modem: gsm: convert work to delayable work
The 'work' argument of a delayable work's handler should be
converted to delayable work before passing into the CONTAINER_OF
macro.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-04 15:03:06 -06:00
Yong Cong Sin
b2b9343c95 drivers: modem: gsm: declare structs in gsm_modem
Move the declarations of a few structs into the struct
gsm_modem

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-04 15:03:06 -06:00
Jedrzej Ciupis
fcda8699cb drivers: timer: extend nrf_rtc_timer
This commit introduces the following changes:

* nrf_rtc_timer is extended with a capability to handle RTC overflow,
allowing it to operate on absolute RTC ticks, rather than relative
ticks.
* overflow handling is ZLI-proof and relies on the sys clock
handler being executed twice every RTC counter's overflow.
* callbacks are given an absolute RTC tick value as a parameter instead
of CC register's value. The absolute RTC tick value is the RTC counter
value set during CC channel configuration extended to 64 bits.
* in case the timer's target time is in the past or is the current tick,
the timer fires as soon as possible, however still from the RTC's ISR
context.
* in case an active timer is set again with the same target time, it is
not scheduled again - only its event data is updated. Otherwise, the
timer is scheduled as usual.
* a scheduled timer can be aborted.
* system clock functions are now using 64 bit values internally.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Paweł Kwiek <pawel.kwiek@nordicsemi.no>
2022-01-04 17:44:32 +01:00
Emil Gydesen
0921979adc Bluetooth: Drivers: Fix bad return for bt_esp_evt_recv
Instead of returning NULL, the function had a `continue`.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-04 10:09:51 -05:00
Sylvio Alves
92fb477641 drivers: uart: esp32: fix poll in return value
ESP32 uart_poll_in should return 0 on success and not
the total amount of data read.

This also adds a check in fifo_fill call to
avoid negative values, otherwise it would send garbage
to uart

Closes #41352

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-04 10:07:15 -05:00
Jordan Yates
1bb7aa21b8 lora: sx126x: don't re-enable interrupt in sleep
Don't re-enable the DIO1 interrupt when the modem is in sleep mode. This
fixes the power regression introduced in Zephyr v2.7.0 #41026.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-04 10:02:24 -05:00
Alexander Wachter
66fef31236 drivers: can: mcan: Add cache handling
The msg_sram resides in the sram region, where the
m_can controller direcly access it. Whenever the driver
writes to the msg_sram and operations are triggered, the
cache needs to be invalidated.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2022-01-04 09:14:16 -05:00
Francois Ramu
e9b9e4c6ad drivers: adc: driver setting the oversampling for stm32wl
RM 0453: the sw is allowed to write the Oversampling
ratio or shift of the ADC Config.Reg.2 only when ADSTART = 0
(no conversion is on-going). So disabling it will be stopped.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-04 09:12:08 -05:00
Francois Ramu
c918c4f1d9 drivers: adc: driver setting the resolution for stm32wl
RM 0453: the sw is allowed to write the Data Resolution bits
of the ADC Config.Reg.1 only when ADEN = 0 (ADC disable).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-04 09:12:08 -05:00
Jordan Yates
6ec3967eaa drivers: gpio: test driver
Add a dummy driver for the `vnd,gpio` compatible to allow compilation of
drivers utilising GPIO when running "build_all" tests.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-04 09:10:40 -05:00
Yong Cong Sin
900757c3e2 drivers: watchdog: STM32G0X: clock DBGMCU before configuring
Enable the clock for the DBGMCU peripherals so that it can be
configured.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-04 09:08:00 -05:00
Tim Lin
f554fcbe4c ITE: drivers/flash: add the API of page_layout
This commit adds the API of page_layout that will make test of
test/drivers/flash pass on it8xxx2_evb board.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-01-04 09:05:45 -05:00
TOKITA Hiroshi
3787e5aab3 drivers: dac: Adds DAC support for gd32vf103
Enable DAC driver with gd32vf103 SoC.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-01-04 11:49:14 +01:00
Henrik Brix Andersen
b1b77c1774 drivers: can: change can_tx_callback_t function signature
Change the can_tx_callback_t function signature to use an "int" (not an
uint32_t) for representing transmission errors.

The "error" callback function parameter is functionally equivalent to
the return value from can_send() and thus needs to use the same data
type and needs to be able to hold negative errno values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-01 07:40:29 -05:00
Yong Cong Sin
522eff91e5 drivers: modem: gsm: Use dedicated workq
The driver performs AT commands configurations using the
system workqueue, this can delay the workqueue by up to 6
seconds to wait for the modem replies, which isn't ideal.

This PR creates a dedicated workqueue for the gsm, and
provides a helper function to reschedule work items to the
gsm workqueue.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-01 07:40:13 -05:00
Sylvio Alves
94327512a3 drivers: i2c: esp32: split stop command into a new transmission
STOP command was issued in the same transmission message
and as from esp-idf, this should be moved into a new
transmission.

Although it works in most scenarios, SHT3X sensor is one
case that presents reading error.

Closes #41385

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-01 07:39:41 -05:00
Gerard Marull-Paretas
5dc6ed3ce3 pinctrl: require ; after PINCTRL_DT_(INST_)DEFINE macros
The PINCTRL_DT_(INST_)DEFINE macros already defined the trailing ;,
making its usage inconsistent with other macros such as
DEVICE_DT_DEFINE.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-01 07:39:08 -05:00
Christoffer Zakrisson
8367df2956 drivers: i2c: sam0 Fix i2c NACK on receive
PR #38482 made the sam0 i2c send NACK when receiving a single message

Fixes #38878
Fixes #41016

Signed-off-by: Christoffer Zakrisson <rustypig91@gmail.com>
2022-01-01 07:21:22 -05:00
Gerard Marull-Paretas
8b95b259cd drivers: gpio: stm32: replace SYS_DEVICE_DEFINE with SYS_INIT
SYS_INIT can be used for the same purpose, what is being run is simply
an initialization hook.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-24 20:59:10 -05:00
Tim Lin
f9bf14f79a ITE: drivers/serial: add console input expired
If there are no console messages input at an interval of 15
seconds, the system will be able to enter suspend mode.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-12-24 20:54:16 -05:00
Emil Gydesen
b988c803f6 Bluetooth: drivers: Add length checks before net_buf_add_mem
Add length checks before calls to net_buf_add_mem
for dynamically sized data.

This should give a better error response than hitting
the __ASSERT in net_buf_simple_add.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-12-24 20:50:03 -05:00
Hake Huang
2cbdd12e9c driver: i2s: fixing build error
some build error due to adding rt11xx support without testing

update mclk enable to avoid add pinmux driver

note:
  some other PRs still in progress to full enable i2s on rt platform

this fixing: #41153

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-12-23 13:25:43 +01:00
Carlo Caione
67ef1df950 mbox: Enforce callback registration before enabling the channel
Specify in the API that the callback must be registered before the
channel is enabled, fix the NRFX IPC driver to be compliant and change
the MBOX sample.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-12-23 12:38:21 +01:00
Mateusz Kwiatkowski
e8c12f2af0 drivers: wifi: eswifi: fix socket poll timeout
Fix a problem introduced in 6ea54db334 that caused the poll operation to
take 10x more time than intended.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
2021-12-23 11:19:00 +01:00
Aditya Bhutada
e4481f82cb drivers: adc: adc_mchp_xec: update configuration register clk times
MCHP ADC configuration register need to be updated with appropriate
clock time values for high & low time clock.

Signed-off-by: Aditya Bhutada <aditya.bhutada@intel.com>
2021-12-22 13:47:18 -05:00
Henrik Brix Andersen
f92542ecf3 drivers: can: deprecate the can_attach_workq() API call
Deprecate the can_attach_workq() API call.

This API is limited in its functionality (it does not work with
userspace, it uses one common buffer size for all work queue instances).

Similar functionality can easily be implemented using the
can_attach_msgq() API along with the generic triggered work API
(e.g. using k_work_poll_submit()).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-22 18:04:02 +01:00
Henrik Brix Andersen
a1cff6f4a9 drivers: can: shell: convert from can_attach_workq() to triggered work
Convert the CAN shell from using can_attach_workq() to using
can_attach_msgq() and triggered work via k_work_poll_submit().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-22 18:04:02 +01:00
Krzysztof Chruscinski
11bbdb030d uart: nrfx_uarte: Return error when re-enabling RX
Driver was not behaving according to API description and
was not returning -EBUSY when uart_rx_enable() was called
on already enabled receiver.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-22 15:50:57 +01:00
Andrzej Głąbek
ea81b4b812 drivers: display_nrf_led_matrix: Correct calculation of pixel period
This is a follow-up to commit 4dfab40cac.

The calculation of the pixel period is done incorrectly and results
in higher than configured refresh frequency if pixels are refreshed
in groups. Fix that and lower the base frequency for the timer and
PWM so that wider range of refresh frequency can be used also with
the pixel grouping.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-12-22 15:50:44 +01:00
Marcin Niestroj
54a785b886 drivers: wifi: esp_at: don't send AT+CWLAP during initial setup
Sending AT+CWLAP was introduced with commit f2859f9501 ("drivers:
wifi: esp_at: changes to scanning") as a way to easily test introduced
changes, rather than on purpose. Remove that now, as there is no
particular reason to send it and additionally it breaks setup phase:

  <err> modem_cmd_handler: command AT+CWLAP ret:-5
  <err> wifi_esp_at: Init failed -5

with ESP-AT firmware v2.1.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-12-22 12:17:04 +01:00
Tomasz Bursztyka
c1bc5db795 drivers/pcie: Use the generic arch-interface for allocating IRQs
PCIE now uses the new interface. And pcie_alloc_irq() is only made
available when CONFIG_PCIE_CONTROLLER is unset. So only for x86 atm.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-12-22 12:16:52 +01:00
Ryan McClelland
dacae94761 drivers: avoid i2c_burst_write where possible
i2c_burst_write can have portability issues with certain i2c
peripherals that can fail when this api is called. This fixes the case
where this can be easily replaced with i2c_write in mcp230xx,
pca95xx, stmpe1600, max17055, and tmp112.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-12-22 12:14:42 +01:00
Krzysztof Chruscinski
22c4c888a5 drivers: gpio: nrfx: Use mask to determine if sense is used
So far driver was using SENSE mechanism for all or none edge
interrupts. This was not convenient since in some modules may
require IN event to be used and other did not. Converting it to
use a mask specified in the device tree. Pins indicated in the
mask will use sensing.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-22 12:03:00 +01:00
Andrzej Głąbek
4dfab40cac drivers: display_nrf_led_matrix: Add option to light LEDs in groups
Add a new DT property named "pixel-group-size" that allows users to
configure the driver to refresh the matrix by illuminating multiple
LEDs in particular rows simultaneously. This way the maximum possible
brightness of the LEDs can be increased (as they can be lit longer)
and the timer interrupt handler is executed less frequently, what
results in decreased CPU load, but more GPIOTE/PPI channels needs to
be allocated if the PWM peripheral cannot be used. Thus, it is left
to users to select the configuration that suits them best.

Update definitions of both the bbc_microbit boards with this new
property, using the maximum available group size (to achieve maximum
possible brightness). For v2, no new resources are used (only all
channels in the already used PWM peripheral are now utilized).
For v1, two more GPIOTE and PPI channels are allocated.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-12-21 17:53:38 +01:00
Marcin Niestroj
2f4fbc7621 drivers: serial: nrfx_uart: fix pin disconnect in suspend when !PINCTRL
Fix pin disconnection when COFNIG_PINCTRL=n, so that less power is used
in suspended state. This seems to be a copy-paste kind of bug, since
when both resuming and suspending the same configuration was applied.

Fixes: 5567d7ae07 ("drivers: serial: nrfx_uart: add support for
  pinctrl")

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-12-21 17:13:06 +01:00
Alexandre Bourdiol
dc3b2321f3 drivers: entropy: stm32: add health configuration support
Some STM32 series need to configure health test register
for proper RNG behavior.
In addition, some also require to write a Magic number
before writing the configuration.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-12-21 17:09:02 +01:00
Johann Fischer
44585b7fc5 drivers: mb_display: rework bbc:microbit display support
Rework bbc:microbit display support to use nRF LED matrix
display controller driver and allow to use it with
bbc:microbit v2 board.

This patch turns the driver into a higher level driver
using the display controller API. Code that directly
accesses hardware (GPIO) is removed.
This driver is reworked to be more generic. It still
has a lot of potential for improvement, but it requires
changes in all applications that use this tool.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-21 17:06:03 +01:00
Johann Fischer
de072e47b0 drivers: nrf_led_matrix: enable driver if compatible is enabled
Enable nRF LED matrix display controller driver if compatible
devicetree node is enabled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-21 17:06:03 +01:00
Carles Cufi
38ce8d615d Revert "drivers: timer: extend nrf_rtc_timer"
This reverts commit 26e297572a.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-20 21:04:26 +01:00
Yong Cong Sin
26f7b9c1ea drivers: sensor: Add MH-Z19B CO2 sensor driver
Add MH-Z19B CO2 sensor driver.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
Co-Authored-By: Azamlukman <azamlukmanabdullah@gmail.com>
2021-12-20 18:47:47 +01:00
Michael Schmidt
557870c05f drivers: virt_ivshmem: Allow multiple instances of ivShMem devices.
- Supporting multiple instances of ivShMem virtual devices.
- Introduces DT based configuration for ivShMem devices.
- Add DTS overlay file to test new multiple ivshmem instance capability.
- Enable BDF unspecified device initialization.
  (limited to one instance. An improved version of pcie_bdf_lookup()
  will come soon that fixes this limitation)
- Make PCIE DTS file macros available for a proper ivshmem device
  properties parsing.

Sample for dts file:
pcie0 {
	label = "PCIE_0";
	#address-cells = <1>;
	#size-cells = <1>;
	compatible = "intel,pcie";
	ranges;
    ivshmem0: ivshmem@800 {
	    compatible = "qemu,ivshmem";
	    reg = <PCIE_BDF_NONE PCIE_ID(0x1af4,0x1110)>;
	    label = "IVSHMEM";
	    status = "okay";
    };
};

Signed-off-by: Michael Schmidt <michael1.schmidt@intel.com>
2021-12-20 19:42:27 +02:00
Dominik Ermel
8e001191ce drivers/flash/nrf_qspi_nor: Default write_from_nvmc buffer size to 4
The commit changes the default size of write_from_nvmc,
defined by CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE, to 4,
making the write_from_nvmc operation enabled by default.
The Kconfig description for the option has been changes more clearly
describe how does the option impact compilation.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-12-20 17:52:00 +01:00
TOKITA Hiroshi
7e80c74f95 drivers: serial: Add USART support for GD32V
Modifying configuration to enable with gd32vf103

- Add usart definition to devicetree.
- Define USART_STAT as alias of USART_STAT0 if not defined it.
- Enable USART if SOC_SERIES_RISCV_GIGADEVICE_GD32VF103.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2021-12-20 17:51:30 +01:00
TOKITA Hiroshi
5c7a0ef888 drivers: interrupt-controller: add Nuclei ECLIC driver
Add support for the ECLIC interrupt controller
which is used with the Nuclei processor core.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2021-12-20 17:51:30 +01:00
TOKITA Hiroshi
949d4b91d9 drivers: pinctrl: Support pinctrl with GD32VF103
Change the settings to support pinctrl on the GD32VF103.

- Split soc/arm/gigadevice/common/pinctrl_soc.h
  and put it into include/dt-bindings.
- Leave some definitions that can't handle with device tree compiler
  in pinctrl_soc.h.
- Remove dependency to SOC_FAMILY_GD32 because always enabled it
  if GD32_HAS_AF(IO)_PINMAX was selected.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2021-12-20 17:51:30 +01:00
TOKITA Hiroshi
d79d4f0bea riscv_machine_timer: Enable to use divided clock for the machine timer
GD32V SoC uses divided clock from core-clock for machine timer clock.
Add config of clock divide factor to support GD32V.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2021-12-20 17:51:30 +01:00
Lukas Gehreke
53dea67733 drivers: modem: Added simcom sim7080 modem driver.
Implemented driver for the simcom sim7080 modem.
This driver features Socket offloading, TCP, UDP, DNS,
SMS, GPS and FTP.

Signed-off-by: Lukas Gehreke <lk.gehreke@gmail.com>
2021-12-20 17:48:47 +01:00
Alexander Wachter
11d340f9c5 drivers: can: m_can: fix alignmed issues
Make sure that all access to the msg_sram
is 32 bit aligned.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-12-20 17:46:24 +01:00
Jun Lin
c097b8f80e drivers: uart: npcx: fix the coding style
Fix the coding style by clang-format.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-12-20 17:43:58 +01:00
Jun Lin
db74010cc7 drivers: uart: npcx: use PM constraint for the receiving
In this commit, the driver sets the PM constraint to prevent the system
from entering the suspend state for a CONFIG_UART_CONSOLE_INPUT_EXPIRED
period when data come in. The constraint releases after the
CONFIG_UART_CONSOLE_INPUT_EXPIRED time expires, .

With this change, the PM policy doesn't have to check the timestamp
by calling npcx_power_console_is_in_use() explictly. So the related
npcx_power_console_is_in_use*() functions can be removed.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-12-20 17:43:58 +01:00
Pete Dietl
2b62282d46 drivers: sensors: tmp112 fix config register updating
The function that sets the driver's state of the sensor's
config register has a bug. This commit fixes that.

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2021-12-20 17:42:33 +01:00
Francois Ramu
188c8c47a8 drivers: spi: stm32 spi driver using ll_func as defined in the header
Instead of checking the SPI register flags, the spi_ll_stm32.h
has dedicated functions for that purpose.
They are abstracting the STM32 registers of SPI instance.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-12-20 17:42:17 +01:00
Jedrzej Ciupis
26e297572a drivers: timer: extend nrf_rtc_timer
This commit introduces the following changes:

* nrf_rtc_timer is extended with a capability to handle RTC overflow,
allowing it to operate on absolute RTC ticks, rather than relative
ticks.
* overflow handling is ZLI-proof and relies on the sys clock
handler being executed twice every RTC counter's overflow.
* callbacks are given an absolute RTC tick value as a parameter instead
of CC register's value. The absolute RTC tick value is the RTC counter
value set during CC channel configuration extended to 64 bits.
* in case the timer's target time is in the past or is the current tick,
the timer fires as soon as possible, however still from the RTC's ISR
context.
* in case an active timer is set again with the same target time, it is
not scheduled again - only its event data is updated. Otherwise, the
timer is scheduled as usual.
* a scheduled timer can be aborted.
* system clock functions are now using 64 bit values internally.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Paweł Kwiek <pawel.kwiek@nordicsemi.no>
2021-12-20 16:25:49 +01:00
Carles Cufi
02cee09308 drivers: bluetooth: spi: Check lengths in incoming headers
So far the lengths provided in event and ACL packets were not being
checked at all, which could have caused an overflow if the contents were
not to fit inside the net_buf.
Check the length and discard the packet when it doesn't fit.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-20 15:24:02 +01:00
Armando Visconti
34fed86b2b drivers/sensor: lsm6dso: Add power mode properties to DTS
Add power mode properties for bot accelerometer and gyrometer
to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-12-18 07:58:50 -05:00
Armando Visconti
18e8cadaf9 drivers/sensor: lsm6dso: Move odr/range Kconfig property into dts
Move odr and range properties for both accelerometer and gyro
from Kconfigs to Device Tree.
Fixes #41117

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-12-18 07:58:50 -05:00
Jimmy Johnson
5fda6a3b2f sample: sensor: tmp108: Add ti tmp108 sample
This sample writes the tmp108 temperature to the console
once every 3 seconds. There are macro definitions included
for turning off and on alerts if that is set up, and
also using low power one shot mode.

Signed-off-by: Jimmy Johnson <catch22@fastmail.net>
2021-12-17 21:15:25 +01:00
Jimmy Johnson
5c28b218fa drivers: sensor: add ti tmp108 driver support
Adding support for the TI TMP108 temperature sensor. This includes
over/under temp interrupt support as well as one shot, continuous
conversion and power down modes.

Signed-off-by: Jimmy Johnson <catch22@fastmail.net>
2021-12-17 21:15:25 +01:00
Felipe Neves
d170079815 wifi: esp32: disable wifi driver
when SMP support is selected.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-12-17 13:59:31 -05:00
Abel Radenac
e8fa6b3f08 drivers: dma_stm32: init DMA struct in dma_stm32_configure
The init struct for DMA peripheral is allocated in stack
and must be initialized (e.g. with LL_DMA_StructInit here)
to avoid loading undefined values in the DMA peripheral
registers.

Signed-off-by: Abel Radenac <a.radenac@lacroix-sofrel.com>
2021-12-17 11:52:22 -06:00
Gerard Marull-Paretas
9f5de86e8a drivers: display: st7735r: replace non-existing DT_INST_HAS_PROP
DT_INST_HAS_PROP macro is not available, DT_INST_NODE_HAS_PROP needs to
be used instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
56e325ca83 drivers: wifi: esp_at: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
4b511eb520 drivers: syscon: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
e3d4c2c278 drivers: serial: nrfx_uart: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
5350121e64 drivers: serial: gd32: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
ad0855187a drivers: sensor: tmp112: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
677050d46d drivers: sensor: max17262: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
bda8878b03 drivers: pwm: stm32: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
45a3985170 drivers: pwm: nrf5_sw: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
59fe6b8235 drivers: kscan: it8xxx2: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
fa63671ff7 drivers: i2s: mcux_sai: use instance based macros
Replace usages of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
b9d573f622 drivers: gpio: nct38xx_alert: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
56c2c1f7c1 drivers: gpio: mcp23sxx: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
38e827dab1 drivers: gpio: mcp230xx: use instance based macros
Replace usage of DT_DRV_INST(n) with instance based macros where
possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
4e7b4e65af drivers: gpio: mchp_xec_v2: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
eb9eae4efc drivers: flash: spi_nor: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
0fb27f3adb drivers: flash: nrf_qspi_nor: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
3ef533341b drivers: flash: at45: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
7a4d3f72f9 drivers: ethernet: phy_mii: use instance based DT macros
Replace usages of DT_DRV_INST(n) with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
b7ee4e2951 drivers: eeprom: emulator: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
d4a5a633a6 drivers: dma: mcux_edma: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
0feb972a30 drivers: counter: sam_tc: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
6512eddc5c drivers: counter: rtc_mcp7940n: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
fa67177a7f drivers: counter: mcux_pit: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
159c2ed574 drivers: counter: ll_stm32_timer: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Andrzej Głąbek
e7f7e955b3 drivers: display: Add support for LED matrix driven by nRF SoC GPIOs
Add a display driver and the corresponding devicetree binding for a LED
matrix with rows and columns driven by nRF SoCs GPIOs. Such matrix can
be found, for example, in the BBC micro:bit boards.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-12-17 15:48:08 +01:00
Julien D'ascenzio
4f9c79c867 drivers/uart: stm32: don't call k_yield on poll_out
Some tests like:
    tests/kernel/sched/metairq/kernel.scheduler.metairq
    tests/kernel/profiling/profiling_api/kernel.common.profiling
    tests/kernel/sched/schedule_api/kernel.scheduler
    tests/kernel/sched/schedule_api/kernel.scheduler.multiq
    tests/kernel/profiling/profiling_api/kernel.common.profiling
    tests/kernel/workq/work_queue/kernel.workqueue

don't support that the current thread change when writing a message with
printk (which uses poll_out). So, we remove the call to k_yield which is
useful only for optimizing cpu usage by forcing a thread change if the
usart send stack is full.

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2021-12-16 20:42:00 -05:00
Gerard Marull-Paretas
3e9d8da9ec drivers: use DT_INST_PARENT
Replace usages of DT_PARENT(DT_DRV_INST(idx)) with more idiomatic
DT_INST_PARENT(idx).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 11:10:01 -06:00
Gerard Marull-Paretas
a6398f0932 drivers: gpio: stm32: improve initialization
Call `gpio_stm32_clock_request` unconditionally with "true" if no
runtime PM is enabled, "false" otherwise. In case the GPIO was enabled
(e.g. by a bootloader), the device will be left in proper state when
runtime PM is enabled.

Also added pm_device_runtime_init_suspended to indicate that device is
in a suspended state (will prevent pm_device_runtime_enable to suspend
the device again).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Gerard Marull-Paretas
776ecf4b73 drivers: gpio: stm32: do not expose gpio_stm32_clock_request
The function is only used by the driver itself. This likely comes from
pre-runtime PM API usage.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Gerard Marull-Paretas
a9ae700695 drivers: gpio: stm32: introduce gpio_stm32_configure_raw
Make gpio32_stm32_configure use runtime PM API (so that it can be used
externally without further effort). The raw version of the function (no
PM put/get) has been introduced for internal use.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Gerard Marull-Paretas
a7a6a86505 drivers: gpio: stm32: use synchronous put
The suspend operation for this device is a clock gating operation (i.e.
fast), so use synchronous put to skip unnecessary overhead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Gerard Marull-Paretas
392b20f2a5 drivers: pinmux: stm32: remove runtime PM get/put guards
The PM runtime API (get/put) provides an inline implementation when not
built-in. Such implementation always returns 1, so it is safe to not
guard PM runtime calls and check for < 0.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Gerard Marull-Paretas
53f17da351 drivers: gpio: stm32: remove runtime PM get/put guards
The PM runtime API (get/put) provides an inline implementation when not
built-in. Such implementation always returns 1, so it is safe to not
guard PM runtime calls and check for < 0.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
HaiLong Yang
ba9c3a4d88 drivers: dac: introduce gd32 dac driver
Add DAC driver for gd32 series SoCs.

Signed-off-by: HaiLong Yang <cameledyang@pm.me>
2021-12-16 10:13:56 +01:00
Jun Lin
f7c2f4fd94 driver: i2c: npcx: adjust parameters for better I2C timing at 100 KHz
The original parameter (k1) setting may let the I2C frequency be a
little bit higher than 100k Hz, which causes the timing Tsu:sta (set-up
time for a repeated START) to violate the spec. This change fixes the k1
parameter and also changes the HLDT to the suggested value in the
datasheet.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-12-15 14:56:36 -06:00
Pete Dietl
bc1b262885 drivers: adc: stm32: Disable ADC before calibration
The STM32 docs state that the ADC may not be calibrated unless
the ADC is disabled (ADEN=0). This commit implements this constraint

Fixes #40936

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2021-12-15 14:39:31 -06:00
Andy Ross
9ac2c214eb soc/intel_adsp: Remove adsp/io.h
More dead code.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-12-14 18:43:05 -06:00
Flavio Ceolin
18b932f10d pm: device_runtime: Return possible error on enable
Change the function pm_device_runtime_enable() to return 0 on
success or an error code in case of error.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-14 19:23:05 -05:00
Bartosz Bilas
0bd304f9d9 drivers: sensor: ina23x: add support for INA237
Add the new driver for INA237 variant which is
quite similar to the already supported INA230.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-12-14 13:48:54 -06:00
Bartosz Bilas
2df7140947 drivers: sensor: ina230: driver refactoring
Create an explicit ina230 driver which is supposed to
work with 230 and 231 variants. While at it switch
to i2c_dt_spec helpers and change device-tree node
names to use - instead of _ in order to follow
convention.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-12-14 13:48:54 -06:00
Bartosz Bilas
f50c7ab542 drivers: sensor: ina23x: add ina23x common module
That's needed to not duplicate code between INA230/231
and the upcoming INA237 variant.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-12-14 13:48:54 -06:00
Yuriy Vynnychek
8ef807f624 drivers: ieee802154: b91: Fix Set Channel API and ACK detection
- B91 SoC requires to set RX mode again if channel is changed
- Fixed wrong ACK packet detection, mask should be used

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-12-14 13:47:25 -06:00
Yuriy Vynnychek
a696a55e3b drivers: serial: b91: fifo_fill API update to check fifo size
Updated fifo_fill API to check TX/RX data registers size

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-12-14 13:47:25 -06:00
Guillaume Lager
ba7e70e0bc drivers: console: gsm_mux: fix length indicator
The MSB and LSB were inverted for length > 127
Fixes #41077

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-12-14 13:44:48 -06:00
Johann Fischer
72cbc04a73 drivers: ramdisk: add checks for the upper boundary
Add checks for the upper boundary in access_read/access_write
instead of the homeopathic ASSERTS.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-14 13:40:47 -06:00
Armando Visconti
56b435f2bf drivers/sensor: lps22hh: Move odr Kconfig property into dts
Move odr options from Kconfigs to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-12-14 09:11:15 -06:00
Armando Visconti
177b53a944 drivers/sensor: lps22hh: Add multi-instance support
This commit aligns lps22hh sensor driver to latest multi
instance sensor driver model.

In particular it makes use of the stmemsc common routines
and move ctx handler inside struct config, so that the
bus_init routines can be totally avoided.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-12-14 09:11:15 -06:00
Johann Fischer
64751220bd drivers: usb: allow to disable option USB_DEVICE_REMOTE_WAKEUP
This flag may cause host to more ambitious power saving behavior,
not all Zephyr USB classes or applications may be ready for this
now. Allow to disable option USB_DEVICE_REMOTE_WAKEUP.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-14 09:08:58 -05:00
Alex Sergeev
40b81e6b76 drivers: ethernet: stm32: PTP L2 timestamping support
Add support for IEEE 1588-2008 (PTP L2) for STM32F7 and STM32H7
families.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2021-12-13 22:19:25 -05:00
Dino Li
03fea69272 driver: espi: it8xxx2: enable CONFIG_ESPI_FLASH_CHANNEL
This enable eSPI flash channel.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-12-13 20:33:47 -05:00
Ryan McClelland
ecf99abc17 drivers: gpio: set all on-chip gpios to PRE_KERNEL_1/2 init
PRE_KERNEL_1 is to be used for devices that have no dependencies
and do not use kernel features, such as those that rely solely on
hardware present in the processor/SOC. This commit updates these
gpios to initialize during the PRE_KERNEL_1 rather than the
POST_KERNEL. Some SoC drivers are moved to PRE_KERNEL_2 due
to dependencies.

A lot of 'other' drivers can depend on GPIOs though phandles
(such as reset lines, data or command gpios, etc...). Most of these
drivers that would need this would come up on the POST_KERNEL,
and it's likely the driver may not be up yet as it should be defined.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-12-13 20:31:28 -05:00
Daniel DeGrasse
1328abe052 drivers: disk: USDHC: Update USDHC driver to pass disk test
USDHC driver did not pass disk test (failed during multiple writes). Add
logic to wait for the SD card to be idle before reading new data, so
that the test will pass. Also, add logic to reject OOB reads and writes
to the disk.

Fixes #39942

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-13 20:30:06 -05:00
HaiLong Yang
b009cc2e18 drivers: pinctrl: add gd32f350 gpio opspeed check
Add compile time check for gd32f350 gpio opspeed.

Signed-off-by: HaiLong Yang <cameledyang@pm.me>
2021-12-13 20:27:30 -05:00
HaiLong Yang
3b72a9b2bd drivers: serial: gd32 usart support GD32F350
GD32 HAL use two USART status register name, USART_STAT and USART_STAT0.
This add a redefine to make USART_STAT as defaut name.

Signed-off-by: HaiLong Yang <cameledyang@pm.me>
2021-12-13 20:27:30 -05:00
Daniel DeGrasse
fa56e9ee2b drivers: mcux_gpt_timer: Added GPT timer for HW clock
Added a driver to enable the GPT timer on RT1xxx parts to be used
instead of systick as a clock source. The timer is set to run in reset
mode, and uses the low frequency 32kHz oscillator for power savings

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-13 20:13:21 -05:00
Aymeric Aillet
903c78c207 driver: i2c: TCA954X: Add support for TCA9548A
Add support for the 8 channels TCA9548A I2C mux.
Added a new binding ti,tca9548a binding inheriting
properties from ti,tca954x-base and defining its own compatibles fields.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-12-13 18:07:08 +01:00
Aymeric Aillet
ee1d849c4e driver: i2c: TCA954X: Add support for "reset-gpios"
Add an optional "reset-gpios" phandle-array
field to the driver common yaml.
The reset GPIO channel and pin can be defined
in device tree as a node property.
The driver then deassert the reset signal at mux
initialization if a "reset-gpios" has been specified.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-12-13 18:07:08 +01:00
Aymeric Aillet
50540ed594 driver: i2c: TCA9546A: Rename to TCA954x
Prepare the driver to upcoming support of more mux references.
Rename all TCA9546A related files to TCA954x.
Keep ti,tca9546a and ti,tca9546a-channel compatible
for backward compatibility reasons.
New tca954x-base binding embedding common properties,
tca9546a binding inherits from it and define its own compatibles fields.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-12-13 18:07:08 +01:00
Armando Visconti
13bf2e5e48 drivers/sensor: stmemsc: make use of i2c/spi dt APIs
Make use of the i2c and spi DT APIs introduced in
2946a535 and c894ad12 that get i2c_dt_spec and spi_dt_spec
as input arguments.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-12-13 10:21:43 -06:00
Kent Hall
ba37d5935e drivers: counter: Counter API implementation for STM32F4 Series (TIMER).
- Shim for counter API using LL_TIM driver.
- Supports all general-purpose (TIMx) timers.

Signed-off-by: Kent Hall <kjh2166@columbia.edu>
2021-12-11 14:20:17 -05:00
Carles Cufi
2bc9cb4691 sensor: bmi160: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/__w/zephyr/zephyr/drivers/sensor/bmi160/bmi160.c: In function
bmi160_gyr_channel_get:
/__w/zephyr/zephyr/drivers/sensor/bmi160/bmi160.c:795:23: error: taking
address of packed member of struct <anonymous> may result in an
unaligned pointer value [-Werror=address-of-packed-member]
  795 |           data->sample.gyr, val);
      |           ~~~~~~~~~~~~^~~~
/__w/zephyr/zephyr/drivers/sensor/bmi160/bmi160.c: In function
bmi160_acc_channel_get:
/__w/zephyr/zephyr/drivers/sensor/bmi160/bmi160.c:807:23: error: taking
address of packed member of struct <anonymous> may result in an
unaligned pointer value [-Werror=address-of-packed-member]
  807 |           data->sample.acc, val);
      |           ~~~~~~~~~~~~^~~~

To avoid the warning, make the struct non-packed, since it is not
necessary in this case given that a union already guarantees that the
pointer to the union points to each member of the union equally..

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Carles Cufi
710e03b990 gpio: sx1509b: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/__w/zephyr/zephyr/drivers/gpio/gpio_sx1509b.c: In function
'port_write':
/__w/zephyr/zephyr/drivers/gpio/gpio_sx1509b.c:456:19: error: taking
address of packed member of 'struct sx1509b_pin_state' may result in an
unaligned pointer value [-Werror=address-of-packed-member]
  456 |  uint16_t *outp = &drv_data->pin_state.data;

To avoid the warning, use an intermediate void * variable.

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Johann Fischer
307c13b218 drivers: display: remove unused Kconfig options
remove unused options SDL_DISPLAY_* and DUMMY_DISPLAY_*.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:30 +01:00
Johann Fischer
2d175d14f3 drivers: display_dummy: rework to obtain configuration from devicetree
Add bindings for dummy display controller.
Rework dummy display controller driver to obtain
configuration from devicetree. Remove unnecessary casts,
add multi-instance support.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:30 +01:00
Johann Fischer
dee50e9aae drivers: display_sdl: rework to obtain configuration from devicetree
Add bindings for SDL based display controller.
Rework SDL based display controller driver to obtain
configuration from devicetree. Remove unnecessary casts,
add multi-instance support.

Add display controller node and chosen property
to native_posix devicetree.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:30 +01:00
Johann Fischer
5e722c4368 drivers: ssd16xx: fix driver initialization
ssd16xx driver is not well designed and does not pass configuration
via device->config but via struct ssd16xx_data, this was not taken
into account in the commit 4d6d50e2bc
("display: ssd16xx: convert to spi_dt_spec").

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:30 +01:00
Glauber Maroto Ferreira
d8bafe47e6 esp32: drivers: gpio: remove pin offset
this allows using a pin numbering scheme as per Espressif's
documentation and HAL usage, where pin counting does not wrap
up when reaching a given number.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-12-09 19:57:10 -05:00
Erwan Gouriou
6787566e3d drivers/clock_control: u5: Add utility to set voltage scaling
Voltage scaling computation should be done in multiple cases.
Add a function that takes into account all cases.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-12-09 19:45:41 -05:00
Brad Rushbrook
6d0e83f89e eth: Add promiscious mode support to stm32 ethernet abstraction
Simply adds the definitions in the stm32 hal to define ethernet
promiscious mode.

Signed-off-by: Brad Rushbrook <rushybrook@gmail.com>

Fixes error and resetting promisc mode, adds support for STM23H7x

Signed-off-by: Brad Rushbrook <rushybrook@gmail.com>

Co-authored-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>

Readability improvement; coding-style compliance

Signed-off-by: Brad Rushbrook <rushybrook@gmail.com>

Co-authored-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-12-09 19:32:25 -05:00
Henrik Brix Andersen
f499559434 drivers: can: deprecate the use of CAN-specific error return values
Deprecate the use of CAN-specific error return values and replace them
with standard errno values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-09 12:37:40 -05:00
Wealian Liao
3cdf684cd9 driver: timer: npcx_itim: Add timer initialization
The init responsibility moves to the drivers themselves. The npcx itim
initialize doesn't work now. This adds timer initialization for npcx
itim to fix it.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-12-09 11:13:06 -06:00
Pete Dietl
a1bf02e519 drivers: sensors: tmp112: Remove extra I2C reads
The original code erroneously used:
uint16_t *val;
sizeof val
instead of:
sizeof *val;
This commit fixes this problem and removes an unnecessary
buffer from the stack

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2021-12-09 10:27:47 -06:00
Bartosz Bilas
cf8e974bec drivers: sensor: max6675: convert to spi_dt_spec
Convert max6675 driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-12-09 10:21:13 -06:00
Bartosz Bilas
68080c1269 drivers: sensor: icm42605: convert to spi_dt_spec
Convert icm42605 driver to use spi_dt_spec helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-12-09 10:20:41 -06:00
Krzysztof Chruscinski
c27ac38cf8 drivers: gpio: nrfx: Implementation based on new nrfx_gpiote driver
Converting driver to shim which is using nrfx_gpiote driver
underneath.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-09 16:51:28 +01:00
Mahesh Mahadevan
0a2464b89f drivers: ethernet: Add support for new PHY API
SDK 2.10 changed the PHY API. These updates are
needed as part of moving to SDK 2.10

1. add phy / mdio ops init
2. update PHY_Read/Write HAL call

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-12-09 09:18:10 -06:00
Sylvio Alves
81f5ced9fe drivers: gpio: esp32: use rtcio to config pins
Set gpio driver to use RTCIO interface to configure
output strength of necessary output pins.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-12-08 17:19:21 -05:00
Sylvio Alves
f00a0a9e06 drivers: pinmux: esp32: use rtcio to control pull up/down
Set pinmux driver to use RTCIO interface for to handle
dedicated IOs pull-up/down configuration.
Without this, some GPIOS won't have pull-up enabled
properly.

Also, current implementation automatically disables
output pin when input pin is set. It also performs the
oppositte. This PR changes it only to enable what is
requested, either input or output.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-12-08 17:19:21 -05:00
Sylvio Alves
23d581d44c drivers: i2c: esp32: remove unused irq_line and add end packet
irq_line and irq_enabled call is not necessary as the interrupt
allocater enables it during its initialization.

it also adds end packet to all write transmission instead
of only at the end (burst data scenario)

Add check in gpio configuration check to avoid wrong gpio pins

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-12-08 17:19:21 -05:00
Johann Fischer
eeb4434d2e drivers: ieee802154_dw1000: use dedicated workqueue
Driver has dedicated workqueue for IRQ processing.
Submit work to dedicated workqueue intead of system workqueue.
It also fixes driver functionality when NET_TC_TX_COUNT is set to 0.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-08 10:06:20 -05:00
Gennady Kovalev
b49766f001 drivers: clock_control: More power supply modes for STM32H7
STM32H7 has different power supply modes but now Zephyr supports just LDO
and direct SMPS. This commit introduses POWER_SUPPLY_CHOICE configuration
parameter and add support for missed power supply modes.

Signed-off-by: Gennady Kovalev <gik@bigur.com>

Fixes #40730.
2021-12-08 09:12:12 -05:00
Julien D'ascenzio
e4234aeb89 drivers/uart: stm32: fix dead lock on poll_out
A dead lock could happen if 2 threads with differents priorities use
poll_out. In fact, the lock data->tx_lock could be lock by a thread with
lower priority and then a thread with higher priority can't take the
lock. There was a race condition here:

/* Wait for TXE flag to be raised */
while (1) {
	if (atomic_cas(&data->tx_lock, 0, 1)) {
		/* !!!!!!!! RACE CONDITION !!!!!!!!!!!!!!
		if (LL_USART_IsActiveFlag_TXE(UartInstance)) {
			break;
		}
		atomic_set(&data->tx_lock, 0);
	}
}

To fix race condition, the interrupts are locked in poll_out.

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2021-12-08 08:56:18 -05:00
Peter Johanson
a5ad94f20f driver: gpio: mcp23xxx: Refactor to generic.
Refactor the mcp230xx driver to generically also support
SPI IO expanders, renaming it to mcp23xxx in the process.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
2021-12-08 08:55:28 -05:00
Guillaume Lager
972e5d0274 sensor: eeprom: Add TMP116 EEPROM access
eeprom access is supported by using
either custom or eeprom API

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-12-08 07:51:46 -06:00
Jay Vasanth
fd43c725d2 drivers: spi: Add MEC172x QMSPI-LDMA driver
Add driver for MEC172x QMSPI with local DMA(LDMA). The driver
support SPI asynchronous operation.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2021-12-08 08:43:05 -05:00
Daniel DeGrasse
20eed64030 drivers: edma: update MCUX dma driver for multi-instance
Updates mcux edma driver to handle multiple DMA instances correctly.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:40:06 -05:00
Daniel DeGrasse
11e4690bdd drivers: clock_control: Add LPSR clock for EDMA
Adds ccm clock config for EDMA1 clock

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:40:06 -05:00
Daniel DeGrasse
4d4939c4e1 boards: mimxrt1060_evk_cm7: Enable DMA controller on RT1160 EVK
DMA controller is enabled and tested for cortex M7 core. The M7 core was
tested on the loop and channel link transfer tests.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:40:06 -05:00
Daniel DeGrasse
cae297d917 drivers: pca9420: added support for current limit setting on PCA9420
Added ability to set VIN current limit when using the pca9420 PMIC

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Daniel DeGrasse
423dff8a51 drivers: pca9420: Added voltage level support for PCA9420
This commit adds support for editing the voltage levels on the buck
regulators on the PCA9420 PMIC

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Daniel DeGrasse
130f6eb816 drivers: regulator: add i2c regulator driver
This commit adds a generic i2c regulator driver, and enables the NXP
PCA9420 PMIC IC using this driver. The regulator driver also exposes an
additional API in include/drivers/regulator/consumer.h, which allows
drivers to implement support for adjusting voltage levels and current
limits, if their device supports it.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Daniel DeGrasse
b18aefdfd3 dts: rt685: enabled flexcomm15
the RT685 contains an additional flexcomm peripheral, that supports
only I2C. This commit adds this peripheral to the device tree,
and enables pins and clocks for flexcomm15.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
c6a74a5e5f drivers/flash: sam0: only use a semaphore if multitasking is enabled
This lets the driver be used in single threaded applications such as a
bootloader.

Signed-off-by: Michael Hope <mlhx@google.com>
2021-12-07 19:29:07 -05:00
Henrik Brix Andersen
b21a91e468 drivers: can: catch up on API naming changes
Catch up on the CAN driver API argument naming changes:
- Unify naming of callback function pointers as "callback".
- Unify naming of user-specified callback function arguments as
  "user_data".
- Instances and pointers to struct zcan_frame are named "frame",
  not "msg", to avoid confusion with the CAN message queue support.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-07 15:39:06 -05:00
Dmytro Firsov
31b4e4124d xenvm: drivers: serial: Add consoleio Xen serial driver for Domain 0
This commit adds Xen consoleio serial driver. It is needed to receive
kernel messages from Zephyr in case it runs as Xen privileged domain
(Dom0). There is no console ring buffer for such domain, so regular
uart_hvc_xen driver can not be used (privileged domain input/output
are possible only through consoleio interface).

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2021-12-07 12:15:38 -05:00
Dmytro Firsov
d63a10da54 xenvm: drivers: serial: add interrupt-driven API for Xen PV console
This commit adds support of interrupt-driven API for UART-like Xen PV
console driver. It is implemented via Xen event channels. It allows to
send and receive data by chunks (not single symbols) and without
polling.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2021-12-07 12:15:38 -05:00
Dmytro Firsov
01a9b117fe xenvm: arm64: add Xen Enlighten and event channel support
This commit adds support of Xen Enlighten page and initial support for
Xen event channels. It is needed for future Xen PV drivers
implementation.

Now enlighten page is mapped to the prepared memory area on
PRE_KERNEL_1 stage. In case of success event channel logic gets
inited and can be used ASAP after Zephyr start. Current implementation
allows to use only pre-defined event channels (PV console/XenBus) and
works only in single CPU mode (without VCPUOP_register_vcpu_info).
Event channel allocation will be implemented in future versions.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2021-12-07 12:15:38 -05:00
Ryan McClelland
4e5bd204fd drivers: gpio: revert kconfig init priority for off-chip gpios
In #40140, all on-chip gpios where made to use `CONFIG_GPIO_INIT_PRIORITY`.
The lmp90xxx and sx1509b are off-chip gpios. This commit reverts those
changes for these two devices.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-12-07 09:53:45 -06:00
Pieter De Gendt
4d161a3b23 drivers: counter: NXP SNVS rtc: Add support for NXP imx SNVS RTC
Adds a driver using the SNVS high power and optionally low power
RTC instances. A device specific function `mcux_snvs_rtc_set` is
provided to update the current counter value.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-12-07 09:45:43 -06:00
Keith Short
f7005599ff spi: npcx_fiu: Update the SPI context
Update the SPI context during all transceive functions. This fixes a
deadlock where SPI transactions failed to give back the semaphore.

Verified on NPCX9 based Chromebook.

Signed-off-by: Keith Short <keithshort@google.com>
2021-12-07 09:44:34 -06:00
Casper Meijn
2b618bdb5c drivers: display: st7789v: Use device * for internal functions
The internal functions of this driver needed either `device *`
or `st7789v_data *` as argument. Standardize to
using `device *`.

Signed-off-by: Casper Meijn <casper@meijn.net>
2021-12-07 09:38:43 -06:00
Daniel DeGrasse
57f35bbf5a drivers: USDHC: Enable detection using DAT3 pulldown
Enable USDHC host to detect inserted SD card via DAT3 line pulldown.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-06 15:27:25 -05:00
Daniel DeGrasse
4712913872 drivers: USDHC: Update USDHC driver for RT11xx SOCs
RT11xx USDHC lacks some watermarking features that RT10xx SOCs include.
Place #ifdef guards around these features.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-06 15:27:25 -05:00
Alexander Wachter
3f500df975 drivers: can: can_net: Fix build issue after #38501
Fixing build issue introduced by PR #38501

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-12-06 08:15:14 -05:00
Casper Meijn
7dfdaf4ab7 drivers: display: st7789v: Remove explicit cast
Remove explicit cast of `data`.

Signed-off-by: Casper Meijn <casper@meijn.net>
2021-12-06 08:04:26 -05:00
Marc Reilly
54b6d26242 drivers: spi: add spi-bitbang driver
This adds an spi master mode driver via bitbanged gpio. Only syncronous
transfers are implemented. Clock signal timing is accomplished via busy
waits, the gpios are manipulated via the standard gpio interface; these
two factors limit the frequency at which it can operate - but here
a simple and generic implementation was chosen over performance.

The driver supports the various clock polarity and phase
configurations, and can also work with word sizes which are non
multiples of 8bits, currently up to 16 bits.

A sample program is also added demonstrating basic use of the driver
with 9bit data words.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
2021-12-06 07:29:45 -05:00
Gerard Marull-Paretas
5ab7d35e7c pm: state: PM_STATE_DT_ITEMS_LIST->PM_STATE_LIST_FROM_DT_CPU
Rename the PM_STATE_DT_ITEMS_LIST macro to PM_STATE_LIST_FROM_DT_CPU to
make its purpose more clear. Similar naming scheme is found e.g. in the
GPIO API.

Associated internal macros and docstrings have been adjusted, too.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 12:33:57 -05:00
Gerard Marull-Paretas
493b6786ab drivers: timer: fix MISRA 5.7 violation
A couple of drivers violated MISRA 5.7 rule (Tag name should be unique),
triggering CI compliance errors.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 07:34:53 -05:00
Gerard Marull-Paretas
7d1bfb51ae drivers: timer: cortex_m_systick: improve ISR installation
A Cortex-M specific function (sys_clock_isr()) was defined as a weak
function, so in practice it was always available when system clock was
enabled, even if no Cortex-M systick was available. This patch
introduces an auxiliary Kconfig option that, when selected, the ISR
function gets installed. External SysTick drivers can also make use of
this function, thus achieving the same functionality offered today but
in a cleaner way.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 07:34:53 -05:00
Gerard Marull-Paretas
78dc8ce338 drivers: timer: improve sys_timer_disable usage
- Remove the weak symbol definition
- Notify about the capability of disabling via a selected Kconfig option
  (CONFIG_SYSTEM_TIMER_HAS_DISABLE_SUPPORT)
- Provide a dummy inline function when the functionality is not
  available

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 07:34:53 -05:00
Gerard Marull-Paretas
24a169e329 drivers: timer: split Kconfig
Split Kconfig into individual files for each driver. This improves
overall readability of the Kconfig options.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 07:34:53 -05:00
Gerard Marull-Paretas
b1ced75386 drivers: timer: move initialization setup to drivers
The weak symbol sys_clock_driver_init has been removed, therefore moving
the init responsability to the drivers themselves. As a result, the init
function has now been made static on all drivers and moved to the
bottom, following the convention used in other areas.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 07:34:53 -05:00
Tom Burdick
7b1349cfe6 stats: i2c: I2C stats
Adds the ability for I2C drivers to report synchronous transfer stats
using a I2C specific macro to define the device instance.

The macro creates a container for device_state which allows for per
instance device class common data structure to be used in the device
class api (ex: i2c.h). This is used to maintain per driver instance
stats for all i2c drivers. This is a reusable idea across other device
classes as desired.

Using Kconfig device class stats may be turned on/off individually
this way as well, in this case I2C_STATS.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2021-12-04 07:22:56 -05:00
Daniel DeGrasse
b0dfda1584 drivers: pwm_mcux: Update MCUX pwm driver to use clock bindings
MCUX PWM driver used hardcoded clock source. update driver to use clock
bindings to determine PWM peripheral clock frequency.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-03 16:44:12 -06:00
Bryce Wilkins
219bf88fe8 drivers: spi: Add optional delays to mcux flexcomm spi driver
Adds optional device tree properties to insert delays between spi chip
select assert/deassert and the clock edges, and also between spi
frames and transfers to the mcux flexcomm spi driver. If the properties
are not set, no additional delay is inserted.

Verified expected behavior on mimxrt685_evk and check with a scope
that the pre- and post-delay could be changed from the device tree
properties.

Signed-off-by: Bryce Wilkins <bryce.wilkins@gmail.com>
2021-12-03 16:42:10 -06:00
Sören Tempel
fd089b361d uart: sifive: align txcnt of UART1 with UART0
The UART1 is not actually accessible on the HiFive1 since the
QFN48 package for the FE310, used by this board, does not expose the
required pads. However, it is still possible to use the UART1 on HiFive1
emulators (e.g. using UART0 for debugging and UART1 for SLIP).

Unfortunately, the UART0 and UART1 currently have different default
configurations when it comes to the configured transmission watermark
(txcnt). With a txcnt of zero (the default for UART1) the UART is not
actually usable (see #18118). Contrary to UART0 (see #23699), the UART1
does therefore not work by default on Zephyr which took me some time to
figure out.

This commit aligns the default UART1 configuration with the UART0,
thereby making it work by default.

Signed-off-by: Sören Tempel <tempel@uni-bremen.de>
2021-12-02 11:42:46 -06:00
Tim Lin
f52ff1a79e drivers/serial: uart_ns16550: add power management constraint API
Instead of busy wait until completed transaction, the constraint set
is used before enabling tx interrupt to not allow system to enter
suspend when tx is transmitting.

Application defined policy should use the pm_constraint_get function
to check if given state is enabled and could be used.

TEST=Test on hayato board(soc:it8xxx2), the logs print normally before
system enters suspend.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-12-02 10:53:19 +01:00
Hake Huang
9672180327 driver: i2s: add i2s driver for mcux
add i2s driver for mcux

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-12-02 10:50:21 +01:00
Hake Huang
0e9d491f47 driver: clock: nxp-mcux add clock support for i2s
add mcux ccm clock setting for i2s

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-12-02 10:50:21 +01:00
Ryan McClelland
b15b16d59a drivers: i2c: fix i2c_gpio log typo
Fix typo with error logging the gpio pin name for sda

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-12-01 14:51:59 -06:00
Lukasz Majewski
90f36ac16d net: dsa: ksz8794: Fix the port numbering for DSA tag setting
After the commit "dts: ksz8974: change port number to start at zero."
(SHA1: aa6217697e)

the lan ports are numbered starting from zero (not as previously from
one), so code assigning tags shall take this into account.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-01 13:58:08 -06:00
Lukasz Majewski
cb4f7bc15c net: dsa: ksz8794: Fix the port numbering for this ETH switch IC
After the "dts: ksz8974: add support for ksz8863"
(SHA1: b0e4886dfa) commit the port numbering
for KSZ8794 was wrong.

This IC has 3 ETH ports (with linear offset), with port 4 being the
"master" with non linear offset (i.e. 0x50 instead of linear 0x40).

Such situation can be explained with similarity of this IC to ksz8795,
which has 4 LAN ports, and then the 0x40 offset is used.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-01 13:58:08 -06:00
Lukasz Majewski
ab1f0b55d5 net: dsa: ksz8794: Use CONFIG_DSA_KSZ_TAIL_TAGGING in preprocessor macros
The name of macro to enable tail tagging support in DSA KSZ driver is
CONFIG_DSA_KSZ_TAIL_TAGGING, not DSA_KSZ_TAIL_TAGGING.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-01 13:58:08 -06:00
Lukasz Majewski
5b957e4e46 net: dsa: ksz8794: Remove check for CPU port in the switch setup
The check for CPU port on the KSZ8794 when the switch is initialized,
is not required as the last port number is always smaller than the CPU
port.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-01 13:58:08 -06:00
Wealian Liao
230378aebe driver: uart_npcx: Fix uart to use PM constrain
The device PM callback needs to be used only to suspend/resume devices.
If the system cannot be suspended because UART is in a particular
state, the pm_constraint_set/release API should be used. For NPCX UART,
the chip can't enter low power idle state until UART completes the data
transmission.
This commit changes NPCX UART to use pm_constraint_set/release & fixes
UART lost data from low power idle.

Fix #40621

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-12-01 13:49:17 -06:00
Konrad Sikorski
cb410abec0 drivers: i2c: fix esp32 i2c driver unwilled STOP and repeated START
- added messages check and fix before transfer
- fixed START and STOP signal generation conditions
- fixed semaphore release for empty messages

Signed-off-by: Konrad Sikorski <znfgnu@gmail.com>
2021-12-01 12:27:45 -05:00
Dino Li
584e38c9b4 cleanup: espi: it8xxx2: eliminate DRV_CONFIG() and DRV_DATA() macros
The two macros aren't required in the file.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-12-01 12:23:28 -05:00
Torsten Rasmussen
0c66240908 drivers: nrf5: kconfig: add missing dependency for TEMP_NRF5
Fixes: #40538

The TEMP_NRF5 setting requires MULTITHREADING, therefore add this
dependency to Kconfig.

The TEMP_NRF5 supports an alternative driver implementation using the
TEMP_NRF5_FORCE_ALT setting.
Because it cannot be known whether an alternative implementation has
the same dependency, then the MULTITHREADING is OR'ed with
TEMP_NRF5_FORCE_ALT, as to allow enabling of TEMP_NRF5 if an alternative
driver is provided.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-12-01 16:10:59 +01:00
Antonio Tessarolo
cc1cd4d65b arm: Nxp imx6sx added PWM support
This commit adds support for IMX6SX PWM.
The PWM module is the same module present on the IMX7D and so dts
bindings has been renamed following the one present on linux.

Signed-off-by: Antonio Tessarolo <anthonytexdev@gmail.com>
2021-11-30 11:54:11 -06:00
Daniel DeGrasse
7b74dbb405 drivers: spi_mcux_lpspi: Added DMA support to NXP LPSPI driver
Adds DMA support to NXP's LPSPI driver. This can be enabled by selecting
the KConfig symbol CONFIG_SPI_MCUX_LPSPI_DMA, and requires the LPSPI
instances enabled in the devicetree to have valid DMA instances
assigned.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-11-30 10:57:17 -06:00
Lukasz Majewski
aa464a9d67 spi: Fix the Pcs setup for NXP's K6xF processors
Without this change, when DTS SPI device node has node ID = <0>, the
value of 0 is assigned during SPI configuration and written to
whichPcs member in master_config structure.
This value wrongly overrides the default value read from NXP's DSPI
HAL (kDSPI_Pcs0 = 1U << 0).

Such situation occurs on ip_k66f board, where the DSA device -
controlled via SPI has the node ID equal to 0 (i.e. reg = <0>).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-11-30 09:55:46 -06:00
Dominik Ermel
c4a6137834 drivers/flash/nrf_qspi_nor: Fix qspi_sfdp_read error path
The commit fixes processing of a return value from the ANOMALY_122_INIT
call.

Fixes #39923

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-30 11:46:22 +01:00
Francois Ramu
701d6bd087 drivers: watchdog: stm32G0 window watchdog during debug
This commit is enabling the Debug support clock
like the stm32L0 or F0, the APB peripheral clock enable register 1
has a bit to clock DBGMCU before use.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-29 18:26:47 -05:00
Francois Ramu
4145c83c82 drivers: watchdog: stm32MP1 window watchdog during debug
This commit is controlling the WWDG during the Stop mode in debug.
WWDG1 is frozen while the core is in Debug mode, setting the bit
of the DBGMCU APB1 peripheral freeze register (DBGMCU_APB1FZ2)
for the stm32MP1 soc devices.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-29 18:26:47 -05:00
Francois Ramu
0d84e7b2bc drivers: watchdog: stm32H7 window watchdog during debug
This commit is controlling the WWDG during the Stop mode in debug.
WWDG1 is frozen while the core is in Debug mode, setting the bit
of the DBGMCU APB3 peripheral freeze register (DBGMCU_APB3FZ1)
for the stm32H7 soc devices.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-29 18:26:47 -05:00
Markus Brüx
c56851a5cb drivers: sensor: lis2dh: Allow power-down mode
Remove check if frequency is equal to zero. A value of `ODR = 0` is
explicitly allowed by manufacturer / datasheet.
This has prevented applications from using the lis2dh power-down-mode,
which is set via `ODR = 0`.

For reference see "Table 28. Data rate configuration" in datasheet p.33.

Fixes #35486.

Signed-off-by: Markus Brüx <markus.bruex@grandcentrix.net>
2021-11-29 18:19:18 -05:00
Thomas Stranger
aef64fcb17 drivers: sensor: shtcx: fix
This commit fixes humidity value and model dependent timing parameters.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-11-29 18:18:42 -05:00
Casper Meijn
889ab9107e drivers: display: st7789v: Make naming consistent
The names of `struct st7789v_data` varied a bit in the driver code.
Make the name consistently `data`.

Signed-off-by: Casper Meijn <casper@meijn.net>
2021-11-29 16:29:55 +01:00
Ruibin Chang
fad78a2c07 ITE drivers/sensor: add tachometer driver for it8xxx2_evb
Add tachometer driver for it8xxx2_evb.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2021-11-29 08:25:19 -05:00
Alexandre Bourdiol
102ac1ae36 drivers: clock_control: stm32u5: set voltage scaling VOS for MSIS
In case of MSIS selected as system clock source it is necessary
to set Voltage scaling (VOS) when freqency is greater than 24MHz

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-29 05:27:19 -05:00
Alexandre Bourdiol
ffb6a31819 drivers: clock_control: stm32u5: keep reset values of MSI trimming
When MSI trimming values where set to 0,
and MSIS is used as system core clock and MSI > 4 MHz,
it causes uart to fail.
There is no need to set thoses trimming values.
So keep the default reset value. (keep ST Factory calibration)

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-29 05:27:19 -05:00
Alexandre Bourdiol
2d223bdc8f drivers: clock_control: stm32u5: rework MSIS as system clock source
Because on stm32u5 MSIS is the default clock after reset,
changing MSIS range means immediate frequency change.
Thus it is important to do it after flash latency change
in case of higher new frequency.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-29 05:27:19 -05:00
Gerard Marull-Paretas
89a4f36fc8 device: remove inclusion of pm/device.h
The device PM subsystem _depends_ on device, not vice-versa. Devices
only hold a reference to struct pm_device now, and initialize this
reference with the value provided in Z_DEVICE_DEFINE. This requirement
can be solved with a forward struct declaration, meaning there is no
need to include device PM headers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-29 11:08:38 +01:00
Dino Li
f1f0dadad3 driver: espi: it8xxx2: enable ESPI_OOB_CHANNEL
This enable eSPI out-of-band channel.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-11-26 10:26:52 -05:00
Erwan Gouriou
6026d3c5bf drivers/pinmux|pinctrl: stm32f1: Fix broken cast in remap
remap information is coded in 10 bits, uint16_t should be used
to cast it.

Fixes #40688

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 10:25:41 -05:00
Gerard Marull-Paretas
ed67eb28b8 drivers: gpio: nrfx: adjust initialization level and priority
Make nrfx GPIO driver part of the PRE_KERNEL_1 initialization stage. As
a result, the GPIO driver can now be initialized before UART if
required, a device that is also initialized during PRE_KERNEL_1.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 14:20:51 +01:00
Gerard Marull-Paretas
5567d7ae07 drivers: serial: nrfx_uart: add support for pinctrl
This patch adds support for the new pinctrl API to the UART driver. The
old pin property based solution is still kept so that users have time to
transition to the new model.

Notes:

- A new property to disable RX has been introduced: disable-rx. It is no
  longer possible to do it automatically depending on pin information,
  since it's not available when using pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 14:20:51 +01:00
Gerard Marull-Paretas
3b7215e160 drivers: serial: nrfx_uarte: add support for pinctrl
This patch adds support for the new pinctrl API to the UARTE driver. The
old pin property based solution is still kept so that users have time to
transition to the new model.

Notes:

- Some build assertions cannot be performed since the driver does not
  have direct access to pin settings anymore. As a result user will not
  be notified if HWFC is enabled but RTS/CTS pins are not configured.
- Hardware flow control can be enabled regardless of pin configuration,
  it is now up to the user to configure RTS/CTS pins in DT.
- Some RX enable checks that were performed using pin information has
  been replaced with a DT property that informs if RX is enabled or not.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 14:20:51 +01:00
Gerard Marull-Paretas
6399ad50f4 drivers: pinctrl: nrf: add support for uart/uarte peripheral
Add support for configuring UART/UARTE peripheral pins.

Co-authored-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 14:20:51 +01:00
Gerard Marull-Paretas
22c8c02145 drivers: pinctrl: nrf: initial support
Add initial support for nRF pin controller driver. The implementation in
this patch does not yet support any peripheral. Only states
representation and basic driver functionality is introduced.

Note:
The nrf_pin_configure function has been marked as __unused since it may
not be used in certain scenarios until all peripherals are supported by
the pinctrl driver. For example, if only UART/E is supported but the
board does not enable UART, the function will never get called. However,
that board will likely have other peripherals that will gain support in
the future.

Thanks to Marti Bolivar for bindings documentation.

Co-authored-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 14:20:51 +01:00
Johann Fischer
5aedcabf51 drivers: spi_context: fix null pointer dereferencing
commit 54907c7014
("drivers: spi: spi_context: improve support of multiple cs gpios")
added function to initialize all CS GPIOs defined in devicetree.
This function, spi_context_cs_configure_all, is intended to be
called during SPI driver initialization (POST_KERNEL init level).
It is also obvious that a SPI driver was not used at that time,
and no bus configuration (struct spi_config) is assigned to
SPI bus (spi_context.config).

The spi_context_cs_configure_all function has a homeopathic
ASSERT to validate CS levels, which causes a null pointer
dereferencing by ctx->config->operation if asserts are
enabled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-26 11:47:27 +01:00
Erwan Gouriou
eff3ad6df7 drivers/pwm: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.
Since STM32F1 series require pinctrl option and required register
address is parent timer address in place of own node register address,
use PINCTRL_DT_INST_CUSTOM_REG_DEFINE in place of usual
PINCTRL_DT_INST_DEFINE for this specific series.

Additionally, remove the automatic selection of PINMUX API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
90b0e92540 drivers/usb/device: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Additionally, rename usb_pinctrl to usb_pcfg to better fit
new pinctrl API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
8bd410a589 drivers/spi: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
ab893d5fef drivers/memc: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
79943f647f drivers/i2s: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
f21de9dfe6 drivers/i2c: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
cec2cb69dd drivers/flash: qspi stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
18ae799b73 drivers/ethernet: dwmac_stm32h7x: use new pinctrl API
Use the new pinctrl API to configure pins.

Additionally, rename eth0_pins to eth0_pcfg to better fit
new pinctrl API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
87438e4587 drivers/ethernet: stm32_hal: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
d55905b2f7 drivers/disk: sdmmc: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
956afc3a08 drivers/dac: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
65d222b0ab drivers/fdcan: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
337c9b96e9 drivers/can: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
93956b2073 drivers/adc: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Gerard Marull-Paretas
21a271962c drivers: serial: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 11:36:42 +01:00
Gerard Marull-Paretas
9c10e1e988 drivers: pinctrl: stm32: initial version
Add initial version for STM32 pinctrl driver. Driver has been written
re-using many of the already existing parts in
drivers/pinmux/pinmux_stm32.c.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 11:36:42 +01:00
Krzysztof Chruscinski
9886bdc0c8 drivers: pwm: pwm_nrf5_sw: Use runtime resources allocation
Use nrfx_gpiote and nrfx_ppi allocators to allocate channels
at runtime instead of fixed, device-tree based allocation which
is harder to maintain.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-11-26 09:31:54 +01:00
Neil Armstrong
f8f2936dba pcie: add initial controller support
This adds :
- Generic PCIe Controller layer implementing the current PCIe API
- Generic PCIe Controller in ECAM mode driver

The Generic PCIe Controller layer provides:
- Configuration space read/write
- single bus endpoint enumerations
- Endpoint I/O, MEM & MEM64 BARs allocation
- Endpoint I/O, MEM & MEM64 BARs get & translation for drivers

The Generic PCIe Controller in ECAM mode driver provides:
- Raw DT RANGES properties into usable PCIe regions
- Configuration space read/write into ECAM config space
- PCIe regions allocation & translation

The limitations are:
- No support for PCIe prefetchable regions
- No support for PCIe bus configuration (only bus0 is supported)
- No support for multiple controllers (no domain-id in BDF)

Support has been designed to initially support Root Complexes with
Root Complex Integrated Endpoint, which was designed for Embedded
Systems with internal-only PCIe Endpoints on bus 0.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-11-25 18:37:15 +01:00
Robert Lubos
666e9f80d6 net: ipv6: Remove in6_addr from packed net_ipv6_hdr struct
Replace unpacked in6_addr structures with raw buffers in net_ipv6_hdr
struct, to prevent compiler warnings about unaligned access.

Remove __packed parameter from `struct net_6lo_context` since the
structure isn't really serialized.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-25 10:46:35 -05:00
Robert Lubos
064200b420 net: ipv4: Remove in_addr from packed net_ipv4_hdr struct
Replace unpacked in_addr structures with raw buffers in net_ipv4_hdr
struct, to prevent compiler warnings about unaligned access.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-25 10:46:35 -05:00
Jeremy Bettis
5ec3cd68ff gpio_emul: Fix bug with input & output pins
Change gpio_emul_input_set_masked_pend to log when it returns an error.
Changed all calls to gpio_emul_input_set_masked* to check the return
value.

Changed the function gpio_emul_input_set_masked_pend to apply the mask
to the provided values and not return an error if there are excess
values. In almost every call to that function, the value wasn't being
limited to bits set in the mask, so they were failing if there was more
than one gpio configured for INPUT|OUTPUT with a value of 1.

Fixes #40646

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2021-11-25 10:36:25 -05:00
Ryan McClelland
b7bedb5c1e drivers: fix double promotion warnings
With -Wdouble-promotion added to the warning base, fix warnings given
by the compiler.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-11-24 17:14:25 -05:00
Flavio Ceolin
6451626ce7 pm: Use pm_device_action_run instead of state_set
Since drivers implement a callback based on action and not the state,
we should be using the API based on the action instead of the one based
on the state.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-24 14:21:50 -05:00
Flavio Ceolin
80d26d996e drivers: led_pwm: Fix log message
The log message was using the uninitialized variable state.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-24 14:21:50 -05:00
Raúl Sánchez Siles
f35cdfc1e4 drivers: usb_dc_native_posix fill in data amount
Fill in received bytes in USBIP_RET_SUBMIT packet

Currently this field is unconditionally set to 0 and therefore not
filled in conveniently. This may mislead the USB host which is correctly
acknowledged that the transaction was sucessful but it cannot check the
actual received bytes.

Test application:

```python
import usb

data = (0xFF, 0xFF)
print("Opening loopback device")
device = usb.core.find(idVendor=0x2FE3, idProduct=0x0009)
print("Writing test data", data)
written = device.write(0x1, data)
print("Written", written, "bytes")
```

Before:
```
$ ./test_loopback.py
Opening loopback device
Writing test data (255, 255)
Written 0 bytes
```

After:
```
$ ./test_loopback.py
Opening loopback device
Writing test data (255, 255)
Written 2 bytes
```

Signed-off-by: Raúl Sánchez Siles <rsanchezs@k-lagan.com>
2021-11-24 17:55:04 +01:00
Johann Fischer
48362df588 drivers: usb_dc_sam_usbhs: default to full-speed
Use DT_INST_ENUM_IDX_OR and always default to full-speed
if CONFIG_USB_DC_HAS_HS_SUPPORT is not set or maximum-speed
property is not defined.
Remove low-speed setting since device stack does not support it.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-24 12:28:02 +01:00
Johann Fischer
cf8d7764da usb: fix bulk endpoint configuration for high-speed capable device
In the current USB device support, the sizes of bulk endpoint
are mostly configure through Kconfig and do not care if a device
is high-speed capable. The information if a USB device controller
supports high-speed comes from devicetree. Add a Kconfig option to
map this information and configure bulk endpoint sizes
accordingly.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-24 12:28:02 +01:00
HaiLong Yang
5e035b0f4e drivers: serial: gd32 usart add interrupt support
Add interrupt support for gd32 usart driver.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2021-11-23 13:25:43 -05:00
HaiLong Yang
9418a4f763 drivers: serial: gd32 usart parity bit config
Initialize parity bit(Default NONE) from DTS.

Signed-off-by: HaiLong Yang <cameledyang@pm.me>
2021-11-23 13:25:43 -05:00
Robert Lubos
f3a9b8c83d net: l2: Add symbols for custom IEEE802154 L2
Define a custom IEEE802154 based L2. The user can then use those symbols
to implement their own 802.15.4 based L2, based on those symbols, w/o a
need to modify the Zephyr tree.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-23 13:25:01 -05:00
Robert Lubos
5cf235e601 drivers: ieee802154_nrf5: Add Kconfig to configure FCS inclusion policy
Some 802.15.4 L2 implementations expect that FCS length is included in
the overall packet length while others not. Allow to configure this
behavior, based on the selected upper layer.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-23 13:25:01 -05:00
Robert Lubos
9a319226f8 net: ieee802154: Add common config for all 802154 L2s
Introduce a common config for all 802.15.4 based L2 implementations.
This way, any custom 15.4 L2 implementation will be able to
automatically enable use 15.4 driver, w/o a need to modify the actual
Kconfig.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-23 13:25:01 -05:00
Andy Ross
a7af0acfc2 soc/intel_adsp: Clean up IPM compiler guards
The CAVS_IDC_IPM driver happens to be used only on non-2.5 hardware,
but it's best to be clear in the conditional compilation when we're
talking about hardware-dependencies and when we mean software
configuration.  This was mixed up in a few spots.

Also fix a warning that creeps in on non-default drivers choices about
an undeclared ipm function.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-11-23 13:23:54 -05:00
Andy Ross
430cbf430a soc/intel_adsp: Eliminate platform configuration headers
All the in-use contents of these files have now been moved to the
intel_adsp core, and they are configured via devicetree and kconfig.
Remove the legacy headers.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-11-23 13:23:54 -05:00
Andy Ross
ed9434c812 soc: intel_adsp: Clean up shim driver
Each platform was defining its own shim.h header, with slightly
variant field definitions, for a register block that is almost
completely compatible between versions.  This is made worse by the
fact that these represent an API imported fairly early from SOF, the
upstream version of which has since diverged.

Move the existing shim struct into a header ("cavs-shim.h") of its
own, remove a bunch of unused symbols, fill in definitions for some
registers that were left out, correct naming to match the hardware
docs in a few places, make sure all hardware dependencies are source
from devicetree only, and modify existing usage to use the new API
exclusively.

Interestingly this leaves the older shim.h header in place, as it
turns out to contain definitions for a bunch of things that were never
part of the shim register block.  Those will be unified in separate
patches.

Finally: note that the existing IPM_CAVS_IDC driver (soon to be
removed from all the intel_adsp soc's) is still using the old API, so
redeclare the minimal subset that it needs for the benefit of the
platforms in transition.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-11-23 13:23:54 -05:00
Andy Ross
ab1baca03f drivers/ipm: Remove intel_adsp_mailbox driver
This is dead code.  It's based on the cAVS "IPC" mechanism to allow
communication to and from the host CPU.  But there is no test rig in
the Zephyr tree for the protocol defined.  And in fact the only
Zephyr-based user of the IPC mechanism (Sound Open Firmware) has its
own IPC driver and speaks its own protocol with the host kernel.  That
driver needs to migrate into Zephyr soon and this legacy bit is just
confusing.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-11-23 13:23:54 -05:00
Andy Ross
b6a32e9550 drivers: cavs_timer: Use the new interrupt controller API
Recent work to this platform added a new, cleaner low level API to the
interrupt controller.  Replace the hand-cooked register access with
that.  This is still not as good as having proper multicore support in
the intc_cavs driver, but it's at least better.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-11-23 13:23:54 -05:00
Wealian Liao
1a3a7b1d5e driver: gpio: nct38xx: Improve kconfig prompt
As per the guidelines:
https://docs.zephyrproject.org/latest/guides/build/kconfig/tips.html#prompt-strings
This improves the NCT38XX Kconfig prompt string.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-11-23 13:19:21 -05:00
Pawel Dunaj
7ba38d8b26 drivers: pwm: Restore default on re-initialization
Device data is cleared on deinitialization. This operation removes
some important information. Let's restore the defaults each time
the device is initialized.

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2021-11-23 17:00:56 +01:00
Ron Smith
863fef4a54 drivers: serial: uart_sam0: fix |= incorrectly clearing all INTFLAGS.
fix uart_sam0_irq_update to only clear the RXS bit by writing only the
RXS bitflag to the INTFLAG register. Performing an |= opperation
with the bitflag for RXS incorrectly clears all pending interrupts set
since writing 1 to a INTFLAG clears that bit field. This causes a race
condition on when TXC will be cleared before all bytes have finished
being clocked out on tx and TXC being set 1 again. If tx finishes first,
any driver using uart_irq_tx_complete will deadlock the system.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-11-23 10:40:13 -05:00
Ron Smith
847b3205d6 drivers: serial: uart_sam0: add uart_irq_tx_complete method for sam0.
sam0 does not currently have a uart_irq_tx_complete method for interrupt
driven mode.
This is especially important since the sam0 platform has seperate
interrupt signals for TX data register empty and TX complete therefore
the TX register being empty does not nessisarily mean the data has been
shifted out.
Drivers should check uart_irq_tx_complete if it needs to guarantee
that the data has been fully transmitted in a hardware agnostic way.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-11-23 10:40:13 -05:00
Erwan Gouriou
097cb02e59 drivers/pinmux: stm32f1: Rework pinmux remap information encoding
Aim of this change is to remove the need for the pinmux driver
on stm32f1 series to access the base address of the pinmux owner
device.

This is achieved by a modification in the device tree pin definition.
Instead of providing a generic information on type of the remap
(such as NO_REMAP, PARTIAL_REMAP, FULL_REMAP), the remap field
encodes all the information required to perform the remap register
configuration:
-Address of the targeted remap register in AFIO peripheral
-Position of the remap configuration in the remap register
-Mask used for the remap configuration encoding
-Value of the expected remap configuration.

All the possible remap configurations are encoded and predefined
in a new stm32f1-afio.h dt-bindings include.

To match this new configuration, all stm32f1 -pinctrl.dtsi should
be regenerated to use these new remap definitions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-23 10:37:01 -05:00
Erwan Gouriou
c35ed25a63 drivers/pinmux: stm32: Rework pinmux macro definitions
Review pinmux macro definition to a more portable format,
in preparation for new remap information encoding on stm32f1 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-23 10:37:01 -05:00
Nicolas Pitre
e915dcad13 ethernet: dwmac: fix promiscuous mode
The dedicated PR (Promiscuous Mode) bit should be used instead of
the RA (Receive All) bit.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-11-23 10:31:29 -05:00
Julien D'ascenzio
d42cef17b0 uart_stm32: Fix conflit between poll_out and irq API
A lock was added to manage situation where the API poll_out and irq API
are used in same time.

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2021-11-23 09:13:21 -05:00
Guillaume Lager
4c986a266f drivers: sensor: tmp112: Add default device initialization
This allow to have a smaller driver footprint when a single
configuration is required.

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-11-23 13:12:39 +01:00
Guillaume Lager
cd207ca0bc drivers: sensor: tmp112: correct type
TMP112 registers are 16bit so there is no reason to use int64_t for
register values

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-11-23 13:12:39 +01:00
Daniel DeGrasse
e70907f52d drivers: mcux_flexspi: Default logging to disabled when XIP is used
Program flow will behave incorrectly (memory and instruction fetches
return invalid data) if Flexspi is accessed by the Flexspi driver while
being used as XIP memory by the Cortex M7.

Set logging to disabled by when XIP mode is used in the memc and
flexspi drivers, and warn the user if they attempt to enable it.

Fixes #40133

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-11-22 22:27:13 -05:00
Tilmann Unte
38e89c90a5 drivers: pwm: stm32: add pwm capture support
Extends STM32 PWM driver to support capturing pulse width, period,
or both.

The approach used is based on the PWM Input sections in reference
manual RM0351 by ST in the chapters on timers.
The LL library by ST is used for all extensions to the driver.

Only the disco_l475_iot1 board was available for testing on hardware,
using tests/drivers/pwm/pwm_loopback.
Since timers are a generic component, it is assumed that other STM32
boards will behave the same

Fixes #39394

Signed-off-by: Tilmann Unte <unte@es-augsburg.de>
2021-11-22 22:24:45 -05:00
Yong Cong Sin
a6ebcddc54 driver: serial: uart_stm32: Calculate suitable PRESCALER value
Current driver set a fixed prescaler value for the lpuart
that caused certain baudrate configurations to fail due to
LPUARTDIV overflow the LPUART_BRR register.

This PR attempt to calculate a suitable PRESCALER for the
selected baudrate, throws error and return if it couldn't get
an optimal one.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-11-22 22:21:20 -05:00
Gerard Marull-Paretas
285f55899b drivers: serial: gd32: use pinctrl
Use the pinctrl API to configure peripheral pins.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-11-22 16:30:28 -05:00
Gerard Marull-Paretas
f8017dc5ad drivers: pinctrl: gd32: initial support for AFIO based SoCs
Add a pin control driver for GD32 SoCs using the AFIO model.

Thanks to Gerson Fernando Budke for testing and implementation
suggestions.

Co-authored-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-11-22 16:30:28 -05:00
Gerard Marull-Paretas
543a3843ff drivers: pinctrl: gd32: initial support for AF based SoCs
Add a pin control driver for GD32 SoCs using the AF model.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-11-22 16:30:28 -05:00
Sylvio Alves
b9ae272ade drivers: clock: esp32c3: fix clock basis
Clock ISR was running 2x the frequency.
Also fixes clock_get_cycle which was returning
wrong values.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-22 08:30:15 -05:00
Johann Fischer
f2e45d75a7 drivers: usb_dc_native_posix: check return value from recv()
Check return value from recv() passed by usbip_recv().

Fixes: #39849
Fixes: #39869
Coverity-CID: 240221
Coverity-CID: 240244

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-22 09:11:41 +01:00
Sylvio Alves
779ef06a5b drivers: spi: esp32: fix CS gpio initialization
SPI_CONTEXT_CS_GPIOS_INITIALIZE call was not considering
proper SPI driver instance ID.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-20 11:56:55 -05:00
Sylvio Alves
71d3609e16 drivers: spi: esp32: fix frequency config
Current implementation is using hardcoded frequency
and not the one provided by the spi api.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-20 11:56:55 -05:00
Andrei Emeltchenko
343033fc34 edac: ibecc: Exclude LOG_ERR() from branch coverage
It does not make sense to use branch coverage with macro LOG_ERR().
It is still covered with line coverage.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-11-20 11:54:32 -05:00
Andrei Emeltchenko
d11fae6d06 edac: ibecc: Return -ENODATA on zero log
Return -ENODATA when we read zero log.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-11-20 11:54:32 -05:00
Andrei Emeltchenko
e1ffce9ec3 edac: ibecc: Add header guards and move definition
Add header guards for ibecc.h to be used in tests.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-11-20 11:54:32 -05:00
Wealian Liao
5a9bc389f0 driver: gpio: nct38xx: Add NCT38XX gpio driver support
NCT38XX series, which are i2c-based chips, support a different number
of GPIO functionality. For NCT3807, it has 2 GPIO ports on the same i2c
device address. For NCT3808, it has 2 GPIO ports on different i2c
device addresses. This commit adds NCT38XX GPIO driver support &
provides the interrupt handler for the share alert pin.

The following is NCT3807 devicetree node example:
```
&i2c0_0 {
	nct3807_0: nct3807@70 {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "nuvoton,nct38xx-gpio";
		reg = <0x70>;
		label = "NCT3807_0";

		gpio@0 {
			compatible = "nuvoton,nct38xx-gpio-port";
			reg = <0x0>;
			label = "NCT3807_0_GPIO0";
			gpio-controller;
			#gpio-cells = <2>;
			ngpios = <8>;
			pin_mask = <0xff>;
			pinmux_mask = <0xf7>;
		};

		gpio@1 {
			compatible = "nuvoton,nct38xx-gpio-port";
			reg = <0x1>;
			label = "NCT3807_0_GPIO1";
			gpio-controller;
			#gpio-cells = <2>;
			ngpios = <8>;
			pin_mask = <0xff>;
		};
	};
};
```

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-11-20 08:00:38 -05:00
Ruibin Chang
3ab081efe9 ITE drivers/pwm: cleanup it8xxx2 pwm driver
1.Putting the PWM_CHANNEL_X, PWM_PRESCALER_CX information
  in the description.
2.Use the common definition EC_FREQ.
3.Use the common macro IT8XXX2_DT_ALT_ITEMS_LIST.
4.Stop using DRV_CONFIG, DRV_REG macro.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2021-11-19 10:24:11 -06:00
Tomasz Bursztyka
01b9813d73 drivers/spi: Return an error on SPI_HALF_DUPLEX for relevant drivers
This feature will need to be, however, implemented driver by driver
afterwards.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-19 11:50:38 +01:00
Tomasz Bursztyka
d5de0788ad drivers/sensors: Enable 3-wire SPI access to HTS221 sensor driver
HTS221 is a humidity and temperature sensor (thus HTS) that can be wired
on i2c or SPI bus. On SPI bus however, it uses the 3-wire mode, aka:
half-duplex.

Now that SPI API exposes half duplex operation, let's enable the SPI bus
on that sensor.

Let's move to a better DTS integrated driver as well, and also use
stmemsc interface.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-19 11:50:38 +01:00
Tomasz Bursztyka
f6be2835bd drivers: Apply SPI API change to relevant places
Mostly drivers, but also one sample and one test.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-19 11:50:38 +01:00
Tomasz Bursztyka
f8cc93de8c spi: Add a configuration option for half/full duplex mode
This is meant to expose half/full duplex configuration option on regular
configuration. So far, dual/quad/octal are not exactly supported, as it
would require extensions to the SPI buffer for a full support.

So moving these modes to an extended operation attribute
(32 vs 16 bits), disabled by default.

And exposing half/full duplex configuration bit. Full duplex being the
default option.

Fixes #19134

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-19 11:50:38 +01:00
Gerard Marull-Paretas
88a69674c0 drivers: use new PM macros
Port some drivers to the recently introduced macros to showcase its
usage and be able to do some initial testing (nRF52840).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-19 10:11:32 +01:00
Gerard Marull-Paretas
f4417dab46 device: remove PM capability from SYS_DEVICE_DEFINE
The macro already mentions in the docstrings that PM is not supported:

"Invokes DEVICE_DEFINE() with no power management support".

This patch removed the PM entry from the macro and ajusts its uses.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-19 10:11:32 +01:00
Gerard Marull-Paretas
c78c312c82 drivers: interrupt_controller: i/loapic: use DEVICE_DEFINE
Define the device using DEVICE_DEFINE macro, so that a single option can
be used regardless of PM being enabled or not.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-19 10:11:32 +01:00
Bartosz Bilas
a82ccba9ea drivers: flash: cast offset value into ssize_t
To fix compiler warnings cast offset value into ssize_t.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-11-18 19:13:22 -05:00
Gerard Marull-Paretas
c759a35d08 drivers: use DT_INST_ENUM_IDX(_OR) macros
Replace `DT_ENUM_IDX(_OR)(DT_DRV_INST(...),` pattern with
`DT_INST_ENUM_IDX(_OR)(...,`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-18 19:12:07 -05:00
Johann Fischer
fdcc104455 usb: remove Kconfig option USB_UART_CONSOLE
Since there are no more users and dependencies of
Kconfig option USB_UART_CONSOLE in the tree,
remove the remains and the option USB_UART_CONSOLE.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-18 14:29:18 +01:00
Johann Fischer
6fd0843809 drivers: console: limit scope of CONFIG_USB_UART_CONSOLE
Do not change init level and priority of console driver
if Kconfig option CONFIG_USB_UART_CONSOLE is enabled because
commit 37f4d9ba63
("usb: cdc_acm: rework cdc_acm_poll_out to non-blocking")
changed CDC ACM UART driver so that it more closely mimics
the real controller and CDC ACM UART driver now uses the same
init level and priority as regular serial driver.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-18 14:29:18 +01:00
Manojkumar Subramaniam
86a6280ed7 drivers: clock_control: stm32h7: Add logic to handle SMPS config
Some STM32 SoC supports an internal SMPS

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2021-11-18 13:56:39 +01:00
Thomas Stranger
cfac53b76f drivers: flash: stm32g0: dual bank handling
This commit fixes dual bank flash handling on stm32g0 targets.
In contrast to other Series (G4, L5) the flash page size does not change
in single bank configuration (2KiB in both configurations).

nSWAP_BANK:
While the reference manual(RM) only documents:
"This bit selects the bank that is the subject of empty check upon boot"
as expected, this behaves similar to BFB2 on G4 and SWAP_BANK on L5.
It has been observed that this bit swaps the address mapping of bank1
and bank2, regardless of DUAL_BANK bit being set or not.
As documented in the RM the nSWAP_BANK bit is ignored when the BOOT_LOOK
bit is set. This applies to the empty check as well as the address
mapping.

On this Series FLASH_CR_BKER must be set in single-bank as well as
dual-bank configuration for erase operations on bank2 regardless of
the swap status.

On a G0B1RE (dev-id: 0x467) I could not observe a difference between
DUAL_BANK flash option bit set and not.
It this may be different on 256KiB Flash targets.
The HAL indicates that "FLASH_SALES_TYPE_0" only uses a single bank if
OB_DUAL_BANK_VALUE is not set, but as I don't know which SoC this is
and I can't test the behaviour and the driver does not take this into
account.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-11-17 11:06:59 -05:00
Thomas Stranger
5bf11c250d drivers: flash: stm32g0: preparation for dual bank handling
This commit makes no functional changes, it only refactors the
driver such that dual bank flash handling can be easily added.

Instead of using HAL macros directly in the code, new macros
with STM32G0 prefix are defined.
The erase_page function gets passed the offset instead of the page,
and the FLASH CR reg is written once with all erase parameters.
flash_stm32_wait_flash_idle is already called before each
write to CR, consequently it is also made sure CFGBSY flag
is not set.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-11-17 11:06:59 -05:00
Thomas Stranger
4c862c14c1 drivers: flash: stm32: wait for CFGBSY & BSY2 in wait_flash_idle
Some series (namely g0, u5, wb, wl, ?) use CFGBSY to indicate
that FLASH_CR is not ready to be modfied.

This commit adds this flag additionally to other the flash busy flags,
in flash_stm32_wait_flash_idle such that the driver waits before
trying to modify PG, PNB[6:0], PER, and MER bits in FLASH_CR.

Additionally, dual bank variants of STM32G0 have a seperarate BSY2 flag
for flash bank two.
Until now this was not yet checked in flash_stm32_wait_flash_idle.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-11-17 11:06:59 -05:00
Thomas Stranger
f15f9dfd72 flash: stm32: fix g0 error flags and move ifdef-ery to header
In STM32G0 HAL FLASH_FLAG_xxx defines don't follow the pattern of
other Series to simply redefine the FLASH_SR_xxx Msk.
Instead an ID for the SR reg and the position of the Error flag
are defined.

As a result error checking in flash_stm32_check_status was not working
until this fix on stm32g0 series.

In order to avoid complexity in the driver, the ifdef-ery of the flags
was moved to the header file.
Other series except g0 use FLASH_FLAG_xxx defines, because those
are valid for both cores in dual core(wl) and in secure/non-secure
targets(l5,u5).
FLASH_STM32_SR_ERRORS mask is introduced to check for any active error
in the SR.

The flags for SIZERR, MISERR, FASTERR are newly introduced.
the latter two are only required once fast programming is used,
which is not yet the case for any series.

The FLASH_SR_OPTVERR flag (option validity flag) is also present
in the SR, but is not added.
Also ecc errors are generally not checked, but these are in a different
register.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-11-17 11:06:59 -05:00
Thomas Stranger
519f5ffcde drivers: flash: stm32: mv security-mode dependent defines to header
An attempt to simplify the ifdef-ery around FLASH_SR is made.
Define Registers and flags in the header file instead of including
several individual operations in the driver.

FLASH_FLAG_BSY is not only defined for STM32L5, but also other series.
Therefore use this flag instead of FLASH_SR_BSY.
Only the g0 series definition is not valid in our context,
therefore use FLASH_SR_BSY1 instead.

No functional changes, only refactoring.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-11-17 11:06:59 -05:00
Jani Hirsimäki
d2a7d29a08 drivers: net: ppp: configurable autostart
New Kconfig CONFIG_PPP_NET_IF_NO_AUTO_START
to have an option to disable of starting of the PPP networking interface
right after the init.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2021-11-16 21:25:47 -05:00
Tim Lin
e29a15c0e3 ITE: drivers/serial: add the UART driver for the PM callback function
IT8XXX2 uses shared ns16550.c driver which does not provide a power
management callback(pm_action_cb), so create driver to handle
IT8XXX2 specific UART features.

note: pm_action_cb(old name: pm_control_fn)

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-11-16 21:23:42 -05:00
Wealian Liao
1b416f7fd1 driver: gpio: npcx: Fix API header
For port_set_bits_raw(), port_clear_bits_raw(), and port_toggle_bits(),
the second parameter sould be gpio_port_pins_t type. Currently, it
doesn't have other side effect, but it sould be fix. This commit fixes
it.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-11-16 21:22:48 -05:00
Alexandre Bourdiol
3a60344522 drivers: pwm: stm32: move "st,prescaler" to timers instead of pwm
Prescaler was misplaced in pwm binding, instead of timers binding.
For example, TIM6/TIM7 doesn't have PWM capability,
but have a prescaler.
This change also prepares the introduction of timer based counter
(which requires prescaler at timer level)
For compatibility reason temporarily use pwm prescaler if it exists,
otehrwise use timers prescaler.
And thus avoid to avoid breaking boards out of tree.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-16 09:55:30 -06:00
Lucas Dietrich
f7f0bc7022 drivers: can: Fixed timeout values comparison
Trivial fix of compilation error "invalid operands to binary "
when CONFIG_CAN_AUTO_BUS_OFF_RECOVERY = n

Fixes #40290

Signed-off-by: Lucas Dietrich <ld.adecy@gmail.com>
2021-11-16 10:14:02 -05:00
Lukas Gehreke
0544f5dbc3 drivers: gpio: Added mcp230xx GPIO driver.
Added driver for the mcp230xx series I2C-based GPIO chips.

Signed-off-by: Lukas Gehreke <lk.gehreke@gmail.com>
2021-11-16 10:13:14 -05:00
Jay Vasanth
70d4559fdf Microchip: MEC172x: eSPI driver
Updates to MEC172x eSPI driver to support ACPI shared
memory region and EC Host Command Subsystem through
ACPI_EC1 and Embedded Memory Interface (EMI).

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2021-11-16 10:43:42 +01:00
Maureen Helm
836651b453 drivers: gpio: Refactor drivers to use shared init priority
Refactors all of the on-chip GPIO drivers to use a shared driver class
initialization priority configuration, CONFIG_GPIO_INIT_PRIORITY, to
allow configuring GPIO drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

Most drivers previously used CONFIG_KERNEL_INIT_PRIORITY_DEFAULT or
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, therefore the default for this new
option is the lower of the two, which means earlier initialization.

Driver-specific options for off-chip I2C- or SPI-based GPIO drivers are
left intact because they often need to be initialized at a different
priority than on-chip GPIO drivers.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-11-15 14:38:55 -05:00
Christopher Friedt
7c6039a1d2 drivers: serial: nrfx: refactor for atomic_t as long
This driver aliases a regular `int` to `atomic_t` but that
should be updated to `long` with the change to `atomic_t`.

Added a comment to highlight that the variable was aliased.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-11-15 09:59:01 -05:00
Christopher Friedt
3e86c627f7 kernel: atomics: update print specifiers for atomic_t
The print specifier for `atomic_t` should be updated
to `%ld`, `%lu`, or `%lx` to account for the type
change of `atomic_t` to `long`.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-11-15 09:59:01 -05:00
Andy Ross
0b400d86c0 drivers/timer/cavs_timer: Fix race in k_cycle_get_64()
In commit 918a574c88 ("clock: add k_cycle_get_64") this driver was
augmented with a count64() method to get a 64 bit cycle output from
the two-32-bit-word device registers.

Unfortunately it appeared to be trying to use a spinlock around the
two (low/high) reads to protect against overflow.  But that doesn't
work: spinlocks protect against other CPU code using the same
spinlock, not against a hardware counter that is incrementing in real
time!

Thankfully there was already a count() routine in place that does a
detect-overflow-and-retry loop to solve this.  Use that.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-11-15 09:54:31 -05:00
Emil Gydesen
12decc70d0 Bluetooth: ISO: Add bitmask for retrieving iso header lenght
Add a macro to retrieve the iso data load length (the
length stored in the iso header) with a bit mask that
ensures that we only take the first 14 bits.

This is to remove any RFU bits that may have been set.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-12 14:52:33 +01:00
Rafał Kuźnia
e1ba2f75cf drivers: ieee802154: nrf5: fix NULL pointer dereference
When a frame is sent with a cleared ACK request bit, the transmit
metadata contains a NULL pointer to the ACK frame.

The pointer must not be dereferenced in such case.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-11-12 14:51:54 +01:00
Dino Li
6d8f1bf6d9 soc: it8xxx2: add support for eSPI driver
This supports eSPI slave, virtual wire, and peripheral functions.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-11-12 14:51:10 +01:00
Felipe Neves
b50cb2a537 drivers: counter: esp32: add support for esp32c3
to the unified esp32 counter driver.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-11-11 19:14:15 -05:00
Wouter Cappelle
ebed957005 modem: Update modem sockets poll to allow eventfd
The modem sockets poll implementation does not allow
a combination of poll on modem sockets and on other sockets
like eventfd. This blocks trivial application signalling. Current
users are using a poll timeout, which needs to check if other
work needs to be done in the thread (eg: lwm2m engine).
To allow proper signalling with eventfd, the non offload poll
methods needs to work for the modem sockets.
This commit is implementing this for POLLIN.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2021-11-11 19:12:46 -05:00
Henrik Brix Andersen
2e8cc9f9b0 drivers: gpio: add combined drive strength flags and mask
Introduce combined GPIO drive strength flags for GPIO controllers only
supporting either default or alternative drive strength regardless if
the pin is driven to a high or a low level.

Fixes: #30329

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-11 07:20:12 -05:00
Alex Sergeev
1c53e68459 drivers: ethernet: mcux: Bugfix ptp_clock_adjust
ptp_clock_adjust() API call for mcux driver has a bug where
increment gets compared with an unsigned int, causing it to
always return -EINVAL.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2021-11-11 07:05:22 -05:00
Johan Hedberg
224468f35b Bluetooth: drivers: h4: Fix uart_fifo_fill return value handling
The return value of uart_fifo_fill could potentially be negative, so
make sure the code doesn't do anything bad in that case.

Fixes #39823

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-11-10 14:17:50 +01:00
Johan Hedberg
cc2d5f8a45 Bluetooth: drivers: h4: Fix uart_fifo_read return value handling
Make sure negative error returns from uart_fifo_read() are correctly
handled.

In the same go, the logic of reading packet headers (ACL/event/ISO) is
refactored into its own helper function. This also fixes having an
appropriate name for the variable that tracks how many header bytes have
already been read (it was called "to_read" and now it's called
"bytes_read").

Fixes #39805

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-11-10 14:17:50 +01:00
Nick Ward
fa94be591d drivers: spi_nrfx_spim: workaround for nRF52832 errata anomaly 58
See:
https://infocenter.nordicsemi.com/index.jsp?topic=%2Fstruct_nrf52%2Fstruct%2Fnrf52832_errata.html
https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_3_Errata_v1.0.pdf

Code derived from the example PAN 58 workaround code.

Adds a new nRF SPIM Devicetree binding property called
anomaly-58-workaround that allows the workaround to be enabled
if required per SPIM instance.

Signed-off-by: Nick Ward <nick.ward@setec.com.au>
2021-11-09 20:04:45 -05:00
Daniel Leung
40c2b1e99c uart: add API support for wide data
This adds API to support datum more than 8-bit wide. Drivers are
still responsible for the implementation.

Fixes #31914

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-11-09 19:44:38 -05:00
Dominik Ermel
bd6cc1fe35 drivers/flash/nrf_qspi_nor: Modify qspi_erase loop condition
The commit removes an error check from the erase loop and instead
add breaks in places where errors that would break an execution of
the loop occur.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-09 16:02:26 -06:00
Francois Ramu
2185863d3b drivers: adc: add the stm32U5 devices to the adc driver
The STM32U5x device has ADC instance of different versions
similar to the stm32H7 about the oversampling.
ADC1 of 14bit resolution has a ratio from 1..1024 on OSR[9:0]
ADC4 of 12bit resolution has a ratio on OVSR[2:0]

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-09 15:59:23 -06:00
Francois Ramu
e26fcc47b9 drivers: adc: stm32 oversampling includes the ADC of the stm32U5 soc
This commit extends the configuration of the oversampling
ratio and shift for the stm32U5xx soc, depending on the
ADC instance: ratio is a value from 1..1024 or a LL_ADC_OVS_RATIO_x
to be used with the stm32Cube LL function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-09 15:59:23 -06:00
Francois Ramu
cf60639390 drivers: serial: stm32 usart driver clears the RXNE through flag
For some stm32 soc devices, the USART (or UART) flag RXNE is cleared
by the LL_USART_ClearFlag_RXNE function which directly writes
the RXNE bit of the Status register. This is the case with the
stm32F1x, stm32F2x,stm32F4x, stm32L1x.
Some other are using the Rx Data Flushing function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-09 15:43:48 -05:00
Sylvio Alves
b0c48a2182 drivers: uart: esp32: set device to initialize pre-kernel
Uart post kernel initialization does not allow starting shell
properly. This issue was added in UART unifying PR.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-09 15:18:15 -05:00
Emil Lindqvist
38eed4a49e sara-r4: increase socket processing prio
Higher socket processing prio is required for offloaded sockets.

Resolves #40074

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-11-09 14:40:54 -05:00
Bartosz Bilas
ee95b5317a drivers: sensor: lsm6dsl: improve driver initialization
Take into account the return code of the bus_init function
and propagate codes from the init* functions to the user
instead of hardcoded -EIO. While at it set the ERROR
level message to the logs.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-11-09 08:32:13 -06:00
Andrzej Głąbek
760adff120 drivers: spi_context: Correct alignment of LOG_DBG() parameters
so that the call looks nicer.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-09 12:46:08 +01:00
Andrzej Głąbek
688d81813e drivers: spi_context: Fix handling of zero-length buffers
In some cases, it is quite useful to have the possibility to also
include zero-length buffers in a buffer set used in transfers
(for example, when frames in a protocol consist of several parts,
of which some are optional). So far, the behavior of spi_context
update functions was that the transfer in a given direction was
finished when a zero-length buffer was encountered in the buffer
set. Change those functions to simply skip such buffers. Correct
in the same way also the spi_context_buffers_setup() function.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-09 12:46:08 +01:00
Andrzej Głąbek
3489ca9da2 drivers: spi_context: Do not use transfer timeout in slave mode
Do not use any timeout in the slave mode, as in this case it is not
known when the transfer will actually start and what the frequency
will be.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-09 12:46:08 +01:00
Henrik Brix Andersen
5bc0451f72 drivers: can: remove DT_CHOSEN_ZEPHYR_CANBUS_LABEL macro
Remove the DT_CHOSEN_ZEPHYR_CANBUS_LABEL macro and replace it with
DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus)) were possible.

Where both devicetree CAN controllers and Kconfig specified CAN loopback
controllers are supported, the macro is replaced with
DT_LABEL(DT_CHOSEN(zephyr_canbus)) for now.

This is the first pass for removing the requirement for devicetree
labels for CAN controllers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-09 11:19:50 +01:00
Ryan Erickson
270608139f modem: hl7800: remove NEWLIB_LIBC dependency
Zephyr LIBC minimal has definitions for struct tm.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-11-09 11:19:02 +01:00
Ruibin Chang
e505f2476a ITE drivers/timer: update timer_init() definition
Update timer_init() definition.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2021-11-09 11:18:42 +01:00
Lukasz Maciejonczyk
c930262fd8 drivers: ieee802154: nrf5: refactor storing mac keys
This commit makes nrf5_config_mac_keys function more generic.
Is uses lookup table for storing keys to override. It removes old keys
before storing new ones.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-11-09 11:18:31 +01:00
Andrzej Głąbek
f7466d28fd drivers: spi_nrfx_spim/spi: Fix initialization of CS GPIOs
This is a follow-up to commits 99daca9bba
and ae03c0a6bf.

nRF SPI driver shims cannot use devicetree instance indexes, they need
to use the DT_NODELABEL macro and SoC peripheral instance indexes.
Correct the macros used in initialization of CS GPIOs in those shims.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-09 11:11:19 +01:00
Benjamin Lindqvist
0ab1bf42b3 drivers: sensor: lis2dh: Level triggered interrupts
Both DRDY and motion interrupts behaves like level signals since they
remain asserted until they're cleared. Configuring them as edge
interrupts is dangerous because if we ever miss an interrupt, it may
never get cleared and thus will never trigger again.

Treating them as edge signals seems to have no advantages, other than
being marginally simpler to implement.

The patch has gotten many hours of run-time on real hardware using a
nRF52-based board and a LIS3DH with both interrupts connected and
heavily utilized.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2021-11-08 15:37:57 -06:00
Christopher Friedt
918a574c88 clock: add k_cycle_get_64
This change adds `k_cycle_get_64()` on platforms that
support a 64-bit cycle counter.

The interface functions `arch_k_cycle_get_64()` and
`sys_clock_cycle_get_64()` are also introduced.

Fixes #39934

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-11-08 13:41:53 -05:00
Bartosz Bilas
f445cb9a7e drivers: ieee802154_rf2xx: convert to use spi_dt_spec
Convert ieee802154_rf2xx driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-08 11:06:16 -05:00
Johann Fischer
02c32d4474 usb: move USB_DEVICE_REMOTE_WAKEUP option to drivers
Kconfig USB_DEVICE_REMOTE_WAKEUP option depends only on
USB device controller capability, but is not controlled
by the USB device controller drivers configuration.
Move USB_DEVICE_REMOTE_WAKEUP option to drivers and
make it promptless.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-08 17:01:32 +01:00
Erwan Gouriou
08bb61e0ff drivers/disk: sdmmc: stm32: DMA header requested on L4/F7 series
Even if not used DMA HAL is required in L4/F7 SD HAL driver.
Add them for these specific series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-08 10:58:49 -05:00
Felipe Neves
857a188c76 drivers: watchdog: esp32: enabled esp32c3
support for the unified esp32 wdt driver.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-11-08 10:56:28 -05:00
Yuriy Vynnychek
4ae0165c8b drivers: ieee802154: b91: Kconfig update with new params.
Added SET_TXRX_DELAY_US and CCA_RSSI_THRESHOLD params to Kconfig.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-11-08 09:31:53 -05:00
Alexander Wachter
ecd7c23daa drivers: hwinfo: shell: Add reset cause shell command
This commit adds shell commands for the reset cause API
- show: show the persistent reset cause
- clear: clear the persistent reset cause
- supported: list all supported reset causes

Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
2021-11-07 14:55:52 -05:00
Alexander Wachter
5db37b12a3 drivers: hwinfo: shell: rename args to satisfy rule 5.7
This commit changes the shell argument name from shell to sh
to satisfy the warning
"Violation to rule 5.7 (Tag name should be unique) tag: shell"

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-11-07 14:55:52 -05:00
Henrik Brix Andersen
c817a09b0a canbus: rename zephyr,can-primary chosen property to zephyr,canbus
Rename the Zephyr chosen property for specifying the default CAN bus
controller from "zephyr,can-primary" to "zephyr,canbus".

The "zephyr,can-primary" property name was selected in antipation of
adding support for redundant CAN networks, which we have yet to
add. Meanwhile, the "primary" term causes confusion for non-redundant
CAN bus configurations (and the "can" term doesn't match the name of the
Zephyr CAN bus subsystem).

The CAN in Automation (CiA) 302-6, which deals with CANopen network
redundancy, uses the terms "default interface" and "redundant
interface". If/when we add support for redundant CAN networks, the
"zephyr,canbus" chosen property can be supplemented with a
"zephyr,canbus-redundant" chosen property.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-07 09:05:39 -05:00
Bartosz Bilas
ee7cd10563 drivers: modem: improve modem context RSSI member
The previous bf68b67 commit incorrectly passes minfo.mdm_rssi
value to the modem context data_rssi member during the driver
initialization which causes the `modem info` shell command
to return 0 as RSSI value. Fix that by changing data_rssi
modem ctx member to a pointer that is assigned to the RSSI
variable stored within the modem driver context structure.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-07 15:02:43 +02:00
Andrei-Edward Popa
5413661a81 boards: xtensa: add ledc support to the esp32 board
add ledc to board dtsi file,
change compatible and device define in pwm driver,
add yaml for board ledc support,
fix missing include for board in gpio include

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2021-11-07 05:36:42 -05:00
Jan Zyczkowski
d435340f1b drivers: led_pwm: Decrease power consumption
Changed pwm_pin_set_cycles into pwm_pin_set_nsec
to decrease power consumption. Changed default
value for period to 100000. There is no need in having
period for pwm leds equal to 100 cycles as human eye has ~100 fps.

Signed-off-by: Jan Zyczkowski <jan.zyczkowski@nordicsemi.no>
2021-11-06 21:38:35 -04:00
Guillaume Lager
ec0d5b6e8d driver: modem: Fix mux device name comparison
CONFIG_UART_MUX_DEVICE_NAME is used as a prefix for the uart muxes
name. Pointer comparison will always return false

Fix #39774

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-11-06 10:20:42 -04:00
Jair Jack
8e95b95bb4 drivers: modem: gsm: Fix to COPS cmd parse info
drivers: modem: gsm: Quectel EC21 and BG9x act as a gsm modem without
problem, but COPS commands can returns just one value with 'mode'.

Format and oper are not mandatory. This modification reads 'mode'.
Also a modification on modem_cmd_read_cops_cmd is needed.

Signed-off-by: Jair Jack <jack@icatorze.com.br>
2021-11-06 10:20:11 -04:00
Sylvio Alves
ab91612a6d driver: esp32: I2C code refactoring
Use i2c_hal functions to enable support for
multiple SoCs.

Use DT compat to enable I2C from device
tree configuration

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-05 14:07:09 -04:00
Daniel N. Hansten
48a1e76e83 drivers: led: pca9633: add support for multiple devices
PCA9633 driver does not cunnetly support multiple devices.
Updated the driver to use DT_INST_FOREACH_STATUS_OKAY to
configure all devices defined in the device tree.
Convert driver to use `i2c_dt_spec` helpers.

Fixes #40076

Signed-off-by: Daniel N. Hansten <dnh2000@gmail.com>
2021-11-05 10:27:48 -05:00
Dino Li
963d05bd52 timer: it8xxx2: enable free run timer overflow interrupt
The ISR will be called on each overflow.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-11-05 03:03:16 -04:00
Sylvio Alves
27e44acda1 clock: esp32: unify clock control for all espressif socs
This joins all clock control handling to same source
by using hal clock functions. It also brings ESP32C3
clock support.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-04 15:21:26 -04:00
Francois Ramu
2ebf885ab0 drivers: usb device driver for the stm32u5 soc family
This commit enables the HSI48 clock for the stm32U5 soc family
to use the USB device peripheral.
Enable the VDD USB voltage supply.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-04 10:25:17 -05:00
Bartosz Bilas
41325bd1fb drivers: spi: remove spi_context_cs_configure function
Since cs gpios are initialized during driver initialization
remove spi_context_cs_configure that is not longer need.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
7ba48aa7a9 drivers: spi_xlnx_axi_quadspi: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
258f2d85f7 drivers: spi_xec_qmspi: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
997723b760 drivers: spi_sifive: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
81a3900b35 drivers: spi_sam0: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
61646649a1 drivers: spi_sam: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
05f326c96e drivers: spi_rv32m1_lpspi: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
97d3de2349 drivers: spi_psoc6: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
225f0b3825 drivers: spi_oc_simple: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
99daca9bba drivers: spi_nrfx_spim: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
ae03c0a6bf drivers: spi_nrfx_spi: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
054fb71bf0 drivers: spi_mcux_lpspi: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
ab2d23c5f4 drivers: spi_mcux_flexcomm: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
0ccdd5f263 drivers: spi_mcux_dspi: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
bcd0364ab8 drivers: spi_gecko: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
f40be1f17f drivers: spi_esp32_spim: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
70a65b229b drivers: spi_dw: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
37925430b1 drivers: spi_cc13xx_cc26xx: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
b370fb8fad drivers: spi_b91: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
388a33c188 drivers: spi_ll_stm32: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
54907c7014 drivers: spi: spi_context: improve support of multiple cs gpios
Add extra cs_gpios and num_cs_gpios members into
spi_context structure that will be used to
initialize all defined cs gpios during the driver
initialization using SPI_CONTEXT_CS_GPIOS_INITIALIZE macro.
While at it add a new spi_context_cs_configure_all
function that allows the user to configure
all available cs gpios in inactive mode.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
ea25b92cd9 drivers: spi: use dedicated init priority
A couple of SPI drivers use CONFIG_KERNEL_INIT_PRIORITY_DEVICE
as init priority for driver initialization. Let's change
it to the dedicated CONFIG_SPI_INIT_PRIORITY to make it
compatible with other ones.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Tomasz Bursztyka
23a0ce4ff3 drivers/pcie: Add PTM root device driver as well as implement PTM API
Any exposed PTM root device will by default see their root capability
enabled so they will become PTM responder.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-04 11:06:02 -04:00
Tomasz Bursztyka
766f567bfc drivers/pcie: Add PCIE logging module
Such module is missing and will prove to be useful for future features
and/or printing out debug messages on existing ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-04 11:06:02 -04:00
Francois Ramu
95e2c39497 drivers: uart stm32 flushing Rx register once the RXNE irq is enabled
When the "Read data register not empty" irq occurs,
this commit is cleaning the RXNE flag by flushing the RX register
since the Receive Data Reg. (USART_RDR) has not be read previously
This could be the case when aborting a Rx for example.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-04 09:45:11 -05:00
Erwan Gouriou
608b358d6b drivers/disk: sdmmc: stm32: err var init is not required
err is set unconditionally in these functions.
No need to initialize it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-04 09:40:47 -04:00
Erwan Gouriou
34a50e313d drivers/disk: sdmmc: stm32: Enable hw fc only after card init
During SDMMC card init, HW_FC is disabled by default, overwriting
driver configuration.
To avoid this, move HW FC configuration after card init.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-04 09:40:47 -04:00
Andrzej Głąbek
527315d451 drivers: flash: nrf_qspi_nor: Add support for device power management
Deinitialize the nrfx_qspi driver for periods when the device
is suspended. For flash chips with "has-dpd" property set, when
suspending/resuming the device, issue also the enter/exit Deep
Power-down Mode command, respectively.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-04 13:28:55 +01:00
Andrzej Głąbek
70efbcc15e drivers: flash: nrf_qspi_nor: Clean up handling of DT properties
Use the read-only device config structure (so far used only for storing
the flash chip size and its JEDEC ID) to store the nrfx_qspi driver
configuration (it is not modified after initialization, so there is no
need to keep it in RAM) and fill it with settings read from devicetree,
processing them all at compile time (e.g. use the DT_STRING_UPPER_TOKEN
macro instead of switch-case blocks for getting values of "readoc" and
"writeoc" properties).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-04 13:28:55 +01:00
Maureen Helm
32b4950c61 drivers: eeprom: Refactor drivers to use shared init priority
Refactors all of the EEPROM drivers to use a shared driver class
initialization priority configuration, CONFIG_EEPROM_INIT_PRIORITY, to
allow configuring EEPROM drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The
exceptions are at2x and emul drivers which have dependencies on SPI,
I2C, or flash drivers and must therefore initialize later than the
default device priority.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-11-04 07:33:01 -04:00
Dominik Ermel
c716514ca7 drivers/flash/nrf_qspi_nor: Remove qspi_nor_read_id param flash_id
The commit removes redundant flash_id argument that the function
can obtain itself from dev.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-04 07:23:43 -04:00
Dominik Ermel
f7ebbc5374 drivers/flash/qspi_nor_flash: Remove dev null check
The commit removes dev != NULL check from qspi_nrfx_configure.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-04 07:23:43 -04:00
Bartosz Bilas
7e43332436 drivers: adc: mcp320x: convert to spi_dt_spec
Convert mcp320x driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 07:18:09 -04:00
Julien D'ascenzio
7b21050f19 drivers/uart: stm32: fix a bug during transmission
If a transmission is made with poll_out and immediately after an other
transmission is made with interrupt api the transmission is locked.
We fix this behavior by clearing the tx_poll_stream_on flag during the
irq_tx_enable function

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2021-11-04 07:13:11 -04:00
Gerard Marull-Paretas
811a09bd83 drivers: serial: npcx: drop inline attribute for PM action callback
Making function inline doesn't provide any benefit here, and is
inconsistent with all other definitions.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Gerard Marull-Paretas
cb329bbefe drivers: sensor: bme280: make PM action callback static
The PM action callback is never accessed externally, so make it static.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Gerard Marull-Paretas
4baf1e01ff drivers: use common PM action callback naming
The PM callback is no longer referenced as "pm_control" but
"pm_action_cb", so reflect this new naming on the callbacks.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Gerard Marull-Paretas
01430da395 drivers: video: ov2640: remove deprecated PM macro
Use NULL if no PM is available.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Gerard Marull-Paretas
dd9d0560d1 drivers: spi: esp32_spim: use NULL for PM callback
A non-existing definition was being used (probably a misspelled
deprecated macro).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Gerard Marull-Paretas
79effd7d1a drivers: sensor: si7210: make PM callback static
The PM action callback is not used externally, so make it static.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Sylvio Alves
d5aa5c2a77 drivers: esp32: uart: use hal functions
In order to have Espressif SoCs working with
the same uart drivers, all low level functions
are now replaced to hal_espressif HAL calls.

This also changes pinmux, gpio and uart
init order to meet its dependencies.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-03 16:47:32 -04:00
Gerard Marull-Paretas
1cee284a46 pm: device: runtime: use pm_device_runtime* namespace
Move all PM device runtime API calls from pm_device* to the
pm_device_runtime* namespace.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 16:37:33 -04:00
Erwan Gouriou
e19716e5c9 include/driver/clock_control: stm32: Remove STM32_PLL_PREDIV1
Make the code coherent with the comment:
purely remove STM32_PLL_PREDIV1.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-03 16:19:06 -04:00
Erwan Gouriou
ace71a98a4 drivers/clock_control: stm32: Remove CLOCK_STM32_ Kconfig symbols
Remove deprecated Kconfig based STM32 clock configuration system.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-03 16:19:06 -04:00
Andrzej Głąbek
eafafa2816 drivers: spi_nrfx_spis: Fix handling of buffer lengths
Do not limit the length of the prepared transfer to the shorter of
provided TX and RX buffers if both are used. The SPIS peripheral
cannot handle scattered buffers anyway, so there is no point in
getting the common part of TX and RX buffers for a partial transfer,
like it is done for SPI and SPIM peripherals; everything what is
possible needs to be transferred in one shot. For the same reason,
there is no point in calling spi_context_buffers_setup() and using
the related part of the spi_context structure, hence the call is
removed and buffer pointers are used directly.
Also return an error if a requested transfer length exceeds the SPIS
peripheral hardware limit, instead of silently limiting the transfer
like it was done so far.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-03 17:34:35 +01:00
Armando Visconti
aa3f3d943a drivers/sensor: lsm6ds0: Fix SENSOR_DEG2RAD_DOUBLE macro
In order to convert from degrees to radiants the SENSOR_DEG2RAD_DOUBLE
macro must divide the argument by 180 degrees and multiply by PI
radiants, and not the other way around. Please note that same macro
is already defined in the correct way in other sensor drivers as well.
(Fix #39483)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-11-03 08:16:45 -05:00
Robert Lubos
17856620cf drivers: ieee802154_cc1200: Fix unchecked return value coverity issue
Verify the return value of `gpio_add_callback()` call.

CID: 240678

Fixes #39825

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-03 11:17:58 +01:00
Robert Lubos
cf49c8676c drivers: ieee802154_cc2520: Fix unchecked return value coverity issue
Verify the return value of `gpio_add_callback()` calls.

CID: 240700

Fixes #39806

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-03 11:17:58 +01:00
Henrik Brix Andersen
0acb38adf1 drivers: gpio: mcux: add drive strength flags support
Add support for setting high/low GPIO output drive strength.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-02 22:25:33 -04:00
Andrew Hedin
52c298e0e3 drivers: sensors: lis2dh: Add ability to read temperature
Allow user to read temperature from LIS2DH family of sensors.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2021-11-02 22:23:39 -04:00
Erwan Gouriou
9f6246c325 drivers/disk: sdmmc_stm32: Add Hardware FC Kconfig option
Add a Kconfig symbol to enable use of SDMMC hardware flow control.
In specific cases, this feature could help to avoid FIFO ovderrun
and underrun errors.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-02 22:20:36 -04:00
Erwan Gouriou
8bd5549021 drivers/disk: sdmmc_stm32: Convert driver to IT driven mode for r/w
Add IT driven read/write access.
2 new semaphores are added to protect IT driven procedures.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-02 22:20:36 -04:00
Dawid Niedzwiecki
65277d4770 i2c: emul: Add get_config function
Add get_config function to I2C emulator.

Also update tests using I2C emulator to use i2c_get_config.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2021-11-02 16:46:33 +01:00
Dawid Niedzwiecki
51c3e0de79 i2c: npcx: Add get_config function
Add get_config function to NPCX I2C driver. The master mode is hardcoded
and get the speed from a controller.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2021-11-02 16:46:33 +01:00
Dawid Niedzwiecki
72486b6971 i2c: Add get_config to I2C API
Some applications need to get the current I2C configuration. Add a
proper callback to I2C API under Kconfig option not to change
applications that don't need this feature.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2021-11-02 16:46:33 +01:00
Francois Ramu
a1e7c4dbfa drivers: clock control disable AHB3 clock in stm32_clock_control_off
This commit is fixing the error on clock control for the AHB3
in the stm32_clock_control_off function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-02 13:24:10 +01:00
Nicolai Glud
8773c31047 drivers: flash: the chosen_flash variable was not read properly
This fixes an issue with code relocation.

Signed-off-by: Nicolai Glud <nicolai.glud@prevas.dk>
2021-11-02 13:23:56 +01:00
Krzysztof Chruscinski
9174cd8dbc drivers: watchdog: Add software watchdog based on counter
Added watchdog implementation which is using counter device
to implement watchdog driver API. Watchdog timeout is called from
counter interrupt context. Some counter implementations support
using ZLI interrupt level which can be use here as well. Watchdog
like this can be used along hardware watchdog to cover for its
limitations, i.e. Nordic watchdog resets unconditionally after
62uS after triggering watchdog interrupt. It is not enough time
to dump logging data.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-11-02 13:22:58 +01:00
Henrik Brix Andersen
351d065f63 drivers: pwm: mcux: ftm: return -EBUSY if PWM capture in progress
Return -EBUSY (not 0) from pwm_pin_enable_capture() if PWM capture is
already in progress.

Fixes: #39817

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-01 22:11:04 -04:00
Jun Lin
5d72417df4 drivers: spi: npcx: add SPI support to access the SPI flash
The FIU/UMA module in the NPCX chip provides an dedicated SPI interface
to access the SPI flash. This commit adds the driver support for it.
With this commit, the application can call the flash APIs
(via spi_nor.c) to access the internal flash of NPCX EC chips.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Change-Id: I32bbf09f6e014b728ff8e4692e48151ae759e188
2021-11-01 21:48:20 -04:00
Felipe Neves
0a0fed7879 drivers: spi: esp32: add esp32c3 support
to the esp32 spi unified driver

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-11-01 21:47:26 -04:00
Carlo Caione
c03519fffc mbox: ipc: s/_MBOX_NRFX/_MBOX_NRFX_IPC/
Use a more precise Kconfig symbol name to avoid namespace conflicts when
more NRFX-dependent drivers will be added.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-11-01 11:30:59 -04:00
Henrik Brix Andersen
2d7cabb970 drivers: flash: spi_flash_at45: remove unused variable
Remove unused variable.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-11-01 10:33:09 -04:00
Jacob Siverskog
861787602e ite: drivers/i2c: fix potential NULL pointer dereference
reorganize code so that null pointer check is done prior to accessing
element.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2021-10-29 22:55:50 -04:00
Maureen Helm
b539699a98 drivers: dma: Refactor drivers to use shared init priority
Refactors all of the DMA drivers to use a shared driver class
initialization priority configuration, CONFIG_DMA_INIT_PRIORITY, to
allow configuring DMA drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

Most drivers previously used CONFIG_KERNEL_INIT_PRIORITY_DEFAULT or
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, therefore the default for this new
option is the lower of the two, which means earlier initialization.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-29 22:55:03 -04:00
Maureen Helm
b071588265 drivers: display: Refactor drivers to use shared init priority
Refactors the remaining display drivers that didn't already use the
shared driver class initialization priority configuration,
CONFIG_DISPLAY_INIT_PRIORITY.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-29 22:55:03 -04:00
Felipe Neves
4c069b9894 drivers: serial: add support for esp32c3
into esp32_serial unified driver

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-29 16:09:09 -04:00
Bartosz Bilas
84dc576670 drivers: sensor: lsm6dsl: convert to use spi_dt_spec and i2c_dt_spec
Convert lsm6dsl driver to use `spi_dt_spec` and `i2c_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-10-29 12:21:27 -05:00
Dmytro Firsov
d9a3efb834 xenvm: drivers: serial: Implement serial interface to Xen PV console
This commit adds minimal support of Xen hypervisor console via UART-like
driver. Implementation allows to use poll_in/poll_out char interface for
uart_console.c driver directly to HV console instead of using Xen
virtual PL011 UART. Future implementation will support interrupt driven
interface on Xen event channels, currently it is under development.

Also this commit introduces early console_io Xen interface, which allows
to receive printk/stdout messages quickly after start, but requires Xen,
built with CONFIG_DEBUG option.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2021-10-29 15:23:33 +02:00
Martin Jäger
5511cba5fe drivers: can: Add get_max_filters API
The maximum number of concurrent filters depends on the hardware and
the driver implementation. This API allows the application to obtain
the maximum number of available filters.

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-10-28 13:56:58 -04:00
Ryan Holleran
cbb0585e0b drivers: sensor: fxos8700: Keep current power mode when setting ODR
Setting the power mode to enabled causes other initialization to not
occur. Restore the power mode set upon entry when exiting.

Signed-off-by: Ryan Holleran <rhollerar@gmail.com>
2021-10-28 10:10:52 -05:00
Daniel Schultz
dbf2d02747 drivers: led: Fix warnings in shell_print
Change format in various shell_error calls from int to long unsigned
int.

Warning:

    warning: format '%d' expects argument of type 'int', but argument
    6 has type 'long unsigned int'

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
2021-10-28 10:38:01 -04:00
Jakub Rzeszutko
36f907e43c driver: qdec - fix step limits
Corrected the condition that checks the maximum number of steps
allowed.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2021-10-28 08:29:59 -05:00
Bartosz Bilas
0a7d8d4452 drivers: sensor: bmp388: convert to spi_dt_spec
Convert bmp388 driver to use spi_dt_spec helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-10-28 08:29:07 -05:00
Bartosz Bilas
022bc83351 drivers: sensor: ms5607: convert to spi_dt_spec
Convert ms5607 driver to use spi_dt_spec helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-10-28 08:28:26 -05:00
Immo Birnbaum
811d77a88a drivers: serial: xlnx_xuartps: Fix interrupt-driven operation
Fixes interrupt-driven operation. With the previous way of
handling the TX FIFO and the interrupt flags, the operation
of the UART was prone to stalling when using it as the
console I/O device.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2021-10-28 15:26:50 +02:00
Immo Birnbaum
fe33a24721 drivers: serial: xlnx_xuartps: enable this driver for Zynq-7000 series SoCs
Enable this driver to be used in conjunction with Xilinx Zynq-7000
series SoCs.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2021-10-28 15:26:50 +02:00
Immo Birnbaum
266875ead0 drivers: ethernet: xlnx_gem: Zynq-7000 support for the Xilinx GEM driver
Add support for the Xilinx Zynq-7000 SoC family to this driver. This
includes some SoC-specific register accesses when setting an updated
TX clock divider, also, the device tree binding now supports higher
MDC clock divisor values when the current target SoC is a Zynq rather
than a ZynqMP.

With regards to the use of this driver in a QEMU simulation of the
Zynq-7000, the Kconfig file is modified so that the driver is not
enabled unless QEMU networking is set to Ethernet mode.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2021-10-28 15:26:50 +02:00
Immo Birnbaum
315ad1d6e6 drivers: timer: arm_arch_timer: Workaround for Cortex-A9 erratum 740657
Modification of the ARM architected timer driver and its configuration
data in order to address an erratum which exists at least in the Cor-
tex-A9 CPU, and which can also be observed in the QEMU implementation
of the Cortex-A9.

Comp.: ARM Cortex-A9 processors Software Developer Errata Notice
ARM document ID032315
Erratum 740657

This erratum causes a spurious interrupt pending indication with the
interrupt controller if no new compare value is written within the
timer ISR before the interrupt is cleared. This is usually the case
in tickless mode. If the spurious interrupt is not prevented, the
timer ISR will be called twice, but on second execution, the pending
flag is not set within the timer's register space. Not handling this
issue will lead to erratic tick announcements to the kernel.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2021-10-28 15:26:50 +02:00
Glauber Maroto Ferreira
1af506dd32 soc: riscv: esp32c3: drivers: flash: add support
to host SPI Flash driver.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-28 06:47:21 -04:00
Glauber Maroto Ferreira
dcf26d72f5 soc: esp32s2: drivers: flash: add support
to host SPI Flash driver.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-28 06:47:21 -04:00
Gerson Fernando Budke
45d60c4d4c drivers: serial: Add gd32 uart driver
Introduce minimal serial driver support for gigadevice soc.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-10-28 11:17:25 +02:00
Jordan Yates
3b8e2f8983 drivers: regulator: convert to gpio_dt_spec
Convert regulator_fixed GPIO usage to utilize `struct gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-28 11:15:12 +02:00
Felipe Neves
1e328fe109 clock_control: esp32c3: added clock control
gating driver support for esp32c3 SoC family

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-27 15:09:08 -04:00
Marek Pieta
07b9e4e992 drivers: led_pwm: Fix power management action callback
A single PWM driver can be used for multiple LED numbers. In that
case -EALREADY may be reported. It should be ignored.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2021-10-27 13:45:43 -04:00
Carlo Caione
012591c4a5 mbox: Introduce MBOX NRFX IPC driver
Rewrite the NRFX IPC driver to properly support multi-channel addressing
leveraging the newly introduced MBOX APIs.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-10-27 18:27:21 +02:00
Carlo Caione
1976f33e87 drivers: mbox: Introduce MBOX driver class
One limitation of the current IPM API is that it is assuming that the
hardware is only exporting one single channel through which the data can
be sent or signalling can happen.

If the hardware supports multiple channels, the IPM device must be
instantiated (possibly in the DT) several times, one for each channel to
be able to send data through multiple channels using the same hw
peripheral. Also in the current IPM API only one callback can be
registered, that means that only one driver is controlling all the
signalling happening on all the channels.

This patch is introducing a new MBOX API that is supporting
multi-channel signalling and data exachange leveraging and extending the
previous (and outdated) IPM API.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-10-27 18:27:21 +02:00
Nicolas Pitre
bc41234104 ethernet: Synopsys DesignWare MAC driver
This is a driver for the Synopsys DesignWare MAC. It should work
with the "DesignWare Cores Ethernet Quality-of-Service" versions 4.x
and 5.x.

This driver uses a zero-copy strategy, meaning that the hardware
reads and writes data directly from/to packet fragment buffers
provided by the network subsystem without first copying the data into
a dedicated DMA bounce buffer.

Platform specific setup is necessary for the hardware to work.
Currently, only the STM32H7X series is implemented and tested.
While this part needs refinement, this driver performs better and uses
far less code space than the HAL-based alternative.

Not yet implemented:

- MDIO (it is WIP, currently relying on default PHY config)
- PTP support
- VLAN support
- various hardware offloads (when available)

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-10-27 10:43:05 -04:00
Maureen Helm
9eef764c65 drivers: dac: Refactor drivers to use shared init priority
Refactors all of the DAC drivers to use a shared driver class
initialization priority configuration, CONFIG_DAC_INIT_PRIORITY, to
allow configuring DAC drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The
exceptions are dacx0508, dacx3608, and mcp4725 drivers which have
dependencies on SPI or I2C drivers and must therefore initialize later
than the default device priority.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-27 10:58:33 +02:00
Maureen Helm
1788b036fb drivers: sensor: Fix ina219 driver when device pm enabled
Fixes a build error in the ina219 sensor driver when device power
management is enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-26 20:51:13 -04:00
Maureen Helm
be38a87089 drivers: sensor: Fix bq274xx driver when device pm enabled
Fixes a build error in the bq274xx sensor driver when device power
management is enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-26 20:51:13 -04:00
Henrik Brix Andersen
91233dba70 drivers: entropy: add driver for the neorv32 trng
Add entropy driver for the NEORV32 True Random Number Generator (TRNG).

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-10-26 17:53:15 -04:00
Bartosz Bilas
7965d7582b drivers: wifi: eswifi: convert to spi_dt_spec
Convert eswifi driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-10-26 17:40:54 -04:00
Jordan Yates
526b3e9605 lora: asynchronous packet reception
Adds functionality to receive LoRa packets asynchronously. Reception
runs continuously until cancelled by another call to `lora_recv_async`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-26 15:48:09 +02:00
Jay Vasanth
c214c59548 Microchip: MEC172x: eSPI driver
MEC172x eSPI driver, eSPI pin programming, interrupt updates related
to eSPI and other updates for MEC172x eSPI driver.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2021-10-26 09:27:20 -04:00
Bartosz Bilas
bf68b670f1 drivers: modem: gsm: extend modem info struct about RSSI value
Add RSSI member into gsm_ppp_modem_info structure in order to
get that information using the gsm_ppp_modem_info function.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-10-26 14:47:38 +03:00
Bartosz Bilas
5107691441 drivers: modem: gsm: allow the user to get modem information
Make modem_info structure public in order to allow the user
to get modem information using gsm_ppp_modem_info function.
Move modem info query commands into separate function
that's called only once during gsm configuring because
there is no necessity to re-querying modem since
they should not change.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-10-26 14:47:38 +03:00
Bartosz Bilas
cb30cc5f8c drivers: modem: gsm: move header file into modem directory
There is a specified location for modem drivers so move this
header right there.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-10-26 14:47:38 +03:00
Robert Lubos
a2e619ec8b drivers: uart_nrfx_uarte: Use predefined data pointer where applicable
After recent changes in the driver, the predefined `data` pointer in
`uarte_nrfx_pm_control()` would not be used in CONFIG_UART_ASYNC_API
configuration. Fix this by replacing `get_dev_data()` calls with
predefined data pointer where applicable.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-10-25 19:26:43 -04:00
Francois Ramu
3ee3a46b6a drivers: adc: stm32h7 adc driver has a range for oversampling ratio
On the stm32H7 family, there are ADC which have Oversampling ratio
of 10 bits OSVR[9:0] in the CFGR2 register. It means that oversampling
512x or 1024x are possible.
Other values are not allowed as the oversampling field of the struct
adc_sequence (adc.h) is 2^oversampling.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-10-25 19:15:03 -04:00
Francois Ramu
0af4a393ee drivers: adc: stm32h7 adc driver has a different oversampling ratio
The adc_stm32_oversampling function is used to configure
the ratio and shift for each sequence->oversampling
depending on the soc serie and ADC instance in the serie
In the stm32H7 serie, only ADC3 of ADC_VER_V5_V90 version
have a LL_ADC_OVS_RATIO_x contant (other a 9bit value).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-10-25 19:15:03 -04:00
Francois Ramu
41bfec7c52 drivers: adc: stm32h7 adc driver using LL function
Change the access to the PCSEL register by using the LL function
because on the STM32H7xx soc, some devices have no PCEL register
especially on ADC3 of the stm32H723.
The LL function manages this difference.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-10-25 19:15:03 -04:00
Gerard Marull-Paretas
329f2453c5 drivers: pinctrl: add support for dynamic pin control
Add support for dynamic pin control, that is, allow to change device pin
configuration at runtime. Because no device de-initialization is
available yet, this API has limited usage options, e.g. modify pin
configuration at early boot stage (before device driver is initialized)

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-10-25 15:26:47 -05:00
Gerard Marull-Paretas
4040df096f drivers: pinctrl: initial skeleton
Initial skeleton for pinctrl drivers. This patch includes common
infrastructure and API definitions for pinctrl drivers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-10-25 15:26:47 -05:00
Henrik Brix Andersen
adfd34ed08 drivers: entropy: introduce shared init priority and logging
Introduce Kconfig for setting the driver initialization priority across
the entropy drivers and add a call to the logging template.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-10-25 08:34:29 -05:00
Gerard Marull-Paretas
6869743e28 sensor: qdec_nrfx: fix PM callback signature
The PM action callback had an incorrect signature, probably a leftover
from the actions conversion.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-10-25 08:30:58 -05:00
Jordan Yates
fab00d086e ieee802154: cc2529: convert to _dt_spec
Convert cc2529 driver to `spi_dt_spec` and `gpio_dt_spec`. Required a
whole driver conversion from passing around the driver data struct to
passing around the driver itself.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-25 09:01:05 -04:00
Jordan Yates
eecb6cdaf3 ieee802154: cc1200: convert to _dt_spec
Convert cc1200 driver to `spi_dt_spec` and `gpio_dt_spec`. Required a
whole driver conversion from passing around the driver data struct to
passing around the driver itself.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-25 09:01:05 -04:00
Jordan Yates
21e99902d1 gpio: mcp23s17: convert to spi_dt_spec
Convery mcp12s17 GPIO driver to `spi_dt_spec`. Also perform some minor
cleanup on non-standard device data pointers.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-25 09:01:05 -04:00
Jordan Yates
49fbee42e0 flash: spi_flash_at45: convert to spi_dt_spec
Convert spi_flash_at45 driver to use `spi_dt_spec` helpers.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-25 09:01:05 -04:00
Torsten Rasmussen
bd61122aa2 kconfig: drivers: experimental settings now uses select EXPERIMENTAL
With the introduction of `EXPERIMENTAL` and `WARN_EXPERIMENTAL` in
Zephyr all drivers settings having `[EXPERIMENTAL]` in their
prompt has has been updated to include `select EXPERIMENTAL` so that
developers can enable warnings when experimental features are enabled.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-25 10:46:48 +02:00
Torsten Rasmussen
36f5600387 kconfig: net: experimental settings now uses select EXPERIMENTAL
With the introduction of `EXPERIMENTAL` and `WARN_EXPERIMENTAL` in
Zephyr all subsys/net and drivers/ethernet/Kconfig.e1000 settings
having `[EXPERIMENTAL]` in their prompt has has been updated to include
`select EXPERIMENTAL` so that developers can enable warnings when
experimental features are enabled.

The following settings has EXPERIMENTAL removed as they are considered
mature:
- NET_OFFLOAD
- NET_PROMISCUOUS_MODE

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-25 10:46:48 +02:00
Torsten Rasmussen
8aa7a653d1 kconfig: gpio: remove experimental on GPIO_EMUL setting
The setting GPIO_EMUL is no longer considered experimental.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-25 10:46:48 +02:00
Torsten Rasmussen
b87d8e7d7d kconfig: uart: remove experimental on UART_ASYNC_API setting
The setting UART_ASYNC_API is no longer considered experimental.
Also remove `new` from title and help test as the feature no longer can
be considered new.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-25 10:46:48 +02:00
Maureen Helm
43fa7ce53f drivers: console: Refactor drivers to use shared init priority
Refactors all of the console drivers to use a shared driver class
initialization priority configuration, CONFIG_CONSOLE_INIT_PRIORITY, to
allow configuring console drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEFAULT to preserve
the existing default initialization priority for most drivers.

The driver-specific option, CONFIG_NATIVE_POSIX_CONSOLE_INIT_PRIORITY,
is left intact because the native posix console driver needs to
initialize after the UART console driver when both drivers are enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-23 20:44:49 -04:00
Maureen Helm
165963c115 drivers: counter: Refactor drivers to use shared init priority
Refactors all of the counter drivers to use a shared driver class
initialization priority configuration, CONFIG_COUNTER_INIT_PRIORITY, to
allow configuring counter drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The
exceptions are the maxim_ds3231 and mcp7940n drivers which have a
dependency on a SPI driver and must therefore initialize later than the
default device priority.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-23 20:44:49 -04:00
Maureen Helm
e297f8ee26 drivers: can: Refactor drivers to use shared init priority
Refactors all of the CAN drivers to use a shared driver class
initialization priority configuration, CONFIG_CAN_INIT_PRIORITY, to
allow configuring CAN drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The exception
is the mcp2515 driver which has a dependency on a SPI driver and must
therefore initialize later than the default device priority.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-23 20:44:49 -04:00
Andrei Auchynnikau
3b3a30612f drivers: add adc driver for the NXP RT series
adc driver is based on the NXP MCUX hal library

Signed-off-by: Andrei Auchynnikau <ovchinnikov@strim-tech.com>
2021-10-22 15:43:36 -05:00
Armando Visconti
ea6ad7337c drivers/sensor: lis2ds12: Move odr Kconfig property into dts
Move odr options from Kconfigs to Device Tree. Moreover add
in DT a power-mode option to select among 4 possible values
(PD, LP, HR, HF). The power mode cannot be currently set from
sensor APIs.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-10-22 09:06:07 -05:00
Armando Visconti
e0f06e23ef drivers/sensor: lis2ds12: Move range Kconfig property into dts
Converts lis2ds12 range options (2g, 4g, 8g, 16g) from Kconfig
to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-10-22 09:06:07 -05:00
Armando Visconti
f3ad909abd drivers/sensor: lis2ds12: Add multi-instance support
This commit aligns lis2ds12 sensor driver to latest multi
instance sensor driver model.

In particular it makes use of the stmemsc common routines
and move ctx handler inside struct config, so that the
bus_init routines can be totally avoided.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-10-22 09:06:07 -05:00
Armando Visconti
1c0acad364 driver/sensor: lis2ds12: make use of STdC definitions
Port the lis2ds12 sensor driver on top of the lis2ds12_StdC
HAL interface (in modules/hal/st/sensor/stmemsc/).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-10-22 09:06:07 -05:00
Armando Visconti
dabaaa1e5d drivers/sensor: stmemsc: make use of spi_dt_spec and i2c_dt_spec
Make use of the new DT facilities that introduced two new
bus structures, spi_dt_spec and i2c_dt_spec, as well as the
macros, SPI_DT_SPEC_INST_GET and I2C_DT_SPEC_INST_GET, to
retrieve info from DT.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-10-22 09:06:07 -05:00
Bartosz Bilas
919b3f9165 drivers: sensor: ina23x: fix sample fetching
Fix the usage of sensor shell module that calls sensor_sample_fetch
function with SENSOR_CHAN_ALL id which is not supported and
causes the following error:

uart:~$ sensor get INA237 current
Failed to read sensor: -134
channel idx=31 current =   0.000000

Fix that by adding support for SENSOR_CHAN_ALL channel id.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-10-22 08:51:30 -05:00
Torsten Rasmussen
587285e4de kconfig: canbus: experimental settings now uses select EXPERIMENTAL
With the introduction of `EXPERIMENTAL` and `WARN_EXPERIMENTAL` in
Zephyr all subsys/canbus, subsys/net/l2/canbus, and drivers/can settings
having `[EXPERIMENTAL]` in their prompt has has been updated to include
`select EXPERIMENTAL` so that developers can enable warnings when
experimental features are enabled.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-22 13:59:21 +02:00
Torsten Rasmussen
9a2be89557 kconfig: bluetooth: experimental settings now uses select EXPERIMENTAL
With the introduction of `EXPERIMENTAL` and `WARN_EXPERIMENTAL` in
Zephyr all subsys/bluetooth and drivers/bluetooth/hci settings having
`[EXPERIMENTAL]` in their prompt has has been updated to include
`select EXPERIMENTAL` so that developers can enable warnings when
experimental features are enabled.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-22 13:59:21 +02:00
Neil Armstrong
71766f5c05 interrupt_controller: gicv3_its: Implement Indirect Two-level table
When the ITS is configured with a large number of DeviceID bits,
up to 32, the Device Translation Table can be configured as
"indirect" mode consisting of a 2-level table with the first
level entries pointing to a second level table for each
group of DeviceIDs.

This is necessary to support platforms with DeviceID bits > 16.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-10-21 10:56:15 -04:00
Sylvio Alves
944b6d0486 soc: esp32: use same rom func prefix
This sets esp32 to use common rom functions
prefix among SoCs.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-10-21 10:55:45 -04:00
Sylvio Alves
b0717d518e drivers: gpio: esp32: use dts and improve code checks
This PR updates GPIO driver to use DTS information
regarding gpio availability.

This also fixes interrupt handling and
also removes kconfig definition for GPIO port.

A few configuration checks were also added to
improve code usage.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-10-21 10:53:34 -04:00
Sylvio Alves
7c10e0d947 pinmux: esp32: add missing pull down call
When configuring pin as pull up, pull down needs
to be disabled first.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-10-21 10:53:34 -04:00
Erwan Gouriou
aa144ca3f0 drivers/usb: stm23: Fix deprecated macro declaration
Use of '__DEPRECATED_MACRO' was not compatible with the way macro
is used later in this driver.
Remove it and keep the warning as vector for deprecation information.

Additionally, replace DT_NODE_HAS_PROP with DT_INST_PROP as
using the former is not recommended with boolean properties.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-21 05:53:52 -05:00
Kumar Gala
fb4d68973f shell: Fix various build issues with string formattors
We get a few different CI failures associated with data type
differences on various platforms.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-10-20 10:54:38 -05:00
Maureen Helm
b0cdef3c25 drivers: adc: Refactor drivers to use shared init priority
Refactors all of the ADC drivers to use a shared driver class
initialization priority configuration, CONFIG_ADC_INIT_PRIORITY, to
allow configuring ADC drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The
exceptions are lmp90xxx, mcp320x, and mcux_adc16 drivers which have
dependencies on GPIO, SPI, and/or DMA drivers and must therefore
initialize later than the default device priority.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-20 07:33:44 -04:00
Wouter Cappelle
96f9f6e6d2 modem: clang-format the modem_socket files
Running clang-format on the modem socket files

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2021-10-20 07:30:46 -04:00
Wouter Cappelle
287481ef0a modem: Rework the modem_sockets poll behavior
The current modem sockets poll implementation has 2 limitations
as of today:
- not following posix spec wrt timeout of -1 (should be forever,
  but as today it's was returning immediately)
- not able to poll from multiple threads on different sockets
  on the same modem.
This pull request should implement these limitations.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2021-10-20 07:30:46 -04:00
Timo Teräs
1eb6831ddd drivers: uart_ns16550: Fix dts hw_flow_control mapping to config
DT_INST_NODE_HAS_PROP() returns true always since the boolean
tag is valid. Use DT_INST_PROP_OR() to get the real value.

Fixes: baecd7e55a drivers: uart_ns16550: Remove CMake-based templating
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2021-10-20 07:13:42 -04:00
Henrik Brix Andersen
267a83e94b drivers: can: flexcan: fix timing parameter limits
Fix the limits for the timing parameter calculations.

The lower limit for the phase_seg2 value is wrongly specified as 1 to 7,
but 1U is substracted before writing it to the CTRL1:PSEG2 register
field. This results in register field values between 0 and 6, but 0 is
an invalid value for the PSEG2 register field.

The upper limits for several of the timing parameters are wrong as well,
but this does not result in invalid register field values being
calculated. It can, however, result in not being able to meet CAN timing
requirements.

The confusion in specifying the limits likely stems from the timing
calculations and timing limits using the "physical" values, whereas the
registers fields all use the "physical" value minus 1. When the
datasheet says "The valid programmable values are 1-7", the
corresponding limits should be set to 2 to 8 to take the "minus 1" into
account.

Fixes: #39541

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-10-20 07:06:56 -04:00
Maureen Helm
ed9cb841c3 drivers: clock_control: Refactor drivers to use shared init priority
Refactors all of the clock control drivers to use a shared driver class
initialization priority configuration,
CONFIG_CLOCK_CONTROL_INIT_PRIORITY, to allow configuring clock control
drivers separately from other devices. This is similar to other driver
classes like I2C and SPI.

Most drivers previously used CONFIG_KERNEL_INIT_PRIORITY_OBJECTS or
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, therefore the default for this new
option is the lower of the two, which means earlier initialization.

The even lower defaults for STM32 and Arm Beetle are preserved by
SoC-family level overrides.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-19 23:05:25 -04:00
Nicolai Glud
81cdf7a455 drivers: flash: added flexspi hyperflash.
This enables accessing the hyperflash through the flash api.

Added a feature to memc_mcux_flexspi that waits for flexspi bus to be
quiet.

Signed-off-by: Nicolai Glud <nicolai.glud@prevas.dk>
2021-10-19 16:42:12 -05:00
Bartosz Bilas
fd316a5452 drivers: sensor_shell: add missing power sensor channel
There is no power channel within the name array that
is used by e.g INA23X so let's add it to have support
in sensor shell commands.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-10-19 07:15:55 -04:00
Henrik Brix Andersen
d711d224c2 drivers: serial: neorv32: use shared serial driver init priority
Use the shared CONFIG_SERIAL_INIT_PRIORITY for driver initialization
priority.

Override the default value for the NEORV32 SoC to ensure the serial
driver is initialized after the syscon driver by default.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-10-19 06:44:46 -04:00
Ryan Erickson
d6adbf9d0e modem: hl7800: fix IPv6 socket creation
When creating a socket, be sure to check the address
family and set the correct address family option in
the AT command.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-10-18 17:58:15 -04:00
Andrzej Głąbek
40329881bf soc: nrf52: Add Kconfig option for enabling REG0 DC/DC converter
Add a Kconfig option, similar to the one that is already available
for nRF5340, that allows enabling the REG0 (VDDH) DC/DC converter
in nRF52840. Make use of this option in Nordic boards: nRF52840 DK
and nRF52840 Dongle.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-10-17 11:49:26 -04:00
Josh Hansen
ae4f68c16d drivers: dma: stm32 Fix for STM32F1 SoCs
Not all STM32 parts have at least 5 DMA interrupt vectors for DMA2. In
particular, some STM32F1 XL-density devices only have 4 DMA2 interrupt
vectors, with Channels 4 and 5 sharing the same vector. Added
#if DT_INST_IRQ_HAS_IDX(1, 4) to prevent compiler errors on these SoCs.

Signed-off-by: Josh Hansen <jhansen3141@gmail.com>
2021-10-17 10:58:39 -04:00
Maureen Helm
ad1450510a drivers: serial: Refactor drivers to use shared init priority Kconfig
Refactors all of the serial drivers to use a shared driver class
initialization priority configuration, CONFIG_SERIAL_INIT_PRIORITY, to
allow configuring serial drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The one
exception is uart_lpc11u6x.c which previously used
CONFIG_KERNEL_INIT_PRIORITY_OBJECTS.

This change was motivated by an issue on the frdm_k64f board where the
serial driver was incorrectly initialized before the clock control
driver.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-17 10:58:09 -04:00
Henrik Brix Andersen
3e70c4fcc9 drivers: gpio: add neorv32 gpio driver
Add GPIO driver for the open-source NEORV32 RISC-V compatible processor
system (SoC).

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-10-15 09:46:53 -04:00
Henrik Brix Andersen
c6ada02210 drivers: serial: add neorv32 uart driver
Add UART driver for the open-source NEORV32 RISC-V compatible processor
system (SoC).

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-10-15 09:46:53 -04:00
Andrzej Głąbek
56162a48eb drivers: i2c: nrfx: Add implementation of i2c_recover_bus API function
Both nRF I2C drivers (i2c_nrfx_twi and i2c_nrfx_twim) perform the bus
recovery procedure in reaction to timeout (500 ms) of any requested
message transfer. Add implementation of the I2C API recovery function
in both these drivers so that it is also possible to execute this
procedure directly.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-10-15 13:56:20 +02:00
Pavlo Hamov
18f26b843c drivers: wifi: esp32: fix memmory corruption
Size of data pointer for event revival must be at least sizeof
event queue item.
Update to send whole event (id + event)

Signed-off-by: Pavlo Hamov <p.hamov@venstar.com>
2021-10-14 16:35:17 -04:00
Krzysztof Chruscinski
eb3375f47c shell: Add __printf_like to shell_fprintf
Add __printf_like modifier to validate strings used by shell.
Fixing warnings triggered by this change.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-10-14 16:32:19 -04:00
Andrei Emeltchenko
443143b5ec edac: Make edac_ibecc_init() function static
Make function edac_ibecc_init() static.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-10-14 12:11:09 -04:00
Pavlo Hamov
39d6d0db4e drivers: watchdog: esp32s2 add support
Add support of esp32s2 WDT1 & WDT2 using base esp32 driver

Use dts to determine WDT driver state

Signed-off-by: Pavlo Hamov <p.hamov@venstar.com>
2021-10-13 10:14:35 -04:00
Pavlo Hamov
89e907d4f0 drivers: serial: esp32: Unify serial driver for esp32 & esp32s2
1) Allow use of interrup driven instance.
   ROM implementation could be selected via dts compatiable.

2) Use UART rx fifo and timeout interrupt for end of message detection.
   Added to decrease interrupts count on data reception

3) Use ESP_LL api.

Signed-off-by: Pavlo Hamov <p.hamov@venstar.com>
2021-10-13 10:14:23 -04:00
Krzysztof Chruscinski
2453f16099 drivers: clock_control: nrf: Fix calibration dependencies
When CLOCK_CONTROL_NRF_FORCE_ALT is enabled then calibration is
performed outside of the driver. In that case certain Kconfig
options where present which were dedicated for case when calibration
is performed by the driver. Side effects of those options lead to
conflicts when CLOCK_CONTROL_NRF_FORCE_ALT was enabled. Fixed
those conflicts by introducing Kconfig option which indicates
whether calibration is performed by the driver or not.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-10-13 06:23:05 -04:00
Luc Viala
a94c2bc78b usb: stm32l5: add configuration to enable HSI48 clock
Add configuration to enable HSI48 clock when using USB from STM32L5
board

Signed-off-by: Luc Viala <luc.viala19@gmail.com>
2021-10-13 06:15:58 -04:00
Huang Qi
a6342b11c6 drivers: display: Fix typo in Kconfig.ssd1306
Model descriptions in Kconfig.ssd1306 should be ssd1306 instead of
ssd16xx, these may be copied from driver for ssd16xx.

Signed-off-by: Huang Qi <no1wudi@qq.com>
2021-10-13 06:14:41 -04:00
Robert Lubos
4e9b9a7fdf drivers: net: loopback: Register loopback IP address to the interface
Regsiter loopback IPv4/IPv6 to the loopback interface during
interface initialization.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-10-13 11:17:51 +02:00
Pavel Hübner
f3dd088a99 drivers: sht3xd: Add names to choices in Kconfig
Unless a choice is named, its default value
cannot be changed in another Kconfig file.

Signed-off-by: Pavel Hübner <pavel.hubner@hardwario.com>
2021-10-12 09:21:08 -05:00
Luis Ubieda
a717820f74 drivers: bmi270: Added inter-write delays required to configure device.
- Per datasheet (Rev 1.0, Page 29): When enabling adv_power_save, there
needs to be a 1ms inter-write registers delay. With this addition, the
driver will work at SCLK frequencies faster than 100kHz.
- Added helper function reg_write_with_delay() to factor these writes.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2021-10-12 08:54:00 -05:00
Siew Chin Lim
0c34373720 drivers: clock_control: Add clock driver for Intel SoC FPGA Agilex
Add clock driver for Intel SoC FPGA Agilex.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
2021-10-12 08:37:03 -04:00
Krzysztof Chruscinski
c590b3545a drivers: serial: Use microseconds to represent timeout
Updated uart_rx_enable() and uart_tx() to use timeout given
in microseconds. Previously argument was given in milliseconds.
However, there are cases when milliseconds granularity is not
enough and can significantly reduce a throughput, e.g. 1ms is
100 bytes at 1Mb.

Updated 4 drivers which implement asynchronous API. Updated
places where API was used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-10-12 12:26:56 +02:00
Pavel Hübner
7504265e47 drivers: lis2dh: Add names to choices in Kconfig
Unless a choice is named, its default value
cannot be changed in another Kconfig file.

Signed-off-by: Pavel Hübner <pavel.hubner@hardwario.com>
2021-10-11 21:04:09 -04:00
Yuriy Vynnychek
1242f5129d drivers: serial: b91: irq_tx_ready update to check TX IRQ
Updated b91_irq_tx_ready API to check TX IRQ enabled.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-10-11 21:02:21 -04:00
Glauber Maroto Ferreira
7468121f19 esp32s2: drivers: spi: add driver support
and hooks to spi_loopback test.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-10 14:52:41 -04:00
Glauber Maroto Ferreira
26131ba5d4 esp32: drivers: spi: driver refactoring
in preparation to support other esp32-family socs

on top of existing driver.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-10 14:52:41 -04:00
Glauber Maroto Ferreira
fb1632925e soc: esp32: partial code standardization
Replaces the prefixes of gpio_matrix_in and gpio_matrix_out
to unify those function calls on all supported socs.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-10 14:52:41 -04:00
Andrzej Głąbek
165c14dc60 drivers: pwm_nrfx: Fix handling of zero length periods
When the driver was called to set the period length for a channel
to 0, it set the COUNTERTOP register in the PWM peripheral to 0,
what resulted in an undefined behavior of the peripheral (and lack
of the STOPPED event sometimes).
The PWM API does not precise how should a zero length period be
handled; some drivers return the -EINVAL error in such case, some
do not. This patch fixes the pwm_nrfx driver so that it does not
change the previously used COUNTERTOP register value when the period
length is set to 0, and because the pulse cycles are always limited
by the driver to period cycles (so 0 in this case), in result the
relevant channel is simply deactivated. This allows users to switch
off a channel by requesting the pulse width to be set to 0 without
providing a non-zero period in such call.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-10-08 13:06:40 +02:00
Tim Lin
41c9b71450 ITE: soc: add cpu idle task
Implement the CPU idle task. The system should enter this task when
there is no any task to ensure power saving.

Tested on it8xxx2_evb board. It will reduce 12.5mA when system enters
the CPU idle task.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-10-08 13:01:06 +02:00
Erwan Gouriou
19a40a15b6 drivers/usb: stm32: Deprecate 'enable-pin-remap'
'enable-pin-remap' is deprecated in favor of 'remap-pa11-pa12' from
'st-stm32-pinctrl'.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-07 15:38:53 -04:00
Gerard Marull-Paretas
f3fbff6ecb drivers: pinmux: stm32: remove unused init priority
The device initialization priority is not used, so remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-10-07 15:38:53 -04:00
Erwan Gouriou
e1b905d6bc drivers: pinmux: stm32: add support for PA11/12 remap.
STM32G0/F0 SoCs allow to remap PA11/12 to PA9/10. Some boards
were manually configuring this remap. This patch centralizes this
functionality to the pinmux driver, allowing boards to enable the
remap directly in board dts file.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-07 15:38:53 -04:00
Erwan Gouriou
1ec41ce922 drivers/clock_control: stm32u5: Fix VCO setting
When existing stop mode 1&2, VCO is set to range 4
and should be set back to range 1 to allow full speed
operations.
Rather than setting VCO at startup, set it inside clock
setting procedure so that it could done
in clock reset procedure when existing stop modes.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-07 15:38:40 -04:00
Erwan Gouriou
dcac61631d drivers/timer: stm32 lptim: Update for u5 series support
Adapt lptim driver implementation to support stm32u5 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-07 15:38:40 -04:00
Jani Hirsimäki
f2859f9501 drivers: wifi: esp_at: changes to scanning
If CONFIG_WIFI_ESP_AT_SCAN_MAC_ADDRESS: mac addr included in
scanning results.
if CONFIG_WIFI_ESP_AT_SCAN_PASSIVE: passive scanning is used instead of
default active scanning.
If CONFIG_WIFI_ESP_AT_SCAN_RESULT_RSSI_ORDERED: scanning response
ordered by RSSI.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2021-10-07 10:55:37 +02:00
Armando Visconti
a2f3ea5d19 drivers/sensor: lsm6dso: Prevent device entering I3C
On LSM6DSO sensor the INT1 pin is used for both generating the drdy
interrupt and for switching to I3C hotjoin mode just after reset if
it is at logical '1' level. It might happen that after a board
reset the logical level '1' is preserved (maybe a level shifter)
forcing the LSM6DSO to enter erroneously in I3C mode, breaking any
attempt to communicate with it. (Fix #38902)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-10-06 22:22:09 -04:00
Marcin Niestroj
87ac114571 drivers: wifi: esp_at: fix connect to open network
According to ESP-AT documentation ([1] for version before 2.0 and [2]
for version 2.1) of AT+CWJAP command, both SSID and PSK are required.
Even for newest ESP-AT release 2.2 ([3]) "," (comma) is needed even if
SSID or PSK are not explicitly provided.

Send 'AT+CWJAP="SSID",""' instead of 'AT+CWJAP="SSID"' when connecting
to open WiFi network, to follow AT commands documentation.

Tested with ESP-AT firmware 2.1.

[1] https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf
[2] https://github.com/espressif/esp-at/blob/release/v2.1.0.0_esp8266/docs/en/AT_Command_Set/Wi-Fi_AT_Commands.md#atcwjapconnects-to-an-ap
[3] https://github.com/espressif/esp-at/blob/release/v2.2.0.0_esp8266/docs/en/AT_Command_Set/Wi-Fi_AT_Commands.rst#refatcwjap-wifi-at-connect-to-an-ap

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-10-06 20:44:34 -04:00
Daniel Leung
ed83474b10 interrupt_controller: remove CONFIG_DW_ICTL_OFFSET
This kconfig is only used for one board and is simply an alias
to another kconfig. So remove CONFIG_DW_ICTL_OFFSET and apply
the value directly to the other kconfig.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-10-06 19:43:48 -04:00
Marcin Niestroj
47e10a6830 drivers: lora: fix RtcGetCalendarTime()
Uptime in milliseconds is assigned to uint32_t variable, which results
in integer overflow after enough time has expired. Additionally
milliseconds part (which should be 0-999) is assigned directly from
uptime, without subtracting full seconds.

Fix both issues by using int64_t variable and calculating milliseconds
with modulo.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-10-05 19:24:58 -04:00
Felipe Neves
ed55ee95e9 boards: riscv: esp32c3: added button support
in samples for esp32c3 devkitm_board using GPIO9

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-05 19:24:38 -04:00
Felipe Neves
9768e98001 drivers: gpio_esp32: added support for esp32c3
in the gpio drivers and pinmux for esp32 chip series

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-05 19:24:38 -04:00
Jordan Yates
29773391c7 spi: convert CS usage to gpio_dt_spec
Convert all CS control logic to be based on the `gpio_dt_spec` member
instead of the standalone `port`, `pin` and `flags` members.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Co-authored-by: Jordan Yates <jordan.yates@data61.csiro.au>
Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
Co-authored-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-10-05 19:24:18 -04:00
Francois Ramu
33e0f1a87a drivers/spi: stm32u5 spi support
Add the specific driver functions for the SPI
of the stm32u5 device.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-10-05 19:23:37 -04:00
Manojkumar Subramaniam
d79d26f1ae drivers: serial: stm32: renable IT RXNE as part of graceful disable
async_rx_disable does not re-anable RXNE interrupt, it was disabled
during async_rx_enable

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2021-10-05 19:19:16 -04:00
Igor Knippenberg
bd7b7a6423 drivers: sensors: fdc2x1x: removed unused fdc2x1x_data
Removing two unused "struct fdc2x1x_data" to fix warnings
when compiling with PM_DEVICE=y.

Signed-off-by: Igor Knippenberg <igor.knippenberg@gmail.com>
2021-10-05 13:13:46 -04:00
Evgeniy Paltsev
6807e02655 ARC: IRQ: drop excessive PM_DEVICE hooks
All ARC CPUs (supported by Zephyr) don't lose core interrupt
controller configuration after switching to sleep mode / modes,
so we don't need to save & restore it's configuration with PM.

This PM code most likely was added for Arduino 101 (Genuino 101)
board which isn't supported by Zephyr anymore - so we can drop
it.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-05 07:48:47 -04:00
Evgeniy Paltsev
e1455fafdf ARC: IRQ: drop unused _VectorTable declaration
We don't use '_VectorTable' in the driver, so let's drop it's
declaration.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-05 07:48:47 -04:00
Daniel Leung
ef0d955758 uart: ns16550: add workaround to re-enable interrupts in ISR
In some configurations (e.g. edge interrupt triggers),
an interruptible event occurs during ISR and the host interrupt
controller does not see the new event due to IIR is constantly
asserting interrupts. For example, the callback handles RX and
then TX. If another character comes in before end of TX processing
(TX interrupt still asserts while raising RX interrupt), the host
interrupt controller may not see this new event. So if needed,
the IER is being toggled to re-assert interrupts at the end of ISR
to nudge the host interrupt controller to fire the ISR again.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-10-04 20:49:13 -04:00
Krzysztof Chruscinski
cf3dabedaf drivers: gpio: nrf: Remove CONFIG_GPIO_NRF_P0 and CONFIG_GPIO_NRF_P1
Remove Kconfig options for enabling device instances in favor of
taking that information only from device tree. Prior to that
change there was a mix of devicetree and Kconfig.

Bring back use of CONFIG_GPIO_NRF_INIT_PRIORITY.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-10-04 20:48:20 -04:00
Bartosz Bilas
d6792dd7be drivers: gsm_ppp: introduce modem on/off callbacks
Allow the user to register function callbacks that
are executed during gsm modem configuring and stopping.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-10-04 20:46:04 -04:00
Tim Lin
213c0c43e6 ITE: soc: pull-down GPIO L/K groups and set GPIOH7 output low at default
GPIO L/K groups:
On IT81202 (128-pins package), the pins of GPIO group K and L aren't
bonding with pad. So we configure these pins as internal pull-down
at default to prevent leakage current due to floating.

GPIOH7:
On IT81202/IT81302, the GPIOH7 isn't bonding with pad and is left
floating internally. We need to enable internal pull-down for the pin
to prevent leakage current, but IT81202/IT81302 doesn't have the
capability to pull it down. We can only set it as output low,
so we enable output low for it at initialization to prevent leakage.

After setting: power saving=2.26mA

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-10-04 20:41:37 -04:00
Kevin Townsend
21321fba1c drivers: sensor: lsm303dlhc_mag: Fix gain factor
The magnetometer on the LSM303DLHC has a different gain conversion
factor for LSB to Gauss for the Z axis than it does for X, Y. This
commit takes into account the different conversion factors, and
adds the correct coefficients for each gain setting and axis.

Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
2021-10-04 20:40:43 -04:00
Francois Ramu
1ebd6b579e driver: clock: stm32 clock control supports ahb_prescaler
This constraint on the AHB prescaler is removed.
The ahb-prescaler is allow from 1-512.
For stm32 common and stm32U5 devices.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-10-04 20:37:09 -04:00
Gerard Marull-Paretas
f371ae3cc5 drivers: pinmux: stm32: remove pre-DT API
Remove APIs used in the pre-DT era. In case manual access is required,
`stm32_dt_pinctrl_configure` can still be used as a shortcut with data
initialized in the expected format.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-10-04 20:36:17 -04:00
Tim Lin
15106009c5 ITE: drivers/i2c: returning negative values for error
Fixes: #38959

Currently, the I2C driver returns I2C status register value as error
code when error happen. This PR fixes returning system number and
the return values is negative for error.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-10-04 12:53:50 -04:00
Francois Ramu
e763061876 drivers: pinmux stm32F1 remap IP without changing the SWJ_CFG
Change the REMAP bits of the AFIO_MAPR of the stm32F1x soc
with local MACRO without changing the SWJ_CFG (write-only bits).
The serial wire JTAG configuration is taken from the Z_AFIO_REMAP
(value of the CONFIG_GPIO_STM32_SWJ_xxx))
and not read from the MAPR register.
It accesses to the MAPR register directly instead of LL functions.
Note that Remapping on the MAPR2 is not to change.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-10-04 11:44:22 -04:00
Erwan Gouriou
6b0199ac7d drivers/timers: stm32_lptim: Set LSI as default LPTIM clck source
Timer STM32 LPTIM currently supports 2 clocks sources: LSE & LSI.
LSE (external) is defined as default but its availability depends
on board support package and then may not be available.

This ends up in situations where users have LSE implicitly selected
while no crystal is available on board, leading to non functional
LPTIM.

To avoid this situation, makes LSI clock, which is always available
(since internal to the SoC), the default LPTIM source clock.
Then, default case will be functional. Users will then be able to
select LSE if needed.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-04 08:24:03 -04:00
Flavio Ceolin
d55c9b6d54 console: uart: Don't re-define functions as macros
Some functions were being re-defined as macros if certain conditions
were not met.

Fix violations to rule 5.5

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-10-02 14:34:14 -04:00
Flavio Ceolin
419fabdad0 console: uart: Remove unnecessary macro
console_input_init is only used in the same scope it is implemented.
There is not need to have it defined elsewhere.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-10-02 14:34:14 -04:00
Felipe Neves
949a6a8e53 interrupt-controller: intc_esp32c3: make logs optional
Allowing cleaner debug experience and preventing unwanted
outputs during debug.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-02 14:33:24 -04:00
Felipe Neves
16be75b68f dts: added dts binding for esp32c3
interrupt controller, also places its relevant
peripheral sources allowing drivers to use the
DT macros instead of espressif headers.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-02 14:33:24 -04:00
Felipe Neves
b97c2da2f2 interrupt_controller: intc_esp32c3: added intc driver
For esp32c3 and replaces the hardcoded interrupt
attaching procedures with this new driver.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-02 14:33:24 -04:00
Sjors Hettinga
7f9b4d807c drivers: modem: Fix reference to stack in modem_context_sprint_ip_addr
Changes the modem_context_sprint_ip addr to write into a provided
buffer. This approach fixes a referencing to a non existing stack
variable, without using a lot of stack space.
Tested using the by building all used modems and tested on HW using
IPv4.

Fixes: #38459

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
2021-10-01 11:06:32 -04:00
Glauber Maroto Ferreira
c7ce4b2016 esp32s2: drivers: entropy: add support
also needed for wifi driver support.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-01 10:51:37 -04:00
Eduardo Montoya
f397e9b6c2 drivers: nrf5: fixes for the CSL Receiver
Introduce fixes for making the CSL Receiver to properly schedule
the reception window.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2021-10-01 11:37:38 +02:00
Sylvio Alves
69311ccc3d soc: esp32: update clock configuration calls
Removed duplicated calls in clock subsystems.
Move proper includes to soc specific.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-09-30 21:42:20 -04:00
Christopher Friedt
c4ecd78ce1 Revert "drivers: spi: stm32 can support TI mode for the SPI frame format"
This reverts commit d563313ab1.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-09-30 16:04:37 -04:00
Felipe Neves
d4ed7f69d4 drivers: entropy: esp32: enable rng driver
for esp32c3 allowing wifi subsystem to use inside
its driver.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-09-30 06:39:55 -04:00
Francois Ramu
d563313ab1 drivers: spi: stm32 can support TI mode for the SPI frame format
Depending of the soc and SPI peripheral, the Frame-Format of the
SPI can be configured to support TI or Motorola protocol.
This is configured through a new DTS property.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-09-29 14:47:31 -04:00
Andrzej Głąbek
5473b22275 drivers: i2s_nrfx: Fix a few minor fixes
- correct the names of buffers used by message queues so that it
  is possible to have multiple instances of the driver (in case
  such need appears in the future)
- make `stop` and `discard_rx` normal structure members, not bit
  fields, as they are modified in the interrupt handler and that
  could lead to overwriting of other bit fields located in the
  same memory unit
- add a log message providing the actual frame clock (WS) frequency
  (i.e. PCM rate) that the driver was able to configure (due to
  hardware limitations, it is not always possible to achieve the
  exact requested frequency and the driver selects the closest one
  available, so make it more visible to users

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-29 14:46:29 -04:00
Andrzej Głąbek
953f35f130 drivers: i2s_nrfx: Do not enforce two channels for I2S format
Remove unnecessary condition that effectively limits the usability
of the I2S format to two channels mode only.
Although the description of the `i2s_config` structure contains
a remark that for the I2S format the specified number of channels
is ignored and always two are used, in fact only one other in-tree
driver (i2s_sam_ssc) applies such limitation.
The nRF I2S hardware has no problem with handling the I2S format
with audio data for only one channel, so there is no need for having
this limitation in the driver, and without such mode of operation of
the driver it is impossible to feed it with PCM data directly from
the PDM peripheral working in one channel mode.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-29 14:46:29 -04:00
Pieter De Gendt
4e2bb0e762 drivers: hwinfo: add reset cause support for iMX RT series
Add a shim driver to get/clear the reset reason on NXP i.MX
RT controllers

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-09-29 14:44:21 -04:00
Robert Lubos
0dbdcc770d net: sockets: Add socket processing priority
When creating a socket, all of the registered socket implementation are
processed in a sequence, allowing to find appropriate socket
implementation for specified family/type/protocol. So far however,
the order of processing was not clearly defined, leaving ambiguity if
multiple implmentations supported the same set of parameters.

Fix this, by registering socket priority along with implementation. This
makes the processing order of particular socket implementations
explicit, giving more flexibility to the user, for example when it's
neeed to prioritze one implementation over another if they support the
same set of parameters.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-28 20:11:26 -04:00
Dawid Niedzwiecki
1031cfd51e drivers: serial: ns16550: fill full fifo
Put the maximum number of bytes into Tx FIFO in the fill_fifo routine
to reduce CPU usage.

Previously, the THRE bit was checked in a loop, but, according to doc -
"In the FIFO mode, it is set when the XMIT FIFO is empty, and is
cleared when at least one byte is written to XMIT FIFO.", so only one
byte was transferred every interrupt. That was generating a big amount
of interrupts, which consumes CPU time.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2021-09-28 20:10:00 -04:00
Markus Fuchs
a283cb3311 drivers: Update drivers to use new multicast monitor API
Update drivers regarding latest multicast group join/leave monitor
changes which now supports both IPv6 and IPv4 multicast addresses.

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
2021-09-28 20:04:49 -04:00
Alex Sergeev
851cccb67e drivers: ethernet: mcux: generalize gPTP code to support PTP L2
Update eth_mcux.c to use CONFIG_NET_L2_PTP instead of CONFIG_NET_GPTP.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2021-09-28 20:01:16 -04:00
Gerard Marull-Paretas
222a21dd72 drivers: pinmux: stm32: use DEVICE_DT_GET_OR_NULL
Use existing Devicetree macro to obtain optional references to GPIO
ports.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-28 20:00:00 -04:00
Ruibin Chang
d16ae76d30 ITE drivers/kscan: add keyboard scan driver for it8xxx2_evb
Add keyboard scan driver for board it8xxx2_evb.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-09-28 19:53:15 -04:00
Dennis Ruffer
fe1b167760 gpio: shell: Change shell *shell to shell *sh
To fix MISRA Rule 5.7 violation

Signed-off-by: Dennis Ruffer <daruffer@gmail.com>
2021-09-28 19:51:33 -04:00
Dennis Ruffer
95bab86051 gpio: shell: Use macro SHELL_CMD_ARG to check parameters count
The args_number and args_no structures could be removed
But other parameter checks we still preserved.

Signed-off-by: Dennis Ruffer <daruffer@gmail.com>
2021-09-28 19:51:33 -04:00
Dennis Ruffer
9b3dfe7443 gpio: shell: Replace gpio listen with blink
This is a frequently used command during hardware bringup
The listen command was not actually implemented
Also uncrustified and check_compliance.py

Signed-off-by: Dennis Ruffer <daruffer@gmail.com>
2021-09-28 19:51:33 -04:00
Neil Armstrong
a737999b5b interrupt_controller: gicv3: add Interrupt Translation Service support
This implements support for the optional Interrupt Translation Service
(ITS) module of the GICv3 Interrupt Controller.

The current implementation is designed for MSI/MSI-X interrupt delivery
in mind.
The gicv3 driver calls each ITS INVALL command when LPI interrupts are
enabled/disabled.
A simple atomic integer is used to allocate unique LPI INTIDs to ITS
users.
CPUs numbers are directly mapped as ICIDs into the Collections Table.

As a limitation it doesn't support indirect Device table to simplify
implementation but may use a large amount of memory.

INV, DISCARD, MOVI and MOVALL commands are not implemented.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-28 19:45:29 -04:00
Neil Armstrong
e819bd8f34 interrupt_controller: gicv3: add support for LPIs
The LPI (Locality-specific Peripheral Interrupts) are edge-triggered
message-based interrupts that can use an Interrupt Translation
Service (ITS) to route an interrupt to a specific Redistributor and
connected PE.

This implement the necessary LPI support when an ITS is enabled.

The LPI states are stored in memory-backed tables.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-28 19:45:29 -04:00
Jonathan Hahn
c9f87969c2 drivers: sensor: add I3G4250D Gyro driver
Implements a shim layer driver using st hal for
I3G4250D gyro, mounted for example on stm32f3_disco_E.
No support for triggers included yet.

Signed-off-by: Jonathan Hahn <Jonathan.Hahn@t-online.de>
2021-09-28 19:44:26 -04:00
Carlo Caione
d5556cafed arm_arch_timer: Fix ticks count on !CONFIG_TICKLESS_KERNEL
When SMP is enabled all the cores are announcing a tick and this is
causing too many ticks to be announced. Announce the tick even if this
is zero.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-09-28 19:40:01 -04:00
Torsten Rasmussen
34e346de14 Revert "drivers: pinmux: build as static library"
This reverts commit 43309296b8.

Fixes: #38403

The referred commit introduced `zephyr_library()` for pinmux drivers but
also resulting in #38403 because several boards has `CONFIG_PINMUX=y`
without selecting any pinmux drivers from `drivers/pinmux` thus
generating the following warning:
> No SOURCES given to Zephyr library: drivers__pinmux
>
> Excluding target from build.

This commit reverts the changes so that this warning disappears.
This results in pinmux drivers from `drivers/pinmux` to be located in
libzephyr.a which is messy, but has been so for a long time, even before
Zephyr 1.14 LTS.

The future pinctrl API will be designed in such a way that this problem
will not occur. Thus the old behavior is acceptable until the transition
to pinctrl API has completed.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-28 14:33:16 +02:00
Erwan Gouriou
5c23fa9f9d drivers/gpio: stm32f1: AFIO init should happen before GPIO inits
GPIO initialization was moved to PRE_KERNEL_1 with commit
590162a5cc06c72b70dee93f410b878bc0935f1f.
This had the consequence of having AFIO init done after GPIO init
as a consequence, this sequence ends up with AFIO clock disabled,
and hence negative impact on AFIO expected services.

Additionally, to save some flash, compile out afio init when not
required.

Fixes #38870

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-28 06:19:08 -04:00
Torsten Rasmussen
d800b4a4d7 drivers: gpio: remove unused GPIO selection
Fixes: #38403

Removing unneeded `imply GPIO` and `CONFIG_GPIO=y` occurrences where no
files are added to the gpio zephyr library.

Also removed `CONFIG_GPIO=y` occurences where this is handled by
defconfigs for the soc or board.

Selection of GPIO without selecting any drivers results in the warning:

> No SOURCES given to Zephyr library: drivers__gpio
>
> Excluding target from build.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-28 12:13:23 +02:00
Torsten Rasmussen
e8eb8a8c2c drivers: ethernet: remove dedicated drivers__ethernet__native_posix lib
Fixes: #38403

The two eth_native_posix.c and eth_native_posix_adapt.c are now added
to the common drivers__ethernet Zephyr library.

Instead of creating a dedicated library for just two files those files
are now added to the common ethernet library, see also #8826.
Instead, the dedicated compile definitions required for those files are
specified using COMPILE_DEFINITIONS on the source files.

This also avoids the following warning as the ethernet library is no
longer empty.

> No SOURCES given to Zephyr library: drivers__ethernet
>
> Excluding target from build.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-28 12:13:23 +02:00
Torsten Rasmussen
8e64038559 drivers: net: adding NET_DRIVERS menuconfig
Fixes: #38403

Adding NET_DRIVERS menuconfig so that network drivers are grouped
together in its own menu entry under drivers, similar to most other
drivers.

This further has the advantages that `CONFIG_NET_DRIVERS` can be used
for testing to determine if network drivers has been selected.

This changed revealed a dependency loop where both `select` (for SLIP)
and `depends` (for PPP) which both depends on NET_DRIVERS` where in use
in the dependency tree for Qemu networking, especially NET_SLIP_TAP.

This is handled by defaulting `NET_DRIVERS` to `y` when building for a
Qemu target.
`SLIP` had a dependency to `!QEMU_TARGET || NET_QEMU_SLIP`. This is
changed so that SLIP prompt depends on `!QEMU_TARGET` which provides
full user control in hardware but makes the symbol promptless on Qemu
targets.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-28 12:13:23 +02:00
Torsten Rasmussen
6ebe0b8425 drivers: create BT_DRIVERS Kconfig entry
Fixes: #38403

Changing Bluetooth drivers from being a menu into a menuconfig.
This aligns the Bluetooth driver configuration with other driver
configurations as well as provides a setting which identifies if
Bluetooth drivers has been enable.

This further helps to avoid empty Zephyr libraries for bluetooth
samples.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-28 12:13:23 +02:00
Francois Ramu
acad37196d drivers: adc: stm32 adc disable causing endless loop
Setting Oversampling also applies on stm32L5 but disabling
the ADC will cause endless loop except for the stm32L0 serie.
Errata applies only on stm32G0 soc series when
writing ADC_CFGR1 register.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-09-28 06:12:47 -04:00
Steven Lemaire
cc5f769436 drivers: serial: gecko: add hw flow control support for EFR32 Series 2
Add hardware flow control support for the EFR32MG21 and other modules
using GPIO_USART_ROUTEEN_RTSPEN (and GPIO_USART_ROUTEEN_CTSEN) instead
of the Kconfig SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION.

The driver already contained the section settings the RTS and CTS pins
for modules using the GPIO_USART_ROUTEEN_(RTS|CTS)PEN define, but it was
not compiling because of an #ifdef checking only for
CONFIG_SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION and not both.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2021-09-28 11:39:02 +02:00
Dino Li
29d039335f cleanup: soc: it8xxx2: remove unnecessary code
Code removed:
- IT8XXX2 doesn't support soc level software interrupt hence remove
  them.
- To use common macro to access csr (control status register).
- To remove CONFIG_RISCV_HAS_PLIC related code. IT8XXX2 uses its own
  interrupt controller code.
- To remove ite_write and ite_read. We don't use them anymore.

Code changed:
- Return true from arch_irq_is_enabled() when external interrupt-enable
  bit, and SOC's IER are both true.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-09-28 11:36:23 +02:00
Glauber Maroto Ferreira
e605efc698 esp32s2: drivers: clock_control: add support
add clock control driver support for esp32s2 SoC.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-09-27 22:02:08 -04:00
Glauber Maroto Ferreira
d15d3de5fc esp32: drivers: clock_control: code refactoring
code refactoring.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-09-27 22:02:08 -04:00
Christoffer Zakrisson
2ec4986d57 drivers: i2c: sam0: Continue write/read if next message allows it
Update sam0 i2c driver to directly send/receive next message if it is
in the same direction and the current message has no stop or restart
flags. Seems like in some drivers this is the expected behaviour.

Fixes #36857

Signed-off-by: Christoffer Zakrisson <rustypig91@gmail.com>
2021-09-27 10:13:19 -04:00
Gerard Marull-Paretas
f647a5c8ec drivers: display: st7789v: remove incorrect error check
The st7789v_transmit function does not return any error code (void), so
ret = st7789v_transmit(...) is wrong.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-27 08:24:21 -04:00
Xabier Marquiegui
3566cf11ba drivers: eth: e1000: only enable e1000 clock on e1000 configured
e1000 clock should only be enabled by default if e1000 driver is
configured

Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2021-09-24 17:05:11 -04:00
Steven Lemaire
2aa0bb2422 drivers: i2c: gecko: fix typo of the BUILD_ASSERT
In the macro I2C_VALIDATE_LOC, there was a typo preventing the
compilation.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2021-09-24 14:08:42 -04:00
Ryan Erickson
1715e39414 modem: hl7800: separate IO interrupt config
The interrupt config flags for an IO should be separate
from the standard IO configs because the interrupt config
is a separate API.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-24 11:30:37 -04:00
Krzysztof Chruscinski
8e66894d4e drivers: regulator: Fix k_work_schedule return code handling
k_work_schedule may return other non-negative value than 0.
When driver was adapted to the new k_work API that was not
taken into account.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-24 06:36:50 -04:00
Yong Cong Sin
6083b89553 drivers: modem: gsm_ppp: Add support for Quectel modems
Add support for Quectel modem in gsm_ppp modem driver.

The CMUX cmd is based on MUX application notes v1.0(2020-09-22)
for BG95, BG77 and BG600L. Tested and working on EC21e.

As the gsm_ppp doesn't do power control, it is required to power
on the modem manually in the application.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-09-23 08:40:10 -04:00
Andrzej Głąbek
36451e6b54 drivers: spi_nrfx_spi: Change the way the nrfx driver is configured
Apply the same changes as the previous commit made in the spi_nrfx_spim
shim, to keep these two shims aligned.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-23 08:39:37 -04:00
Andrzej Głąbek
2a199afac3 drivers: spi_nrfx_spim: Change the way the nrfx driver is configured
According to the nRF5340 PS, for 32 Mbps high-speed SPI using SPIM4,
drive configuration H0H1 must be used. The underlying nrfx_spim driver
does it properly in its initialization function, so change the shim to
(re)initialize the driver when the SPI configuration is to be changed
(only then the speed to use is known), to avoid the need of duplicating
the corresponding code in the shim itself.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-23 08:39:37 -04:00
Andrzej Głąbek
5f1581bb05 drivers: spi_nrfx_spim: Fix limiting of SPIM frequency on nRF5340
According to the nRF5340 PS, SPIM4 only supports 32 Mbps when
the application core is running at 128 MHz. This patch adds
the corresponding check.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-23 08:39:37 -04:00
Ryan Erickson
e1eb55d7f7 modem: hl7800: sync APN for PDN and GPRS connection
Ensure the GPRS connection APN settings match the PDP
context. This it best to ensure proper IP connectivity.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-23 04:15:55 -04:00
Ryan Erickson
bd24fba6c4 modem: hl7800: ensure IP family set correctly
Ensure that the IP family is synchronized between the PDP
context and the GPRS connection.
There were cases where they could get out of sync.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-23 04:15:55 -04:00
Ryan Erickson
e8e9d83ab7 modem: hl7800: Add address family config
Add ability to set the IP address family with Kconfig.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-23 04:15:55 -04:00
Ryan Erickson
3fb82291d2 modem: hl7800: Fix IPv6 operation
Assign the IPv6 address from the LTE network to the
network iface.
Configure DNS resolver with IPv6 DNS address from the
LTE network.
Fix socket AT commands to account for IPv6 addresses.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-23 04:15:55 -04:00
Ryan Erickson
a28a20b50f modem: hl7800: Only reconfig DNS if iface up
In the DNS work callback ensure the iface is up
(on the LTE network) before trying to reconfigure the
DNS resolver with the DNS address.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-23 04:15:55 -04:00
Fabio Baltieri
23fbb19ed5 drivers: sx126x_stm32wl: clear the radio IRQ before reenabling it
The stm32wl version of the sx126x driver disables the NVIC interrupt in
the radio isr to prevent retriggering while the event gets handled in
the workqueue. Since the interrupt condition is still present while the
line is disabled, the interrupt pending bit remains set in the NVIC, so
after the handler finished, when irq_enable() gets called, the interrupt
fires immediately again with no status bit set in the radio registers.

Apart from the no-op interrupt, this has the side effect of bringing
the radio out of sleep as soon as the interrupt bit are read and
cleared, which increases the idle state power consumption.

Adding a NVIC_ClearPendingIRQ() before irq_enable() seems to fix the
problem. It should not cause any issue with missing interrupt events, as
if there are pending bit on the Radio, the NVIC pending bit would be
re-set immediately.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-09-22 21:10:05 -05:00
Yuval Peress
a1f6d97978 drivers: syscon: Add support for multiple regions
1. Add support for multiple syscon entries (as a side effect, this also
   fixed syscon.c implementations which weren't being linked to their
   syscon.h counterparts).
2. Add support for different width registers in syscon.
3. Add tests for syscon

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-09-22 10:32:11 -04:00
Ryan Erickson
7cf0a5c4a1 modem: hl7800: fix gpio with interrupts init
Need to use gpio_pin_interrupt_configure for any IO
that uses interrupts.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-22 06:36:11 -04:00
David Leach
3ea7fbc662 display: st77xx: Move initialization to POST_KERNEL
These are the only two display drivers initializing in APPLICATION.
Dependency exposed with LVGL with initialization at same level and
priority.

Fixes #38690

Signed-off-by: David Leach <david.leach@nxp.com>
2021-09-21 19:42:36 -04:00
Flavio Ceolin
80681d2984 stm32: gpio: Fix device runtime pm
When CONFIG_PM_DEVICE_RUNTIME is enabled, if a pin is configure as
input after an output pin has already being configured the device is
wrongly suspended.

Fixes #38433

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-09-21 11:38:06 -04:00
Erwan Gouriou
79ff645390 drivers/uart: stm32: Simplify code around pm_constraints handling
Now that we're clearer around pm constraints management in various
TX cases (poll streams, irq driven or async), make some code
simplifications to ease readability.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-21 10:47:56 -04:00
Erwan Gouriou
a3de3df5dc drivers/uart: stm32: Fix pm_constraint handling
Introduce new logic to set/release pm_constraint during serial TX
transactions.

First change is to introduce an internal flag and utility functions
to control the set/release constraint balancing per uart device.
This way, whatever the mix of transactions or API calls, we
ensure a single uart device can only do 1 or 0 to the PM state
constraint. Constraint can't then be set more than once, released w/o
having been set or released more than it was set.

The last part of the change reworks the triggers for constraints
set/release operations.
In order not to disturb driver operations, if irq driven mode or PM is
enabled, don't enable TC interrupt handling by default.
Instead, map the pm_constraint setting to the way TC flag is handled
in normal mode of operations (irq driven or async).
As a consequence, in irq driven mode, pm_constraint is set/released on
tx_enable/tx_disable api calls, which gives API user full control
on transaction protection vs low power operations.
Finally, we emulate the same behavior on TX poll transaction, by
enabling TC irq at the start of a stream and disabling TC irq once
stream is completed. This is controlled with a dedicated device flag.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-21 10:47:56 -04:00
Andrzej Głąbek
5601805695 drivers: i2c_nrfx_twim: Add handling of buffers located in flash
TWIM peripherals cannot perform write transactions from buffers
located in flash. The content of such buffers needs to be copied
to RAM before the actual transfer can be requested.
This commits adds a new property (zephyr,flash-buf-max-size) that
informs the driver how much space in RAM needs to be reserved for
such copying and adds proper handling of buffers located in flash.
This fixes an issue that caused that e.g. the DPS310 sensor driver
did not work on nRF SoCs that only have TWIM, not TWI peripherals.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-21 13:44:06 +02:00
Andrzej Głąbek
99ce264df7 drivers: i2c_nrfx_twim: Use concatenation buffer by default
Issue an error logging message when the i2c_nrfx_twim driver lacks
a concatenation buffer big enough to properly handle a call to
i2c_burst_write() function, to give the user a hint what is wrong.

Also use by default a 16-bytes long concatenation buffer for every
instance of the i2c_nrfx_twim driver. Such value should cover most
of the simple uses of the i2c_burst_write() function, like those
in the stmemsc sensor drivers, and when a longer buffer is needed,
the user will be provided with the above message pointing to the
property that should be adjusted.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-21 13:44:06 +02:00
Berend Ozceri
357ec64b36 drivers: timer: Fix RISC-V machine timer count drift due integer math
If CYC_PER_TICK does not divide the (now - last_count) quantity exactly with integer math, the subsequent multiplication before incrementing last_count causes a drift. This commit eliminates the redundant division-followed-by-multiplication and fixes https://github.com/zephyrproject-rtos/zephyr/issues/37852

Signed-off-by: Berend Ozceri <berend@recogni.com>
2021-09-20 19:50:40 -04:00
Ryan Erickson
42075342a8 modem: hl7800: fix PSM
Fix power-save-mode (PSM) operation.
When in PSM, do not bring the networking interface down
when an out-of-coverage event occurs.
When PSM goes into hibernate, this will cause an
out-of-coverage event to occur, even though the device
still has access to service.
Keeping the networking interface in the up state
allows an app to send data whenever it needs to.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-20 12:24:40 -04:00
Ryan Erickson
38c8d4729f modem: hl7800: remove DTR control
Using DTR to control sleep modes is a legacy mode
of operation. Remove control of DTR IO.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-20 12:24:40 -04:00
Ryan Erickson
982c072221 modem: hl7800: change sleep mode
Sleep mode 0 (driven by DTR) is only recommended for use
as a legacy option.
Sleep mode 1 is recommend by Sierra Wireless.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-20 12:24:40 -04:00
Julien D'ascenzio
ca7899afa9 drivers: spi: stm32: Fix forever lock when configure failed
On transceive, if the SPI configure failed, the SPI wasn't release.

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2021-09-20 10:17:56 -04:00
Ron Smith
683dbc4573 drivers: serial: uart_sam0: Fix async tx done event triggering to early.
uart_sam0_dma_tx_done callback triggers when the last byte
is transferred from the tx sram buffer to the sercom DATA register.
However the byte has yet to be transmitted completely which can lead to
incorrect event handling if UART_TX_DONE is expected to signal
the end of transmission.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-09-19 19:31:25 -04:00
Ron Smith
a0d92453d8 drivers: serial: uart_sam0: move err_check methodout of if guard
Fixes a compile error for the err_check function not being found if
if CONFIG_UART_INTERRUPT_DRIVEN is not enabled.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-09-19 19:31:25 -04:00
Ron Smith
4f9ac180b4 drivers: dma: dma_sam0: change sam0 DMA to higher priority init.
fixes peripheral drivers such as async uart that rely on dma being
ready failing because dma is not initialized yet.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-09-19 19:31:25 -04:00
Francois Ramu
97c031822b drivers: adc: stm32 disable the ADC before setting the Oversampling
On those STM32 series, setting of this feature is conditioned to
the ADC state: it is allowed to set/reset the oversampler (OVSE bit)
and set the Oversampling ratio (OVSR bits) in the ADC_CFGR2 register
only when ADC is disabled or enabled without conversion on going.
Then is the ADC re-enabled.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-09-18 09:02:31 -04:00
Francois Ramu
572ab24241 drivers: adc: stm32 disable the ADC before setting the Resolution
On those STM32 series, setting of this feature is conditioned to
the ADC state: it is allowed to write the Data resolution (RES bits)
in the ADC_CFGR1 register only when ADC is disabled (ADEN=0).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-09-18 09:02:31 -04:00
Vinayak Kariappa Chettimada
19fe102862 Bluetooth: Controller: Propagate ticks_drift in the ticker callback
The ticker `ticks_drift` is propagated via the ticker
elapsed callback, in order to provide necessary information
to correctly calculate total elapsed durations by states and
roles that use ticker extensions to mitigate scheduling
collisions by drifting within a permitted window.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-17 14:30:07 +02:00
Mahesh Mahadevan
a90c4c38a1 drivers: disk: Fix USDHC driver to return 0 on success
The function usdhc_board_access_init was returning a non-zero
value as the variable "ret" is also used to store the GPIO
level for card-detect.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-09-17 08:12:22 -04:00
David Leach
fb5192656a drivers: eth: mcux: Fix PTP clock init priority dependency
The net_core device initialization has a subtle dependency
on the PTP clock initialization. Adding a Kconfig and set
it to a priority level less than net_core. This will ensure
the initialization sequence.

Fixes #38571

Signed-off-by: David Leach <david.leach@nxp.com>
2021-09-17 10:56:35 +02:00
Xavier Chapron
f83bb02cbf drivers: modem: sara-r4: Replace snprintf calls by snprintk
Snprintf calls should be avoid when not necessary, instead snprintk
should be used as it offers the same functionnalities at a lower cost
in flash.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2021-09-16 09:33:28 -04:00
Yong Cong Sin
495f6b7ccc drivers: modem: bg9x: Fix unused configs
Fix Kconfig so that unused configs won't be compiled.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-09-15 11:30:03 -04:00
Tomasz Bursztyka
d8484e2ea5 drivers/ivshmem: MSI API change was not applied in this drivers
commit id ec2b9d42af missed that ivshmem
uses pcie_msi_enable as well, thus fixing it now.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-09-15 13:42:22 +03:00
Gerard Marull-Paretas
a7f13755ed drivers: serial: stm32: remove unnecessary flag clear
According to reference manual, use of TC is "to avoid corrupting the
last transmission when the USART is disabled or enters Halt mode.". It
is safe to remove it since it is not checked when CONFIG_PM=n.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-13 17:53:19 -04:00
Gerard Marull-Paretas
e3f4907efe drivers: serial: stm32: use PM constraints to prevent suspension
In the current implementation the STM32 UART driver required to enable
`CONFIG_PM_DEVICE` when `CONFIG_PM=y` to function properly. The main
reason is that in some situations, like in polling mode, transmissions
are not fully synchronous. That is, a byte is pushed to the _queue_ if
it is empty and then the function returns without waiting for it to be
transmitted to the wire. This makes sense to make things like per-byte
transmission efficient. However, this introduces a problem: the system
may reach idle state, and so enter low power modes before the UART has
actually finished the last data in the queue. If this happens,
communications can be interrupted or garbage data may be put into the
UART line.

The proposed solution in this patch uses PM constraints to solve this
problem. For the IRQ/DMA case it is easy since we can set the constraint
before transmission start, and when the completion (TC) interrupt is
received we can clear it. However, the polling mode did not have the
capability to signal the completion. For this case, a simpler IRQ
routine is provided to just release the constraint. As a result, the PM
hooks are not required and so system can operate with just `CONFIG_PM`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-13 17:53:19 -04:00
Dawid Niedzwiecki
3e696a0f84 drivers: serial: ns16550: fix uart initialization
Do not set DLAB bit in Line Control Register when the access to
the baud rate divisor registers is not needed.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2021-09-13 07:06:33 -04:00
Nick Ward
ecbfc1172a drivers: watchdog: fix missing stm32 LOG_LEVEL macro
Without this a user can't enable logging for the STM32 wdt driver.

Signed-off-by: Nick Ward <nick.ward@setec.com.au>
2021-09-10 10:57:57 -04:00
Yong Cong Sin
293af9e823 drivers: modem: gsm_ppp: Fix ppp_dev
ppp_dev should be pointing to the net/ppp driver.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-09-08 10:49:45 -04:00
Bartosz Bilas
6badb7f1b8 drivers: sensors: sht3xd: allow multiple instances
Make this driver multi-instance.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-09-08 09:49:34 -04:00
Andy Ross
795d36f811 drivers/timer/cavs_timer: Don't suppress smp_timer_init()
This function wasn't being defined when SMP_BOOT_DELAY was set or when
SMP wasn't enabled.  There's no reason for either, then function
doesn't depend on any kconfig-dependent build-time state, and (given
that we use -ffunction-sections) it won't appear in output binaries
unless called.

And there are use cases (e.g. z_smp_start_cpu()) where we need that
function even when BOOT_DELAY is enabled.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-07 14:23:31 -04:00
Francois Ramu
5199e1bfa9 drivers: clock control stm32wb has MSI clock range to set
When the MSI clock is selected as source on the stm32wbx device,
the MSI has a range to choose the MSI input frequency.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-09-07 11:31:56 -04:00
Jiafei Pan
6f1dc5d3a9 drivers: gicv3: set SPI's affinity when it is enabled
When affinity routing is enabled for Non-secure state
( GICD_CTLR.ARE_NS is '1'), need to set routing information
for the SPI interrupt.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2021-09-07 11:31:22 -04:00
Gerard Marull-Paretas
051e9989bb drivers: pinmux: stm32: fix remap equality check
The equality check for remap was not being performed since the local
variable remap was assigned to the value being checked just before the
check. Some minor simplifications have been performed (fixed variable
types).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-07 07:56:21 -04:00
Torsten Rasmussen
e1481fee4a drives: cmake: zephyr_library_property(ALLOW_EMPTY TRUE) on drivers lib
This commit now sets the Zephyr library property `ALLOW_EMPTY` to
silence the warning:
`No SOURCES given to Zephyr library: drivers__interrupt_controller`

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-07 11:42:47 +02:00
Gerard Marull-Paretas
d092945e86 drivers: pinmux: stm32: remove redundant include
stddef.h is already included by zephyr/types.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-06 12:23:30 -04:00
Gerard Marull-Paretas
5ef11520f2 drivers: pinmux: stm32: remove declaration of missing function
stm32_get_port_clock function is not defined anywhere, so remove its
declaration.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-06 12:23:30 -04:00
Gerard Marull-Paretas
902f963151 drivers: pinmux: stm32: remove unused pinmux struct
The struct stm32_pinmux_conf structure (and stm32_pin_func_t type)
are not used, so remove them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-06 12:23:30 -04:00
Glauber Maroto Ferreira
8dff10dfbe esp32s2: drivers: counter: add support
by bringing up on top of existing counter driver.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-09-06 10:02:57 -04:00
Armando Visconti
c3050a5aab drivers/sensor: lps22hh: Fix int32 overflow in the val2 part
The val2 calculation was done using (1000000 / 40960) as
multiplying factor, which was sometimes leading to a
int32 overflow. So, let's use the equivalent (but smaller)
(3125 / 128).

Fix #38090

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-09-06 03:31:50 -04:00
Andrei Emeltchenko
12f67c11cd pcie: shell: Print more MSI-X information
For pcie ls command print more detailed MSI / MSI-X information.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-09-03 10:09:05 -04:00
Andrei Emeltchenko
bf4d79a3db pcie: shell: Print 64 bit BARs
Print full 64 bit BARs.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-09-03 10:09:05 -04:00
Jake Swensen
6c2dca08f8 counter: ds3231: replace repeated bit manipulation with bcd functions
The driver code for the Maxim DS3231 has repeated code for bit
manipulation to transform time data between binary and binary coded
decimal. Use the new BCD header functions instead.

Signed-off-by: Jake Swensen <jake@swensen.io>
2021-09-03 10:06:07 -04:00
Mateusz Sierszulski
c09dfb3bf6 drivers: fpga controller: add shell support
This adds shell support for FPGA drivers.

Signed-off-by: Mateusz Sierszulski <msierszulski@internships.antmicro.com>
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2021-09-03 09:54:00 -04:00
Mateusz Sierszulski
a64ce1fc6b drivers: fpga controller: add eos_s3 fpga driver
This adds driver for EOS_S3 SoC FPGA.

Signed-off-by: Mateusz Sierszulski <msierszulski@internships.antmicro.com>
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2021-09-03 09:54:00 -04:00
Mateusz Sierszulski
2c718b2726 drivers: fpga controller: add fpga api
This adds new FPGA controller which allow to control FPGA chips.

FPGA controller has been created to enable bitstream loading
into the reprogrammable logic. It adds completely new API,
which enables to check status of the FPGA chip, power it on
or off and reset it.

Signed-off-by: Mateusz Sierszulski <msierszulski@internships.antmicro.com>
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2021-09-03 09:54:00 -04:00
Katsuhiro Suzuki
763428d5a4 drivers: serial: sifive: support SiFive Freedom series SoCs
This patch changes condition of 'depends on' of sifive UART driver
to support other SoCs of SiFive Freedom series.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2021-09-03 09:52:26 -04:00
Andrzej Głąbek
1bf7c391b8 drivers: audio: dmic: Add support for nRF PDM peripherals
Add a shim that allows using the nrfx PDM driver via the Zephyr API.
Add also missing devicetree nodes representing the PDM peripherals
in the nRF52 Series SoCs.
Extend the "nordic,nrf-pdm" binding with a new property that allows
specifying the clock source to be used by the PDM peripheral (so that
it is possible to use HFXO for better accuracy of the peripheral clock
or, in the nRF53 Series SoCs, to use the dedicated audio oscillator).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-03 09:34:06 -04:00
Tim Lin
f9a8a1dc0b ITE: soc: it8xxx2: move the timer registers to header file
The free run timer will be used to count before entering hibernate
mode. Move the related registers to the head file for accessing.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-09-03 08:07:08 -04:00
Neil Armstrong
95315239d8 pcie: use newly introduced IDs define for MSI/MSI-X
Remove the locally MSI/MSI-X capabilities ID define and use the
newly introduced one from the PCI Code and ID Assignment
Specification Revision 1.11 document header.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-02 19:37:56 -04:00
Neil Armstrong
99c2279abf pci: add Extended PCI(e) capability offset get
Extend the PCIe API to find Extended Capabilities in the PCI Express
Extended Capabilities located in Configuration Space at offsets 256
or greater.

Note: the Root Complex Register Block is not supported

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-02 19:37:56 -04:00
Hake Huang
ef410ee732 drivers: spi: Update mcux driver to support edma
enable spi driver to support dspi edma

add support for shared dma mux spi port

for shared spi port we need judge the irq source

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-09-02 15:50:52 -05:00
Hake Huang
cc1801440f spi: mcux: update driver init priority
use the CONFIG_SPI_INIT_PRIORITY to init device driver

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-09-02 15:50:52 -05:00
Christopher Friedt
650b111ba5 drivers: flash: Kconfig.sam: -depends on and +dfu sample exclude
The additional depends on SOC_FAMILY_SAM was redundant.

Add sam4l_ek to dfu sample exclude since it was failing on
arduino_due.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-09-02 13:23:47 -04:00
Grixa Yrev
27ac1cb012 drivers: can: mcux_flexcan: fix irq connect
IRQ_CONNECT macro last argument is architecture-specific flag,
but now there is instance id at this place.

This PR set architecture-specific flag to 0.

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
2021-09-02 06:46:10 -04:00
Gerson Fernando Budke
bca28015e3 drivers: adc: adc_sam0: Fix result ready interrupt
Atmel sam0 adc peripheral have multiple interrupt vectors for same5x
devices.  This configure interrupt vector by name to ensure that proper
interrupt handle will be executed.

Fixes #37779

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-09-02 06:45:35 -04:00
Gerard Marull-Paretas
f667b09ade drivers: display: ssd1306: add missing error handling
gpio_pin_configure_dt call was not being checker for errors.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-02 06:42:31 -04:00
Gerard Marull-Paretas
d65b7191d5 drivers: i2c: tca9546a: fix mutex initializer
The mutex initializer was only initializing the first instance of the
driver.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-02 06:42:31 -04:00
Gerson Fernando Budke
626b1b79df drivers: flash: Kconfig.sam: Fix depends on
The Kconfig refactor that replaces some single-symbol 'if's with
'depends on' added a second entry.  That entry allows flash driver
be selected for SoC's without support.  This fixes the 'depends on'
entry to allows only SAME/V SoCs.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-09-01 20:52:50 -04:00
Mahesh Mahadevan
35fca50dce drivers: i2s: Update MCUX Kconfig
Move SoC specific configs to the soc folder

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-09-01 14:39:03 -04:00
Mahesh Mahadevan
91f172e4ad drivers: dma: Zero-initialize memory allocated using kmalloc
The code was wrongly calling DMA_Abort on a channel
that not initialized. This fixes Issue#38078

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-09-01 12:34:50 -04:00
Ryan Erickson
ef322d9e16 drivers: modem: hl7800 Add Site Survey
Add API to determine nearby cell towers and their signal
strength.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-01 12:33:29 -04:00
Erwan Gouriou
b14a3cb2b3 drivers/gpio: stm32: Fix for stm32u5 support
W/o this fix issues could be seen on pins higher than 8

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-01 10:30:38 -04:00
Ryan Erickson
aba8a21001 drivers: modem: hl7800: Add Position over LTE (PoLTE)
Position over LTE (PoLTE) can be used to locate a device as
an alternative to GNSS.
Increase RX thread stack size for PoLTE processing.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-01 09:33:46 -04:00
Ryan Erickson
f094346e18 drivers: modem: hl7800: Add GNSS support
Add API to use GNSS on the HL7800 modem.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-01 09:33:46 -04:00
Ryan Erickson
e29dbf5d04 drivers: modem: hl7800: Add airplane mode
Add API to set HL7800 to airplane mode.
Also add option to boot into airplane mode.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-01 09:33:46 -04:00
Ryan Erickson
11e992099b drivers: modem: hl7800: Add delayed start
Allow application control for starting modem driver.
This allows network attach to be randomized.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-01 09:33:46 -04:00
Ryan Erickson
7cfedb915b drivers: modem: hl7800: fix COPS handler
Add support for handling the +COPS=? response
to the +COPS command handler.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-01 08:37:49 -04:00
Yuriy Vynnychek
fde0b96bb7 drivers: i2c: introduce new Telink B91 I2C driver
I2C driver basic support for Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-09-01 06:36:56 -04:00
Andrzej Puzdrowski
e7ac7269cf drivers/flash/flash_simulator: allow to disable statistic
So fare flash simulator had been forced to use the statistic
subsystem.

This patch introduces CONFIG_FLASH_SIMULATOR_STATS which allow to select
whether the statistic is involved in flash_simulator operations.

This patch allows to reduce flash footprint when the statistic is
not required.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-09-01 12:10:19 +02:00
Sigvart Hovland
ad4daa722a drivers: flash: add specific api for access flash_simulator RAM
For getting the address of the RAM region in the application we need to
extend the api for the flash_simulator.

This path introduce flash_simulator_get_memory() call which allow to
do so.

Signed-off-by: Sigvart Hovland <sigvart.m@gmail.com>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-09-01 12:09:58 +02:00
Ron Smith
e54d2553f3 drivers: serial: uart_sam0: Correct check for interrupts enabled
Fixes the issue where uart_sam0_irq_tx_ready would return true if
the INTFLAG was set even though the INTSET bit for the given
interrupt was not enabled yet through uart_sam0_irq_tx_enable.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-09-01 11:50:51 +02:00
Ron Smith
18830991e1 drivers: serial: uart_sam0: Update to correct bitmask
Update uart_sam0_irq_tx_enable to use the correct INTENSET bitmask.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-09-01 11:50:51 +02:00
Ryan Erickson
1c14a4b1ba modem: hl7800: reconfig IP connection on startup
For low power operation, set the IP connection reconfig
flag when receiving a startup report.
This will ensure the GPRS connection is reconfigured
before any socket operations take place.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-31 19:27:23 -04:00
Ryan Erickson
ac751b7bcc drivers: modem: hl7800: Query IMSI
Add API to query SIM card IMSI.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-31 19:25:13 -04:00
Ryan Erickson
d83aaef031 drivers: modem: hl7800: Add retries to get IP address info
Allow command retries when querying IP address info.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-31 17:34:53 -04:00
Yong Cong Sin
9d2f8a1124 drivers: modem: gsm_ppp: Use DTS
Convert the gsm_ppp driver to use DTS.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-08-31 17:33:34 -04:00
Ryan Erickson
61ef41fc24 drivers: modem: hl7800: Add query carrier config
Add API to query the carrier config of the HL7800.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-31 17:30:46 -04:00
Andrew Hedin
6fb6533a48 drivers: modem: hl7800: Fix generation of FOTA complete event
FOTA complete event is now generated and can be used by application.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2021-08-31 17:30:15 -04:00
Andrew Hedin
fd864c61bb drivers: modem: hl7800: Allow operation without a SIM card
Allow the driver to run if a SIM card is not present.
This allows public HL7800 APIs like firmware updates
to be used even if no network is available.
Remove duplicate query ICCID command.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2021-08-31 16:29:31 -04:00
Daniel Leung
89ddd0bfd2 usb: usb_dc_mcux: use K_HEAP_DEFINE_NOCACHE()
This changes "__nocache K_HEAP_DEFINE()" to use the new
K_HEAP_DEFINE_NOCACHE() macro. This fixes a build error
as K_HEAP_DEFINE() is specifying its own linker section
so that it is no longer possible to specify another
linker section.

Fixes #38108

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-31 16:29:11 -04:00
Daniel Leung
ef795f6fd1 flash: spi_nor: fix building on XCC
For some reason, XCC fails to build complaining segfault
during CGPREP phase. Adding an assignment to a volatile
return value seems to fix this. This provides an easily
revertable commit to workaround the issue.

Fixes #37734

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-31 07:36:28 -04:00
Rafał Kuźnia
3053a931a3 drivers: ieee802154: reverse ack data ext addr string
When ack data for extended address is set with the
nrf_802154_ack_data_set function, the extended address
must be reversed to the IEEE 802.15.4 address transmit
order in order to be properly matched.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-08-31 12:09:39 +02:00
Gerard Marull-Paretas
5f9fddd9d5 drivers: sensor: adxl362: improve error handling
Error handling was missing in numerous places, mostly on GPIO related
callbacks. Some error codes were not correct (-EINVAL vs -ENODEV) and in
some cases error was not propagated correctly.

Fixes #38117

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-30 17:53:24 -04:00
Gerard Marull-Paretas
35e7acb703 drivers: sensor: adxl372: add missing error handling
Error handling was missing in numerous places, mostly for GPIO related
callbacks. An assertion has been used in the context of thread callback.

Fixes #38132

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-30 17:53:24 -04:00
Martí Bolívar
21c6ca9487 drivers: sensor: clean up zephyr_library calls, again
Apply the same fix in bd8afe9365
(" drivers: sensor: clean up zephyr_library calls") to remove
redundant code in the sensor driver build system files. Additional
instances of the antipattern have crept in.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-30 17:07:51 -04:00
Gerard Marull-Paretas
546dd95ed5 drivers: sensor: sgp40: fix ticks variable types
The result of temperature and relative humidity ticks ranges from 0 to
65535 which is the range of a uint16_t variable. Intermediate tmp
variable type has also been adjusted.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-30 13:42:18 -04:00
Martí Bolívar
7a77a31436 dts: fix location of stm32-specific property
The max-erase-time property was introduced for the STM32 flash driver,
but it was inserted as an optional property in the generic
soc-nv-flash binding which is used by other SoCs.

Make it a required property in a new st,stm32-nv-flash binding
instead, since it is at present a vendor specific property.

Update the DTS files accordingly. Keep the existing "soc-nv-flash"
value in the compatible list in each case, so that DT_HAS_COMPAT(...
soc_nv_flash) tests on these nodes will still succeed, but put it
after a newly added "st,stm32-nv-flash" compatible, so that the
SoC-specific binding will be used as it is discovered first by the DT
tooling.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-30 13:40:30 -04:00
Jim Shu
45bcef1de9 drivers: gpio: add andes atcgpio100 GPIO driver
Add atcgpio100 GPIO driver for andes_v5 soc series.

Signed-off-by: Jim Shu <cwshu@andestech.com>
2021-08-30 13:40:14 -04:00
Johann Fischer
010b448454 drivers: usb_dc_nrfx: add logging for NRFX_USBD_EP_ABORTED event
Add logging for NRFX_USBD_EP_ABORTED event inside
control transfer events handling, otherwise "Unexpected event"
error message in this regard confuses the users.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-30 13:37:14 -04:00
Yuval Peress
74b9a607b4 drivers: bbram: Add it8xxx2 BBRAM driver implementation
Note that the it8xxx2 does not support a status register so that
functionality is omitted.

This change also adds driver tests that build both the npcx and it8xxx2
drivers.

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-08-30 11:35:23 -04:00
Yuval Peress
cbe4803812 drivers: bbram: fix npcx driver and update Kconfig defaults
There was a typo that snuck into the bbram driver for npcx.
Fix the driver and update the Kconfig to automatically include the
driver if the compatible string exists in the dts. This ensures that
the driver is built when building the npcx evbs.

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-08-30 11:35:23 -04:00
Fabio Baltieri
466ca63c2b drivers: ipm: set IPM_STM32_HSEM default from the device tree
Change IPM_STM32_HSEM Kconfig definition so that it picks the correct
default automatically depending on which cpu node is enabled in the
device tree, rather than relying on board specific Kconfig overrides.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-08-30 09:33:32 -04:00
Daniel Leung
ec2b9d42af pcie: msi: pci_msi_enable() to take IRQ as parameter
This changes pci_msi_enable() to take IRQ number as a function
parameter. The old behavior relies on putting the IRQ number
into the interrupt line register in the PCI config space
during IRQ allocation, and reading it back when enabling IRQ.
However, the interrupt line register is only required to be
read-/writable when legacy interrupt is supported on the device.
Otherwise it has undefined behavior. On ACRN, they don't even
care about this register and always wires it to 0x00.
So this commit changes the behavior in pci_msi_enable() to not
require reading back the interrupt line register and instead
takes the IRQ number via function parameter.

Fixes #36765

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-30 13:04:36 +03:00
Glauber Maroto Ferreira
489c012198 esp32: drivers: interrupt_controller: make it common for xtensa socs
by including interrupt allocation feature whenever an Xtensa-based
Espressif SoC is selected.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-27 17:34:41 -04:00
Glauber Maroto Ferreira
2689a6ee0a esp32s2: drivers: gpio: add gpio support
through the reuse of current gpio driver.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-27 17:34:41 -04:00
Glauber Maroto Ferreira
2c031caed0 esp32s2: drivers: interrupt_controller: add interrupt allocation support
through the reuse of current esp32 interrupt allocator.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-27 17:34:41 -04:00
Glauber Maroto Ferreira
219fe5339d esp32s2: drivers: pinmux: add pinmux support
on top of esp32 pinmux driver code.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-27 17:34:41 -04:00
Glauber Maroto Ferreira
7da555621c esp32: drivers: gpio: code refactoring
to ease driver code reuse between socs.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-27 17:34:41 -04:00
Glauber Maroto Ferreira
17f3792abf esp32: drivers: pinmux: code refactoring
to make use of Espressif's hal in order to ease both
driver maintenance and code reuse between socs.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-27 17:34:41 -04:00
Mahesh Mahadevan
2dbfb229ef drivers: counter: Remove unused macros
CTIMER_CLOCK_SOURCE macros have been moved to
soc.c file.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-27 13:47:04 -05:00
Francois Ramu
e90c47fbc4 drivers: dma: stm32 initialize a dma_stm32_data structure
In the dma.h there is a dma_ctx structure using a magic code
to be identify. This structure must be prepared as a new
element of the dma_stm32_data.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-08-27 13:08:33 -04:00
Leonard Pollak
dcff99eeaf drivers: sensor: sgp40: fix rounding errors
This fixes/improves the rounding errors that are introduced
through the truncation of integer division.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2021-08-27 13:07:54 -04:00
Arvin Farahmand
276996d754 drivers: eth_sam_gmac: use PHY driver
This commit removes PHY and MDIO specific code from the ATSAM
Ethernet driver and instead relies on a separate PHY driver to
handle the PHY.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-08-27 11:43:48 -04:00
Arvin Farahmand
f845cddcf7 drivers: Add Ethernet PHY API
This commit adds support for Ethernet PHY drivers via a PHY API.

It also includes a driver for a generic MII compliant PHY
which supports most PHYs on the market.

Separating PHY driver from the SoC specific Ethernet driver
simplifies the Ethernet driver code and enables code re-use.
Drivers for specific PHYs with more advanced features, such as
RGMII delay in PHY can be developed independent of the Ethernet
MAC driver.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-08-27 11:43:48 -04:00
Arvin Farahmand
2bec7587e9 drivers: mdio: add shell
MDIO shell support.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-08-27 11:43:48 -04:00
Arvin Farahmand
c4cb45eaac drivers: mdio: add Atmel SAM MDIO driver
MDIO driver for ATSAM platform with Ethernet.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-08-27 11:43:48 -04:00
Arvin Farahmand
419b103dd6 drivers: Add mdio API
This commit adds support for MDIO bus. The bus is used by Ethernet
MACs to communicate with PHYs.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-08-27 11:43:48 -04:00
Gerard Marull-Paretas
936f3523d3 drivers: sensor: fxas21002: check gpio calls return code
Some GPIO related calls were not being checked for error.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
50a31d2f36 drivers: sensor: bmg160: check gpio calls return code
Some GPIO related calls were not being checked for error.

This patch also fixes coverity issue 236651.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
7e57a8720d drivers: sensor: bmi160: check gpio calls return code
Some GPIO related functions were not being checked for errors.

This patch fixes coverity issue 236653.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
18732a5c74 drivers: sensor: fxos8700: check gpio calls return code
Some GPIO related calls were not being checked for errors.

This patch fixes coverity issue 236650.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
6cfab29e19 drivers: sensor: adt7420: check gpio add callback return code
gpio_add_callback was not being error-checked. Some other minor cleanups
(rc var to the top, remove redundant log).

This patch fixes coverity issue 236649.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
2682879df5 drivers: sensor: sx9500: check gpio calls return code
Some GPIO related calls were not being checked for error.

This patch fixes coverity issue 236648.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
53231c8bfe drivers: sensor: bmp388: check gpio calls return code
Some GPIO related calls were not being checked for error.

This patch fixes coverity issue 236647.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
09048f843a drivers: sensor: sgp40: fix humidity formula
Fix the formula used to compute RH/ticks formula according to the Table
9 of the datasheet.

This patch also fixes coverity issue 238360.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
9dab2b3c5c drivers: sensor: sgp40: fix temperature formula
Fix the formula that computes T/ticks according to the details found on
Table 9 of the datasheet.

This patch fixes coverity issue 238343.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
086cfb3913 drivers: i2s: nrfx: fix incorrect direction check
I2S direction was not checked correctly in the i2s_nrfx_configure
function.

This patch also fixes coverity issue 238365.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 16:47:27 -04:00
Piotr Mienkowski
2f17bd8e6b drivers: Add Atmel SAM DAC (DACC) driver
Add Digital-to-Analog Converter driver (based on DACC module) for Atmel
SAM MCU family. Only SAME70, SAMV71 series devices are supported in
this version.

Tested on Atmel SMART SAM E70 Xplained board.

Origin: Original

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-08-26 16:46:16 -04:00
Gerson Fernando Budke
1c43138333 drivers: usb: dc: sam: Add full driver fsm
Add sam4l full finite state machine based on Atmel Software Framework.
This allows driver detect protocol errors and sync all requests.  This
version is compliance with Linux USB tests.

Note: Tests are timing sensitive and log may affect results.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-08-26 14:03:44 -04:00
Gerson Fernando Budke
670c067563 drivers: usb: dc: sam: Add atmel USBC controller
Add atmel USBC device controller.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-08-26 14:03:44 -04:00
Yuval Peress
ab6e724ab4 emul: espi: Add ACPI Shared Memory functions
Add the bare minimum to set and access the ACPI shared memory via the
eSPI emulator.

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-08-26 13:14:05 -04:00
Martí Bolívar
2b9d477576 adc: npcx: use new DT pinctrl accessors
Update to use the new APIs.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-25 18:09:00 -04:00
Martí Bolívar
831332068b pwm: it8xxx2: use new DT pinctrl accessors
Update to use the new APIs.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-25 18:09:00 -04:00
Henrik Brix Andersen
a2791ccfef drivers: interrupt_controller: plic is independent of risc-v privileged
The RISC-V Platform-Level Interrupt Controller (PLIC) was moved from the
RISC-V Privileged Specification v1.11 to a separate specification
(see https://github.com/riscv/riscv-plic-spec).

Reflect this by not automatically enabling the PLIC interrupt controller
driver for all RISC-V privileged SoCs, but only for SoCs with the
CONFIG_RISCV_HAS_PLIC Kconfig option enabled.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-08-25 18:06:34 -04:00
Johann Fischer
9ad610d1a7 bluetooth: remove Kconfig options CONFIG_BT_*_ON_DEV_NAME
Follow up on commit bfd45e5b8c
("drivers: remove Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME")
Remove Kconfig options
CONFIG_BT_UART_ON_DEV_NAME and CONFIG_BT_MONITOR_ON_DEV_NAME
since all UART drivers are converted to devicetree and we can just use
DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_uart)) and
DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_mon_uart)).

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-25 18:05:17 -04:00
David Leach
d3cd0d2f9a drivers: adc: add LPADC driver support to mimxrt685 platform
Add LPADC support to the mimxrt685 platform.

Signed-off-by: David Leach <david.leach@nxp.com>
2021-08-25 18:02:00 -04:00
Scott Worley
145673d57a Microchip: MEC172x: I2C driver
Microchip MEC172x series I2C driver implementing controller
and target modes. The driver implemenents its own I2C port
pin control functions and does not depended upon pinmux. Future
updates will make use of PINCTRL when that subystem is finalized.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-25 13:07:45 -04:00
Alexandre Bourdiol
4b7e9368bc drivers: spi: spi_ll_stm32: not all stm32l1 MCU have SPI_CR2_FRF
After update of stm32 cube l1 V1.10.3,
SPI_CR2_FRF doesn't exist for all stm32L1 MCU,
thus LL_SPI_SetStandard() is also not defined for all stm32l1 MCU.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-08-24 22:14:20 -04:00
Erwan Gouriou
3e2672b13f drivers/clock_control: stm32: STM32WB: No HSE by-pass
HSE by-pass capability is not available on STM32WB.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-08-24 22:14:20 -04:00
Alexandre Bourdiol
29d1e90a8d drivers: bluetooth: hci: ipm_stm32wb: macro renamed CFG_BLE_OPTIONS
Adapt to stm32hal stm32wb cube update v1.12.0

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-08-24 22:14:20 -04:00
Toby Firth
893bfc0fc1 drivers: counter: added ctimer driver for lpcexpresso55s69
Added shim driver for the CTIMERs for the lpcexpresso55s69 board.

Fixes: #22705

Signed-off-by: Toby Firth <tobyjfirth@gmail.com>
2021-08-24 17:13:22 -04:00
Aurelien Jarno
698a28663c drivers/sensor: Add basic Silabs Si7210 support
This adds basic support for the Silabs Si7210 hall effect magnetic
position and temperature sensor. It is able to get magnetic field and
temperature in the default scale of the sensor (depending on the
variant). It also supports going into sleep mode without measurements
through the device power management infrastructure.

It is most notably missing support for scale change, measurement
averaging and filtering, and alert pin configuration (threshold,
hysteris, tamper).

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-08-24 10:16:19 -05:00
Vojislav Milivojevic
fcfb1d9872 drivers: sensors: fix of sensor channel get for z axis
the correct value is returned when using sensor channel get function to
read z-axis value

Signed-off-by: Vojislav Milivojevic <milivojevicvoja@yahoo.com>
2021-08-24 09:40:26 -05:00
Ruibin Chang
2877bdcdfe ITE drivers/watchdog: reduce interval of warning timer
Reduce interval of warning timer, so we can print more
warning messages (ex. MEPC, task ID...) before watchdog reset.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-08-24 07:31:08 -04:00
Ruibin Chang
f2b9ba1b2c ITE drivers/timer: add disable event timer control
We add disable event timer at the beginning of critical section
for two reason:
1.For K_TICKS_FOREVER case: since no future timer interrupts
are expected or required, so we disable the event timer.
2.Others case: according it81202 spec, when timer enable bit
from 0->1, the timer will reload counts and start countdown.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-08-24 07:30:47 -04:00
Erwan Gouriou
d40910097a drivers/clock_control: stm32wl: Consider new options for HSE clock
On STM32WL, HSE clock can take 2 specific options:
-hse-tcxo
-hse-div2
Enable support for these options.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-08-24 07:19:12 -04:00
Johann Fischer
bfd45e5b8c drivers: remove Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME
Remove Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Johann Fischer
92a00ee39b drivers: uart_altera_jtag_hal: use DEVICE_DT_INST_DEFINE()
The conversion to devicetree seems to be half lost
for this driver. There are already bindings and nodes for
compatible "altr,jtag-uart", update driver to use it.
Remove last mention of CONFIG_UART_CONSOLE_ON_DEV_NAME.

Resolves #37207

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Johann Fischer
c179d83e72 drivers: uart_mcumgr: remove CONFIG_UART_MCUMGR_ON_DEV_NAME
Remove CONFIG_UART_MCUMGR_ON_DEV_NAME and use
DEVICE_DT_GET(DT_CHOSEN(zephyr_uart_mcumgr)).
Add usb.overlay, which contains chosen node and cdc-acm-uart node,
to smp_svr sample.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Johann Fischer
e78b0785b3 console: remove device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME)
Remove device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME)
and use DEVICE_DT_GET(DT_CHOSEN(zephyr_console)) to get
chosen "zephyr,console" node.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Leonard Pollak
d6eb80ac27 drivers: sensor: INA219: added support
This adds support for the TI INA219 Zero-Drift, Bidirectional
Current/Power Monitor with I2C Interface

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2021-08-23 10:32:07 -05:00
Yong Cong Sin
cf3b18bec0 drivers: usb: device: Add support for USB on STM32G0X
Patches to support USB_DRD_FS on STM32G0 series.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-08-23 08:24:46 -04:00
Ryan Erickson
2e045a0ed6 drivers: modem: hl7800: null terminate DNS server list
bugfix: NULL termination is required by
dns_resolve_reconfigure API so null terminate the DNS
server list.
Fix checkpatch warning.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-20 14:10:22 -05:00
Marcin Niestroj
c910138ade drivers: lora: sx12xx: fix atomic include
Include sys/atomic.h instead of sys/atomic_builtin.h, so that build for
platforms with non-default atomic implementation will still succeed.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-08-20 11:32:45 -04:00
Ryan Erickson
8d6832b256 drivers: modem: hl7800: socket RX could drop data
net_buf_skipcrlf() will remove all \r\n characters from the buffer.
If the data after CONNECT\r\n contained \r or \n it would
be removed, resulting in dropped data.
Fix this to only remove two bytes to ensure data is not dropped.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-20 06:33:31 -04:00
Ryan Erickson
6ef958c2e1 drivers: modem: hl7800: keep socket data if EOF not found
Change socket RX trailer (EOF) missing to warning and
keep socket RX data instead of discarding.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-20 06:33:31 -04:00
Tomasz Bursztyka
f70ecc1099 drivers/pcie: Improve and fix MBAR retrieval depending on use cases
So far pcie_get_mbar() has been the only way to retrieve a MBAR. But
it's logic does not fit all uses cases as we will see further.
The meaning of its parameter "index" is not about BAR index but about
a valid Base Address count instead. It's an arbitrary way to index
MBARs unrelated to the actual BAR index.

While this has proven to be just the function we needed so far, this has
not been the case for MSI-X, which one (through BIR info) needs to
access the BAR by their actual index. Same as ivshmem in fact, though
that one did not generate any bug since it never has IO BARs nor 64bits
BARs (so far?).

So:

- renaming existing pcie_get_mbar() to pcie_probe_mbar(), which is a
  more relevant name as it indeed probes the BARs to find the nth valid
  one.
- Introducing a new pcie_get_mbar() which this time really asks for the
  BAR index.
- Applying the change where relevant. So all use pcie_probe_mbar() now
  but MSI-X and ivshmem.

Fixes #37444

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-08-20 06:30:20 -04:00
Francois Ramu
c4161024c4 drivers: dma: stm32 dma of type V1 with mux
This is the configuration of the stm32h723 where the
dma1 & dma2 of type V1 with a MUX. Even if DMA is of type V1,
the 'feature' does not exist with DMAMUX

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-08-20 06:28:32 -04:00
Yuriy Vynnychek
b7f99d4a47 drivers: serial: b91: full duplex mode support
Improved fifo_fill API: stop and return on RX.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-08-20 06:23:24 -04:00
David Leach
b6a3dc8d71 drivers: can: mcux_flexcan: Update to support rt1170
The RT1170 platform adjusted the result parameter in the callback
function to be a uint64_t. The adjustment is to conditionally change
the callback definition and then cast the result value to a size that
fits the reported values across the various SOCs.

With error results, cast result to uint64_t and modified the called
function to print a uint64_t value.

With the RX/TX status, result is a MB value that doesn't exceed 64
so the result value is cast down to a uint32_t.

Fixes #37691

Signed-off-by: David Leach <david.leach@nxp.com>
2021-08-20 06:16:24 -04:00
Mahesh Mahadevan
e3a14d9cb9 drivers: usb: Rename NXP EHCI driver
Rename to usb_dc_mcux as this driver is used for both
EHCI and LPC USB controllers

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-19 17:19:11 -04:00
Mahesh Mahadevan
3982708359 drivers: usb: Add support for NXP LPC USB controller
1. Add support for NXP LPC USB controller
2. Do not check the return value from the
   kUSB_DeviceControlRun command as not all SDK drivers
   return a value
3. Use the kUSB_DeviceControlPreSetDeviceAddress
   command to set device address

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-19 17:19:11 -04:00
Yuriy Vynnychek
87018c50cc drivers: spi: introduce new Telink B91 SPI driver
SPI driver basic support for Telink B91 SoC.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-08-19 17:18:23 -04:00
Alexandre Bourdiol
482198bf79 drivers: clock_control: stm32: enable PWR clock unconditionally
Enable PWR clock unconditionally for L4, L5 and U5
like it is done on other stm32 series

Fixes #37781

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-08-19 08:51:10 -05:00
Jordan Yates
dfc16827d6 flash: spi_nor: re-enable write protection
Turn write-protection back on after a write, instead of disabling it
again.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-18 20:10:59 -04:00
Dino Li
9c47f314a5 flash: it8xxx2: add a short delay before #CS be driven high
The delay will ensure last byte has been latched in before

This also change the method of reading status register from re-send
read status command on each read to read status register continuously.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-08-18 20:10:05 -04:00
Daniel Leung
ab87df9f75 sensor: grove: fix cmake empty library warning
When there is no grove sensor driver enabled, cmake warns
that the library has no sources. Fix that by adding
a new kconfig to be used by CMake to selectively
include the grove directory.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-18 19:08:41 -05:00
Daniel Leung
e4da47ca8f drivers: sensor: fix cmake empty library warning
When there is no sensor driver enabled, cmake warns that
the library has no sources. Fix that by wrapping cmake
library instructions inside kconfig.

Fixes #37765

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-18 19:08:41 -05:00
Daniel Leung
4c3a023a0c drivers: console: fix cmake empty library warning
When there is no console driver enabled, cmake warns that
the library has no sources. So only include the console
directory when CONFIG_CONSOLE is enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-18 19:08:41 -05:00
Alexander Wachter
3262eb416f drivers: sensors: tmp116: Use compile time i2c device
Use the compile-time devictree macro to obtain the i2c dev.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-08-18 09:27:29 -05:00
Alexander Wachter
704ec188f2 drivers: sensors: tmp112: Allow multiple instances
Allow to instanciate multiple instance.
Use compile-time defined i2c device instance.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-08-18 09:27:29 -05:00
Sylvio Alves
d04a58bd1e clock: esp32: fix dt node path
Latest node linux prefix update commit
missed esp32 clock entry.

ref: 7cf99aa2f2

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-08-18 06:41:13 -05:00
Jordan Yates
3cec3ac2a4 lora: detect failed transmissions
Detect failed transmissions using `lora_send` by only waiting for some
multiple of the actual on-air time before giving up.

We use this instead of the inbuilt TxTimeout functionality because the
value of this timeout is set by `lora_configure`, and therefore doesn't
change with different packet lengths. This is a limitation of the
underlying `RadioSend` function, not the Zephyr driver.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-18 05:16:46 -04:00
Jordan Yates
93b4dbcc19 lora: lora_send blocks until completion
Change the behaviour of `lora_send` to block until the transmission
completes. The current asynchronous behaviour is exposed through the
new function `lora_send_async`. This naming convention brings LoRa in
line with other asynchronous subsystems.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-18 05:16:46 -04:00
Mahesh Mahadevan
387e6a676f drivers: disk: Update NXP USDHC driver
1. Do not throw an error when FSL_FEATURE_USDHC_HAS_HS400_MODE
   is defined
2. Add support for the case when the card detect is handled
   by the USDHC module

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-17 17:53:31 -04:00
Mahesh Mahadevan
f28672a448 drivers: clock_control: Update LPC clock driver for USDHC
Add support to get USDHC clock frequency

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-17 17:53:31 -04:00
Mahesh Mahadevan
27c73d3841 drivers: lpc_gpio: Fix warning when interrupt is not defined
Unused variable warnings were seen when the GPIO interrupt
property was not defined.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-17 17:53:31 -04:00
Martí Bolívar
bcf8e560c5 dts: rename 'nios2,i2c' compatible to 'altr,nios2-i2c'
The original NIOS-II developer and former vendor is Altera, which is
now part of Intel. Let's not add a new vendor prefix for something
that already exists and has been acquired; move it to use the existing
'altr,' prefix instead.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-17 17:51:57 -04:00
Martí Bolívar
f78d4be329 dts: fix 'grove,foo' compatibles by using 'seeed,grove-foo'
Rename:

- grove,light to seeed,grove-light
- grove,temperature to seeed,grove-temperature

The "grove" brand applies to a family of products by Seeed (sic):

https://www.seeedstudio.com/category/Grove-c-1003.html

Therefore we should use the existing vendor seeed.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-17 17:51:57 -04:00
Martí Bolívar
b4042154bf dts: fix 'colorway' compatibles
I can't find any reference anywhere showing that the manufacturer of
the LPD8803 or LPD8806 LED scripts is a company called 'colorway'.

Use 'greeled' instead; these seem to actually be manufactured by
GreeLed corporation.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-17 17:51:57 -04:00
Martí Bolívar
98f43ba0be dts: fix max30101 compatible
It should be "maxim,max30101", because the vendor prefix for this
company is "maxim", not "max".

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-17 17:51:57 -04:00
Martí Bolívar
3910c35193 dts: fix u-blox sara r4 compatible
It should be "u-blox,sara-r4", because the vendor prefix for this
company is "u-blox", not "ublox".

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-17 17:51:57 -04:00
Tim Lin
6a1262198a ITE: drivers/i2c: it8xxx2: move pinctrls macro to soc_dt.h
This PR will change accessing the related pinctrl macro from soc_dt.h
And the pinctrl of SCL and SDA were got from pinctrl-0 and pinctrl-1,
respectively. Change it to get from pinctrl-0 only.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-08-17 17:51:17 -04:00
Leonard Pollak
9a59d30517 drivers: sensor: SHT4X: convert to i2c_dt_spec
Convert sht4x driver to `struct i2c_dt_spec`.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2021-08-17 12:40:17 -05:00
Leonard Pollak
adc5604c5c drivers: sensor: SGP40: convert to i2c_dt_spec
Convert sgp40 driver to `struct i2c_dt_spec`.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2021-08-17 12:40:17 -05:00
Dominik Ermel
f7ac14ddc7 mgmt/mcumgr: Allow using UART async API
The commit provides preliminary support for async UART within
mcumgr.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-08-17 17:12:34 +02:00
Robert Szczepanski
55e3c732d0 drivers: video: ov2640: add driver for ov2640 image sensor
This adds the driver for Omnivision OV2640 image sensor.

The driver provides support for 10 different resolutions in range from
160x120 to 1600x1200 in both JPEG and RGB565 pixel formats. There are
also mutliple configuration options, e.g. hflip, vflip, saturation and
brightness control.

Signed-off-by: Robert Szczepanski <rszczepanski@antmicro.com>
2021-08-17 09:18:38 -04:00
Daniel Leung
eb0060cd7b drivers: display: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Also sort the entries alphabetically.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
8dd6540e02 display: change init priority config to 85
Some display drivers may actually be initialized after LittlevGL
as those drivers and LittlevGL's lvgl_init() all have SYS_INIT()
at APPLICATION and init priority the same as application init
priority. Depending on how the final binary is linked, these
drivers may initialize after lvgl_init() resulting in it not
able to find a display driver. This changes the value of
CONFIG_DISPLAY_INIT_PRIORITY so that the display drivers that
make use of this kconfig are initialized a bit earlier to
ensure that they are actually initialized before lvgl_init().

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
0464524986 drivers: pm_cpu_ops: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
59a16f71d5 drivers: sys_con: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
94514726b2 drivers: watchdog: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
25b47290bd drivers: usb: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
6ed46e3412 drivers: ptp_clock: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
43309296b8 drivers: pinmux: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
28021b8484 drivers: net: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
0f0c17880e drivers: modem: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
2880a49198 drivers: memc: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
08a2be839c drivers: led_strip: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
583d392477 drivers: led: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
95782108dd drivers: ieee802154: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
6edd223772 drivers: hwinfo: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
cbbc6c2102 drivers: flash: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
e912a0533a drivers: ethernet: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Note that the include to subsys has been moved from
under the drivers into subsys, as it is actually
the subsystem's job to make sure the include
directories are correct.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
77dd3daaaf drivers: edac: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
f6a3dcf282 drivers: disk: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
71bd37efb2 drivers: clock_control: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
a062463d7b drivers: can: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
bcdff8220a drivers: sensors: build as static libraries
Instead of putting object files inside libzephyr.a, simply
build a separate static library for the top level of sensor
drivers. Also, for those that were not building its own
static library, make them do so as majority of sensor
drivers are building their own static libraries.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
378ad046c8 drivers: bluetooth: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Note that the include to subsys/bluetooth has been
moved from under drivers/bluetooth to subsys/bluetooth,
as it is actually the subsystem's job to make sure
the include directories are correct.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
579ca90e25 drivers: wifi: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
941eb9696a drivers: pcie: build as static library
Instead of putting the object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
2fccd97f0c drivers: i2c: slave: group into i2c static library
This changes the build command so the I2C EEPROM slave
is being grouped into the I2C static library.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
9cef5d5981 drivers: console: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Also sort the entries alphabetically.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
32f094f8fa console: semihosting: remove unused include
Content in kernel_arch_interface.h is not being used.
So remove the #include.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
29ec31bff3 console: native_posix: change init priority to 99
This changes the init priority of native posix console to 99.
When building for native_posix, it is usually assumed that
the output would be stdout. With old priority at 60, UART
console, for example, can be initialized later which means
printk() would not go to stdout. So changing the native posix
console to be (hopefully) initialized last.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
f0b3146ff5 drivers: timer: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Also sort the entries alphabetically.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
9fa5437447 drivers: interrupt_controller: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Also sort the entries alphabetically.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Francois Ramu
744e1dc692 drivers: serial: stm32 uart defines dma slot with macro
The STM32_DMA_SLOT macro from include/drivers/dma/dma_stm32.h
must be used here, especially for dma of type v2bis.
In this case, the dma-cell is not defined and slot is null.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-08-16 19:35:36 +02:00
Martin Jäger
ecef16aa86 bluetooth: hci: esp32: Fix DBG logging
The log level was always set to debug. Defining BT_DBG_ENABLED same
as for other bluetooth files allows to switch off debug log messages.

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-08-16 11:44:10 +02:00
Fabio Baltieri
d6731819e3 drivers: sx126x_standalone: use the correct dev_data for dio1 callback
The current code uses dev->data for finding back the instance data
structure in various places, but for the dio1 irq callback, dev refers
to the GPIO device node (not the LORA radio one), so dev->data returns a
pointer to the GPIO data rather than a "struct sx126x_data".

Fix that by using CONTAINER_OF to find back the correct structure from
the callback pointer.

The bug was introduced in:

  74efaa920a drivers: sx126x: refactor few functions for stm32wl support

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-08-16 04:57:41 -04:00
Watson Zeng
fc8dc62310 drivers: gpio: cy8c95xx: use LOG_DBG instead of LOG_INF
LOG_INF: It's meant to write generic user oriented messages.
LOG_DBG: It's meant to write developer oriented information.

use LOG_DBG instead of LOG_INF to hide debug message.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-08-15 21:13:14 -04:00
David Leach
f3435b75ef hal: nxp: Update to SDK 2.10.0
Updating to the SDK 2.10.0 for select platforms.

west.yml:
- Update to point to the NXP HAL update with SDK 2.10.0 files
- modules/tee/tfm needed to be updated to synchronize the
  LPCXPRESSO55S69 platform SDK to version 2.10.0 to be in sync
  with Zephyr usage of SDK 2.10.0

drivers/counter/counter_mcux_pit.c:
- underlying SDK 2.10.0 adjusted the setting by -1 so need
  to adjust the reported value set by +1

drivers/ethernet/eth_mcux.c:
- SDK2.10 ethernet driver provided an assert test that highlighted
  we were using the wrong clock source on various platforms.

drivers/memc/memc_mcux_flexspi.c:
- SDK2.10 added compile time conditional on whether a field was
  defined for the flexspi configuration structure.

Signed-off-by: David Leach <david.leach@nxp.com>
2021-08-13 15:37:48 -05:00
Mahesh Mahadevan
a69bd75bd8 modules: hal_nxp: Move NXP USB file to modules folder
Move USB file to from modules/hal_nxp to zephyr/modules
folder

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-13 12:51:46 -04:00
Sylvio Alves
907b5d9e7f drivers: spi: set max chunk len for esp32
Max SPI chunk len was missing from the
implementation, causing SPI to hang up in some
conditions.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-08-12 16:22:34 -05:00
Mark Wang
857b8508d0 drivers: serial: NXP: Enable flow control for uart_mcux_lpuart
add flow_ctrl filed and give it initialized value
    based on hw_flow_control.
Initialize mcux lpuart based on flow_ctrl

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2021-08-12 14:49:09 -05:00
Daniel Leung
8b8e8f99ba display: introduce CONFIG_DISPLAY_INIT_PRIORITY
This introduces a new kconfig CONFIG_DISPLAY_INIT_PRIORITY
to specify the initialization priority for display devices.
Most of the display devices are using APPLICATION and
CONFIG_APPLICATION_INIT_PRIORITY which is not entirely
appropriate for devices. Due to linking order, the display
device may be initialized after application code at same
init level and priority. This results in the display device
not ready to be used for application code. So this kconfig
option allows the display devices to be initialized earlier
if needed.

For the drivers using CONFIG_APPLICATION_INIT_PRIORITY,
they have been changed to use CONFIG_DISPLAY_INIT_PRIORITY
instead.

Note that the default value for CONFIG_DISPLAY_INIT_PRIORITY
is the same as CONFIG_APPLICATION_INIT_PRIORITY at 90 to
avoid any functional changes.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-12 17:00:39 +02:00
Scott Worley
19dd46ef68 Microchip: MEC172x: ADC driver
Add ADC driver version 2 for MEC172x using new in-tree headers
and device tree properties. Update the ADC shell for the new driver.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-11 19:44:31 -04:00
Flavio Ceolin
2aa67efd7a drivers: gpio_emul: Add dummy pm support
Add a simple device PM support to be used for tests.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-11 19:39:13 -04:00
Dong Wang
a56c42574e timer: hpet: make it support EHL/PSE CPU
Add config macro to set interrupt as level triggered for ARM CPUs
Merge all timer configures into one place, then no need to overwrite
hpet_timer_conf_get/set() functions in SoC layer
Make hpet_timer_comparator_set() as the only register access function
to implemented in the SoC layer

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
2021-08-11 11:30:05 -04:00
Dong Wang
eeb15aa393 timer: hpet: enable 64 bit mode for better usages
Get longer maximum timeout
Make HPET counter usable as timestamp

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
2021-08-11 11:30:05 -04:00
Piotr Mienkowski
6c699239f9 drivers: flash_sam: fix flash_sam_write_page
According to Atmel SAM datasheet when writing data to the latch buffer
"32-bit words must be written continuously, in either ascending or
descending order. Writing the latch buffer in a random order is not
permitted." To enforce the requirement we need to call a memory barrier
instruction after copying every word of data to the latch buffer. In
the absensce of __DSB() call the ARM processor is free to change order
of AHB transfers. This has caused the driver to occasionally corrupt
data programmed in the flash.

Fixes #37515

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-08-11 11:29:04 -04:00
Neil Armstrong
72bb75a360 pcie: msi: fix MSI-X fallback to MSI
When enabling MSI & MSI-X, the code seemed to handle fallback to MSI
when MSI-X is not available, but the logic uses MSI-X even if not
available and the MSI path never gets used.

Fixes: a2491b321e ("drivers/pcie: Add support for MSI-X")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-08-10 14:46:22 -04:00
Neil Armstrong
f9c3ade883 pcie: msi: add missing mem_manage.h include for MSI-X
When building on non-X86 platforms K_MEM_PERM_RW gets undefined.

Fixes: a2491b321e ("drivers/pcie: Add support for MSI-X")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-08-10 14:46:22 -04:00
Christopher Friedt
5c7f395f8f Revert "include: driver: sensor: add tank level channel in units of percent"
This reverts commit f51aec4307.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-08-10 09:44:48 -05:00
Jordan Yates
3682eb9714 sensor: bmi160: convert to _dt_spec
Convert bmi160 driver to use `spi_dt_spec`, `i2c_dt_spec` and
`gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
757bb42d5f sensor: bme280: convert to _dt_spec
Convert bme280 driver to use `spi_dt_spec` and `i2c_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
75682f7d0e sensor: adxl372: convert to _dt_spec
Convert adxl372 driver to use `spi_dt_spec` and `gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
534bfbda8a sensor: adxl362: convert to _dt_spec
Convert adxl362 driver to use `spi_dt_spec` and `gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
941a1af0e3 led_strip: lpd880x: update to spi_dt_spec
Convert lpd880x to use `spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
7065aec5e2 led_strip: ws2812: convert to spi_dt_spec
Convert ws2812 LED strip driver to `spi_dt_spec`. Also moves the init
function implementation outside the declaration macro.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
8d84626cab led_strip: apa102: convert to spi_dt_spec
Convert apa102 LED strip driver to `spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
3085c4d070 ethernet: w5500: convert to _dt_spec
Convert w5500 ethernet driver to `spi_dt_spect` and `gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 19:50:53 -04:00
Jordan Yates
128e8a4a6f ethernet: enc424j600: convert to _dt_spec
Convert enc424j600 ethernet driver to `spi_dt_spect` and `gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 19:50:53 -04:00
Jordan Yates
a94cfb42a3 ethernet: enc28j60: convert to _dt_spec
Convert enc28j60 ethernet driver to `spi_dt_spect` and `gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 19:50:53 -04:00
Jordan Yates
c634a79344 eeprom: at2x: convert to _dt_spec
Convert the at2x eeprom driver to `spi_dt_spec` and `i2c_dt_spec`.
I2C functions are not fully converted due to the non-standard addressing
scheme.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 19:50:53 -04:00
Jordan Yates
7b42f8960a display: ssd1306: convert to _dt_spec
Convert the ssd1306 driver to `spi_dt_spec` and `i2c_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 19:50:53 -04:00
Henrik Brix Andersen
eb616130d7 drivers: sensor: add driver for the LM77 temperature sensor
Add sensor driver for the LM77 temperature sensor.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-08-09 19:50:29 -04:00
Nick Ward
f51aec4307 include: driver: sensor: add tank level channel in units of percent
Provides an enum for tank level sensor drivers.

Signed-off-by: Nick Ward <nick.ward@setec.com.au>
2021-08-09 16:24:50 -04:00
Scott Worley
ad19104f28 Microchip: MEC172x: Add UART driver
Microchip XEC has been using the standard NS16550 driver.
Using the standard NS16550 driver requires extra HW programming
for XEC UART in board level and did not support XEC GIRQ interrupt
programming. We add an XEC specific driver and remove UART specific
register programming from the board level and implement interrupt
support. Also, by implementing a SoC specific driver we can add
driver PM in the future.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-09 16:21:33 -04:00
Sylvio Alves
d608e79777 drivers: esp32: fix data range check
Fix if content fits in a single write page.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-08-09 13:19:20 -04:00
Glauber Maroto Ferreira
8e865a7a88 esp32s2: drivers: serial: add minimal uart driver
based on uart rom functions, also enable console driver
on top of this driver, which enables logging

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-09 13:03:14 -04:00
Imre Lagas
ee3f50fdeb drivers: gpio: Add fxl6408 driver
Add a driver for the fxl6408 gpio-expander using gpio api.

Origin: original

Signed-off-by: Imre Lagas <Imre_Lagas@hotmail.com>
2021-08-09 13:02:20 -04:00
Aurelien Jarno
117090c1a2 drivers: sensors: ti_hdc20xx: add support for DRDY/INT pin
Add optional support for the DRDY/INT pin. This avoids waiting a fixed
time for the temperature and humidity conversion to finish.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-08-09 11:32:43 -04:00
Aurelien Jarno
28f9a7614b drivers: sensors: ti_hdc20xx: reset the device during init
Soft-reset the TI HDC20XX sensor during init to bring all registers in a
known and consistent state.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-08-09 11:32:43 -04:00
Aurelien Jarno
28e7cfd037 drivers: sensors: ti_hdc20xx: convert to i2c_dt_spec
Convert ti_hdc20xx temperature and humidity sensor driver to
`i2c_dt_spec`.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-08-09 11:32:43 -04:00
Aurelien Jarno
7ebae7f569 drivers: sensors: ti_hdc20xx: use uint16_t variables to store the samples
The temperature and humidity samples are 16 bits long and can therefore
fit in a uint16_t variable. This save 4 bytes of RAM.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-08-09 11:32:43 -04:00
HaiLong Yang
559e1269e7 drivers: ipm: add driver based on stm32 hsem
Some STM32 SOC, like stm32h745 and stm32h747 doesn't have IPCC.
Provide a STM32 HSEM based ipm driver for these SOC.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2021-08-09 16:11:28 +02:00
Jordan Yates
d2363be091 lora: sx12xx_common: thread safe RX
Make the `lora_recv` operation thread safe by copying memory directly
in the callback instead of deferring copying to the original caller.

To ensure pointer validity, this requires performing operations "inside"
the `modem_release` context.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-08 04:19:27 -04:00
Jordan Yates
586a4bfc7d lora: sx12xx_common: thread-safe API
Ensure that the modem is not asked to perform new operations before the
previous operation completes.

An atomic variable is used instead of a mutex as multiple threads need
to release the lock. A semaphore isn't used as there is no indication
whether `k_sem_give` gives the semaphore or not, which is required to
determine if `Radio.Sleep()` should be run.

`Radio.Sleep()` is only ever run by the context that successfully
releases the modem usage, to guard against double calls.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-08 04:19:27 -04:00
Jordan Yates
4b370fb5e3 lora: sx12xx_common: transition to k_poll_signal
Transition the receive synchronisation method from a single driver
semaphore to a function specific k_poll_signal. This is required to
allow the modem to be released without introducing race conditions on
the signalling mechanism.

Without this change, the RX can either be signalled before the modem is
released, unblocking the calling thread before the modem is put back to
sleep, or after the modem is released, in which case a second thread
could start using the semaphore before the original thread is signalled.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-08 04:19:27 -04:00
Jordan Yates
f397361c8a lora: sx12xx_common: sleep after RX timeout
If no packet was received in the provided timeout, manually transition
to sleep mode. If a packet was received, the rx_done callback
automatically transitions the modem to sleep.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-08 04:19:27 -04:00
Mulin Chao
ab87854d9b driver: serial: replace suffix nuvoton with numicro
Replace the suffix "nuvoton" with "numicro" for Nuvoton microcontroller
serial driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-08-07 20:37:24 -04:00
Yuval Peress
268f9bf163 nuvoton: battery-backed ram
Add bindings and entry for the battery-backed ram in the nuvoton
npcx. This commit is an upstream port of
https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/dts/bindings/cros_bbram/nuvoton,npcx-cros-bbram.yaml;l=1;drc=e9af813c36b7b411bf2a01cbc1b09d5fdec49b8a

Along with a bit of cleaning up and an emulator.

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-08-07 20:32:33 -04:00
Przemyslaw Bida
678a170925 net: openthread: Add capability to disable properly CSL.
This commit adds capability to disable CSL sampling by setting
CSL period to 0.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2021-08-07 20:27:25 -04:00
Scott Worley
114b84a58b Microchip: XEC GPIO driver interrupt enable fix part 2
Fixes issue 34879
This PR updates previous PR's 37138 and 37139.
Refer to issue 34879 for information from MCHP HW
designers. A delay after enabling interrupts is a
more appropriate work-around than depending upon
behavior of ARM DMB instruction.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-07 20:24:37 -04:00
Felipe Neves
2474c9b3f3 soc: riscv: esp32c3: added initial support for ble
subsystem by linking esp32 vhci adapter to the
espressif ble controller adapter

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-08-07 19:59:27 -04:00
David Leach
569a1a0a5d soc: arm: nxp_imx: rt: Configure settings for TRNG IP
RT platforms that support TRNG IP (rt10xx and rt6xx) need to set
RNG and CSRNG to Xoroshiro and CTR_DRBG respectively instead of
using TRNG as random source.

Fixes: #37307

Signed-off-by: David Leach <david.leach@nxp.com>
2021-08-06 20:29:59 -04:00
Andrzej Głąbek
3842babc79 drivers: serial: nrf: Make pull-ups on UART pins configurable
This is a follow-up to commit 3656ba5ae9.

Do not enforce pull-up resistors to be enabled on RXD and CTS pins
in nRF UART drivers, as in certain hardware designs this may be
undesirable or may even make certain hardware not working.
Instead, provide devicetree properties that allow enabling of those
resistors when it is actually needed.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-08-06 19:17:26 -04:00
Jan Pohanka
1df0569001 drivers: ethernet: eth_stm32_hal.c: add wait time for buffer allocation
Driver's RX thread can wait some time before a free buffer is available.
When resources are limited we can easily run out of them.

Fixes #36891.

Signed-off-by: Jan Pohanka <xhpohanka@gmail.com>
2021-08-05 11:32:42 -04:00
Krzysztof Chruscinski
0419ff72aa drivers: counter: nrfx_timer: Add option to use ZLI interrupt
Extended driver configuration in device tree to enable ZLI interrupt.
When zli is set in the device tree then event handlers for alarm and
top is called in ZLI interrupt context. It means that kernel primitives
cannot be used there.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-08-05 16:17:23 +02:00
Krzysztof Chruscinski
53333d58bf drivers: counter: nrfx_rtc: Add option to use ZLI interrupt
Extended driver configuration in device tree to enable ZLI interrupt.
When zli is set in the device tree then event handlers for alarm and
top is called in ZLI interrupt context. It means that kernel primitives
cannot be used there.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-08-05 16:17:23 +02:00
Yuriy Vynnychek
84db9cd36a drivers: pwm: introduce new Telink B91 PWM driver
PWM driver basic support for Telink B91 SoC.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-08-05 16:11:41 +02:00
Dario Binacchi
c3ee515865 drivers: can: stm32: fix typo in a comment
Replace 'mailbix' with 'mailbox' in drivers/can/can_stm32.c.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-08-05 16:11:11 +02:00
Dario Binacchi
f4e9ec5392 drivers: can: stm32: drop exit from sleep mode
Before entering initialization mode, we left sleep mode, then request
to leave again sleep mode before returning from can_stm32_init() is
useless.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-08-05 16:11:11 +02:00
Dario Binacchi
b1097df26e drivers: can: stm32: remove useless mcr setting
Disabling the time-triggered communication mode (TTCM) is done twice in
the setting of the master control register (MCR). So, let's remove the
second.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-08-05 16:11:11 +02:00
Guillaume Lager
ca5921845d driver: i2c: Add TCA9546a I2C switch driver
The driver only support use case where the channels are used in mutual
exclusion.
Origin: Original

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-08-05 11:48:30 +02:00
Scott Worley
c66250f5ba drivers: GPIO: Microchip: Fix GPIO interrupt enable spurious interrupt
Fix for issue 34879.
Microchip MEC GPIO hardware can trigger a spurious interrupt when
interrupt detection is set to edge mode especially falling edge mode.
Clearing the status immediately after enabling interrupt detection does
not work because the hardware takes a small number of AHB clocks to
set the status. After interrupt detection enable we use an ARM data
memory barrier to insure the write completes before clearing spurious
status and enabling the interrupt in the GIRQ.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-05 11:29:35 +02:00
Jordan Yates
fdeaa9103e random: deprecate XOROSHIRO_RANDOM_GENERATOR
Deprecate the xoroshiro128+ PRNG algorithm in favour of xoshiro128++.
xoshiro128++ is a drop-in replacement which is invisible from the user
perspective.

xoroshiro128+ is unsuitable because it is explicitly a floating-point
PRNG, not a general-purpose PRNG. This means that the lower 4 bits of
the output are actually linear, not random (from the designers,
https://prng.di.unimi.it/). This means 1/8th of the generated data is
not random.

Additionally, xoroshiro128+ is not a 32bit algorithm, it operates on
64bit numbers. For the vast majority of Zephyr devices, this makes the
PRNG slower than it needs to be. The replacement (xoshiro128++) is
32bit, with no loss in state space (still 128 bit).

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-05 11:24:44 +02:00
Krishna Mohan Dani
365ff6db9f drivers/flash: stm32l5: Adding flash driver for stm32l5x series
This commit adds flash driver in non-secure mode for stm32l5x
series with icache enabled. This commit also adds a flash
programming error status check applicable for all platforms
except stm32f1 series.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-08-04 10:26:06 -05:00
Yuriy Vynnychek
3e4e9496a1 drivers: entropy: introduce new Telink B91 Entropy driver
Entropy driver basic support for new Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-08-04 15:45:32 +02:00
Gerard Marull-Paretas
7ccc1a41bc pm: use actions for device PM control
Instead of passing target states, use actions for device PM control.
Actions represent better the meaning of the callback argument.
Furthermore, they are more future proof as they can be suitable for
other PM actions that have no direct mapping to a state. If we compare
with Linux, we could have a multi-stage suspend/resume. Such scenario
would not have a good mapping when using target states.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
6d273f49bd pm: fix incorrect usages of PM_DEVICE_STATE_OFF
According to the documentation the OFF state has to be used when the
devices is fully turned off, ie, power removed. Most drivers were using
a sort of fall-through for all non-active states, leading to behaviors
not following the specifications.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
495672ab62 pm: cleanup pm control callback implementations
- Return -ENOTSUP if the requested state is not supported
- Remove redundant "noop style" functions.
- Use switch everywhere to handle requested state (not necessary in all
  drivers, but better take off with consistency in place after current
  changes).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
d41dadc569 pm: rename PM_DEVICE_STATE_SUSPEND to PM_DEVICE_STATE_SUSPENDED
The verb tense for the suspended state was not consistent with other
states. The likely reason: state was being used as a command/action.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
56a35e5682 pm: converge to suspend state for low power modes
The difference between low power and suspend states is a thin blur line
that is is not clear and most drivers have used indistinctly. This patch
converges to the usage of the suspend state for low power, since
contrary to the low power state, it is used by both system and runtime
device PM. The low power state is still kept, but its future is unclear
and needs some discussion.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
c6cce80ac4 pm: remove incorrect usages of force suspend
Some devices are using PM_DEVICE_STATE_FORCE_SUSPEND as a sort of low
power state, something that is not correct. In fact, this state is not
an actual state and will be eventually moved, if found necessary, to an
action or command.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
920f30cc0e pm: simplify state change check logic
The device PM control function will only be called if the requested
state is different from the current one. A significant amount of drivers
were checking for state changes, now unnecessary. This patch removes all
this redundant logic.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
11eef4d8c8 pm: device: remove pointer usage for state
Since the state is no longer modified by the device PM callback, just
use the state value.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
9e7d545bb4 pm: device: remove ctrl_command callback argument
The ctrl_command is not used anymore, so remove it from the callback
signature.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
da0ff4ae46 pm: device: remove usage of ctrl_command
The callback is now invoked to set the device PM state in all cases, so
the usage of ctrl_command is redundant.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
c2cf1ad203 pm: device: remove usage of local states
The device PM subsystem already holds the device state, so there is no
need to keep duplicates inside the device. The pm_device_state_get has
been refactored to just return the device state. Note that this is still
not safe, but the same applied to the previous implementation. This
problem will be addressed later.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Yuriy Vynnychek
1c0ed94601 drivers: ieee802154: introduce new Telink B91 IEEE802154 driver
IEEE802154 driver basic support for Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-08-04 11:58:02 +02:00
Jordan Yates
6cf6d515b1 sensor: sht3xd: convert to i2c_dt_spec
Convert sht3xd driver to `struct i2c_dt_spec` as a demonstration.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 19:05:14 -04:00
Jordan Yates
7bdb22941c sensor: bme680: convert to i2c_dt_spec
Convert bme680 driver to `struct i2c_dt_spec` as a demonstration.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 19:05:14 -04:00
Scott Worley
2070c0997f Microchip: MEC172x: Update pinmux driver
Update the Microchip XEC pinmux driver to use system I/O
routine for read/write of registers instead of direct use
of volatile and CMSIS defines. Add GPIO port number to
bindings instead of using hard coded value from chip headers.
Modify SoC DTSI pinmux syntax, requires "pinmux: pinumx {..."
or the DT macros will not work. Since pinmux is used by MEC152x
we update its chip pinmux DT.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-03 19:04:56 -04:00
John Kjellberg
f452a086fb drivers: led: Add LED driver support for TLC59108
Add support for TI TLC59108 an I2C 8-bit LED driver.
Supported blinkink period: 41ms to 10730ms
Supported brightness value: 0 to 100%

This driver supports the following APIs:

1. led_blink
2. led_set_brightness
3. led_on
4. led_off

This is a modified version of the NXP PCA9633 driver.

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>
2021-08-03 19:03:29 -04:00
Johann Fischer
ae074e81d4 usb: remove Kconfig option CONFIG_USB
The USB configuration option is actually a global switch
to enable USB drivers in general, but currently only
the device controller drivers are meant.

USB device controller drivers also have USB_DEVICE_DRIVER option.
Thus the option USB is actually redundant and can be replaced
by the self-explanatory option USB_DEVICE_DRIVER.
The name USB itself is not unique and should not be used as an
configuration option.

With these changes the option USB_DEVICE_DRIVER generally
enables USB device controller drivers. The option USB_DEVICE_STACK
enables USB device support. It is sufficient to enable only option
USB_DEVICE_STACK because it selects USB_DEVICE_DRIVER.

CONFIG_USB Kconfig option is temporary added to subsys/usb/Kconfig.
This is necessary to pass CI and will be removed again
when the USB configuration has been adapted in modules.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-03 19:00:12 -04:00
Felipe Neves
d368087fc0 drivers: serial: added minimal uart driver for esp32c3
based on uart rom functions, also enable console driver
on top if this driver enabling logging

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-08-03 11:20:06 -05:00
Francois Ramu
bfeb9b4684 drivers: adc: stm32h7 has a different oversampling config API
The LL_ADC_ConfigOverSamplingRatioShift function for
the stm32H7xx soc serie differs from other for the 'ratio':
"This parameter can be in the range from 1 to 1024"
Note that in the stm32h7xx_ll_adc.c the LL_ADC_OVS_RATIO_xxx value is
defined for ADC of type ADC_VER_V5_V90.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-08-03 10:34:49 -05:00
Jun Lin
2b1841ef3e driver: eSPI: npcx: select the host interface to eSPI explicitly
Set the host interface type to eSPI if it is not configured by the
booter.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-08-03 13:59:42 +02:00
Jordan Yates
4d6d50e2bc display: ssd16xx: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Jordan Yates
f1f8ccc388 display: ls0xx: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Jordan Yates
bd980f3506 display: gd7965: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Jordan Yates
80dabf52eb display: st7735r: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Jordan Yates
e49c7f1780 dac: dacx0508: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Jordan Yates
a8aa97b5d0 can: mcp2515: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Jordan Yates
c5868310ca adc: lmp90xxx: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Johann Fischer
6954554284 drivers: usb: use new USB framework header
Use macros and types from usb/usb_ch9.h header where it
is possible. This patch also adds local macros, USB_REQTYPE_GET_DIR
and USB_REQTYPE_GET_TYPE, which is an intermediate solution and
these will be removed later.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-03 13:20:07 +02:00
David Leach
bdd536a09e watchdog: add watchdog driver support to mimxrt685 platform
Add watchdog support to the mimxrt685 platform.

The mimxrt685 platform is excluded from the watchdog
test case because the test case uses variables in the
noinit section that need to be retained through a reset
but the rt685 does not retain this memory through a
reset.

Signed-off-by: David Leach <david.leach@nxp.com>
2021-08-02 13:21:20 -05:00
Kumar Gala
a1a895e331 drivers: modem: Fix compiler warning
When building tests/drivers/build_all/modem on native_posix_64 we get:

	modem_cmd_handler.c:545:9: error: ret may be used
	uninitialized in this function
	[-Werror=maybe-uninitialized]

Fix by adding simple initialization of ret = 0 at start of function.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-08-02 11:32:02 -05:00
Kieran Mackey
19f7af11fa drivers: gpio: Add PCA953X driver (gpio port expander)
The Texas Instruments TCA9538 is an 8 pin GPIO port expander.
It operates on an I2C bus with 2 configurable address pins. The
device has an interrupt output pin that is asserted when any pin
configured as an input changes state.

Added under the PCA953X name to allow other similar parts to
use the same driver.

Signed-off-by: Kieran Mackey <kieran.mackey@lairdconnect.com>
2021-07-31 14:56:34 -04:00
Efrain Calderon
5274aa5dc2 drivers: bme280: fetch data after measurement is done
After powering-on the sensor, and before every measurement, it loads
the NMV. We must wait until this process is completed otherwise
we will read weird values.
Since it was observed that the time may be a bit long after a cold
start, it is more convinient to just wait until the sensor iready,
without a timout.

Signed-off-by: Efrain Calderon <efrain.calderon@aquarobur.com>
2021-07-30 20:15:56 -04:00
Efrain Calderon
c009450d44 drivers: bme280: do soft reset after boot
To ensure that we have the same behaviour with a power cycle
and by pressing the reset button, we can perform soft reset
in `bme280_chip_init()`.

Signed-off-by: Efrain Calderon <efrain.calderon@aquarobur.com>
2021-07-30 20:15:56 -04:00
Efrain Calderon
86e656b640 drivers: bme280: fix: build broken after PM changes
The driver did not build with PM_DEVICE enabled.
commit to blame: cc2f0e9c08

Signed-off-by: Efrain Calderon <efrain.calderon@aquarobur.com>
2021-07-30 20:15:56 -04:00
Tim Lin
733cd7ccd8 ITE: drivers/adc: it8xxx2: access pinctrl_0 property from soc_dt.h
This PR will cleanup related pinctrl_0 property which has been
moved to soc_dt.h

TEST=alternate function is as intended.
console command: md .b 0xf01650 8
00F01650: 00 00 00 00 80 00 00 80
TEST=read adc
console command: adc
ADC_VBUS_C0 = 11330 mV
ADC_BOARD_ID_0 = 2997 mV
ADC_BOARD_ID_1 = 1318 mV
ADC_AMON_BMON = 68166 mV
ADC_VBUS_C1 = 12270 mV
ADC_PMON = 32 mV
ADC_PSYS = 32 mV

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-07-30 19:54:56 -04:00
Yuriy Vynnychek
fe0b9e85a3 drivers: flash: introduce new Telink B91 Flash driver
Flash driver basic support for Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-07-30 19:53:04 -04:00
Kieran Mackey
94e006f0fc drivers: counter: add driver for Microchip MCP7940N RTCC
Microchip MCP7940N is a Real-Time Clock/Calendar. It operates on a I2C
bus. It can be used to set a calendar time and has two alarm channels.
When an alarm is asserted the state of the MPF pin of the MCP7940N will
change (depending on gpio active high/active low setting) to trigger an
interrupt.

Signed-off-by: Kieran Mackey <kieran.mackey@lairdconnect.com>
2021-07-30 19:51:29 -04:00
Gerson Fernando Budke
62ba4723d4 drivers: serial: uart_sam0: Add pinctrl support
Add Atmel sam0 sercom[uart] pinctrl bindings and implements pinctrl at
driver level.  It changes all sam0 boards to use new feature and remove
pinmux driver dependency for sercom[uart].  The samples that require a
binding were update to keep consistency and avoid errors.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-07-30 14:37:20 -05:00
Gerson Fernando Budke
6de5f4d729 soc: atmel_sam0: common: Add soc_port
Introduce soc_port common functions.  The sam0 pinmux driver was
refactored to use soc_port_pinmux_set common function.

This create the common base to implement sam0 pinctrl functions.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-07-30 14:37:20 -05:00
Mahesh Mahadevan
5f636286d3 drivers: pwm: Add PWM support for NXP LPC devices
Add PWM support using the LPC SCTimer module

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-07-30 13:08:03 -05:00
Gerard Marull-Paretas
6c3beb928e pm: adjust busy check API call return types and naming
Busy check APIs now return boolean type. Due to that change, the
function names have also been adjusted. The common name pattern for
boolean check type APIs is "PREFIX_is_CONDITION". For example,
"pm_device_is_busy".  pm_device_busy_check has been renamed to
pm_device_is_busy and pm_device_any_busy_check to pm_device_is_any_busy.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-30 09:28:42 -04:00
Gerard Marull-Paretas
70322853a8 pm: device: move device busy APIs to pm subsystem
The following device busy APIs:

- device_busy_set()
- device_busy_clear()
- device_busy_check()
- device_any_busy_check()

were used for device PM, so they have been moved to the pm subsystem.
This means they are now prefixed with `pm_` and are defined in
`pm/device.h`.

If device PM is not enabled dummy functions are now provided that do
nothing or return `-ENOSYS`, meaning that the functionality is not
available.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-30 09:28:42 -04:00
Aurelien Jarno
9ecdd78961 drivers: sensors: ti_hdc20xx: update temperature conversion formula
TI recently released a new version of the HDC2080 datasheet, which
slightly update the temperature conversion formula, with a temperature
offset of -40.5°C instead of -40°C. Adjust the code accordingly.

In addition the datasheet also describes a voltage dependent
compensation of -0.08°C/V above 1.8V, however it's not something easily
doable with the current sensor framework, so just ignore that part.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-07-30 07:06:18 -04:00
Scott Worley
4cb0020614 modules: hal_microchip: Update Microchip HAL to version 1.2.1
Microchip HAL update used by MEC152x projects with eSPI
definition changes. Remove hack from XEC ESPI driver since
the missing symbol is in the HAL.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-07-29 18:27:30 -04:00
Dominik Ermel
8489b49599 drivers/flash: Add missing flash_get_parameters user space handler
The flash_get_parameters has been missing user space handler,
the commit fixes that.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-07-29 18:26:28 -04:00
Aurelien Jarno
58b8c4006e drivers: adc: STM32: add support for oversampling
The STM32 G0, G4, H7, L0, L4, WB and WL series have hardware support for
oversampling. This patch adds support for it, using the oversampling
value provided in the adc sequence. The result is shifted right
accordingly to not change the resolution of the measured value, like it
is done on other ADC drivers.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-07-29 11:48:41 -04:00
Daniel N. Hansten
88604971cd drivers: led: pca9633: exit sleep mode on init.
Driver does not correctly take ic out from sleep mode on init.
Added logic to update mode register on init to take the leddriver
out from sleep mode.
See datasheet for register details.
Fixes #37180

Signed-off-by: Daniel N. Hansten <dnh2000@gmail.com>
2021-07-29 11:01:02 -04:00
Erwan Gouriou
06b94f20aa drivers: gpio & interrupt_controller: Add stm32 u5 support
Add changes to STM32 GPIO and Interrupt controller driver
to support stm32u5 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-29 07:28:32 -05:00
Erwan Gouriou
9e351db03e drivers/clock_control: stm32: Add stm32u5 support
Add clock_control driver to stm32u5 support.
For this series, now deprecated STM32 clock Kconfig symbols
are not added.
Due to a divergence in MSI clock definition, PLL1 use
instead of PLL and lack of sufficient abstraction abstraction
for these a dedicated file has been added.
This should be reshuffled:
- once a better abstraction is provided by LL API for these
- when some stm32 clock control driver rework will be done
after complete removal of Kconfig STM32 clock symbols.

Tested in MSI, HSI, PLL based HSI and PLL based MSI.
Not tested on HSE due to lack of compatible hardware.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-29 07:28:32 -05:00
Dino Li
f2cd50d8ea gpio: it8xxx2: disable irq before configuring pin interrupt
Fixed the following assertion causing by high level functions
enable gpio interrupt at the same pin at least two times:

ASSERTION FAIL [!arch_irq_is_enabled(irq)]
@ ZEPHYR_BASE/arch/common/sw_isr_common.c:84 IRQ xxx is enabled

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-07-28 21:10:40 -04:00
Marcin Niestroj
301243ed06 drivers: wifi: esp_at: fix race condition when waiting for 'SEND OK'
This is more or less the flow of AT+CIPSEND:

  RX                         TX
  --                         --
                             AT+CIPSEND=<...>
  OK
  >
                             <data to be sent>
  SEND OK / SEND FAIL

'sem_response' semaphore is released by receiving 'OK'. Then after
receiving '>' (which releases 'sem_tx_ready' semaphore) actual data is
sent. Waiting for 'SEND OK' or 'SEND FAIL' is implemented by waiting on
'sem_response' (the same as for 'OK'), which mean that resetting this
semaphore just after sending all data is racy.

Fix that race condition by resetting 'sem_response' just after receiving
'OK', so that neither 'SEND OK' nor 'SEND FAIL' will appear yet (they
will not be sent as long as we won't send whole payload).

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-28 21:08:51 -04:00
Marcin Niestroj
01852138ae drivers: wifi: esp_at: fix race condition when waiting for '>'
Sending AT+CIPSEND=<...> command results in following reply:

  OK
  >

modem_cmd_send_nolock() invocation was setting command handlers for '>',
but as 'OK' was received first, it was handled as a generic reply. After
receiving 'OK' this function was unsetting command handlers. Then
modem_cmd_handler_update_cmds() was called once again in order to
register '>' handler once again. There was a small period of time where
'>' was not being handled at all.

Fix that race condition by using just introduced modem_cmd_send_ext(),
which allows to leave commands handlers in place and get rid of race
condition where expected command could be missed.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-28 21:08:51 -04:00
Marcin Niestroj
1a4cb7e0e3 drivers: modem: add modem_cmd_send_ext()
There are currently modem_cmd_send() and modem_cmd_send_nolock()
functions, each with slightly different behavior regarding acquiring (or
not) sem_tx_lock. Introduce a generic function that will allow caller to
select behavior using flags.

While at it, add possibility to disable setting and unsetting command
handlers. This will be useful in situations when there are multiple
replies expected one after the other coming as a response to single
command. This is the case for example with ESP-AT driver, which expects
following data as response to AT+CIPSEND command:

  OK
  >

where 'OK' is handled by static CMD_RESP (so releasing response
semaphore right away), while '>' is handled by dynamic
CMD_HANDLER (which is releasing another semaphore). Keeping command
handlers in place allows to receive '>' without race condition because
of small period of time where command handlers are not set.

Convert modem_cmd_send_nolock() and modem_cmd_send() to static inline
functions, as they are just a specific invocation of
modem_cmd_send_ext() function.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-28 21:08:51 -04:00
Andrzej Głąbek
32da1078da drivers: i2s: Add support for nRF I2S peripherals
Add a shim that allows using the nrfx I2S driver via the Zephyr API.
Add also missing devicetree nodes representing the I2S peripherals
in the nRF52 Series SoCs.
Extend the "nordic,nrf-i2s" binding with a new property that allows
specifying the clock source to be used by the I2S peripheral (so that
it is possible to use HFXO for better accurracy of the peripheral clock
or, in the nRF53 Series SoCs, to use the dedicated audio oscillator).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-07-28 18:41:26 -04:00
Scott Worley
6976800cf0 Microchip: MEC172x GPIO driver version 2
Create version 2 of the MEC GPIO driver to support MEC172x to not
interfere with MEC152x. When the MEC172x ECIA interrupt aggregator
driver is ready, this driver will use ECIA for registering GPIO
interrupt callbacks instead of maintaining its own interrupt table.
Add V2 DT binding.
Add the Kconfig configuration settings for the MEC172x GPIO
V2 driver at the SoC and board level.
Add port id to DT allowing use of DT FOR EACH macro in the driver.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-07-27 18:01:55 -04:00
Sam Hurst
1382d64ed5 drivers: sensor: Add driver for TI INA23x
This driver supports the TI INA230 and INA231 Bidirectional Current
and Power Monitors. The devices work on the I2C interface and are
created from DT nodes with a compatible property matching "ti,ina23x".

The following datasheets were referenced while developing the driver:
https://www.ti.com/product/INA230
https://www.ti.com/product/INA231

Twister passed:
twister -T tests/drivers/build_all/sensor/

Testing was performed on the stm32g071b_disco board with the following:
Load:    ~170 ohms
Voltage: 5V

Measured Values:
Voltage: 5.1 V
Current: 0.032 A
Power:   0.157 W

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2021-07-27 17:59:23 -04:00
Felipe Neves
3917203d52 driver: timer: esp32c3: added tickless support
For esp32c3 system timer clock driver enabling tickless mode
kernel

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-07-27 17:42:01 -04:00
Piotr Mienkowski
4566d0ec58 drivers: i2s_sam_ssc: use dma_reload() to continue transfer
Use `dma_reload()` instead of `dma_config()` within DMA callbacks. This
significantly shortens time required to reconfigure DMA engine to
transmit / receive the next data block and allows to configure higher
I2S bus data rates.

The maximum I2S data rate supported by the driver is still lower than
that of underlying hardware. To fully support hardware capabilities the
I2S driver would have to use scatter-gather / linked-list DMA transfer.
This is currently not supported by the DMA driver.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-07-27 09:52:07 -04:00
Piotr Mienkowski
4b36416720 drivers: dma_sam_xdmac: add dma_reload function
Add implementation of `dma_reload()` function.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-07-27 09:52:07 -04:00
Scott Worley
dd1a9559be Microchip: XEC RTOS timer: Add MEC172x support to driver
Update Microchip XEC RTOS timer driver adding MEC172x support and
using more device tree properities in the driver. We must also update
the XEC counter driver to use the new GIRQ DT properties.
Add new properties to RTOS timer and RTC timer YAML. These two timers
are linked due to option using a high speed timer for kernel busy wait.
Add Kconfig logic for XEC RTOS timer to MEC172x SoC.
Enable the Microchip XEC RTOS timer in the MEC172x evaluation board.
Add device tree nodes for most peripeherals.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-07-27 09:29:34 -04:00
Jun Lin
c51a4ecd42 driver: eSPI: unify the bit fields of ACPI/KBC event data
The KBC/ACPI event data is 4-byte in width and composed of
event/data/type fields. However, the field position is defined by each
chip vendor via macro and not unified in the current implementation.
The commit uses the structure bit field to define and unify the field
position. It helps the application access it with a common approach.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-07-26 22:50:44 -04:00
Arvin Farahmand
c95e0825d2 dsa: updated api to use net_if
Change DSA API to use `net_if` directly to make API calls instead of
indirectly via `dsa_context` and `switch_id`.
Remove unused `switch_id`, `switch_enable_port`, and `dsa_get_context`.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
9cb353a97e dts: ksz8974: rename driver to ksz8xxxx
Renamed driver to reflect that it supports different KSZ8 series chips.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
b0e4886dfa dts: ksz8974: add support for ksz8863
Add DSA support for KSZ8863 chip.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
47f4a86835 dts: ksz8974: improve slave interface initialization
Changed slave interface initialization code to be more generic and less
dependent on a specific number of ports.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
cb3aa1b1b5 dts: ksz8974: add private data structure for each device
Added a private structure pointer to each DSA device to store device
specific data.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
fe4f6969ac dts: ksz8974: fix compilation error if no tail tagging is enabled.
Compiling the driver without `CONFIG_DSA_KSZ8794_TAIL_TAGGING` would
generate an error.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
aa6217697e dts: ksz8974: change port number to start at zero.
Changed port numbers to start at zero since they're used as indexes
into various arrays in the code.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
b164baa3e9 dts: ksz8974: code clean-up
Removed superfluous port status read.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Andrzej Puzdrowski
f6641d70d5 drivers/eeprom/eeprom_emulator: fix mutex usage with rambuf
In the eeprom read operation, when rambuf was available
mutex was not unlocked after the read. Consequence of that is
that device was blocked after that read for incoming operations.

This commit fixes the issue

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-07-26 12:27:22 -04:00
Scott Worley
6b3749d2ff Microchip: MEC172x Add aggregated interrupt driver
Add driver implementation and header files for a MEC172x
aggregated interrupt driver. Enable the parent(ECIA) node
to have the driver initialize interrupt hardware for use.
Enable child nodes for those GIRQs used for aggregation.
Refer to chip documention for the list of GIRQs restricted
to aggregation and those which support direct mode.
Add chip level device tree node for MEC172x EC interrupt
aggregator parent and GIRQ children. Each child node contains
a list of sources representing the source bit position in the
GIRQ registers.
Add DT bindings for ECIA and GIRQ nodes.
Add build file(s) and configuration items for the MEC172x ECIA
aggregated interrupt driver. Add and enable the MEC172x interrupt
driver on the MEC172x evaluation board(EVB). Enable parent node to
initialize ECIA hardware. Child nodes are left disabled until a
future driver needs them.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-07-26 12:24:52 -04:00
Oliver Yang
d5af33eaf0 drivers: clock_control: stm32h7: fix comment mistake 'bansk'
Change comment word 'bansk' to 'banks'.

Signed-off-by: Oliver Yang <cameledyang@pm.me>
2021-07-26 12:23:41 -04:00
Piotr Mienkowski
1145986096 drivers: Add Atmel SAM counter (TC) Driver
Add basic counter driver based on Timer Counter (TC) module for Atmel
SAM family.

Remarks:
- The driver is not thread safe.
- The driver does not implement guard periods.
- The driver does not guarantee that short relative alarm will trigger
  the interrupt immediately and not after the full cycle / counter
  overflow.

Tested on Atmel SMART SAM E70 Xplained board

Origin: Original

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-07-26 05:13:40 -04:00
Piotr Mienkowski
1d199ca5ac drivers: qdec_sam: align naming of TcChannel in TC
Change naming of TC_CHANNEL to TcChannel in Tc struct to align with
a new convention used by samv71, samv71b series.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-07-26 05:13:40 -04:00
Thomas Stranger
95b7385bf1 drivers: entropy: stm32: don't use zero value
According to the Reference Manual of several series(G0,L5,WL,WB,...)
RNG_DR register value should only be used if it is different from 0:
"Because when it is the case a seed error occurred between RNG_SR
polling and RND_DR output reading (rare event)."

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-26 04:36:56 -04:00
Thomas Stranger
95c3916c60 drivers/entropy: stm32 add seed error recovery
This commit introduces an automatic recovery procedure in cases an
entropy source error was detected.
- On Series with soft reset support a soft rest is executed.
- On Series w/o soft reset support the pipeline is cleared by reading
  the RNG_DR 12 times.

With this changes the check for seed errors uses SEIS flag instead
of the SECS flag.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-26 04:36:56 -04:00
Ruibin Chang
21f0f958fe ITE drivers/ite_it8xxx2_timer: re-write ite timer driver
Re-write ite timer driver.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-07-24 21:26:49 -04:00
Ruibin Chang
78ef5ace6a ITE drivers/intc_ite_it8xxx2: correct logic operation
Interrupt polarity register don't support rising and
falling edge triggered at the same time, so I correct
logic operation to match this.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-07-24 21:26:49 -04:00
Thomas Stranger
bb9fd7377b drivers/crypto: stm32: add support for socs with AES IP
This commit adds crypto support for several series which have
the same/very similar or same AES IP.
This includes G0, G4, L5, WL.
WB is also very similar but, expects the app to load the key via CKS.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-23 16:25:27 -04:00
Guennadi Liakhovetski
45b70e1500 smp: limit the scope of some SMP-only functions
z_smp_init() is only available if CONFIG_SMP is defined,
smp_timer_init() also depends on two Kconfig parameters. Also make it
conditional in cavs_timer.c. Also clarify some SMP-related comments
there.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-23 16:06:54 -04:00
Tim Lin
f72b32f7fd ITE: drivers/i2c: disable the interrupt
The irq will be enabled at the condition of start or repeat
start of I2C. If timeout occurs without being wake up during
suspend(ex: interrupt is not fired), the irq should be
disabled immediately.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-07-22 17:36:41 -04:00
Tim Lin
ebc49ba1f1 ITE: drivers/i2c: remove redundant printk
This printk has been printed in i2c_recovery_bus routine,
so here is redundant.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-07-22 17:36:41 -04:00
Leonard Pollak
2d0fd2554a drivers: sensor: SHT4X Added support
This adds support for Sensirion's SHT4X temperature and
humidity sensor.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2021-07-22 10:17:13 -04:00
Leonard Pollak
0d7cb32c58 drivers: sensor: SGP40 Added support
This adds support for Sensirion's SGP40 multipixel gas sensor.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2021-07-22 10:17:13 -04:00
Luka Lopotar
7b67e239fe sensor: bq274xx: Add power management and shutdown mode
Add support for power management and the shutdown mode for bq274xx fuel
gauge sensor. This now allows boards that have any kind of low power
mode to turn on or off the sensor.

Tested on a Company's custom board with bq27421 sensor on it.

Signed-off-by: Luka Lopotar <luka.lopotar@greyp.com>
2021-07-22 06:21:25 -04:00
Francois Ramu
325edf23d7 drivers: dma: stm32 source_periph incorrectly set in dma_stm32
The flag source_periph seems to be incorrectly set in dma_stm32.
In case the transfer direction is from periph to mem, then the
stream->source_periph is 1 (true) else it is false.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-07-22 06:06:11 -04:00
Francois Ramu
8fe0831c6b include: dt-bindings: remove dma header for stm32 soc
All the macro for dma-cells are now in the
include/drivers/dma/dma_stm32.h header file.
So the include/dt-bindings/dma/stm32_dma.h is no more
useful and removed from #include.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-07-22 04:52:53 -04:00
Francois Ramu
30fd0228ae drivers: dma of the stm32 refactored macro for the dma-cells
The macro to set the element of the dma-cells for each peripheral
are defined in the dma_stm32 header file
and used in the periph driver (as dma client)

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-07-22 04:52:53 -04:00
Francois Ramu
dcefbd67ed drivers: dma: stm32 dma driver for a new dma version
This is the dma V2bis which is particular DMA V2 instance for
stm32F1 and STM32L1 soc series. This DMA does not use the dma slot
Otherwise it is similar to version V2.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-07-22 04:52:53 -04:00
Francois Ramu
6312b7383d drivers: dma: stm32 dma driver using DT compat macro
Controlling the DMA offset  for the request, relies on the
dma version different from V1

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-07-22 04:52:53 -04:00
Scott Worley
d3f6b54f8e Microchip: MEC172x clock control driver
Implement a clock control driver for Microchip MEC172x handling
configuring the 32 KHz input sources for the PLL and peripheral-32k
clock domains. MEC172x differs from MEC152x. MEC152x had one 32K source
for both PLL and peripherals. MEC172x allows the two domains to use
independent 32 KHz sources. Device tree updated to provide addresses
of hardware used by the driver.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-07-21 17:46:07 -04:00
Alexander Wachter
f87135bbee drivers: clock_control: clock_stm32g4: Fix ifdef STM32_LSE_CLOCK
the macro STM32_LSE_CLOCK is always defined and therefore systems
without lse crystals hang on startup.
Used #if instead of #ifdef.

Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
2021-07-21 06:29:31 -04:00
Yuriy Vynnychek
15818a8245 drivers: serial: introduce new Telink B91 Serial driver
Serial driver basic support for new Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-07-21 05:37:12 -04:00
Yuriy Vynnychek
6c76b416ee drivers: pinmux: introduce new Telink B91 Pinmux driver
Pinmux driver basic support for new Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-07-21 05:37:12 -04:00
Yuriy Vynnychek
215cdc7a3c drivers: gpio: introduce new Telink B91 GPIO driver
GPIO driver basic support for new Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-07-21 05:37:12 -04:00
Sylvio Alves
e01f18441e intr: esp32: conf log default level
Only enable interrupt allocator logs if config is set

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-07-20 20:01:47 -04:00
Sylvio Alves
e57e6dc7cf drivers: flash: esp32: Add cache flush and guard calls
Add cache flush and guard calls in write and
erase api.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-07-20 20:01:35 -04:00
Dino Li
ce7c7bb5f9 it8xxx2: intc: protect interrupt enable registers of soc
Because these two functions are called from threads and ISR.
And they run a bit-wise OR operation on the interrupt registers.
So protect them to prevent race condition between thread and ISR
context where causing an interrupt won't enable as expected.

eg.
- Pseudo code of thread enable IER1's bit1:
1. load word from IER1 (0x40) and write into CPU register S1
   => S1=0x40
2. Or S1's bit1
   => S1=0x42
(But if an interrupt is triggered here)
3. Store word to IER1 from S1
   => IER1=0x42
(IER1 will be 0x42 not 0x43, IER1's bit0 is disable again due to the
race condition above)

-Pseudo code of ISR enable IER1's bit0
1. load word from IER1 (0x40) write into CPU register S2
   => S2=0x40
2. Or S2's bit0
   => S2=0x41
3. Store word to IER1 from S2
   => IER1=0x41
4. Go back to thread.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-07-20 20:00:39 -04:00
Alexander Wachter
2daad1dab9 drivers: sensors: Add driver for LM75
This commit adds a driver implementation for the LM75 I2C temperature
sensor.

Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
2021-07-20 16:15:32 -05:00
Crist Xu
04ab2400e6 driver: adc: an adc driver for rt1170
reuse the lpc's lpadc driver for rt1170, modify the dts and add
some macro to shield some code of LPC series. Also add the
board support inside the tests/drivers/adc/adc_api/src/test_adc.c,
and a dts node:zephyr,user inside
samples/drivers/adc/boards/mimxrt1170_evk_cm7.overlay

Signed-off-by: Crist Xu <crist.xu@nxp.com>
2021-07-20 13:15:58 -05:00
Daniel Leung
f7d82da541 timer: hpet: convert register access to functions
This converts register access from macro to functions.
This allows SoCs to override these functions if needed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-07-20 13:35:14 +02:00
Daniel Leung
b9cc043434 timer: hpet: don't force TIMER_READS_ITS_FREQUENCY_AT_RUNTIME
This allows the HPET timer to use kconfig to specify clock
frequency instead of relying on calculation at runtime.
When the frequency is known at build, this allow the toolchain
to optimize some calculations.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-07-20 13:35:14 +02:00
Daniel Leung
fc5f698551 timer: hpet: allow overriding MIN_DELAY
This renames MIN_DELAY to HPET_CMP_MIN_DELAY, and also allows it
to be overridden. The default delay is for HPET with relative
high frequency, and may not suitable for all HPET
implementations.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-07-20 13:35:14 +02:00
Daniel Leung
aadcd10a6e timer: hpet: extract Counter Clock Period into a macro
This extracts the hard-coded value into a macro which can be
overridden. This is in preparation for SoCs where the period
is not in femptoseconds.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-07-20 13:35:14 +02:00
Simon Guinot
4de1b6be21 led_strip: ws2812: claim compatibility with Everlight B1414
This patch states that the Everlight B1414 LED controller is compatible
with the Worldsemi WS2812. Some information about it is added to the
WS2812 DT binding and driver Kconfig files.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-07-20 13:35:02 +02:00
Simon Guinot
dc92d1d559 led_strip: ws2812: use k_usleep() for reset delay
Since this driver is working reliably, let's use k_usleep() instead of
k_busy_wait() (as suggested in a TODO comment) to latch and reset the
LED strip controller.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-07-20 13:35:02 +02:00
Simon Guinot
17c0ddfe9c led_strip: ws2812: allow to configure reset delay
Some devices compatibles with the WS2812 IC have a different reset/latch
delay.

This patch introduces the "reset-delay" optional property for the WS2812
DT binding and adds support to the ws2812_spi driver. This new property
allows to configure the reset/latch delay of a WS2812 compatible LED
strip controller from its DT node.

If omitted the driver uses 8 microseconds by default (which is good for
the WS2812 IC).

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-07-20 13:35:02 +02:00
Simon Guinot
4ada0bbd6e led_strip: ws2812: allow to configure channel mapping
Some devices compatibles with the WS2812 IC have a different channel to
color mappings (e.g. RGB, BGR, RGBW, etc).

This patch introduces the "color-mapping" required property for the
WS2812 DT binding and adds support to the ws2812_gpio and ws2812_spi
drivers. This new property allows to configure the color to channel
mapping of a WS2812 compatible LED strip controller from its DT node.

Since this property also allows to know if a white channel is available,
then this patch removes the "has-white-channel" property.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-07-20 13:35:02 +02:00
Krzysztof Chruscinski
c44a46f1f5 drivers: serial: nrfx_uarte: Fix race condition in async isr
When DMA switches from one buffer to another ENDRX followed by
RXSTARTED is generated. Code flow assumes that ENDRX will be
handled before RXSTARTED but this may not be the case if there
is a short between ENDRX and RXSTARTED and event occurs after
ENDRX event check but before RXSTARTED event check. In that case,
RXSTARTED event is handled first. Such case may happen if there
is a higher priority interrupt that may preempt UARTE interrupt
handler.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-20 13:31:25 +02:00
Andrzej Głąbek
7cae49d22c drivers: clock_control_nrf: Add configuration of HFCLKAUDIO frequency
Add a new property to the "nordic,nrf-clock" binding to allow
configuration of the HFCLKAUDIO frequency.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-07-20 10:13:56 +03:00
Maureen Helm
ceacc177ef drivers: gpio: Refactor mcux lpc driver to use DT_INST_FOREACH
Refactors the mcux lpc driver to use DT_INST_FOREACH_STATUS_OKAY instead
of hardcoding each instance. Tested with samples/basic/button and
samples/basic/blinky on mimxrt685_evk_cm33.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-07-19 20:00:54 -04:00
Kumar Gala
f829697931 drivers: i2c: rcar: Fix possible compiler warning
In certain build cases we get the following compiler warning:

i2c_rcar.c: In function 'i2c_rcar_transfer_msg':
i2c_rcar.c:168:6: warning: 'ret' may be used uninitialized in
                  this function [-Wmaybe-uninitialized]

Fix this by initializing ret to 0 at start of function.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-07-19 17:54:38 +02:00
Jedrzej Ciupis
a55c0b0531 drivers: ieee802154: align with API changes
This commit aligns the nRF5 ieee802154 driver with the latest
API changes necessary to handle security-related flags properly.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2021-07-19 18:15:56 +03:00
Krzysztof Chruscinski
482fae74a8 drivers: timer: nrf_rtc_timer: Fix race condition
RTC interrupt was reading CC value and passing it to the handler.
However, higher priority interrupt could preempt RTC interrupt
and set new CC value. In that case CC value read in the RTC
interrupt context was not the one that triggered the interrupt.
Added fallback to COUNTER value if that case is detected.

Using COUNTER is not as precise as CC because it returns time
when event was handled and not when event occured but it is the
only option since CC value is overwritten.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-19 12:02:27 +02:00
Johann Fischer
8cbef2da24 drivers: console: update USB_UART_CONSOLE description
Remove outdate text and add note what the option in
the console driver does.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-07-19 04:02:07 -04:00
Gerson Fernando Budke
3771b968f0 drivers: eth: sam: Replace constants by devicetree values
The zephyr sam gmac driver don't get register address and, in some
cases, peripheral id from devicetree.  This replace headers constants
in favor of devicetree values.

This fix wrong Atmel SAME7x/SAMV7x gmac register address and add
missing peripheral id property for SAM family.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-07-16 21:34:43 -04:00
Gerson Fernando Budke
49eb184ea4 dts: eth: sam: Split generic GMAC compatible
The current GMAC compatible not allow especialize properties by SoC
family.  Split current generic Atmel GMAC compatible into two new
compatibles which are defined by SoC families.  This increase the
freedom and avoid odd situations.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-07-16 21:34:43 -04:00
Carlo Caione
bc30598456 drivers: syscon: Add generic syscon API
A syscon device is a device managing a memory region containing a set of
registers that are not cohesive enough to represent as any specific type
of device. We need a driver for that because several other drivers could
use the same region at the same time and we need to io-map the region at
boot for MMU enabled platforms.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-07-16 21:31:38 -04:00
Sylvio Alves
4d37aa828a driver: wifi: add esp event task name
When enabling shell and retrieving thread information,
esp wifi event task name was empty.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-07-16 18:59:57 -04:00
John Kjellberg
0647b2e0a8 disk: Add support for MCUs with SDIO drivers.
Use abstracted define to cover more MCUs.

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>
2021-07-16 18:57:17 -04:00
Mahesh Mahadevan
5c818f7f55 drivers: counter: Add counter for rt600
Add a RTC based counter for MXRT600

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-07-16 18:56:15 -04:00
Erwan Gouriou
04e70a482d drivers/gpio: stm32: Move gpio_stm32_configure to void
No check is done on this function,
so no error can be returned.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-16 07:21:07 -04:00
Erwan Gouriou
b26a898705 drivers/gpio: stm32: Move driver initialization to PRE_KERNEL_1
Assuming gpio devices are required by pinmux which is used
by any device make it a device that is initialized in preliminary
steps of platform init.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-16 07:21:07 -04:00
Erwan Gouriou
7e8c497d40 drivers/pinmux: stm32: Group gpio devices usability checks
Move GPIO devices clock handling in stm32_pin_configure function
which is also used in stm32_setup_pins.
Additionally, add device usability check to be sure gpio driver
was initialized before being used by pinmux pseudo driver.

Last, going from the assumption that GPIO devices should be
initialized before being used by pinmux, then there is no need
to enable clock in case CONFIG_PM_DEVICE_RUNTIME=n.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-16 07:21:07 -04:00
Glauber Maroto Ferreira
c5361d2416 esp32: interrupt_controller: clean redundant configs
Remove config entries now selected on SoC definition.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
35c8cb7b37 esp32: drivers: interrupt_controller: review SPI interrupt usage
Review SPI interrupt allocation usage.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
378278f61d esp32: drivers: interrupt_controller: review I2C interrupt usage
Review I2C interrupt allocation usage.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
4108ca1060 esp32: drivers: interrupt_controller: review GPIO interrupt usage
Review GPIO interrupt allocation usage.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
57bf89d65e esp32: drivers: interrupt_controller: review UART interrupt usage
Review UART interrupt allocation usage.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
0cf0830ead esp32: drivers: interrupt_controller: review WDT interrupt usage
Review WDT interrupt allocation usage.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
b6d61587c2 esp32: drivers: interrupt_controller: review Timer's interrupt usage
Review Timer interrupt allocation usage.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
9ae5fd1b34 esp32: drivers: interrupt_controller: add interrupt allocation support
Add interrupt allocation support for ESP32.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Fabio Baltieri
accb71ec9e drivers: sx126x: add support for the stm32wl chip
Add support for the STM32WL integrated radio, based on the sx1262. The
STM32WL implementation does not use any GPIO, and the signals are routed
to other units of the SoC and accessed with the ST HAL.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-07-15 21:30:28 -04:00
Fabio Baltieri
2916133b06 drivers: sx126x_standalone: convert to gpio_dt_spec APIs
Convert the standalone part of the sx126x driver to the new gpio_dt_spec
APIs. This allows moving the specific GPIOs in that part of the driver
and out of struct sx126x_data.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-07-15 21:30:28 -04:00
Fabio Baltieri
74efaa920a drivers: sx126x: refactor few functions for stm32wl support
Move few functions around in preparation of adding the STM32WL variant
of the driver.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-07-15 21:30:28 -04:00
Fabio Baltieri
624886156a drivers: spi_ll_stm32: add SUBGHZSPI support
This adds support for controlling the SUBGHZSPI NSS line in STM32WL
devices. This is a special dedicated SPI port only connected to the
radio device internally, chip select happens through a bit in the PWR
module. Adding a special dt-property to identify the port, it all gets
built out on non-WL devices.

Deduplicate the existing dts bindings in the process, and add the new
one for the special spi with the new property.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-07-15 21:30:28 -04:00
Sylvio Alves
c58a218720 drivers: i2c: fix timing and stop bit
Current impĺementation fails due to missing stop bit
when reading data. This fixes it and refactor the implementation
by adding k_busy_wait when waiting I2C bus completion.

Also, this implementation is based on esp-idf v3.0.
It will be refactored based on latest esp-idf v4.3 using proper
low level calls.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>

Fixes #34015
2021-07-15 19:28:16 -04:00
Titouan Christophe
8e3ab9248f drivers: gpio: add new driver for STMPE1600 gpio expander
The STMPE1600 is an I2C based GPIO expander. This initial patch
only supports reading from/writing to the pins on the STMPE1600,
and there is currently no support for interrupts.

Signed-off-by: Titouan Christophe <moiandme@gmail.com>
2021-07-15 19:23:16 -04:00
Carlo Caione
f4db14f349 dts: Introduce DT_STRING_TOKEN and DT_STRING_UPPER_TOKEN
To be able to get a tokenize DT string without the quotes. Deprecate
also DT_ENUM_TOKEN and DT_ENUM_UPPER_TOKEN.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-07-15 18:12:51 -05:00
Dino Li
b316d18cb0 drivers: gpio: it8xxx2: add support for GPIO_VOLTAGE_ flags
Support GPIO_VOLTAGE_1P8, GPIO_VOLTAGE_3P3 flags on IT8xxx2 chips.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-07-15 13:53:54 -05:00
Armando Visconti
59812961f2 drivers/sensor: lis2mdl: Fix errors when CONFIG_PM_DEVICE=y
Fix a couple of issues related to Power Management:

    1. A build error because 'dev' was used even if not declared
       in the caller routine scope
    2. The lis2mdl power management init specific routine was
       not declared in in the device instance definition

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-07-15 11:50:00 -04:00
Marcin Niestroj
26bd4fb45e drivers: modem: operate on device pointers instead of names
So far modem API used UART device names / labels. Change API to operate
on device pointers instead, so that we stop using device_get_binding()
in modem core and in some DT compatible modem drivers.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-07-15 11:48:00 -04:00
Stancu Florin
67360416f2 drivers: ieee802154: cc13xx_cc26xx: add subghz power saving
When stopping the interface, also abort the RX routine and enable RF
power saving. Will re-start RX on iface start.

Also fixed a bug with `cmd_fs` crashing at RF wakeup because `rf_mode`
was allocated on stack.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2021-07-15 07:04:46 -04:00
Marcin Niestroj
d08c6ee113 drivers: net: ppp: fix removing CRC16 from packet
CRC16 was removed by simply decreasing length of the last fragment by 2.
This worked as long as last fragment was longer than 1 byte. If not,
then last fragment was corrupted (its length ended up being 65535),
leading to undefined behavior.

Fix CRC16 removal by utilizing recently introduced
net_pkt_remove_tail(), that properly handles multiple fragments.

Reported-by: Jim Paris <jim@jim.sh>
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-07-15 06:54:33 -04:00
Pieter De Gendt
aedc51aca8 drivers: flash: mcux flexspi nor: Fix write on arbitrary offset
If a write offset isn't a multiple of the nor page size, and the
length is too large to fit within a single page, it could wrap around
in that page.

Tested on i.MX RT1064 internal flash using NVS settings

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-07-15 06:47:53 -04:00
Thomas Stranger
d25d385145 drivers: sensor: sht3xd: use sys functions for crc and byteorder
replace custom crc8 with sys/crc8
use sys_put/sys_get helpers for byteorder specific operations

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-15 06:44:34 -04:00
Thomas Stranger
22c8d9973b drivers: sensor: shtcx: add driver supporting shtc1 and shtc3
Add driver for sensirion consumer humidity sensor line.
Supports shtc1 and shtc3, but only shtc3 is tested.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-15 06:44:34 -04:00
Manivannan Sadhasivam
fa2d1ea422 drivers: spi: Use timeout for transfer completion
Instead of waiting forever for the SPI transfer to complete, let's use
a timeout value and bail out if elapsed. The timeout value logic is,

xfer_len/frequency + tolerance

Tolerance value can be modified using a Kconfig symbol,
CONFIG_SPI_COMPLETION_TIMEOUT_TOLERANCE. It defaults to 200ms.

Fixes: #33192

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2021-07-15 06:43:23 -04:00
Erwan Gouriou
7650d917a2 drivers/clock_control: stm32: Fixes around LSE clock
Fix macro used in g4 file to enable LSE clock.
Then, to avoid no-op configurations, generate an error
when MSI Hardware auto calibration is selected but LSE
clock is not enabled.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-15 10:13:01 +03:00
Tahir Akram
608ad430f3 drivers: modem: RSSI measurement for PPP link
This PR addresses radio signal stength measurement during
and before PPP session. The PR provides provides facility
of readout for both +CSQ and +CESQ versions depending
upon the modems. This PR follows the idea of rssi readout
of PR#35496. Additionally, reliable Cell info update
is also ensured.

Signed-off-by: Tahir Akram <mtahirbutt@hotmail.com>
2021-07-14 21:06:30 -04:00
Aymeric Aillet
573d77cff2 drivers: i2c: add Renesas R-Car driver
This patch add support for I2C on the Renesas R-Car.

This I2C hardware block can be found on various Renesas R-Car
SoC series.

It allows to perfom read and write on I2C buses in an
interrupt based way on R-Car Gen3 H3ULCB board.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-07-14 20:58:50 -04:00
Henrik Brix Andersen
21806b569f drivers: timer: add NXP LPTMR timer driver
Add NXP Kinetis Low Power Timer (LPTMR) OS timer driver shim. Since the
LPTMR does not support asynchronous changes to the timer period, only
non-tickless mode is supported.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-07-14 22:54:34 +03:00
Gerard Marull-Paretas
84b8f5e62c drivers: display: ili9xxx: remove unnecessary casts
The config/data casts are not strictly necessary. Furthermore, config
was being casted to non-const.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-07-14 13:19:32 -05:00
Gerard Marull-Paretas
4d32558038 drivers: display: ili9xxx: use spi_dt_spec
Use the recently introduced struct spi_dt_spec to store SPI information
and operate with it.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-07-14 13:19:32 -05:00
Gerard Marull-Paretas
51e53ee73f drivers: display: ili9xxx: use gpio_dt_spec
Use the recently introduced struct gpio_dt_spec to store GPIO
information and operate with them.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-07-14 13:19:32 -05:00
Johann Fischer
0500ec214c drivers: usb_dc_mcux_ehci: use K_NO_WAIT in k_heap_alloc()
This is called in ISR context and timeout must be set
to K_NO_WAIT.

Reported-by: Pieter De Gendt <pieter.degendt@basalte.be>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-07-14 13:05:18 -05:00
Johann Fischer
8eeec634ea drivers: usb_dc_mcux_ehci: fix style
Fix style, two lines are indented too far.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-07-14 13:05:18 -05:00
Thomas Stranger
94f7ed356f drivers: serial: add a dummy driver for vnd,serial
This commit adds a serial dummy driver compatible to vnd,serial.
This is needed that devices can access the uart device in tests
like tests/drivers/build_all/... .

Add myself as codeowner to avoid complicance check failure.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-14 11:10:08 -05:00
Tim Lin
abe27c5bca ITE: driver/i2c: add I2C recovery function
Use GPIO output high and low to simulate I2C start and stop
conditions to restore i2c to normal.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-07-14 07:32:16 -04:00
Tim Lin
8fdcc11d6b ITE: drivers/i2c: create pinmux phandle to the I2C driver node
Create the pinmux phandle to the I2C driver node in the
devicetree. When the pinmux_pin_set function in
i2c_it8xxx2_init can refer to the setting of this phandle.
It is more flexible to use.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-07-14 07:32:16 -04:00
Rup Gajurel
113413ad43 drivers: ethernet: stm32: add support for disabling auto-negotiation
drivers: support disabling auto-negotiation for stm32 eth drivers

Signed-off-by: Rup Gajurel <rup@fb.com>
2021-07-14 07:28:57 -04:00
Gerson Fernando Budke
0ff3616bdf drivers: usb: device: Rename usb_dc_sam to usb_dc_sam_usbhs
The SoC driver name is 'USB High-Speed Interface (USBHS)'. This rename
from usb_dc_sam to usb_dc_sam_usbhs allowing add others SoC drivers
like 'USB Device Port (UDP)' that is found at SAM4S/E variations.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-07-14 07:23:38 -04:00
Dino Li
7d5411d6e0 soc: it8xxx2: introduce SOC_IT8XXX2_PLL_FLASH_48M option
Enable SOC_IT8XXX2_PLL_FLASH_48M at default to reduce latency of
fetching code from flash.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-07-13 09:44:29 -04:00
Watson Zeng
1103402e90 driver: gpio: add initial support for synopsys creg gpio
Add single-register MMIO GPIO driver for complex cases where
only several fields in register belong to GPIO lines and each GPIO
line owns a field with different length and on/off value.

Such CREG GPIOs are used in Synopsys em_starterkit and HSDK boards.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-07-13 09:42:59 -04:00
Aymeric Aillet
54c481980e drivers: uart: Add "Interrupt driven" to R-Car
This commit add the support of "Interrupt driven UART"
to the R-Car UART driver and enable it in the related
Kconfig.

The driver is supporting nearly all the methods that are
described in the "Interrupt driven UART" part of the
uart_driver_api.

This new version of the driver has been tested on
H3ULCB board by running "uart_basic_api" test suite.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-07-13 09:42:22 -04:00
Thomas Stranger
a587c25156 drivers: entropy: add support for stm32wl and stm32g0
This commit adds entropy support for stm32wl and stm32g0.

Pll is used as clock source and has to be enabled,
other clock sources are not supported at the moment.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-13 09:37:48 -04:00
Thomas Stranger
7422ce6265 drivers/clock_control: stm32wl set cpu2 prescaler only for STM32WL5X
To support single core stm32wlex series, cpu2 prescaler is set
only on dual core soc variants.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-13 09:37:29 -04:00
Gerard Marull-Paretas
26ad8376bd pm: remove callback from control function
The callback is not used anymore, so just delete it from the pm_control
callback signature.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-13 09:36:45 -04:00
Gerard Marull-Paretas
217e610d8f pm: remove redundant callback usage
the device PM callback is not used anymore by the device PM subsystem,
so remove it from all drivers/tests using it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-13 09:36:45 -04:00
Huifeng Zhang
7bf6d88029 driver: pm_cpu_ops: change PM_CPU_OPS_PSCI's dependency
Armv8-A and Armv8-R both support PSCI. So PM_CPU_OPS_PSCI's
dependency should be "ARM64" rather than "ARMV8-A".

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2021-07-13 09:30:29 -04:00
Johan Hedberg
b10287cd69 drivers: edac: Fix PCIe Kconfig dependency
It's not possible to build the IBECC driver without PCIe support.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-07-12 20:02:00 -04:00
Gerard Marull-Paretas
165ae60e40 drivers: pinmux: stm32: fix name clashes with G4 series
There is a name clash when using G4 series LL TIM driver depending on
the inclusion order of the LL TIM and pinmux headers. If the LL headers
are included after pinmux is included, AF1 and AF2 definitions used by
pinmux clash with the AF1 and AF2 TIMx register names.

In order to solve this problem with minimum impact, the following has
been done:

1. Prefix the AFx and ANALOG definitions with STM32
2. In order to avoid changing all *-pinctrl.dtsi files, the STM32_PINMUX
   macro contatenates STM32_ with the provided mode.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-07-12 16:03:18 -05:00
Jun Lin
1974ea97a4 driver: clock: npcx: add a option to generate LFCLK via XTSOC
This commit adds a new Kconfig option CLOCK_CONTROL_NPCX_EXTERNAL_SRC.
With this option enabled, the internal 32.768 KHz clock (LFCLK) is
generated by the on-chip Crystal Oscillator (XTOSC). Otherwise, the
LFCLK is generated by the Low-Frequency Clock Generator (LFCG).

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-07-12 23:34:42 +03:00
Marcin Niestroj
c28d372d33 drivers: pwm: nrf_sw: drop deprecated 'timer-instance' DT prop
This property has been marked as deprecated in 2.5.0 and was replaced by
'generator' property.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-07-12 08:20:47 -05:00
Laczen JMS
294e2df2d9 flash_page_layout: refactor flash_page_get_info
refactor flash_page_get_info to simplify and to avoid using mixing the
usage of an off_t (offs) and an uint32_t (page_index).

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2021-07-10 14:48:22 -04:00
Krishna Mohan Dani
ca0b261b7f drivers/dma: STM32: Initialising DMA_InitStruct with 0 for stm32l5xx
In stm32l5xx soc, the LL_DMA_InitTypeDef has 2 more fields
(DoubleBufferMode and TargetMemInDoubleBufferMode) that must be
initialised with 0 else the configuration is wrong and gives
wrong values to the LL_DMA_Init function. Due to this the test
tests/drivers/dma/loop_transfer too would fail.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-07-10 12:43:19 -04:00
Flavio Ceolin
db9756045e drivers: intc_arcv2_irq_unit: Fix arc_v2_irq_unit_device_ctrl
Fix some leftovers from the pm_device_state changes.

Fixes build problem introduced in
cc2f0e9c08.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-07-09 12:51:36 -05:00
Dino Li
cb307e2c64 driver: intc: it8xxx2: wait until two equal interrupt values are read
This change ensures the CPU won't get an interrupt number which is
being generated.

it8xxx2 has a limitation for interrupt vector register.
CPU may read incorrect interrupt number in ISR.

The following is an example that got incorrect interrupt number:
1. Register IVECT = 0x10. (no interrupt pending/IVECT_OFFSET_WITH_IRQ)
2. Chip INT6 interrupt occurs (IVECT = 0x16) and jump to ISR.
3. Read interrupt vector register to determine interrupt number.
4. Higher priority interrupt occurs (for example: INT158, IVECT = 0xAE)
while the CPU is reading the interrupt vector register for EC INT6,
CPU may end up with an incorrect interrupt number between 0x16 and 0xAE.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-07-09 12:45:01 -05:00
Erwan Gouriou
491775549d drivers/clock_control: stm32: Fix macro to get HCLK freq
__LL_RCC_CALC_HCLK1_FREQ is only available for WL and WB series,
for other series __LL_RCC_CALC_HCLK_FREQ should be used.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-09 12:42:00 -05:00
Abram Early
bdae64279e drivers: flash: nrf_qspi_nor: Configurable RXDELAY
The nRF QSPI has a configurable delay from the rising
clock signal to the actual sample point measured in
clock cycles. This commit exposes that delay as a DTS
parameter without modifying existing behavior.

Signed-off-by: Abram Early <abram.early@gmail.com>
2021-07-09 12:23:45 -05:00
Dominik Ermel
f36569db0d drivers/flash/nrf_qspi_nor: Fix get_parameters layout dependency
The definition of qspi_flash_get_parameters, that implements
the mandatory get_parameters API call for the driver, was incorrectly
placed within block conditionally compiled when
CONFIG_FLASH_PAGE_LAYOUT is defined.
The commit fixes the issue that was causing compilation error
when the config has not been set.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-07-09 12:19:06 -05:00
Krishna Mohan Dani
b09e6fb3c5 drivers/entropy: stm32: selecting the right rng clock source
This commit selects LL_RCC_RNG_CLKSOURCE_CLK48 as a clock source
to rng peripheral. LL_RCC_RNG_CLKSOURCE_CLK48 is CLK48 divided by 3.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-07-09 09:19:39 -05:00
Aurelien Jarno
0d543f1742 drivers/sensor: Add basic TI HDC20XX support
Add basic support for TI HDC20XX series (e.g. HDC2010, HDC2021, HDC2022,
HDC2080). It is able to get temperature and humidity in the default
14-bit resolution. Triggers, resolution selection, interrupt line, auto
measurement mode are currently not supported.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-07-09 07:48:15 -04:00
Andrei Emeltchenko
f818d8770b pcie: msi: Map only actual table
Map only actual table of size n_vector * PCIE_MSIR_TABLE_ENTRY_SIZE.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-07-08 14:36:32 -04:00
Henrik Brix Andersen
b7b7709eec drivers: hwinfo: add NXP MCUX RCM hwinfo driver
Add driver shim for the NXP MCUX Reset Control Module (RCM) for
determining reset cause.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-07-08 09:33:32 -05:00
Crist Xu
c21bfdca9c driver: gpt: the gpt driver for the rt1170
reuse the gpt driver for the rt10xx, and add the related code

Signed-off-by: Crist Xu <crist.xu@nxp.com>
2021-07-07 20:59:42 -04:00
Felipe Neves
600f8c64e1 soc: riscv: esp32c3: use the new esp_rom prefix
For esp32c3 related ROM located functions instead
of esp32c3_rom.

Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-07-07 20:58:50 -04:00
Felipe Neves
132ab922a8 drivers: timer: esp32c3: add esp32c3 systimer driver to CODEOWNERS
Also added maintainer to the entry

Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-07-07 20:58:50 -04:00
Felipe Neves
5d736766ed soc: esp32c3: added initial soc support files for esp32c3
by adding the soc specific files such: soc initialization code,
linker scripts and support for esp32c3 devkitm

Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-07-07 20:58:50 -04:00
Sylvio Alves
4303cfdb3c hal: esp32: driver changes to allow HAL update
hal_espressif repository was updated from esp-idf v4.2
to esp-idf v4.3 to allow latest Espressif chips integration.
As a consequence, it added a few changes in drivers
and peripherals. To maintain bisectability, changes in this
PR cannot be split. Here are some details:

wifi: update linker script by adding libphy and new attributes.

spi: update some APIs and fixed missing wait_idle check

west.yml: esp32: update hal to new version

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-07-07 15:01:16 -04:00
Gerard Marull-Paretas
cc2f0e9c08 pm: use enum for device PM states
Move all PM_DEVICE_STATE_* definitions to an enum. The
PM_DEVICE_STATE_SET and PM_DEVICE_STATE_GET definitions have been kept
out of the enum since they do not represent any state. However, their
name has not been changed since they will be removed soon.

All drivers and tests have been adjusted accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-07 14:13:12 -04:00
Marcin Niestroj
66766581c9 drivers: wifi: esp_at: notify send() caller about pending close
If stream socket is marked as pending close, make sure that send()
caller gets notified about it, so that application layer can decide to
stop trying to send anything more.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-07 08:25:34 -04:00
Marcin Niestroj
1ab0848eab drivers: wifi: esp_at: close stream socket after failure to send
So far send errors were silently ignored. This is okay for
UDP (datagram) sockets, as there is no guarantee that packets will
actually be sent successfully. In case of TCP (stream) stream sockets
however, application layer expects network stack to send requested data
as stream, without losing any part of it.

In case of send errors on stream sockets mark that socket to be closed
and stop sending any subsequent network packets, so that data stream
won't have any holes.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-07 08:25:34 -04:00
Mahesh Mahadevan
c3567c6f33 tests: arch: arm_irq_vector_table: Update to run on MXRT685
Fix for Issue#35658.
Update the custom vector table to add the OS Event timer
interrupt which is used on RT685 as the kernel system timer

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-07-07 08:25:06 -04:00
Krishna Mohan Dani
4c38ca1625 drivers/flash: stm32: Gets maximum erase time from device tree
This commit removes the huge if condition section and is
replaced with DT APIs to get the maximum erase time of a
stm32 flash from dtsi.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-07-06 19:02:19 -04:00
Sidhdharth Yadav
bdf425cd5c drivers: adc: Adding CONFIG_SOC_SERIES_STM32L5X in stm32l5 series
Allowing ADC to build in stm32l5 series.

Signed-off-by: Sidhdharth Yadav <sidhdharth.yadav@hcl.com>
2021-07-06 18:03:22 -04:00
Aurelien Jarno
2a96cc0347 drivers: adc: STM32: fix support for internal voltage reference source
Commit c045cbd336 added support for internal voltage reference source,
but in practice only the temp sensor is supported. Fix that.

Also change the code to keep the existing paths so that VREFINT and
TEMPSENSOR can be used at the same time.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-07-06 18:01:57 -04:00
Tomasz Michalec
becfed481e drivers: i2c: emul: Link emulators to correct bus
Fix i2c emulated bus initialisation code to use children of specific i2c
bus DTS node instead of first i2c bus instance.

Signed-off-by: Tomasz Michalec <tm@semihalf.com>
2021-07-06 15:19:40 -05:00
Dario Binacchi
c3a067e841 drivers: adc: stm32: fix f3x series
The patch fixes driver compile errors and ADC management for the f3x
series. It was developed and tested for the stm32f373 variant.

Tested-by: Dario Binacchi <dariobin@libero.it>
Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-07-06 15:08:04 -05:00
Fabio Baltieri
9c82898127 drivers: stm32_lptim_timer: add support for STM32WL series
Add the lptim1 device node definition and enable the corresponding
exti interrupt in sys_clock_driver_init().

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-07-06 09:51:22 -04:00
Anas Nashif
0898388080 Revert "drivers: ieee802154: configure IE header injection for nRF5"
This reverts commit bde592e91a.

This is causing build failures. Original PR #36008.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-07-05 18:54:35 -04:00
Tim Lin
91a6b286c9 ITE: drivers/i2c: it8xxx2: add mutex lock
Add mutex lock to prevent race conditions.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-07-03 08:03:10 -04:00
Jordan Yates
fb76f47f86 flash: spi_nor: convert to spi_dt_spec usage
Converts the spi_nor flash driver to use `spi_dt_spec` as a
demonstration of the simplifications that the API enables.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-07-02 21:34:16 -04:00
Jun Lin
55f21ab846 drivers: PS/2: npcx: Replace device_get_binding with DEVICE_DT_GET
Replace device_get_binding() with DEVICE_DT_GET to obtain the PS/2
controller and clock control device objects. It helps to improve the
efficiency for driver initialization as DEVICE_DT_GET is processed
at the link time rather than run time.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-07-02 15:41:28 -04:00
Jun Lin
ba39c47187 driver: PS/2: npcx: add driver support for Nuvoton npcx family
The PS/2 module in npcx provides a hardware accelerator mechanism
including an 8-bit shift register, a state machine, and control logic
that handle both the incoming and outgoing data. The hardware
accelerator mechanism is shared by 4 PS/2 channels. To support it,
this CL separates the PS/2 driver into channel and controller drivers.
The controller driver is in charge of the PS/2 transaction. The channel
driver is in charge of the connection between the Zehpyr PS/2 API
interface and controller driver.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-07-02 15:41:28 -04:00
Lukasz Maciejonczyk
bde592e91a drivers: ieee802154: configure IE header injection for nRF5
Pass enh ack data injection arguments to the nRF5 radio driver.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-07-02 13:32:10 -04:00
Henrik Brix Andersen
fe2075d140 shell: modules: promote edac mem shell subcommand to root shell command
Promote the "edac mem" shell subcommand to a generic "devmem" root shell
command. This command is useful for poking around registers and memory
outside of the EDAC drivers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-07-02 13:21:25 -04:00
Henrik Brix Andersen
fadc5d15a3 drivers: adc: mcux_adc16: reduce log verbosity
Reduce the initialization done log message from informational to debug.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-07-01 17:04:04 -05:00
Ruibin Chang
d0ce9bb877 ITE drivers/pwm: add PWM for it8xxx2
Add pulse width modulator (PWM) for it8xxx2.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-07-01 13:21:06 -04:00
Dino Li
ee3ccc9696 driver: gpio: it8xxx2: enable gpio_driver_config
Fix assertion of unsupported pin.

This change also remove ngpios field.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-07-01 11:39:08 -04:00
Benedikt Schmidt
08a39c37dd boards: arm: add STM32H735G discovery kit
Add the STM32H735G discovery kit to the available boards.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2021-07-01 08:49:26 -05:00
Andrei Emeltchenko
882600834e edac: shell: Use helper functions for shell devmem command
Using helper functions decreases function complexity numbers reported
by static code analyzers.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
fee256bc72 edac: shell: Print exact error with shell error message
Include to shell_error() also exact error.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
228232e29d edac: shell: Check error for log clear functions
Check errors returned by edac_ecc_error_log_clear() and
edac_parity_error_log_clear().

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
9da4e3f3dc edac: ibecc: Reduce CCM number using fallthrough
Reduce CCM number reported by Coverity by using __fallthrough.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
50c47267b4 edac: ibecc: Strip debug information
Remove debug information increasing code coverage.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
07d524357e edac: ibecc: Simplify PCI probing
Use only one pcie_conf_read() instead of several reads and make code
more readable.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
b1d79776c7 edac: ibecc: Simplify NMI handling
Refactor NMI handling making it clearer and fix return code for other
NMI source.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
b6c75cfd34 edac: ibecc: Use boolean expressions in if conditions
Use only boolean in if conditions as new coding style implies.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
9bad08e3e7 edac: shell: Use boolean expressions in if conditions
Use only boolean in if conditions as new coding style implies.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
daf8095851 edac: shell: Replace ret with err
Replace ret with err for simple int type errors.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
661eb79f6f edac: Use TODO instead of workaround in comment
Using TODO is more appropriate since workaround implies working around
a bug.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
7293587725 edac: Use -ENOSYS for not implemented mandatory API functions
Use standard Zephyr way for not implemented mandatory API functions.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
0eb48e30c6 edac: shell: Use new EDAC API in shell
Use new EDAC API in shell.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
6622eccddb edac: Refactor EDAC API
Refactor EDAC API making it more clear, removing unneeded typedefs and
using check for optional and assert for mandatory APIs.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Flavio Ceolin
fbd2d2f557 drivers: ps2: Build syscall handlers
syscall handler were not being built at all !!

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-30 10:44:44 -04:00
Flavio Ceolin
297fb5a90f drivers: ps2: Fix wrong cast
ps2_read() syscall was casting the value to uint32_t *

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-30 10:44:44 -04:00
Flavio Ceolin
407ea645a0 drivers: ps2: Fix syscalls handlers
This driver was using a very old macro to declare a syscall. Fix
syscall handlers.

Fixes #23745

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-30 10:44:44 -04:00
Martí Bolívar
bd8afe9365 drivers: sensor: clean up zephyr_library calls
In drivers/sensor/CMakeLists.txt, we have various lines like this:

    add_subdirectory_ifdef(CONFIG_FOO foo)

Then drivers/sensor/foo/CMakeLists.txt says:

    zephyr_library()
    zephyr_library_sources_ifdef(CONFIG_FOO foo.c)

This is redundant; the foo/CMakeLists.txt won't be added to the build
system unless CONFIG_FOO=y in the first place, so there's no need for
extra boilerplate testing it again.

Remove all these unnecessary instances in each sensor driver's
CMakeLists.txt using this pattern:

    zephyr_library()
    zephyr_library_sources(foo.c)

In a couple of places, the '.c' extension is missing. Add them in for
consistency when that happens.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-06-30 09:36:33 -04:00
Krivorot Oleg
1d55d929db drivers: display: ili9xxx: add support for ILI9341 controller
Add support for the ILI9341 display controller.

Signed-off-by: Krivorot Oleg <krivorot.oleg@gmail.com>
2021-06-29 16:02:44 -04:00
Krzysztof Chruscinski
520ba93f5d drivers: serial: nrfx_uarte: Fix race condition in async isr
RXTO event is generated always after ENDRX and driver relies
on assumption that ENDRX event is handled before RXTO. However,
when interrupt is preempted after ENDRX check returned false
and RXTO event is already set handling order would be swapped.

Added addtional check to handle RXTO event only if ENDRX is not
set. If ENDRX is set, it means that it is not yet handled. RXTO
event is not cleared and interrupt will be triggered again and
ENDRX event will be handled first.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-06-29 11:31:31 -04:00
Armando Visconti
fa423d30a2 drivers/sensor: lis2dw12: Preserve APIs error code
Return the same error code returned by HAL i/f APIs.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
40f843ae54 drivers/sensor: lis2dw12: Set tap triggers only if detection is on
Set single/double tap triggers only if tap detection is enabled.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
de0ff0c354 drivers/sensor: lis2dw12: Fix the logic to set TAP interrupt
The lis2dw12 sensor can generate the TAP interrupt only on INT1,
while DRDY can be generated on both. The int-pin DT property
specifiy on which pin the DRDY (and not the TAP) can be generated.

This commit fix the way the trigger is set: first the driver checks
the trigger type (DRDY or TAP), then it uses the int-pin information
only in DRDY case but allows setting TAP regardless of int-pin (it
always routes it on INT1).

The previous code was first checking int-pin: if it was INT2 then
the driver refused setting TAP triggers.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
9217e37901 drivers/sensor: lis2dw12: Add multi-instance support
This commit aligns lis2dw12 sensor driver to latest multi
instance sensor driver model.

In particular it makes use of the stmemsc common routines
and move ctx handler inside struct config, so that the
bus_init routines can be totally avoided.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
77b74f1b85 drivers/sensor: lis2dw12: Remove odr values from Kconfig
Remove all odr values from Kconfig and always init it
at 12.5Hz. It is responsibility of application to set
the rate to a different value using SENSOR_ATTR_SAMPLING_FREQUENCY.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
344e06025d drivers/sensor: lis2dw12: Move range Kconfig property into dts
Converts lis2dw12 range options (2g, 4g, 8g, 16g) from Kconfigs
to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
a783a062f8 drivers/sensor: lis2dw12: Move power Kconfig property into dts
Move lis2dw12 power-mode option from Kconfigs to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
56ce558094 drivers/sensor: lis2dw12: Move trigger pulse Kconfig property into DT
Move lis2dw12 trigger pulse configurations from Kconfigs to Device Tree.
Moreover the dts properties have been renamed as 'tap', which sounds a
better name to immediately catch the feature behind it. Since tap
threshold cannot be zero, this value (which is the default in dts
binding) is used to enable/disable the device feature per each axis.
The event can be generated on INT1 only.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
8609733e76 drivers/sensor: lis2dw12: use gpio_dt_spec oriented macros
Use gpio_dt_spec structure (and related APIs) in config for configuring
the gpio used for drdy and pulse interrupts.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
351b28e122 drivers/sensor: lis2dw12: move int-pin in DTS binding
Take the int-pin information (i.e. what pin between INT1
and INT2 the drdy is attached to) directly from DT.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Fabio Baltieri
239bd4a8ce drivers: stm32-fmc: enable MEMC_STM32 default based on dt
Default the option MEMC_STM32 to "y" when the device node is defined and
enabled, so that the driver is selected automatically when the board
supports it and MEMC is enabled.

Remove the default conditional on serise as it's redundant with the one
in soc/arm/st_stm32/common/Kconfig.defconfig.series.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-29 11:30:35 -04:00
Mahesh Mahadevan
0057c5753b drivers: hwinfo: Update i.MX RT Hwinfo driver
Add support for RT1170. The fuse register that holds
the unique device ID is different as compared to the
RT10XX series

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-06-29 11:30:00 -04:00
Ryan QIAN
2883d727a7 drivers: clock_control: add ccm driver for rt117x
- add ccm driver for rt117x

Signed-off-by: Ryan QIAN <jianghao.qian@nxp.com>
2021-06-29 11:30:00 -04:00
Mahesh Mahadevan
94bbf23e7c drivers: igpio: Do not require GPIO interrupts to be present
Some SoC's do not have a GPIO interrupt connected

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-06-29 11:30:00 -04:00
Tim Lin
442f68378c ITE: drivers/i2c: it8xxx2: no need to reset bus if there is any error
The transaction is dropped on any error(timeout, NACK, fail,
bus error, device error).

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-06-28 20:11:45 -04:00
Wealian Liao
1cb8f7c369 driver: uart: npcx: Fix building of kernel.timer.tickless
UART CR_SIN interrupt enable/disable are invoked when CONFIG_PM enable.
This removes the guard for UART CR_SIN interrupt enable/disable to fix
the build issue.

Fixed #36520

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-06-28 20:11:25 -04:00
Watson Zeng
a6cc3f1838 dts: designware-gpio: remove reduplicative property bits
bits property indicates the number of in-use slots of available slots
for GPIOS. We have a similar property ngpios in gpio-controller.yaml,
we will use ngpios to calculate port_pin_mask. Let's remove bits and
only use ngpios.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-06-28 13:53:57 -05:00
Alexandre Bourdiol
64d2449185 drivers: flash: stm32f7: Flush ART cache before Flash erase
Similar to #32218 and #34032
Flush ART cache before erase operation
(preparing ART activation)

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-06-28 14:17:40 -04:00
Alexandre Bourdiol
5e11fbfbe1 drivers: flash: stm32g4: implement data cache errata
Disable data cache to avoid the silicon errata ES0430 Rev 7 2.2.2
"Data cache might be corrupted during Flash memory read-while-write
operation"

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-06-28 14:17:40 -04:00
Alexandre Bourdiol
feacc2e16e drivers: flash: stm32f4: implement data cache errata
Disable data cache to avoid the silicon errata ES0206 Rev 16 2.2.12
"Data cache might be corrupted during Flash memory read-while-write
operation"

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-06-28 14:17:40 -04:00
Alexandre Bourdiol
5650609c4c drivers: flash: stm32f4: Flush ART caches before Flash erase
Similar to #32218 and #34032
Flush ART caches before erase operation
(preparing ART activation)

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-06-28 14:17:40 -04:00
Fabio Baltieri
5efea4283c drivers: flash: stm32f4: Flush caches after erase
This implement the same flush cache functionality already present in the
other stm32 series flash drivers, used to avoid bus errors when writing
big chunks of data to the flash.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-28 12:35:41 -04:00
Fabio Baltieri
f0c4040159 drivers: flash_stm32: enable flash_stm32l4x for STM32WL series
The flash_stm32l4x driver seems to work out of the box on the WL series.

This just adds the necessary config changes to let the driver build and
run when SOC_SERIES_STM32WLX is selected.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-28 12:35:41 -04:00
Aurelien Jarno
b94edd2393 drivers/sensor: ms5607: fix compensation for temperature < 20C
When the temperature is lower than 20C, adc_temperature is smaller than
(data->t_ref << 8), which should yield a negative value for dT. While dT
and adc_temperature are correctly declared as signed, the subtrahend is
wrongly casted to unsigned, yielding insanely high temperature values.
Fix that by casting it to int32_t instead of uint32_t.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-06-28 11:53:56 -04:00
Yasushi SHOJI
ebf35f8f93 drivers: can: Kconfig.rcar: Make options depend on its driver
Need this so that the option won't pop out without R-Car selected.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2021-06-28 10:40:18 -05:00
Tim Lin
aec4c4977d ITE: drivers/i2c: it8xxx2: i2c reset to show the device address
This change has more detail about providing the I2C peripheral
device's address to help pinpoint any issues that are device
specific and not bus specific.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-06-27 23:03:00 -04:00
Fabio Baltieri
ba786843af drivers: i2c_npcx_port: convert the driver to use DEVICE_DT_GET
Use DEVICE_DT_GET instead of device_get_binding to obtain the controller
node, so that the device address gets resolved at link time.

This means we can move the pointer form the data to the config
structure, and get rid of the data structure and associated boilerplate
entirely.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2021-06-27 23:02:39 -04:00
Fabio Baltieri
3af832868c drivers: npcx: convert NPCX drivers clock client to DEVICE_DT_GET
Convert the various device_get_binding() calls used to get the device
clock node to use DEVICE_DT_GET. The latter is processed at link time,
so it should be a bit more efficient.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2021-06-27 23:02:39 -04:00
Abram Early
bd09d4ff3f drivers: can: Timestamps depend on driver select
Instead of explicity ORing together the compatible drivers,
CAN_RX_TIMESTAMP now depends on CAN_HAS_RX_TIMESTAMP
which is selected by the drivers primary Kconfig option. In addition,
stm32fd does not need to select this option since it selected by
the underlying M_CAN driver.

Signed-off-by: Abram Early <abram.early@gmail.com>
2021-06-25 10:42:49 -04:00
Fabio Baltieri
93554f050b drivers: timer: make lptim depend on the dt node
The stm32_lptim driver is hardcoded to use lptim1.

Make the Kconfig option depend on the presence of the node label in the
devicetree, so that there's one less list of supported SoC to keep track
of.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-24 21:06:25 -04:00
Kumar Gala
b12c6dbeec drivers: hwinfo: Fix building of NXP LPC syscon driver
The NXP LPC syscon driver failed to build on several platforms for
various reasons.  We need dts support on LPC55s1x and LPC55s2x, the
driver doesn't seem like it will work on LPC54114 so we exclude it
there for now.

Additionally, fix a dtc warning on LPC55s6x based on unit-address in
the node naming needing to be lowercase.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-24 12:39:18 -05:00
Eduardo Montoya
0f73fbdbfe drivers: ieee802154: add CSL receiver for nRF5
Implement CSL receiver functionality in nRF5 radio driver.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2021-06-24 11:31:24 -04:00
Jordan Yates
7eb48adb52 drivers: led_gpio: use gpio_pin_set_dt
Use the simpler version of `gpio_pin_set` to demonstrate usage.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-06-24 06:40:00 -05:00
Mahesh Mahadevan
6dbffcb2a8 hwinfo: Support NXP LPC family
add hwinfo driver support for NXP's LPC family.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-06-23 18:24:08 -05:00
Radoslaw Koppel
2d2bc55f51 drivers: pwm: pwm_nrfx: Fix driver suspending
This commit clears current settings of the PWM perihperal
that are stored inside device structure.
This makes sure that PWM period and prescaler is configured
as expected after driver was suspended.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2021-06-23 03:56:30 -05:00
Wealian Liao
b4faf7fe63 driver: uart: npcx: Fix CR_SIN interrupt storm
NPCX WIMU CR_SIN is used to wake up soc from NPCX sleep power state.
The wake-up IRQ enabled when UART init. It causes the wake-up IRQ to
generate many extra interrupt events, which causes the system too busy
to handle other events. This PR moves the UART wake-up IRQ enabling
from UART init to npcx_power_enter_system_sleep() to avoid the
interrupt storm.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-06-22 20:31:09 -04:00
Tim Lin
ef3c8507a6 ite: drivers/flash: add flash driver for it8xxx2
Add flash driver for it8xxx2. The driver can implement
flash read, write and erase that will be mapped to the
ram section for executing.

TEST="flash write 0x80000 0x10 0x20 0x30 0x40 ..."
     "flash read 0x80000 0x100"
     "flash erase 0x80000 0x1000"

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-06-22 15:15:20 -04:00
Lukasz Maciejonczyk
fa1407129d drivers: ieee802154: add support for secured transmission in nRF5
Configure radio driver with MAC key pairs and frame counter.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-06-22 08:22:02 -04:00
Immo Birnbaum
dabe728eef drivers: ethernet: add support for Xilinx GEM controller
Add support for the Xilinx GEM Ethernet controller, which is integrated
in both the Xilinx Zynq and ZynqMP (UltraScale) SoC families. The driver
supports the management of a PHY attached to the respective GEM's MDIO
interface.

This driver was developed with ultimately the Zynq-7000 series in mind,
but at the time being, it is limited to use in conjunction with the
ZynqMP RPU (Cortex-R5) cores. The differences are minor when it comes
to the adjustment of the TX clock frequency derived from the current
link speed reported by the PHY, but for use in conjunction with the
Zynq-7000, some larger adjustments will have to be made when it comes
to the placement of the DMA memory area, as this involves the confi-
guration of the MMU in Cortex-A CPUs.

The driver was developed under the qemu_cortex_r5 target. The Marvell
88E1111 PHY simulated by QEMU is supported by the driver.

Limitations currently exist when it comes to timestamping or VLAN
support and other minor things. Those haven't been implemented yet,
although they are supported by the hardware. In order to be fully
supported by the ZynqMP APU, 64-bit DMA address descriptor format
support will be added.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2021-06-21 20:11:00 -04:00
Mulin Chao
fbf5b8e8de dts: pcc: npcx: add properties of pcc node to configure clock settings
This CL introduces six properties, clock-frequency, core-prescaler,
apb1/2/3/4-prescaler in pcc (Power and Clock Controller) node to
configure clock settings. It also removed the original Kconfig options
used for the same purpose.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-06-21 18:47:31 -04:00
Mulin Chao
6885afe432 driver: timer: npcx: add check for system kernel timer frequency
In npcx series, we use ITIM64 as system kernel timer. Its source clock
frequency must equal to CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC. This CL
added check during initialization to prevent ambiguous condition.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-06-21 18:47:31 -04:00
Mulin Chao
009388a321 soc: npcx: rename OSC_CLK as OFMCLK
Rename OSC_CLK as OFMCLK to meet npcx datasheet. The Oscillator
Frequency Multiplier Clock (OFMCLK), which is derived from
High-Frequency Clock Generator (HFCG), is the source clock of cortex-m4
core and most of NPCX hardware modules.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-06-21 18:47:31 -04:00
Crist Xu
530db5154e lpadc: a bug fix for the drivers/adc_mcux_lpadc.c
it need to be a && between two condition, to satisfy
the comment: only 12 / 13 bit resolution is supported,
if FSL_FEATURE_LPADC_HAS_CMDL_MODE is not defined. not
using ||.

Signed-off-by: Crist Xu <crist.xu@nxp.com>
2021-06-21 14:19:29 -05:00
Kumar Gala
28e4af6176 drivers: sensor: iis2iclx: Fix compile warning
Fix compile warning with clang and extraneous parentheses

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-21 10:08:24 -05:00
Kumar Gala
deb689f0f9 drivers: sensor: max17055: Fix compile error with clang
Since we are writing a register it makes more sense for the type
to be unsigned.  This hopefully address a compile warning we get
with clang:

error: implicit conversion from 'int' to 'int16_t' (aka 'short')
changes value from 32768 to -32768 [-Werror,-Wconstant-conversion]

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-21 10:08:24 -05:00
Kumar Gala
83cfcd41fc drivers: sensor: icm42605: Fix build issues
If CONFIG_ICM42605_TRIGGER is not set the driver doesn't build.  There
are a few places that need ifdefs based on CONFIG_ICM42605_TRIGGER for
the driver to build correctly.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-21 10:08:24 -05:00
Krzysztof Chruscinski
3656ba5ae9 drivers: serial: nrfx: Add pullups to RXD and CTS
Configured UART/UARTE input pins to have pullups. Otherwise when
uart is disconnected pins are floating and generate receiver
errors.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-06-18 23:49:36 +02:00
Francois Ramu
2790d2ac4c drivers: bluetooth: hci driver for stm32wb includes clock control
The definition of the STM32_LSE_CLOCK is given by the
drivers/clock_control/stm32_clock_control.h
to the hci/ipm_stm32wb driver

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-06-18 07:59:48 -05:00
Aurelien Jarno
9d0169deaf drivers/sensor: ms5607: Add I2C support
Add I2C support to the MS5607 driver, which mostly consist in adding the
I2C transfer functions.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-06-18 11:23:07 +02:00
Aurelien Jarno
593ec46c0a drivers/sensor: ms5607: Add multi-instance support
Add multi-instance support to the MS5607 driver. This is needed to
easily add I2C support later. It also simplifies a bit the driver
initialisation by using more static values.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-06-18 11:23:07 +02:00
Armando Visconti
098a5f51aa drivers/sensor: Clean unused axis structures
axis1bit16 and axis3bit16 unions are no longer used
and can be deleted from all .h files that are referencing
them.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-18 11:22:58 +02:00
Armando Visconti
7f9e3af932 modules/hal_st: Align sensor drivers to stmemsc HAL i/f v2.00
Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v2.00.

Requires https://github.com/zephyrproject-rtos/hal_st/pull/7
(merged as 575de9d461aa6f430cf62c58a053675377e700f3)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-18 11:22:58 +02:00
Henrik Brix Andersen
93587e9178 drivers: led: ht16k33: reprocess keyscan events in case of i2c error
Reprocess keyscan event processing in case of an I2C bus read
error. Otherwise, the HT16K33 will be stuck (when used in IRQ mode, not
in polling mode) and no new IRQs will be delivered.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-06-18 11:22:40 +02:00
Henrik Brix Andersen
588d22a755 drivers: ht16k33: convert keyscan driver from gpio API to kscan API
Convert the keyscan portion of the Holtek HT16K33 driver to adhere to
the kscan API instead of the GPIO API.

When this driver was introduced the kscan API was not present. The
keyscan driver was therefore implemented as a GPIO interrupt driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-06-18 11:22:40 +02:00
Kumar Gala
7e52ee7fe1 drivers: pwm: Fix compile issues with Atmel SAM PWM driver
The was a missing comma in the DEVICE_DT_INST_DEFINE macro and the
SAME71 HAL tweaks the name of a struct so we have to work around that.

Fixes #36095

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-18 11:22:27 +02:00
Ilya Tagunov
63dbc1f4e0 drivers: lora: sx126x: cosmetic fixes
Fix minor cosmetic issues discovered while updating driver.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2021-06-18 11:22:03 +02:00
Ilya Tagunov
05957b66cb lorawan: update LoRaMac-node and move CMakeLists.txt to the main repo
Update the LoRaMac-node library to the last stable release and fix
the Zephyr glue code to match it. Move CMakeLists.txt to the main
Zephyr repository to simplify loramac-node module maintenance.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2021-06-18 11:22:03 +02:00
Ruibin Chang
d45668480a ITE driver/watchdog: add watchdog timer for it8xxx2
Add watchdog timer for it8xxx2.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-06-18 11:21:53 +02:00
Parthiban Nallathambi
dac8a6ef7d ethernet: w5500: reset_gpio isn't mandatory
reset_gpio pin isn't mandatory for function w5500.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2021-06-17 18:38:15 -05:00
Gerard Marull-Paretas
8f0657a1c4 drivers: kscan: increase init priority
Make kscan init priority higher, since it is lower than some buses like
I2C, making some devices to fail initialization if not tuning
priorities.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-06-17 07:31:41 -05:00
Chris Coleman
cb1d588ea7 drivers: wifi: eswifi: Fix err log & NET_SOCKETS_OFFLOAD=n config
Change Highlights:

- Fix error check after `k_work_reschedule_for_queue`. A value of 1
  means job was scheduled which was resulting in a ton of "<err>
  wifi_eswifi: Rescheduling socket read error" logs getting printed
  due to the erroneous check
- When using the B-L475E-IOT01A, attempts to use a TLS socket result
  in a hang when socket offload is enabled so I'd like to have a way
  to disable the option. To accomplish this, I I switched the
  `CONFIG_NET_SOCKETS_OFFLOAD=n` Kconfig option from `select` to
  `imply`.
- There was a missing `net_context_set_state()` call when
  `CONFIG_NET_SOCKETS_OFFLOAD=n`. I applied the same fix from #30664
  for this case to fix the issue.

Signed-off-by: Chris Coleman <chris@memfault.com>
2021-06-17 12:41:03 +02:00
Krishna Mohan Dani
27435cf6e5 drivers/flash: STM32: Adding flash driver for nucleo_f207zg
This commit adds the flash driver for nucleo_f207zg platform.
This has been tested with flash test application.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-06-17 12:40:39 +02:00
Jukka Rissanen
2758aeedbc drivers: modem: gsm: Ignore semaphore take return value
We do not need the return value of k_sem_take() so ignore it.

Coverity-CID: 236602
Fixes #36313

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-06-16 22:12:40 -04:00
Flavio Ceolin
0ea0344328 drivers: fxos8700: Remove unnecessary cast
Change a variable type in fxos8700_set_odr to avoid unnecessary cast.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-16 11:13:45 -05:00
Flavio Ceolin
54d33990f3 drivers: fxos8700: Make internal function static
fxos8700_set_odr is used only inside this file and don't need to be
exported.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-16 11:13:45 -05:00
Flavio Ceolin
e31d2ab6b4 drivers: fxos8700: Fix sensor_attr_set behavior
It is necessary to put the device in standby to change the contents of
CTRL_REG1. This register is used to change the sampling frequency.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-16 11:13:45 -05:00
Pieter De Gendt
46643dcb05 sensor: bq274xx: fix sleep logic when polling after softreset
The bq274xx fuel gauge does a softreset when configuring, after
which the device is polled and sealed. However the sleep logic
was inverted so the poll became blocking.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-06-16 10:39:44 +02:00
Lasse Sangild
ec174d41b6 drivers: adc: stm32: Perform calibration if set in sequence
The calibration bit previously did nothing.

Move calibration to allow call in start_read.

Signed-off-by: Lasse Sangild <lsangild@gmail.com>
2021-06-16 10:39:18 +02:00
Lasse Sangild
e4463a7d9e drivers: adc: stm32: Add STM32h7xx linearity calibration
The STM32H7 series has a special ADC, which is calibrated
on the factory. The calibration values are stored in flash
and must be retrieved upon powering up the device.

Failure to calibrate the device leads to missing codes in
the ADC readings.

Fixes #35529

Signed-off-by: Lasse Sangild <lsangild@gmail.com>
2021-06-16 10:39:18 +02:00
Aymeric Aillet
de2e14177b drivers: uart: rcar: Fix typo in conf phase
Fix typo in configuration phase to prepare the driver
for incoming add of Interrupt driven uart mode.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-06-15 20:13:55 -05:00
Rafał Kuźnia
3aae1f64a3 drivers: ieee802154: fix unintentional case fall-through
This commit fixed buggy fall-throughs introduced with
recent changes to nRF5 shim layer.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-06-15 14:26:01 +03:00
Piotr Mienkowski
aaf64e0bdf soc: atmel_sam: Add _INST to ATMEL_SAM_DT_PIN* macros
The macros are used to get the pin(s) of a given driver instance. Add
_INST prefix to match convention used by the devicetree.h. The original
macros can now be used to obtain pin(s) of an arbitrary device instance
identified by the nodelabel.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-06-14 09:50:41 -05:00
Hans Wilmers
0a345df211 drivers: modem: ublox-sara-r4: query for operator and cell info
Query the numerical network operator id, location area code (LAC)
and cell id. Following AT commands are used:

  AT+COPS?
  AT+CEREG?

Functionality is enabled by CONFIG_MODEM_CELL_INFO=y.

Tested with uBlox SARA-R410M-02B.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2021-06-14 15:19:13 +02:00
Hans Wilmers
09fd688d23 drivers: modem: gsm_ppp: query for operator and cell info
Query the numerical network operator id, location area code (LAC)
and cell id. Following AT commands are used:

  AT+COPS?
  AT+CEREG?

Functionality is enabled by CONFIG_MODEM_CELL_INFO=y.

Tested with uBlox SARA-R410M-02B.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2021-06-14 15:19:13 +02:00
Hans Wilmers
120b2165ec drivers: modem: implement operator id and cell info
Implement numerical network operator id, location area code (LAC)
and cell id in modem context and modem shell.

Please note that the functionality to query these values must be
implemented in the modem driver.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2021-06-14 15:19:13 +02:00
Jukka Rissanen
0b36b22146 drivers: eth: Enable TXTIME and PTP clock properly
Mark qemu_x86 and native_posix drivers to support both
TXTIME and PTP clock so that we can use txtime sample application
for testing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-06-14 07:00:10 -04:00
Johan Stridkvist
b3389d4a5b soc: nrf53: Tune capacitor for LFXO for nRF53 and update accuracy
Switch from using internal 6pf to internal 7pf load capacitor for LFXO.
Use a default clock accuracy of 50PPM as this matches lab results.

50PPM should be sufficient for common operating temperatures of
25degC +- 15.

Signed-off-by: Johan Stridkvist <johan.stridkvist@nordicsemi.no>
2021-06-12 08:52:00 -05:00
Lukasz Maciejonczyk
8196770737 drivers: ieee802154: propagate frame counter to upper layer
When frame counter is managed by the radio driver the upper layer
needs to be informed about the frame counter changed. The upper layer
looks for the most recent frame counter in the transmitted frame,
this is why the tx_payload need to be updated after processed by
the radio driver.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-06-12 08:51:26 -05:00
Kumar Gala
fb57b23a37 drivers: hwinfo: Exclude GECKO driver on EFR32MG21
The EFR32MG21 doesn't have a RMU and thus the driver isn't relevant for
that SoC series.  Add a Kconfig exclusion so the driver isn't available
on EFR32MG21 SoCs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-12 08:48:16 -05:00
Jose Alberto Meza
03ce67f153 drivers: espi: eSPI host DnX propagation fixes
Correct MEC15xx HAL value for DnX warn.
For consistency add automatic ack into the driver.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2021-06-11 17:45:16 -04:00
Kumar Gala
f1affb5e67 drivers: hwinfo: gecko: Fix build
Fix how HAS_BROWNOUT so things build correct and without warnings.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-11 16:23:05 -05:00
Luc Viala
7105875ff4 driver/uart: add enum parity element on devicetree bindings
It helps configurations of the parity mode for uart interfaces

Signed-off-by: Luc Viala <lviala@zaack.io>
2021-06-11 08:53:10 -05:00
Tim Lin
8ea58d4389 ite: drivers/adc: create pinmux phandle to the ADC driver node
Create the pinmux phandle to the ADC driver node in the
devicetree. When the pinmux_pin_set function in
adc_it8xxx2_channel_setup can refer to the setting of
this phandle. It is more flexible to use.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-06-11 15:47:25 +02:00
Erwan Gouriou
88cf73d58f drivers/pinmux: stm32: Remove unused definition
`STM32_PINMUX_NAME` is not used anymore.
Removed

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-06-11 08:04:39 -05:00
Erwan Gouriou
fcc3177509 drivers/pinmux: stm32: Move stm32 driver from stm32/
Since we removed various series headers, move stm32 driver
under main driver/pinmux folder.
Take this change into account into various drivers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-06-11 08:04:39 -05:00
Erwan Gouriou
00e1adda5c drivers/pinmux: stm32: Remove deprecated pinmux series headers
These headers were deprecated since release V2.5.0.
Users are expected to use dts based configuration API.
Remove these headers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-06-11 08:04:39 -05:00
Jedrzej Ciupis
15fef0d2f5 drivers: ieee802154: extend capabilities
This commit extends the capabilities of the nRF IEEE 802.15.4 radio
driver with IEEE802154_HW_TX_SEC capability.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2021-06-11 07:35:53 -05:00
Henrik Brix Andersen
35733ca385 drivers: timer: hide CONFIG_APIC_TIMER_IRQ_PRIORITY when not applicable
Make the APIC_TIMER_IRQ_PRIORITY Kconfig depend on APIC_TIMER ||
APIC_TSC_DEADLINE_TIMER to hide it in menuconfig when not applicable.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-06-10 18:15:01 -04:00
Yonatan Schachter
782c9b7973 drivers: hwinfo: Added Gecko support for reset cause
This commit provides implementations for the reset cause
API functions as part of hwinfo.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2021-06-10 17:10:28 -04:00
Alexandre Bourdiol
f021fa8e80 drivers: flash: stm32f4: Remove useless definition and use CMSIS
Remove useless definiton STM32F4X_SECTOR_MASK and use CMSIS instead.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-06-10 15:53:41 -05:00
Alexandre Bourdiol
6798135694 drivers: flash: stm32f7: Remove useless definition and use CMSIS
Remove useless definiton STM32F7X_SECTOR_MASK and use CMSIS instead.
By the way fix bug as '|' should be in fact '&',
but thanks to '~' inversion, '|' is now good.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-06-10 15:53:41 -05:00
Rafał Kuźnia
cab64a9c61 drivers: ieee802154: copy back the TX buffer into the upper layer
Copy back the TX buffer content back into the upper layer
in case of a TX failure.

This is necessary in when frame encryption by the radio driver
is used. The shim layer for the nRF5 driver has a buffer, that
is used by the driver to authenticate and encrypt the frame
in-place. In case of a TX failure, the buffer contents
are propagated back to the upper layer. The upper layer
must use the same secured frame for retransmission.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-06-10 11:03:40 +03:00
Rafał Kuźnia
9070190bc6 drivers: ieee802154: add option to retransmit a frame
Use the nrf_802154_retransmit_csma_ca_raw and
nrf_802154_retransmit_at_raw API to retry the frame transmission
after a failed attempt.

The retry must be performed only in response to
a nrf_802154_transmit_failed event.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-06-10 11:03:40 +03:00
Lingao Meng
9644e9bc99 drivers: Fix missing auto_attach_cmd
When run native posix with `-attach_uart_cmd=<cmd>`,
should attach cmd by arguments.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-06-09 16:18:17 +02:00
Lukasz Maciejonczyk
4113a43bff drivers: ieee802154: fix serialization issue in nRF5
Function 'nrf_802154_transmitted_timestamp_raw' is not serialized and
connot be used for multi-core devices yet.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-06-09 16:11:58 +03:00
Jamie McCrae
6637c5bb4a drivers: ethernet: enc424j600: Add config get support for driver
This allows the current speed of the connection (100Mbps/10Mbps) and
if it is operating in half or full duplex to be queried

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-06-09 11:45:10 +03:00
Jamie McCrae
5719e545af drivers: ethernet: enc424j600: Reduce interrupt command lengths
The enc424j600 chipet has 1-byte commands to enable or disable
interrupts which an be used rather than the currently used 4-byte
commands to speed the process up by a factor of 4x

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-06-08 15:42:59 -05:00
Fabio Baltieri
b06f4a5e72 drivers: flash_stm32_v1: fix a potential unaligned access
The flash write function casts a void * to flash_prg_t, which can be 2,
4 or 8 bytes long depending on the SoC. This can trigger a hard fault
exception if data is not aligned, such as when passing a constant string
from settings_save_one().

Copying the chunk of data to a temporary variable on the stack to avoid
the problem.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-08 11:15:59 -05:00
Marcin Niestroj
0b59257d93 drivers: wifi: esp32: create event handling thread in runtime
Commit 95b916d104 ("drivers: wifi: esp32: fix reconnect issue")
switched from thread created at runtime to statically defined thread.
The difference is mainly visible for simple applications that use
CONFIG_NET_CONFIG_AUTO_INIT=y, where networking setup code is executed
before main() and any statically defined threads. All ESP32 events are
just queued and never handled, so conditions enforced by
CONFIG_NET_CONFIG_NEED_IPV4=y are never met (e.g. Zephyr networking
layer is never informed about being connected).

Switch back to thread created at runtime, which starts at the moment
when k_thread_create() is invoked. This allows ESP32 event processing to
happen just after ESP32 WiFi driver gets initialized and before Zephyr
network auto initialization code (CONFIG_NET_CONFIG_AUTO_INIT=y).

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-06-08 11:15:38 -05:00
Henrik Brix Andersen
a25afdd470 drivers: eeprom: at2x: convert to new DT helper macros
Simplify the the AT2x EEPROM instance initialization macro a bit by
converting it to use the new DT helper macros for SPI and GPIO.

This also saves a few bytes when only AT24 support is enabled.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-06-08 16:09:39 +02:00
Eduardo Montoya
ae44b30b41 drivers: ieee802154: include timestamp in acks
Fill the ACK timestamp field in nRF5 driver. This is required by
OpenThread for the proper CSL transmitter functioning.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2021-06-08 04:54:38 -05:00
Arvin Farahmand
98a0ccd5c5 drivers: hwinfo: Add reset cause support
Add `hwinfo_get_reset_cause` and `hwinfo_clear_reset_cause` to retrieve
and to clear cause of system reset on supported platforms.

Different platforms can provide different causes of reset, however
there is a great deal of overlap. `enum reset_cause` can be expanded in
the future to support additional reasons, as additional platforms are
supported.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-06-08 10:16:17 +02:00
Jose Alberto Meza
c85e11c05b drivers: espi: Propagate eSPI host DnX warning to driver's client
Propagate Download and Execute (DnX) entry warning.
Add missing handler for SUS warning power down ack.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2021-06-07 23:52:17 -04:00
Daniel Leung
4e1692f85a serial: introduce CONFIG_UART_USE_RUNTIME_CONFIGURE
This kconfig option enables runtime configuration of UART
controllers. This allows application to call uart_configure()
to configure the UART controllers and calling uart_config_get()
to retrieve configuration. If this is disabled, UART controllers
rely on UART driver's initialization function to properly
configure the controller. The main use of this option is mainly
code size reduction.

Fixes #16231

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-06-07 12:09:01 +02:00
Mulin Chao
a31378dec1 driver: clock: npcx: add apb4 clock support for npcx9 series.
Add apb4 clock support for npcx9 and later series.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-06-07 12:06:33 +02:00
Mulin Chao
87f29ef5bb driver: adc: npcx: replace constant value with DT_INST_PROP_LEN macro.
In this CL, instead of a constant value, we use the length of property
'pinctrl-0' of adc0 to indicate the number of ADC channels in different
npcx series.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-06-07 12:06:33 +02:00
Julien Massot
3ced1ddb85 drivers: can: Add Renesas R-Car driver
This driver is for classic CAN, it makes use of CAN interface
in FIFO mode.

This driver support Standard ID as well as Extended ID.

Tested on H3ULCB, Ebisu platform, with external adapter and
in loopback mode.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2021-06-07 12:06:21 +02:00
Julien Massot
d79044cd2b drivers: can: mcp2515: move filter_match function
Move filter match function to can_utils.h, so that it
can be reused for Renesas driver.

Preserve copyright from Karsten Koenig.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2021-06-07 12:06:21 +02:00
Fabio Baltieri
03adc1e2bb drivers: clock_stm32: add APB3 support for STM32WL
STM32WL series have an extra APB3 bus with the SUBGHZSPI device on it.
Add the relevant code to enable and disable that clock, and to obtain
the actual clock rate. This is enough to run the STM32 SPI driver
against it.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-07 12:04:15 +02:00
Fabio Baltieri
fbf2f81c43 drivers: stm32_adc: add STM32WL family support
Add ADC support for the STM32WL family, this seems to work following
most of the L0X code path.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-07 12:04:15 +02:00
Fabio Baltieri
cb355f6e6c drivers: stm32_rtc: add STM32WL family support
Add RTC counter support for the STM32WL family.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-07 12:04:15 +02:00
Tim Lin
958c79ea5a ite: drivers/i2c: it8xxx2: Don't check bus busy during repeat start
If the transaction of write to read is divided into two transfers,
the second transfer will go to check bus busy and cause i2c reset.
This change adds flag to eliminate this situation.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-06-04 16:30:45 -05:00
Armando Visconti
fcb0953309 drivers/sensor: lis2mdl: Add multi-instance support
Add multi-instance support and make use of the stmemsc i2c/spi
read/write routine that has been introduced to simplify the ST
sensor drivers code.

Moreover, move spi-full-duplex property from Kconfig inside Device
Tree, so that each LIS2MDL instance can be configured selectively
in accordance to how it is used in h/w.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-04 16:29:45 -05:00
Robert Szczepanski
ba56d751c0 drivers: gpio_litex: add support for changing IRQ type
LiteX GPIOIn module provides possibility to change IRQ mode
and edge via CSRs. This commit adds support for that feature.

Signed-off-by: Robert Szczepanski <rszczepanski@internships.antmicro.com>
2021-06-04 16:24:52 -05:00
Robert Szczepanski
639e1d1b36 drivers: gpio_litex: add support for disabling IRQs and update devicetree
This adds missing option to disable IRQs.
Devicetree is modified to match previous commit with custom IRQ CSR
addresses.

Signed-off-by: Robert Szczepanski <rszczepanski@internships.antmicro.com>
2021-06-04 16:24:52 -05:00
Raptor Engineering Development Team
0061a61f14 drivers: gpio_litex: make IRQ CSR addresses adjustable for user
This adds an option to set IRQ pending and IRQ enabled CSR adresses
in devicetree since these can be custom in LiteX.

Signed-off-by: Raptor Engineering Development Team <support@raptorengineering.com>
2021-06-04 16:24:52 -05:00
Robert Szczepanski
cf385b0a15 drivers: gpio_litex: add support for litex_vexriscv GPIO interrupts
This commit adds support for GPIO interrupts in GPIO driver for Litex
SoC Builder.

Signed-off-by: Robert Szczepanski <rszczepanski@internships.antmicro.com>
2021-06-04 16:24:52 -05:00
Henrik Brix Andersen
2dc90a0825 drivers: adc: mcp320x: convert to new DT helper macros
Simplify the the MCP320x instance initialization macro a bit by
converting it to use the new DT helper macros for SPI.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-06-04 16:19:01 -05:00
Henrik Brix Andersen
7c6c65e384 drivers: gpio: lmp90xxx: convert to new DT helper macros
Convert from using device_get_binding() to DEVICE_DT_GET().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-06-04 16:18:51 -05:00
Henrik Brix Andersen
31fc67d9ae drivers: adc: lmp90xxx: convert to new DT helper macros
Simplify the LMP90xxx instance initialization macro a bit by converting
it to use the new DT helper macros for SPI and GPIO.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-06-04 16:18:51 -05:00
Guillaume Lager
42835a780a drivers: sensor: tmp116: Check that a new value is available
Add a check to ensure that the conversion is complete before reading

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-06-04 16:18:33 -05:00
Guillaume Lager
c40f0ec108 drivers: sensor: tmp116: Fix compilation error
commit d31ed3be04 enabled multiple
instances but when multiple instances are actually used the code does
not compile

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-06-04 16:18:33 -05:00
Mulin Chao
a8a217f22d dts: npcx: replace series-prefix 'npcx7-' with famliy-prefix 'npcx-'
This CL replaces series-prefix "npcx7-" with family-"npcx-" for npcx dts
nodes such as 'espi-vws-map' and 'miwus-int-map'. Since we plan to
introduce the npcx9 and later series, adding a new node such as
npcx9-espi-vws-map for each series is more complicated and not
necessary.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-06-04 16:14:48 -05:00
Anas Nashif
24bd45b287 pm: do not use deprecate Kconfig
CONFIG_DEVICE_POWER_MANAGEMENT is deprecated, use CONFIG_PM_DEVICE
instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-06-04 12:19:38 -05:00
Stancu Florin
8ebb641ef7 drivers: cc13xx_cc26xx: fix pm.h not included
Fixes #35916.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2021-06-04 10:24:10 -05:00
Gerard Marull-Paretas
45a6de6804 drivers: fix pm callback signature
For some reason a few drivers were not converted to the new device PM
callback signature. The reason may be because the device PM part is
compiled only when CONFIG_PM_DEVICE=y, a condition not enabled in CI by
default.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-06-04 08:16:49 -05:00
Christoph Steiger
6ce18c6e6a drivers: can: mcan: Fix DBTP sjw register writes
The data-sjw value was incorrectly written to the NBTP register when it
should be written to the DBTP register.

This fixes a regression introduced by
5e0ca9b41e.

Signed-off-by: Christoph Steiger <c.steiger@lemonage.de>
2021-06-04 08:12:12 -05:00
Armando Visconti
e879be1dbb drivers/sensor: lis2mdl: Fix temperature sample handling
The lis2mdl temperature samples work with a level of 25 Celsius.
When temperature goes below that level the samples become negative
and there was an issue in properly propagating the sign.

Fix #35910

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-03 09:44:31 -05:00
Armando Visconti
4e8c809d74 drivers/sensor: lps22hh: Fix the raw to kPa sample conversion
The lps22hh 24 bit raw sample is left aligned, which means that
it needs to be right-shifted by 8 before applying conversion.
Moreover the conversion has been simplified for clarity.

Fix #35871

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-03 09:30:42 -05:00
Armando Visconti
282a644b0e drivers/sensor: lis2dh: use gpio_dt_spec oriented macros
Use gpio_dt_spec structure and related macros for both drdy
and AnyMotion interrupts, to have a more compat, readable and
safe code. Moreover, skip setting DRDY or AnyMotion trigger
from application if the corresponding irq-gpios has not been set.

(This commit also fixes #34794)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-02 08:51:14 -05:00
Alexander Wachter
5e0ca9b41e drivers: can: sjw == 0 in can_set_timing should not change sjw
If the supplied sjw in the timing parameters is zero,
the sjw parameter should not be changed.
This fixes the uninitialized swj in can_set_bitrate.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-06-01 07:29:36 -05:00
Henrik Brix Andersen
9138e87925 drivers: i2c: gpio: fix compilation
Fix the compilation of i2c_gpio.c after the gpio_config() syscall was
removed.

Fixes: 3632815e2e

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-06-01 07:27:27 -05:00
Kumar Gala
7f77240126 drivers: gpio: mcux_lpc: Convert driver to use devicetree port prop
Move to using port property for a few cases in which we need to know
which specific hardware port a device is for.  This allows us to
remove the PORT0/1 Kconfig options.  This also fixes the issue that
assumed pio0 would map to DT_INST(0) and pio1 would map to DT_INST(1)

Fixes #35693

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-31 17:45:05 +02:00
Krzysztof Chruscinski
edff2b020f drivers: serial: nrf_uarte: Fix async/int TX api in inactive state
Currently zephyr has no means to control access to the uart
driver when it is inactive, e.g. shell is not aware of uart
being in idle state and calls asynchronous api. Add early
return to TX starting procedure if device is idle.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-28 10:06:15 -05:00
Krzysztof Chruscinski
8e6898ef14 drivers: flash: nrf_qspi_nor: Fix no multithreading compilation
Fixing error introduced in 951e72b947
where ifdef was converted to IS_ENABLED. Ifdef was required because
element in the struct does not exist when multithreading is disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-28 15:32:43 +02:00
Affrin Pinhero
2c61c06a0e drivers/ADC: STM32: This solves coverity reported in ADC driver.
This commit it to resolve following bugs:
* Operands don't affect result.
* Logical dead code in stm32_adc driver.
Above mentioned bugs were solved by adding parenthesis and
changed the method of comparing. Since comparison of ADC
channel_id with the channel may cause loss of value.
So instead of direct comparison, introduced a mechanism to
convert channel constant to a decimal using
__LL_ADC_CHANNEL_TO_DECIMAL_NB() and strips away
the INTERNAL_CH bit and then compare with channel_id.

fix:
* zephyrproject-rtos/zephyr#35130
* zephyrproject-rtos/zephyr#35136

Signed-off-by: Affrin Pinhero <affrin.pinhero@hcl.com>
2021-05-27 15:55:19 -05:00
Thomas Stranger
12c80eba71 drivers: can: init timing.sjw also in canfd mode
This commit resolves the undefined behviour caused by missing timing.sjw
initialization.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-27 15:54:30 -05:00
Eduardo Montoya
9c6895105d drivers: ieee802154: fix ACK length handling
OpenThread expects the FCS field at the end of the ACK frame to be
passed with `otPlatRadioTxDone`.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2021-05-27 12:59:06 -05:00
Emil Lindqvist
9b7d9d43b8 drivers: modem: ublox-sara-r4: implement F_GETFL in ioctl
Zephyr sees fnctl as an alias of ioctl, and so the F_GETFL
request should be handled here as well.

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-05-27 15:44:03 +02:00
Sylvio Alves
95b916d104 drivers: wifi: esp32: fix reconnect issue
Device won't reconnect automatically even if
AP station is available. This fix adds the carrier event, indicating
that network is present again enabling DHCP bound event.
Also, internal wifi event callback was added into wifi
driver to enable proper event handling.

Update west.yml to bring exposed wifi event callback.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>

Fixes #33843
2021-05-27 08:23:06 -05:00
Flavio Ceolin
15b071d821 drivers: can: Fix compilation issue
Remove extra (and syntactically wrong) semicolon.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-27 07:05:34 -05:00
Flavio Ceolin
18e9ec70d6 drivers: can: can_set_bitrate is not a syscall
There was a verification function for can_set_bitrate calling a syscall
implementation. But, can_set_bitrate is not a syscall and does not need
to be because it is accessing the driver through other syscalls.

Fixes #34734

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-27 07:05:34 -05:00
Krzysztof Chruscinski
909fbb2086 drivers: console: rtt: Add no multithreading support
Avoid calling k_sleep when multithreading is disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-27 13:33:02 +02:00
Casper Bonde
afe469eac7 Bluetooth: ISO: Speed up BT ISO data processing
For the native posix build the sleep calls used in tasks will stall
the zephyr instance which sets an upper limit on the data processing
interval to once every 20-30 millisecond.
This change reduces the duration of the sleep calls and increases the
TICKS_PER_SECOND to allow for shorter sleeps. This is needed to
support the data rates needed for LE Audio streaming. The rate is
tuned to support up to bidirectional 5ms ISO-intervals.
This change also increases the ISO buffer count from 1 to 5 to
allow for some buffering in the controller, which is needed for
gapless playback and/or use of burst number larger than 1.

Signed-off-by: Casper Bonde <casper_bonde@bose.com>
2021-05-27 13:16:40 +02:00
Scott Worley
825170e00b drivers: pinmux: mchp: Update pinmux based on latest HAL
Microchip HAL 1.2.0 fixed a bug in the define of GPIO
control register MUX field. The incorrect MUX defined
cleared by GPIO input pad disable field by accident.
After the MUX definition was corrected the pinmux driver
must be modified to mask off the input pad disable for
the pin to be operational.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-05-26 19:09:47 -05:00
Piotr Mienkowski
a323a41fc2 sensor: qdec_sam: use compatible atmel,sam-tc-qdec
Change the drivers's compatible from atmel,sam-tc to atmel,sam-tc-qdec.
The atmel,sam-tc should be reserved for the future counter driver.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-05-26 18:13:10 -05:00
Affrin Pinhero
c1daae647e driver/spi: STM32 Revert while loop on tx only
This commit reverted while loop on tx only.
This commit solves SPI loopback failure and SPI wrong behaviour on RX.
fix:
* zephyrproject-rtos/zephyr#35297
* zephyrproject-rtos/zephyr#35539

Revert "drivers/spi: STM32: This solves SPI infinite loop on Tranceive"

This reverts commit 50c2acbc03e7a48a09880b6fcb8c22256bffa70c.

Signed-off-by: Affrin Pinhero <affrin.pinhero@hcl.com>
2021-05-26 10:38:21 -05:00
Flavio Ceolin
d67a5786bc pm: device_runtime: Change API behavior s/_sync/_async
Most APIs have the default synchronous and an asynchronous version
with the sufix _async because that is the most common use.

All devices in tree right now are using the synchronous version, so
just change it to be consistent with the rest of the system.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-26 10:56:55 -04:00
Krzysztof Chruscinski
951e72b947 drivers: flash: nrf_qspi_nor: Fix no multithreading configuration
File was failing to compile when multithreading was off.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-26 11:51:23 +02:00
Kamil Panek
8a23205a22 drivers: wifi: eswifi: fix swapped protocols in eswifi_off_getaddrinfo
As a result, when values returned by getaddrinfo were used, the wrong
socket was created.

Signed-off-by: Kamil Panek <kamil.panek@wbudowane.pl>
2021-05-25 16:59:17 -05:00
Gerard Marull-Paretas
01565fa17d drivers: adc: lmp90xxx: check read REG_ADC_DONE error code
Check the error code returned when reading REG_ADC_DONE, return if
non-zero.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-25 12:53:35 -05:00
Gerard Marull-Paretas
2352da2e56 drivers: adc: lmp90xxx: fix incorrect buffer size
sizeof() reported the size of the val pointer, not the variable size.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-25 12:53:35 -05:00
Arvin Farahmand
d1d494e2b7 drivers: flash: bugfix: set atmel SAM0 write-block-size
`write-block-size` property in multiple Atmel SAM SoCs was either
missing or set incorrectly.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-05-25 11:59:45 -05:00
Watson Zeng
f05593e726 arc: interrupt_controller: increase irq unit priority
arc_v2_irq_unit_init function will init all interrupts and disable
they, we must make sure we call it first before we use interrupts.
so we need to increase its priority to highest in PRE_KERNEL_1 stage.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-05-25 07:37:02 -05:00
Anas Nashif
108129cf7d tracing: fix conflict with RTT locking
Make custom RTT locking configurable and select it where it is needed.
When using RTT for tracing we want to use the default locking.

Update both segger and tracerecorder modules to support that.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-25 07:36:38 -05:00
Andrzej Głąbek
457a28bf78 drivers: nrf_rtc_timer: Remove unnecessary locking
As per description of the sys_clock_elapsed() function, "the kernel
will call this with appropriate locking, the driver needs only provide
an instantaneous answer". Remove then the unnecessary locking from the
function, as it only adds an undesirable delay.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-05-24 23:53:18 -04:00
Maksim Masalski
0f5aab1182 drivers: change suffix ull to ULL
Replace suffix ull to ULL to increase code readability and prevent
unexpected behaviours, because the lowercase character l shall not be
used in a literal suffix

Found as a coding guideline violation (MISRA R7.3) by static
coding scanning tool.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2021-05-21 18:13:01 -04:00
Johann Fischer
de974efebb drivers: eth_enc424j600: explicitly disable INTIE after reset
After system reset (SETETHRST) interrupt enable register (EIE)
has the default value 0x8010 and global interrupt enable flag (INTIE)
is set. This is not desired and the INTIE flag should be set only at
the end of the initialization.

Disable INTIE flag and set desired interrupts sources in
a single write command just right after system reset.

Resolves: #35091

Reported-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-05-21 07:35:19 -04:00
Johann Fischer
6de9c18f03 drivers: eth_enc424j600: terminate driver thread only when debugging
The controller has several interrupt sources which are signaled
via a single INT pin. Only the interrupt sources that are explicitly
switched on during controller initialization may generate an interrupt
signal. Currently there are only PHY Link Status Change Interrupt
and RX Packet Pending Interrupt enabled. So there is no other reason why
an interrupt can be triggered.

Terminate interrupt handling thread on unknown interrupt
only when debugging, as there are concerns that stopping
thread in the field is going too far.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-05-21 07:35:19 -04:00
Francois Ramu
aa2e915fbf drivers: dma: stm32 dmamux has request 0 for mem-to-mem
The request ID = 0 is allowed for mem-to-mem data
transfer through the DMAMUX.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-05-21 04:55:02 -05:00
Krzysztof Chruscinski
7d61be9e79 drivers: serial: nrf_uarte: Fix uart_callback_set unsupported handling
Function should return -ENOTSUP when asynchronous api is not
supported by the device.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-21 04:53:19 -05:00
Krzysztof Chruscinski
8af5dbc977 drivers: serial: nrf_uarte: Fix power management transitions
Deadlock may occur when uart device was put to low power state
while uart_poll_out was in progress. Poll out pends until uarte
is ready to send new byte and it is detected by endtx and txstopped
events being set. When uarte was disabled while poll_out was pending
events were never set and that lead to deadlock. Added a step
in going to low power state in which CPU waits for txstopped event
and only after that uarte peripheral is disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-21 04:53:19 -05:00
Armando Visconti
468c553190 drivers/sensor: iis2iclx: (FIX) enable interrupt selectively
(same considerations as commit 2f01479b)
In a multi-instance driver it may happen that on some h/w
one device should use interrupts and a second device should use
polling mode. So, CONFIG_IIS2ICLX_TRIGGER is not enough to discriminmate
if interrupt inizialization routine should be called or not; the choice
is now based whether the "irq-gpios" property is present in the DT
for that particular instance or not.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-20 17:55:08 -04:00
Armando Visconti
1f851bc268 drivers/sensor: lsm6dso: use gpio_dt_spec oriented macros
Use gpio_pin_configure_dt() and gpio_pin_interrupt_configure_dt()
for drdy_gpio: they result in a more readable code.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-20 17:55:08 -04:00
Simon Guinot
1945f70eee drivers: dma: stm32: fix build for STM32F0 MCUs
The STM32F0 MCUs (except STM32F030XC) don't have a DMA channel selection
register (DMA_CSELR). This patch fixes the build of the dma_stm32 driver
for them.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-05-20 13:24:18 -05:00
Simon Guinot
aa8e34302a drivers: systick: fix cycle count in sys_clock_set_timeout()
With this patch the sys_clock_set_timeout function counts the cycles
elapsed while computing the systick timer's new load (tickless mode).
This cycles are then added to the total cycle count instead of being
lost.

This patch mitigates uptime drifting in tickless mode (especially when
high frequency timers are registered).

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-05-20 08:44:55 -05:00
Alexander Wachter
1c792fb0b5 drivers: sensors: sbs-gauge: add CHAN_ALL to fetch
Add the SENSORS_CHAN_ALL to the fetch function.

Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
2021-05-19 08:56:21 -05:00
Shlomi Vaknin
1b4f7e5651 drivers: uart: stm32: fix handling interrupt and async api in isr
When using the uart driver with interrupt and async api
at the same time (instance for interrupt and instance for async),
the transmission complete interrupt was handled in the async
handling section, even when interrupt driven api is used.
This caused transmission to not work properly in interrupt mode.
The fix is to move the interrupt mode handling to the begginning
of the isr. If async mode is used then interrupt mode code
will not be run.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-05-19 08:12:55 -05:00
Ryan Erickson
a1498f3e40 drivers: modem: hl7800: +KSRAT dependent on firmware version
The reboot option of the +KSRAT command is only
supported by newer firmware.
Add a check to determine what version of the command
to use when setting the RAT.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-05-19 08:09:37 -05:00
Marek Pieta
3851a14ff8 drivers: led_pwm: Update pm_control function
Change updates pm_control function to make it compatible with new
API.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2021-05-19 07:52:02 -05:00
Simon Guinot
df01148aeb drivers: led_pwm: fix device name fallback
If the label property is missing in a "pwm-leds" compatible DT node
(which is almost always the case), then the device name is now set to
DT_NODE_FULL_NAME instead of "LED_PWM_$inst" previously.

This allows applications to use the DEVICE_DT_NAME macro to retrieve
the device name instead of gessing an arbitrary string.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-05-19 11:56:01 +02:00
Daniel Leung
7295c19893 gpio: intel: fix reg address for Apollo Lake
On Apollo Lake, each GPIO controller has more than 32 pins.
But Zephyr API can only manipulate 32 pins per controller.
So the workaround is to divide each hardware GPIO controller
into 32-pin blocks so each block has a GPIO driver instance.
Compounding to the issue is that there cannot be two device
tree nodes with same register address. So another workaround
is to increment the register addresses by 1 for each block.
So when mapping the address, the lowest 8-bit needs to be
masked to get the actual hardware address.

Fixes #28551

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-05-18 20:45:55 -04:00
Armando Visconti
b430b8d6a6 drivers/sensor: iis2iclx: Fix shub for multi-instance case
In case of multi-instance the driver tries to discover whether
there are devices attached to SDx/SCx sensorhub bus. If not it
just turns the shub_inited variable (inside data structure) to false
and skips doing any further sensorhub related action for that
particular IIS2ICLX device instance, regardless the fact that the
macro CONFIG_IIS2ICLC_SENSORHUB is enabled.

Moreover, the info found during the enumeration process for a
particular instance (number and types of attached devices) must be
saved inside the per-instance data structure, so that more than one
IIS2ICLX device can be used as a sensorhub without interfering with
the others.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-18 11:18:08 -05:00
Armando Visconti
1325525e3b drivers/sensor: lsm6dso: Fix shub for multi-instance case
In case of multi-instance the driver tries to discover whether
there are devices attached to SDx/SCx sensorhub bus. If not it
just turns the shub_inited variable (inside data structure) to false
and skips doing any further sensorhub related action for that
particular LSM6DSO device instance, regardless the fact that the macro
CONFIG_LSM6DSO_SENSORHUB is enabled.

Moreover, the info found during the enumeration process for a
particular instance (number and types of attached devices) must be
saved inside the per-instance data structure, so that more than one
LSM6DSO device can be used as a sensorhub without interfering with
the others.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-18 11:18:08 -05:00
Alexandre Bourdiol
d915eb8252 drivers: ethernet: stm32: enable IRQ at the end of iface init
This avoid IRQ to be handle before iface init is finished
(especially before iface address is set)
Fixes #32771

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-05-17 10:59:43 -04:00
Jukka Rissanen
546b79e6bb drivers: uart_mux: Fix compilation after logging changes
The logging macros use _Generic() atm and it started to complain
when we are trying to print pointer value of gsm_dlci and gsm_mux
structs. Cast the pointer value to (void *) to overcome this.

Fixes #35329

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-05-17 10:57:53 -04:00
Krzysztof Chruscinski
0ee3da91ac drivers: serial: nrf_uarte: Fix checkpatch issues
Fixing checkpatch issues. No functional changes.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-17 16:23:11 +02:00
Krzysztof Chruscinski
1ddfea32bf drivers: serial: nrf_uarte: Add missing check for async API
uarte_enable function was not supporting a case when async
api was enabled but instance did not use it. Added runtime
check for async instance presence.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-17 16:23:11 +02:00
Krzysztof Chruscinski
485f593bb7 drivers: serial: nrf_uart: Disable uart when fifo_fill not used
Driver was failing when interrupt mode was enabled for given
instance but interrupt driven TX part was not used. In that
case uart was not disabled after sending a byte which resulted
in continuous interrupt triggering. Added check for
fifo_fill_lock which is set when uart_fifo_fill is used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-17 16:23:11 +02:00
Sylvio Alves
384d05932f driver: uart: esp32: DT fix to allow uart2
UART2 would not be available with current DT implementation.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-05-14 16:41:03 -04:00
Ryan Erickson
62ccddb035 drivers: modem: hl7800: fix update RAT
The default behavior of the +KSRAT= command has
changed to not reboot the HL7800.
Adjust the command so the reboot takes place properly.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-05-14 08:25:49 -05:00
Kumar Gala
21d1ad3762 drivers: gpio: gpio_cy8c95xx: Add error check of i2c_reg_read_byte
Check return value from i2c_reg_read_byte and error out if it
received an error

Fixes #35155

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-14 02:56:31 -05:00
Alexandre Bourdiol
c3d35d89a3 drivers: bluetooth: hci: increase spi_rx_stack
Thread analyze:
 BT SPI RX : STACK: unused 216 usage 296 / 512 (57 %)

Fixes #34601

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-05-13 22:07:45 -04:00
Kieran Mackey
5e10e77b69 drivers: dac: mcp4725: remove usage of device_pm_control_nop
Fixes issue #35263

Signed-off-by: Kieran Mackey <kieran.mackey@lairdconnect.com>
2021-05-13 22:04:14 -04:00
Tim Lin
5f5fb7d792 ite: drivers/adc: it8xxx2: fix adc driver flow
This commit fixes the ADC driver flow. And add internal
reference voltage to ADC driver API. And correct the
data buffer that only need to store raw data.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-05-13 11:54:05 -04:00
Tim Lin
bb40d93f27 ite: drivers/i2c: it8xxx2: fix slave address from 7-bit to 8-bit
This commit fixes the slave address from 7-bit to 8-bit.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-05-13 11:52:53 -04:00
Tim Lin
7b0a89e4c3 ite: drivers/i2c: it8xxx2: fix i2c_reset issue
After i2c_reset, there is still no external pull-up I2C bus,
and finishing off the rest of loop causes the code to hang
indefinitely.
This patch fixes that if I2C bus is not available(No external
pull-up), dropping the transaction.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-05-13 11:52:53 -04:00
Gerard Marull-Paretas
7268b6fe01 drivers: timer: sys_clock: return -ENOSYS if not implemented
-ENOSYS should be returned if the operation is not implemented. This
issue was causing some PM tests to fail, as -ENOSYS was expected.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-13 07:16:02 -05:00
Armando Visconti
24f345ee3e drivers/sensor: iis2mdc: use gpio_dt_spec oriented macros
Use gpio_pin_configure_dt() and gpio_pin_interrupt_configure_dt()
for drdy_gpio: they result in a more readable code.

Moreover, this commit includes also the fix for PR #35156
(i.e. CID 235979, add check for gpio_pin_configure() return val).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-12 23:34:46 -05:00
Prema Jonathan van Win
76dee395d8 drivers: serial: stm32: Fixes uart_event_tx len calculation
Resetting the dma_tx.buffer_length after the dma_tx.counter
calculation, instead of before.
We need to reset the buffer_length when the transmission is finished,
but in order to give the correct value to the uart_event_tx struct,
we use the dma_tx.buffer_length in the calculation of the
dma_tx.counter, used for the len of the event (number of bytes sent).
I found this problem, when I wanted to use the uart_event_tx.len for
freeing the used space inside a ring buffer (ring_buf_get_finish),
and it didn't work, I logged the values of the uart_event_tx struct,
and found out it always was 0, because the buffer_length was 0,
and the whole buffer was transmitted (stat.pending_length also 0).

Signed-off-by: Prema Jonathan van Win <jonathanvanwin@gmail.com>
2021-05-11 13:03:20 -05:00
Affrin Pinhero
0129884062 drivers/spi: STM32: This solves SPI infinite loop on Tranceive
This commit loops on rx not empty only if rx_buf is enabled.
And if rx_buf is not enabled, it loops on tx empty status.

Signed-off-by: Affrin Pinhero <affrin.pinhero@hcl.com>
2021-05-11 13:01:57 -05:00
Tomasz Chyrowicz
13303c4351 drivers: serial: nrf uarte: Fix for the RX byte counter
In case of the following sequence of UART events:
 - UART_ENDRX
 - UART_RXRDY
 - TIMER_RXTIMEOUT

The application receives one more byte that was received,
due to RX counter alignment upon ENDRX event.

The proposed fix moves the RX byte counter alignment to the
RX timeout event handler.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2021-05-11 13:01:29 -05:00
Daniel Leung
84a6a292c0 timer: hpet: mark functions as boot/pinned/isr
This marks the data and functions into appropriate
linker sections.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-05-10 16:00:43 -05:00
Daniel Leung
1ad7349d17 intc: ioapic: mark data and functions as boot/pinned
This marks the data and functions into appropriate
linker sections.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-05-10 16:00:43 -05:00
Daniel Leung
e4987484de intc: loapic: mark data and functions as boot/pinned
This marks the data and functions into appropriate
linker sections.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-05-10 16:00:43 -05:00
Daniel Leung
08d6386f3c intc: system_apic: mark functions as boot/pinned
This marks the functions into appropriate linker sections.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-05-10 16:00:43 -05:00
Kumar Gala
4ee61309b1 drivers: gpio: Fix when psoc6 gpio driver is built
Add check to see that the GPIO devicetree node is actually enabled
before we build the PSoC6 GPIO driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-10 13:47:11 -05:00
Kumar Gala
706de953ab drivers: serial: uart_miv: Fix build errors
If we try and build the MiV uart driver with interrupt support enabled
we get some errors related to code that hasn't been updated.  Fix the
compile errors and add SERIAL_SUPPORT_INTERRUPT to the Kconfig to
hopefully catch these issues in the future

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-10 13:15:50 -05:00
Eug Krashtan
05d798e3a9 drivers: sensor: STM32 die temperature driver
STM32 internal temperature sensor driver.
This sensor can be used to measure the temperature of the CPU
and its surroundings.

Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
2021-05-08 10:18:09 -05:00
Eug Krashtan
c045cbd336 drivers: adc: STM32 Add common path
Enable common path for internal voltage voltage
reference source.

Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
2021-05-08 10:18:09 -05:00
Kumar Gala
0b83a7e5ce drivers: gpio: Fixup missed PM conversion
In the power mgmt conversion of void *context to uint32_t *state this
driver got missed and shows build errors with power mgmt is enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-08 09:59:07 -05:00
Carlo Caione
e2333269ae cache: Introduce external cache controller system support
The cache API currently shipped in Zephyr is assuming that the cache
controller is always on-core thus managed at the arch level. This is not
always the case because many SoCs rely on external cache controllers as
a peripheral external to the core (for example PL310 cache controller
and the L2Cxxx family). In some cases you also want a single driver to
control a whole set of cache controllers.

Rework the cache code introducing support for external cache
controllers.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-05-08 07:00:33 +02:00
Armando Visconti
2f01479b56 drivers/sensor: lsm6dso: (FIX) enable interrupt selectively
In a multi-instance driver it may happen that on some h/w
one device should use interrupts and a second device should use
polling mode. So, CONFIG_LSM6DSO_TRIGGER is not enough to discriminmate
if interrupt inizialization routine should be called or not; the choice
is now based whether the "irq-gpios" property is present in the DT
for that particular instance or not.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-07 20:53:47 -04:00
Armando Visconti
cacee210ad drivers/sensor: lsm6dso: move ctx structure inside struct config
Move ctx structure from struct data to struct config, so that
it can be filled at compile time and we could get rid of the bus
init routines.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-07 20:53:47 -04:00
Armando Visconti
99308c514a drivers/sensor: iis2iclx: clean unused leftovers
Remove few unused declarations.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-07 20:53:47 -04:00
Wealian Liao
42aeaccb3e driver: clock: npcx: Add valid clock checking
NPCX clock has some limitations about the frequency range &
synchronization between core clock & other clocks. Add build assert to
check whether NPCX clock setting correct. This also fixed soc_clock.h
to consist with datasheet.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-05-07 20:52:55 -04:00
Flavio Ceolin
0c607adb63 pm: device: Align state names with system states
Change device pm states to the same pattern used by system power
management.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 18:35:12 -04:00
Kumar Gala
27e33e25c9 drivers: modem: Fix build errors on 64-bit platforms
If the modem drivers are built on a 64-bit platform we get errors with
the logging code due to use of size_t.  Update to use %zX to handle this
correctly between 32-bit and 64-bit platforms.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-07 16:08:09 -05:00
Flavio Ceolin
7eba310220 power: device: void *context -> uint32_t *state
The context parameter used across device power management is
actually the power state. Just use it and avoid a lot of
unnecessary casts.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 16:55:31 -04:00
Andy Ross
662b0bf765 drivers/timer: Add x86 APIC TSC_DEADLINE driver
Modern hardware all supports a TSC_DEADLINE mode for the APIC timer,
where the same GHz-scale 64 bit TSC used for performance monitoring
becomes the free-running counter used for cpu-local timer interrupts.
Being a free running counter that does not need to be reset, it will
not lose time in an interrupt.  Being 64 bit, it needs no rollover or
clamping logic in the driver when presented with a 32 bit tick count.
Being a proper comparator, it will correctly trigger interrupts for
times set "in the past" and thus needs no minimum/clamping logic.  The
counter is synchronized across the system architecturally (modulo one
burp where firmware likes to change the adjustment value) so usage is
SMP-safe by default.  Access to the 64 bit counter and comparator
value are single-instruction atomics even on 32 bit systems, so it
beats even the RISC-V machine timer in complexity (which was our
reigning champ for "simplest timer driver").

Really this is just ideal for Zephyr.  So rather than try to add
support for it to the existing APIC driver and increase complexity,
make this a new standalone driver instead.  All modern hardware has
what it needs.  The sole gotcha is that it's not easily emulatable
(qemu supports it only under kvm where they can freeload on the host
TSC) so it can be exercised only on hardware platforms right now.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-05-07 16:48:58 -04:00
Saurabh Jagdhane
7b15b855d7 drivers: memc: Update driver to support XIP on mimxrt685_evk.
Enable XIP based on SoC specific option.

Signed-off-by: Saurabh Jagdhane <saurabh.jagdhane@nxp.com>
2021-05-07 15:44:19 -05:00
Saurabh Jagdhane
721e3406e6 drivers: flash: Enable FlexSPI XIP on mimxrt685_evk.
Move LUT to driver.
Update CMake to include SoC specific driver.
Fix mimxrt685_evk LUT header spacing.

Signed-off-by: Saurabh Jagdhane <saurabh.jagdhane@nxp.com>
2021-05-07 15:44:19 -05:00
Eug Krashtan
793e2c1891 drivers: flash: at45: Add Reset and WP pins
Adding Reset and Write-protect pins initialization during AT45 driver
start-up. Usually these pins are driven high when not used.
The AT45 device incorporates an internal power-on reset circuit, so
there is no initial on-off reset sequence.

Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
2021-05-07 14:57:08 -05:00
Piotr Mienkowski
3632815e2e api: gpio: do not support INT flags in gpio_pin_configure
To keep compatibility between the old GPIO API implementation and a new
one introduced in the Zephyr 2.2.0 release the gpio_pin_configure()
function was accepting interrupt flags. In the new API implementation
interrupt flags are only accepted by gpio_pin_interrupt_configure()
function.

This temporary support for INT flags in gpio_pin_configure should have
been removed in the Zephyr 2.4.0 release.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-05-07 12:42:08 -05:00
Thomas Stranger
8f559a3260 drivers: interrupt_controller: intc_shared: cond. forward sense cell
The shared interrupt controller depended on interrupt-cell sense
to inialize the interrupt using IRQ_CONNECT.
Forward the "sense" property only conditionally to be able to
use the driver all drivers that don't define it.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-07 12:41:04 -05:00
Thomas Stranger
dedd444fb7 drivers: interrupt_controller: intc_shared: clients array size from dts
The size of the array holding the client information is determined
from the number of dt supports dep ordinals.
Finally remove the Kconfig symbol for the number of clients.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-07 12:41:04 -05:00
Thomas Stranger
a0bea0812a drivers: intc: intrc_shared: get client count from SUPPORTS_DEP_ORDS
The intc_shared driver used kconfig to set the number of clients.
This commit changes the driver to determine the number of clients
per instance using supports ordinals information from device tree.

Leave the kconfig symbol for the number of clients, it now only defines
the array size in driver data and therefore an upper limit of how
many clients can be defined in dts.
It will be removed later with changes of driver data struct.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-07 12:41:04 -05:00
Thomas Stranger
23982030a8 drivers: interrupt_controller: intc_shared: convert to multi instance
The intc_shared driver until now had the possibility to enable
up to two instances of the driver using the symbols SHARED_IRQ_0
and SHARED_IRQ_1.
This commit removes those Config options, and instead instantiates the
driver using DT_INST_FOREACH_STATUS_OKAY macro.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-07 12:41:04 -05:00
Alexander Wachter
f1754b19eb drivers: can: Implement stm32fd driver
This driver is the SoC specific implementation of the
Bosch M_CAN IP.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-05-07 12:36:10 -05:00
Alexander Wachter
1c50ef6c43 drivers: can: Implement Bosch M_CAN driver
Implementation of the Bosch M_CAN IP driver.
This driver is just the base for a specific SoC implementation.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-05-07 12:36:10 -05:00
Alexander Wachter
2ccbfd661e drivers: can: Add Kconfig option for CANFD datalenght
Add Kconfig option to select appropriate can data field length

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-05-07 12:36:10 -05:00
Guennadi Liakhovetski
faecc4c235 ipm: cavs: (cosmetic) fix indentation
Add a missing TAB.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-07 12:44:34 -04:00
Rodrigo Brochado
037f994ed2 drivers: flash: Add workaround for anomaly 122 on nrf52840
The energy consumption on nrf52840 is unnecessarily high when
CONFIG_NORDIC_QSPI_NOR is used due to Anomaly 122. The nrf_qspi_nor
driver is unitialize after QSPI usage and initialize before using
it again.

Semaphore objects are used to allow multiple threads exclusive access
and efficient usage.

The main assumption made was that all QSPI API is stateless, in the
sense that it is not required to store any peripheral state before
uninit. Also, the QSPI driver was supposed to be synchronous, except
for the erase operation, in which the nrf signals its start, instead of
its end. While the flash is performing the erase, an uninit followed
by an init doesn't work. For that reason, polling is done before
every uninit.

Tests were made with a simple LittleFS application in a custom board
using flash MX25R3235F and another with the LittleFS flash sample
using nrf52840 DK that has a MX25R6435F. Current consumption dropped
from 630 uA to ~10uA in both cases.

Signed-off-by: Rodrigo Brochado <git.rodrigobrochado@gmail.com>
2021-05-07 10:26:21 -05:00
Xavier Chapron
e845878870 drivers: i2c_nrfx_twi: Add recover when I2C transfer timeout
Previously to this commit, nothing was done to restore the bus to an
healthy level.
However, I2C devices sometimes needs help to recover from an aborted
transaction.
Therefore, we now add a call to nrfx_{twi, twim}_bus_recover().

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2021-05-07 10:24:41 -05:00
U Divya
04b885d4e3 drivers: gpio: Fixed pin number check condition
Fixed check condition for GPIO pin number.
This check is done
before reading or writing value for the pin.

Verified on ehl_crb.

Signed-off-by: U Divya <u.divya@intel.com>
2021-05-07 09:45:50 -04:00
U Divya
86fa606a0c drivers: gpio: Add GPIO driver for Intel Elkhart Lake
Added support for GPIO driver for Intel Elkhart Lake
board.
The GPIO driver will support pin value read/write operations,
pin direction and interrupt configuration. ACPI enumeration
support and support for different GPIO communities is also
present.

Verified on ehl_crb.

Signed-off-by: U Divya <u.divya@intel.com>
2021-05-07 09:45:50 -04:00
U Divya
f6436a14d8 drivers: gpio: Generic GPIO driver for Intel SoC
Modified GPIO driver for Intel APL SoC to have a
generic driver for all Intel SoC.

Signed-off-by: U Divya <u.divya@intel.com>
2021-05-07 09:45:50 -04:00
Tomasz Michalec
d83647dea6 drivers: adc: add ADC emulator
ADC emulator is designed to be used in tests on native_posix board. It
supports 1-16 bit resolution range and all GAINs from enum adc_gain.
Reference voltages and number of emulated channels are set through dts.
Using special API from drivers/adc/adc_emul.h it is possible to set
constant voltage value returned by given ADC channel or set custom
function which allows to simulate complex output.
Also reference voltages can be changed in runtime using the API.

The CL also includes:
- Add adc definitions of ADC emulator in
  tests/drivers/adc/adc_api/src/test_adc.c for supporting test suites.
- Add test for ADC emulator API in tests/drivers/adc/adc_emul/

Signed-off-by: Tomasz Michalec <tm@semihalf.com>
2021-05-07 15:27:37 +02:00
Hake Huang
c1080f3ceb adc: adc dma driver
add dma support to adc driver
add HW trigger dma support
using new dma api to request dma channel

tested on frdm_k82f and frdm_k64f

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-05-07 08:23:49 -05:00
MORGER Patrick
0e1d16bf03 drivers: sensors: smart-battery with SBS 1.1 compliant fuel gauge
Implementation of a SBS 1.1 compliant fuel gauge driver

Signed-off-by: MORGER Patrick <patrick.morger@leica-geosystems.com>
2021-05-07 07:55:23 -05:00
Dong Wang
7989302e6a interrupt_controller: ioapic: support more device power states
do nothing when enter or resume from DEVICE_PM_LOW_POWER_STATE

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
2021-05-07 13:11:14 +02:00
Marcin Niestroj
eb78d70805 drivers: wifi: esp: stop using pkt->work in TX path
Usage of k_work object from within net_pkt results in undefined behavior
in case when net_pkt is deallocated (by net_pkt_unref()) before work has
been finished.

Use per socket k_work object (sock->send_work) to submit send work and
put net_pkt objects onto k_fifo (sock->tx_fifo). Add a helper function
esp_socket_queue_tx() for that, which will make sure that packets are
enqueued only when send work handler will be successfully submitted (so
that all packets are consumed/dereferenced).

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-05-07 13:10:01 +02:00
Aymeric Aillet
c5a057bc63 drivers: serial: add Renesas R-Car driver
This patch add support for polling based UART
on the Renesas R-Car SCIF (Serial Communication Interface
with FIFO)

This hardware block can be found on various Renesas R-Car
SoC series.

It allows to get console on R-Car Gen3 H3ULCB board.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-05-07 13:08:48 +02:00
Krzysztof Chruscinski
6a5d828948 drivers: serial: nrf_uarte: Conditionally call PPI driver
Avoid calling PPI driver when enhanced poll functionality is
disabled. Fixing a case when driver failed to compile when
enhanced poll is disabled for all instances.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-07 12:11:32 +02:00
Erwan Gouriou
47c9ac5c69 drivers/gpio: stm32: Don't perform clock gating with VddIO2
In some cases, VddIO2 is required to get port working.
Looking in details, VddIO2 should be set on start up
but not toggled on/off in PM use cases.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-06 14:31:13 -04:00
Erwan Gouriou
46f33bcd3e drivers/pinmux: stm32: Enable PM_DEVICE_RUNTIME services
Add PM_DEVICE_RUNTIME support

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-06 14:31:13 -04:00
Erwan Gouriou
13de6e3b24 drivers/gpio: stm32: Enable PM_DEVICE services
Implement power mgmt hooks to support PM_DEVICE and
PM_DEVICE_RUNTIME.
In case of PM_DEVICE_RUNTIME, clock is requested for bank writes
so it is requested before configuring and released only if pin
is not configured as output.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-06 14:31:13 -04:00
Marcin Niestroj
b4854debd1 drivers: wifi: esp_at: rename driver from esp
Recently WiFi ESP32 driver (utilizing WiFi radio in ESP32 SoC) was
introduced into drivers/wifi/esp32/ and it already caused confusion as
there was existing drivers/wifi/esp/ directory for ESP-AT
driver (utilizing external WiFi chip, by communicating using AT commands
from any serial capable platform). So question has arisen whether it is
good to merge both, while they are totally different drivers.

Rename ESP-AT driver to be placed in drivers/wifi/esp_at/, so that it is
easier to figure out difference between "esp32" and "esp_at" just by
looking at driver name. Rename also DT compatible and all Kconfig
options for the same reason.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-05-06 13:21:39 -04:00
Glauber Maroto Ferreira
84f599b228 esp32: i2c: fix: fixed error status handling
Fixed error status handling on ESP32's I2C.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-05-06 13:20:45 -04:00
Kieran Mackey
38ed9c885e drivers: dac: added driver for Microchip MCP4725
The MCP4725 is a single channel 12 bit DAC. It is controlled via I2C.

Signed-off-by: Kieran Mackey <kieran.mackey@lairdconnect.com>
2021-05-06 11:07:33 -05:00
Andrzej Głąbek
96f20cfb99 drivers: i2c_nrfx_twim: Remove extra path for zero-length transfers
nrfx 2.5.0 release includes the patch in the nrfx_twim driver that
fixes the driver behavior for zero-length transfers. No need to keep
the same fix in the shim layer.
This effectively reverts cb86a2b306.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-05-06 17:46:14 +02:00
Emil Lindqvist
f3f8af4cc2 drivers: modem: ublox-sara-r4: make reset pin optional
Remove reset pin requirement from devicetree as this
is not required for modem functionality, and is not
used in the driver anyways.

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-05-06 09:44:19 -05:00
Thomas Stranger
04ee034f4b drivers/dma: stm32 fix dmamux request id valid check
The request id is given by the DMA request MUX id which start at offset
1 and are vaid until req_nb + gen_nb.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 09:28:33 -05:00
Jedrzej Ciupis
0923e32fe7 drivers: ieee802154: Udpate nRF IEEE 802.15.4 radio driver
This commit updates the revision of hal_nordic component
and introduces necessary changes to the IEEE 802.15.4 driver
to match latest nRF IEEE 802.15.4 radio driver API.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2021-05-06 08:46:47 -05:00
Andrzej Puzdrowski
df726f5afe drivers/flash/nrf_qspi_nor: fixed bad type casting
nrf_qspi_write_t was used instead of nrf_qspi_readoc_t in casting.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-05-06 08:32:19 -05:00
Mulin Chao
f7f93d2207 driver: uart: npcx: Support APB clock of uart module up to 20MHz.
Suport npcx UART module's APB clock up to 20MHz.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-05-06 08:15:39 -05:00
Mulin Chao
2a86c3ba9d driver: i2c: npcx: support APB clock of i2c modules up to 20MHz.
Support APB clock of npcx i2c modules up to 20MHz and add releted timing
settings.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-05-06 08:15:39 -05:00
Marcin Niestroj
a8e6fc0b83 drivers: wifi: esp: do not wait at the end of ESP chip reset
esp_reset() is called from net_if init function, which holds net_if lock
after commit 24b49f4399 ("net: if: Add locking"). At the end of
esp_reset() there is a blocking wait on `sem_if_up` semaphore. This
semaphore can be release only by esp_init_work(). esp_init_work()
however blocks on net_if operations, because net_if init function (which
invokes esp_reset() underneath) is still holding net_if lock. As a
result there is a deadlock, because esp_reset() and esp_init_work() are
both waiting on each other.

Remove waiting for `sem_if_up`, so that net_if init can exit and release
net_if lock.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-05-06 07:42:55 -05:00
Katsuhiro Suzuki
f8e9b505c9 drivers: spi: sifive: fix bug of transferring multiple bufs
This patch fixes a bug of SPI driver for SiFive FE310.
Current implementation sends/receives only first buffer even if
an user passed two or more struct spi_buf to driver.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2021-05-06 07:41:16 -05:00
Thomas Stranger
136a83ae5c drivers/clock_control: stm32: rename macros to avoid z_ namespace
A few macros used the reserved z_ prefix, this commit refactors
the driver to avoid them.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:36:05 -05:00
Thomas Stranger
743336943a drivers/clock: fix stm32 flash latency calculation in init function
This commit fixes the flash latency calulation in clock_control_init
for stm32wb and stm32wl series:
For these series new_hclk_freq can't be used to set the flash latency,
because the flash clk uses a different prescaler.

Without this fix, the flash latency could be set to an inadequat value
in cases wehere the new AHB3/AHB4 prescaler is different from the
new cpu1 prescler.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:36:05 -05:00
Thomas Stranger
fca13b8de5 drivers/clock_control: stm32 wb, wl: fix missing init of rcc prescalers
This commit adds missing initialization of rcc prescalers for
stm32wb and stm32wl series when hse or hsi are selected as
system clock.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:36:05 -05:00
Thomas Stranger
844277f4aa drivers/clock_control: fix: stm32wb series has only a single msi range
stm32wb only has a single msi clock range, in contrast to wl, l4, l5
which have a second range that is active after exit from standby mode.
This difference must be taken account of in the driver.

This commit abstracts __LL_RCC_CALC_MSI_FREQ macro such that all series
can be supported, additionally the switch to the msirange
(LL_RCC_MSI_EnableRangeSelection) is now only executed on series
that support it.

As a result stm32wb socs can use msi as sysclock.
The same should be done for stm32l0, but this commit series limits
the scope of socs to avoid getting too bloated.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:36:05 -05:00
Thomas Stranger
42a47a58ea drivers/clock: stm32wl config restructure cpu2 prescaler assignment
This commmit restructures the clock_controller code such that the cpu2
prescler assignment later can be excluded for single core socs.

The stm32wl mcu line has variants with a single cortex-m4 core
(stm32wle5), therefore the prescaler for the second clock should
only be set for dual core socs.
This commit still checks for the complete series
(CONFIG_SOC_SERIES_STM32WLX) as the single core variants are not
yet introduced, later the condition should check for a flag like
CONFIG_SOC_STM32WL5X instead.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:36:05 -05:00
Thomas Stranger
f46b20da2f drivers/clock_control: stm32 fix struct wrongly dereferenced
This commit fixes several occurences where a struct members is wrongly
dereferenced, which causes a compile error in case the msi clock is used
as system clock.
Only affects stm32wb and stm32wl with MSI selected as sysclock.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:36:05 -05:00
Thomas Stranger
0014193193 drivers/dma: stm32 dmamux: use util_listify to gen. func/dma_chan arrays
This commit continues simplifying the generation of
isActiveFlag/clearFlag funtion pointer array for the request generators
and does the same for the table_ll_channel.
Additionally move struct dmamux_stm32_channel to c file.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:10:02 -05:00
Thomas Stranger
d7fb6fa9f1 drivers/dma: stm32 dmamux: fix isActiveFlag/clearFlag function array len
This commit uses dt property dma-channels instead of ll defines to
make sure every soc has correct number of function pointers defined.

While commit 5f6218a tried to fix this for g0 series, this caused
regression for other series(e.g. stm32g431). Using UTIL_LISTIFY and
dt properties this should finally be fixed and reduce boilerplate code.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:10:02 -05:00
Arne Edholm
2b864edbcd serial: nrfx_uarte: check size before writing to buffer
NRFX UARTE would write to user supplied buffer on IRQ without checking
whether or not the supplied buffer had available space left to write
one char

Signed-off-by: Arne Edholm <arne.edholm@assaabloy.com>
2021-05-06 11:34:50 +02:00
Mahesh Mahadevan
84e7807190 drivers: timer: MXRT600 OS timer to wake platform from deep sleep
Enable OS Timer interrupt to wake up platform from deep sleep
mode

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-05-05 22:28:44 -05:00
Joakim Andersson
597080204e drivers: Bluetooth: Update H5 driver to new delayable work API.
Update the Bluetooth H5 driver to use the new delayable work API.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-05-05 19:44:09 -04:00
Gerard Marull-Paretas
56f1a8ce98 pm: rename PM_DEVICE_GET/SET_POWER_STATE to PM_DEVICE_STATE_GET/SET
Adjust name to be consistent with device PM naming conventions.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas
7988ab4a26 pm: rename device_set/get_power_state to pm_device_set/get
Make name consistent with other device PM APIs.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas
dbf46b3815 pm: rename device_pm_cb to pm_device_cb
Prefix all device PM functions/data structures with pm.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas
2c7b763e47 pm: replace DEVICE_PM_* states with PM_DEVICE_*
Prefix device PM states with PM.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas
3863be02a5 drivers: replace power/power.h with pm/device.h
Drivers need access to the device PM API, so just include pm/device.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Erwan Gouriou
07e5644ac6 drivers/pwm: stm32: Leftovers in clock_control conversion to dts
Fix omissions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-05 16:51:02 -05:00
Erwan Gouriou
edaeef1cea drivers/clock_control: stm32h7_m4: Don't rely on rcc "clocks" property
In prts of the code, we use rcc node "clocks" property to testify the
use of device tree for clocks configuration.
This doesn't work in case of stm32h7 m4 targets as for those,
"upstream rcc" clock configuration, such as sysclk source selection,
is done on m7 core and hence rcc node doesn't have a "clocks"
property.
To work around this, use alternate "d1cpre" property in case of
stm32h7 targets.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-05 16:34:37 -05:00
Erwan Gouriou
05b7476664 drivers/clock_control: stm32mp1: Exclude deprecated symbols definition
Cortex-M4 stm32mp1 zephyr relies on chip Cortex-A for clock
configuration.
No change is then required for conversion to dts based clocks
configuration, but we do need to exclude use of newly deprecated
Kconfig symbols.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-05 16:34:37 -05:00
Erwan Gouriou
6d33d6944b drivers/clock_control: stm32: Add CLOCK_CONTROL_STM32_HAS_DTS
Add new symbol CLOCK_CONTROL_STM32_HAS_DTS to exclude definition
of other CLOCK_CONTROL_STM32_* symbols when dts based configuration
is in use.
CLOCK_CONTROL_STM32_HAS_DTS is defined based on availability of
"clocks" property in rcc node.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-05 16:34:37 -05:00
Erwan Gouriou
e1f9d8ead4 drivers/clock_control: stm32: Move CLOCK_STM32_HSE_CLOCK definition
Symbol CLOCK_STM32_HSE_CLOCK will remain in use in context of stm32
clock_control configuration using device tree, cf commit
a7989f64a3.

In preparation for next change, separate it from the others symbols
definition. Also make it non dependent from other Kconfig symbols.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-05 16:34:37 -05:00
Ryan Erickson
5af20cd258 drivers: modem: hl7800: fix fault with IPv6 address
If modem receives an IPv6 address, buffer overrun
would occur. Fix this by checking string length to
ensure what type of IP address needs to be parsed.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-05-05 13:39:50 -05:00
Ryan Erickson
c9b8f89b80 drivers: modem: hl7800: fix potential buffer overrrun
Correct destination buffer size when processing
RX messages from modem.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-05-05 13:39:50 -05:00
Kumar Gala
293802c407 sensor: max17262: Fix CI build failure
device_pm_control_nop has been marked deprecated so we get a CI
build error due to its use.  Replace with NULL to fix the issue.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-05 14:13:21 -04:00
Kumar Gala
6f8f08a6a3 drivers: i2s: i2s_sam_ssc: Fix build issue
Change to make i2s_config const missed a case in the SAM driver.
Without this we get build errors when building in CI.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-05 13:01:01 -05:00
Jennifer Williams
ca75bbef3c tests: boot_time: remove all the code and instrumentation feeding into test
Remove the config BOOT_TIME_MEASUREMENT and corresponding #ifdef'd code
throughout (kernel/init.c, idle.c, core/common.S , reset.S, ... ) which
hold the extern hooks for z_timestamp_main and z_timestamp_idle in the
removed boot_time test suite.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2021-05-05 10:41:15 -04:00
Gerson Fernando Budke
d999531f7f drivers: spi: Add cypress PSoC-6 scb spi driver
Add Cypress PSoC-6 SCB[spi] driver.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-05-05 16:01:28 +02:00
Gerson Fernando Budke
7a1f26b005 drivers: ieee802154: rf2xx: Add pan coordinator mode
Enable pan coordinator mode.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-05 15:55:45 +02:00
Gerson Fernando Budke
0ae119ef3f drivers: ieee802154: rf2xx: Add promiscuous mode
The current rf2xx driver not implement any configuration.  Add
the minimal structre to implement rf2xx driver configuration and
implement IEEE802154_CONFIG_PROMISCUOUS mode.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-05 15:55:45 +02:00
Gerson Fernando Budke
2f3644ee0c drivers: ieee802154: rf2xx: Add tx mode CCA
Configure transceiver to create a 0 period backoff and perform only one
time the CCA without transmission retires for failures.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-05 15:55:45 +02:00
Gerson Fernando Budke
195800145e drivers: ieee802154: rf2xx: Add tx mode direct
The current RF2XX driver only support IEEE802154_TX_MODE_CSMA_CA.  Add
IEEE802154_TX_MODE_DIRECT to allow transmit packets immediately without
performing random backoff, CCA and retransmission process.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-05 15:55:45 +02:00
Matija Tudan
d2c503f202 sensor: add MAX17262 fuel gauge driver and sample application
The MAX17262 is an ultra-low power fuel-gauge IC which implements the
Maxim ModelGauge m5 algorithm. The IC monitors a single-cell battery
pack and supports internal current sensing for up to 3.1A pulse
current. The IC provides best performance for batteries with 100mAhr
to 6Ahr capacity.

Signed-off-by: Matija Tudan <mtudan@mobilisis.hr>
2021-05-05 15:54:29 +02:00
Tim Lin
caa3328cc7 ite: drivers/pinmux: modify pinmux driver
Modify the pinmux control method and add support the fun3
& fun4 alternation function.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-05-05 08:45:16 -04:00
Fabio Baltieri
525a235fb3 clock_control: stm32f1: fix STM32_PLL_XTPRE check
This is always defined since:

755d09e149 include/drivers/clock_control: stm32: Update for STM32F1
support

So the condition has currently no effect and causes the prescaler to
always be set to /2.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-05-05 08:42:53 -04:00
Eduardo Montoya
a47677da06 net: openthread: add CSL transmitter API
This commit implements the OpenThread APIs to pass MAC keys and
frame counter to the radio layer in order to process the
transmission security. This is needed for the correct functioning
of a CSL transmitter.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2021-05-05 14:33:47 +02:00
Raphael Löffel
3abd88a64e drivers/flash: stm32h7: Fixed range validation
The range validation routine is not able to detect unaligned memory
blocks as it should.

Signed-off-by: Raphael Löffel <loeffel@rte-ag.ch>
2021-05-05 11:00:20 +02:00
Armando Visconti
f0332eb5d3 drivers/sensor: iis2dlpc: use common stmemsc routine
This commit aligns iis2dlpc sensor driver to latest multi
instance sensor driver model.

In particular:

    1. make use of some few DT helpers:
        - get bus devices with DEVICE_DT_GET
        - get SPI information with SPI_CONFIG_DT_INST
        - get drdy gpios with GPIO_DT_SPEC_GET

    2. make use of the stmemsc common routines and move ctx
       handler inside struct config, so that the bus_init
       routines can be totally avoided.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-04 22:41:56 -04:00
Göran Weinholt
afc8c2528e drivers: flash: stm32h7x: handle ECC errors on read
The STM32H7x flash has an integrated ECC that can correct single
errors and detect double errors. When a double ECC error is detected,
the DBECCERR1/2 flag is raised and there is a bus fault.

We now mask this bus fault and check the error flags. ECC errors are
logged with the offset of the data. Single ECC errors cause a warning
to be logged and double ECC errors return -EIO.

Fixes #33140.

Signed-off-by: Göran Weinholt <goran.weinholt@endian.se>
2021-05-04 13:03:31 -05:00
Erwan Gouriou
7ce1d02ba6 drivers/clock_control: stm32f1: Add explicit case for PLL source HSI
Now that we have specific bindings for STM32F100 devices,
we need dedicated treatment for PLL source HSI case.
Otherwise, we end up using undefined symbol STM32_PLL_PREDIV1.

Please note that previous code compiled, it was assigning
a wrong value to prediv. This had no consequence because
prediv value is forced in Cube LL functions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-04 13:02:26 -05:00
Erwan Gouriou
785ecf0991 drivers/clock_control: stm32f1: Deal with stm32f100xx devices
According to RM0041.pdf clock tree for stm32f100xx devices is
different from both STM32F10X density and connectivity lines devices,
but is a combination of both.

Rework symbols definitions so that STM32F100xx is neither of those
and uses:
- CLOCK_STM32_PLL_MULTIPLIER as on SOC_STM32F10X_DENSITY_DEVICE
- CLOCK_STM32_PLL_PREDIV1 as on SOC_STM32F10X_CONNECTIVITY_LINE_...

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-04 13:02:26 -05:00
Martí Bolívar
5cb95c4ce6 drivers: led_gpio: minor tweaks
Two minor tweaks and a semantics change:

- fix a whitespace nit
- use gpio_pin_configure_dt()
- turn the LED on in case the percentage is nonzero

The last change patterns this driver after behavior in the Android
lights HAL, which recommends analogous behavior when the user requests
a color change in a non-RGB LED:

    Do your best here. [...] If you can only do on or off, 0 is off,
    anything else is on.

    https://source.android.com/reference/hal/structlight__state__t

I think this behavior makes more sense.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-04 16:01:30 +02:00
Mahesh Mahadevan
cccb15e687 drivers: flash: MCUX: Split the relocate define based on target memory
Use the CODE_DATA_RELOCATION_SRAM config to indentify code relocated
to SRAM so we can setup the MPU for the SRAM region used for code
relocation.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-05-04 15:46:52 +02:00
Armando Visconti
4da8a13d76 drivers/i2s/ i2s_ll_stm32.c: Fix wrong DMA burst length value
'0' is not a valid value for DMA burst length. Set it to '1'
to perform a SINGLE transfer.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-04 08:33:46 -05:00